/* -----------------------------------------------------------
  Visa Archive - Hero Intro
----------------------------------------------------------- */
.hero-visa-intro {
  text-align: center;
  margin-top: 2rem;
}

.hero-visa-intro__title {
  margin: 0 0 8px;
  font-weight: 600;
  line-height: 1.35;
  font-size: clamp(20px, 2.2vw, 32px);
}

.hero-visa-intro__lead {
  margin: 0 0 12px;
  font-size: clamp(14px, 1.2vw, 18px);
  font-weight: 400;
  opacity: .95;
  color: var(--color-text-muted);
}

.hero-visa-intro__bullets {
  font-size: 1rem;
  color: var(--color-text-muted);
}

/* Buttons (اگه لازم داری) */
.btn--primary {
  background: #00c897;
  color: #0b0b0b;
}
.btn--ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
}
.btn--primary:hover { filter: brightness(1.05); }
.btn--ghost:hover   { border-color: rgba(255,255,255,.45); }


/* -----------------------------------------------------------
  Hero Visa (Top 5 grid)
----------------------------------------------------------- */
.hero-visa {
  --gap: 16px;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0,0,0,.12);
  --overlay: linear-gradient(180deg, rgba(0,0,0,.0) 35%, rgba(0,0,0,.55) 100%);
  margin-top: -170px;
}

/* شبکه: ۵ ستون برابر در دسکتاپ */
.hero-visa__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--gap);
  align-items: end;
}

/* آیتم‌ها */
.hero-visa__item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #0b0b0b;
}

/* لینک کل کارت را پوشش می‌دهد */
.hero-visa__link {
  display: grid;
  grid-template-rows: auto auto;
  height: 100%;
}

/* اسلات ۱ و ۵ دو تیکه بمانند */
.slot-1 .hero-visa__link,
.slot-5 .hero-visa__link {
  grid-template-rows: 1fr auto;
}

/* نسبت‌ها (Desktop) */
.slot-1 { --ar: 2/4; } /* بلندترین */
.slot-2 { --ar: 3/5; }
.slot-3 { --ar: 3/4; } /* کوتاه‌تر */
.slot-4 { --ar: 3/5; }
.slot-5 { --ar: 2/4; } /* بلندترین */

/* مدیا */
.hero-visa__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--ar, 4/5);
}
.hero-visa__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-visa__overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  pointer-events: none;
}

/* نوار پایین */
.hero-visa__bottom {
  position: absolute;
  bottom: 0;
  display: grid;
  gap: 6px;
  padding: clamp(10px, 1.2vw, 14px) clamp(12px, 1.6vw, 18px);
  color: #fff;
}

.hero-visa__title {
  margin: 0;
  color: #fff;
  font-weight: 500;
  line-height: 1.45;
  font-size: clamp(14px, 1.1vw, 18px);
}

.hero-visa__meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-visa__price {
  font-size: .95em;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,.1);
}
.hero-visa__issue {
  font-size: .9em;
  opacity: .9;
}

/* پنل شیشه‌ای روی هاور دسکتاپ */
.hero-visa__glass {
  position: absolute;
  inset: auto 0 0 0;
  padding: 14px 16px;
  color: #fff;
  background: rgba(20,20,20,.6);
  backdrop-filter: blur(8px);
  transform: translateY(100%);
  transition: transform .35s ease;
}
.hero-visa__glass-inner {
  display: grid;
  gap: 8px;
}
.hero-visa__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.hero-visa__label {
  font-size: var(--fs-small);
  opacity: .9;
}
.hero-visa__value {
  font-weight: 500;
}

@media (hover:hover) and (pointer:fine) {
  .hero-visa__item:hover .hero-visa__glass {
    transform: translateY(0);
  }
}


/* -----------------------------------------------------------
  Visa Cards Grid (visa-explorer)
----------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--card-gap);
  align-items: start;
}

/* Breakpoints برای گرید پایین */
@media (max-width: 1200px) {
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* کارت‌ها */
.card__img {
  width: 100%;
  height: var(--card-img-h);
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
  transition: transform 700ms cubic-bezier(.2,.6,.2,1), filter 700ms ease;
  will-change: transform;
}

.card__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.45) 8%, rgba(0,0,0,0) 55%);
  transition: opacity var(--transition);
  opacity: .9;
}

.card__caption {
  position: absolute;
  inset: auto 0 12px 0;
  z-index: 2;
  padding: 0 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 4px;
  direction: rtl;
  text-align: right;
}

