/* ==== chert-fonts.css ==== */
/* Self-hosted typefaces (SIL OFL 1.1) — see ../fonts/README.md. No CDN.
   Inter and JetBrains Mono (no Reserved Font Name) ship as Latin WOFF2 subsets with the full TTF as fallback;
   IBM Plex Sans Arabic and Playfair Display (Reserved Font Names) ship unmodified. */

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter/Inter-latin.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0100-024F, U+0259, U+1E00-1EFF, U+2000-206F, U+2070-209F, U+20A0-20CF, U+2122, U+2190-21FF, U+2200-22FF, U+25A0-25FF, U+2600-26FF, U+FB00-FB04, U+FEFF;
}
@font-face { /* fallback for glyphs outside the Latin subset only */
  font-family: 'Inter';
  src: url('../fonts/inter/Inter[opsz,wght].ttf') format('truetype');
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0250-0258, U+025A-1DFF, U+1F00-1FFF, U+20D0-2121, U+2123-218F, U+2300-259F, U+2700-FAFF, U+FB05-FEFE, U+FF00-10FFFF;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('../fonts/ibm-plex-sans-arabic/IBMPlexSansArabic-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0250-0258, U+025A-05FF, U+0700-074F, U+0780-089F, U+0900-1DFF, U+1F00-1FFF, U+20D0-2121, U+2123-218F, U+2300-259F, U+2700-FB4F, U+FE00-FE6F, U+FF00-10FFFF;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('../fonts/ibm-plex-sans-arabic/IBMPlexSansArabic-Medium.ttf') format('truetype');
  font-weight: 500; font-style: normal; font-display: swap;
  unicode-range: U+0250-0258, U+025A-05FF, U+0700-074F, U+0780-089F, U+0900-1DFF, U+1F00-1FFF, U+20D0-2121, U+2123-218F, U+2300-259F, U+2700-FB4F, U+FE00-FE6F, U+FF00-10FFFF;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('../fonts/ibm-plex-sans-arabic/IBMPlexSansArabic-SemiBold.ttf') format('truetype');
  font-weight: 600; font-style: normal; font-display: swap;
  unicode-range: U+0250-0258, U+025A-05FF, U+0700-074F, U+0780-089F, U+0900-1DFF, U+1F00-1FFF, U+20D0-2121, U+2123-218F, U+2300-259F, U+2700-FB4F, U+FE00-FE6F, U+FF00-10FFFF;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('../fonts/ibm-plex-sans-arabic/IBMPlexSansArabic-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0250-0258, U+025A-05FF, U+0700-074F, U+0780-089F, U+0900-1DFF, U+1F00-1FFF, U+20D0-2121, U+2123-218F, U+2300-259F, U+2700-FB4F, U+FE00-FE6F, U+FF00-10FFFF;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono/JetBrainsMono-latin.woff2') format('woff2');
  font-weight: 100 800; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0100-024F, U+2000-206F, U+2070-209F, U+20A0-20CF, U+2122, U+2190-21FF, U+2200-22FF, U+25A0-25FF, U+2600-26FF, U+FEFF;
}
@font-face { /* fallback for glyphs outside the Latin subset only */
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono/JetBrainsMono[wght].ttf') format('truetype');
  font-weight: 100 800; font-style: normal; font-display: swap;
  unicode-range: U+0250-0258, U+025A-1DFF, U+1F00-1FFF, U+20D0-2121, U+2123-218F, U+2300-259F, U+2700-FAFF, U+FB05-FEFE, U+FF00-10FFFF;
}
/* Renamed WOFF2 subsets of the two Reserved-Font-Name families (OFL Modified Versions); the unmodified TTFs follow as fallbacks. */
@font-face { font-family: 'CHERT Display Serif'; src: url('../fonts/playfair-display/CHERTDisplaySerif-latin.woff2') format('woff2'); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'CHERT Sans Arabic'; src: url('../fonts/ibm-plex-sans-arabic/CHERTSansArabic-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'CHERT Sans Arabic'; src: url('../fonts/ibm-plex-sans-arabic/CHERTSansArabic-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'CHERT Sans Arabic'; src: url('../fonts/ibm-plex-sans-arabic/CHERTSansArabic-SemiBold.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'CHERT Sans Arabic'; src: url('../fonts/ibm-plex-sans-arabic/CHERTSansArabic-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face {
  font-family: 'Playfair Display';
  src: url('../fonts/playfair-display/PlayfairDisplay[wght].ttf') format('truetype');
  font-weight: 400 900; font-style: normal; font-display: swap;
  unicode-range: U+0250-0258, U+025A-1DFF, U+1F00-1FFF, U+20D0-2121, U+2123-218F, U+2300-259F, U+2700-FAFF, U+FB05-FEFE, U+FF00-10FFFF;
}

/* ==== chert-tokens.css ==== */
/* ============================================================
   CHERT Design Tokens v1.0
   Single source of truth. Do not edit per-project.
   ============================================================ */

:root {
  /* ---- Brand ---- */
  --chert-orange:       #FF8651;
  --chert-orange-deep:  #F26B33;
  --chert-tan:          #D2B082;
  --chert-cream:        #FFFAE4;
  --chert-ink:          #1A1A18;

  /* ---- Extended ---- */
  --chert-surface:      #FFFFFF;
  --chert-surface-alt:  #FBF7EC;
  --chert-border:       #ECE0C2;
  --chert-border-strong:#D9C9A4;
  --chert-muted:        #6B6B66;
  --chert-orange-tint:  #FDEEE4;

  /* ---- Functional ---- */
  --chert-success:      #10B981;
  --chert-success-tint: #E7F8F2;
  --chert-warning:      #F59E0B;
  --chert-warning-tint: #FEF4E3;
  --chert-error:        #EF4444;
  --chert-error-tint:   #FDECEC;
  --chert-info:         #3B82F6;
  --chert-info-tint:    #EAF1FE;

  /* ---- Dark surfaces ---- */
  --chert-dark:         #151311;
  --chert-dark-surface: #1B1815;
  --chert-dark-border:  #26221D;
  --chert-dark-text:    #F3EDE0;
  --chert-dark-muted:   #A89E8D;

  /* ---- Type ---- */
  --font-ui:      'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-ar:      'IBM Plex Sans Arabic', 'Cairo', sans-serif;
  --font-mono:    'JetBrains Mono', 'Consolas', monospace;

  --fs-display:  56px;
  --fs-h1:       40px;
  --fs-h2:       30px;
  --fs-h3:       22px;
  --fs-lg:       18px;
  --fs-base:     16px;
  --fs-sm:       14px;
  --fs-xs:       13px;
  --fs-overline: 12px;

  --lh-tight: 1.1;
  --lh-snug:  1.25;
  --lh-base:  1.5;
  --lh-ar:    1.7;

  /* ---- Spacing (8px base) ---- */
  --space-1: 4px;   --space-2: 8px;   --space-3: 12px;
  --space-4: 16px;  --space-5: 24px;  --space-6: 32px;
  --space-7: 48px;  --space-8: 64px;  --space-9: 96px;

  /* ---- Layout ---- */
  --maxw:       1200px;
  --maxw-wide:  1440px;
  --maxw-prose: 68ch;
  --gutter:     24px;
  --sidebar-w:  250px;
  --header-h:   72px;

  /* ---- Radius ---- */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-card: 16px;
  --radius-pill: 40px;

  /* ---- Shadow ---- */
  --shadow-card:     0 10px 30px -18px rgba(0,0,0,.2);
  --shadow-hover:    0 20px 40px -20px rgba(242,107,51,.4);
  --shadow-dropdown: 0 12px 32px -8px rgba(0,0,0,.18);
  --shadow-modal:    0 24px 64px -12px rgba(0,0,0,.3);

  /* ---- Motion ---- */
  --ease:      cubic-bezier(.4,0,.2,1);
  --dur-fast:  120ms;
  --dur-base:  150ms;
  --dur-slow:  240ms;

  /* ---- Z-index ---- */
  --z-base: 0;      --z-sticky: 100;  --z-dropdown: 200;
  --z-overlay: 300; --z-modal: 400;   --z-toast: 500;
}

@media (min-width: 1024px) { :root { --gutter: 40px; } }
@media (max-width: 639px) {
  :root { --fs-display: 36px; --fs-h1: 30px; --fs-h2: 24px; --header-h: 64px; }
}

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

body {
  margin: 0;
  background: var(--chert-cream);
  color: var(--chert-ink);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
}

[lang="ar"] {
  font-family: var(--font-ar);
  font-size: 17px;
  line-height: var(--lh-ar);
  letter-spacing: normal;
}
[lang="ar"] em, [lang="ar"] i { font-style: normal; font-weight: 700; }
[dir="rtl"] .icon-directional { transform: scaleX(-1); }

.ltr-content { direction: ltr; unicode-bidi: isolate; display: inline-block; }

:focus-visible {
  outline: 2px solid var(--chert-ink);
  outline-offset: 2px;
}

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

/* ==== chert-components.css ==== */
/* ============================================================
   CHERT component layer — built only from chert-tokens.css.
   Section 10 of the design system is reproduced first (verbatim
   rules), then the remaining mandatory components (§6) follow.
   No literal colours appear in this file.
   ============================================================ */

/* ---- Buttons (§10) ---- */
.btn {
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease);
}
/* Primary: INK text on orange (7.29:1). White on orange fails AA (2.39:1). */
.btn--primary   { background: var(--chert-orange); color: var(--chert-ink); }
.btn--primary:hover { background: var(--chert-orange-deep); transform: translateY(-1px); }
.btn--secondary { background: transparent; border: 1.5px solid var(--chert-ink); color: var(--chert-ink); }
.btn--secondary:hover { background: var(--chert-ink); color: var(--chert-cream); }
/* Ghost: ink text — orange-deep on cream fails AA (2.89:1). */
.btn--ghost     { background: transparent; color: var(--chert-ink); padding-inline: 0; min-width: 44px; }
.btn--ghost:hover { text-decoration: underline; text-decoration-color: var(--chert-orange-deep); text-underline-offset: 3px; }
.btn--danger    { background: var(--chert-error); color: var(--chert-ink); font-size: var(--fs-base); } /* §6.1: white only at ≥19px bold (3.76:1); ink for 16px text (4.66:1) */
.btn:disabled   { opacity: .45; cursor: not-allowed; transform: none; }
.btn--sm { padding: 8px 16px; }
/* §8.1 touch targets ≥ 44 px: the §6.1 paddings alone give ~40 px, so a minimum height is added (no visual change for lg). */
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn--lg { padding: 14px 28px; font-size: var(--fs-base); }

/* ---- Card (§10) ---- */
.card {
  background: var(--chert-surface);
  border: 1px solid var(--chert-border);
  border-radius: var(--radius-card);
  padding: 28px;
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-base) var(--ease),
              box-shadow var(--dur-base) var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

.card__icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  background: var(--chert-orange-tint);
  color: var(--chert-ink);
  margin-block-end: var(--space-4);
}
.card__title { font-size: var(--fs-h3); font-weight: 700; margin: 0 0 var(--space-2); }
.card__desc  { font-size: var(--fs-sm); color: var(--chert-muted); margin: 0 0 14px; }
.card__link  { font-size: var(--fs-sm); font-weight: 700; color: var(--chert-ink);
               text-decoration: underline; text-decoration-color: var(--chert-orange);
               text-underline-offset: 3px; }

/* ---- Input (§10) ---- */
.input {
  width: 100%;
  height: 44px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: var(--fs-base);
  background: var(--chert-surface);
  border: 1px solid var(--chert-border);
  border-radius: var(--radius-sm);
  color: var(--chert-ink);
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.input::placeholder { color: var(--chert-muted); }
.input:focus {
  outline: none;
  border-color: var(--chert-orange);
  box-shadow: 0 0 0 3px rgba(255,134,81,.25);
}
.input--error { border-color: var(--chert-error); }
.label { display: block; font-size: var(--fs-sm); font-weight: 600; margin-block-end: 6px; }
.helper { font-size: var(--fs-xs); color: var(--chert-muted); margin-block-start: 6px; }

/* ---- Callout (§10) ---- */
.callout {
  border-inline-start: 4px solid var(--chert-orange-deep);
  background: var(--chert-orange-tint);
  padding: var(--space-4);
  border-radius: var(--radius-sm);
}
.callout--success { border-color: var(--chert-success); background: var(--chert-success-tint); }
.callout--warning { border-color: var(--chert-warning); background: var(--chert-warning-tint); }
.callout--error   { border-color: var(--chert-error);   background: var(--chert-error-tint); }
.callout--info    { border-color: var(--chert-info);    background: var(--chert-info-tint); }

/* ---- Layout (§10) ---- */
.container { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section   { padding-block: var(--space-9); }
.section--alt { background: var(--chert-surface); }

.grid-cards { display: grid; grid-template-columns: 1fr; gap: var(--space-5); }
@media (min-width: 640px)  { .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---- Header (§10) ---- */
.header {
  position: sticky; inset-block-start: 0; z-index: var(--z-sticky);
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--gutter);
  background: var(--chert-cream);
  transition: box-shadow var(--dur-base) var(--ease);
}
.header--scrolled {
  border-block-end: 1px solid var(--chert-border);
  box-shadow: 0 2px 12px -6px rgba(0,0,0,.1);
}

/* ---- Starburst loader (§10) ---- */
.chert-star { width: 26px; height: 26px; }
.loader { animation: chert-spin 1.2s linear infinite; color: var(--chert-orange); }
@keyframes chert-spin { to { transform: rotate(360deg); } }

/* ============================================================
   Remaining mandatory components (§6) — tokens only.
   ============================================================ */

/* Focus: the token file sets the global ring; inputs replace it with the orange halo (§6.4). */
.btn:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--chert-ink); outline-offset: 2px; }

/* ---- Arabic typography complement ----
   The §9 token file declares `body { font-family: var(--font-ui) }` and `[lang="ar"] { … }`. With `lang="ar"` on <html>
   (as §7.1 prescribes) the body declaration wins the cascade and Arabic text would stay in Inter. This rule restores the
   §7.4 values without editing the verbatim token file. */
html[lang="ar"] body { font-family: 'CHERT Sans Arabic', var(--font-ar); font-size: 17px; line-height: var(--lh-ar); letter-spacing: normal; }
/* The renamed WOFF2 subsets (see fonts/README.md) are tried first; the token stacks remain the fallbacks. */

/* ---- Skip link (§8.1) ---- */
.skip-link {
  position: absolute; inset-inline-start: var(--space-4); inset-block-start: -100px;
  background: var(--chert-ink); color: var(--chert-cream);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm);
  z-index: var(--z-toast); font-weight: 700; text-decoration: none;
}
.skip-link:focus { inset-block-start: var(--space-4); }

/* ---- Typography helpers (§4) ---- */
h1, .h1 { font-size: var(--fs-h1); font-weight: 800; line-height: var(--lh-tight); letter-spacing: -1px; margin: 0 0 var(--space-4); }
h2, .h2 { font-size: var(--fs-h2); font-weight: 700; line-height: 1.15; letter-spacing: -.5px; margin: 0 0 var(--space-3); }
h3, .h3 { font-size: var(--fs-h3); font-weight: 700; line-height: var(--lh-snug); margin: 0 0 var(--space-2); }
.display { font-family: 'CHERT Display Serif', var(--font-display); font-size: var(--fs-display); font-weight: 700; line-height: 1.05; letter-spacing: -1.5px; }
.lead { font-size: var(--fs-lg); max-width: var(--maxw-prose); }
.prose { max-width: var(--maxw-prose); }
.overline { font-size: var(--fs-overline); font-weight: 600; letter-spacing: 3px; text-transform: uppercase; color: var(--chert-muted); line-height: 1.3; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--chert-muted); }
.text-sm { font-size: var(--fs-sm); font-weight: 500; line-height: 1.45; }
.text-xs { font-size: var(--fs-xs); font-weight: 500; line-height: 1.4; }
[lang="ar"] .display { font-family: 'CHERT Sans Arabic', var(--font-ar); letter-spacing: normal; }
[lang="ar"] h1, [lang="ar"] h2, [lang="ar"] .h1, [lang="ar"] .h2 { letter-spacing: normal; }
[lang="ar"] .overline { letter-spacing: normal; text-transform: none; }

