/* MoneyExchange — design system. Overrides theme.css tokens to the dark-purple
   mockup palette, keeps light mode + the sun/moon toggle working. */

/* ---------- Tokens (exact brand palette) ---------- */
:root, :root[data-theme="dark"] {
  --bg: #050D25;            /* Background (main) */
  --bg-2: #0B1630;          /* Section background */
  --surface: #14233D;       /* Card background */
  --surface-2: #182B49;
  --surface-alt: #0B1630;
  --border: #263A5C;        /* Card border */
  --border-soft: #1B2C48;
  --text: #F1F3FA;          /* Text primary */
  --text-muted: #94A3C0;    /* Text secondary */
  --text-faint: #6B7A9C;
  --input-bg: #0A142E;
  --primary: #5B5BEF;       /* Primary purple */
  --primary-hover: #4A4AE0;
  --primary-bright: #6C63FF;/* Bright purple */
  --primary-soft: #5B5BEF22;
  --accent: #4FD1FF;        /* Accent blue */
  --accent-soft: #4FD1FF1f;
  --success-text: #22C55E;  /* Success green */
  --success-bg: #22C55E1f;
  --danger-text: #EF4444;   /* Error red */
  --danger-bg: #EF44441f;
  --warning-text: #F59E0B;  /* Warning orange */
  --up: #22C55E;
  --down: #EF4444;
  --shadow: rgba(2, 6, 20, .6);
  /* Gradients from the brand sheet (135deg) */
  --grad-primary: linear-gradient(135deg, #5B5BEF, #4FD1FF);   /* purple -> blue */
  --grad-dark:    linear-gradient(135deg, #050D25, #0B1630);   /* navy -> indigo */
  --grad-accent:  linear-gradient(135deg, #4FD1FF, #6C63FF);   /* blue -> purple */
  --grad-card:    linear-gradient(135deg, #0B1630, #14233D);   /* subtle */
  --grad-glow:    linear-gradient(135deg, #6C63FF40, #4FD1FF40);
  --brand-gradient: var(--grad-primary);
  --hero-gradient:
    radial-gradient(1200px 600px at 20% 0%, rgba(79, 21, 255, 0.15), transparent 60%),
    radial-gradient(1000px 500px at 100% 20%, rgba(79, 209, 255, 0.12), transparent 60%);
  --glow: 0 0 42px -8px rgba(108, 99, 255, .5);
  --radius: 16px;
  --radius-lg: 22px;
  --ring: 0 0 0 3px rgba(79, 209, 255, .28);
}

:root[data-theme="light"] {
  --bg: #F2F4FB;
  --bg-2: #E9ECF7;
  --surface: #FFFFFF;
  --surface-2: #F6F8FE;
  --surface-alt: #E9ECF7;
  --border: #DBE0EF;
  --border-soft: #E7EAF5;
  --text: #101A33;
  --text-muted: #4A5578;
  --text-faint: #8A93B2;
  --input-bg: #FFFFFF;
  --primary: #5B5BEF;
  --primary-hover: #4A4AE0;
  --primary-bright: #6C63FF;
  --primary-soft: #5B5BEF14;
  --accent: #2BA9D9;
  --accent-soft: #2BA9D914;
  --success-text: #15803D;
  --success-bg: #DCFCE7;
  --danger-text: #B91C1C;
  --danger-bg: #FEE2E2;
  --warning-text: #C2410C;
  --up: #15803D;
  --down: #DC2626;
  --shadow: rgba(16, 26, 51, .12);
  --grad-primary: linear-gradient(135deg, #5B5BEF, #4FD1FF);
  --grad-dark:    linear-gradient(135deg, #EEF1FA, #FFFFFF);
  --grad-accent:  linear-gradient(135deg, #4FD1FF, #6C63FF);
  --grad-card:    linear-gradient(135deg, #F6F8FE, #FFFFFF);
  --grad-glow:    linear-gradient(135deg, #6C63FF22, #4FD1FF22);
  --brand-gradient: var(--grad-primary);
  --hero-gradient:
    radial-gradient(1100px 560px at 20% 0%, rgba(91, 91, 239, 0.10), transparent 60%),
    radial-gradient(900px 460px at 100% 20%, rgba(79, 209, 255, 0.10), transparent 60%);
  --glow: 0 12px 40px -16px rgba(91, 91, 239, .4);
  --radius: 16px;
  --radius-lg: 22px;
  --ring: 0 0 0 3px rgba(91, 91, 239, .22);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #F2F4FB; --bg-2: #E9ECF7; --surface: #FFF; --surface-2: #F6F8FE;
    --surface-alt: #E9ECF7; --border: #DBE0EF; --border-soft: #E7EAF5;
    --text: #101A33; --text-muted: #4A5578; --text-faint: #8A93B2;
    --input-bg: #FFF; --primary: #5B5BEF; --primary-hover: #4A4AE0;
    --primary-bright: #6C63FF; --primary-soft: #5B5BEF14;
    --accent: #2BA9D9; --accent-soft: #2BA9D914;
    --success-text: #15803D; --success-bg: #DCFCE7;
    --danger-text: #B91C1C; --danger-bg: #FEE2E2; --warning-text: #C2410C;
    --up: #15803D; --down: #DC2626; --shadow: rgba(16,26,51,.12);
    --grad-dark: linear-gradient(135deg, #EEF1FA, #FFFFFF);
    --grad-card: linear-gradient(135deg, #F6F8FE, #FFFFFF);
    --grad-glow: linear-gradient(135deg, #6C63FF22, #4FD1FF22);
    --hero-gradient:
      radial-gradient(1100px 560px at 20% 0%, rgba(91,91,239,0.10), transparent 60%),
      radial-gradient(900px 460px at 100% 20%, rgba(79,209,255,0.10), transparent 60%);
    --glow: 0 12px 40px -16px rgba(91,91,239,.4);
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; overflow-anchor: none; }
/* Grid/flex tracks default to min-width:auto, so a wide fixed-size child
   (e.g. hero-visual img) can force its whole row wider than the viewport on
   narrow screens even with grid-template-columns: 1fr. minmax(0, …) below
   lets tracks actually shrink; this container query is the last-resort net. */
.container { min-width: 0; }
body {
  font-family: "IRANSans", Tahoma, "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(1200px 700px at 12% -5%, rgba(91, 91, 239, .18), transparent 60%),
    radial-gradient(1100px 650px at 100% 8%, rgba(79, 209, 255, .12), transparent 58%),
    radial-gradient(900px 900px at 50% 120%, rgba(108, 99, 255, .10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; color: var(--primary); }
img { max-width: 100%; }
h1, h2, h3 { color: var(--text); line-height: 1.4; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 900px; }
main { flex: 1; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background:
    linear-gradient(color-mix(in srgb, var(--bg) 80%, transparent), color-mix(in srgb, var(--bg) 92%, transparent)),
    url("/img/wave-bg.jpg") center / cover no-repeat;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
:root[data-theme="light"] .site-header {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 74px; min-width: 0;
}
.brand {
  display: flex; align-items: center; gap: 11px; min-width: 0;
  font-weight: 800; font-size: 1.2rem; color: var(--text);
}
.brand span:last-child {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 38px; height: 38px; object-fit: contain; flex-shrink: 0;
  filter: drop-shadow(0 3px 10px rgba(37, 99, 235, .4));
}
.site-nav { display: flex; align-items: center; gap: 2px; }
.site-nav a {
  color: var(--text-muted); padding: 9px 15px; border-radius: 10px;
  font-size: .95rem; font-weight: 600; transition: color .15s, background .15s;
}
.site-nav a:hover { color: var(--text); background: var(--surface); }
.site-nav a.active { color: #fff; background: var(--primary-soft); color: var(--accent); }
.theme-toggle {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 999px; width: 42px; height: 42px;
  cursor: pointer; font-size: 1rem; margin-inline-start: 8px; flex-shrink: 0;
  transition: border-color .15s;
}
.theme-toggle:hover { border-color: var(--primary); }
.nav-toggle {
  display: none; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; width: 42px; height: 42px;
  cursor: pointer; font-size: 1.1rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer;
  background: var(--brand-gradient); color: #fff;
  padding: 13px 26px; border-radius: 12px;
  font: inherit; font-weight: 700; font-size: 1rem;
  box-shadow: 0 12px 30px -12px var(--primary);
  transition: transform .06s, box-shadow .15s, opacity .15s;
}
.btn:hover { text-decoration: none; color: #fff; box-shadow: 0 16px 40px -12px var(--primary); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-block { width: 100%; }
.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border); box-shadow: none;
}
.btn-outline:hover { background: var(--surface); color: var(--text); box-shadow: none; }
.btn-ghost {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: none;
}

/* ---------- Cards / sections ---------- */
.section { padding: 60px 0; position: relative; }
/* alternating section gets a gradient wash + glow */
.section-alt {
  background:
    radial-gradient(900px 400px at 85% 0%, rgba(91, 91, 239, .14), transparent 60%),
    radial-gradient(700px 380px at 10% 100%, rgba(79, 209, 255, .10), transparent 60%),
    linear-gradient(180deg, var(--bg-2), color-mix(in srgb, var(--bg-2) 70%, var(--surface)));
  border-block: 1px solid var(--border-soft);
}
.section-head { margin-bottom: 34px; }
.section-head h2 { font-size: 1.7rem; margin: 0 0 8px; }
.section-head p { color: var(--text-muted); margin: 0; font-size: 1.02rem; }
/* A link like "View all rates →" (or its Persian equivalent, arrow on the
   other side) needs its own direction resolved from its actual text, not
   forced either way and not inherited from the page's fixed RTL shape —
   otherwise the trailing arrow flips to the wrong side per language. */
.section-head > a { unicode-bidi: plaintext; }

.card {
  position: relative;
  background: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: 0 20px 50px -30px var(--shadow), inset 0 1px 0 rgba(255,255,255,.03);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.card:hover {
  border-color: color-mix(in srgb, var(--primary) 50%, var(--border));
  transform: translateY(-3px);
  box-shadow: 0 26px 60px -28px rgba(91,91,239,.35);
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }

.feature { text-align: center; }
.feature .ico {
  width: 58px; height: 58px; margin: 0 auto 14px;
  border-radius: 16px; display: grid; place-items: center;
  background: var(--grad-accent); color: #fff;
  font-size: 1.4rem;
  box-shadow: 0 12px 30px -12px rgba(79,209,255,.5);
}
.feature h3 { margin: 0 0 6px; font-size: 1.08rem; }
.feature p { margin: 0; color: var(--text-muted); font-size: .94rem; }

/* ---------- Page head (breadcrumb + title) ---------- */
.page-head {
  background:
    radial-gradient(800px 400px at 80% 0%, rgba(91, 91, 239, .20), transparent 62%),
    radial-gradient(600px 340px at 12% 100%, rgba(79, 209, 255, .12), transparent 60%),
    linear-gradient(color-mix(in srgb, var(--bg) 88%, transparent), color-mix(in srgb, var(--bg) 93%, transparent)),
    url("/img/hero-earth-bg.jpg") center / cover no-repeat;
  border-bottom: 1px solid var(--border-soft);
  padding: 44px 0 50px;
}
:root[data-theme="light"] .page-head {
  background:
    radial-gradient(800px 400px at 80% 0%, rgba(91, 91, 239, .16), transparent 62%),
    radial-gradient(600px 340px at 12% 100%, rgba(79, 209, 255, .1), transparent 60%),
    linear-gradient(rgba(248, 250, 252, .74), rgba(248, 250, 252, .8)),
    url("/img/hero-earth-bg.jpg") center / cover no-repeat;
}
.breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: .86rem; color: var(--text-faint); margin-bottom: 14px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: .5; }
.breadcrumb .current { color: var(--text); font-weight: 700; }
.page-head h1 { margin: 0; font-size: 2rem; }
.page-head .page-sub { margin: 10px 0 0; color: var(--text-muted); font-size: 1.05rem; max-width: 720px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 76px 0 60px;
  background:
    radial-gradient(700px 500px at 78% 30%, rgba(91, 91, 239, .22), transparent 65%),
    radial-gradient(600px 420px at 20% 8%, rgba(79, 209, 255, .16), transparent 60%),
    linear-gradient(color-mix(in srgb, var(--bg) 88%, transparent), color-mix(in srgb, var(--bg) 93%, transparent)),
    url("/img/hero-world-map.jpg") center / cover no-repeat;
  border-bottom: 1px solid var(--border-soft);
}
/* The background photo is dark/navy by design — in light theme it would
   muddy a light page, so fall back to just the accent glows (same trick
   already used for .site-header's wave-bg.jpg). */
:root[data-theme="light"] .hero {
  background:
    radial-gradient(700px 500px at 78% 30%, rgba(91, 91, 239, .18), transparent 65%),
    radial-gradient(600px 420px at 20% 8%, rgba(79, 209, 255, .12), transparent 60%),
    linear-gradient(rgba(248, 250, 252, .74), rgba(248, 250, 252, .8)),
    url("/img/hero-world-map.jpg") center / cover no-repeat;
}
/* About/Help share this same .hero section markup as Home — swap in a
   different photo so they don't look identical to the homepage. (Can't use
   the background-image longhand alone here: this is a 4-layer background,
   so a 1-value override would replace all 4 layers, not just the photo.) */
.page-about .hero, .page-help .hero {
  background:
    radial-gradient(700px 500px at 78% 30%, rgba(91, 91, 239, .22), transparent 65%),
    radial-gradient(600px 420px at 20% 8%, rgba(79, 209, 255, .16), transparent 60%),
    linear-gradient(color-mix(in srgb, var(--bg) 88%, transparent), color-mix(in srgb, var(--bg) 93%, transparent)),
    url("/img/hero-earth-bg.jpg") center / cover no-repeat;
}
:root[data-theme="light"] .page-about .hero,
:root[data-theme="light"] .page-help .hero {
  background:
    radial-gradient(700px 500px at 78% 30%, rgba(91, 91, 239, .18), transparent 65%),
    radial-gradient(600px 420px at 20% 8%, rgba(79, 209, 255, .12), transparent 60%),
    linear-gradient(rgba(248, 250, 252, .74), rgba(248, 250, 252, .8)),
    url("/img/hero-earth-bg.jpg") center / cover no-repeat;
}
.hero .container { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 48px; align-items: center; }
.hero-copy h1 { font-size: 2.6rem; margin: 0 0 18px; }
.hero-copy p { font-size: 1.14rem; color: var(--text-muted); margin: 0 0 26px; max-width: 480px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
/* Above-the-fold, so this fades/slides in immediately on load rather than
   waiting for a scroll trigger — the calculator card (second) lags slightly
   behind the headline for a gentle, staggered reveal. */
.hero-copy, .hero-visual { animation: mx-card-in .7s cubic-bezier(.16, 1, .3, 1) backwards; }
.hero-visual { animation-delay: .12s; }
@media (prefers-reduced-motion: reduce) {
  .hero-copy, .hero-visual { animation: none; }
}
.hero-visual {
  position: relative; min-height: 340px;
  display: grid; place-items: center;
}
.hero-visual img {
  width: 100%; max-width: 540px; height: auto;
  filter: drop-shadow(0 24px 60px rgba(91, 91, 239, .35));
  border-radius: var(--radius-lg);
}
/* Auto-rotating crossfade (see site.js mxInitHeroCarousel) — multiple
   images stacked in the same spot, one faded in at a time. Only applies
   when .hero-visual has this modifier; a plain single-image .hero-visual
   (About/Help) is unaffected by any of this. */
.hero-visual.mx-carousel { aspect-ratio: 1080 / 607; max-width: 540px; margin: 0 auto; }
.hero-visual.mx-carousel img {
  position: absolute; inset: 0; max-width: none;
  width: 100%; height: 100%; object-fit: contain;
  opacity: 0; transition: opacity 1.1s ease-in-out;
}
.hero-visual.mx-carousel img.mx-active { opacity: 1; }
:root[data-theme="light"] .hero-visual.mx-carousel img { filter: none; }
@media (prefers-reduced-motion: reduce) {
  .hero-visual.mx-carousel img { transition: none; }
}
/* JPEG art has a dark bg; blend it into the page on dark theme */
:root:not([data-theme="light"]) .hero-visual img,
:root:not([data-theme="light"]) .illus img { mix-blend-mode: screen; }
/* In light theme the art can't blend the same way (screen-mode washes it
   out on a light bg instead of hiding the dark corners), so instead of a
   jarring bare dark rectangle, frame it as a deliberate dark card — padding
   acts as a visible border and a lifted shadow makes it read as intentional. */
:root[data-theme="light"] .hero-visual {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 30px 60px -24px rgba(15, 23, 42, .35);
}
:root[data-theme="light"] .hero-visual img {
  border-radius: calc(var(--radius-lg) - 8px);
  filter: none;
}
/* Same bare-dark-rectangle problem on any other illustration using the
   generic .illus slot (e.g. the homepage "why us" art) — same fix. */
:root[data-theme="light"] .illus img {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  padding: 20px;
  box-sizing: border-box;
  box-shadow: 0 30px 60px -24px rgba(15, 23, 42, .35);
  filter: none;
}

/* Generic illustration slot */
.illus { display: grid; place-items: center; }
.illus img {
  width: 100%; max-width: 460px; height: auto; border-radius: var(--radius-lg);
  filter: drop-shadow(0 20px 50px rgba(79, 209, 255, .22));
}

/* ---------- Rate calculator ---------- */
.calc {
  position: relative;
  background:
    linear-gradient(160deg, rgba(91,91,239,.12), transparent 45%),
    var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: 0 40px 90px -40px rgba(91,91,239,.4), 0 0 0 1px rgba(79,209,255,.06);
}
.calc h3 { margin: 0 0 16px; font-size: 1.05rem; text-align: center; }
.calc-row {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
}
.calc-row input {
  border: none; background: transparent; color: var(--text);
  font: inherit; font-size: 1.15rem; font-weight: 700; width: 100%; outline: none;
  /* Numbers are always typed/read left-to-right, even on an RTL (Persian)
     page — otherwise the cursor jumps to the wrong side while typing. */
  direction: ltr; text-align: left;
}
.calc-row select {
  border: none; background: transparent; color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer; outline: none;
}
.calc-swap {
  margin: 8px auto; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--accent);
  cursor: pointer; font-size: 1rem; display: grid; place-items: center;
}
.calc-meta {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text-faint); font-size: .82rem; margin: 12px 2px 16px;
}
/* "1 USD = 1.02 EUR" mixes digits, "=" and Latin currency codes as several
   short alternating runs — inside an RTL page these get visually reordered
   by the browser's bidi algorithm unless forced LTR explicitly (unlike a
   real <input>, a plain text node is reflowed as part of the surrounding
   RTL paragraph). Pure date/time strings like #calcUpdated don't need this
   — a single coherent run in one language already displays correctly. */
#calcRate { direction: ltr; }
.calc-words {
  color: var(--text-faint); font-size: .78rem; margin: 6px 4px 0; min-height: 1.1em;
}

/* ---------- Rate board ---------- */
.rate-board-status {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  color: var(--text-faint); font-size: .84rem; margin: -8px 0 18px;
}
.rate-board-status .live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--up, #22c55e);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--up, #22c55e) 60%, transparent);
  animation: rate-pulse 1.8s infinite;
  flex-shrink: 0;
}
@keyframes rate-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--up, #22c55e) 55%, transparent); }
  70%  { box-shadow: 0 0 0 6px color-mix(in srgb, var(--up, #22c55e) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--up, #22c55e) 0%, transparent); }
}
.rate-board-clock { margin-inline-start: auto; font-variant-numeric: tabular-nums; direction: ltr; }
.rate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.rate-cell {
  position: relative; overflow: hidden;
  background:
    linear-gradient(150deg, rgba(79,209,255,.10), transparent 50%),
    var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 18px 18px;
  box-shadow: 0 18px 44px -28px var(--shadow);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
/* Thin top accent bar, tinted by the day's trend direction (set via the
   rc-up/rc-down class in rates.js) — a quick-scan cue before reading numbers. */
.rate-cell::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px;
  background: var(--border); opacity: .6;
}
.rate-cell.rc-up::before { background: linear-gradient(90deg, var(--up), color-mix(in srgb, var(--up) 35%, transparent)); opacity: 1; }
.rate-cell.rc-down::before { background: linear-gradient(90deg, var(--down), color-mix(in srgb, var(--down) 35%, transparent)); opacity: 1; }
.rate-cell:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  transform: translateY(-3px);
  box-shadow: 0 24px 54px -26px var(--shadow);
}

.rate-cell .rc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.rate-cell .flag {
  font-size: 1.25rem; width: 38px; height: 38px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--surface-alt); border: 1px solid var(--border);
}
.rate-cell .rc-id { display: flex; flex-direction: column; min-width: 0; }
.rate-cell .code { font-weight: 800; letter-spacing: .5px; font-size: .95rem; }
.rate-cell .name {
  color: var(--text-faint); font-size: .74rem; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Same bidi-reordering risk as #calcRate above — "1,234 Toman" / "▲ 1.2%"
   have no strong-direction characters of their own, so token order would
   otherwise follow the surrounding RTL paragraph instead of staying as typed. */
.rate-cell .price-row, .rate-cell .chg-pill { direction: ltr; }
.rate-cell .price-row { display: flex; align-items: baseline; gap: 6px; }
.rate-cell .price { font-size: 1.5rem; font-weight: 800; letter-spacing: -.2px; }
.rate-cell .unit { color: var(--text-faint); font-size: .74rem; font-weight: 600; }
.rate-cell .chg-pill {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 10px; padding: 3px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 700;
}
.rate-cell .chg-pill.up { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.rate-cell .chg-pill.down { color: var(--down); background: color-mix(in srgb, var(--down) 14%, transparent); }
.rate-cell-call { border-style: dashed; }
.rate-cell .price-call { font-size: 1.05rem; font-weight: 700; color: var(--accent); }
.rate-cell .chg-pill.call-hint { background: transparent; padding: 3px 0; margin-top: 8px; }
.rate-cell .chg-pill.call-hint a { color: var(--accent); font-weight: 700; }
.rate-cell .chg-pill.call-hint a:hover { text-decoration: underline; }

/* Staggered fade/slide-in on first paint (each card's JS-set animation-delay
   spaces them out) — smooth, understated easing rather than a linear move. */
.rate-cell.mx-enter {
  animation: mx-card-in .55s cubic-bezier(.16, 1, .3, 1) backwards;
}
@keyframes mx-card-in {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* Brief highlight when a price actually changes between polls, so the
   board reads as "live" without re-animating cards that didn't move. */
.rate-cell.flash-up, .rate-cell.flash-down { animation: mx-card-flash .9s ease-out; }
@keyframes mx-card-flash {
  0%   { box-shadow: 0 18px 44px -28px var(--shadow), inset 0 0 0 1px var(--flash-color); background-color: var(--flash-bg); }
  100% { box-shadow: 0 18px 44px -28px var(--shadow), inset 0 0 0 1px transparent; background-color: transparent; }
}
.rate-cell.flash-up { --flash-color: color-mix(in srgb, var(--up) 70%, transparent); --flash-bg: color-mix(in srgb, var(--up) 10%, transparent); }
.rate-cell.flash-down { --flash-color: color-mix(in srgb, var(--down) 70%, transparent); --flash-bg: color-mix(in srgb, var(--down) 10%, transparent); }
@media (prefers-reduced-motion: reduce) {
  .rate-cell.mx-enter { animation: none; }
  .rate-cell.flash-up, .rate-cell.flash-down { animation: none; }
}

/* ---- Rate board skeleton (shown before the first real poll resolves) ---- */
.rate-skeleton { display: flex; flex-direction: column; }
.sk {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg, var(--border-soft, var(--border)) 25%, color-mix(in srgb, var(--border-soft, var(--border)) 60%, var(--surface-alt)) 50%, var(--border-soft, var(--border)) 75%);
  background-size: 200% 100%;
  animation: mx-shimmer 1.4s ease-in-out infinite;
}
@keyframes mx-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk-flag { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; }
.sk-code { width: 44px; height: 13px; }
.sk-name2 { width: 64px; height: 10px; margin-top: 6px; }
.sk-price { width: 70%; height: 26px; margin-top: 2px; }
.sk-chg { width: 72px; height: 20px; border-radius: 999px; margin-top: 10px; }
@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; }
}

/* ---------- Process steps ---------- */
.process-wrap { display: grid; grid-template-columns: 320px 1fr; gap: 40px; align-items: center; }
.process-art img { max-width: 300px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; position: relative; }
.step { text-align: center; }
.step .step-ico {
  width: 96px; height: 96px; object-fit: contain; margin: 0 auto 6px; display: block;
  border-radius: 18px;
}
:root:not([data-theme="light"]) .step .step-ico { mix-blend-mode: screen; }
.step .num {
  width: 40px; height: 40px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--primary-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-size: 1rem;
  border: 1px solid var(--border);
}
.step h3 { margin: 0 0 6px; font-size: 1.05rem; }
.step p { margin: 0; color: var(--text-muted); font-size: .92rem; }
@media (max-width: 900px) {
  .process-wrap { grid-template-columns: 1fr; }
  .process-art { display: none; }
}

/* ---------- Full-bleed section break (bold, not the subtle hero backdrop) ---------- */
.section-break {
  position: relative;
  min-height: 320px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 70px 24px;
  background:
    linear-gradient(120deg, rgba(5,13,37,.72), rgba(5,13,37,.5)),
    url("/img/section-break-bg.jpg") center 35% / cover no-repeat;
}
.section-break-inner { max-width: 640px; }
.section-break h2 { color: #fff; font-size: 2.1rem; margin: 0 0 14px; }
.section-break p { color: rgba(255,255,255,.88); font-size: 1.08rem; margin: 0; }
:root[data-theme="light"] .section-break {
  background:
    linear-gradient(120deg, rgba(5,13,37,.78), rgba(5,13,37,.6)),
    url("/img/section-break-bg.jpg") center 35% / cover no-repeat;
}
@media (max-width: 640px) {
  .section-break { min-height: 240px; padding: 50px 20px; }
  .section-break h2 { font-size: 1.6rem; }
}

/* ---------- CTA banner ---------- */
.cta-banner {
  position: relative; overflow: hidden;
  background:
    linear-gradient(120deg, rgba(7,12,28,.88), rgba(18,22,58,.62) 55%, rgba(79,99,255,.38)),
    url("/img/cta-bg.jpg") center 55% / cover no-repeat,
    var(--grad-primary);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius-lg);
  padding: 34px 38px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  flex-wrap: wrap;
  box-shadow: var(--glow), inset 0 1px 0 rgba(255,255,255,.14);
}
.cta-banner p {
  position: relative; z-index: 1;
  margin: 0; color: #fff; font-size: 1.15rem; font-weight: 700; max-width: 60%;
  text-shadow: 0 2px 14px rgba(0,0,0,.4);
}
.cta-banner .btn {
  position: relative; z-index: 1;
  background: #fff; color: var(--primary);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.55);
  transition: transform .16s, box-shadow .16s, color .16s;
}
.cta-banner .btn:hover {
  color: var(--primary-hover); transform: translateY(-2px);
  box-shadow: 0 18px 38px -10px rgba(0,0,0,.6);
}
.cta-banner .cta-art {
  position: absolute; inset-inline-end: 24px; bottom: -18px; width: 170px; z-index: 0;
  opacity: .9; mix-blend-mode: lighten; pointer-events: none;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,.4));
}
@media (max-width: 640px) { .cta-banner .cta-art { display: none; } .cta-banner p { max-width: 100%; } }

/* ---------- WhatsApp order CTA (always-dark card, like .cta-banner) ---------- */
.whatsapp-cta {
  background: #0D1117;
  border: 2px dashed #22C55E;
  border-radius: 28px;
  padding: 44px 48px;
  text-align: center;
}
.whatsapp-cta h2 { margin: 0 0 14px; font-size: 1.9rem; font-weight: 800; color: #fff; }
.whatsapp-cta p {
  margin: 0 0 28px; color: #9CA3AF; font-size: 1.1rem; line-height: 1.7;
  max-width: 560px; margin-inline: auto;
}
.btn-whatsapp {
  display: flex; width: 100%;
  padding: 20px 28px; border-radius: 999px; font-size: 1.15rem;
  background: #22C55E; color: #fff;
}
.btn-whatsapp:hover { background: #1DA851; color: #fff; }
.btn-whatsapp img { width: 24px; height: 24px; filter: brightness(0) invert(1); }
@media (max-width: 640px) {
  .whatsapp-cta { padding: 32px 22px; }
  .whatsapp-cta h2 { font-size: 1.4rem; }
}

/* ---------- Forms ---------- */
.form-card {
  background:
    linear-gradient(165deg, rgba(91,91,239,.08), transparent 40%),
    var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 30px 32px;
  width: 100%;
  box-shadow: 0 40px 90px -50px rgba(91,91,239,.4);
}
.info-panel {
  background:
    linear-gradient(165deg, rgba(79,209,255,.08), transparent 42%),
    var(--grad-card);
}
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 7px; font-size: .9rem; font-weight: 700; color: var(--text-muted); }
.field-req { color: var(--danger-text); margin-inline-start: 3px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 13px 15px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  font: inherit; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--primary); box-shadow: var(--ring);
}
.field textarea { min-height: 150px; resize: vertical; }
.field-hint { font-size: .82rem; color: var(--text-faint); margin-top: 5px; }

/* Icon inside a text field (contact form). Wraps just the input/textarea
   (not the label) so vertical centering is simple; logical inset-inline
   means the icon sits on the correct side automatically in both RTL
   (Persian) and LTR (English) without any extra per-language rule. */
.input-icon { position: relative; }
.input-icon svg {
  position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-faint); pointer-events: none;
}
.input-icon.icon-top svg { top: 16px; transform: none; }
.input-icon input, .input-icon textarea { padding-inline-start: 42px; }

/* Phone numbers are conventionally written with the country code on the
   left regardless of page direction (same as in Persian usage), so this
   row stays LTR even when the page itself is RTL — otherwise dir=rtl would
   flip the select to the right and read as "number, then code". */
.phone-group { display: flex; gap: 8px; direction: ltr; }
.phone-group select {
  width: auto; flex: 0 0 auto; min-width: 110px; max-width: 130px;
  padding-inline-end: 8px; cursor: pointer;
}
.phone-group input { flex: 1; min-width: 0; text-align: left; }
.phone-group .input-icon { flex: 1; min-width: 0; }
.phone-group .input-icon input { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-msg { margin: 12px 0 0; font-size: .92rem; min-height: 1.2em; }
.form-msg.ok { color: var(--success-text); }
.form-msg.err { color: var(--danger-text); }

.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.cat-chips button {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
  padding: 8px 16px; border-radius: 999px; cursor: pointer; font: inherit; font-size: .9rem;
  transition: all .15s;
}
.cat-chips button:hover { color: var(--text); border-color: var(--primary); }
.cat-chips button.active { background: var(--brand-gradient); color: #fff; border-color: transparent; }

/* ---------- Contact info panel ---------- */
.contact-cols { display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; align-items: start; }
.info-panel {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 26px 28px;
}
.info-panel h2 { margin: 0 0 6px; font-size: 1.3rem; }
.info-panel > p { color: var(--text-muted); margin: 0 0 20px; font-size: .95rem; }
.info-row { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border-soft); }
.info-row:first-of-type { border-top: none; }
.info-row .ico {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 1.2rem;
  background: var(--grad-accent); color: #fff;
  box-shadow: 0 10px 24px -12px rgba(79,209,255,.5);
}
.info-row .ico img, .footer-social a img { width: 20px; height: 20px; display: block; filter: brightness(0) invert(1); }
.info-row .ico.ic-whatsapp { background: #25D366; box-shadow: 0 10px 24px -12px #25D36680; }
.info-row .ico.ic-telegram { background: #26A5E4; box-shadow: 0 10px 24px -12px #26A5E480; }
.info-row .it-title { font-weight: 700; margin-bottom: 2px; }
/* Phone numbers / handles are digit-groups or an @handle — same bidi
   reordering risk as #calcRate: force LTR so the groups don't get
   reshuffled (Persian digits are unaffected either way, so this is safe
   in both languages). */
.info-row .it-value { color: var(--text); font-size: .96rem; direction: ltr; }
.info-row .it-note { color: var(--text-faint); font-size: .8rem; margin-top: 2px; }

/* ---------- Stat tiles (about) ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.stat-tile {
  background: var(--grad-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; text-align: center;
  box-shadow: 0 20px 50px -30px var(--shadow);
  transition: border-color .18s, transform .18s;
}
.stat-tile:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); transform: translateY(-3px); }
.stat-tile .ico {
  width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 15px;
  background: var(--grad-accent); color: #fff;
  display: grid; place-items: center; font-size: 1.3rem;
  box-shadow: 0 12px 28px -12px rgba(79,209,255,.5);
}
.stat-tile h3 { margin: 0 0 4px; font-size: 1.05rem; }
.stat-tile p { margin: 0; color: var(--text-muted); font-size: .9rem; }

/* ---------- FAQ accordion ---------- */
.faq { display: flex; flex-direction: column; gap: 12px; }
.faq-item {
  background: var(--grad-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color .18s;
}
.faq-item[open] { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.faq-item summary {
  list-style: none; cursor: pointer; padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-weight: 700; color: var(--text);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; font-size: 1.3rem; color: var(--accent); flex-shrink: 0;
  transition: transform .2s;
}
.faq-item[open] summary::after { content: "\2013"; }
.faq-item .faq-body {
  padding: 0 20px 18px; color: var(--text-muted); line-height: 1.9;
}

/* ---------- Prose (CMS / editor-authored content) ---------- */
.prose { color: var(--text); font-size: 1.03rem; line-height: 1.9; }
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: 2rem; margin: 0 0 14px; color: var(--text); }
.prose h2 { font-size: 1.5rem; margin: 28px 0 12px; color: var(--text); }
.prose h3 { font-size: 1.2rem; margin: 22px 0 10px; color: var(--text); }
.prose h4 { font-size: 1.05rem; margin: 18px 0 8px; color: var(--text); }
.prose p { margin: 0 0 14px; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-inline-start: 1.6em; }
.prose li { margin-bottom: 6px; }
.prose img { border-radius: 12px; max-width: 100%; height: auto; margin: 12px 0; }
.prose figure { margin: 16px 0; }
.prose figcaption { color: var(--text-faint); font-size: .88rem; margin-top: 6px; text-align: center; }
.prose blockquote {
  border-inline-start: 3px solid var(--primary);
  margin: 16px 0; padding: 8px 18px;
  color: var(--text-muted); background: var(--surface); border-radius: 8px;
}
.prose hr { border: none; border-top: 1px solid var(--border); margin: 26px 0; }
.prose code {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 6px; font-size: .92em;
}
.prose pre {
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; overflow-x: auto;
}
.prose pre code { background: none; border: none; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 10px 12px; text-align: start; }
.prose th { background: var(--surface-2); font-weight: 700; }
.prose mark { background: var(--warning-text); color: #1a1300; padding: 0 3px; border-radius: 3px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  background:
    linear-gradient(var(--bg-2), var(--bg-2)),
    url("/img/wave-bg.jpg") center / cover no-repeat;
  background-blend-mode: multiply;
  color: var(--text-muted);
  padding: 44px 0 26px;
  font-size: .92rem;
}
:root[data-theme="light"] .site-footer { background: var(--bg-2); }
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px;
  margin-bottom: 28px;
}
.footer-grid h4 { margin: 0 0 12px; font-size: .95rem; color: var(--text); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a { color: var(--text-muted); }
.footer-grid a:hover { color: var(--accent); }
.footer-brand .brand { margin-bottom: 12px; }
.footer-brand p { margin: 0; color: var(--text-faint); max-width: 320px; }
.footer-social { display: flex; gap: 10px; margin-top: 14px; }
.footer-social a {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
  transition: transform .15s, opacity .15s;
}
.footer-social a:hover { transform: translateY(-2px); opacity: .9; }
.footer-social a.ic-whatsapp { background: #25D366; border-color: #25D366; }
.footer-social a.ic-telegram { background: #26A5E4; border-color: #26A5E4; }
.footer-social a.ic-instagram { background: linear-gradient(45deg, #f9ce34, #ee2a7b 40%, #6228d7 80%); border-color: transparent; }
.footer-social a.ic-x { background: #000; border-color: #000; }
:root[data-theme="light"] .footer-social a.ic-x { background: #14171a; border-color: #14171a; }
.footer-bottom {
  border-top: 1px solid var(--border-soft); padding-top: 18px;
  text-align: center; color: var(--text-faint); font-size: .85rem;
}

/* ---------- Toasts ---------- */
#toastStack {
  position: fixed; top: 16px; inset-inline-end: 16px;
  display: flex; flex-direction: column; gap: 8px; z-index: 9999;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; box-shadow: 0 6px 24px var(--shadow);
  color: var(--text); max-width: 340px;
}
.toast-success { border-color: var(--success-text); }
.toast-danger { border-color: var(--danger-text); }
.toast-close { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 1.1rem; }
.toast-leaving { opacity: 0; transition: opacity .18s; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero .container { grid-template-columns: minmax(0, 1fr); }
  .hero-visual { min-height: 240px; }
  .contact-cols { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .site-nav { position: fixed; inset: 74px 0 auto 0; flex-direction: column; align-items: stretch;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 10px 16px; gap: 4px;
    transform: translateY(-120%); transition: transform .2s; }
  .site-nav.open { transform: translateY(0); }
  .site-nav .theme-toggle { align-self: flex-start; margin: 6px 0 2px; }
  .nav-toggle { display: grid; place-items: center; }
  .hero-copy h1 { font-size: 2rem; }
  .page-head h1 { font-size: 1.55rem; }
  .steps { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .cta-banner { flex-direction: column; text-align: center; }
}

/* Scroll-reveal and hero/page-head/section-break parallax are now driven by
   GSAP ScrollTrigger (see motion.js) instead of CSS — GPU-friendly transform
   animation that works consistently on iOS Safari, unlike
   background-attachment: fixed. */