.card__title {
  margin: 0;
  color: #fff;
  font-size: var(--fs-h6);
  line-height: var(--line-height-heading);
  text-shadow: var(--cm-text-shadow);
  font-weight: var(--fw-heading, 600);
}

.card__meta {
  color: #fff;
  font-size: var(--fs-small);
  font-weight: var(--fw-strong, 600);
}

/* پنل گلس کارت‌های گرید پایین */
.card__glass {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  border-radius: var(--card-radius);
  padding: 12px 14px;
  color: var(--color-text, #1F2937);
  background: color-mix(in srgb, rgba(0,0,0,.68), rgba(255,255,255,.10) 10%);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow:
    0 8px 32px rgba(0,0,0,.10),
    inset 0 1px 0 rgba(255,255,255,.45),
    inset 0 -1px 0 rgba(255,255,255,.08);
  overflow: hidden;
  direction: rtl;
  text-align: right;
  transform: translateY(8px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity .26s ease,
    transform .26s ease,
    visibility 0s linear .26s;
}

.card__glass::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
}

.card__glass::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,.7), transparent, rgba(255,255,255,.25));
}

.card__glass-inner {
  display: grid;
  gap: 10px;
}
.card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card__label {
  font-size: var(--fs-small);
  color: var(--color-text-wte);
  font-weight: var(--fw-muted, 400);
}
.card__value {
  font-size: var(--fs-h6);
  font-weight: var(--fw-strong, 600);
  color: var(--color-text-wte, #0F172A);
}

/* Hover effects دسکتاپ */
.card__link:hover .card__img {
  transform: scale(1.06);
  filter: saturate(1.05);
}
.card__link:hover .card__caption {
  opacity: 0;
  transition: opacity 220ms ease;
}
.card__link:hover .card__glass {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity .26s ease, transform .26s ease;
}
.card__link:hover .card__overlay {
  opacity: 1;
}

/* فوکوس کیبوردی */
.card__link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus-ring, rgba(80,196,237,.35));
  border-radius: var(--card-radius);
}


/* -----------------------------------------------------------
  Visa Header / Tabs / Filters
----------------------------------------------------------- */
.visa-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 0 16px 0;
  direction: rtl;
}

.visa-tabs {
  display: flex;
  gap: 8px;
}

.visa-tab {
  appearance: none;
  border: none;
  background: #fff;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 600;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.10);
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    background .18s ease;
}

.visa-tab:is(:hover, :focus-visible) {
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,.14),
    0 6px 18px rgba(0,0,0,.06);
  outline: none;
}

.visa-tab.is-active {
  background: rgba(14,165,233,.12);
  box-shadow: inset 0 0 0 2px rgba(14,165,233,.45);
}

.visa-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  direction: rtl;
}

.vf-input,
.vf-select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
}

.vf-input {
  min-width: 220px;
}
.vf-select {
  min-width: 190px;
}

.vf-input:focus {
  border: 1px solid rgba(0,0,0,.12) !important;
}

.visa-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  direction: rtl;
}

.cat-chip {
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.10);
  transition:
    background .18s ease,
    box-shadow .18s ease,
    transform .18s ease;
  font: inherit;
}

.cat-chip:is(:hover, :focus-visible) {
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,.14),
    0 6px 18px rgba(0,0,0,.06);
  outline: none;
}

.cat-chip.is-active {
  background: var(--color-visa);
  color: #fff;
  box-shadow: none;
}

/* هدِر روی موبایل یک ستون شود */
@media (max-width: 768px) {
  .visa-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .visa-filters {
    justify-content: space-between;
  }
}


/* -----------------------------------------------------------
  Responsive / Mobile (<= 1200 & 720 & 768)
----------------------------------------------------------- */

/* Hero Visa grid: سه‌ستونه در 1200- */
@media (max-width: 1200px) {
  .hero-visa__grid {
    grid-template-columns: 1.1fr 0.9fr 1.1fr;
  }

  /* ترتیب در سه‌ستونه */
  .slot-1 { order: 1; --ar: 2/5; }
  .slot-2 { order: 2; --ar: 3/5; }
  .slot-3 { order: 4; --ar: 5/6; }
  .slot-4 { order: 3; --ar: 3/5; }
  .slot-5 { order: 5; --ar: 2/5; }
}