/* ---- Links ---- */
.link { color: var(--chert-ink); font-weight: 700; text-decoration: underline; text-decoration-color: var(--chert-orange-deep); text-underline-offset: 3px; }
.link:hover { text-decoration-thickness: 2px; }

/* ---- Select / textarea (§6.4) ---- */
.select { appearance: none; padding-inline-end: 40px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%231A1A18' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 6l4 4 4-4'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; }
[dir="rtl"] .select { background-position: left 14px center; }
.textarea { height: auto; min-height: 120px; resize: vertical; line-height: var(--lh-base); }
.field { margin-block-end: 20px; }
.field-group { margin-block-end: var(--space-6); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--chert-surface-alt); color: var(--chert-muted); cursor: not-allowed; }
.error-text { font-size: var(--fs-xs); color: var(--chert-ink); margin-block-start: 6px; display: flex; gap: 6px; align-items: center; }
.error-text::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--chert-error); flex: none; }

/* ---- Checkbox / radio / switch (§6.4) ---- */
.choice { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; cursor: pointer; font-size: var(--fs-base); }
.choice input { appearance: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--chert-ink); background: var(--chert-surface); border-radius: var(--radius-sm); display: grid; place-items: center; cursor: pointer; flex: none; }
.choice input[type="radio"] { border-radius: 50%; }
.choice input:checked { background: var(--chert-orange); border-color: var(--chert-orange); }
.choice input[type="checkbox"]:checked::after { content: ""; width: 10px; height: 6px; border-style: solid; border-color: var(--chert-surface); border-width: 0 0 2px 2px; /* tick glyph geometry: never mirrors */ transform: translateY(-1px) rotate(-45deg); }
.choice input[type="radio"]:checked::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--chert-surface); }
.choice input:focus-visible { outline: 2px solid var(--chert-ink); outline-offset: 2px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; cursor: pointer; }
.switch__track { width: 44px; height: 24px; border-radius: var(--radius-pill); background: var(--chert-border); position: relative; transition: background var(--dur-base) var(--ease); flex: none; }
.switch__track::after { content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--chert-surface); transition: transform var(--dur-base) var(--ease); box-shadow: var(--shadow-card); }
.switch[aria-checked="true"] .switch__track { background: var(--chert-orange); }
.switch[aria-checked="true"] .switch__track::after { transform: translateX(20px); }
[dir="rtl"] .switch[aria-checked="true"] .switch__track::after { transform: translateX(-20px); }
.switch__state { font-size: var(--fs-sm); font-weight: 600; }

