/* =====================================================================
   پارس پگاه تجارت — صفحهٔ گالری تصاویر (۵ کشور)
   gallery.css — وابسته به main.css (توکن‌ها + ناوبری + فوتر + دکمه‌ها)
   ─────────────────────────────────────────────────────────────────────
   • ساختار صفحه: هیروی فشرده → فیلتر کشورها + نوارهای متحرک
     (مارکی تمام‌عرض، الهام‌گرفته از «Direkt vom Drehtag» در darkcrown.de)
     → پنل دعوت → فوتر
   • نوار متحرک: چند ردیف با جهت‌های متناوب؛ حرکت با CSS روی
     GPU/compositor (translate3d) — توقف با هاور/فوکس، توقف
     هنگام لایت‌باکس و خارج از دید. سرعت ردیف‌ها از خودِ سایت
     مرجع darkcrown.de استخراج شده (۴۸–۵۸px/s).
   • کارت‌ها: ارتفاع ثابت ردیف + نسبتِ طبیعی عکس (بدون کراپ) —
     عکس‌های عمودی و افقی کنار هم مثل نوار فیلم می‌نشینند.
   • بهینه‌سازی روانی: شیمر فقط تا قبل از لود عکس روشن است
     (.is-loaded خاموشش می‌کند) و ردیف‌های خارج از دید کاملاً
     می‌ایستند — بعد از لود اولیه، هیچ repaint مداومی وجود ندارد.
   ===================================================================== */

/* ─────────────────────────── ۱) هیروی گالری ─────────────────────────── */
.g-hero { padding: clamp(46px, 7vw, 92px) 0 clamp(30px, 4vw, 48px); }

.g-hero__badge {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid rgba(43, 224, 166, 0.3);
  background: rgba(43, 224, 166, 0.07);
  color: #b6efe0; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em;
}

.g-hero__title { margin-top: 18px; max-width: 21ch; }

