/* =============================================
   RBB Gallery — Elementor widget
   Scoped under .rbb-gallery so it works without the theme.
   Colors below are only fallbacks; override them per-instance
   from the widget's Style tab. Font is inherited from the site.
   ============================================= */

.rbb-gallery {
  --color-bg: #FAFAF8;
  --color-surface: #FFFFFF;
  --color-text: #1A1A1A;
  --color-text-muted: #6B6B6B;

  --color-brick: #E04F2A;
  --color-brick-light: #FFF0EB;

  --color-foundation: #2D6A4F;
  --color-foundation-light: #EDF7F2;

  --color-tech: #1B4965;
  --color-tech-light: #EDF4F8;

  --color-border: #E8E8E4;
  --color-border-light: #F0F0EC;

  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.04);
  --shadow-md: 0 4px 20px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.08);

  --ease: cubic-bezier(.4, 0, .2, 1);

  direction: rtl;
  color: var(--color-text);
  font-family: 'Kalameh';
}

.rbb-gallery *,
.rbb-gallery *::before,
.rbb-gallery *::after {
  box-sizing: border-box;
}

.rbb-gallery h1,
.rbb-gallery h2,
.rbb-gallery h3,
.rbb-gallery h4 {
  margin: 0;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.02em;
}

.rbb-gallery p { margin: 0; }

.rbb-gallery .eyebrow {
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--color-brick);
  margin-bottom: 12px;
}

.rbb-gallery .tag {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 8px;
}
.rbb-gallery .tag--foundation { background: var(--color-foundation-light); color: var(--color-foundation); }
.rbb-gallery .tag--tech { background: var(--color-tech-light); color: var(--color-tech); }

/* ---- Hero ---- */

.rbb-gallery .gallery-hero {
  padding: 24px 0 56px;
  text-align: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(224, 79, 42, .12), transparent 28%),
    radial-gradient(circle at 84% 12%, rgba(42, 111, 151, .12), transparent 30%),
    var(--color-bg);
}

.rbb-gallery .gallery-hero__inner {
  max-width: 760px;
  margin-inline: auto;
}

.rbb-gallery .gallery-hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
}

.rbb-gallery .gallery-hero p:not(.eyebrow) {
  color: var(--color-text-muted);
  font-size: 1.0625rem;
  max-width: 620px;
  margin-inline: auto;
}

.rbb-gallery .year-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 36px;
}

.rbb-gallery .year-filter--top {
  margin: 0 0 40px;
}

.rbb-gallery .year-filter a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 10px 18px;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  background: rgba(255,255,255,.72);
  color: var(--color-text-muted);
  font-size: .875rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all .25s var(--ease);
}

.rbb-gallery .year-filter a:hover {
  border-color: var(--color-brick);
  color: var(--color-brick);
  transform: translateY(-1px);
}

/* ---- Year sections ---- */

.rbb-gallery .gallery-page { padding: 24px 0 32px; }

.rbb-gallery .year-section { scroll-margin-top: 24px; }

.rbb-gallery .year-section + .year-section {
  margin-top: 72px;
  padding-top: 72px;
  border-top: 1px solid var(--color-border);
}

.rbb-gallery .year-section__head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 32px;
}

.rbb-gallery .year-section__head span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  height: 44px;
  padding: 0 18px;
  background: #eb6733;
  color: #fff;
  border-radius: 100px;
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.rbb-gallery .year-section__head h2 { font-size: clamp(1.4rem, 4vw, 2rem); }

/* ---- Album cards ---- */

.rbb-gallery .album-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.rbb-gallery .album-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  padding-bottom: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}

.rbb-gallery .album-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-border);
  box-shadow: var(--shadow-lg);
}

.rbb-gallery .album-card.is-active {
  border-color: var(--color-brick);
  box-shadow: 0 14px 42px rgba(42, 224, 175, 0.14);
}

.rbb-gallery .album-card.is-active::after {
  content: 'در حال نمایش';
  position: absolute;
  top: 26px;
  right: 26px;
  z-index: 5;
  padding: 6px 12px;
  border-radius: 100px;
  background: var(--color-brick);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
}

.rbb-gallery .album-card__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  isolation: isolate;
  align-items: center;
  text-decoration: none;
}

