/* =============================================================
   GLOBAL ACCESSIBILITY + NUMERIC POLISH — wave 2 S17
   ============================================================= */
:focus-visible { outline: 2px solid #1f3a55; outline-offset: 2px; border-radius: 2px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
[role="tab"]:focus-visible, [role="button"]:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid #1f3a55; outline-offset: 2px;
}
.lc-mono, .h-mono, .dl-meta, .kpi-val, .product-code, .cal-amount, .cal-date,
.lc-clock-time, .lc-tk-val, .lc-kpi-val, .libra-mode-pill, .libra-egypt-chip,
.libra-persona-pill, .badge-prod, .badge-tier, .badge-class, .asset-pill,
[class*="-mono"], [class*="kpi-val"], [class*="ticker"] {
  font-variant-numeric: tabular-nums lining-nums;
}

/* =============================================================
   Libra Infra AI — Design System v3.2 (Cinematic Cartography)
   Movement: an instrument for navigating the financing of physical
   infrastructure at planetary scale. ISS cupola palette + Bloomberg
   discipline + Knopf monograph craftsmanship.
   See: DESIGN_PHILOSOPHY_LibraInfra.md
   ============================================================= */

/* Libra's own type stack — Cormorant Garamond (display) + Inter (body) + JetBrains Mono (data).
   Quality discipline borrowed from anthropic-skills:canvas-design philosophy
   (hairlines, glass, layered shadows, tabular nums, operatic ratio) — but the
   typography and palette are Libra's, not Anthropic's. */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@300;400;500;600;700&display=swap');

/* =============================================================
   TOKENS
   ============================================================= */
:root {
  /* === REAL CINEMATIC SPACE — ISS night cupola / Interstellar grade ===
     Desaturated, atmospheric, photo-realistic. NOT pop / NOT Discord blue.
     Saturation kept low (~25-35%) to avoid the cartoon look. */

  /* Depth — slight violet-shift in the blacks, like real night space */
  --void:        #02040a;   /* deepest, violet-black */
  --deep:        #060a14;   /* navy-violet underbed */
  --surface:     #0c1422;   /* steel-navy panel */
  --card:        #111a2c;   /* slight elevation */
  --border:      #1c2a40;   /* muted steel rim */
  --border-hi:   #2a3a55;   /* lighter rim, hover */

  /* === Libra's own brand palette — Cinematic Cartography ===
     Real ISS cupola space colors. Desaturated steel-cyan atmosphere haze
     + warm Earth-limb amber. These are Libra's, not Anthropic's. */

  /* Steel-cyan spectrum — atmosphere haze, not LED */
  --blue:        #5a8eb6;   /* atmosphere haze, primary accent */
  --blue-bright: #b6cee0;   /* thin atmospheric band */
  --blue-glow:   #7eaecc;   /* horizon scatter */
  --blue-dark:   #345e85;   /* dusk blue */
  --blue-deep:   #1f3a55;   /* deep dusk steel */
  --blue-ice:    #d9e4ee;   /* highest highlight */
  --blue-sky:    #e6ecf2;   /* near-white starlight */

  /* Warm Earth-limb amber — used SPARINGLY for atmospheric glow,
     active state, positive verdict. The single warm note. */
  --amber:       #c89a5a;   /* Earth-limb amber — restored W8.89 (was steel-blue since 8 May) */
  --amber-glow:  #e8c789;   /* lifted, hover halo */
  --amber-deep:  #8f6a3a;   /* shadowed variant */
  --amber-faint: rgba(200,154,90,0.18);

  /* Error — muted carrier red */
  --red:         #d35a5a;
  --red-dark:    #b04545;

  /* Text — warm starlight whites, steel grays */
  --white:       #ffffff;
  --ink:         #ece8df;   /* warm white starlight (not cool LCD white) */
  --ink-mid:     #a8b0c0;   /* steel gray — 9.41:1 on void, AA/AAA PASS */
  --ink-light:   #8892a6;   /* muted steel — bumped from #707a8e; 5.55:1 on card, 6.55:1 on void, AA PASS */
  --ink-faint:   #637080;   /* deep steel-violet — bumped from #3e4658; 3.44:1 on card, large-text AA PASS */

  /* Type stacks — Libra's own (Cormorant display + Inter body + JetBrains Mono data) */
  --font-display: 'Cormorant Garamond', Georgia, Garamond, serif;
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', ui-monospace, Menlo, monospace;

  /* Operatic type ramp — most page should whisper, one element should speak */
  --t-2xs: 0.62rem;       /* control-room readout labels */
  --t-xs:  0.72rem;       /* small body, captions */
  --t-sm:  0.82rem;       /* default UI */
  --t-base:0.94rem;       /* body */
  --t-md:  1.05rem;       /* lifted body */
  --t-lg:  1.25rem;       /* h4 */
  --t-xl:  1.55rem;       /* h3 */
  --t-2xl: 2.0rem;        /* h2 */
  --t-3xl: 2.7rem;        /* h2 hero */
  --t-4xl: clamp(2.8rem, 5.5vw, 4.6rem);  /* h1 — operatic */

  /* Spacing scale (4/8 base) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;
  --s-9: 56px; --s-10: 72px;

  /* Radius — minimal, instrument-precise */
  --r-1: 2px;  --r-2: 4px;  --r-3: 6px;  --r-4: 10px;

  /* Layout — magazine margins */
  --max-w: 1180px;

  /* Hairlines — instrument lines, not borders */
  --hairline:       rgba(126,174,204,0.14);
  --hairline-hi:    rgba(126,174,204,0.28);
  --hairline-amber: rgba(200,154,90,0.30);

  /* Layered elevation — ambient + key + highlight inset */
  --elev-1: 0 1px 2px rgba(0,0,0,0.40);
  --elev-2: 0 1px 2px rgba(0,0,0,0.40), 0 8px 24px rgba(0,0,0,0.42);
  --elev-3: 0 1px 2px rgba(0,0,0,0.45), 0 16px 40px rgba(0,0,0,0.50), inset 0 1px 0 rgba(255,255,255,0.03);
  --elev-4: 0 2px 4px rgba(0,0,0,0.50), 0 28px 60px rgba(0,0,0,0.60), inset 0 1px 0 rgba(255,255,255,0.05);

  /* Glow effects — atmospheric scatter, not LED */
  --glow-blue:    0 0 14px rgba(126,174,204,0.28);
  --glow-bright:  0 0 22px rgba(182,206,224,0.20);
  --glow-soft:    0 0 32px rgba(90,142,182,0.10);
  --glow-amber:   0 0 18px rgba(200,154,90,0.22);
  --focus-ring:   0 0 0 2px var(--blue-glow), 0 0 0 4px rgba(126,174,204,0.18);

  /* Motion — quiet bezier */
  --ease-cinematic: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-quiet:     cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================================
   RESET / GLOBALS
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--void);
  color: var(--ink);
  font-size: var(--t-base);
  line-height: 1.55;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
  text-rendering: optimizeLegibility;
}
/* Tabular numerals on every monospace + data display — control-room precision */
.mono, code, kbd, pre, samp, .tabular,
.stat-value, .kpi-value, .number, .data-value, .summary-value,
input[type="number"], td.num, td.mono {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: 'tnum' 1, 'lnum' 1, 'cv11' 1;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--blue-bright); text-decoration: none; transition: color .2s; }
a:hover { color: var(--blue); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-2); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: var(--t-4xl); line-height: 1.04; letter-spacing: -0.02em; }
h2 { font-size: var(--t-2xl); line-height: 1.18; }
h3 { font-size: var(--t-xl); line-height: 1.28; }
h4 { font-size: var(--t-lg); line-height: 1.38; }

