/* NovaBlock Systems design tokens.
   Direction: "Editorial Engineering" (docs/09-creative-direction.md).
   Light paper pages, dark instrument plates for engineering artefacts, one accent (vermilion),
   and a lifted charcoal dark mode. Status is shown with outlines and words, not extra hues. */

:root {
  /* Type families */
  --font-display: "Inter Tight", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Sans Arabic", ui-monospace, "Cascadia Mono", Consolas, monospace; /* Arabic glyphs fall through to Plex Arabic */
  --font-arabic: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;

  /* Type scale (fluid) */
  --fs-mega: clamp(2.6rem, 1.4rem + 5.2vw, 6.2rem);
  --fs-h1: clamp(2.2rem, 1.4rem + 3.4vw, 4.4rem);
  --fs-h2: clamp(1.75rem, 1.2rem + 2.1vw, 3rem);
  --fs-h3: clamp(1.2rem, 1rem + 0.7vw, 1.55rem);
  --fs-h4: 1.075rem;
  --fs-lead: clamp(1.08rem, 1rem + 0.35vw, 1.3rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-micro: 0.75rem;
  --fs-reading: 1.0625rem;
  --fs-register: 0.9375rem;

  --lh-tight: 1.04;
  --lh-snug: 1.2;
  --lh-body: 1.62;

  /* Space (8pt base) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 128px;
  --section-y: clamp(44px, 3vw + 22px, 76px); /* tightened again 1 Nov 2026: about 25% less space between sections */
  --gutter: clamp(20px, 4vw, 56px);
  --maxw: 1320px;
  --measure: 66ch;

  --radius-s: 3px;
  --radius: 4px;
  --radius-l: 6px;

  --ease: cubic-bezier(.2, .7, .1, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-1: 160ms; --dur-2: 280ms; --dur-3: 520ms; --dur-4: 900ms;

  --header-h: 72px;
  --sticky-top: var(--header-h); /* top offset for everything pinned under the fixed header */
  --z-header: 50; --z-menu: 60; --z-assistant: 80; --z-modal: 90; --z-toast: 100;
}

/* ---------- Light: paper (alternative; dark is the default since 31 Oct 2026) ---------- */
html[data-theme="light"] { /* html prefix: must outrank the :root default below */
  color-scheme: light;
  --bg: #FAF9F6;
  --bg-2: #EFE9DF;
  --surface: #FFFFFF;
  --surface-2: #F5F0E8;
  --surface-3: #E9DFD1;
  --hero-surface: #F0E8DC;
  --line: #E0D9CD;
  --line-2: #C8BEAF;
  --line-3: #A9A59B;
  --line-ctl: #7F7C74;        /* edges of inputs and controls: 3:1 or better on every light surface */
  --text: #252A30;
  --text-2: #484D52;
  --text-3: #5E6065;
  --accent: #A63716;
  --accent-2: #93300A;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(172, 61, 24, 0.08);
  --accent-glow: transparent;
  --signal: #45464A;          /* status (simulated, pending): neutral + dashed outline */
  --signal-soft: rgba(18, 18, 18, 0.05);
  --data: #45464A;            /* secondary diagram marks: neutral, not a second hue */
  --data-soft: rgba(18, 18, 18, 0.05);
  --ok: #17703F;
  --danger: #A1162B;          /* crimson: distinct from the vermilion accent */
  --grid-line: transparent;
  --shadow: 0 1px 2px rgba(20, 18, 10, .05), 0 16px 36px -28px rgba(20, 18, 10, .35);
  --overlay: rgba(250, 249, 246, 0.92);
}

/* ---------- Dark: charcoal (default) ---------- */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #1A1E23;
  --bg-2: #22272E;
  --surface: #292F37;
  --surface-2: #30373F;
  --surface-3: #39414A;
  --hero-surface: #252C34;
  --line: #353D46;
  --line-2: #48525D;
  --line-3: #63707D;
  --line-ctl: #929DA8;
  --text: #ECEAE5;
  --text-2: #CDD1D6;
  --text-3: #ADB5BF;
  --accent: #FF966F;
  --accent-2: #FFAD8E;
  --accent-ink: #1A0A03;
  --accent-soft: rgba(255, 150, 111, 0.10);
  --accent-glow: transparent;
  --signal: #B5BCC4;
  --signal-soft: rgba(236, 237, 238, 0.06);
  --data: #B5BCC4;
  --data-soft: rgba(236, 237, 238, 0.06);
  --ok: #6FCF97;
  --danger: #FF6B8A;          /* rose: distinct from the orange accent */
  --grid-line: transparent;
  --shadow: 0 20px 50px -24px rgba(0, 0, 0, .7);
  --overlay: rgba(20, 24, 29, 0.88);
}

/* ---------- Instrument plates ----------
   Engineering artefacts (tracer, architecture, data flow, calculators) are bound into the page like drawings in
   a report. In dark mode the plate sits one step above the page and is outlined. In light mode it is a drawing
   sheet: warm white paper, graphite lines, a faint grid and the accent for the one highlighted path. */
.instrument {
  color-scheme: dark;
  --bg: #252B32;
  --bg-2: #2B323A;
  --surface: #30373F;
  --surface-2: #39414B;
  --surface-3: #434D58;
  --line: #414B56;
  --line-2: #53606D;
  --line-3: #6E7D8D;
  --line-ctl: #A0ABB6;
  --text: #ECEDEE;
  --text-2: #CDD3D9;
  --text-3: #BAC3CC;
  --accent: #FFAB89;
  --accent-2: #FFBC9F;
  --accent-ink: #1A0A03;
  --accent-soft: rgba(255, 171, 137, 0.12);
  --signal: #C1CAD2;
  --signal-soft: rgba(236, 237, 238, 0.06);
  --data: #C1CAD2;
  --data-soft: rgba(236, 237, 238, 0.06);
  --grid-line: rgba(236, 237, 238, 0.035);
  background-color: var(--bg);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--line-2);
}
html[data-theme="light"] .instrument {
  color-scheme: light;
  --bg: #FBFAF7;
  --bg-2: #F4F2EC;
  --surface: #FFFFFF;
  --surface-2: #F7F6F2;
  --surface-3: #ECEAE3;
  --line: #E2DFD7;
  --line-2: #CFCBC1;
  --line-3: #A9A59B;
  --line-ctl: #7F7C74;
  --text: #121212;
  --text-2: #45464A;
  --text-3: #5F6064;
  --accent: #A63716;
  --accent-2: #93300A;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(172, 61, 24, 0.08);
  --signal: #45464A;
  --signal-soft: rgba(18, 18, 18, 0.05);
  --data: #45464A;
  --data-soft: rgba(18, 18, 18, 0.05);
  --grid-line: rgba(18, 18, 18, 0.05);
  box-shadow: 0 0 0 1px #CFCBC1, 0 1px 2px rgba(20, 18, 10, .04);
}

