/*
 * ttfb.net — shared by every page (home, /itti/, /lighthouse/, /results.html):
 * reset, fonts, color tokens (light + dark), base type, the site header and
 * footer and the theme switch. Mobile first; wider layouts in min-width
 * queries. Page-specific styles stay in each page.
 */

/* ---- Fonts: self-hosted, preloaded by each page. `optional` never swaps
   after first paint, so text can't shift the layout (no CLS from fonts). */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: optional;
  src: url(fonts/instrument-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: optional;
  src: url(fonts/instrument-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: optional;
  src: url(fonts/jetbrains-mono-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: optional;
  src: url(fonts/jetbrains-mono-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-height: 100vh; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
p, h1, h2, h3, h4 { overflow-wrap: break-word; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }

/* ---- Tokens ---- */
:root {
  color-scheme: light;
  --bg: #ffffff; --bg2: #fbfbfc; --panel: #ffffff; --panel2: #f7f8f9; --line: #e7e9ec; --line2: #eef0f2;
  --text: #0d1117; --muted: #646d78; --faint: #98a1ab; --placeholder: #a8b0b8;
  --accent: #06a76a; --cta-bg: #06a76a; --cta-fg: #ffffff; --warn: #c2820b; --bad: #d1543a;
  --glow: rgba(6,167,106,.10); --track: #ecedf0; --dot: #d2d7dc; --label: #8b939b;
  --soft-bg: rgba(6,167,106,.07); --soft-border: rgba(6,167,106,.32); --hover: #cfd4d9;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: 16px;
  --max: 1160px;
}
/* Dark: a dark green background (not black); panels and lines follow it a
   step lighter, text keeps the original neutral colors. */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b2219; --bg2: #0d261c; --panel: #0f2b20; --panel2: #113024; --line: #1b3d30; --line2: #204536;
  --text: #e6e8ea; --muted: #8b9198; --faint: #5b6167; --placeholder: #4a5057;
  --accent: #4ff0a5; --cta-bg: #4ff0a5; --cta-fg: #06231a; --warn: #e8c34a; --bad: #e8734a;
  --glow: rgba(79,240,165,.10); --track: #163428; --dot: #2a4d40; --label: #7b838a;
  --soft-bg: rgba(79,240,165,.10); --soft-border: rgba(79,240,165,.45); --hover: #2e5244;
}
/* Older names the test pages use. */
:root, [data-theme="dark"] {
  --ink: var(--text); --sub: var(--muted); --bg-soft: var(--panel2);
  --green: var(--accent); --amber: var(--warn); --red: var(--bad);
}
@media (min-width: 760px) { :root { --gutter: 32px; } }

/* ---- Base ---- */
body {
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 16px;
}
body > main { flex: 1; width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: .8; }
::placeholder { color: var(--placeholder); }
.mono, .num { font-family: var(--mono); }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* ---- Header (identical on every page) ---- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: var(--max); margin: 0 auto; width: 100%;
  min-height: 64px; padding: 0 var(--gutter);
}
.site-header .logo { display: flex; align-items: center; gap: 10px; color: inherit; }
.site-header .logo:hover { opacity: 1; }
.site-header .mark {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--cta-bg); color: var(--cta-fg); font: 700 11px/1 var(--mono);
}
.site-header .name { font: 500 15px/1 var(--mono); letter-spacing: -.2px; }
.site-header nav { display: flex; align-items: center; gap: 16px; font-size: 13.5px; }
.site-header nav a { color: var(--muted); }
.site-header nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
@media (min-width: 760px) { .site-header { min-height: 72px; } .site-header nav { gap: 20px; } }

/* ---- Footer (identical on every page) ---- */
.site-footer { border-top: 1px solid var(--line); margin-top: 24px; }
/* One row at every width: name, optional note (cut with an ellipsis when
   short of room), then the theme switch pushed to the right. */
.site-footer .wrap {
  display: flex; align-items: center; gap: 16px;
  padding-top: 20px; padding-bottom: 24px;
}
.site-footer .name { flex: none; font: 500 13px/1 var(--mono); color: var(--muted); }
.site-footer .tag { font-size: 13px; color: var(--faint); }
.site-footer nav { display: flex; gap: 20px; font-size: 13px; }
.site-footer nav a { color: var(--muted); }
.site-footer .note { margin: 0; max-width: none; line-height: 1.4; min-width: 0; font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-footer .note a { color: var(--muted); }
.site-footer .grow { flex: 1; }
.theme-switch {
  flex: none; display: flex; align-items: center; gap: 2px; padding: 3px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel2);
}
.theme-switch button {
  padding: 6px 12px; border: 0; border-radius: 999px; background: transparent;
  color: var(--faint); font: 500 12px/1 var(--mono); transition: background .15s, color .15s;
}
.theme-switch button[aria-pressed="true"] { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(13,17,23,.10); }
@media (min-width: 760px) {
  .site-footer .wrap { padding-top: 28px; padding-bottom: 40px; }
}

/* ---- Hero (home, /itti/, /lighthouse/): pill, big headline, ▸ input box
   with the green button, small options line. Scoped to .hero so pages'
   own .run / button / input rules can't collide. Mobile first. ---- */
/* Soft glow behind the hero, on every page that has one. */
body:has(.hero) { background: radial-gradient(1100px 520px at 50% -180px, var(--glow), transparent 70%), var(--bg); background-repeat: no-repeat; }
.hero { max-width: 900px; margin: 0 auto; padding: 40px var(--gutter) 48px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero .pill { display: inline-flex; align-items: center; gap: 9px; padding: 5px 12px 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel2); margin-bottom: 24px; font: 400 12px/1 var(--mono); color: var(--muted); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; animation: blink 1.8s ease-in-out infinite; }
.hero h1 { font-size: clamp(34px, 9vw, 64px); line-height: 1.04; letter-spacing: -.04em; font-weight: 600; text-wrap: balance; }
.hero .lede { margin-top: 16px; max-width: 540px; font-size: 16px; line-height: 1.55; color: var(--muted); text-wrap: pretty; }
.hero .check { width: 100%; max-width: 660px; margin-top: 32px; }
.hero .check .row { display: flex; flex-direction: column; gap: 10px; }
.hero .field { flex: none; display: flex; flex-direction: row; align-items: center; font-size: inherit; color: inherit; gap: 10px; height: 56px; padding: 0 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(13,17,23,.04); }
.hero .field:focus-within { border-color: var(--soft-border); }
.hero .field .caret { font: 400 13px/1 var(--mono); color: var(--accent); }
.hero .field input { flex: 1; min-width: 0; width: auto; height: 100%; padding: 0; background: transparent; border: 0; border-radius: 0; outline: none; color: var(--text); font: 400 16px/1 var(--mono); letter-spacing: -.3px; }
.hero .run { height: 56px; padding: 0 26px; border: 0; border-radius: 12px; background: var(--cta-bg); color: var(--cta-fg); font: 600 15.5px/1 var(--sans); display: flex; align-items: center; justify-content: center; gap: 9px; white-space: nowrap; }
.hero .run:hover { filter: brightness(1.08); }
.hero .run:disabled { opacity: .6; cursor: not-allowed; filter: none; }
.hero .run .key { font: 700 13px/1 var(--mono); }
.hero .options { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; margin-top: 14px; font: 400 12.5px/1.6 var(--mono); color: var(--muted); }
.hero .options label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.hero .options select { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; max-width: 100%; }
.hero .options input[type=checkbox] { accent-color: var(--accent); margin: 0; }
.hero .status { margin-top: 12px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
@keyframes blink { 0%, 45% { opacity: 1; } 50%, 100% { opacity: .15; } }
@media (min-width: 640px) {
  .hero .check .row { flex-direction: row; }
  .hero .field { flex: 1; height: 58px; }
  .hero .run { height: 58px; }
}
@media (min-width: 760px) {
  .hero { padding-top: 72px; padding-bottom: 64px; }
  .hero .lede { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