.eyebrow, .data-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-light);
}
.mono { font-family: var(--font-mono); }
.ink-mid { color: var(--ink-mid); }
.ink-light { color: var(--ink-light); }
.ink-faint { color: var(--ink-faint); }

/* =============================================================
   LAYOUT
   ============================================================= */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--s-6); }

/* =============================================================
   GLOBAL ATMOSPHERE — subtle hex-grid + radial vignette
   Drop into <body> via <div class="atmosphere"></div> if a page wants it.
   ============================================================= */
.atmosphere {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(14,165,233,0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(2,132,199,0.05) 0%, transparent 50%);
}
.atmosphere::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(56,189,248,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56,189,248,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at 50% 50%, black 30%, transparent 80%);
}

/* =============================================================
   BRAND LOGO  (image swap; SVG sits in /assets/libra-logo.svg)
   Wordmark fallback for inline use.
   ============================================================= */
.libra-brand {
  display: inline-flex; align-items: center; gap: var(--s-3);
  text-decoration: none;
}
.libra-brand-mark {
  width: 28px; height: 28px;
  filter: drop-shadow(var(--glow-blue));
}
.libra-brand-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: var(--ink);
  text-transform: uppercase;
}
.libra-brand-text .accent {
  color: var(--blue);
  font-weight: 400;
  margin-left: 0.4em;
}

/* =============================================================
   NAV (mission control top bar)
   ============================================================= */
.libra-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-6);
  background: rgba(4,10,22,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.libra-nav-links {
  display: flex; gap: var(--s-1); list-style: none; padding: 0; margin: 0;
}
.libra-nav-links a {
  position: relative;
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-4);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-light);
  border-radius: var(--r-2);
  transition: color .2s, background .2s;
}
.libra-nav-links a:hover {
  color: var(--ink);
  background: rgba(56,189,248,0.06);
}
.libra-nav-links a[aria-current="page"] {
  color: var(--blue);
  background: rgba(56,189,248,0.1);
}
.libra-nav-links a[aria-current="page"]::before {
  content: ''; position: absolute; left: 50%; bottom: -1px;
  width: 16px; height: 1px; transform: translateX(-50%);
  background: var(--blue);
  box-shadow: 0 0 6px var(--blue);
}

/* =============================================================
   MODULE FLIGHT-PATH  (Stage 4 of the cinematic journey: FLYING)
   A sequenced indicator across Atlas › Pulse › Capital › Access.
   Active node has a warm Earth-limb amber glow + slow orbital pulse,
   reading like a current position marker on a flight tracker.
   ============================================================= */
.libra-flightpath {
  display: flex; align-items: center; justify-content: center;
  gap: 0;
  padding: var(--s-3) var(--s-6);
  background:
    linear-gradient(180deg, rgba(13,27,48,0.5), rgba(4,10,22,0.0)),
    radial-gradient(ellipse 60% 80% at 50% 0%, rgba(126,174,204,0.06), transparent 70%);
  border-bottom: 1px solid var(--hairline);
  position: relative;
  overflow: hidden;
}
.libra-flightpath::before {
  /* faint horizontal flight line behind the nodes */
  content: '';
  position: absolute;
  left: 12%; right: 12%; top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(126,174,204,0.18) 15%, rgba(126,174,204,0.18) 85%, transparent);
  pointer-events: none;
}

.libra-flightpath ol {
  list-style: none; padding: 0; margin: 0;
  display: flex; align-items: center; gap: 0;
  position: relative; z-index: 1;
}
.libra-flightpath li { position: relative; }

.libra-flightpath a, .libra-flightpath span.step {
  display: inline-flex; flex-direction: column; align-items: center;
  gap: 6px;
  padding: 6px 24px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-light);
  text-decoration: none;
  transition: color .25s var(--ease-quiet);
}
.libra-flightpath a:hover { color: var(--ink); }
.libra-flightpath .node {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--bg-elevated, var(--deep));
  border: 1px solid var(--blue-glow);
  box-shadow: inset 0 0 0 2px var(--void);
  transition: all .3s var(--ease-quiet);
}
.libra-flightpath .label {
  display: block;
  white-space: nowrap;
}
.libra-flightpath a:hover .node {
  border-color: var(--blue-bright);
  box-shadow: inset 0 0 0 2px var(--void), 0 0 12px rgba(126,174,204,0.35);
}