/* ---- Badge / tag / chip (§6.7) ----
   Text on tinted badges is INK, with a status dot in the functional colour:
   the "matching deep text" variant fails AA (e.g. success on its tint = 2.27:1),
   and §3.6 rule 2 ("all body text is ink or muted") plus rule 7 (never colour alone) take precedence. */
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-pill); padding: 4px 12px; font-size: var(--fs-xs); font-weight: 600; color: var(--chert-ink); background: var(--chert-orange-tint); line-height: 1.4; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--chert-orange-deep); flex: none; }
.badge--success { background: var(--chert-success-tint); } .badge--success::before { background: var(--chert-success); }
.badge--warning { background: var(--chert-warning-tint); } .badge--warning::before { background: var(--chert-warning); }
.badge--error   { background: var(--chert-error-tint); }   .badge--error::before   { background: var(--chert-error); }
.badge--info    { background: var(--chert-info-tint); }    .badge--info::before    { background: var(--chert-info); }
.badge--neutral { background: var(--chert-surface-alt); }  .badge--neutral::before { background: var(--chert-muted); }
.tag { display: inline-block; background: var(--chert-tan); color: var(--chert-ink); border-radius: var(--radius-sm); padding: 3px 8px; font-size: var(--fs-xs); font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--chert-border-strong); background: var(--chert-surface); border-radius: var(--radius-pill); font-size: var(--fs-sm); font-weight: 600; color: var(--chert-ink); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--chert-ink); color: var(--chert-cream); border-color: var(--chert-ink); }
.chip__x { font-weight: 800; }

/* ---- Avatar ---- */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--chert-tan); color: var(--chert-ink); display: inline-grid; place-items: center; font-weight: 600; font-size: var(--fs-sm); flex: none; }
.avatar--sm { width: 32px; height: 32px; font-size: var(--fs-xs); }
button.avatar { width: 44px; height: 44px; border: 0; cursor: pointer; font: inherit; font-weight: 600; }

/* ---- Divider (§6.7) ---- */
.divider { border: 0; border-block-start: 1px solid var(--chert-border); margin-block: var(--space-6); }
.divider--star { display: flex; align-items: center; gap: var(--space-4); color: var(--chert-tan); margin-block: var(--space-6); }
.divider--star::before, .divider--star::after { content: ""; flex: 1; border-block-start: 1px solid var(--chert-border); }
.divider--star .chert-star { width: 24px; height: 24px; }

/* ---- Tooltip ---- */
.tooltip-wrap { position: relative; display: inline-block; }
.tooltip { position: absolute; inset-block-end: calc(100% + 8px); inset-inline-start: 50%; transform: translateX(-50%); background: var(--chert-ink); color: var(--chert-cream); font-size: var(--fs-xs); padding: 6px 10px; border-radius: var(--radius-sm); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease); z-index: var(--z-dropdown); }
[dir="rtl"] .tooltip { transform: translateX(50%); }
.tooltip-wrap:hover .tooltip, .tooltip-wrap:focus-within .tooltip { opacity: 1; }

/* ---- Dropdown (§6.5) ---- */
.dropdown { position: relative; display: inline-block; }
.dropdown__menu { position: absolute; inset-block-start: calc(100% + 6px); inset-inline-start: 0; min-width: 220px; background: var(--chert-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-dropdown); padding: 8px; z-index: var(--z-dropdown); margin: 0; list-style: none; display: none; }
.dropdown__menu[data-open="true"] { display: block; animation: dd-in var(--dur-fast) var(--ease); }
.dropdown__menu--end { inset-inline-start: auto; inset-inline-end: 0; }
@keyframes dd-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.dropdown__item { display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: 8px 12px; min-height: 44px; border-radius: var(--radius-sm); border: 0; background: none; font: inherit; font-size: var(--fs-sm); font-weight: 500; color: var(--chert-ink); cursor: pointer; text-align: start; text-decoration: none; }
.dropdown__item:hover, .dropdown__item:focus-visible { background: var(--chert-orange-tint); color: var(--chert-ink); }
.dropdown__item[aria-current="true"] { background: var(--chert-orange-tint); border-inline-start: 3px solid var(--chert-orange); cursor: default; }

