/* gruff design base, shared by the scanner UI and gruff watch.
   Warm paper and ink, a light serif display face,
   hairline rules, square controls, a monospace voice for labels. One signal colour
   (vermilion) is kept for threat; everything else stays ink. */

@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("fonts/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("fonts/geist-mono.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ------------------------------------------------------------ tokens: light */
:root {
  --bg: #f5f4ef;
  --bg-2: #efede6;
  --surface: #faf9f5;
  --surface-2: #ebe9e1;
  --ink: #111111;
  --text: #2b2b2a;
  --muted: #6b6a66;
  --dim: #97958c;
  --line: #d9d6cd;
  --line-2: #c3bfb3;
  --on-ink: #f5f4ef;
  --header-bg: rgba(245, 244, 239, 0.82);
  --shadow: 0 1px 0 rgba(17, 17, 17, 0.04), 0 24px 60px -40px rgba(17, 17, 17, 0.35);

  --signal: #c8371d;
  --benign: #2f6e4f;
  --suspicious: #a7680f;
  --malicious: #c8371d;
  --unknown: #77756e;
  --critical: #b0241a;
  --high: #c4561b;
  --medium: #a0811a;
  --low: #3c6890;
  --info: #8a877e;
  --evidence: #7a4a12;

  --fmt-0: #d8d4c8; --fmt-1: #cdd3cf; --fmt-2: #d6cfc4; --fmt-3: #cfd0d6;
  --fmt-4: #ddd8cb; --fmt-5: #d2ccd0; --fmt-6: #c9d0c6;
  --fmt-ink: rgba(17, 17, 17, 0.78);

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --gutter: clamp(16px, 4.5vw, 64px);
  --wide: 1240px;
  color-scheme: light;
}

/* ------------------------------------------------------------ tokens: dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111111; --bg-2: #161615; --surface: #191918; --surface-2: #21211f;
    --ink: #f2f0ea; --text: #d9d6cd; --muted: #9b998f; --dim: #6c6a64;
    --line: #2a2927; --line-2: #3b3a36; --on-ink: #111111;
    --header-bg: rgba(17, 17, 17, 0.78);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 30px 80px -40px rgba(0, 0, 0, 0.9);
    --signal: #ff5b3a; --benign: #6cc895; --suspicious: #e7a940; --malicious: #ff5b3a;
    --unknown: #9a978d; --critical: #ff4a3d; --high: #ff8a4c; --medium: #e2c04f;
    --low: #78a6d6; --info: #807d75; --evidence: #f0c48a;
    --fmt-0: #27313a; --fmt-1: #2b2a36; --fmt-2: #23332f; --fmt-3: #352d24;
    --fmt-4: #2c3036; --fmt-5: #322733; --fmt-6: #26312a;
    --fmt-ink: rgba(242, 240, 234, 0.82);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111111; --bg-2: #161615; --surface: #191918; --surface-2: #21211f;
  --ink: #f2f0ea; --text: #d9d6cd; --muted: #9b998f; --dim: #6c6a64;
  --line: #2a2927; --line-2: #3b3a36; --on-ink: #111111;
  --header-bg: rgba(17, 17, 17, 0.78);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 30px 80px -40px rgba(0, 0, 0, 0.9);
  --signal: #ff5b3a; --benign: #6cc895; --suspicious: #e7a940; --malicious: #ff5b3a;
  --unknown: #9a978d; --critical: #ff4a3d; --high: #ff8a4c; --medium: #e2c04f;
  --low: #78a6d6; --info: #807d75; --evidence: #f0c48a;
  --fmt-0: #27313a; --fmt-1: #2b2a36; --fmt-2: #23332f; --fmt-3: #352d24;
  --fmt-4: #2c3036; --fmt-5: #322733; --fmt-6: #26312a;
  --fmt-ink: rgba(242, 240, 234, 0.82);
  color-scheme: dark;
}

/* ------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); overflow-x: clip; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-weight: 300; font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
b, strong { font-weight: 500; color: var(--ink); }
button, input { font: inherit; color: inherit; }
::selection { background: var(--ink); color: var(--on-ink); }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
.mono { font-family: var(--mono); font-size: 0.84em; letter-spacing: 0; font-weight: 400; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ eyebrow: "§ 01 | THE SCAN" */
.kicker {
  display: flex; align-items: center; gap: 10px; margin: 0 0 22px;
  font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
}
.kicker b { color: var(--ink); font-weight: 500; letter-spacing: 0.08em; }
.kicker b + span { padding-left: 10px; border-left: 1px solid var(--line-2); }
.kicker .live { width: 6px; height: 6px; border-radius: 50%; background: var(--signal); animation: blink 1.6s var(--ease) infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ------------------------------------------------------------ header */
.top {
  position: sticky; top: 0; z-index: 30;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.2) blur(16px); backdrop-filter: saturate(1.2) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .4s var(--ease), background-color .4s var(--ease);
}
.top.scrolled { border-bottom-color: var(--line); }
.top-in {
  max-width: var(--wide); margin: 0 auto; padding: 14px var(--gutter);
  display: flex; align-items: center; gap: 28px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.4; flex: none; }
.brand-mark .sweep { transform-origin: 16px 16px; animation: sweep 6s linear infinite; }
.brand-mark .blip { fill: var(--signal); stroke: none; animation: blink 2.4s var(--ease) infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
.brand-word { font-family: var(--serif); font-size: 21px; font-weight: 400; letter-spacing: -0.02em; line-height: 1; }
.brand-word em { color: var(--muted); font-weight: 300; margin-left: 3px; }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a {
  position: relative; text-decoration: none; color: var(--text); font-size: 14px; font-weight: 400; padding: 4px 0;
  transition: color .2s;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--ink);
  transform: scaleX(0); transform-origin: right; transition: transform .5s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after, .nav a.on::after { transform: scaleX(1); transform-origin: left; }
.nav a.on { color: var(--ink); }
.top-status { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--benign); position: relative; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid currentColor; color: var(--benign); animation: ring 2.2s var(--ease) infinite; }
.pulse.busy, .pulse.busy::after { background: var(--signal); color: var(--signal); }
.pulse.busy::after { background: transparent; }
@keyframes ring { 0% { transform: scale(0.5); opacity: 0.9; } 100% { transform: scale(1.8); opacity: 0; } }

/* theme switch: auto / light / dark */
.theme {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 9px;
  border: 1px solid var(--line-2); background: transparent; cursor: pointer; color: var(--ink);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  transition: border-color .25s, background-color .25s;
}
.theme:hover { border-color: var(--ink); }
.theme svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.theme svg .fill { fill: currentColor; stroke: none; }
.theme .ic { display: none; }
:root[data-theme-pref="auto"] .theme .ic-auto,
:root[data-theme-pref="light"] .theme .ic-light,
:root[data-theme-pref="dark"] .theme .ic-dark { display: block; }
:root:not([data-theme-pref]) .theme .ic-auto { display: block; }

/* ------------------------------------------------------------ buttons */
.btn {
  --b: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 44px; padding: 0 22px; border: 1px solid var(--b); border-radius: 0; cursor: pointer;
  background: var(--ink); color: var(--on-ink); font-family: var(--sans); font-size: 14px; font-weight: 400;
  text-decoration: none; white-space: nowrap; position: relative; overflow: hidden; isolation: isolate;
  transition: color .45s var(--ease), border-color .3s, opacity .2s;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--signal);
  transform: translateY(101%); transition: transform .45s var(--ease);
}
.btn:hover::before { transform: translateY(0); }
.btn:hover { border-color: var(--signal); color: #fff; }
.btn .arr { display: inline-block; transition: transform .45s var(--ease); }
.btn:hover .arr { transform: translateX(4px); }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost::before { background: var(--ink); }
.btn.ghost:hover { color: var(--on-ink); border-color: var(--ink); }
.btn.small { height: 34px; padding: 0 14px; font-size: 13px; gap: 8px; }

/* ------------------------------------------------------------ footer */
.foot { border-top: 1px solid var(--line); margin-top: 120px; }
.foot-in {
  max-width: var(--wide); margin: 0 auto; padding: 40px var(--gutter) 56px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px 48px; align-items: end;
  color: var(--muted); font-size: 13.5px;
}
.foot-in p { margin: 0 0 6px; max-width: 70ch; }
#foot-meta, #meta { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }

/* ------------------------------------------------------------ motion */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 1.1s var(--ease), transform 1.1s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 760px) {
  .top-in { gap: 14px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
  .nav { order: 3; width: 100%; margin-left: 0; gap: 18px; }
  .theme { margin-left: auto; }
  .theme .lbl { display: none; }
  .top-status { display: none; }
}