/* Hero Visa grid: تک‌ستونه در <=720 */
@media (max-width: 720px) {
  .hero-visa__grid {
    grid-template-columns: 1fr;
  }
  .hero-visa__link {
    grid-template-rows: auto auto;
  }
  .hero-visa__media {
    aspect-ratio: 16/10;
  }
}


/* -----------------------------------------------------------
  Mobile Layout Enhancements (<= 768px)
----------------------------------------------------------- */
@media (max-width: 768px) {

  :root{
    --container-pad: 16px;
    --edge-pad: 16px;
    --chip-h: 38px;
    --sticky-top: calc(env(safe-area-inset-top, 0px) + 8px);
  }

  /* جلوگیری از اسکرول افقی کل صفحه */
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* کانتینر اصلی آرشیو */
  .container.d-grid.gap-4.mt-4 {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* اینتروی بالا روی موبایل کمی متراکم‌تر */
  .hero-visa-intro {
    margin-top: 1rem;
    padding-inline: 16px;
  }

  /* Hero visa دیگر منفی نباشد */
  .hero-visa {
    margin-top: 0;
  }

  /* Hero Visa: اسلایدر افقی */
  .hero-visa__grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 var(--edge-pad) 4px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    align-items: stretch;
  }
  .hero-visa__grid::before,
  .hero-visa__grid::after {
    content: '';
    flex: 0 0 var(--edge-pad);
  }
  .hero-visa__item {
    flex: 0 0 84%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    height: auto;
  }
  .hero-visa__media {
    aspect-ratio: 16/10;
  }
  .hero-visa__bottom {
    inset: auto 12px 10px 12px;
    padding: 10px 12px;
  }
  .hero-visa__title {
    font-size: 16px;
  }

  .visa-header {
    position: sticky;
    top: var(--sticky-top);
    z-index: 20;
    padding: 8px var(--container-pad);
    background: color-mix(in srgb, #ffffff 85%, transparent);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,.06);
    margin-bottom: 20px;
  }

  .visa-cats {
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 4px;
  }
  .visa-cats::-webkit-scrollbar {
    display: none;
  }
  .cat-chip {
    height: var(--chip-h);
    padding: 0 12px;
    line-height: var(--chip-h);
    scroll-snap-align: start;
    white-space: nowrap;
    font-weight: 600;
  }

  .visa-filters {
    gap: 6px;
  }
  .vf-input,
  .vf-select {
    height: 40px;
    padding: 0 10px;
    font-size: 14px;
    touch-action: manipulation;
  }
  .vf-input {
    flex: 1 1 auto;
    min-width: 0;
  }

  .vf-select {
    flex: 0 0 46%;
    min-width: 0; 
  }
  .card {
    flex: 0 0 78%;
    min-width: 0;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }
  .card-grid::-webkit-scrollbar {
    display: none;
  }

  /* تصویر کارت روی موبایل */
  .card__img {
    height: var(--card-img-h-sm);
  }

  /* پنل گلس روی موبایل نمایش داده نشود (تاچ = کلیک لینک) */
  .card__glass {
    display: none;
  }

  /* کپشن خواناتر روی موبایل */
  .card__caption {
    inset: auto 0 10px 0;
    padding: 0 12px;
  }
  .card__title {
    font-size: 15px;
  }
  .card__meta {
    font-size: 12px;
  }

  /* Hoverها روی موبایل خنثی شوند */
  .card__link:hover .card__img {
    transform: none;
    filter: none;
  }

  @media (prefers-reduced-motion: reduce) {
    .card__img {
      transition: none;
    }
  }
}
/* ----- Mobile fix: card-grid تمام‌عرض، بدون overflow-x روی #visa-explorer ----- */
@media (max-width: 768px) {

  /* خود اکسپلورر فقط فیت بشه، چیزی رو نمی‌بُریم */
  #visa-explorer {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* هیچ overflow-x اینجا تعریف نکنیم */
  }

  /* گرید کارت‌ها: یک ستون، فیت در ویوپورت */
  .card-grid {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* اون pseudo-elementهایی که برای حالت اسلایدری بود، اینجا خنثی کن */
  .card-grid::before,
  .card-grid::after {
    content: none !important;
  }

  /* خود کارت‌ها: دیگه flex نباشن و کامل فیت ستون بشن */
  .card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: none !important;    /* flex:0 0 78% رو با این می‌پوشونیم */
  }
}
@media (max-width: 480px) {
  .visa-filters {
    flex-wrap: wrap;
  }

  .vf-input,
  .vf-select {
    flex: 1 1 100%;
    min-width: 0;
  }
}
