/* =====================================================================
   0. FONT — Ravi (all text)
   ===================================================================== */
/* Official Ravi v2.3 webfonts (Fontiran) — woff2 first, woff fallback */
@font-face { font-family: "Ravi"; src: url("assets/fonts/Ravi-Thin.woff2") format("woff2"), url("assets/fonts/Ravi-Thin.woff") format("woff"); font-weight: 100; font-style: normal; font-display: swap; }
@font-face { font-family: "Ravi"; src: url("assets/fonts/Ravi-Light.woff2") format("woff2"), url("assets/fonts/Ravi-Light.woff") format("woff"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Ravi"; src: url("assets/fonts/Ravi-Regular.woff2") format("woff2"), url("assets/fonts/Ravi-Regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Ravi"; src: url("assets/fonts/Ravi-Medium.woff2") format("woff2"), url("assets/fonts/Ravi-Medium.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Ravi"; src: url("assets/fonts/Ravi-SemiBold.woff2") format("woff2"), url("assets/fonts/Ravi-SemiBold.woff") format("woff"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Ravi"; src: url("assets/fonts/Ravi-Bold.woff2") format("woff2"), url("assets/fonts/Ravi-Bold.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Ravi"; src: url("assets/fonts/Ravi-Black.woff2") format("woff2"), url("assets/fonts/Ravi-Black.woff") format("woff"); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Ravi"; src: url("assets/fonts/Ravi-ExtraBlack.woff2") format("woff2"), url("assets/fonts/Ravi-ExtraBlack.woff") format("woff"); font-weight: 950; font-style: normal; font-display: swap; }

/* =====================================================================
   1. TOKENS
   ===================================================================== */
:root {
  /* colour */
  --paper: #F3F3EF;            /* neutral, slightly cool page */
  --paper-rgb: 243, 243, 239;
  --paper-2: #EBEBE6;          /* neighbouring land, plain and quiet */
  --water: #DFE6E9;            /* cool seas and lakes */
  --iran: #FFFFFF;             /* Iran land: the brightest surface on the page */
  --ink-n: #A3A39C;            /* neighbour lines and labels */
  --ink: #111110;
  --ink-2: #3D3D3A;
  --ink-3: #85857F;            /* quiet labels */
  --terra: #F0532A;            /* accent (persimmon) */
  --cream: #FFFFFF;

  --c-caspian: #12392B;
  --c-northwest: #2B47E6;
  --c-central: #F0532A;
  --c-south: #0B6A70;
  --c-east: #F3B53F;

  /* type — Persian script is cursive: never letter-space it */
  --f: "Ravi", "Vazirmatn", Tahoma, sans-serif;

  /* line weights */
  --w-border: 1.3px;
  --w-prov: 1.2px;
  --w-neigh: 1px;

  /* motion */
  --ease-quint: cubic-bezier(.83, 0, .17, 1);      /* quintic in-out */
  --ease-expo: cubic-bezier(.16, 1, .3, 1);        /* exponential out */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --t-draw: 1.7s;
  --t-view: 1.25s;
  --t-photo-in: .65s;
  --t-photo-out: .45s;
  --t-ring: 14s;

  /* layout */
  --strip: 72px;
  --footer-h: 52px;
  --map-shift: 520px;          /* overwritten by JS with the frame scale */
}

/* =====================================================================
   2. BASE
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--terra); outline-offset: 3px; }
bdi.ltr { direction: ltr; unicode-bidi: isolate; }

.app { position: fixed; inset: 0; overflow: hidden; overflow: clip; }

/* =====================================================================
   3. MAP VIEW — stage (SVG + photo canvases) and UI frame
   ===================================================================== */
.map-view {
  position: absolute; inset: 0; overflow: hidden; overflow: clip;
  transition: transform var(--t-view) var(--ease-quint);
  will-change: transform;
}
/* the map slides to the left, stories enter from the right */
.app[data-view="story"] .map-view { transform: translate3d(calc(var(--map-shift) * -1), 0, 0); }

.stage { position: absolute; inset: 0 0 var(--footer-h) 0; overflow: hidden; overflow: clip; direction: ltr; }
.stage > svg, .photo-layer { position: absolute; left: 0; top: 0; }
.stage > svg { width: 100%; height: 100%; display: block; overflow: hidden; }
.map-top { pointer-events: none; }

/* base layer */
.m-water { fill: var(--water); }
.m-nland { fill: var(--paper-2); }
.m-iran { fill: var(--iran); filter: drop-shadow(0 6px 18px rgba(28, 26, 23, .07)); }
.m-lake { fill: var(--water); }
.m-veil { fill: #fff; opacity: .5; pointer-events: none; }

/* ink */
.ink path {
  fill: none; stroke: var(--ink);
  stroke-linejoin: round; stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.ink-n path { stroke: var(--ink-n); stroke-width: .9px; stroke-opacity: .55; }
.ink-n .m-nborder { stroke-opacity: .32; }
.ink-lake path { stroke: var(--ink-n); }
.ink-lake path { stroke-width: .9px; stroke-opacity: .6; }
.ink-prov path { stroke-width: var(--w-prov); stroke-opacity: .55; }
.ink-zone path { stroke-width: var(--w-border); stroke-opacity: 1; }
.ink-iran path { stroke-width: 1.5px; }

/* line drawing entrance */
.is-drawing .ink path {
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  animation: draw var(--t-draw) var(--ease-out) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* labels (SVG text, Persian, RTL) */
.lbl { font-family: var(--f); fill: var(--ink-n); fill-opacity: .85; text-anchor: middle; direction: rtl; font-size: 11px; font-weight: 400; }
html[dir="ltr"] .lbl { direction: ltr; }   /* the stage itself is LTR, so labels set their own direction */
.lbl-water { fill: #8A928F; font-size: 12px; }
.lbl-small { font-size: 10.5px; }
.lbl-iran { fill: var(--ink); fill-opacity: 1; font-size: 26px; font-weight: 900; }
.lbl-mtn { font-size: 11px; fill: #8C8579; font-weight: 400; }
.lbl-city { font-size: 11.5px; fill: var(--ink-2); fill-opacity: 1; font-weight: 600; }
.lbl-iran, .lbl-city { paint-order: stroke; stroke: var(--iran); stroke-width: 3px; stroke-linejoin: round; }
.labels { opacity: 0; transition: opacity 1.2s ease 1.1s; }
.is-ready .labels { opacity: 1; }

/* zone hit areas */
.hit { fill: #000; fill-opacity: 0; pointer-events: all; cursor: pointer; outline: none; }
.prov-hl { fill: none; stroke: var(--terra); stroke-width: 2.4px; vector-effect: non-scaling-stroke; stroke-linejoin: round; pointer-events: none; opacity: 0; transition: opacity .25s ease; }
.prov-hl.is-on { opacity: 1; }
.prov-label { fill: var(--ink); font-size: 13px; font-weight: 800; pointer-events: none; paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; opacity: 0; transition: opacity .2s ease; }
.prov-label.is-on { opacity: 1; }

/* photo layer: one canvas per zone, clipped by the zone's SVG clipPath */
.photo-layer { transform-origin: 0 0; pointer-events: none; }
.zone-photo {
  position: absolute; display: block;
  opacity: 0;
  transition: opacity var(--t-photo-out) ease;
}
.zone-photo.is-active { opacity: 1; transition: opacity var(--t-photo-in) ease; }

/* markers */
.marker { pointer-events: all; cursor: pointer; outline: none; }
.marker .dot { fill: var(--terra); }
.marker .halo { fill: var(--terra); opacity: .25; transform-box: fill-box; transform-origin: center; animation: pulse 2.6s var(--ease-out) infinite; }
.marker .hit-dot { fill: transparent; }
.marker .mk-city { opacity: 1; transition: opacity .3s ease; }
.marker .disc { transform: scale(.2); opacity: 0; transition: transform .7s var(--ease-expo), opacity .35s ease; }
.marker .disc-face { fill: var(--cream); stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.marker .plus { stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.marker .ring { opacity: 0; transform: rotate(-60deg) scale(.7); transition: transform 1.1s var(--ease-expo), opacity .5s ease; }
.marker .ring-spin { animation: spin var(--t-ring) linear infinite; animation-play-state: paused; }
.marker .ring text { font-family: var(--f); font-size: 10px; font-weight: 600; fill: var(--ink); }
/* ring text: LTR paragraph so it starts at the path start; the Persian run itself still reads right-to-left */
.fit-ring { direction: ltr; text-anchor: start; }
.marker .ring-bg { fill: none; stroke: var(--cream); stroke-width: 19; opacity: .92; }
.marker.is-active .disc { transform: scale(1); opacity: 1; }
.marker.is-active .ring { opacity: 1; transform: none; transition-delay: .08s; }
.marker.is-active .ring-spin { animation-play-state: running; }
.marker.is-active .mk-city, .marker.is-active .halo, .marker.is-active .dot { opacity: 0; }
.marker .dot, .marker .halo { transition: opacity .25s ease; }
.markers { opacity: 0; transition: opacity .8s ease 1.4s; }
.is-ready .markers { opacity: 1; }
@keyframes pulse { 0% { transform: scale(1); opacity: .32; } 70%, 100% { transform: scale(2.4); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- UI frame (desktop: a scaled 1440×810 overlay, mirrored for RTL) ---------- */
.ui {
  position: absolute; left: 0; top: 0; width: 1440px; height: 810px;
  transform-origin: 0 0; pointer-events: none;
}
.ui > * { pointer-events: auto; }
.ui-fade {
  position: absolute; right: -400px; top: -200px; width: 900px; height: 1210px; pointer-events: none;
  background: linear-gradient(270deg, var(--paper) 0 52%, rgba(var(--paper-rgb),.82) 64%, rgba(var(--paper-rgb),0) 92%);
}

.brand {
  position: absolute; right: 60px; top: 42px;
  font-size: 13px; color: var(--ink-2);
  display: flex; gap: 14px; align-items: center;
}
.brand b { font-weight: 700; color: var(--ink); }
.brand .brand-ico { display: block; flex: none; margin-inline-end: -8px; fill: var(--ink); }   /* icon sits close to the word */
html[lang="en"] .brand b { text-transform: uppercase; letter-spacing: .04em; }
.brand i { width: 22px; height: 1px; background: currentColor; display: inline-block; opacity: .5; }

.intro { position: absolute; right: 60px; top: 170px; width: 370px; }
/* section labels: eyebrow (right) and 'انتخاب استان' (left) share one style and one top line (y = 200px) */
.intro .eyebrow, .regions h2 { font-size: 14px; line-height: 20px; font-weight: 700; color: var(--ink-2); }
.intro .eyebrow { margin: 30px 0 0; }
.intro h1 {
  margin: 14px 0 0; font-weight: 900; font-size: 60px; line-height: 1.22; letter-spacing: 0;
  color: var(--ink);
}
.intro h1 em { font-style: normal; color: var(--terra); }
/* each line is its own block; JS stretches them with kashida (ـ) to one shared width */
.intro h1 .hl { display: block; width: max-content; white-space: nowrap; }
.intro p {
  margin: 30px 0 0; max-width: 340px;
  font-size: 15px; line-height: 28px; color: var(--ink-2);
}

.coords {
  position: absolute; left: 144px; top: 38px; text-align: left;
  font-size: 12.5px; line-height: 22px; color: var(--ink-2);
}
.coords .k { color: var(--ink-3); margin-inline-end: 10px; font-weight: 600; }
.coords .v-region { color: var(--terra); }

.regions { position: absolute; left: 60px; top: 236px; display: flex; gap: 22px; align-items: flex-start; --row: 34px; }
.regions h2 {
  position: absolute; left: 0; top: -36px; margin: 0; white-space: nowrap;
}
.region-list {
  list-style: none; margin: 0; padding: 0; text-align: left;
  height: calc(var(--row) * 10); overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth;
  scrollbar-width: none; padding-right: 8px;
  /* soft fade at the scroll edges */
  -webkit-mask-image: linear-gradient(transparent, #000 18px, #000 calc(100% - 26px), transparent);
          mask-image: linear-gradient(transparent, #000 18px, #000 calc(100% - 26px), transparent);
}
.region-list::-webkit-scrollbar { display: none; }
.region-list button {
  display: block; width: 100%; text-align: left; white-space: nowrap;
  font-size: 18px; line-height: var(--row); font-weight: 500; color: var(--ink);
  transition: color .35s ease, transform .5s var(--ease-expo);
}
.region-list button:hover { transform: translateX(4px); }
.region-list button[aria-current="true"] { color: var(--terra); }
.region-list .num { display: inline-block; min-width: 20px; font-size: 11px; color: var(--ink-3); vertical-align: 4px; margin-inline-end: 12px; font-weight: 500; }
.region-list button[aria-current="true"] .num { color: var(--terra); }

.ruler {
  position: relative; width: 14px; height: calc(var(--row) * 10); margin-top: 0; flex: none;
  background:
    linear-gradient(var(--ink), var(--ink)) left 0 top 0 / 1px 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--ink) 0 1px, transparent 1px 9px) left 0 top 0 / 7px 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--ink) 0 1px, transparent 1px var(--row)) left 0 top 0 / 14px 100% no-repeat;
  opacity: .9;
}
.ruler::before { content: ""; position: absolute; inset: 0; background: var(--paper); opacity: .35; }
.ruler-mark {
  position: absolute; left: -4px; top: 0; width: 22px; height: 2px; background: var(--terra);
  transform: translateY(var(--y, 20px)); transition: transform .5s var(--ease-expo), opacity .3s ease;
}
.ruler-mark::after { content: ""; position: absolute; right: -7px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--terra); }

/* bottom row: hint (left) and foot (right) share one line: same bottom, height and line-height */
.hint { position: absolute; left: 60px; bottom: 40px; height: 20px; line-height: 20px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.foot {
  position: absolute; right: 60px; bottom: 40px; height: 20px; line-height: 20px; display: flex; gap: 18px; align-items: center;
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
}
.foot button { line-height: 20px; text-decoration: underline; text-underline-offset: 5px; }
.foot button { color: var(--ink); font-weight: 600; }
.foot button:hover { color: var(--terra); }

.chips { display: none; }

/* signature — white footer bar under the map */
.credits-sig {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--footer-h); z-index: 3;
  background: #fff; border-top: 1px solid rgba(28, 26, 23, .08);
  direction: ltr; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; white-space: nowrap;
  padding: 0 60px;
  font-size: 12px; line-height: 1.4; color: #8A857C;
}
.credits-sig > *, .credits-sig .sig-end > * { line-height: 1; }
.credits-sig svg { display: block; flex: none; }
.credits-sig a { display: inline-flex; align-items: center; gap: 6px; height: 20px; color: inherit; text-decoration: none; border-radius: 6px; transition: opacity .2s; }
.credits-sig a:hover { opacity: .7; }
.credits-sig strong { color: var(--ink-2); font-weight: 600; }
.credits-sig svg { width: 13px; height: 13px; fill: var(--ink-2); }
.credits-sig .star-icon { fill: var(--c-east); }
.credits-sig .dot { opacity: .5; }
.credits-sig .sig-start { justify-self: start; }
.credits-sig .sig-mid { justify-self: center; }
.credits-sig .sig-end { justify-self: end; display: inline-flex; align-items: center; gap: 10px; height: 20px; }
.credits-sig .sig-mid, .credits-sig .dot { display: inline-flex; align-items: center; height: 20px; }
.credits-sig [hidden] { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* =====================================================================
   4. STORY VIEW (RTL: first story on the right, track moves rightward)
   ===================================================================== */
.story-view {
  position: absolute; top: 0; bottom: 0; left: var(--strip); right: 0;
  background: var(--paper);
  transform: translate3d(100%, 0, 0);
  transition: transform var(--t-view) var(--ease-quint), visibility 0s linear var(--t-view);
  visibility: hidden;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none; -webkit-user-select: none;
}
.app[data-view="story"] .story-view { transform: none; visibility: visible; transition: transform var(--t-view) var(--ease-quint), visibility 0s; }

.strip {
  position: absolute; left: 0; top: 0; bottom: 0; width: var(--strip);
  background: rgba(var(--paper-rgb), .6);
  border-right: 1px solid rgba(17, 17, 16, .12);
  backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px);
  opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility 0s linear .6s;
  display: flex; align-items: center; justify-content: center;
}
.app[data-view="story"] .strip { opacity: 1; visibility: visible; transition: opacity .8s ease .6s, visibility 0s; }
.back {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-size: 15px; font-weight: 700; padding: 18px 12px; border-radius: 8px;
  background: var(--ink); color: #fff;
  box-shadow: 0 10px 30px rgba(17, 17, 16, .28), 0 0 0 4px rgba(255, 255, 255, .7);
  transition: background .25s ease, transform .35s var(--ease-expo), box-shadow .35s ease;
}
.back .txt { writing-mode: vertical-rl; }
.back .arr { display: block; flex: none; transition: transform .45s var(--ease-expo); }
/* Iran shape at the bottom: solid white, the flag's three bands (no emblem) on hover */
.back .ico-iran { display: block; flex: none; overflow: visible; transition: transform .5s var(--ease-expo); }
.back .ico-iran use {
  fill: #fff; stroke: #fff; stroke-width: 1; vector-effect: non-scaling-stroke; stroke-linejoin: round;
  transition: fill .35s ease;
}
.back:hover { background: #2A2A28; transform: translateX(-2px); box-shadow: 0 14px 34px rgba(17, 17, 16, .34), 0 0 0 4px rgba(255, 255, 255, .85); }
.back:hover .arr { transform: translateX(-4px); animation: back-nudge 1.1s ease-in-out .45s infinite; }
.back:hover .ico-iran { transform: scale(1.15) rotate(-6deg); }
.back:hover .ico-iran use { fill: url(#flag-ir); stroke: none; }
.back:active { transform: scale(.97); }
@keyframes back-nudge { 0%, 100% { transform: translateX(-4px); } 50% { transform: translateX(-8px); } }

/* the track runs left → right (next story enters from the right, like the view itself); text inside stays RTL */
.track { position: absolute; left: 0; top: 0; height: 100%; display: flex; direction: ltr; will-change: transform; }
.story { display: flex; height: 100%; padding-right: 3.6vh; flex: none; }
html[dir="rtl"] .story > * { direction: rtl; }
html[dir="ltr"] .story > * { direction: ltr; }

.story-photo {
  position: relative; width: 74vh; height: 100%; overflow: hidden; flex: none; background: var(--paper-2); margin: 0;
}
.story-photo .wipe { position: absolute; inset: 0; overflow: hidden; clip-path: inset(100% 0 0 0); }
.story-photo img { position: absolute; top: 0; left: -8%; width: 116%; height: 100%; object-fit: cover; display: block; transform: scale(1.25); transform-origin: 50% 60%; background: var(--paper-2); }
.story-photo .wipe-inner { position: absolute; inset: 0; will-change: transform; }
/* slideshow: photos stack and crossfade */
.story-photo img.slide { opacity: 0; transition: opacity 1.1s ease; }
.story-photo img.slide.is-on { opacity: 1; }
/* dark gradient at the bottom so caption and controls stay readable on any photo */
.story-photo::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34%; z-index: 1; pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .28) 45%, rgba(0, 0, 0, .62));
  opacity: 0; transition: opacity .8s ease .7s;
}
.story.is-in .story-photo::after { opacity: 1; }
.story-photo figcaption { z-index: 2; }
.slide-ui {
  position: absolute; left: 12px; bottom: 10px; z-index: 2; display: flex; align-items: center; gap: 2px; direction: ltr;
  opacity: 0; transition: opacity .6s ease .9s;
}
.story.is-in .slide-ui { opacity: 1; }
html[dir="ltr"] .slide-ui { left: auto; right: 12px; }   /* caption starts on the left in English */
.slide-dots { display: flex; }
.slide-step {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .28); cursor: pointer;
  transition: background .25s ease, transform .25s ease;
}
.slide-step:hover { background: rgba(255, 255, 255, .3); }
.slide-step:active { transform: scale(.92); }
.slide-ui, .slide-ui button { cursor: pointer; }
.slide-dots button { width: 22px; height: 22px; display: grid; place-items: center; }
.slide-dots button::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .5);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3); transition: background .3s ease, transform .3s ease;
}
.slide-dots button:hover::after { background: rgba(255, 255, 255, .85); }
.slide-dots button[aria-selected="true"]::after { background: #fff; transform: scale(1.3); }
.story-photo figcaption {
  position: absolute; right: 20px; bottom: 18px; left: 20px;
  font-size: 12px; font-weight: 500; color: #fff;
  text-shadow: 0 1px 8px rgba(0,0,0,.5); opacity: 0; transition: opacity .6s ease .9s;
}

.card {
  --fg: var(--cream); --fg-2: rgba(251, 248, 240, .78);
  position: relative; flex: none; width: 69vh; height: calc(100% - 7.2vh);
  margin: 3.6vh 0 0 3.6vh;
  background: var(--card); color: var(--fg);
  padding: 3.2vh 3.4vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.card[data-tone="light"] { --fg: var(--ink); --fg-2: rgba(28, 26, 23, .76); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; font-size: 14px; font-weight: 600; }
/* population and area, top-left of each card */
.stats { display: flex; gap: 28px; margin: 0; text-align: start; }
.stats dt { font-size: 12px; font-weight: 500; color: var(--fg-2); margin-bottom: 4px; }
.stats dd { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.stats small { font-size: 12px; font-weight: 500; color: var(--fg-2); }
.counter { display: flex; align-items: center; gap: 10px; }
.counter i { width: 34px; height: 1px; background: currentColor; opacity: .7; }


.card-map { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 2vh 0; }
.card-map .mini { width: auto; max-width: 100%; height: 100%; max-height: 34vh; }
.card-body { margin-top: 1vh; }
.category { font-size: 13px; font-weight: 600; color: var(--fg-2); }
.city { margin: .6vh 0 0; font-weight: 900; font-size: clamp(34px, 6.4vh, 56px); line-height: 1.2; }
.desc { margin: 1vh 0 0; font-size: clamp(15px, 2.15vh, 17.5px); line-height: 1.8; font-weight: 400; color: var(--fg); max-width: 46ch; }

.card-foot { margin-top: 2.4vh; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.credit .coord-line { color: var(--fg); font-weight: 600; }
.credit { font-size: 11px; line-height: 1.7; color: var(--fg-2); max-width: 30ch; margin-top: 10px; }

.badge { position: relative; width: 11.5vh; height: 11.5vh; max-width: 96px; max-height: 96px; min-width: 72px; min-height: 72px; flex: none; color: var(--fg); }
.badge svg { width: 100%; height: 100%; display: block; overflow: visible; }
.badge .spin { transform-origin: 50px 50px; animation: spin var(--t-ring) linear infinite; }
.badge text { font-family: var(--f); font-size: 10px; font-weight: 600; fill: currentColor; }
.badge .face { fill: none; stroke: currentColor; stroke-width: 1; opacity: .9; }
.badge .plus { stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }

.mini { color: var(--fg); display: block; }
.mini .mi-iran { fill: none; stroke: currentColor; stroke-width: 1; opacity: .55; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.mini .mi-zone { fill: currentColor; opacity: .85; stroke: currentColor; stroke-width: 1; vector-effect: non-scaling-stroke; stroke-linejoin: round; }

/* story entrance */
.rise { opacity: 0; transform: translate3d(0, 22px, 0); }
.story.is-in .rise { opacity: 1; transform: none; transition: opacity .8s ease, transform 1s var(--ease-expo); transition-delay: calc(.35s + var(--k, 0) * 70ms); }
.story.is-in .wipe { clip-path: inset(0 0 0 0); transition: clip-path 1.15s var(--ease-quint); }
.story.is-in .story.is-in .story-photo img { transform: scale(1); transition: transform 1.6s var(--ease-expo); }
.story.is-in .story-photo figcaption { opacity: 1; }

/* drag cursor */
.drag-cursor {
  position: fixed; left: 0; top: 0; width: 80px; height: 80px; margin: -40px 0 0 -40px; border-radius: 50%;
  background: var(--cream); color: var(--ink); pointer-events: none; z-index: 20;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(28, 26, 23, .14);
  opacity: 0; transform: translate3d(var(--x, -100px), var(--y, -100px), 0) scale(.4);
  transition: opacity .25s ease, transform .35s var(--ease-expo);
}
.drag-cursor.is-on { opacity: 1; transform: translate3d(var(--x), var(--y), 0) scale(1); transition: opacity .25s ease, transform .12s linear; }
.drag-cursor.is-on.is-down { transform: translate3d(var(--x), var(--y), 0) scale(.78); }
@media (hover: hover) and (pointer: fine) { .app[data-view="story"] .story-view.cursor-hidden { cursor: none; } }

/* credits dialog */
dialog.credits {
  max-width: 640px; width: calc(100% - 32px); border: 1px solid var(--ink); background: var(--paper); color: var(--ink);
  padding: 28px 32px; font-size: 14px; line-height: 1.9;
}
dialog.credits::backdrop { background: rgba(28, 26, 23, .35); }
dialog.credits h2 { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
dialog.credits p { margin: 0 0 16px; color: var(--ink-2); font-size: 15px; }
dialog.credits ol { margin: 0; padding-right: 20px; padding-left: 0; }
dialog.credits li { margin: 0 0 6px; }
dialog.credits a { color: var(--terra); }
dialog.credits .close { position: absolute; left: 16px; top: 12px; font-size: 24px; line-height: 1; padding: 6px; }

/* hidden video source (not display:none so it keeps decoding) */
.grid-video { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; }

/* language switch (same pill as the Word & Capsule project): flag + arrow, menu below */
.lang { position: absolute; left: 60px; top: 38px; z-index: 6; }
.lang-btn {
  height: 36px; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 0 10px; direction: ltr;
  border: 1.5px solid rgba(17, 17, 16, .14); border-radius: 999px; background: #fff; color: var(--ink);
  cursor: pointer; transition: border-color .2s, box-shadow .2s;
}
.lang-btn:hover { border-color: rgba(17, 17, 16, .28); box-shadow: 0 4px 12px -8px rgba(0, 0, 0, .35); }
.lang-btn .chev { display: block; margin-right: -3.5px; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.lang.open .lang-btn .chev { transform: rotate(180deg); }
.flag { width: 21px; height: 15px; flex: none; display: block; }
.flag svg { width: 100%; height: 100%; display: block; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.flag img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.lang-menu {
  position: absolute; top: 44px; left: 0; width: 200px; background: #fff; border-radius: 13px; padding: 6px;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .25), 0 0 0 1px rgba(0, 0, 0, .05);
  opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none; transform-origin: top;
  transition: opacity .22s ease, transform .32s cubic-bezier(.2, .8, .2, 1);
}
.lang.open .lang-menu { opacity: 1; transform: none; pointer-events: auto; }
.lang-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 9px;
  font-size: 15px; font-weight: 600; color: var(--ink); text-align: start;
}
.lang-item:hover { background: #f3f3f6; }
.lang-item small { color: var(--ink-3); font-weight: 400; font-size: 12.5px; margin-inline-start: auto; }
.lang-item.on { background: #f0f0f3; }
.lang-item.on::after { content: "✓"; margin-inline-start: 8px; font-size: 13px; }

/* English: Proxima Nova, and the whole frame mirrored (Persian reads from the right, English from the left) */
@font-face { font-family: "Proxima Nova"; src: url("assets/fonts/ProximaNova-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Proxima Nova"; src: url("assets/fonts/ProximaNova-Semibold.woff2") format("woff2"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "Proxima Nova"; src: url("assets/fonts/ProximaNova-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Proxima Nova"; src: url("assets/fonts/ProximaNova-Extrabold.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Proxima Nova"; src: url("assets/fonts/ProximaNova-Black.woff2") format("woff2"); font-weight: 900 950; font-display: swap; }
html[lang="en"] { --f: "Proxima Nova", "Helvetica Neue", Arial, sans-serif; }
html[lang="en"] .intro h1 { line-height: 1.02; }

@media (min-width: 761px) and (orientation: landscape), (min-width: 1101px) {   /* = desktop: the opposite of the mobile query */
  html[dir="ltr"] .ui-fade { right: auto; left: -400px; background: linear-gradient(90deg, var(--paper) 0 52%, rgba(var(--paper-rgb),.82) 64%, rgba(var(--paper-rgb),0) 92%); }
  html[dir="ltr"] .intro { right: auto; left: 60px; width: 340px; }
  html[dir="ltr"] .intro h1 { font-size: 52px; }
  html[dir="ltr"] .intro .lede { max-width: 320px; }
  html[dir="ltr"] .region-list button { font-size: 16px; }   /* English names are longer than Persian ones */
  html[dir="ltr"] .regions { gap: 18px; }
  html[dir="ltr"] .brand { right: auto; left: 60px; }
  html[dir="ltr"] .regions { left: auto; right: 60px; flex-direction: row-reverse; }   /* ruler sits on the map side of the names */
  html[dir="ltr"] .lang { left: auto; right: 60px; }
  html[dir="ltr"] .lang-menu { left: auto; right: 0; }
  html[dir="ltr"] .coords { left: auto; right: 144px; text-align: right; }
  html[dir="ltr"] .hint { left: auto; right: 60px; }
  html[dir="ltr"] .foot { right: auto; left: 60px; }
}

/* =====================================================================
   5. MOBILE & PORTRAIT TABLET
   ===================================================================== */
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  .map-view { display: flex; flex-direction: column; }
  .app[data-view="story"] .map-view { transform: translate3d(-30%, 0, 0); }
  .ui { display: contents; }
  .ui-fade, .brand, .hint, .regions, .coords { display: none; }
  .lang { left: auto; right: 16px; top: max(16px, env(safe-area-inset-top)); }
  .lang-menu { left: auto; right: 0; }
  html[dir="rtl"] .lang { right: auto; left: 16px; }
  html[dir="rtl"] .lang-menu { right: auto; left: 0; }

  .intro {
    position: relative; right: auto; top: auto; width: auto; z-index: 2; flex: none;
    padding: max(20px, env(safe-area-inset-top)) 20px 26px;
    background: linear-gradient(var(--paper) 72%, rgba(var(--paper-rgb),0));
    margin-bottom: -18px;
  }
  .intro h1 { font-size: clamp(38px, 11.5vw, 64px); line-height: 1.22; margin-top: 6px; white-space: normal; }
  .intro p { font-size: 14px; line-height: 25px; margin-top: 10px; max-width: 46ch; }
  .intro p .more { display: none; }

  .stage { position: relative; inset: auto; flex: 1 1 auto; min-height: 0; order: 1; }
  .chips { order: 2; }
  .foot { order: 3; }
  /* the desktop ruler, laid flat under the chips; it scrolls with them (background-attachment: local) */
  .chips {
    --rb: max(18px, env(safe-area-inset-bottom));
    display: flex; gap: 8px; overflow-x: auto; flex: none; scroll-snap-type: x proximity;
    padding: 12px 20px calc(var(--rb) + 26px); scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    background-image:
      linear-gradient(var(--ink-3), var(--ink-3)),
      repeating-linear-gradient(to right, var(--ink-3) 0 1px, transparent 1px 9px),
      repeating-linear-gradient(to right, var(--ink) 0 1px, transparent 1px 45px);
    background-size: 100% 1px, 100% 6px, 100% 12px;
    background-position: 0 calc(100% - var(--rb)), 0 calc(100% - var(--rb)), 0 calc(100% - var(--rb));
    background-repeat: no-repeat; background-attachment: local;
  }
  .chips button { position: relative; }
  .chips button[aria-current="true"]::after {
    content: ""; position: absolute; left: 50%; bottom: -21px; width: 8px; height: 8px; margin-left: -4px;
    border-radius: 50%; background: var(--terra); box-shadow: 0 0 0 3px var(--paper);
  }
  .chips::-webkit-scrollbar { display: none; }
  .chips button {
    flex: none; scroll-snap-align: center; white-space: nowrap;
    font-size: 15px; font-weight: 500;
    padding: 9px 18px; border: 1px solid var(--ink); border-radius: 999px; background: var(--paper);
    transition: background .3s ease, color .3s ease, border-color .3s ease;
  }
  .chips button[aria-current="true"] { background: var(--terra); border-color: var(--terra); color: var(--cream); }
  .foot { position: static; height: auto; padding: 0 20px 14px; font-size: 11px; gap: 12px; }
  .credits-sig { position: static; height: auto; order: 4; flex: none; gap: 8px; padding: 14px 16px max(14px, env(safe-area-inset-bottom)); font-size: 11px; }

  .story-view { left: 0; }
  .strip { right: 14px; left: auto; top: max(14px, env(safe-area-inset-top)); bottom: auto; width: auto; height: auto; border: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; z-index: 5; }
  .app[data-view="story"] .strip { transition: opacity .5s ease .9s, visibility 0s; }
  .back { flex-direction: row; gap: 8px; padding: 10px 18px; font-size: 14px; }
  .back .txt { writing-mode: horizontal-tb; }

  .story { flex-direction: column; width: 100vw; padding: 0; }
  .story-photo { width: 100%; height: 42vh; }
  @supports (height: 1svh) { .story-photo { height: 42svh; } }
  .card { width: auto; height: auto; flex: 1 1 auto; margin: 0; padding: 20px 20px max(20px, env(safe-area-inset-bottom)); }
    .card-body { margin-top: 16px; }
  .city { font-size: 36px; }
  .desc { font-size: 16px; }
  .badge { display: none; }
  .card-map { padding: 14px 0 0; }
  .card-map .mini { max-height: 22vh; }
  /* the 25 — 31 counter sits at the bottom-left of the card on phones */
  .card-top .counter { position: absolute; left: 20px; bottom: max(20px, env(safe-area-inset-bottom)); }
  html[dir="ltr"] .card-top .counter { left: auto; right: 20px; }
}
@media (max-width: 760px) and (min-height: 760px) {
  }

/* =====================================================================
   6. REDUCED MOTION
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  :root { --t-view: .01s; --t-draw: .01s; }
  .is-drawing .ink path { animation: none; stroke-dashoffset: 0; stroke-dasharray: none; }
  .marker .halo, .marker .ring-spin, .badge .spin, .back:hover .arr { animation: none; }
  .rise, .story.is-in .rise { transition: opacity .3s ease; transform: none; }
  .wipe { clip-path: none !important; }
  .story-photo img { transform: none !important; }
  .labels, .markers { transition: none; }
}
