/* SURGICAL — SIGNAL design system.
   White stock, black rules, one lime indicator. Archivo carries every role;
   JetBrains Mono is kept for machine data (credits, latency, timestamps).
   Squared edges, hairline borders, zero shadows. Light is the default; dark
   is a preserved alternative for night sessions.

   LIGHTSPEED is the motion layer: nothing waits. Sections arrive on the same
   frame the scroll lands, navigation resolves through a view transition, and
   the only thing that animates slowly is the footage itself. */
/* ---- LIGHT (default) ------------------------------------------------------ */
:root{
  --bg:#ffffff;
  --surface:#ffffff;   --panel:#ffffff;   /* alias: some pages call it --panel */
  --surface-2:#f4f2ec;
  --wash:#f4f2ec;
  --wash-2:#e8e5db;
  --line:rgba(16,16,16,.14);
  --line-2:rgba(16,16,16,.34);
  --line2:rgba(16,16,16,.34);            /* alias used by the console shell */
  --ink:#101010;
  --dim:#57574f;       --ink-dim:#57574f; /* alias */
  --ink-faint:#6b6b64;
  --accent:#d4ff3c;                       /* signal FILL — same in both themes */
  --accent-ink:#101010;                   /* text ON the lime fill */
  --on-signal:#101010;                    /* alias used by the console rail */
  --accent-text:#3f5a00;                  /* accent as TEXT / thin line / link */
  --accent-line:#3f5a00;                  /* alias of --accent-text */
  --accent-hover:#c6f218;
  --danger:#b3261e;
  --warn:#8a5a00;
  --shadow:rgba(16,16,16,.14);
  --r:0px;   --r-lg:0px;
  --sans:'Archivo','Helvetica Neue',Arial,sans-serif;
  --mono:'JetBrains Mono',ui-monospace,monospace;
  color-scheme:light;
}

/* ---- DARK (opt-in) -------------------------------------------------------- */
:root[data-theme="dark"]{
  --bg:#101010;
  --surface:#161616;   --panel:#161616;
  --surface-2:#1c1c1b;
  --wash:#161616;
  --wash-2:#232322;
  --line:rgba(255,255,255,.14);
  --line-2:rgba(255,255,255,.32);
  --line2:rgba(255,255,255,.32);
  --ink:#f4f2ec;
  --dim:#a3a39a;       --ink-dim:#a3a39a;
  --ink-faint:#6b6b64;
  --accent:#d4ff3c;
  --accent-ink:#101010;
  --on-signal:#101010;
  --accent-text:#d4ff3c;
  --accent-line:#d4ff3c;
  --accent-hover:#e2ff5c;
  --danger:#ff6b4a;
  --warn:#e8b23a;
  --shadow:rgba(0,0,0,.5);
  color-scheme:dark;
}

*{box-sizing:border-box;margin:0;padding:0}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{background:var(--bg);color:var(--ink);font-family:var(--sans);line-height:1.55;
  font-stretch:100%;font-variant-numeric:tabular-nums;letter-spacing:-.006em;
  -webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
a{color:inherit;text-decoration:none}
img,video{max-width:100%;display:block}
::selection{background:var(--accent);color:var(--ink)}
:focus-visible{outline:2px solid var(--ink);outline-offset:3px}
:root[data-theme="dark"] :focus-visible{outline-color:var(--accent)}

/* labels / machine data */
.mono{font-family:var(--mono);font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--dim)}
.accent{color:var(--accent-text)}

/* buttons — squared, sharp. The lime is a fill, never text on paper. */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;
  font-family:var(--sans);font-weight:650;font-size:14px;padding:13px 22px;
  border:1px solid var(--ink);background:transparent;color:var(--ink);
  border-radius:var(--r);cursor:pointer;white-space:nowrap;letter-spacing:-.005em;
  transition:background .14s,color .14s,border-color .14s,transform .14s}
