/* ==========================================================================
   khavarzadeh.com — design system
   --------------------------------------------------------------------------
   One stylesheet, no framework, no build step. Written with CSS logical
   properties throughout (margin-inline, padding-block, inset-inline-start,
   border-start-*) so the Persian RTL layout and the English LTR layout are the
   SAME code path rather than a mirrored override sheet. Direction is set once
   on <html dir>; everything below follows automatically.

   Palette carries forward the two pieces of the current site worth keeping —
   the near-black navy field and the amber accent — and adds the semantic scale
   the site has never had: positive / negative / neutral / warning, so colour
   means something on a chart instead of decorating one.

   Dark is the primary mode. Light is fully supported via [data-theme="light"].
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts — self-hosted
   Self-hosting rather than a font CDN is a deliberate choice: the primary
   audience is in Iran, where third-party font CDNs are unreliable, and a
   blocked font request means a page of fallback glyphs.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn Static';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn Static';
  src: url('../fonts/Vazirmatn-SemiBold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn Static';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* --------------------------------------------------------------------------
   2. Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Surfaces — a near-black navy field, not pure black. Pure black makes
     charts glare and thin Persian strokes vibrate. */
  --ink-900: #090C13;
  --ink-850: #0D1119;
  --ink-800: #121724;
  --ink-750: #161C2C;
  --ink-700: #1C2337;
  --ink-600: #263049;
  --ink-500: #364260;
  --ink-400: #4C5A7D;
  --ink-300: #6E7B9D;
  --ink-200: #94A0BE;
  --ink-100: #C2CADE;
  --ink-050: #E7EBF4;

  --bg: var(--ink-900);
  --bg-raised: var(--ink-800);
  --bg-sunken: var(--ink-850);
  --bg-card: var(--ink-800);
  --bg-card-hover: var(--ink-750);
  --border: rgba(148, 160, 190, 0.14);
  --border-strong: rgba(148, 160, 190, 0.26);

  --text: #EEF1F8;
  --text-muted: var(--ink-200);
  --text-dim: var(--ink-300);

  /* Brand — carried over from the current site. Nine years of recognition
     is not worth throwing away for a fresh hex code. */
  --brand: #FFB400;
  --brand-bright: #FFC63D;
  --brand-deep: #C98C00;
  --brand-wash: rgba(255, 180, 0, 0.10);
  --brand-line: rgba(255, 180, 0, 0.32);

  /* Semantic — colour that carries meaning, in a fixed vocabulary.
     Verified for contrast against --bg at body sizes. */
  --positive: #34C98B;
  --positive-wash: rgba(52, 201, 139, 0.12);
  --negative: #FF6470;
  --negative-wash: rgba(255, 100, 112, 0.12);
  --neutral: #8794B4;
  --neutral-wash: rgba(135, 148, 180, 0.12);
  --warn: #FFB400;
  --warn-wash: rgba(255, 180, 0, 0.12);
  --demo: #B07CFF;
  --demo-wash: rgba(176, 124, 255, 0.14);

  /* Type */
  --font-fa: 'Vazirmatn', 'Vazirmatn Static', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-en: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-num: 'Vazirmatn', ui-monospace, 'SF Mono', 'IBM Plex Mono', monospace;

  --fs-2xs: 0.6875rem;  /* 11 */
  --fs-xs:  0.75rem;    /* 12 */
  --fs-sm:  0.8125rem;  /* 13 */
  --fs-base:0.9375rem;  /* 15 */
  --fs-md:  1.0625rem;  /* 17 */
  --fs-lg:  1.25rem;    /* 20 */
  --fs-xl:  1.5rem;     /* 24 */
  --fs-2xl: 2rem;       /* 32 */
  --fs-3xl: 2.625rem;   /* 42 */
  --fs-4xl: 3.5rem;     /* 56 */

  --lh-tight: 1.25;
  --lh-snug: 1.45;
  --lh-body: 1.85;   /* Persian needs more leading than Latin */

  /* Space — 4px base */
  --s-1: 0.25rem;  --s-2: 0.5rem;   --s-3: 0.75rem;  --s-4: 1rem;
  --s-5: 1.5rem;   --s-6: 2rem;     --s-7: 2.75rem;  --s-8: 4rem;
  --s-9: 6rem;     --s-10: 8rem;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);

  --wrap: 1240px;
  --wrap-narrow: 760px;
  --wrap-wide: 1480px;

  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --dur: 180ms;
}