/* ---- Tabs (§8.2) ---- */
.tabs { border-block-end: 1px solid var(--chert-border); display: flex; gap: var(--space-2); overflow-x: auto; }
.tab { background: none; border: 0; font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--chert-ink); opacity: .85; padding: 12px 14px; min-height: 44px; border-block-end: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { opacity: 1; border-block-end-color: var(--chert-orange); }
.tab:hover { opacity: 1; }
.tabpanel { padding-block: var(--space-4); }
.tabpanel[hidden] { display: none; }

/* ---- Breadcrumb ---- */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); color: var(--chert-muted); }
.breadcrumb a { color: var(--chert-ink); text-decoration: none; padding: 12px 2px; display: inline-block; min-height: 44px; }
.breadcrumb a:hover { text-decoration: underline; text-decoration-color: var(--chert-orange-deep); }
.breadcrumb li + li::before { content: "›"; color: var(--chert-muted); margin-inline-end: 6px; display: inline-block; }
[dir="rtl"] .breadcrumb li + li::before { transform: scaleX(-1); }
.breadcrumb [aria-current="page"] { color: var(--chert-ink); font-weight: 600; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: var(--space-1); list-style: none; margin: 0; padding: 0; align-items: center; }
.pagination a, .pagination button { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); border: 1px solid var(--chert-border); background: var(--chert-surface); color: var(--chert-ink); font: inherit; font-size: var(--fs-sm); font-weight: 600; text-decoration: none; cursor: pointer; }
.pagination [aria-current="page"] { background: var(--chert-ink); color: var(--chert-cream); border-color: var(--chert-ink); }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }

/* ---- Table (§6.7) ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--chert-border); border-radius: var(--radius-card); background: var(--chert-surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table caption { text-align: start; padding: 12px 16px; font-weight: 600; color: var(--chert-muted); caption-side: top; }
.table th { background: var(--chert-ink); color: var(--chert-surface); font-size: var(--fs-sm); font-weight: 700; padding: 12px 16px; text-align: start; }
.table td { padding: 14px 16px; border-block-start: 1px solid var(--chert-border); }
.table tbody tr:nth-child(even) td { background: var(--chert-surface-alt); }
.table tbody tr:hover td { background: var(--chert-orange-tint); }
.table .num { text-align: end; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---- Alerts (callouts with role) and toasts (§6.8) ---- */
.alert { display: flex; gap: var(--space-3); align-items: flex-start; }
.alert__title { font-weight: 700; margin: 0 0 2px; }
.alert p { margin: 0; font-size: var(--fs-sm); }
.toast-region { position: fixed; inset-block-end: var(--space-5); inset-inline-end: var(--space-5); display: flex; flex-direction: column-reverse; gap: var(--space-2); z-index: var(--z-toast); max-width: min(360px, calc(100vw - 2 * var(--space-5))); }
.toast { background: var(--chert-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-dropdown); border-inline-start: 4px solid var(--chert-info); padding: 12px 16px; font-size: var(--fs-sm); display: flex; gap: var(--space-3); align-items: center; animation: dd-in var(--dur-base) var(--ease); }
.toast--success { border-color: var(--chert-success); } .toast--error { border-color: var(--chert-error); } .toast--warning { border-color: var(--chert-warning); }
.toast__close { margin-inline-start: auto; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--chert-ink); cursor: pointer; font: inherit; }
.icon-btn:hover { background: var(--chert-orange-tint); }

/* ---- Modal / drawer (§6.8, §8.2) ---- */
.backdrop { position: fixed; inset: 0; background: rgba(26,26,24,.5); z-index: var(--z-overlay); display: none; }
.backdrop[data-open="true"] { display: block; }
.modal { position: fixed; inset: 0; margin: auto; width: min(560px, calc(100vw - 2 * var(--space-5))); height: fit-content; max-height: calc(100vh - 2 * var(--space-5)); overflow: auto; background: var(--chert-surface); border-radius: var(--radius-card); box-shadow: var(--shadow-modal); padding: var(--space-6); z-index: var(--z-modal); display: none; }
.modal[data-open="true"] { display: block; animation: dd-in var(--dur-slow) var(--ease); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-block-end: var(--space-4); }
.modal__actions { display: flex; gap: var(--space-2); justify-content: flex-end; margin-block-start: var(--space-5); }
.drawer { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(320px, 85vw); background: var(--chert-cream); z-index: var(--z-modal); box-shadow: var(--shadow-modal); transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease); overflow: auto; padding: var(--space-5); }
[dir="rtl"] .drawer { transform: translateX(100%); }
/* A closed drawer is off-screen AND unreachable by keyboard/AT (visibility), not merely translated. */
.drawer { visibility: hidden; transition: transform var(--dur-slow) var(--ease), visibility 0s linear var(--dur-slow); }
.drawer[data-open="true"] { transform: none; visibility: visible; transition-delay: 0s; }

/* ---- Progress / loading / skeleton / empty / error (§6.8) ---- */
.progress { height: 8px; background: var(--chert-border); border-radius: var(--radius-pill); overflow: hidden; }
.progress__bar { height: 100%; background: var(--chert-orange); border-radius: inherit; }
.skeleton { background: var(--chert-surface-alt); border-radius: var(--radius-sm); position: relative; overflow: hidden; min-height: 14px; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--chert-surface), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.state { text-align: center; padding: var(--space-7) var(--space-5); border: 1px dashed var(--chert-border-strong); border-radius: var(--radius-card); background: var(--chert-surface); }
.state .chert-star { width: 48px; height: 48px; color: var(--chert-tan); }
.state--error .chert-star { color: var(--chert-error); }
.state h3 { margin-block: var(--space-4) var(--space-2); }
.state p { margin: 0 0 var(--space-4); color: var(--chert-muted); }
.loading { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--chert-muted); font-size: var(--fs-sm); }

/* ---- Language switcher (§7.5) and product switcher (§6.6) ---- */
.lang-switch { min-height: 44px; padding: 0 14px; border: 1px solid var(--chert-border-strong); background: var(--chert-surface); border-radius: var(--radius-pill); font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--chert-ink); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.lang-switch:hover { background: var(--chert-orange-tint); }
/* the label is written in the target language: Arabic label uses the Arabic family (avoids pulling the full Latin TTF for one word) */
.lang-switch[lang="ar"] { font-family: 'CHERT Sans Arabic', var(--font-ar); }
.lang-switch[lang="en"] { font-family: var(--font-ui); }
.switcher-trigger { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 0; background: transparent; border-radius: var(--radius-sm); font: inherit; font-size: var(--fs-sm); font-weight: 700; color: var(--chert-ink); cursor: pointer; }
.switcher-trigger:hover { background: var(--chert-orange-tint); }
.switcher-trigger .chert-star { width: 20px; height: 20px; }
.switcher-panel { width: min(320px, calc(100vw - 2 * var(--space-4))); padding: 8px; }
.switcher-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.switcher-grid .dropdown__item { flex-direction: column; align-items: flex-start; gap: 2px; min-height: 64px; }
.switcher-grid .dropdown__item small { color: var(--chert-muted); font-weight: 500; font-size: var(--fs-xs); }
.switcher-grid .dropdown__item .chert-star { width: 18px; height: 18px; }