.btn:hover{background:var(--ink);color:var(--bg)}
.btn-accent{background:var(--accent);color:var(--accent-ink);border-color:var(--ink);font-weight:700}
.btn-accent:hover{background:var(--ink);color:var(--accent);border-color:var(--ink)}
.btn-accent:disabled,.btn.disabled{opacity:.3;cursor:not-allowed;pointer-events:none}
.btn-block{width:100%}
.btn:active{transform:translateY(1px)}

/* inputs — squared, one hairline */
.input{width:100%;background:var(--bg);border:1px solid var(--line-2);color:var(--ink);
  padding:12px 13px;border-radius:var(--r);font-size:15px;font-family:var(--sans);
  transition:border-color .14s}
.input:focus{outline:none;border-color:var(--ink)}
.input::placeholder{color:var(--ink-faint)}

/* Enclosed control — `.ctl`.
   RULE: an action is a BOX, never bare text. The icon sits in its own slot cut
   off from the label by a hairline, so it reads as engraved INTO the control
   rather than floating beside it. That divider is the whole idea; everything
   else here stays quiet.
   The spinner occupies the SAME slot as the icon, so going busy swaps one
   element for another and nothing shifts position.
   Exactly one accent-filled `.ctl-go` per panel; the rest stay outlined, so the
   primary action is obvious without a second look. */
.ctl{display:inline-flex;align-items:stretch;border:1px solid var(--line-2);
  background:transparent;color:var(--ink);border-radius:var(--r);
  font-family:var(--sans);font-weight:650;font-size:13.5px;cursor:pointer;
  text-align:left;padding:0;overflow:hidden;
  transition:border-color .14s,color .14s,background .14s}
.ctl:hover{border-color:var(--ink);background:var(--wash)}
.ctl:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.ctl:disabled{opacity:.38;cursor:not-allowed;pointer-events:none}
/* Busy is not the same as disabled: the job is running, so the spinner has to be
   legible. Without this the .ctl:disabled fade dims the spinner to 38% and the
   control reads as dead while it is actually working. Still not clickable. */
.ctl.is-busy{opacity:1}
.ctl .ico{display:grid;place-items:center;flex:none;min-width:38px;align-self:stretch;
  padding:0 10px;border-right:1px solid var(--line-2)}
.ctl .ico svg{width:15px;height:15px;display:block;stroke-width:1.8}
.ctl .lab{display:flex;align-items:center;padding:10px 15px;white-space:nowrap}
.ctl .spin{display:none;width:14px;height:14px;border:2px solid currentColor;
  border-right-color:transparent;border-radius:50%;animation:ctl-spin .75s linear infinite}
@keyframes ctl-spin{to{transform:rotate(360deg)}}
.ctl.is-busy .spin{display:block}
.ctl.is-busy .idle{display:none}
@media (prefers-reduced-motion:reduce){.ctl .spin{animation-duration:2s}}

/* one accent-filled primary per panel */
.ctl-go{background:var(--accent);border-color:var(--ink);color:var(--accent-ink)}
.ctl-go:hover{background:var(--ink);border-color:var(--ink);color:var(--accent)}
.ctl-go .ico{border-right-color:rgba(16,16,16,.22)}
.ctl-danger:hover{border-color:var(--danger);color:var(--danger);background:transparent}
.ctl-block{display:flex;width:100%}
.ctl-block .lab{flex:1;justify-content:center}

/* Enclosed field — a select that is selectable TEXT, so it is boxed too. Keeps
   the OS arrow; an appearance:none select with no arrow reads as a dead field. */
.sel-enc{display:flex;align-items:center;width:100%;border:1px solid var(--line-2);
  background:transparent;border-radius:var(--r);overflow:hidden;
  transition:border-color .14s}
.sel-enc:focus-within{border-color:var(--ink)}
.sel-enc .ico{display:grid;place-items:center;flex:none;min-width:38px;align-self:stretch;
  padding:0 10px;border-right:1px solid var(--line-2);color:var(--dim)}