[data-theme='light'] {
  --bg: #FBFBFD;
  --bg-raised: #FFFFFF;
  --bg-sunken: #F2F4F9;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F7F8FC;
  --border: rgba(20, 28, 50, 0.10);
  --border-strong: rgba(20, 28, 50, 0.20);
  --text: #10151F;
  --text-muted: #4A5570;
  --text-dim: #6C7792;
  --brand-deep: #9A6C00;
  --brand-wash: rgba(255, 180, 0, 0.14);
  --positive: #0E8F5E;
  --negative: #D02233;
  --neutral: #5C6784;
  --demo: #6D3BC4;
  --shadow: 0 8px 30px rgba(20, 28, 50, 0.08);
  --shadow-lg: 0 24px 60px rgba(20, 28, 50, 0.12);
}

/* --------------------------------------------------------------------------
   3. Reset & base
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* No maximum-scale / user-scalable=no anywhere. The current site disables
     pinch-zoom, which is an accessibility failure. */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-fa);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  /* NOT 'ss01'. In Vazirmatn that stylistic set swaps Latin digits for Persian
     ones at the font level, which silently rendered "161,726" as Persian
     numerals on the English site. Digit conversion is done explicitly in
     Python (the `fa_digits` filter) so it follows the active language rather
     than the typeface. */
  font-feature-settings: 'kern' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

html[lang='en'] body { font-family: var(--font-en); line-height: 1.7; }

h1, h2, h3, h4, h5 {
  margin: 0;
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}
html[dir='rtl'] h1, html[dir='rtl'] h2, html[dir='rtl'] h3 { letter-spacing: 0; }

p { margin: 0 0 var(--s-4); }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }

img, svg, video { max-width: 100%; height: auto; display: block; }

ul, ol { margin: 0 0 var(--s-4); padding-inline-start: 1.35em; }
li { margin-block-end: var(--s-2); }

hr { border: 0; border-block-start: 1px solid var(--border); margin: var(--s-6) 0; }

code {
  font-family: var(--font-num);
  font-size: 0.9em;
  background: var(--bg-sunken);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
}

blockquote {
  margin: var(--s-5) 0;
  padding-inline-start: var(--s-4);
  border-inline-start: 3px solid var(--brand);
  color: var(--text-muted);
  font-size: var(--fs-md);
}

::selection { background: var(--brand); color: #0A0D14; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0;
  z-index: 999;
  background: var(--brand);
  color: #0A0D14;
  padding: var(--s-3) var(--s-4);
  font-weight: 700;
}
.skip-link:focus { inset-inline-start: var(--s-4); top: var(--s-4); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Numbers: tabular figures everywhere a value is compared to another value.
   Without this, columns of prices jitter as digits change width. */
.num, .value, td.num, .metric__value, .indicator-card__value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--s-5); }
.wrap--narrow { max-width: var(--wrap-narrow); }
.wrap--wide { max-width: var(--wrap-wide); }

.section { padding-block: var(--s-8); }
.section--tight { padding-block: var(--s-7); }
.section--sunken { background: var(--bg-sunken); }
.section + .section { border-block-start: 1px solid var(--border); }

.section__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s-4); flex-wrap: wrap; margin-block-end: var(--s-6);
}
.section__title { font-size: var(--fs-xl); }
.section__lead { color: var(--text-muted); max-width: 62ch; margin-block-start: var(--s-2); }

.kicker {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--brand);
}
html[dir='rtl'] .kicker { letter-spacing: 0; text-transform: none; }