.g-hero__latin {
  display: block;
  font-family: var(--latin, Georgia, serif); font-style: italic; font-weight: 500;
  font-size: clamp(0.85rem, 1.4vw, 1.05rem);
  color: var(--muted-2, #7e8680); letter-spacing: 0.24em; margin-top: 14px;
}

.g-hero__lead { margin-top: 14px; max-width: 62ch; }

/* ردیف آمار — اعداد سریف با گرادیان فلزی (هم‌خانوادهٔ بخش رکورد طرح مرجع) */
.g-stats {
  display: flex; flex-wrap: wrap; gap: clamp(26px, 5vw, 64px);
  margin-top: clamp(26px, 4vw, 44px);
  padding-top: clamp(20px, 3vw, 30px);
  border-top: 1px solid var(--hair, rgba(255, 255, 255, 0.08));
}
.g-stat { min-width: 0; }
.g-stat__num {
  font-family: var(--serif, Georgia, serif); font-weight: 600;
  font-size: clamp(2.3rem, 5.4vw, 3.6rem); line-height: 1;
  background: var(--metal, linear-gradient(180deg, #fff, #71757e));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  display: flex; align-items: baseline; gap: 2px;
}
.g-stat__num .ac {
  background: var(--teal-grad, linear-gradient(180deg, #8ff5d0, #0fb483));
  -webkit-background-clip: text; background-clip: text;
}
.g-stat__label { margin-top: 8px; font-size: 0.82rem; color: var(--muted, #9ba3a0); }

/* ───────────────────── ۲) نوار ابزار: فیلتر کشورها ───────────────────── */
.g-toolbar { padding-top: clamp(10px, 2vw, 20px); }

.g-chips {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 6px;
}
.g-chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 18px; border-radius: 999px;
  border: 1px solid var(--hair, rgba(255, 255, 255, 0.1));
  background: transparent; color: var(--muted, #9ba3a0);
  font-family: inherit; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.3s var(--ease, ease), border-color 0.3s var(--ease, ease),
    background-color 0.3s var(--ease, ease), transform 0.25s var(--ease-out, ease);
}
.g-chip:hover { color: var(--ink, #f5f7f5); border-color: rgba(43, 224, 166, 0.35); }
.g-chip:active { transform: scale(0.97); }
.g-chip:focus-visible {
  outline: 2px solid rgba(43, 224, 166, 0.55); outline-offset: 3px;
}
.g-chip.is-active {
  color: #b6efe0;
  border-color: rgba(43, 224, 166, 0.45);
  background: rgba(43, 224, 166, 0.09);
}
.g-chip__n {
  min-width: 26px; padding: 1px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.72rem; font-weight: 700; text-align: center;
  color: var(--muted-2, #7e8680);
  transition: color 0.3s var(--ease, ease), background-color 0.3s var(--ease, ease);
}
.g-chip.is-active .g-chip__n { color: var(--teal, #2be0a6); background: rgba(43, 224, 166, 0.12); }

/* خط وضعیت + راهنمای تعامل */
.g-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px;
  margin-top: 16px; font-size: 0.82rem; color: var(--muted, #9ba3a0);
}
.g-meta__dot {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto;
  background: var(--teal, #2be0a6);
  box-shadow: 0 0 12px rgba(43, 224, 166, 0.9);
}
.g-meta__hint { color: var(--muted-2, #7e8680); font-size: 0.76rem; }
.g-meta__hint svg { width: 13px; height: 13px; vertical-align: -2px; margin-inline-end: 4px; }

/* ───────────────────── ۳) نوارهای متحرک (مارکی) ───────────────────── */
.g-rows {
  --g-row-h: clamp(200px, 23vw, 290px);
  display: grid; gap: 16px;
  margin-top: clamp(22px, 3vw, 34px);
  transition: opacity 0.26s var(--ease, ease), transform 0.26s var(--ease, ease);
}
.g-zone.is-swap .g-rows { opacity: 0; transform: translateY(12px); }
.g-zone.is-swap .g-meta { opacity: 0.35; }
.g-meta { transition: opacity 0.26s var(--ease, ease); }

/* قاب هر ردیف — تمام‌عرض با محو لبه‌ها (مانند طرح مرجع) */
.g-strip {
  direction: ltr; /* ریاضی مارکی قابل‌پیش‌بینی؛ کارت‌ها داخل خود RTL می‌مانند */
  overflow: hidden;
  contain: paint;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

/* ریل متحرک: چند کپیِ محتوا پشت‌سرهم؛ حلقه با translate3d(-50٪)
   بی‌درز است و کاملاً روی GPU اجرا می‌شود (مستقل از main thread) */
.g-track {
  display: flex; width: max-content; height: var(--g-row-h);
  will-change: transform;
  animation: g-flow var(--dur, 80s) linear infinite;
}
.g-strip:nth-child(even) .g-track { animation-direction: reverse; }
@keyframes g-flow {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

/* توقف: هاور / فوکسِ کیبورد روی ردیف */
.g-strip:hover .g-track,
.g-strip:focus-within .g-track { animation-play-state: paused; }
/* توقف: لایت‌باکس باز است */
.g-zone.is-frozen .g-track { animation-play-state: paused; }
/* توقف: ردیف خارج از دید صفحه (صرفه‌جویی CPU) */
.g-strip.is-off .g-track { animation-play-state: paused; }

/* هر کپی: عرض max-content؛ کارت‌ها حاشیهٔ خودشان را می‌برند → -50٪ دقیقاً یک کپی */
.g-copy { display: flex; width: max-content; flex: 0 0 auto; }

/* ── کارت تصویر: ارتفاع ردیف + نسبت طبیعی (بدون کراپ) ── */
.g-card {
  position: relative; flex: 0 0 auto;
  height: 100%; aspect-ratio: var(--ar, 3 / 2);
  margin-right: 14px;
  padding: 0; border: 1px solid var(--hair, rgba(255, 255, 255, 0.08));
  border-radius: 14px; overflow: hidden;
  background:
    linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.04) 50%, transparent 70%)
      var(--panel, #0c0f0d);
  background-size: 220% 100%;
  cursor: pointer; direction: rtl;
  box-shadow: 0 18px 44px -26px rgba(0, 0, 0, 0.9);
  -webkit-tap-highlight-color: transparent;
  animation: g-shimmer 1.6s var(--ease, ease) infinite;
  transition: transform 0.35s var(--ease-out, ease), border-color 0.3s var(--ease, ease),
    box-shadow 0.35s var(--ease, ease);
}
@keyframes g-shimmer {
  0% { background-position: 130% 0; }
  100% { background-position: -30% 0; }
}
.g-card img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 50%;
  display: block; opacity: 0;
  transition: opacity 0.5s var(--ease, ease), transform 0.6s var(--ease, ease);
}
.g-card img.is-in { opacity: 1; }
.g-card.is-broken img { display: none; }
.g-card.is-broken { animation: none; cursor: default; }
/* توقف شیمر بعد از لود عکس — دیگر هیچ repaint مداومی روی کارت نیست */
.g-card.is-loaded { animation: none; }
/* ردیف خارج از دید: توقف کامل هر دو انیمیشن (حرکت + شیمر) */
.g-strip.is-off .g-card { animation-play-state: paused; }

/* هاور/فوکس کارت: بالا آمدن + بزرگ‌شدن نرم عکس + پردهٔ تیره */
.g-card:hover,
.g-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(43, 224, 166, 0.4);
  box-shadow: 0 26px 60px -28px rgba(0, 0, 0, 0.95),
    0 0 40px -14px rgba(43, 224, 166, 0.35);
}
.g-card:focus-visible { outline: 2px solid rgba(43, 224, 166, 0.55); outline-offset: 3px; }
.g-card:hover img.is-in,
.g-card:focus-visible img.is-in { transform: scale(1.045); }

.g-card__veil {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(0deg, rgba(5, 6, 5, 0.62), transparent 42%);
  opacity: 0; transition: opacity 0.35s var(--ease, ease);
}
.g-card:hover .g-card__veil,
.g-card:focus-visible .g-card__veil { opacity: 1; }

/* بج نام کشور روی کارت */
.g-card__tag {
  position: absolute; bottom: 10px; inset-inline-start: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  background: rgba(5, 6, 5, 0.55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(43, 224, 166, 0.35);
  color: #c9f4e4; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.3s var(--ease, ease), transform 0.35s var(--ease-out, ease);
}
.g-card:hover .g-card__tag,
.g-card:focus-visible .g-card__tag { opacity: 1; transform: translateY(0); }

/* دکمهٔ بزرگ‌نمایی مرکزی */
.g-card__zoom {
  position: absolute; top: 50%; left: 50%; z-index: 2;
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 6, 5, 0.5);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid rgba(43, 224, 166, 0.5);
  color: var(--ink, #f5f7f5);
  box-shadow: 0 14px 36px -12px rgba(0, 0, 0, 0.8);
  transform: translate(-50%, -50%) scale(0.82);
  opacity: 0;
  transition: opacity 0.3s var(--ease, ease), transform 0.35s var(--ease-out, ease);
}
.g-card__zoom svg { width: 17px; height: 17px; }
.g-card:hover .g-card__zoom,
.g-card:focus-visible .g-card__zoom { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ───────────────────────── ۴) پنل دعوت ───────────────────────── */
.g-cta { padding: clamp(56px, 8vw, 110px) 0 clamp(64px, 9vw, 120px); }

.g-cta__panel {
  position: relative; overflow: hidden;
  border-radius: var(--radius, 18px);
  border: 1px solid rgba(43, 224, 166, 0.28);
  background:
    radial-gradient(90% 120% at 85% -10%, rgba(43, 224, 166, 0.13), transparent 55%),
    radial-gradient(60% 90% at 8% 110%, rgba(223, 181, 79, 0.08), transparent 55%),
    var(--panel, #0c0f0d);
  box-shadow: 0 40px 90px -50px rgba(43, 224, 166, 0.4);
  padding: clamp(28px, 5vw, 56px);
  text-align: center;
}
.g-cta__panel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(700px 300px at 50% -20%, rgba(43, 224, 166, 0.15), transparent 60%);
}
.g-cta__panel > * { position: relative; }
.g-cta__title { max-width: 24ch; margin-inline: auto; }
.g-cta__lead { max-width: 56ch; margin: 14px auto 0; }
.g-cta__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 28px; }

/* ───────────────────────── ۵) لایت‌باکس ───────────────────────── */
.g-lb {
  position: fixed; inset: 0; z-index: 300;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: clamp(16px, 4vw, 44px);
  opacity: 0;
  transition: opacity 0.3s var(--ease, ease);
}
.g-lb.is-in { opacity: 1; }
.g-lb[hidden] { display: none; }
.g-lb__backdrop {
  position: absolute; inset: 0;
  background: rgba(3, 5, 4, 0.92);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.g-lb__fig {
  position: relative; max-width: min(94vw, 1400px);
  margin: 0; text-align: center;
}
.g-lb__img {
  max-width: 100%; max-height: min(74vh, 900px);
  width: auto; height: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 50px 120px -40px rgba(0, 0, 0, 0.95),
    0 0 80px -30px rgba(43, 224, 166, 0.3);
  background: var(--panel, #0c0f0d);
  opacity: 0; transform: scale(0.985);
  transition: opacity 0.35s var(--ease, ease), transform 0.35s var(--ease-out, ease);
}
.g-lb__img.is-in { opacity: 1; transform: scale(1); }

/* نوار زیر تصویر: بج کشور + شمارنده */
.g-lb__bar {
  display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center;
  gap: 10px 16px; margin-top: 18px;
  padding: 8px 8px 8px 18px; border-radius: 999px;
  background: rgba(12, 15, 13, 0.7);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--hair, rgba(255, 255, 255, 0.1));
}
.g-lb__country {
  display: inline-flex; align-items: center; gap: 7px;
  color: #c9f4e4; font-size: 0.78rem; font-weight: 700;
}
.g-lb__country::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--teal, #2be0a6); box-shadow: 0 0 10px rgba(43, 224, 166, 0.9);
}
.g-lb__count {
  font-size: 0.78rem; color: var(--muted, #9ba3a0);
  font-variant-numeric: tabular-nums; letter-spacing: 0.04em;
}

/* دکمه‌های لایت‌باکس */
.g-lb__btn {
  position: absolute; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(12, 15, 13, 0.6);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid rgba(43, 224, 166, 0.35);
  color: var(--ink, #f5f7f5); cursor: pointer;
  transition: border-color 0.3s var(--ease, ease), background-color 0.3s var(--ease, ease),
    transform 0.25s var(--ease-out, ease);
}
.g-lb__btn svg { width: 20px; height: 20px; }
.g-lb__btn:hover {
  border-color: rgba(43, 224, 166, 0.7);
  background: rgba(43, 224, 166, 0.1);
}
.g-lb__btn:active { transform: scale(0.94); }
.g-lb__btn:focus-visible { outline: 2px solid rgba(43, 224, 166, 0.55); outline-offset: 3px; }
.g-lb__close { top: clamp(14px, 3vw, 28px); inset-inline-end: clamp(14px, 3vw, 28px); position: fixed; }
.g-lb__prev { inset-inline-start: clamp(10px, 3vw, 30px); top: 50%; transform: translateY(-50%); }
.g-lb__next { inset-inline-end: clamp(10px, 3vw, 30px); top: 50%; transform: translateY(-50%); }
.g-lb__prev:hover, .g-lb__next:hover { transform: translateY(-50%) scale(1.05); }
@media (hover: none) {
  .g-lb__prev, .g-lb__next { opacity: 0.85; }
}

/* قفل اسکرول هنگام لایت‌باکس */
html.is-lb { overflow: hidden; }

/* پیام بدون جاوااسکریپت */
.g-noscript {
  margin: 30px 0; padding: 22px 24px; border-radius: 14px;
  border: 1px dashed rgba(43, 224, 166, 0.35);
  background: rgba(43, 224, 166, 0.05);
  color: var(--muted, #9ba3a0); font-size: 0.9rem; text-align: center;
}

/* ───────────────────────── ۶) ریسپانسیو ───────────────────────── */
@media (max-width: 1024px) {
  .g-rows { --g-row-h: clamp(170px, 26vw, 240px); gap: 14px; }
  .g-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
  .g-chips::-webkit-scrollbar { display: none; }
  .g-chip { flex: 0 0 auto; }
}

@media (max-width: 560px) {
  .g-rows { --g-row-h: clamp(150px, 40vw, 205px); gap: 12px; }
  .g-card { margin-right: 10px; border-radius: 12px; }
  .g-card__zoom { width: 36px; height: 36px; }
  .g-card__zoom svg { width: 15px; height: 15px; }
  .g-lb__prev, .g-lb__next { width: 40px; height: 40px; }
  .g-stats { gap: 22px 34px; }
}

/* ───────────── ۷) کاهش حرکت: دیوار ایستا به‌جای نوار متحرک ───────────── */
@media (prefers-reduced-motion: reduce) {
  .g-strip {
    -webkit-mask-image: none; mask-image: none;
    overflow: visible;
  }
  .g-track {
    animation: none; height: auto; width: auto;
    flex-wrap: wrap; justify-content: center; row-gap: 14px;
  }
  .g-copy { display: contents; }
  .g-card {
    height: clamp(150px, 24vw, 230px);
    margin: 0 7px; animation: none;
  }
  .g-card__tag { opacity: 1; transform: none; }
  .g-card img { transition: none; }
  .g-card img.is-in { opacity: 1; }
  .g-rows, .g-meta { transition: none; }
  .g-lb, .g-lb__img { transition: none; }
  .g-card img.is-in { opacity: 1; }
  .g-lb__img.is-in { opacity: 1; transform: none; }
}

/* ───────────────────────── ۸) چاپ ───────────────────────── */
@media print {
  .g-strip, .g-lb, .back-top, .toast { display: none !important; }
  .g-hero { padding: 10px 0; }
}