:root {
  --bg: #f6f7fb;
  --bg-soft: #eef0f7;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --brand: #4f46e5;
  --brand-2: #0d9488;
  --brand-soft: #eef2ff;
  --good: #059669;
  --good-soft: #ecfdf5;
  --bad: #dc2626;
  --bad-soft: #fef2f2;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --shadow: 0 1px 2px rgb(15 23 42 / .04), 0 8px 24px rgb(15 23 42 / .06);
  --shadow-lg: 0 2px 4px rgb(15 23 42 / .04), 0 24px 48px rgb(15 23 42 / .10);
  --radius: 18px;
  --radius-sm: 12px;
  --header-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --bg-soft: #111831; --surface: #121a30; --surface-2: #0f1629;
    --text: #e8ecf6; --text-2: #aab4ca; --text-3: #8591ab; --line: #222c47; --line-2: #2e3a5c;
    --brand: #818cf8; --brand-2: #2dd4bf; --brand-soft: #1b2146;
    --good: #34d399; --good-soft: #0f2a24; --bad: #f87171; --bad-soft: #2c1518; --warn: #fbbf24; --warn-soft: #2a2110;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
    --shadow-lg: 0 24px 48px rgb(0 0 0 / .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --bg-soft: #111831; --surface: #121a30; --surface-2: #0f1629;
  --text: #e8ecf6; --text-2: #aab4ca; --text-3: #8591ab; --line: #222c47; --line-2: #2e3a5c;
  --brand: #818cf8; --brand-2: #2dd4bf; --brand-soft: #1b2146;
  --good: #34d399; --good-soft: #0f2a24; --bad: #f87171; --bad-soft: #2c1518; --warn: #fbbf24; --warn-soft: #2a2110;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
  --shadow-lg: 0 24px 48px rgb(0 0 0 / .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  font-size: 16px; line-height: 1.85; overflow-x: hidden;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { height: 100%; display: flex; align-items: center; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); font-size: 17px; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo img { width: 32px; height: 32px; }
.logo img.logo-wordmark { width: auto; height: 40px; }
.logo .logo-sub { font-size: 13px; font-weight: 600; color: var(--text-3); padding-inline-start: 10px; border-inline-start: 1px solid var(--line); }
.footer-logo { display: block; flex: none; }
.footer-logo img { height: 72px; width: auto; display: block; }
/* The blue wordmark/emblem need a light backdrop on the dark theme */
:root[data-theme="dark"] .logo img.logo-wordmark,
:root[data-theme="dark"] .footer-logo img { background: #fff; border-radius: 10px; padding: 4px 10px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo img.logo-wordmark,
  :root:not([data-theme="light"]) .footer-logo img { background: #fff; border-radius: 10px; padding: 4px 10px; }
}
.nav { display: flex; gap: 4px; margin-inline-start: auto; align-items: center; }
.nav a { padding: 7px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: 15px; }
.nav a:hover, .nav a.active { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; flex: none;
}
.icon-btn:hover { border-color: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }
@media (max-width: 560px) { .nav a.hide-sm { display: none; } .logo span { font-size: 15px; } .logo .logo-sub { display: none; } .logo img.logo-wordmark { height: 34px; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 12px;
  font-weight: 600; font-size: 15px; border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, var(--brand-2))); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--line-2); }
.btn-sm { padding: 7px 14px; font-size: 14px; border-radius: 10px; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 72px 0 56px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -40% -10% auto -10%; height: 140%; z-index: -1;
  background:
    radial-gradient(40% 50% at 80% 20%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
    radial-gradient(35% 45% at 15% 35%, color-mix(in srgb, var(--brand-2) 18%, transparent), transparent 70%);
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 13.5px; font-weight: 500;
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px var(--good-soft); }
.hero h1 { font-size: clamp(32px, 5.4vw, 58px); line-height: 1.3; margin: 20px 0 16px; font-weight: 900; letter-spacing: -.5px; }
.hero h1 .grad { background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: clamp(16px, 2vw, 19px); color: var(--text-2); max-width: 640px; margin: 0 0 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 40px; max-width: 600px; }
.hero-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.hero-stats b { display: block; font-size: 22px; font-weight: 800; }
.hero-stats span { color: var(--text-3); font-size: 13.5px; }

/* ---------- Sections ---------- */
.section { padding: 48px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: clamp(22px, 3vw, 30px); font-weight: 800; }
.section-head p { margin: 4px 0 0; color: var(--text-2); }

/* ---------- Country cards ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; }
.ccard {
  position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); color: var(--text); overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.ccard::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--accent, var(--brand)); }
a.ccard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; border-color: var(--line-2); }
.ccard .top { display: flex; align-items: center; gap: 14px; }
.flag { width: 52px; height: 36px; border-radius: 7px; object-fit: cover; box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgb(0 0 0 / .08); flex: none; }
.flag.sm { width: 30px; height: 21px; border-radius: 5px; }
.flag.lg { width: 72px; height: 50px; border-radius: 10px; }
.ccard h3 { margin: 0; font-size: 21px; font-weight: 800; line-height: 1.4; }
.ccard .en { color: var(--text-3); font-size: 13px; direction: ltr; text-align: right; }
.ccard p { color: var(--text-2); margin: 14px 0 16px; font-size: 15px; flex: 1; }
.ccard .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--bg-soft); color: var(--text-2); border: 1px solid var(--line); }
.chip b { color: var(--text); font-weight: 700; }
.ccard .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--text-3); }
.ccard .go { color: var(--brand); font-weight: 600; }
.ccard.soon { opacity: .72; box-shadow: none; background: var(--surface-2); }
.ccard.soon .flag { filter: grayscale(.6); }
.badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.badge.live { background: var(--good-soft); color: var(--good); }

/* ---------- Feature strip ---------- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 12px; }
.feature .ic svg { width: 22px; height: 22px; }
.feature h3 { margin: 0 0 4px; font-size: 17px; }
.feature p { margin: 0; color: var(--text-2); font-size: 14.5px; }

.cta-band {
  border-radius: 24px; padding: 36px 28px; display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 92%, #000), color-mix(in srgb, var(--brand-2) 80%, #000)); color: #fff;
}
.cta-band h2 { margin: 0 0 6px; font-size: clamp(20px, 3vw, 28px); }
.cta-band p { margin: 0; opacity: .88; }
.cta-band .btn { background: #fff; color: #1e1b4b; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 40px; margin-top: 40px; color: var(--text-3); font-size: 14px; }
.site-footer .wrap { display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.site-footer p { margin: 0; max-width: 640px; }

/* ---------- Guide page ---------- */
.progress { position: fixed; top: var(--header-h); inset-inline: 0; height: 3px; z-index: 49; pointer-events: none; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-2), var(--brand)); margin-inline-start: 0; transition: width .1s linear; }
.guide-hero { padding: 36px 0 20px; }
.crumbs { font-size: 14px; color: var(--text-3); margin-bottom: 18px; }
.crumbs a { color: var(--text-3); }
.guide-title { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.guide-title h1 { margin: 0; font-size: clamp(26px, 4vw, 40px); line-height: 1.35; font-weight: 900; }
.guide-title .meta { color: var(--text-3); font-size: 14px; display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.guide-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; margin-top: 26px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.stat span { color: var(--text-3); font-size: 13px; display: block; }
.stat b { font-size: 20px; font-weight: 800; }
.pc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 14px; margin-top: 18px; }
.pc { border-radius: var(--radius); padding: 18px 20px; border: 1px solid var(--line); background: var(--surface); }
.pc h3 { margin: 0 0 8px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.pc ul { margin: 0; padding: 0; list-style: none; }
.pc li { position: relative; padding-inline-start: 22px; margin: 6px 0; color: var(--text-2); font-size: 14.5px; line-height: 1.75; }
.pc li::before { position: absolute; inset-inline-start: 0; top: 0; font-weight: 800; }
.pc.pros h3 { color: var(--good); } .pc.pros li::before { content: "+"; color: var(--good); }
.pc.cons h3 { color: var(--bad); } .pc.cons li::before { content: "−"; color: var(--bad); }

.guide-layout { display: grid; grid-template-columns: 1fr; gap: 32px; padding: 20px 0 40px; }
@media (min-width: 1024px) { .guide-layout { grid-template-columns: 290px minmax(0, 1fr); } }
.toc {
  position: sticky; top: calc(var(--header-h) + 20px); max-height: calc(100vh - var(--header-h) - 40px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; font-size: 14px;
  scrollbar-width: thin;
}
.toc-search { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; margin-bottom: 8px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--text-2); line-height: 1.6; }
.toc a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.toc a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.toc .l2 > a { font-weight: 600; color: var(--text); }
.toc .l3 a { padding-inline-start: 22px; font-size: 13.5px; }
.toc .l3 { display: none; }
.toc .l2.open .l3, .toc.filtering .l3 { display: block; }
.toc li.hidden { display: none !important; }
.toc-toggle { display: none; }
@media (max-width: 1023px) {
  .toc-wrap { position: fixed; inset: 0; z-index: 60; background: rgb(0 0 0 / .45); display: none; }
  .toc-wrap.open { display: block; }
  .toc { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: min(88vw, 340px); max-height: none; border-radius: 0; }
  .toc-toggle {
    display: inline-flex; position: fixed; bottom: 18px; inset-inline-start: 18px; z-index: 55;
    box-shadow: var(--shadow-lg);
  }
}

/* ---------- Prose ---------- */
.prose { min-width: 0; }
.prose > section[data-level="2"] {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 24px 20px; margin-bottom: 22px;
}
@media (max-width: 560px) { .prose > section[data-level="2"] { padding: 4px 16px 16px; } }
.prose h2 { font-size: clamp(21px, 2.6vw, 27px); font-weight: 800; margin: 18px 0 12px; line-height: 1.5; }
.prose h3 { font-size: 19px; font-weight: 700; margin: 30px 0 10px; line-height: 1.6; padding-top: 18px; border-top: 1px solid var(--line); }
.prose p { margin: 10px 0; color: var(--text); }
.prose p.subhead { margin-top: 20px; font-weight: 700; font-size: 16.5px; color: var(--brand); }
.prose ul, .prose ol { padding-inline-start: 22px; margin: 10px 0; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--brand); font-weight: 700; }
.prose blockquote {
  margin: 16px 0; padding: 14px 18px; border-radius: var(--radius-sm); background: var(--warn-soft);
  border-inline-start: 4px solid var(--warn); color: var(--text);
}
.prose blockquote p { margin: 0; }
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: var(--radius-sm); -webkit-overflow-scrolling: touch; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 520px; }
.prose th, .prose td { padding: 11px 14px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); line-height: 1.75; }
.prose th { background: var(--bg-soft); font-weight: 700; color: var(--text); white-space: nowrap; position: sticky; top: 0; }
.prose tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover td { background: var(--surface-2); }
.prose code { background: var(--bg-soft); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.prose a { word-break: break-word; }
mark.hit { background: color-mix(in srgb, var(--warn) 35%, transparent); color: inherit; border-radius: 3px; }

.notice { border-radius: var(--radius-sm); padding: 14px 18px; background: var(--brand-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); font-size: 14.5px; }
.loading { padding: 60px 0; text-align: center; color: var(--text-3); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Compare ---------- */
.picker { display: flex; flex-wrap: wrap; gap: 10px; }
.pick {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 15px;
  transition: border-color .15s, background .15s;
}
.pick:hover:not(:disabled) { border-color: var(--line-2); }
.pick[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.pick:disabled { opacity: .5; cursor: not-allowed; }
.pick .check { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; font-size: 12px; }
.pick[aria-pressed="true"] .check { background: var(--brand); border-color: var(--brand); color: #fff; }
.pick small { font-weight: 500; color: var(--text-3); font-size: 12px; }
.picker-hint { color: var(--text-3); font-size: 14px; margin-top: 10px; }

.cmp { margin-top: 28px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cmp-grid { display: grid; gap: 0; min-width: 640px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cmp-grid > div { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14.5px; line-height: 1.75; }
.cmp-grid .rowlabel { background: var(--surface-2); font-weight: 600; color: var(--text-2); font-size: 14px; }
.cmp-grid .colhead { background: var(--bg-soft); position: sticky; top: 0; }
.cmp-grid .colhead .h { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.cmp-grid .group { grid-column: 1 / -1; background: var(--bg-soft); font-weight: 800; font-size: 15px; color: var(--text); }
.bar { height: 8px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-2), var(--brand)); }
.score-n { font-weight: 800; }
.best { color: var(--good); font-size: 12px; font-weight: 700; margin-inline-start: 6px; }
.cmp ul { margin: 0; padding-inline-start: 18px; }
.cmp li { margin: 4px 0; }
.cmp .pros li::marker { color: var(--good); }
.cmp .cons li::marker { color: var(--bad); }
.empty { text-align: center; padding: 56px 20px; color: var(--text-3); background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty svg { width: 42px; height: 42px; margin-bottom: 8px; color: var(--line-2); }

/* ---------- Stats ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-top: 18px; }
.panel h3 { margin: 0 0 12px; font-size: 17px; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.rank li:last-child { border-bottom: 0; }
.rank .bar { grid-column: 1 / -1; margin-top: 0; height: 6px; }
.spark { display: flex; align-items: end; gap: 3px; height: 120px; }
.spark i { flex: 1; background: linear-gradient(180deg, var(--brand), var(--brand-2)); border-radius: 4px 4px 1px 1px; min-height: 2px; position: relative; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.input { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; min-width: 0; flex: 1; }

@media print {
  .site-header, .toc-wrap, .toc-toggle, .guide-actions, .progress, .site-footer { display: none !important; }
  .guide-layout { display: block; }
  .prose > section[data-level="2"] { border: 0; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