.grid { display: grid; gap: var(--s-5); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stack > * + * { margin-block-start: var(--s-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }

/* --------------------------------------------------------------------------
   5. Header & navigation
   The current site uses an unlabelled vertical icon rail with empty accessible
   names — unusable with a screen reader, invisible to search engines as anchor
   text, and impossible to extend. This is a labelled horizontal nav.
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-block-end: 1px solid var(--border);
}

.site-header__inner {
  display: flex; align-items: center; gap: var(--s-5);
  min-height: 62px;
}

.brand-mark {
  display: flex; align-items: center; gap: var(--s-3);
  font-weight: 700; font-size: var(--fs-md); white-space: nowrap;
  flex-shrink: 0;
}
.brand-mark__glyph {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--brand); color: #0A0D14;
  font-weight: 800; font-size: 15px; letter-spacing: -0.03em;
}
.brand-mark__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-mark__sub { font-size: var(--fs-2xs); font-weight: 500; color: var(--text-dim); }

.site-nav { display: flex; align-items: center; gap: var(--s-1); flex: 1; }
.site-nav__link {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
  white-space: nowrap;
}
.site-nav__link:hover { color: var(--text); background: var(--bg-raised); }
.site-nav__link.is-active { color: var(--brand); background: var(--brand-wash); }

.header-tools {
  display: flex; align-items: center; gap: var(--s-2);
  margin-inline-start: auto; flex-shrink: 0;
}

.lang-switch {
  display: inline-flex; border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill); overflow: hidden;
}
.lang-switch__item {
  padding: 4px 12px; font-size: var(--fs-xs); font-weight: 600;
  color: var(--text-dim); transition: all var(--dur) var(--ease);
  background: transparent; border: 0; cursor: pointer;
  font-family: inherit; white-space: nowrap;
}
.lang-switch__item.is-active { background: var(--brand); color: #0A0D14; }
.lang-switch__item:not(.is-active):hover { background: var(--bg-raised); color: var(--text); }

.icon-btn {
  display: grid; place-items: center;
  /* min-width, not width: in a flex header these must not be squeezed.
     Without flex-shrink:0 the menu button collapses to a 14px sliver on
     narrow viewports. */
  min-width: 34px; width: 34px; height: 34px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer; padding: 0;
  transition: all var(--dur) var(--ease);
}
.icon-btn svg { flex-shrink: 0; }
.icon-btn:hover { color: var(--brand); border-color: var(--brand-line); }

.nav-toggle { display: none; }

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit; font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer; text-align: center;
  transition: all var(--dur) var(--ease);
}
.btn--primary { background: var(--brand); color: #0A0D14; }
.btn--primary:hover { background: var(--brand-bright); color: #0A0D14; transform: translateY(-1px); }
.btn--ghost { border-color: var(--border-strong); color: var(--text); }
.btn--ghost:hover { border-color: var(--brand-line); color: var(--brand); background: var(--brand-wash); }
.btn--quiet { color: var(--text-muted); padding-inline: var(--s-3); }
.btn--quiet:hover { color: var(--brand); }
.btn--sm { padding: var(--s-2) var(--s-3); font-size: var(--fs-xs); }
.btn--block { width: 100%; }

.link-arrow {
  display: inline-flex; align-items: center; gap: var(--s-2);
  color: var(--brand); font-weight: 600; font-size: var(--fs-sm);
}
.link-arrow::after { content: '←'; transition: transform var(--dur) var(--ease); }
html[dir='ltr'] .link-arrow::after { content: '→'; }
.link-arrow:hover::after { transform: translateX(-3px); }
html[dir='ltr'] .link-arrow:hover::after { transform: translateX(3px); }

/* --------------------------------------------------------------------------
   7. Badges, chips, meters
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radius-pill);
  font-size: var(--fs-2xs); font-weight: 600; line-height: 1.6;
  background: var(--neutral-wash); color: var(--neutral);
  white-space: nowrap;
}
.badge--positive { background: var(--positive-wash); color: var(--positive); }
.badge--negative { background: var(--negative-wash); color: var(--negative); }
.badge--warn, .badge--watch { background: var(--warn-wash); color: var(--warn); }
.badge--brand { background: var(--brand-wash); color: var(--brand); }
.badge--demo { background: var(--demo-wash); color: var(--demo); }
.badge--outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-muted); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: transparent;
  font-size: var(--fs-xs); font-weight: 500; color: var(--text-muted);
  transition: all var(--dur) var(--ease); cursor: pointer;
}
.chip:hover { border-color: var(--brand-line); color: var(--text); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #0A0D14; font-weight: 600; }

.meter {
  height: 4px; border-radius: 2px; background: var(--bg-sunken); overflow: hidden;
}
.meter__fill { height: 100%; background: var(--brand); border-radius: 2px; }
.meter__fill.is-positive { background: var(--positive); }
.meter__fill.is-negative { background: var(--negative); }

.confidence-dots { display: inline-flex; gap: 3px; align-items: center; }
.confidence-dots i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--border-strong); display: block;
}
.confidence-dots i.is-on { background: var(--brand); }

/* --------------------------------------------------------------------------
   8. Cards
   -------------------------------------------------------------------------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s-5);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.card:hover { border-color: var(--border-strong); }
a.card:hover { transform: translateY(-2px); background: var(--bg-card-hover); }
.card--flush { padding: 0; overflow: hidden; }
.card--quiet { background: transparent; }

/* Indicator card — the atom of the radar.
   It answers, in order: what, how much, which way, how fast, how fresh,
   from where. Anything that answers none of those is not on the card. */
.indicator-card { display: flex; flex-direction: column; gap: var(--s-3); min-height: 168px; }
.indicator-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.indicator-card__name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); line-height: 1.4; }
.indicator-card__cat { font-size: var(--fs-2xs); color: var(--text-dim); margin-block-start: 2px; }
.indicator-card__value {
  font-size: var(--fs-2xl); font-weight: 700; line-height: 1.05;
  letter-spacing: -0.02em; display: flex; align-items: baseline; gap: var(--s-2);
}
.indicator-card__unit { font-size: var(--fs-xs); font-weight: 500; color: var(--text-dim); letter-spacing: 0; }
.indicator-card__changes { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.indicator-card__spark { margin-block-start: auto; opacity: 0.9; }
.indicator-card__foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  font-size: var(--fs-2xs); color: var(--text-dim);
  padding-block-start: var(--s-3); border-block-start: 1px solid var(--border);
}