/* Active step — warm Earth-limb amber pulse, like a current-position marker */
.libra-flightpath [aria-current="step"] .node,
.libra-flightpath [aria-current="page"] .node {
  background: var(--amber);
  border-color: var(--amber-glow);
  box-shadow:
    0 0 0 2px rgba(126,174,204,0.10),
    0 0 14px rgba(126,174,204,0.55);
  animation: flightpathPulse 2.6s var(--ease-quiet) infinite;
}
.libra-flightpath [aria-current="step"],
.libra-flightpath [aria-current="page"] {
  color: var(--ink);
}

@keyframes flightpathPulse {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(126,174,204,0.10), 0 0 14px rgba(126,174,204,0.55);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(126,174,204,0.04), 0 0 22px rgba(126,174,204,0.85);
  }
}

/* Connector lines between adjacent steps */
.libra-flightpath li + li::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  width: 24px; height: 1px;
  background: linear-gradient(90deg, rgba(126,174,204,0.22), rgba(126,174,204,0.22));
  pointer-events: none;
}

@media (max-width: 640px) {
  .libra-flightpath { padding: var(--s-2) var(--s-3); overflow-x: auto; }
  .libra-flightpath::-webkit-scrollbar { display: none; }
  .libra-flightpath ol { width: max-content; }
  .libra-flightpath a, .libra-flightpath span.step { padding: 4px 14px; }
}

/* =============================================================
   BUTTONS (three variants per spec)
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  padding: 11px 22px;
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: var(--r-3);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .22s var(--ease-quiet), box-shadow .26s var(--ease-quiet),
              background .22s var(--ease-quiet), border-color .22s var(--ease-quiet),
              color .22s var(--ease-quiet);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  isolation: isolate;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.40; cursor: not-allowed; }

.btn--primary {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0) 50%),
    linear-gradient(135deg, var(--blue-dark), var(--blue));
  color: var(--void);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.10) inset,
    0 1px 2px rgba(0,0,0,0.35),
    0 8px 24px rgba(126,174,204,0.18);
}
.btn--primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.14) inset,
    0 1px 2px rgba(0,0,0,0.35),
    0 12px 32px rgba(126,174,204,0.22),
    0 0 0 1px var(--hairline-amber) inset;
}

.btn--secondary {
  background: rgba(13,27,48,0.55);
  backdrop-filter: blur(8px);
  color: var(--blue-bright);
  border-color: var(--hairline-hi);
  box-shadow: var(--elev-1);
}
.btn--secondary:not(:disabled):hover {
  border-color: var(--blue-bright);
  background: rgba(126,174,204,0.10);
  color: var(--ink);
  box-shadow: var(--elev-2);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-mid);
  border-color: var(--hairline);
  padding: 6px 12px;
  font-size: var(--t-2xs);
}
.btn--ghost:not(:disabled):hover {
  background: rgba(126,174,204,0.06);
  border-color: var(--hairline-hi);
  color: var(--ink);
}

.btn--block { width: 100%; }

/* =============================================================
   CARDS  (general purpose, glass + glow)
   ============================================================= */
.card {
  position: relative;
  background: rgba(13,27,48,0.62);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-4);
  padding: var(--s-5);
  box-shadow: var(--elev-2);
  transition: border-color .24s var(--ease-quiet), transform .24s var(--ease-quiet), box-shadow .28s var(--ease-quiet);
}
.card::before {
  /* Top inset highlight — gives a glass surface depth */
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 30%);
  mix-blend-mode: screen;
}
.card:hover {
  border-color: var(--hairline-hi);
  transform: translateY(-2px);
  box-shadow: var(--elev-3);
}
.card--elevated {
  background: rgba(17,26,44,0.88);
  border-color: var(--hairline-hi);
  box-shadow: var(--elev-3);
}
.card-title { font-family: var(--font-display); font-size: 1.2rem; margin: 0 0 var(--s-2); color: var(--ink); }
.card-desc { color: var(--ink-mid); font-size: 0.85rem; }

/* =============================================================
   PERIODIC-TABLE PRODUCT CARDS  (hexagonal element pattern)
   Used for the 5 products: IYN, CLII, HESC, CPN, VPP
   ============================================================= */
.element-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--s-4);
}
.element-card {
  position: relative;
  aspect-ratio: 1 / 1;
  background: rgba(13,27,48,0.78);
  border: 1.5px solid var(--blue-deep);
  padding: var(--s-4);
  display: flex; flex-direction: column; justify-content: space-between;
  transition: all .3s var(--ease-cinematic);
  border-radius: var(--r-2);
}
.element-card:hover {
  border-color: var(--blue);
  box-shadow: 0 0 24px rgba(56,189,248,0.28), inset 0 0 12px rgba(56,189,248,0.10);
  transform: translateY(-2px);
}
.element-symbol {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--blue);
}
.element-num {
  position: absolute; top: var(--s-3); right: var(--s-3);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--ink-faint);
}
.element-name {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--ink-mid);
  line-height: 1.35;
  margin-top: var(--s-2);
}
.element-stats {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--blue-bright);
  letter-spacing: 0.08em;
  margin-top: var(--s-2);
}
.element-card[data-tier="retail"]   { border-color: var(--blue-glow); }
.element-card[data-tier="retail"] .element-symbol { color: var(--blue-bright); }
.element-card[data-tier="commodity"]{ border-color: var(--blue-dark); }
.element-card[data-tier="commodity"] .element-symbol { color: var(--blue-glow); }

/* =============================================================
   STATS / KPI CARDS
   ============================================================= */
.stat-card {
  background: rgba(13,27,48,0.78);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  padding: var(--s-4);
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: var(--s-2);
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--blue);
}

/* =============================================================
   FORMS
   ============================================================= */
.form-group { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }
label, .form-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-light);
}
input, select, textarea {
  background: rgba(10,22,40,0.6);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  color: var(--ink);
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(56,189,248,0.18);
}

