/* secnull — shared base styles */

/* Self-hosted OFL fonts. Drop the .woff2 files under /static/fonts/ via
   `make fetch-fonts`. If the files are missing the UA falls back to the
   system face listed in each var() below — the layout still works. */
@font-face { font-family: 'Instrument Sans'; font-weight: 400 700; font-style: normal;
  font-display: swap; src: url('/static/fonts/InstrumentSans-VF.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-weight: 400 700; font-style: italic;
  font-display: swap; src: url('/static/fonts/InstrumentSans-Italic-VF.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Serif'; font-weight: 400; font-style: normal;
  font-display: swap; src: url('/static/fonts/InstrumentSerif-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Serif'; font-weight: 400; font-style: italic;
  font-display: swap; src: url('/static/fonts/InstrumentSerif-Italic.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400 700; font-style: normal;
  font-display: swap; src: url('/static/fonts/JetBrainsMono-VF.woff2') format('woff2'); }

:root {
  --unit: 8px;
  --gutter: 24px;
  --max: 1440px;
  --rule: 1px;

  --sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
  --serif: 'Instrument Serif', ui-serif, Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --accent: oklch(0.62 0.18 250);
  --accent-ink: oklch(0.45 0.20 255);
  --accent-pale: oklch(0.92 0.04 250);
  --grade-a: oklch(0.72 0.16 155);
  --grade-b: oklch(0.75 0.15 95);
  --grade-c: oklch(0.78 0.14 70);
  --grade-d: oklch(0.70 0.17 40);
  --grade-f: oklch(0.60 0.22 25);
}

html[data-theme='paper'] {
  --bg: #f6f5f1; --bg-2: #eceae3; --bg-3: #e0ddd3;
  --fg: #0a0a0c; --fg-2: #3d3d42; --fg-3: #76767c;
  --line: #d6d3c7; --line-strong: #0a0a0c; --chip: #eceae3;
  --inverse-bg: #0a0a0c; --inverse-fg: #f6f5f1;
  color-scheme: light;
}
html[data-theme='ink'] {
  --bg: #0a0a0f; --bg-2: #14141c; --bg-3: #1c1c26;
  --fg: #f1f1ee; --fg-2: #a9a9b0; --fg-3: #6e6e76;
  --line: #24242e; --line-strong: #f1f1ee; --chip: #14141c;
  --inverse-bg: #f1f1ee; --inverse-fg: #0a0a0f;
  color-scheme: dark;
}
html[data-theme='cobalt'] {
  --bg: #050a1f; --bg-2: #0a1434; --bg-3: #0f1d4a;
  --fg: #eef2ff; --fg-2: #9fb3e4; --fg-3: #5c71a5;
  --line: #152451; --line-strong: #eef2ff; --chip: #0a1434;
  --accent: oklch(0.78 0.14 230);
  --inverse-bg: #eef2ff; --inverse-fg: #050a1f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
  font-optical-sizing: auto;
  min-height: 100vh;
}

/* Reduced-motion users opt out of the terminal collapse + nav morph. */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

hr { border: 0; border-top: var(--rule) solid var(--line); margin: 0; }

/* a11y helper — visually hidden but read by screen readers */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.shell { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* === HEADER === */
.hdr { position: sticky; top: 0; z-index: 100; background: var(--bg);
  border-bottom: var(--rule) solid var(--line); transition: border-color 200ms ease; }
.hdr-inner { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter);
  display: grid; grid-template-columns: auto 1fr auto; align-items: stretch;
  min-height: 72px; gap: 32px; }

.wordmark { display: flex; align-items: center; gap: 2px;
  font-family: var(--sans); font-weight: 700; font-size: 28px;
  letter-spacing: -0.04em; color: var(--fg); line-height: 1; padding: 22px 0; }
.wordmark .caret { display: inline-block; width: 0.5ch; height: 0.9em;
  background: var(--accent); margin-left: 4px; margin-bottom: -0.05em;
  animation: blink 1.1s steps(2, end) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hdr-center { display: flex; align-items: center; gap: 24px;
  border-left: var(--rule) solid var(--line); border-right: var(--rule) solid var(--line);
  padding: 0 24px; font-family: var(--mono); font-size: 11px; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: 0.06em; overflow: hidden; white-space: nowrap; }
.hdr-center .tick { display: inline-flex; align-items: center; gap: 6px; }
.hdr-center .tick::before { content: ''; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
.hdr-center .tick.ok::before { background: var(--grade-a); }
.hdr-center .tick.warn::before { background: var(--grade-c); }
.hdr-center .tick.bad::before { background: var(--grade-f); }

.hdr-right { display: flex; align-items: center; gap: 0; }
.hdr-right .stat { padding: 0 18px; border-left: var(--rule) solid var(--line);
  display: flex; flex-direction: column; justify-content: center; min-width: 88px; }
.hdr-right .stat:first-child { border-left: 0; }
.hdr-right .stat .n { font-family: var(--mono); font-size: 18px; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1; }
.hdr-right .stat .l { font-family: var(--mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--fg-3); margin-top: 6px; }

.nav-btn { display: flex; align-items: center; gap: 10px; padding: 0 20px;
  border-left: var(--rule) solid var(--line); font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--fg); height: 100%;
  transition: background 150ms ease; }
.nav-btn:hover { background: var(--bg-2); color: var(--fg); }
.nav-btn .glyph { width: 22px; height: 14px; position: relative; }
.nav-btn .glyph .bar { position: absolute; left: 0; height: 2px; background: var(--fg);
  border-radius: 1px; transition: all 260ms cubic-bezier(.6,.2,.2,1); }
.nav-btn .glyph .bar.b1 { top: 2px; width: 100%; }
.nav-btn .glyph .bar.b2 { top: 6px; width: 70%; }
.nav-btn .glyph .bar.b3 { top: 10px; width: 100%; }
html:not(.scrolled) .nav-btn .glyph .bar.b1 { opacity: 0; transform: translateY(4px); }
html:not(.scrolled) .nav-btn .glyph .bar.b2 { opacity: 0; transform: translateY(-2px); }
html:not(.scrolled) .nav-btn .glyph .bar.b3 { background: var(--accent); }

.sub-hdr { border-bottom: var(--rule) solid var(--line); background: var(--bg); }
.sub-hdr-inner { max-width: var(--max); margin: 0 auto; padding: 10px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--fg-3); }
.sub-hdr-inner .crumbs > span { color: var(--fg); }
.sub-hdr-inner .crumbs > span + span::before { content: '/'; color: var(--fg-3); margin: 0 8px; }

/* === TERMINAL === */
.terminal { border-bottom: var(--rule) solid var(--line); background: var(--bg);
  overflow: hidden; transition: max-height 500ms cubic-bezier(.7,.0,.2,1), opacity 300ms ease;
  max-height: 340px; }
html.scrolled .terminal { max-height: 0; opacity: 0; pointer-events: none; border-bottom-color: transparent; }
.terminal-inner { max-width: var(--max); margin: 0 auto; padding: 20px var(--gutter) 28px;
  display: grid; grid-template-columns: 1fr 320px; gap: 40px; }
.term-win { background: var(--bg-2); border: var(--rule) solid var(--line); border-radius: 0;
  font-family: var(--mono); font-size: 13px; color: var(--fg); overflow: hidden; }
.term-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: var(--rule) solid var(--line); font-size: 11px; color: var(--fg-3);
  text-transform: lowercase; }
.term-bar .dots { display: flex; gap: 6px; margin-right: 8px; }
.term-bar .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.term-bar .dot.r { background: var(--grade-f); opacity: 0.6; }
.term-bar .dot.y { background: var(--grade-c); opacity: 0.6; }
.term-bar .dot.g { background: var(--grade-a); opacity: 0.6; }
.term-bar .title { margin-left: auto; font-family: var(--mono); }
.term-body { padding: 16px 18px; min-height: 180px; line-height: 1.65; }
.term-line { white-space: pre-wrap; }
.term-line .p { color: var(--accent); }
.term-line .c { color: var(--fg-2); }
.term-line .ok { color: var(--grade-a); }
.term-line .warn { color: var(--grade-c); }
.term-line .bad { color: var(--grade-f); }
.term-cursor { display: inline-block; width: 0.6ch; height: 1em; background: var(--accent);
  vertical-align: -2px; animation: blink 1.1s steps(2, end) infinite; }

.term-side h4 { font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--fg-3); margin: 0 0 14px; font-weight: 500; }
.term-side .mission { font-family: var(--serif); font-size: 24px; line-height: 1.2;
  letter-spacing: -0.01em; margin-bottom: 18px; }
.term-side .mission em { font-style: italic; color: var(--accent); }
.term-side .mission-sub { font-size: 13px; color: var(--fg-2); line-height: 1.55; margin-bottom: 20px; }
.term-side .cta-row { display: flex; gap: 8px; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px;
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  border: var(--rule) solid var(--line-strong); color: var(--fg); transition: all 150ms ease; }
.btn:hover { background: var(--fg); color: var(--bg); }
.btn.primary { background: var(--fg); color: var(--bg); }
.btn.primary:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn .arrow { transition: transform 150ms ease; }
.btn:hover .arrow { transform: translateX(2px); }

/* === FOOTER === */
footer { margin-top: 80px; border-top: var(--rule) solid var(--line); background: var(--bg); font-size: 13px; }
footer .ft-top { max-width: var(--max); margin: 0 auto; padding: 40px var(--gutter);
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; }
footer .ft-brand .wm { font-weight: 700; font-size: 32px; letter-spacing: -0.04em; line-height: 1; margin-bottom: 12px; }
footer .ft-brand .wm::after { content: '_'; color: var(--accent); }
footer .ft-brand p { color: var(--fg-2); max-width: 34ch; line-height: 1.5; font-size: 13px; }
footer h5 { font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--fg-3); margin: 0 0 14px; font-weight: 500; }
footer ul { list-style: none; padding: 0; margin: 0; }
footer li { margin-bottom: 8px; }
footer .ft-bot { max-width: var(--max); margin: 0 auto; padding: 18px var(--gutter);
  border-top: var(--rule) solid var(--line); display: flex; justify-content: space-between;
  gap: 20px; font-family: var(--mono); font-size: 11px; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: 0.08em; }

/* === DRAWER === */
.drawer { position: fixed; inset: 0;
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity 200ms ease; }
.drawer.open { opacity: 1; pointer-events: auto; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100%);
  background: var(--bg); border-left: var(--rule) solid var(--line-strong); padding: 40px 32px;
  transform: translateX(100%); transition: transform 280ms cubic-bezier(.7,.0,.2,1); overflow-y: auto; }