.change {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-sm); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.change.is-positive { color: var(--positive); }
.change.is-negative { color: var(--negative); }
.change.is-flat { color: var(--neutral); }
.change__label { font-size: var(--fs-2xs); font-weight: 500; color: var(--text-dim); }

/* Signal card */
.signal-card { display: flex; gap: var(--s-4); align-items: flex-start; }
.signal-card__rail { width: 3px; border-radius: 2px; align-self: stretch; background: var(--neutral); flex-shrink: 0; }
.signal-card__rail.is-positive { background: var(--positive); }
.signal-card__rail.is-negative { background: var(--negative); }
.signal-card__rail.is-watch { background: var(--warn); }
.signal-card__body { flex: 1; min-width: 0; }
.signal-card__head { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-block-end: var(--s-2); }
.signal-card__title { font-size: var(--fs-md); font-weight: 600; line-height: 1.45; margin-block-end: var(--s-2); }
.signal-card__reason { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.75; }
.signal-card__take {
  margin-block-start: var(--s-3); padding: var(--s-3) var(--s-4);
  background: var(--brand-wash); border-radius: var(--radius);
  border-inline-start: 2px solid var(--brand);
  font-size: var(--fs-sm);
}
.signal-card__meta {
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  margin-block-start: var(--s-3); font-size: var(--fs-2xs); color: var(--text-dim);
}

/* Article / insight card */
.insight-card { display: flex; flex-direction: column; height: 100%; }
.insight-card__media { aspect-ratio: 16 / 9; background: var(--bg-sunken); overflow: hidden; }
.insight-card__media img { width: 100%; height: 100%; object-fit: cover; }
.insight-card__body { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); flex: 1; }
.insight-card__title { font-size: var(--fs-md); line-height: 1.5; font-weight: 700; }
.insight-card__excerpt { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.8; }
.insight-card__meta {
  margin-block-start: auto; padding-block-start: var(--s-3);
  border-block-start: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  font-size: var(--fs-2xs); color: var(--text-dim);
}

.insight-card--featured { display: grid; grid-template-columns: 1.15fr 1fr; gap: 0; }
.insight-card--featured .insight-card__media { aspect-ratio: auto; height: 100%; min-height: 300px; }
.insight-card--featured .insight-card__body { padding: var(--s-7); justify-content: center; }
.insight-card--featured .insight-card__title { font-size: var(--fs-xl); }

/* Metric tile */
.metric { display: flex; flex-direction: column; gap: var(--s-1); }
.metric__label { font-size: var(--fs-2xs); color: var(--text-dim); }
.metric__value { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.01em; }

/* --------------------------------------------------------------------------
   9. Sparklines & charts
   -------------------------------------------------------------------------- */

.sparkline { overflow: visible; }
.sparkline__line { stroke: var(--neutral); fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.sparkline__area { fill: var(--neutral-wash); }
.sparkline.is-positive .sparkline__line { stroke: var(--positive); }
.sparkline.is-positive .sparkline__area { fill: var(--positive-wash); }
.sparkline.is-negative .sparkline__line { stroke: var(--negative); }
.sparkline.is-negative .sparkline__area { fill: var(--negative-wash); }
.sparkline.is-empty line { stroke: var(--border-strong); stroke-dasharray: 3 3; }

.chart-block {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-card); overflow: hidden;
}
.chart-block__head { padding: var(--s-4) var(--s-5); border-block-end: 1px solid var(--border); }
.chart-block__question { font-size: var(--fs-md); font-weight: 600; line-height: 1.5; }
.chart-block__sub { font-size: var(--fs-xs); color: var(--text-dim); margin-block-start: var(--s-2); }
.chart-block__canvas { padding: var(--s-5); min-height: 260px; position: relative; }
.chart-block__foot {
  padding: var(--s-3) var(--s-5); border-block-start: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap;
  font-size: var(--fs-2xs); color: var(--text-dim); background: var(--bg-sunken);
}