/* =============================================================
   TAGS / BADGES
   ============================================================= */
.tag, .badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  background: rgba(56,189,248,0.10);
  border: 1px solid rgba(56,189,248,0.22);
  color: var(--blue-bright);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: var(--r-2);
}
.badge--live::before    { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); box-shadow: var(--glow-blue); }
.badge--offline::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); }
.badge--error  { color: var(--red);  border-color: var(--red); background: rgba(239,68,68,0.10); }

/* =============================================================
   PASSCODE GATE — cinematic overlay
   ============================================================= */
.libra-gate {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background: var(--void);
  padding: var(--s-6);
}
.libra-gate::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(14,165,233,0.08) 0%, transparent 60%);
}
.libra-gate-card {
  position: relative;
  width: 100%; max-width: 420px;
  background: rgba(13,27,48,0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-4);
  padding: var(--s-8) var(--s-7);
  text-align: center;
}
.libra-gate-card h1 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 var(--s-2);
}
.libra-gate-card p { color: var(--ink-light); font-size: 0.8rem; margin: 0 0 var(--s-6); }
.libra-gate-error { color: var(--red); font-size: 0.7rem; font-family: var(--font-mono); min-height: 1.2em; margin-top: var(--s-2); }

/* =============================================================
   SYSTEM PANELS (status / AI offline / errors)
   ============================================================= */
.system-panel {
  background: rgba(13,27,48,0.6);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue-glow);
  border-radius: var(--r-3);
  padding: var(--s-4);
  display: flex; gap: var(--s-3);
}
.system-panel--info  { border-left-color: var(--blue-glow); }
.system-panel--error { border-left-color: var(--red); }
.system-panel--ok    { border-left-color: var(--blue); }
.system-panel-title  {
  font-family: var(--font-mono);
  font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink); margin: 0 0 4px;
}
.system-panel-body   { color: var(--ink-mid); font-size: 0.82rem; line-height: 1.5; }

/* =============================================================
   BREADCRUMB
   ============================================================= */
.libra-breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-light);
  padding: var(--s-3) var(--s-6);
  border-bottom: 1px solid var(--border);
  background: rgba(4,10,22,0.55);
}
.libra-breadcrumb a { color: var(--ink-light); }
.libra-breadcrumb a:hover { color: var(--blue-bright); }
.libra-breadcrumb [aria-current="page"] { color: var(--blue); }
.libra-breadcrumb .sep { margin: 0 var(--s-2); color: var(--ink-faint); }

/* =============================================================
   FOOTER
   ============================================================= */
.libra-footer {
  border-top: 1px solid var(--border);
  background: rgba(4,10,22,0.6);
  padding: var(--s-7) var(--s-6);
  text-align: center;
  margin-top: var(--s-9);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* =============================================================
   TOOLTIP
   ============================================================= */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--card); color: var(--ink);
  border: 1px solid var(--border-hi);
  padding: var(--s-2) var(--s-3);
  font-family: var(--font-sans);
  font-size: 0.72rem; line-height: 1.4;
  text-transform: none; letter-spacing: 0;
  border-radius: var(--r-3);
  width: max-content; max-width: 280px; white-space: normal;
  box-shadow: 0 8px 24px rgba(1,2,8,0.7);
  z-index: 100; pointer-events: none;
}

/* =============================================================
   TOAST
   ============================================================= */
.libra-toast {
  position: fixed; bottom: var(--s-6); right: var(--s-6); z-index: 200;
  background: rgba(13,27,48,0.95);
  border: 1px solid var(--blue);
  border-radius: var(--r-3);
  padding: var(--s-3) var(--s-5);
  color: var(--ink);
  font-family: var(--font-sans); font-size: 0.85rem;
  box-shadow: 0 12px 32px rgba(1,2,8,0.6), var(--glow-soft);
  opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s;
  max-width: 380px;
}
.libra-toast.show { opacity: 1; transform: translateY(0); }

/* =============================================================
   SCIENCE AESTHETIC — keyframes
   ============================================================= */
@keyframes electron-orbit {
  0%   { transform: rotate(0deg)   translateX(var(--orbit-r,40px)) rotate(0deg); }
  100% { transform: rotate(360deg) translateX(var(--orbit-r,40px)) rotate(-360deg); }
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(14,165,233,0.45), inset 0 0 4px rgba(125,211,252,0.5); }
  50%      { box-shadow: 0 0 20px rgba(14,165,233,0.75), inset 0 0 6px rgba(125,211,252,0.7); }
}
@keyframes hex-pulse {
  0%, 100% { stroke-opacity: 0.55; }
  50%      { stroke-opacity: 1; }
}
@keyframes twinkle  { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }
@keyframes shoot    { 0% { transform: translateY(-100vh) translateX(0); opacity: 1; }
                      100%{ transform: translateY(100vh) translateX(220px); opacity: 0; } }
@keyframes fade-in  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes descend  {
  0%   { opacity: 0; transform: scale(1.6) translateZ(0); filter: blur(6px); }
  60%  { opacity: 1; transform: scale(1.05); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); }
}

.fade-in   { animation: fade-in 0.5s var(--ease-cinematic) both; }
.descend   { animation: descend 1.4s var(--ease-cinematic) both; }
.glow-dot  { animation: glow-pulse 2s ease-in-out infinite; }

/* Loading: 3-electron orbital nucleus */
.electron-loader {
  position: relative; width: 120px; height: 120px;
  margin: 0 auto;
}
.electron-loader::before {
  content: ''; position: absolute; top: 50%; left: 50%; width: 6px; height: 6px;
  margin: -3px 0 0 -3px; border-radius: 50%; background: var(--blue);
  box-shadow: 0 0 8px var(--blue-glow);
}
.electron-loader .orbit {
  position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; margin: -4px;
  border-radius: 50%; background: var(--blue-glow);
  filter: drop-shadow(0 0 6px rgba(14,165,233,0.7));
}
.electron-loader .orbit:nth-child(1) { --orbit-r: 30px; animation: electron-orbit 3s linear infinite; }
.electron-loader .orbit:nth-child(2) { --orbit-r: 50px; animation: electron-orbit 5s linear infinite reverse; }
.electron-loader .orbit:nth-child(3) { --orbit-r: 70px; animation: electron-orbit 7s linear infinite; }