.rbb-gallery .album-card__photo,
.rbb-gallery .album-card__stack {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.rbb-gallery .album-card__photo {
  z-index: 3;
  overflow: hidden;
  margin: 14px 14px 0 14px;
  border-radius: calc(var(--radius-xl) - 10px);
}

.rbb-gallery .album-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rbb-gallery .album-card__photo:not(.has-img)::before,
.rbb-gallery .album-card__photo:not(.has-img)::after {
  content: '';
  position: absolute;
  border-radius: 999px;
}

.rbb-gallery .album-card__photo:not(.has-img)::before {
  width: 44%; height: 44%; right: 9%; bottom: 12%;
  background: rgba(255,255,255,.46);
}

.rbb-gallery .album-card__photo:not(.has-img)::after {
  width: 28%; height: 28%; left: 12%; top: 14%;
  background: rgba(255,255,255,.32);
}

.rbb-gallery .album-card__photo--robotics {
  background:
    linear-gradient(135deg, rgba(27,73,101,.92), rgba(42,111,151,.7)),
    repeating-linear-gradient(45deg, transparent 0 18px, rgba(255,255,255,.09) 18px 20px);
}
.rbb-gallery .album-card__photo--robotics-alt {
  background:
    linear-gradient(135deg, rgba(42,111,151,.92), rgba(224,79,42,.72)),
    radial-gradient(circle at 22% 28%, rgba(255,255,255,.4), transparent 20%);
}
.rbb-gallery .album-card__photo--creative {
  background:
    linear-gradient(135deg, rgba(224,79,42,.86), rgba(233,196,106,.78)),
    radial-gradient(circle at 68% 32%, rgba(255,255,255,.42), transparent 18%);
}
.rbb-gallery .album-card__photo--class {
  background:
    linear-gradient(135deg, rgba(45,106,79,.9), rgba(64,145,108,.72)),
    radial-gradient(circle at 26% 64%, rgba(255,255,255,.38), transparent 22%);
}
.rbb-gallery .album-card__photo--coding {
  background:
    linear-gradient(135deg, rgba(26,26,26,.92), rgba(27,73,101,.82)),
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(255,255,255,.08) 26px 28px);
}
.rbb-gallery .album-card__photo--story {
  background:
    linear-gradient(135deg, rgba(233,196,106,.94), rgba(244,162,97,.75)),
    radial-gradient(circle at 72% 70%, rgba(255,255,255,.42), transparent 20%);
}
.rbb-gallery .album-card__photo--summer {
  background:
    linear-gradient(135deg, rgba(64,145,108,.84), rgba(233,196,106,.82)),
    radial-gradient(circle at 22% 22%, rgba(255,255,255,.46), transparent 18%);
}

.rbb-gallery .album-card__stack {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
  margin: 14px 14px 0 14px;
  border-radius: calc(var(--radius-xl) - 10px);
}
.rbb-gallery .album-card__stack--one { z-index: 2; transform: rotate(-2.5deg) translate(8px, 8px); }
.rbb-gallery .album-card__stack--two { z-index: 1; transform: rotate(2.5deg) translate(-8px, 10px); }

.rbb-gallery .album-card__count {
  position: absolute;
  z-index: 4;
  left: 28px;
  bottom: 14px;
  padding: 7px 12px;
  border-radius: 100px;
  background: rgba(255,255,255,.9);
  color: var(--color-text);
  font-size: .75rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.rbb-gallery .album-card__body { padding: 26px 28px 30px; }
.rbb-gallery .album-card__body h3 { font-size: 1.2rem; margin-bottom: 8px; }
.rbb-gallery .album-card__body p { color: var(--color-text-muted); font-size: .9rem; line-height: 1.7; }

/* ---- Album viewer ---- */

.rbb-gallery .album-viewer {
  scroll-margin-top: 24px;
  margin-top: 72px;
  padding: 40px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.rbb-gallery .album-viewer__empty {
  min-height: 260px;
  display: grid;
  place-items: center;
  text-align: center;
  align-content: center;
}

.rbb-gallery .album-viewer__empty span,
.rbb-gallery .album-viewer__tag {
  display: inline-flex;
  width: fit-content;
  margin-inline: auto;
  margin-bottom: 10px;
  padding: 5px 12px;
  border-radius: 100px;
  background: var(--color-brick-light);
  color: var(--color-brick);
  font-size: .75rem;
  font-weight: 800;
}

.rbb-gallery .album-viewer__empty p,
.rbb-gallery .album-viewer__head p { color: var(--color-text-muted); }

.rbb-gallery .album-viewer__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--color-border-light);
}