.chart { width: 100%; display: block; overflow: visible; }
.chart__grid line { stroke: var(--border); stroke-width: 1; }
.chart__axis text { fill: var(--text-dim); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart__line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart__line--alt { stroke: var(--neutral); stroke-dasharray: 4 3; }
.chart__area { fill: url(#chartGradient); }
.chart__dot { fill: var(--brand); }
.chart__hover-line { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }

.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--ink-700); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: var(--s-2) var(--s-3);
  font-size: var(--fs-xs); box-shadow: var(--shadow);
  opacity: 0; transition: opacity 120ms var(--ease); white-space: nowrap;
}
.chart-tooltip.is-visible { opacity: 1; }
.chart-tooltip__value { font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-tooltip__date { color: var(--text-dim); font-size: var(--fs-2xs); }

.range-tabs { display: inline-flex; gap: 2px; background: var(--bg-sunken); border-radius: var(--radius-sm); padding: 3px; }
.range-tabs a {
  padding: 4px 11px; border-radius: 5px; font-size: var(--fs-2xs); font-weight: 600;
  color: var(--text-dim);
}
.range-tabs a.is-active { background: var(--bg-raised); color: var(--brand); }

/* --------------------------------------------------------------------------
   10. Data provenance
   Freshness and source are part of the design, not a footnote. Every number
   on this site can be traced.
   -------------------------------------------------------------------------- */

.provenance {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-2xs); color: var(--text-dim);
}
.provenance__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--positive); flex-shrink: 0; }
.provenance__dot.is-stale { background: var(--warn); }
.provenance__dot.is-error { background: var(--negative); }
.provenance__dot.is-demo { background: var(--demo); }

.demo-banner {
  background: var(--demo-wash);
  border-block-end: 1px solid color-mix(in srgb, var(--demo) 30%, transparent);
  color: var(--demo);
  font-size: var(--fs-xs); font-weight: 500;
  padding-block: var(--s-2);
}
.demo-banner strong { font-weight: 700; }

/* --------------------------------------------------------------------------
   11. Hero
   -------------------------------------------------------------------------- */

.hero { position: relative; padding-block: var(--s-9) var(--s-8); overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset-block-start: -30%; inset-inline-end: -10%;
  width: 60vw; height: 60vw; max-width: 720px; max-height: 720px;
  background: radial-gradient(circle, var(--brand-wash) 0%, transparent 62%);
  pointer-events: none; z-index: 0;
}
.hero__inner { position: relative; z-index: 1; }
.hero__headline {
  font-size: clamp(2rem, 5.2vw, var(--fs-4xl));
  line-height: 1.15; max-width: 19ch; margin-block: var(--s-4) var(--s-5);
}
html[dir='rtl'] .hero__headline { line-height: 1.35; max-width: 22ch; }
.hero__sub { font-size: var(--fs-md); color: var(--text-muted); max-width: 60ch; line-height: 1.9; }
.hero__actions { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-block-start: var(--s-6); }

.hero__ticker {
  margin-block-start: var(--s-7);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-card); overflow: hidden;
}
.hero__ticker-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-3) var(--s-5); border-block-end: 1px solid var(--border);
  background: var(--bg-sunken);
}
.ticker-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.ticker-item {
  padding: var(--s-4) var(--s-5);
  border-inline-end: 1px solid var(--border);
  border-block-end: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 5px;
}
.ticker-item:last-child { border-inline-end: 0; }
.ticker-item__name { font-size: var(--fs-2xs); color: var(--text-dim); }
.ticker-item__row { display: flex; align-items: baseline; gap: var(--s-2); }
.ticker-item__value { font-size: var(--fs-md); font-weight: 700; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   12. Radar page
   -------------------------------------------------------------------------- */

.radar-group { margin-block-end: var(--s-8); }
.radar-group__head {
  display: flex; align-items: baseline; gap: var(--s-3); flex-wrap: wrap;
  margin-block-end: var(--s-4); padding-block-end: var(--s-3);
  border-block-end: 1px solid var(--border);
}
.radar-group__title { font-size: var(--fs-lg); }
.radar-group__count { font-size: var(--fs-xs); color: var(--text-dim); }
.radar-group__note {
  font-size: var(--fs-sm); color: var(--text-muted);
  background: var(--bg-sunken); border-radius: var(--radius);
  padding: var(--s-3) var(--s-4); margin-block-end: var(--s-4);
  border-inline-start: 2px solid var(--brand);
}

.filter-bar {
  display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center;
  padding-block: var(--s-4); margin-block-end: var(--s-5);
  border-block-end: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   13. Indicator detail
   -------------------------------------------------------------------------- */

.indicator-hero { padding-block: var(--s-7) var(--s-6); border-block-end: 1px solid var(--border); }
.indicator-hero__value { font-size: clamp(2.5rem, 7vw, 4rem); font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.indicator-hero__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--s-5); margin-block-start: var(--s-6);
  padding-block-start: var(--s-5); border-block-start: 1px solid var(--border);
}

.definition-block { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.definition-block__item h3 { font-size: var(--fs-sm); color: var(--brand); margin-block-end: var(--s-2); }
.definition-block__item p { font-size: var(--fs-sm); color: var(--text-muted); }

.relation-list { display: flex; flex-direction: column; gap: var(--s-3); }
.relation {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-4); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card);
}
.relation__arrow { color: var(--brand); font-size: var(--fs-lg); line-height: 1.2; flex-shrink: 0; }
.relation__name { font-weight: 600; font-size: var(--fs-sm); }
.relation__why { font-size: var(--fs-xs); color: var(--text-muted); margin-block-start: 4px; line-height: 1.7; }