/* ---- Brand lockups (§2) ---- */
.brand { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; text-decoration: none; color: var(--chert-ink); }
.brand__mark { height: 32px; width: auto; display: block; }
.brand__mark--sm { height: 28px; }
.brand__mark--icon { height: 24px; }
.brand__word { font-weight: 800; letter-spacing: 1px; font-size: var(--fs-lg); line-height: 1; }
.brand__product { font-weight: 500; color: var(--chert-ink); font-size: var(--fs-lg); line-height: 1; }
.brand__product::before { content: "|"; color: var(--chert-tan); margin-inline: 2px 6px; }
[lang="ar"] .brand__word, [lang="ar"] .brand__product { letter-spacing: normal; }
/* The arrowhead is never mirrored: force the mark's own direction. */
.brand__mark, [dir="rtl"] .brand__mark { transform: none; }
/* Dark-surface treatment: the engraving (≈2.4:1 on ink) sits on a cream tile; it is never recoloured. */
.brand__tile { display: inline-grid; place-items: center; background: var(--chert-cream); border-radius: var(--radius-md); padding: 6px; }
.on-dark { background: var(--chert-dark); color: var(--chert-dark-text); border-radius: var(--radius-card); padding: var(--space-5); }
.on-dark .muted { color: var(--chert-dark-muted); }
.on-dark .btn--primary { background: var(--chert-orange); color: var(--chert-ink); }
.on-dark .brand { color: var(--chert-dark-text); }

/* ---- Footer (§5.7) ---- */
.footer { background: var(--chert-ink); color: var(--chert-dark-text); padding-block: var(--space-7); margin-block-start: var(--space-9); }
.footer a, .footer .brand { color: var(--chert-dark-text); text-decoration: none; }
.footer a:hover { text-decoration: underline; text-decoration-color: var(--chert-orange); }
.footer__grid { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
@media (min-width: 640px) { .footer__grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .footer__grid { grid-template-columns: 2fr repeat(3, 1fr); } }
.footer__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: var(--fs-sm); }
.footer__muted { color: var(--chert-dark-muted); font-size: var(--fs-sm); }

/* ---- Utilities ---- */
.row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.stack { display: grid; gap: var(--space-3); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ==== atlas.css ==== */
/* ============================================================
   CHERT Atlas layer — app shell (§5.8) and Atlas-specific data
   components. Tokens only; no literal colours.
   ============================================================ */

/* ---- Illustrative-data banner (master plan §29) ---- */
.illustrative { background: var(--chert-warning-tint); border-block-end: 1px solid var(--chert-border); font-size: var(--fs-sm); padding: 8px var(--gutter); display: flex; gap: 8px; align-items: center; }
.illustrative::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--chert-warning); flex: none; }
[data-illustrative]::after { content: attr(data-illustrative-label); display: inline-block; font-size: var(--fs-overline); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--chert-muted); margin-inline-start: 6px; vertical-align: middle; }
[lang="ar"] [data-illustrative]::after { letter-spacing: normal; text-transform: none; }

/* ---- App shell (§5.8) ---- */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-rows: auto 1fr; }
.app__sidebar { grid-row: 1 / span 2; background: var(--chert-tan); padding: var(--space-6) 26px; display: flex; flex-direction: column; gap: var(--space-5); position: sticky; inset-block-start: 0; height: 100vh; overflow-y: auto; }
.app__topbar { height: 64px; background: var(--chert-surface); border-block-end: 1px solid var(--chert-border); display: flex; align-items: center; gap: var(--space-3); padding-inline: var(--space-5); position: sticky; inset-block-start: 0; z-index: var(--z-sticky); }
.app__main { padding: var(--space-5); max-width: var(--maxw-wide); width: 100%; }
.app__title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-block: var(--space-2) var(--space-5); }
.app__title h1 { margin: 0; }
.topbar__search { flex: 1; max-width: 420px; }
.topbar__spacer { flex: 1; }
.menu-btn { display: none; }
.app__topbar .breadcrumb { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; min-width: 0; }
.app__topbar > * { flex-shrink: 0; }
.app__topbar nav[aria-label="Breadcrumb"], .app__topbar .topbar__search { flex-shrink: 1; min-width: 0; }
@media (max-width: 1279px) { .topbar__search { max-width: 240px; } .app__topbar .switcher-trigger > span:not(.chert-star) { display: none; } }

.nav { display: flex; flex-direction: column; gap: var(--space-4); }
.nav__group > summary, .nav__heading { list-style: none; cursor: pointer; font-size: var(--fs-overline); font-weight: 600; letter-spacing: 3px; text-transform: uppercase; color: var(--chert-ink); opacity: .8; padding: 10px 14px; min-height: 44px; display: flex; align-items: center; justify-content: space-between; border-radius: var(--radius-sm); }
.nav__group > summary::-webkit-details-marker { display: none; }
.nav__group > summary::after { content: "›"; transform: rotate(90deg); transition: transform var(--dur-fast) var(--ease); font-size: var(--fs-lg); }
.nav__group[open] > summary::after { transform: rotate(-90deg); }
[lang="ar"] .nav__group > summary, [lang="ar"] .nav__heading { letter-spacing: normal; text-transform: none; }
.nav__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav__link { display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 44px; border-radius: var(--radius-sm); color: var(--chert-ink); opacity: .8; text-decoration: none; font-size: var(--fs-sm); font-weight: 600; }
.nav__link:hover { opacity: 1; background: var(--chert-cream); }
.nav__link[aria-current="page"] { background: var(--chert-ink); color: var(--chert-cream); opacity: 1; }
.nav__link--top { font-size: var(--fs-base); }
.nav__cta { margin-block-start: auto; }
.nav__cta .btn { width: 100%; }

/* Sidebar (§5.8): drawer below lg. The md icon-rail variant is deferred until navigation icons exist (Phase 5):
   hiding link text without icons would leave 44 px targets with no accessible name. */
@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app__sidebar { display: none; }
  .app__sidebar.drawer { display: flex; position: fixed; grid-area: auto; height: auto; inset-block: 0; }
  .menu-btn { display: inline-grid; }
}
@media (max-width: 639px) {
  .app__main { padding: var(--space-4); }
  .topbar__search { display: none; }
  .app__topbar { gap: 4px; padding-inline: 8px; }
  .app__topbar nav[aria-label="Breadcrumb"], .app__topbar .switcher-trigger > span, .app__topbar .icon-btn:not(.menu-btn) { display: none; }
  .app__topbar .switcher-trigger { padding-inline: 8px; min-width: 44px; justify-content: center; }
}
.drawer .brand__word, .drawer .brand__product, .drawer .nav__group > summary, .drawer .nav__link span, .drawer .nav__cta { display: initial; }
.drawer .nav__link { justify-content: flex-start; padding-inline: 14px; }
.drawer .nav__group > summary { display: flex; }