/* =============================================================
   UTILITIES
   ============================================================= */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.hidden  { display: none !important; }
.relative{ position: relative; }
.text-center { text-align: center; }

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 900px) {
  .container { padding: 0 var(--s-4); }
}
@media (max-width: 640px) {
  .libra-nav { flex-direction: column; align-items: flex-start; gap: var(--s-2); padding: var(--s-3) var(--s-4); }
  .libra-nav-links { width: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .libra-nav-links::-webkit-scrollbar { display: none; }
  .libra-flightpath { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding: var(--s-2) var(--s-4); }
  .libra-flightpath::-webkit-scrollbar { display: none; }
  .libra-breadcrumb { padding: var(--s-2) var(--s-4); }
  .libra-footer { padding: var(--s-5) var(--s-4); }
  .libra-toast { left: var(--s-4); right: var(--s-4); bottom: var(--s-4); max-width: none; }
  .card { padding: var(--s-4); }
  .element-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s-3); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* =============================================================
   PHASE / SAMPLE / ILLUSTRATIVE MARKERS — Wave 7 anti-fabrication
   Standardised vocabulary applied across pages. Three classes only.
   ============================================================= */
.phase2-marker {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  background: rgba(52,94,133,0.10);
  color: #1f3a55;
  border: 1px solid rgba(52,94,133,0.25);
  border-radius: 2px;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 0.4rem;
}
.phase2-marker::before { content: '['; }
.phase2-marker::after  { content: ']'; }

.phase2-banner {
  padding: 0.85rem 1.5rem;
  background: rgba(52,94,133,0.08);
  border-bottom: 1px solid rgba(52,94,133,0.25);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b4d20;
  text-align: center;
}
.phase2-banner b { color: #1f3a55; }

.illustrative-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  color: #1f3a55;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-left: 0.35rem;
  opacity: 0.85;
}
.illustrative-tag::before { content: '· '; opacity: 0.6; }

/* Mode pill — dark-mode variant for module pages (atlas/access/capital/etc.) */
.mode-pill-dark {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: rgba(126,174,204,0.06);
  border: 1px solid rgba(126,174,204,0.22);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.mode-pill-dark .mp-opt {
  padding: 0.32rem 0.78rem;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(168,176,192,0.72);
  border-radius: 999px;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.mode-pill-dark .mp-opt:hover { color: #ffffff; background: rgba(126,174,204,0.10); }
.mode-pill-dark .mp-opt.is-active { background: #1f3a55; color: #ffffff; box-shadow: 0 0 0 1px #345e85; font-weight: 600; }
@media (max-width: 720px) {
  .mode-pill-dark .mp-opt { padding: 0.28rem 0.55rem; font-size: 0.55rem; }
}

/* =============================================================
   GLOBAL MOBILE — 640px breakpoint (Wave 8.13)
   Applied to ALL pages via shared stylesheet.
   Page-specific overrides are inline in each HTML.
   ============================================================= */
@media (max-width: 640px) {
  /* Topbar — hide nav links, keep brand + mode pill */
  .lc-topbar { padding: 0.5rem 0.85rem; gap: 0.5rem; }
  .lc-tabs { display: none; }
  .lc-brand-text { font-size: 0.85rem; }
  .lc-mode-pill { font-size: 0.55rem; }
  .lc-mode-opt { padding: 0.28rem 0.6rem; font-size: 0.55rem; }
  .lc-clock { display: none; }

  /* Page heads */
  .page-head { padding: 1rem 0.85rem; }
  .page-title { font-size: clamp(1.4rem, 5vw, 2rem); }
  .page-sub { font-size: 0.82rem; }

  /* Tab rows — horizontal scroll */
  .lc-tabs-row, .tabs-row, .tab-row, .tab-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .lc-tabs-row::-webkit-scrollbar, .tabs-row::-webkit-scrollbar,
  .tab-row::-webkit-scrollbar, .tab-bar::-webkit-scrollbar { display: none; }

  /* Generic panel grids — single column */
  .panel-grid { grid-template-columns: 1fr !important; }
  .form-row { flex-direction: column; }
  .form-row .form-group { width: 100%; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .grid-3 { grid-template-columns: 1fr !important; }
  .grid-4 { grid-template-columns: 1fr !important; }

  /* Tables — horizontal scroll wrapper (applied by JS on load, CSS fallback) */
  table { font-size: 0.78rem; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Cards */
  .card { padding: 0.85rem; }

  /* Modals — full screen on mobile */
  .modal-card, .drawer {
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    border-radius: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    transform: none !important;
  }

  /* Buttons — min 44px touch target */
  .btn { min-height: 44px; padding: 0.65rem 1rem; }

  /* Segment chips */
  .segment-chips { flex-wrap: wrap; }
  .seg-chip { min-height: 36px; }

  /* Typography scale */
  h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); }
  h2 { font-size: clamp(1.2rem, 4vw, 1.8rem); }
  h3 { font-size: clamp(1rem, 3.5vw, 1.4rem); }
}

/* Phase tag — small pill in top-right of page-head, three tiers */
.phase-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.18rem 0.55rem;
  border-radius: 2px;
  font-weight: 600;
  vertical-align: middle;
}
.phase-tag.is-live  { background: rgba(21,128,61,0.10);  color: #15803d; border: 1px solid rgba(21,128,61,0.25); }
.phase-tag.is-soon  { background: rgba(52,94,133,0.10); color: #1f3a55; border: 1px solid rgba(52,94,133,0.25); }
.phase-tag.is-vision{ background: rgba(107,114,128,0.10); color: #6b7280; border: 1px solid rgba(107,114,128,0.25); }

/* =============================================================
   WCAG 2.1 AA — Wave 8.26 accessibility additions
   ============================================================= */

/* Skip-to-content link — hidden until focused */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 10000;
  padding: 0.75rem 1.25rem;
  background: #1f3a55;
  color: #ffffff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 4px 0;
  transition: top 0.1s ease;
}
.skip-link:focus {
  top: 0;
  outline: 2px solid #c89a5a;
  outline-offset: 2px;
}

/* Focus ring — override any inline outline:none on focused inputs
   while still showing the border-color visual cue */
.gate-input:focus,
.form-input:focus,
.bom-input:focus,
.bom-select:focus,
.field-input:focus,
.filter-input:focus,
.search-input:focus,
.coord-input:focus {
  box-shadow: 0 0 0 2px rgba(31,58,85,0.35);
}

/* ARIA live region — visually positioned, announced by screen readers */
[aria-live="polite"],
[aria-live="assertive"],
[role="status"],
[role="alert"] {
  /* do not visually hide — these may need to render content */
}

/* Tab role styling — ensure buttons styled as tabs get visible focus */
[role="tab"]:focus-visible {
  outline: 2px solid #1f3a55;
  outline-offset: 2px;
  border-radius: 3px;
}

/* sr-only-focusable — hidden but reachable by keyboard */
.sr-only-focusable:not(:focus):not(:focus-within) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* =============================================================
   WCAG 2.1 AA — Wave 8.27 a11y polish additions
   ============================================================= */

/* Mobile-scroll wrapper for data tables — prevents horizontal overflow
   at <640px without breaking desktop layout.
   Usage: <div class="scroll-x"><table>...</table></div>          */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* Thin scrollbar so overflow is visually discoverable */
  scrollbar-width: thin;
  scrollbar-color: rgba(126,174,204,0.28) transparent;
}
.scroll-x::-webkit-scrollbar { height: 4px; }
.scroll-x::-webkit-scrollbar-thumb { background: rgba(126,174,204,0.28); border-radius: 2px; }
@media (max-width: 640px) {
  .scroll-x { border-radius: 0 0 var(--r-2) var(--r-2); }
}

/* Table caption — sr-only variant hides visually but keeps semantic */
table caption.sr-only {
  /* inherits .sr-only rules from the utility class above */
  caption-side: top;
}

/* Sign-in prompt — auth-gated empty state CTA */
.sign-in-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  padding: var(--s-9) var(--s-6);
  text-align: center;
}
.sign-in-prompt-icon {
  font-size: 2rem;
  color: var(--ink-faint);
  line-height: 1;
}
.sign-in-prompt-title {
  font-family: var(--font-display);
  font-size: var(--t-xl);
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.sign-in-prompt-body {
  font-size: var(--t-sm);
  color: var(--ink-light);
  max-width: 400px;
  line-height: 1.6;
  margin: 0;
}
.sign-in-prompt-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 11px 24px;
  background: var(--blue-deep);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: var(--r-3);
  text-decoration: none;
  border: 1px solid var(--blue-dark);
  transition: background .2s, box-shadow .2s;
}
.sign-in-prompt-cta:hover {
  background: var(--blue-dark);
  box-shadow: 0 4px 16px rgba(31,58,85,0.25);
}
.sign-in-prompt-cta:focus-visible {
  outline: 2px solid var(--blue-glow);
  outline-offset: 3px;
}

/* Light-theme variant for pages with white backgrounds */
.sign-in-prompt.is-light .sign-in-prompt-title { color: #0c1422; }
.sign-in-prompt.is-light .sign-in-prompt-body  { color: #4b5563; }



/* Wave 8.43 — Module sub-features strip */
.module-subfeatures { display:flex; align-items:center; gap:0.7rem; padding:0.5rem 1.25rem; background:#fafbfc; border-bottom:1px solid #e5e7eb; flex-wrap:wrap; }
.subfeature-label { font-family:'JetBrains Mono',monospace; font-size:0.58rem; letter-spacing:0.18em; text-transform:uppercase; color:#6b7280; }
.subfeature-link { font-family:'JetBrains Mono',monospace; font-size:0.6rem; letter-spacing:0.16em; text-transform:uppercase; color:#1f3a55; padding:0.3rem 0.7rem; border:1px solid #d1d5db; border-radius:3px; text-decoration:none; transition:all .15s; }
.subfeature-link:hover { border-color:#1f3a55; background:rgba(31,58,85,0.04); }

/* Wave 8.45-D · progressive disclosure pattern */
.expert-toggle {
  display:inline-block; margin-top:.4rem; padding:.25rem .55rem;
  font-family:'JetBrains Mono',monospace; font-size:.55rem; letter-spacing:.16em;
  text-transform:uppercase; color:#1f3a55; background:transparent;
  border:1px solid #d1d5db; border-radius:3px; cursor:pointer; transition:all .15s;
}
.expert-toggle:hover { border-color:#1f3a55; background:rgba(31,58,85,0.04); }
body.persona-simple .expert-only { display:none; }
body.persona-advanced .expert-only { display:initial; }
/* persona-advanced-only: hide in simple, show in advanced (mirrors pattern in per-page <style> blocks) */
body.persona-simple .persona-advanced-only { display:none !important; }
body.persona-advanced .persona-simple-only { display:none !important; }

/* Wave 8.56 · AR pill greyed out — Arabic interface coming soon */
.lang-opt[data-lang="ar"]:disabled,
.lang-opt[data-lang="ar"][disabled],
.atlas-lang-opt[data-lang="ar"]:disabled,
.atlas-lang-opt[data-lang="ar"][disabled] { opacity:0.35; cursor:not-allowed; pointer-events:none; filter:grayscale(1); }

/* =============================================================
   Wave 8.46-AR · PROFESSIONAL ARABIC INTERFACE
   First-class Arabic UI · MSA register · institutional typography
   IBM Plex Sans Arabic + Tajawal + Reem Kufi + JetBrains Mono
   Font files loaded via <link> in HEAD of every primary page.
   Scoped exclusively to html[dir="rtl"] — zero impact on EN flow.
   ============================================================= */
html[dir="rtl"] {
  --font-display: 'IBM Plex Sans Arabic', 'Tajawal', 'Noto Sans Arabic', system-ui, sans-serif;
  --font-sans:    'IBM Plex Sans Arabic', 'Tajawal', 'Noto Sans Arabic', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'IBM Plex Sans Arabic', ui-monospace, monospace;
  --font-accent:  'Reem Kufi', 'IBM Plex Sans Arabic', sans-serif;
}

/* Body rhythm — Arabic needs higher line-height (descenders, vowel marks, dots)
   and no letter-spacing on body copy. Latin convention does NOT translate. */
html[dir="rtl"] body {
  font-family: var(--font-sans);
  line-height: 1.75;
  letter-spacing: 0;
  text-align: right;
}

/* Headings — display stack across all headline levels.
   Letter-spacing zeroed (Arabic typefaces are designed with built-in spacing). */
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] .hero-title,
html[dir="rtl"] .section-h1,
html[dir="rtl"] .step-title,
html[dir="rtl"] .card-title,
html[dir="rtl"] .sign-in-prompt-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.4;
}

/* Eyebrows / mono accents — Reem Kufi gives the institutional press tone.
   Letter-spacing is much tighter than Latin (0.06em vs 0.18em). */
html[dir="rtl"] .eyebrow,
html[dir="rtl"] .data-label,
html[dir="rtl"] .lc-tab,
html[dir="rtl"] .lc-mode-eyebrow,
html[dir="rtl"] .step-num,
html[dir="rtl"] .filter-label,
html[dir="rtl"] .subfeature-label,
html[dir="rtl"] .subfeature-link,
html[dir="rtl"] .libra-mode-pill,
html[dir="rtl"] .libra-persona-pill,
html[dir="rtl"] .hero-eyebrow,
html[dir="rtl"] .s1-eyebrow {
  font-family: var(--font-accent);
  letter-spacing: 0.06em;
}

/* Numeric monospace stays JetBrains Mono — accepted convention for
   tabular alignment of Western numerals inside RTL paragraphs. */
html[dir="rtl"] .mono,
html[dir="rtl"] code,
html[dir="rtl"] kbd,
html[dir="rtl"] pre,
html[dir="rtl"] samp,
html[dir="rtl"] .yield-card .v,
html[dir="rtl"] .summary-row .v,
html[dir="rtl"] .equipment-table .ctx,
html[dir="rtl"] .kpi-val,
html[dir="rtl"] .stat-value,
html[dir="rtl"] .data-value {
  font-family: var(--font-mono);
}

/* Number direction — keep digits LTR inside RTL paragraphs.
   Apply utility class .num-ltr to any element holding Western numerals
   inside narrative copy (e.g. "27°" or "$5,000"). */
html[dir="rtl"] .num-ltr { unicode-bidi: embed; direction: ltr; display: inline-block; }

/* Optional Arabic-Indic numerals for narrative copy where the brand
   prefers ١٢٣ over 123. Tables/KPIs keep Latin for alignment. */
html[dir="rtl"] .num-ar    { font-feature-settings: "anum" 1; }
html[dir="rtl"] .num-latin { font-feature-settings: "anum" 0; }

/* Flexbox row-reverse on horizontal strips — audit pass on all known
   row-laid widgets. Wave 8.35 covered some; this completes coverage. */
html[dir="rtl"] .lc-tabs,
html[dir="rtl"] .lc-topbar,
html[dir="rtl"] .lc-tabs-row,
html[dir="rtl"] .tabs-row,
html[dir="rtl"] .tab-row,
html[dir="rtl"] .tab-bar,
html[dir="rtl"] .progress-strip,
html[dir="rtl"] .filter-row,
html[dir="rtl"] .cta-row,
html[dir="rtl"] .arch-pills,
html[dir="rtl"] .module-subfeatures,
html[dir="rtl"] .step-chip,
html[dir="rtl"] .step-chips,
html[dir="rtl"] .summary-row,
html[dir="rtl"] .handoff-row,
html[dir="rtl"] .handoff-cards {
  flex-direction: row-reverse;
}

/* Padding/margin swap helpers — list-style on RTL needs padding-right */
html[dir="rtl"] ul,
html[dir="rtl"] ol { padding-right: 1.4em; padding-left: 0; }
html[dir="rtl"] .nav-back::before { content: ""; }
html[dir="rtl"] .step-num { margin-left: 0.7rem; margin-right: 0; }

/* Tables — right-align headers + cells; numeric columns get .num-ltr */
html[dir="rtl"] .equipment-table th,
html[dir="rtl"] .equipment-table td,
html[dir="rtl"] .boq-table th,
html[dir="rtl"] .boq-table td,
html[dir="rtl"] table th,
html[dir="rtl"] table td { text-align: right; }
html[dir="rtl"] .summary-row .v { text-align: left; direction: ltr; }

/* Quote marks — Arabic convention uses « » (guillemets) not "curly".
   Browsers honour this automatically when lang="ar"; verify on q/blockquote. */
html[dir="rtl"] q { quotes: "«" "»" "‹" "›"; }

/* AR welcome banner — Wave 8.46-AR · one-time strip at top of viewport.
   Auto-dismiss after 5s · localStorage flag libra_ar_welcome_seen. */
.libra-ar-welcome {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 8500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 20px;
  background: rgba(13, 27, 48, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 0.5px solid rgba(126, 174, 204, 0.32);
  color: #ece8df;
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
  font-size: 0.82rem;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  animation: libraArSlide 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
  direction: rtl;
}
@keyframes libraArSlide {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.libra-ar-welcome.is-leaving { animation: libraArSlideOut 0.45s cubic-bezier(0.22, 0.61, 0.36, 1) forwards; }
@keyframes libraArSlideOut {
  from { transform: translateY(0);    opacity: 1; }
  to   { transform: translateY(-100%); opacity: 0; }
}
.libra-ar-welcome-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #7eaecc;
  box-shadow: 0 0 10px rgba(126, 174, 204, 0.6);
  flex: 0 0 auto;
}
.libra-ar-welcome-close {
  background: none; border: none; color: #8892a6;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; letter-spacing: 0.06em;
  cursor: pointer; padding: 4px 8px;
  transition: color 0.2s;
}
.libra-ar-welcome-close:hover { color: #d9e4ee; }
@media (max-width: 600px) {
  .libra-ar-welcome { font-size: 0.74rem; padding: 8px 14px; gap: 8px; }
}

/* ═══════════════════════════════════════════════════════════════════
   W8.72-G1 · Typography lightening + Bilingual icon · 10 Jun 2026
   Increased-specificity overrides (html body prefix) so they beat
   same-class rules in per-page <style> blocks without !important.
   DARK-THEME SAFETY: weight reductions only — colors untouched on
   dark pages (memo / materials-* use #ece8df on #02040a, already AA).
   RTL: all rules inherit naturally; nothing fights html[dir="rtl"].
   ═══════════════════════════════════════════════════════════════════ */

/* ── Display headings ── Cormorant Garamond: 700→600 (stays elegant at 600)
   h1/hero-title kept 600 (same target, no regression).
   h2 + section-level headings get a very slight color softening:
   #1a2638 on #ffffff = 13.0:1 (WCAG AAA) — well above 4.5:1 threshold. */
html body h1,
html body .hero-title,
html body .page-title {
  font-weight: 600;
}
html body h2,
html body .section-title,
html body .panel-title,
html body .mc-name {
  font-weight: 600;
  color: #1a2638;
}
html body h3,
html body h4 {
  font-weight: 600;
}

/* ── Mono eyebrows / labels: 600→500 ── */
html body .hero-eyebrow,
html body .page-eyebrow,
html body .lc-tab,
html body .kpi-lbl,
html body .eyebrow,
html body .data-label,
html body .lc-mode-eyebrow,
html body .section-eyebrow,
html body .lc-arch-label,
html body .map-eyebrow,
html body .build-map-eyebrow,
html body .hero-easy {
  font-weight: 500;
}

/* Letter-spacing: heaviest eyebrow tracking 0.32em → 0.26em (lighter feel) */
html body .hero-eyebrow,
html body .hero-easy {
  letter-spacing: 0.26em;
}

/* ── body strong / b: keep 600 — readability protected ── */
html body strong,
html body b {
  font-weight: 600;
}

/* ── KPI values: 700→600 (still clearly bold, more refined) ── */
html body .kpi-val,
html body .kpi-strip b,
html body .stat-value {
  font-weight: 600;
}

/* ── Buttons / CTAs: 600→500 (mono weight; still distinct from body) ── */
html body .btn,
html body button.btn {
  font-weight: 500;
}

/* ── Dark-theme pages (memo, materials-*):
   Weight reductions apply via inheritance above.
   Color overrides on h2/section-title must NOT apply inside dark contexts —
   #1a2638 would be near-invisible on #02040a or #111a2c backgrounds.
   Reset color to inherit so the page's own color declarations win. ── */
html body[style*="background:#02040a"] h2,
html body[style*="background:#02040a"] .section-title,
html body[style*="background:#02040a"] .panel-title,
html body[style*="background:#02040a"] .mc-name,
html body[style*="background-color:#02040a"] h2,
html body[style*="background-color:#02040a"] .section-title {
  color: inherit;
}

/* ═══════════════════════════════════════════════════════════════════
   W8.72-G1 · Bilingual translation icon on .lang-toggle
   Globe motif: circle + 3 latitude arcs + 1 vertical meridian.
   SVG: 16×16 viewBox, stroke #1f3a55, 1.5px, fill none.
   Placed via ::before pseudo-element — CSS only, zero JS, zero HTML edits.
   ═══════════════════════════════════════════════════════════════════ */

/* Light-theme variant (default — navy stroke on white/light background) */
.lang-toggle::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin: auto 0.45rem auto 0.55rem;
  vertical-align: middle;
  flex-shrink: 0;
  opacity: 0.72;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Ccircle cx='8' cy='8' r='6' stroke='%231f3a55' stroke-width='1.5'/%3E%3Cellipse cx='8' cy='8' rx='3' ry='6' stroke='%231f3a55' stroke-width='1.5'/%3E%3Cpath d='M2 8h12' stroke='%231f3a55' stroke-width='1.5'/%3E%3Cpath d='M3 5h10M3 11h10' stroke='%231f3a55' stroke-width='1' stroke-opacity='0.55'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Ensure flex alignment works (lang-toggle is already display:inline-flex in per-page styles;
   this makes the global CSS definition also carry align-items) */
.lang-toggle {
  align-items: center;
}

/* Dark-theme variant — steel-blue stroke (#7eaecc) on dark nav backgrounds.
   Triggered when .mode-pill-dark is a preceding sibling in the same nav
   (capital.html and access.html both follow this DOM pattern). */
.mode-pill-dark ~ .lang-toggle::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Ccircle cx='8' cy='8' r='6' stroke='%237eaecc' stroke-width='1.5'/%3E%3Cellipse cx='8' cy='8' rx='3' ry='6' stroke='%237eaecc' stroke-width='1.5'/%3E%3Cpath d='M2 8h12' stroke='%237eaecc' stroke-width='1.5'/%3E%3Cpath d='M3 5h10M3 11h10' stroke='%237eaecc' stroke-width='1' stroke-opacity='0.55'/%3E%3C/svg%3E");
  opacity: 0.68;
}

/* RTL: swap margins so icon stays visually at the start of the pill */
html[dir="rtl"] .lang-toggle::before {
  margin: auto 0.55rem auto 0.45rem;
}
/* ═══ end W8.72-G1 ═══ */