/* --------------------------------------------------------------------------
   14. Editorial — insight detail
   -------------------------------------------------------------------------- */

.article-header { padding-block: var(--s-8) var(--s-6); }
.article-header__title { font-size: clamp(1.75rem, 4.5vw, var(--fs-3xl)); line-height: 1.25; margin-block: var(--s-4); }
html[dir='rtl'] .article-header__title { line-height: 1.45; }
.article-header__sub { font-size: var(--fs-md); color: var(--text-muted); line-height: 1.8; max-width: 62ch; }
.article-header__meta {
  display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap;
  margin-block-start: var(--s-5); padding-block-start: var(--s-4);
  border-block-start: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-dim);
}

.prose { font-size: var(--fs-md); line-height: 2; }
.prose h2 { font-size: var(--fs-xl); margin-block: var(--s-7) var(--s-4); }
.prose h3 { font-size: var(--fs-lg); margin-block: var(--s-6) var(--s-3); }
.prose p { margin-block-end: var(--s-4); }
.prose a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { margin-block-end: var(--s-4); }
.prose img { border-radius: var(--radius); margin-block: var(--s-5); }

/* The house analysis format. Fact and interpretation are visually distinct
   because they are structurally distinct in the database — the "my take"
   section is coloured differently on purpose. */
.frame-block { border-block-start: 1px solid var(--border); padding-block: var(--s-6); }
.frame-block:first-child { border-block-start: 0; }
.frame-block__head { display: flex; align-items: baseline; gap: var(--s-3); margin-block-end: var(--s-4); }
.frame-block__num {
  font-size: var(--fs-xs); font-weight: 700; color: var(--brand);
  font-variant-numeric: tabular-nums; letter-spacing: 0.05em;
}
.frame-block__label { font-size: var(--fs-lg); font-weight: 700; }
.frame-block__question { font-size: var(--fs-xs); color: var(--text-dim); }
.frame-block--interpretation {
  background: var(--brand-wash); border-radius: var(--radius-lg);
  padding: var(--s-6); border-block-start: 0; margin-block-start: var(--s-5);
}
.frame-block--interpretation .frame-block__label { color: var(--brand); }

.source-list { display: flex; flex-direction: column; gap: var(--s-3); counter-reset: src; }
.source-item {
  display: flex; gap: var(--s-3); font-size: var(--fs-sm); color: var(--text-muted);
  padding-block-end: var(--s-3); border-block-end: 1px solid var(--border);
}
.source-item::before {
  counter-increment: src; content: counter(src);
  font-size: var(--fs-2xs); font-weight: 700; color: var(--brand);
  font-variant-numeric: tabular-nums; flex-shrink: 0; min-width: 1.5em;
}

.notice {
  padding: var(--s-4) var(--s-5); border-radius: var(--radius);
  background: var(--bg-sunken); border-inline-start: 3px solid var(--brand);
  font-size: var(--fs-sm); color: var(--text-muted);
}
.notice--warn { border-inline-start-color: var(--warn); }
.notice--demo { border-inline-start-color: var(--demo); }

/* --------------------------------------------------------------------------
   15. Timeline (résumé)
   -------------------------------------------------------------------------- */

.timeline { position: relative; padding-inline-start: var(--s-6); }
.timeline::before {
  content: ''; position: absolute; inset-block: 6px 0;
  inset-inline-start: 5px; width: 1px; background: var(--border);
}
.timeline__item { position: relative; padding-block-end: var(--s-6); }
.timeline__item::before {
  content: ''; position: absolute; inset-block-start: 7px;
  inset-inline-start: calc(-1 * var(--s-6) + 1px);
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--border-strong);
}
.timeline__item.is-current::before { background: var(--brand); border-color: var(--brand); }
.timeline__period {
  font-size: var(--fs-2xs); color: var(--brand); font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: 0.04em;
}
.timeline__role { font-size: var(--fs-md); font-weight: 700; margin-block: var(--s-1) 2px; }
.timeline__org { font-size: var(--fs-sm); color: var(--text-muted); }
.timeline__summary { font-size: var(--fs-sm); color: var(--text-muted); margin-block-start: var(--s-3); line-height: 1.8; }
.timeline__achievements { margin-block-start: var(--s-3); font-size: var(--fs-sm); color: var(--text-muted); }
.timeline__achievements li { margin-block-end: var(--s-1); }

.org-strip { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); align-items: center; }
.org-strip__item {
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-dim);
  letter-spacing: 0.02em;
}