/* ---- Workspace grids ---- */
.grid-kpi { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .grid-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.grid-2 { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
@media (min-width: 1024px) { .grid-2 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.panel { background: var(--chert-surface); border: 1px solid var(--chert-border); border-radius: var(--radius-card); padding: var(--space-5); }
.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-block-end: var(--space-4); }
.panel__head h2, .panel__head h3 { margin: 0; font-size: var(--fs-h3); }

/* ---- Filters and period selector ---- */
.filters { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-block-end: var(--space-5); }
.filters .select, .filters .input { width: auto; min-width: 160px; }
.period { display: inline-flex; border: 1px solid var(--chert-border-strong); border-radius: var(--radius-pill); background: var(--chert-surface); padding: 3px; }
.period button { min-height: 44px; min-width: 44px; padding: 0 14px; border: 0; background: transparent; border-radius: var(--radius-pill); font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--chert-ink); cursor: pointer; }
.period button[aria-pressed="true"] { background: var(--chert-ink); color: var(--chert-cream); }

/* ---- KPI / statistic card ---- */
.kpi { background: var(--chert-surface); border: 1px solid var(--chert-border); border-radius: var(--radius-card); padding: var(--space-5); display: grid; gap: 6px; min-width: 0; }
.kpi > * { min-width: 0; }
.kpi__label { font-size: var(--fs-sm); font-weight: 600; color: var(--chert-muted); display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.kpi__value { font-family: var(--font-mono); font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi__delta { font-size: var(--fs-sm); font-weight: 600; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--chert-ink); }
.kpi__delta::before { content: ""; width: 0; height: 0; border-inline: 5px solid transparent; }
.kpi__delta--up::before { border-block-end: 7px solid var(--chert-success); }
.kpi__delta--down::before { border-block-start: 7px solid var(--chert-error); }
.kpi__meta { font-size: var(--fs-xs); color: var(--chert-muted); }

/* ---- Confidence / freshness / methodology ---- */
.confidence { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 600; }
.confidence__dots { display: inline-flex; gap: 3px; }
.confidence__dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--chert-border-strong); }
.confidence__dots i.on { background: var(--chert-ink); }
.freshness { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--chert-muted); }
.freshness::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--chert-success); }
.freshness--stale::before { background: var(--chert-warning); }
.methodology { border-inline-start: 4px solid var(--chert-tan); background: var(--chert-surface-alt); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); font-size: var(--fs-sm); display: grid; gap: 4px; }
.methodology dt { font-weight: 700; } .methodology dd { margin: 0 0 4px; color: var(--chert-muted); }

/* ---- Evidence / source card ---- */
.evidence { background: var(--chert-surface); border: 1px solid var(--chert-border); border-radius: var(--radius-card); padding: var(--space-4); display: grid; gap: 8px; }
.evidence__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.evidence__grade { font-family: var(--font-mono); font-weight: 700; width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); background: var(--chert-ink); color: var(--chert-cream); flex: none; }
.evidence__title { font-weight: 700; margin: 0; }
.evidence__meta { font-size: var(--fs-xs); color: var(--chert-muted); display: flex; flex-wrap: wrap; gap: 10px; }
.evidence__quote { margin: 0; font-size: var(--fs-sm); border-inline-start: 3px solid var(--chert-orange); padding-inline-start: 10px; }

/* ---- Market / company card ---- */
.entity { background: var(--chert-surface); border: 1px solid var(--chert-border); border-radius: var(--radius-card); padding: var(--space-4); display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); align-items: start; }
.entity__name { font-weight: 700; margin: 0; }
.entity__facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 12px; font-size: var(--fs-xs); margin-block-start: 6px; }
.entity__facts dt { color: var(--chert-muted); } .entity__facts dd { margin: 0; font-family: var(--font-mono); }

/* ---- Trend / sparkline / chart container / map container ----
   Charts are always LTR: the time axis never mirrors (§7.2). */
.chart { direction: ltr; unicode-bidi: isolate; display: block; }
.chart svg { width: 100%; height: auto; display: block; }
.chart-container { background: var(--chert-surface); border: 1px solid var(--chert-border); border-radius: var(--radius-card); padding: var(--space-4); }
.chart-container__head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-block-end: var(--space-3); }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--space-3); font-size: var(--fs-xs); color: var(--chert-muted); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 6px; vertical-align: middle; }
/* categorical sequence (§6.7): orange → tan → ink → orange-deep → dark-muted → muted */
.c1 { color: var(--chert-orange); } .c2 { color: var(--chert-tan); } .c3 { color: var(--chert-ink); } .c4 { color: var(--chert-orange-deep); } .c5 { color: var(--chert-dark-muted); } .c6 { color: var(--chert-muted); }
.chart-legend i.c1 { background: var(--chert-orange); } .chart-legend i.c2 { background: var(--chert-tan); } .chart-legend i.c3 { background: var(--chert-ink); } .chart-legend i.c4 { background: var(--chert-orange-deep); } .chart-legend i.c5 { background: var(--chert-dark-muted); } .chart-legend i.c6 { background: var(--chert-muted); }
.chart .grid-line { stroke: var(--chert-border); stroke-width: 1; }
.chart .axis-label { fill: var(--chert-muted); font-family: var(--font-mono); font-size: 11px; }
.chart .series-1 { stroke: var(--chert-orange); } .chart .series-2 { stroke: var(--chert-tan); } .chart .series-3 { stroke: var(--chert-ink); }
.chart .band { fill: var(--chert-orange-tint); }
.chart .bar-1 { fill: var(--chert-orange); } .chart .bar-2 { fill: var(--chert-tan); } .chart .bar-3 { fill: var(--chert-ink); }
.sparkline { width: 96px; height: 28px; }
.sparkline path { fill: none; stroke: var(--chert-orange); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.map-container { background: var(--chert-surface-alt); border: 1px dashed var(--chert-border-strong); border-radius: var(--radius-card); min-height: 220px; display: grid; place-items: center; text-align: center; padding: var(--space-4); color: var(--chert-muted); font-size: var(--fs-sm); }

/* ---- Risk / opportunity / forecast / TAM-SAM-SOM ---- */
.score { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-3); font-size: var(--fs-sm); }
.score__bar { height: 8px; background: var(--chert-border); border-radius: var(--radius-pill); overflow: hidden; }
.score__bar i { display: block; height: 100%; background: var(--chert-ink); }
.score--risk .score__bar i { background: var(--chert-error); }
.score--opportunity .score__bar i { background: var(--chert-success); }
.score__value { font-family: var(--font-mono); font-weight: 700; }
.tam { display: grid; gap: 6px; }
.tam__row { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: var(--space-3); font-size: var(--fs-sm); }
.tam__row i { display: block; height: 20px; border-radius: var(--radius-sm); }
.tam__row:nth-child(1) i { background: var(--chert-tan); width: 100%; }
.tam__row:nth-child(2) i { background: var(--chert-orange); width: 55%; }
.tam__row:nth-child(3) i { background: var(--chert-ink); width: 20%; }
.tam__row strong { font-family: var(--font-mono); }
.scenario { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); font-size: var(--fs-xs); text-align: center; }
.scenario div { border: 1px solid var(--chert-border); border-radius: var(--radius-sm); padding: 8px; }
.scenario strong { display: block; font-family: var(--font-mono); font-size: var(--fs-base); }

