/* UAX V15 institutional tokens — "Technical High-Contrast Minimalist & Secure Defense"
   See DESIGN.md (binding). System fonts only (zero webfont download; font-src 'self').
   Flagship = Titanium/Midnight on the bare :root (also the no-JS / crawler view).
   data-theme="dark" mirrors :root; data-theme="light" is the stark clinical-white alternate. */

/* ============================================================================
   FLAGSHIP DARK — Titanium / Midnight  (bare :root + [data-theme="dark"])
   ============================================================================ */
:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0E14;               /* obsidian */
  --bg-elevated: #10151E;
  --bg-panel: #151A22;         /* titanium panel */
  --bg-header: rgba(11, 14, 20, 0.92);
  --text: #F3F4F6;             /* crisp off-white */
  --text-muted: #9CA3AF;       /* muted silver — secondary + disclaimers */
  --text-soft: #C7CDD6;
  /* Structural steel-blue accent: links, eyebrows, rules, diagram strokes, focus. AA on --bg. */
  --accent: #6FA4C6;
  --accent-strong: #9BC2DD;
  --accent-ink: #0B0E14;
  --focus: #7EB0D0;
  /* Tactical aerospace amber — the ONE action signal (primary CTA / verification gateway only) */
  --signal: #E8A33D;
  --signal-strong: #F3B455;
  --signal-ink: #0B0E14;
  --line: rgba(255, 255, 255, 0.10);   /* 1px compartment border */
  --line-soft: rgba(255, 255, 255, 0.06);
  --navy: #101722;
  --graphite: #1E2732;
  --muted-red: #9a5a5a;
  --status-negative: #c98f8f;           /* contrast-safe negative for "not held/claimed" */
  /* Depth = borders, not blur. Shadow reserved for floating overlays (dropdowns) only. */
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  --map-stroke: rgba(180, 200, 220, 0.32);
  --map-fill: rgba(111, 164, 198, 0.12);
  --map-active: #6FA4C6;
  --map-core: #4A7A9C;
  /* Institutional data-table surfaces (secure-console graphite) */
  --inst-border: #2A3442;
  --inst-label-bg: #0E141D;
  --inst-value-bg: #10151E;
  --inst-navy: #0F172A;
  --inst-navy-hover: #1E293B;
  --inst-navy-active: #020617;
  --inst-on-navy: #F3F4F6;
  --inst-focus-ring: #7EB0D0;
}

/* ============================================================================
   ALTERNATE — stark clinical white (high contrast, no warmth)  [data-theme="light"]
   ============================================================================ */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #FBFCFD;
  --bg-elevated: #FFFFFF;
  --bg-panel: #FFFFFF;
  --bg-header: rgba(251, 252, 253, 0.94);
  --text: #0B0E14;
  --text-muted: #4A5564;
  --text-soft: #1F2833;
  --accent: #1A3A5C;
  --accent-strong: #0F2740;
  --accent-ink: #FFFFFF;
  --focus: #2A5080;
  --signal: #C77F17;           /* burnt aerospace amber; dark ink for AA on the mustard fill */
  --signal-strong: #A9660E;
  --signal-ink: #0B0E14;
  --line: rgba(11, 14, 20, 0.16);
  --line-soft: rgba(11, 14, 20, 0.08);
  --navy: #1a3a5c;
  --graphite: #4a5564;
  --muted-red: #8b3a3a;
  --status-negative: #8b3a3a;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
  --map-stroke: rgba(26, 58, 92, 0.28);
  --map-fill: rgba(26, 58, 92, 0.06);
  --map-active: #1a3a5c;
  --map-core: #1a3a5c;
  --inst-border: #d7dee7;
  --inst-label-bg: #F4F6F8;
  --inst-value-bg: #FFFFFF;
  --inst-on-navy: #F8FAFC;
  --inst-focus-ring: #64748B;
}

/* Locale accent nudges (kept from V14, retuned to the steel-blue structural role) */
html[data-locale="ja"]:not([data-theme="light"]) {
  --accent: #7FB0D2;
  --accent-strong: #9BC2DD;
  --focus: #8FB8D6;
  --map-active: #7FB0D2;
  --map-core: #4A7A9C;
}
html[data-locale="ja"][data-theme="light"] {
  --accent: #2c4a6e;
  --focus: #3d5a80;
  --map-active: #2c4a6e;
  --map-core: #2c4a6e;
}

/* ============================================================================
   TYPOGRAPHY, SPACING, GEOMETRY  (theme-independent)
   ============================================================================ */
:root {
  /* Japanese institutional stack — SYSTEM FONTS ONLY. */
  --font-jp: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic Medium", "Yu Gothic", "YuGothic", "Meiryo", "MS PGothic", "Noto Sans CJK JP", "Noto Sans JP", system-ui, sans-serif;
  /* Primary geometric sans — Inter/Roboto if locally installed, else robust system stack. */
  --font-body: "Inter", "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, var(--font-jp);
  --font-display: "Inter", "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, var(--font-jp);
  /* Technical monospace — secure-terminal voice for data, portfolio names, disclaimers. */
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", monospace;

  /* 8px mathematical rhythm. sp-1(4)/sp-3(12) are micro only; majors are 8·16·24·32·48·64·128. */
  --sp-1: 0.25rem;   /*  4px */
  --sp-2: 0.5rem;    /*  8px */
  --sp-3: 0.75rem;   /* 12px */
  --sp-4: 1rem;      /* 16px */
  --sp-5: 1.5rem;    /* 24px */
  --sp-6: 2rem;      /* 32px */
  --sp-7: 3rem;      /* 48px */
  --sp-8: 4rem;      /* 64px */
  --sp-9: 8rem;      /* 128px */

  --container: 1080px;
  --container-wide: 1200px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --measure: 68ch;             /* reading measure for legally dense prose (65–70ch mandate) */

  /* Sharp geometry: 0–2px only. Pills are retired. */
  --radius: 2px;
  --radius-lg: 2px;
  --radius-pill: 2px;
  --radius-institutional: 0px;

  --header-h: 68px;
  --z-header: 100;
  --z-overlay: 200;
  --z-gateway: 99990;

  /* Mechanical, fast motion. */
  --ease: ease-in-out;
  --dur: 0.15s;

  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html[data-locale="ja"] {
  --font-body: var(--font-jp);
  --font-display: var(--font-jp);
  font-feature-settings: "palt" 1;
  line-height: 1.75;
}
:lang(ja) { font-feature-settings: "palt" 1; }