.publication {
  padding-block: var(--s-4); border-block-end: 1px solid var(--border);
}
.publication__title { font-size: var(--fs-sm); font-weight: 600; line-height: 1.6; }
.publication__meta { font-size: var(--fs-xs); color: var(--text-dim); margin-block-start: var(--s-2); }
.publication__methods { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-block-start: var(--s-2); }

/* --------------------------------------------------------------------------
   16. Forms
   -------------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: var(--s-2); margin-block-end: var(--s-4); }
.field__label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); }
.field__input, select.field__input, textarea.field__input {
  width: 100%; padding: var(--s-3) var(--s-4);
  background: var(--bg-sunken); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; font-size: var(--fs-sm);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.field__input::placeholder { color: var(--text-dim); }
.field__input:focus { border-color: var(--brand-line); background: var(--bg-raised); outline: none; }
.field__error { font-size: var(--fs-xs); color: var(--negative); }
.field__help { font-size: var(--fs-2xs); color: var(--text-dim); }
.field--honeypot { position: absolute; inset-inline-start: -9999px; opacity: 0; }

.form-row { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.message-list { list-style: none; padding: 0; margin-block-end: var(--s-5); }
.message-list li {
  padding: var(--s-3) var(--s-4); border-radius: var(--radius);
  font-size: var(--fs-sm); margin-block-end: var(--s-2);
}
.message-list li.success { background: var(--positive-wash); color: var(--positive); }
.message-list li.error { background: var(--negative-wash); color: var(--negative); }
.message-list li.info { background: var(--brand-wash); color: var(--brand); }

.newsletter-panel {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-sunken));
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  padding: var(--s-7);
}
.newsletter-form { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-block-start: var(--s-5); }
.newsletter-form .field { flex: 1; min-width: 200px; margin: 0; }

.search-form { display: flex; gap: var(--s-2); }
.search-form .field__input { flex: 1; }

/* --------------------------------------------------------------------------
   17. Tables
   -------------------------------------------------------------------------- */

.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.data-table th {
  text-align: start; font-size: var(--fs-2xs); font-weight: 600;
  color: var(--text-dim); padding: var(--s-3); border-block-end: 1px solid var(--border-strong);
  white-space: nowrap;
}
.data-table td { padding: var(--s-3); border-block-end: 1px solid var(--border); }
.data-table tbody tr:hover { background: var(--bg-raised); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* --------------------------------------------------------------------------
   18. Scenario & connection map
   -------------------------------------------------------------------------- */

.scenario-flow { display: flex; flex-direction: column; gap: var(--s-2); }
.scenario-level { display: flex; flex-direction: column; gap: var(--s-3); }
.scenario-level__label {
  font-size: var(--fs-2xs); color: var(--text-dim);
  letter-spacing: 0.06em; margin-block-end: var(--s-1);
}
.scenario-node {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-4); border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
}
.scenario-node__sign {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: var(--fs-sm); font-weight: 700;
  background: var(--neutral-wash); color: var(--neutral);
}
.scenario-node__sign.is-up { background: var(--positive-wash); color: var(--positive); }
.scenario-node__sign.is-down { background: var(--negative-wash); color: var(--negative); }
.scenario-connector {
  height: var(--s-4); width: 1px; background: var(--border-strong);
  margin-inline-start: 13px;
}

.map-canvas { min-height: 380px; position: relative; }
.map-node {
  position: absolute; transform: translate(-50%, -50%);
  padding: var(--s-2) var(--s-3); border-radius: var(--radius-pill);
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}
.map-node.is-focus { background: var(--brand); color: #0A0D14; border-color: var(--brand); }

/* --------------------------------------------------------------------------
   19. Footer
   -------------------------------------------------------------------------- */

.site-footer {
  margin-block-start: var(--s-9);
  border-block-start: 1px solid var(--border);
  background: var(--bg-sunken);
  padding-block: var(--s-8) var(--s-6);
}
.footer-grid {
  display: grid; gap: var(--s-6);
  grid-template-columns: 1.6fr repeat(3, 1fr);
  margin-block-end: var(--s-7);
}
.footer-col h4 {
  font-size: var(--fs-2xs); font-weight: 700; color: var(--text-dim);
  letter-spacing: 0.08em; margin-block-end: var(--s-4);
}
html[dir='rtl'] .footer-col h4 { letter-spacing: 0; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-block-end: var(--s-2); }
.footer-col a { font-size: var(--fs-sm); color: var(--text-muted); }
.footer-col a:hover { color: var(--brand); }

.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s-4); flex-wrap: wrap;
  padding-block-start: var(--s-5); border-block-start: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-dim);
}
.social-row { display: flex; gap: var(--s-3); }
.social-row a { color: var(--text-dim); }
.social-row a:hover { color: var(--brand); }