/* ---- Showcase helpers (index.html only) ---- */
.swatches { display: grid; gap: var(--space-3); grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .swatches { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .swatches { grid-template-columns: repeat(5, 1fr); } }
.swatch { border: 1px solid var(--chert-border); border-radius: var(--radius-md); overflow: hidden; background: var(--chert-surface); }
.swatch i { display: block; height: 72px; }
.swatch div { padding: 8px 10px; font-size: var(--fs-xs); }
.swatch code { font-family: var(--font-mono); color: var(--chert-muted); }
.demo { display: grid; gap: var(--space-4); }
.demo-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 var(--space-5); }
.toc a { display: inline-block; padding: 10px 14px; min-height: 44px; border-radius: var(--radius-pill); border: 1px solid var(--chert-border-strong); background: var(--chert-surface); font-size: var(--fs-sm); font-weight: 600; color: var(--chert-ink); text-decoration: none; }
.toc a:hover { background: var(--chert-orange-tint); }
.hero { text-align: center; padding-block: var(--space-7) var(--space-6); }
.hero .lead { margin-inline: auto; color: var(--chert-muted); }
.hero__actions { display: flex; justify-content: center; gap: var(--space-3); flex-wrap: wrap; margin-block-start: var(--space-5); }
.pill-badge { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--chert-border-strong); background: var(--chert-surface); border-radius: var(--radius-pill); padding: 6px 14px; font-size: var(--fs-sm); font-weight: 600; margin-block-end: var(--space-4); }
.bidi-table td:first-child { color: var(--chert-muted); width: 40%; }
.contrast-ok { font-family: var(--font-mono); }
.typo-sample { display: grid; gap: var(--space-2); }
.typo-sample p { margin: 0; }
.type-row { display: grid; grid-template-columns: 110px 1fr; gap: var(--space-3); align-items: baseline; border-block-end: 1px solid var(--chert-border); padding-block: 8px; }
.type-row code { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--chert-muted); }
.states-grid { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 640px) { .states-grid { grid-template-columns: repeat(2, 1fr); } }
.state-cell { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 10px 14px; border: 1px solid var(--chert-border); border-radius: var(--radius-sm); background: var(--chert-surface); font-size: var(--fs-sm); }
.is-hover.btn--primary { background: var(--chert-orange-deep); transform: translateY(-1px); }
.is-hover.btn--secondary { background: var(--chert-ink); color: var(--chert-cream); }
.is-focus { outline: 2px solid var(--chert-ink); outline-offset: 2px; }
.is-focus.input { outline: none; border-color: var(--chert-orange); box-shadow: 0 0 0 3px rgba(255,134,81,.25); }
.is-hover.card { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.is-hover.nav__link { opacity: 1; background: var(--chert-cream); }

/* ==== marketing.css ==== */
/* CHERT Atlas marketing site — section layer. Tokens only (chert-tokens.css); components from chert-components.css / atlas.css.
   Marketing anatomy per design system §5.7: sticky cream header, hero, feature grid, alternating cream/white sections, tan CTA band, ink footer. */

/* ---- Header ---- */
.site-header { gap: var(--space-4); }
.site-header__actions { display: flex; align-items: center; gap: var(--space-2); }
.site-nav__list { display: flex; gap: var(--space-1); list-style: none; margin: 0; padding: 0; }
.site-nav__list a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: 600; color: var(--chert-ink); opacity: .85; text-decoration: none; }
.site-nav__list a:hover { opacity: 1; text-decoration: underline; text-decoration-color: var(--chert-orange); text-underline-offset: 6px; text-decoration-thickness: 2px; }
.site-nav__head { display: none; }
@media (max-width: 1023px) {
  .site-nav { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(320px, 85vw); background: var(--chert-cream); z-index: var(--z-modal); box-shadow: var(--shadow-modal); transform: translateX(-100%); visibility: hidden; transition: transform var(--dur-slow) var(--ease), visibility 0s linear var(--dur-slow); padding: var(--space-5); overflow: auto; }
  [dir="rtl"] .site-nav { transform: translateX(100%); }
  .site-nav[data-open="true"] { transform: none; visibility: visible; transition-delay: 0s; }
  .site-nav__head { display: flex; align-items: center; justify-content: space-between; margin-block-end: var(--space-5); }
  .site-nav__list { flex-direction: column; gap: var(--space-1); }
  .site-nav__list a { font-size: var(--fs-lg); padding: 12px 14px; min-height: 48px; }
  .menu-btn { display: inline-grid; }
  .site-header__cta { display: none; }
}
@media (min-width: 1024px) { .site-nav { display: block; } .menu-btn { display: none; } }

/* ---- Hero ---- */
.hero-band { background: var(--chert-cream); padding-block: var(--space-8) var(--space-7); }
.hero-grid { display: grid; gap: var(--space-6); grid-template-columns: 1fr; align-items: center; }
@media (min-width: 1024px) { .hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: var(--space-8); } }
.hero-title { margin: var(--space-4) 0 var(--space-4); }
.hero-lead { color: var(--chert-muted); margin: 0 0 var(--space-5); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.hero-note { margin: var(--space-4) 0 0; }
.hero-panel { background: var(--chert-surface); border: 1px solid var(--chert-border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: var(--space-5); display: grid; gap: var(--space-3); }
.hero-panel__head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.hero-kpi { border: 0; padding: 0; box-shadow: none; }
.hero-chart svg { width: 100%; height: auto; }
.hero-panel__meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); }

/* anchor targets clear the sticky header */
[id] { scroll-margin-block-start: calc(var(--header-h) + 16px); }

/* ---- Sections ---- */
.section { padding-block: var(--space-8); }
@media (min-width: 1024px) { .section { padding-block: var(--space-9); } }
.section--alt { background: var(--chert-surface); }
.section--dark { background: var(--chert-dark); color: var(--chert-dark-text); }
.section--dark .lead, .section--dark .muted { color: var(--chert-dark-muted); }
.overline--dark { color: var(--chert-dark-muted); }
.section h2 { margin-block: var(--space-2) var(--space-3); }
.two-col { display: grid; gap: var(--space-6); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1024px) { .two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-8); } }