/* ---------- Cool palette (comparison variant, 1 Nov 2026) ----------
   Same structure, contrast targets and accent; only the neutrals change temperature, to a low-chroma blue-grey
   (hue about 215, 2 to 6 percent saturation). Switched with html[data-palette="cool"]. Not yet a brand decision. */
html[data-palette="cool"] {
  --bg: #19212A;
  --bg-2: #202A35;
  --surface: #27333F;
  --surface-2: #303D4A;
  --surface-3: #354352;
  --hero-surface: #24313E;
  --line: #384757;
  --line-2: #4B5D70;
  --line-3: #6D7E90;
  --line-ctl: #A2AEBD;
  --text: #E8ECF0;
  --text-2: #CAD3DD;
  --text-3: #B7C2CF;
  --signal: #B7C2CF;
  --signal-soft: rgba(232, 236, 240, 0.06);
  --data: #B7C2CF;
  --data-soft: rgba(232, 236, 240, 0.06);
  --shadow: 0 20px 50px -24px rgba(0, 4, 12, .75);
  --overlay: rgba(6, 8, 12, 0.78);
}
html[data-palette="cool"][data-theme="light"] {
  --bg: #F7F9FC;
  --bg-2: #E9EFF6;
  --hero-surface: #E7EDF5;
  --surface: #FFFFFF;
  --surface-2: #F8F9FB;
  --surface-3: #DDE3E9;
  --line: #DCE1E7;
  --line-2: #C6CDD5;
  --line-3: #9AA3AE;
  --line-ctl: #737C87;
  --text: #0F1419;
  --text-2: #3D4650;
  --text-3: #56606B;
  --signal: #3D4650;
  --signal-soft: rgba(15, 20, 25, 0.05);
  --data: #3D4650;
  --data-soft: rgba(15, 20, 25, 0.05);
  --shadow: 0 1px 2px rgba(10, 20, 35, .05), 0 16px 36px -28px rgba(10, 20, 35, .35);
  --overlay: rgba(243, 245, 247, 0.86);
}
html[data-palette="cool"] .instrument {
  --bg: #25313E;
  --bg-2: #2B3948;
  --surface: #303E4D;
  --surface-2: #394A5A;
  --surface-3: #3D4E60;
  --line: #46596D;
  --line-2: #5A6D82;
  --line-3: #7B8DA0;
  --line-ctl: #B2BECD;
  --text: #E8ECF0;
  --text-2: #D5DEE8;
  --text-3: #C2CEDC;
  --signal: #C2CEDC;
  --data: #C2CEDC;
  --grid-line: rgba(232, 236, 240, 0.035);
  box-shadow: 0 0 0 1px var(--line-2);
}
html[data-palette="cool"][data-theme="light"] .instrument {
  --bg: #F9FAFC;
  --bg-2: #F1F4F7;
  --surface: #FFFFFF;
  --surface-2: #F6F8FA;
  --surface-3: #E6EBF0;
  --line: #DCE1E7;
  --line-2: #C6CDD5;
  --line-3: #9AA3AE;
  --line-ctl: #737C87;
  --text: #0F1419;
  --text-2: #3D4650;
  --text-3: #56606B;
  --signal: #3D4650;
  --signal-soft: rgba(15, 20, 25, 0.05);
  --data: #3D4650;
  --data-soft: rgba(15, 20, 25, 0.05);
  --grid-line: rgba(15, 30, 50, 0.05);
  box-shadow: 0 0 0 1px #C6CDD5, 0 1px 2px rgba(10, 20, 35, .04);
}

/* Comparison switch (design review only, not part of the site) */
.palette-switch {
  position: fixed; inset-block-end: 16px; inset-inline-start: 16px; z-index: var(--z-assistant);
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px dashed var(--line-ctl); box-shadow: var(--shadow);
  font-size: var(--fs-micro); color: var(--text-2);
}
.palette-switch__seg { display: flex; border: 1px solid var(--line-ctl); border-radius: 999px; overflow: hidden; }
.palette-switch button { background: none; border: 0; padding: 4px 10px; font: inherit; color: var(--text-2); cursor: pointer; }
.palette-switch button[aria-pressed="true"] { background: var(--text); color: var(--bg); font-weight: 600; }
.palette-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 760px) { .palette-switch { inset-block-end: 12px; inset-inline-start: 12px; } .palette-switch__l { display: none; } }
@media print { .palette-switch { display: none; } }

/* Laptop screens: a slightly shorter fixed header leaves more room for content */
@media (max-height: 820px) and (min-width: 1101px) { :root { --header-h: 60px; --fs-h2: 2.125rem; } }