.sel-enc .ico svg{width:15px;height:15px;display:block;stroke-width:1.8}
.sel-enc select{flex:1;min-width:0;padding:10px 12px;border:0;background:transparent;
  color:var(--ink);font-family:var(--sans);font-weight:650;font-size:14px;cursor:pointer}
.sel-enc select:focus{outline:none}

/* logo mark — strokes/fills use currentColor so the reticle darkens in light */
.brand{display:inline-flex;align-items:center;gap:10px;font-weight:700;letter-spacing:.2em;
  font-size:13px;font-stretch:108%;text-transform:uppercase}
.brand svg{width:23px;height:23px;flex-shrink:0;color:var(--ink)}
:root[data-theme="dark"] .brand svg{color:var(--accent)}
.brand .slash{color:var(--dim);font-weight:500;letter-spacing:.06em;font-size:10px;
  font-family:var(--mono);text-transform:uppercase}

/* panels — thin border, square, NO heavy rounding */
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg)}

/* nav */
.nav{display:flex;align-items:center;justify-content:space-between;height:64px;
  border-bottom:1px solid var(--line);position:sticky;top:0;background:var(--bg);z-index:40}
.wrap{max-width:1120px;margin:0 auto;padding:0 24px;width:100%}

/* rule / divider */
.rule{height:1px;background:var(--line);border:0}

/* theme toggle — squared, mono, no emoji. Two-tone disc icon flips with theme. */
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;
  width:34px;height:34px;padding:0;border:1px solid var(--line-2);background:transparent;
  color:var(--ink);border-radius:var(--r);cursor:pointer;flex:none;
  transition:border-color .14s,color .14s,background .14s}
.theme-toggle:hover{border-color:var(--ink);background:var(--wash)}
.theme-toggle svg{width:16px;height:16px;display:block}

/* micro-label used by app pages */
.eyebrow{font-family:var(--mono);font-size:10px;letter-spacing:.16em;text-transform:uppercase;
  color:var(--ink-faint)}

/* one-beat transition lock while the theme flips */
html.theme-switch *,html.theme-switch *::before,html.theme-switch *::after{transition:none!important}

/* ============================================================
   LIGHTSPEED — the motion layer.
   ============================================================ */

/* Cross-document navigation: the old page leaves along a light streak, the
   new one is already there. Nothing to wait for, no white flash. */
@view-transition{navigation:auto}
::view-transition-old(root){
  animation:ls-leave .2s linear both;
}
::view-transition-new(root){
  animation:ls-enter .46s cubic-bezier(.16,.84,.24,1) both;
}
@keyframes ls-leave{
  to{opacity:.72;filter:blur(1px)}
}
@keyframes ls-enter{
  from{clip-path:inset(100% 0 0 0)}
  to{clip-path:inset(0 0 0 0)}
}

/* reveal on first scroll — same frame, no observer tick to wait for */
[data-rise]{opacity:0;transform:translateY(14px);
  transition:opacity .6s cubic-bezier(.2,.8,.2,1),transform .6s cubic-bezier(.2,.8,.2,1);
  transition-delay:calc(var(--d,0) * 1ms)}
[data-rise].in{opacity:1;transform:none}
[data-wipe]{clip-path:inset(0 100% 0 0);
  transition:clip-path .8s cubic-bezier(.16,.84,.24,1);
  transition-delay:calc(var(--d,0) * 1ms)}
[data-wipe].in{clip-path:inset(0 0 0 0)}

/* the hairline that draws as you read */
#ls-progress{position:fixed;top:0;left:0;height:2px;width:0;background:var(--ink);
  z-index:300;pointer-events:none;transition:width .08s linear}
:root[data-theme="dark"] #ls-progress{background:var(--accent)}

/* instant-prefetch hint: links warm as soon as a pointer crosses them */
@media (hover:hover){
  a[href^="/"]:hover{text-decoration-thickness:1px}
}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  [data-rise]{opacity:1;transform:none;transition:none}
  [data-wipe]{clip-path:none;transition:none}
  ::view-transition-old(root),::view-transition-new(root){animation:none}
  *{scroll-behavior:auto}
}