/* ---- Trust strip ---- */
.trust { padding-block: var(--space-6); }
.trust__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .trust__list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .trust__list { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.trust__list li { display: grid; gap: 4px; padding-inline-start: var(--space-3); border-inline-start: 3px solid var(--chert-orange); }
.trust__list strong { font-size: var(--fs-base); }
.trust__list span { font-size: var(--fs-sm); color: var(--chert-muted); }

/* ---- How it works: flow ---- */
.flow { list-style: none; margin: var(--space-6) 0 0; padding: 0; display: grid; gap: 0; max-width: 760px; }
.flow__inputs { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 640px) { .flow__inputs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.flow__card, .flow__step, .flow__outputs { background: var(--chert-surface); border: 1px solid var(--chert-border); border-radius: var(--radius-md); padding: var(--space-4); display: grid; grid-template-columns: auto 1fr; gap: 4px var(--space-3); align-items: center; }
.flow__card--signal { border-color: var(--chert-orange); }
.flow__num { width: 28px; height: 28px; border-radius: 50%; background: var(--chert-ink); color: var(--chert-cream); font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 700; display: inline-grid; place-items: center; grid-row: span 2; }
.flow__card .flow__num { grid-row: auto; }
.flow__step span:not(.flow__num), .flow__outputs span:not(.flow__num) { font-size: var(--fs-sm); color: var(--chert-muted); }
/* connector arrows sit between cards, not inside them */
.flow__step, .flow__outputs { position: relative; margin-block-start: 36px; }
.flow__step::before, .flow__outputs::before { content: "↓"; position: absolute; inset-block-start: -32px; inset-inline: 0; text-align: center; color: var(--chert-tan); font-size: var(--fs-lg); line-height: 28px; }
.flow__step--privacy { border-color: var(--chert-orange-deep); background: var(--chert-orange-tint); }
.flow__step--bank { border-color: var(--chert-tan); background: var(--chert-surface-alt); }
.flow__outputs { background: var(--chert-ink); color: var(--chert-cream); border-color: var(--chert-ink); }
.flow__outputs .flow__num { background: var(--chert-orange); color: var(--chert-ink); }
.flow__outputs span:not(.flow__num) { color: var(--chert-dark-muted); }

/* ---- Capabilities ---- */
.cap-grid { display: grid; gap: var(--space-3); grid-template-columns: 1fr; margin-block: var(--space-6) var(--space-4); }
@media (min-width: 640px) { .cap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .cap-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cap { background: var(--chert-surface-alt); border: 1px solid var(--chert-border); border-radius: var(--radius-md); padding: var(--space-4); }
.cap h3 { font-size: var(--fs-base); margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.cap h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--chert-orange); flex: none; }
.cap p { margin: 0; font-size: var(--fs-sm); color: var(--chert-muted); }

/* ---- Saudi foundation tiles ---- */
.tile-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .tile-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile-list li { background: var(--chert-surface); border: 1px solid var(--chert-border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: var(--fs-sm); font-weight: 600; min-height: 44px; display: flex; align-items: center; }

/* ---- CHERT signals (dark) ---- */
.signals-grid { margin-block-start: var(--space-6); }
.source-list { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: grid; gap: var(--space-2); }
.source-list li { display: grid; grid-template-columns: 110px 1fr; gap: var(--space-3); align-items: baseline; padding: 10px 0; border-block-end: 1px solid var(--chert-dark-border); }
.source-list strong { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--chert-orange); }
.source-list span { font-size: var(--fs-sm); color: var(--chert-dark-text); }
.chain { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); counter-reset: chain; }
.chain li { background: var(--chert-dark-surface); border: 1px solid var(--chert-dark-border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); display: grid; grid-template-columns: auto 1fr; gap: 2px var(--space-3); align-items: center; counter-increment: chain; }
.chain li::before { content: counter(chain); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; background: var(--chert-dark-border); color: var(--chert-dark-text); font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 700; display: inline-grid; place-items: center; }
.chain li span { font-size: var(--fs-sm); color: var(--chert-dark-muted); }
.chain__out { border-color: var(--chert-orange) !important; }
.chain__out::before { background: var(--chert-orange) !important; color: var(--chert-ink) !important; }
.callout--note-dark { margin: var(--space-6) 0 0; border-inline-start: 4px solid var(--chert-orange); background: var(--chert-dark-surface); color: var(--chert-dark-text); padding: var(--space-4); border-radius: var(--radius-sm); font-size: var(--fs-sm); }

/* ---- Industries ---- */
.ind-grid { display: grid; gap: var(--space-3); grid-template-columns: 1fr; margin-block: var(--space-6) var(--space-3); }
@media (min-width: 640px) { .ind-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .ind-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ind { background: var(--chert-surface); border: 1px solid var(--chert-border); border-radius: var(--radius-card); padding: var(--space-4); transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease); }
.ind:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.ind__viz { width: 100%; height: 48px; display: block; margin-block-end: var(--space-3); direction: ltr; }
.ind__viz .bar-1 { fill: var(--chert-orange); } .ind__viz .bar-2 { fill: var(--chert-tan); } .ind__viz .bar-3 { fill: var(--chert-ink); }
.ind__viz .series-1 { stroke: var(--chert-orange); } .ind__viz .series-2 { stroke: var(--chert-tan); } .ind__viz .series-3 { stroke: var(--chert-ink); }
.ind h3 { font-size: var(--fs-base); margin: 0 0 4px; }
.ind p { margin: 0; font-size: var(--fs-sm); color: var(--chert-muted); }

/* ---- Preview ---- */
.preview-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; }
.badge--lg { font-size: var(--fs-sm); padding: 8px 14px; }
.preview-filters { margin-block: var(--space-5); align-items: center; }
.preview-filters .label { margin: 0; }
.preview-grid { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .preview-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .preview-chart { grid-column: span 3; } }
@media (min-width: 640px) and (max-width: 1023px) { .preview-chart { grid-column: span 2; } }
.preview-grid .panel__head { align-items: center; flex-wrap: wrap; } .preview-grid .panel__head h3 { font-size: var(--fs-base); }

/* ---- Layla ---- */
.layla-demo { background: var(--chert-surface); border: 1px solid var(--chert-border); border-radius: var(--radius-card); padding: var(--space-5); display: grid; gap: var(--space-4); box-shadow: var(--shadow-card); }
.layla-demo__q, .layla-demo__a { display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); align-items: start; }
.layla-demo__q p, .layla-demo__a p { margin: 0 0 var(--space-2); }
.layla-demo__a { background: var(--chert-orange-tint); border-radius: var(--radius-md); padding: var(--space-3); }
.layla-demo__a .chert-star { color: var(--chert-ink); width: 26px; height: 26px; }
.layla-caps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.layla-caps li { background: var(--chert-surface-alt); border: 1px solid var(--chert-border); border-radius: var(--radius-pill); padding: 6px 12px; font-size: var(--fs-xs); font-weight: 600; }

/* ---- Research steps ---- */
.steps { list-style: none; margin: var(--space-6) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); counter-reset: steps; }
.steps li { counter-increment: steps; background: var(--chert-surface-alt); border: 1px solid var(--chert-border); border-radius: var(--radius-pill); padding: 10px 16px 10px 12px; font-size: var(--fs-sm); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.steps li::before { content: counter(steps); width: 24px; height: 24px; border-radius: 50%; background: var(--chert-ink); color: var(--chert-cream); font-family: var(--font-mono); font-size: var(--fs-xs); display: inline-grid; place-items: center; }
.steps__out { background: var(--chert-ink) !important; color: var(--chert-cream); border-color: var(--chert-ink) !important; }
.steps__out::before { background: var(--chert-orange) !important; color: var(--chert-ink) !important; }

/* ---- API ---- */
.api-card { background: var(--chert-ink); color: var(--chert-dark-text); border-radius: var(--radius-card); padding: var(--space-5); }
.api-card .overline { color: var(--chert-dark-muted); }
.api-list { list-style: none; margin: var(--space-3) 0; padding: 0; display: grid; gap: 6px; font-size: var(--fs-sm); color: var(--chert-dark-text); }
.api-list li::before { content: "·"; color: var(--chert-orange); margin-inline-end: 8px; }
.api-card .muted { color: var(--chert-dark-muted); }

/* ---- Governance ---- */
.gov-grid { list-style: none; margin: var(--space-6) 0 0; padding: 0; display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 640px) { .gov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .gov-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.gov-grid li { display: grid; gap: 4px; padding: var(--space-4); background: var(--chert-surface-alt); border: 1px solid var(--chert-border); border-radius: var(--radius-md); }
.gov-grid strong { font-size: var(--fs-sm); }
.gov-grid span { font-size: var(--fs-xs); color: var(--chert-muted); }

/* ---- CTA band ---- */
.cta-band { background: var(--chert-tan); padding-block: var(--space-8); }
.cta-band__inner { display: grid; gap: var(--space-5); grid-template-columns: 1fr; align-items: center; }
@media (min-width: 1024px) { .cta-band__inner { grid-template-columns: minmax(0, 1fr) auto; } }
.cta-band h2 { margin: 0 0 var(--space-2); }
.cta-band .lead { margin: 0; color: var(--chert-ink); }

/* ---- Footer additions ---- */
.footer { margin-block-start: 0; }
.lang-switch--footer { background: var(--chert-dark-surface); color: var(--chert-dark-text); border-color: var(--chert-dark-border); }
.lang-switch--footer:hover { background: var(--chert-dark-border); }

/* ---- 404 ---- */
.nf { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: var(--space-7) var(--gutter); }