.rbb-gallery .album-viewer__tag { margin-inline: 0; }
.rbb-gallery .album-viewer__head h2 { margin-bottom: 10px; }
.rbb-gallery .album-viewer__head p { max-width: 620px; }

.rbb-gallery .album-viewer__meta {
  min-width: 132px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  text-align: center;
}

.rbb-gallery .album-viewer__meta strong {
  display: block;
  color: var(--color-brick);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}

.rbb-gallery .album-viewer__meta span {
  color: var(--color-text-muted);
  font-size: .78rem;
  font-weight: 600;
}

.rbb-gallery .album-photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.rbb-gallery .album-photo {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}

.rbb-gallery .album-photo:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: var(--shadow-md);
}

.rbb-gallery .album-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rbb-gallery .album-photo--placeholder::before,
.rbb-gallery .album-photo--placeholder::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  background: rgba(255,255,255,.28);
}
.rbb-gallery .album-photo--placeholder::before { width: 44%; height: 44%; right: 10%; bottom: 12%; }
.rbb-gallery .album-photo--placeholder::after { width: 24%; height: 24%; left: 12%; top: 14%; }

.rbb-gallery .album-photo span {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  color: var(--color-text);
  font-size: .78rem;
  font-weight: 800;
}

.rbb-gallery .album-photo--robotics { background: linear-gradient(135deg, rgba(27,73,101,.96), rgba(42,111,151,.72)); }
.rbb-gallery .album-photo--robotics-alt { background: linear-gradient(135deg, rgba(42,111,151,.96), rgba(224,79,42,.72)); }
.rbb-gallery .album-photo--creative { background: linear-gradient(135deg, rgba(224,79,42,.92), rgba(233,196,106,.78)); }
.rbb-gallery .album-photo--class { background: linear-gradient(135deg, rgba(45,106,79,.94), rgba(64,145,108,.74)); }
.rbb-gallery .album-photo--coding { background: linear-gradient(135deg, rgba(26,26,26,.96), rgba(27,73,101,.82)); }
.rbb-gallery .album-photo--story { background: linear-gradient(135deg, rgba(233,196,106,.96), rgba(244,162,97,.76)); }
.rbb-gallery .album-photo--summer { background: linear-gradient(135deg, rgba(64,145,108,.9), rgba(233,196,106,.82)); }

.rbb-gallery .rbb-album-source { display: none; }

/* ---- Lightbox (appended to <body>) ---- */

body.rbb-lightbox-open { overflow: hidden; }

.rbb-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: rgba(15, 15, 15, .92);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.rbb-lightbox.is-open { display: flex; }

.rbb-lightbox__img {
  max-width: 90vw;
  max-height: 86vh;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}

.rbb-lightbox__close,
.rbb-lightbox__nav {
  position: absolute;
  display: grid;
  place-items: center;
  border: none;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  transition: background .2s ease, transform .2s ease;
}

.rbb-lightbox__close:hover,
.rbb-lightbox__nav:hover { background: rgba(255, 255, 255, .25); }

.rbb-lightbox__close {
  top: 22px;
  left: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
}

.rbb-lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 30px;
  line-height: 1;
}

.rbb-lightbox__nav:hover { transform: translateY(-50%) scale(1.05); }

.rbb-lightbox__prev { right: 24px; }
.rbb-lightbox__next { left: 24px; }

.rbb-lightbox--single .rbb-lightbox__nav { display: none; }

@media (max-width: 600px) {
  .rbb-lightbox { padding: 16px; }
  .rbb-lightbox__nav { width: 42px; height: 42px; font-size: 24px; }
}

/* ---- Responsive ---- */

@media (max-width: 1024px) {
  .rbb-gallery .album-grid { grid-template-columns: 1fr; }
  .rbb-gallery .album-photo-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .rbb-gallery .year-section__head { flex-direction: row; align-items: center; gap: 12px; }
  .rbb-gallery .album-viewer { padding: 28px; }
  .rbb-gallery .album-viewer__head { flex-direction: column; }
  .rbb-gallery .album-viewer__meta { width: 100%; }
  .rbb-gallery .album-photo-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .rbb-gallery .album-photo-grid { grid-template-columns: 1fr; }
}