.drawer.open .drawer-panel { transform: translateX(0); }
.drawer h3 { font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--fg-3); margin: 0 0 16px; font-weight: 500; }
.drawer .nav-list { list-style: none; padding: 0; margin: 0 0 40px; }
.drawer .nav-list li { border-top: var(--rule) solid var(--line); }
.drawer .nav-list li:last-child { border-bottom: var(--rule) solid var(--line); }
.drawer .nav-list a { display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; font-family: var(--sans); font-size: 28px; font-weight: 500;
  letter-spacing: -0.02em; color: var(--fg); }
.drawer .nav-list a:hover { color: var(--accent); }
.drawer .nav-list a .num { font-family: var(--mono); font-size: 11px; color: var(--fg-3); letter-spacing: 0.08em; }
.drawer-close { position: absolute; top: 28px; right: 28px; font-family: var(--mono);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--fg-3); }
.drawer-close:hover { color: var(--fg); }

.eyebrow { font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--fg-3); }
.eyebrow-strong { color: var(--accent); }

.grade { display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; font-family: var(--mono); font-weight: 700; font-size: 20px;
  border: 1.5px solid currentColor; border-radius: 0; letter-spacing: -0.02em; }
.grade.g-a { color: var(--grade-a); }
.grade.g-b { color: var(--grade-b); }
.grade.g-c { color: var(--grade-c); }
.grade.g-d { color: var(--grade-d); }
.grade.g-f { color: var(--grade-f); }
.grade.sm { width: 28px; height: 28px; font-size: 14px; border-width: 1px; }
.grade.lg { width: 64px; height: 64px; font-size: 32px; border-width: 2px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px;
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--chip); color: var(--fg-2); border: var(--rule) solid var(--line); }
.chip.ok { color: var(--grade-a); border-color: color-mix(in oklab, var(--grade-a) 40%, var(--line)); }
.chip.warn { color: var(--grade-c); border-color: color-mix(in oklab, var(--grade-c) 40%, var(--line)); }
.chip.bad { color: var(--grade-f); border-color: color-mix(in oklab, var(--grade-f) 40%, var(--line)); }
.chip.acc { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 50%, var(--line)); }

.kv { display: grid; grid-template-columns: 1fr auto; font-family: var(--mono);
  font-size: 12px; padding: 8px 0; border-top: var(--rule) solid var(--line); }
.kv .k { color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; align-self: center; }

@media (max-width: 960px) {
  .hdr-center { display: none; }
  .terminal-inner { grid-template-columns: 1fr; }
  footer .ft-top { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .hdr-right .stat { padding: 0 12px; min-width: 72px; }
  .hdr-right .stat:nth-child(2) { display: none; }
  .wordmark { font-size: 22px; }
  footer .ft-top { grid-template-columns: 1fr; }
}