.disclaimer {
  font-size: var(--fs-xs); color: var(--text-dim); line-height: 1.8;
  max-width: 70ch; margin-block-start: var(--s-4);
  padding: var(--s-4); background: var(--bg-raised); border-radius: var(--radius);
  border-inline-start: 2px solid var(--border-strong);
}

/* --------------------------------------------------------------------------
   20. Pagination, breadcrumbs, empty states
   -------------------------------------------------------------------------- */

.breadcrumbs { display: flex; gap: var(--s-2); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-dim); padding-block: var(--s-4); }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs__sep { opacity: 0.4; }

.pagination { display: flex; gap: var(--s-2); justify-content: center; align-items: center; margin-block-start: var(--s-7); flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  font-size: var(--fs-sm); padding-inline: var(--s-2);
}
.pagination a:hover { border-color: var(--brand-line); color: var(--brand); }
.pagination .is-current { background: var(--brand); border-color: var(--brand); color: #0A0D14; font-weight: 700; }

.empty-state { text-align: center; padding-block: var(--s-9); color: var(--text-dim); }
.empty-state__title { font-size: var(--fs-lg); color: var(--text-muted); margin-block-end: var(--s-3); }

/* --------------------------------------------------------------------------
   21. Responsive
   Mobile is not a shrunk desktop. Dense grids collapse to single columns,
   the radar becomes a scannable list, and the nav becomes a disclosure panel.
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .insight-card--featured { grid-template-columns: 1fr; }
  .insight-card--featured .insight-card__media { min-height: 200px; aspect-ratio: 16/9; }
  .insight-card--featured .insight-card__body { padding: var(--s-5); }
}

@media (max-width: 860px) {
  :root { --s-8: 3rem; --s-9: 4rem; }

  .nav-toggle { display: grid; }
  .site-nav {
    position: fixed; inset-block-start: 62px; inset-inline: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-raised); border-block-end: 1px solid var(--border);
    padding: var(--s-3); max-height: 0; overflow: hidden;
    transition: max-height 220ms var(--ease); z-index: 90;
  }
  .site-nav.is-open { max-height: 75vh; overflow-y: auto; }
  .site-nav__link { padding: var(--s-3) var(--s-4); font-size: var(--fs-base); }

  .hero { padding-block: var(--s-7) var(--s-6); }
  .hero__actions .btn { flex: 1; }
  .ticker-grid { grid-template-columns: 1fr 1fr; }
  .ticker-item:nth-child(2n) { border-inline-end: 0; }

  .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .indicator-card { min-height: 0; }

  .section__head { flex-direction: column; align-items: flex-start; }
  .indicator-hero__grid { grid-template-columns: 1fr 1fr; gap: var(--s-4); }
  .timeline { padding-inline-start: var(--s-5); }
  .newsletter-panel { padding: var(--s-5); }
  .newsletter-form { flex-direction: column; }
  .newsletter-form .btn { width: 100%; }
}

@media (max-width: 560px) {
  .wrap { padding-inline: var(--s-4); }
  .site-header__inner { gap: var(--s-3); }
  /* The demo notice matters, but three lines of it above the fold on a phone
     costs more than it earns. Trim to the essential claim. */
  .demo-banner { font-size: var(--fs-2xs); line-height: 1.6; }
  .demo-banner .demo-banner__long { display: none; }
  .footer-grid { grid-template-columns: 1fr; gap: var(--s-5); }
  .ticker-grid { grid-template-columns: 1fr; }
  .ticker-item { border-inline-end: 0; }
  .brand-mark__sub { display: none; }
  .filter-bar { overflow-x: auto; flex-wrap: nowrap; padding-block-end: var(--s-3); }
  .chip { flex-shrink: 0; }
  .article-header { padding-block: var(--s-6) var(--s-5); }
  .frame-block--interpretation { padding: var(--s-5); }
}

/* --------------------------------------------------------------------------
   22. Motion & print
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.reveal { opacity: 0; transform: translateY(10px); }
.reveal.is-visible { opacity: 1; transform: none; transition: opacity 420ms var(--ease), transform 420ms var(--ease); }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

@media print {
  .site-header, .site-footer, .demo-banner, .newsletter-panel, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ccc; }
  a[href^='http']::after { content: ' (' attr(href) ')'; font-size: 0.8em; color: #555; }
}

/* CKEditor / existing article HTML inside the new editorial shell */
.prose img,
.prose video,
.prose iframe { max-width: 100%; height: auto; }
.prose table { display: block; max-width: 100%; overflow-x: auto; }
.prose { overflow-wrap: anywhere; }

@media (max-width: 860px) {
  .grid[style*="grid-template-columns:minmax(0,2.1fr)"] {
    grid-template-columns: 1fr !important;
  }
}
