/* savearoundtrip: monospace, terminal-ish, single source of truth for color */

:root {
  --bg:        #0d0f12;
  --bg-soft:   #14181d;
  --bg-inset:  #0a0c0f;
  --fg:        #c8d0d8;
  --fg-dim:    #7b8794;
  --fg-faint:  #4a535e;
  --line:      #232a31;
  --accent:    #4cd47a;   /* the "go straight to h3" green */
  --accent-2:  #59b6ff;   /* links / info */
  --warn:      #ffcf5c;   /* alt-svc-but-no-rr */
  --bad:       #ff6b6b;
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", "Cascadia Code",
          ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:#f7f8f5; --bg-soft:#eef0ea; --bg-inset:#e6e8e1;
    --fg:#1c2126; --fg-dim:#5a6570; --fg-faint:#97a0aa; --line:#d6dad0;
    --accent:#1a9a4b; --accent-2:#1763c9; --warn:#9a6b00; --bad:#c92e2e;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px 120px;
}

a { color: var(--accent-2); text-decoration: none; border-bottom: 1px dotted currentColor; }
a:hover { border-bottom-style: solid; }

::selection { background: var(--accent); color: var(--bg); }

/* ---- top bar ---- */
header.bar {
  border-bottom: 1px solid var(--line);
  margin-bottom: 44px;
  padding: 16px 0 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
header.bar .brand { font-family: var(--mono); font-weight: 600; color: var(--fg); }
header.bar .brand .blink { color: var(--accent); animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
header.bar nav a { color: var(--fg-dim); margin-left: 18px; border: 0; }
header.bar nav a:hover { color: var(--accent); }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--line); color: var(--fg-dim);
  border-radius: 6px; font-size: 18px; line-height: 1; padding: 5px 11px; cursor: pointer;
}
.nav-toggle:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 600px) {
  .nav-toggle { display: inline-flex; align-items: center; }
  header.bar nav { display: none; flex-basis: 100%; flex-direction: column; gap: 2px; margin-top: 8px; }
  header.bar nav.open { display: flex; }
  header.bar nav a { margin-left: 0; padding: 8px 2px; }
}

/* ---- hero ---- */
.hero { padding: 12px 0 8px; }
.kicker {
  color: var(--fg-dim);
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
h1 {
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.32;
  margin: 14px 0 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h1 .hl { color: var(--accent); }
.lede { font-size: 17px; color: var(--fg); max-width: 64ch; }
.lede .dim { color: var(--fg-dim); }

/* ---- the headline metric ---- */
.metric {
  margin: 40px 0;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 26px 28px;
}
.metric .big {
  font-size: clamp(40px, 9vw, 76px);
  font-weight: 700;
  color: var(--warn);
  line-height: 1;
  letter-spacing: -0.02em;
}
.metric .big.loading { color: var(--fg-faint); }
.metric .cap { color: var(--fg-dim); margin-top: 10px; max-width: 60ch; }
.metric .src { color: var(--fg-faint); font-size: 12px; margin-top: 12px; }

/* ---- generic sections ---- */
section { margin-top: 56px; }
h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  margin: 0 0 18px;
  font-weight: 600;
}
h3 { font-size: 16px; margin: 28px 0 8px; color: var(--fg); }
p { margin: 0 0 16px; }
.dim { color: var(--fg-dim); }

ul.tick { list-style: none; padding: 0; margin: 0 0 16px; }
ul.tick li { padding-left: 26px; position: relative; margin-bottom: 8px; }
ul.tick li::before {
  content: "→"; position: absolute; left: 0; color: var(--accent);
}

/* ---- the round-trip sequence diagrams (mermaid) ---- */
.seq { display: grid; gap: 18px; margin: 20px 0; }
.seqcol {
  border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px;
  padding: 16px 18px; background: var(--bg-inset);
}
.seqcol.bad  { border-left-color: var(--warn); }
.seqcol.good { border-left-color: var(--accent); }
.seqcol h4 { margin: 0 0 14px; font-size: 13px; letter-spacing: .04em; }
.seqcol.bad h4  { color: var(--warn); }
.seqcol.good h4 { color: var(--accent); }
/* before mermaid runs, .mermaid is a <pre>; reset the code-block chrome */
.seqcol .mermaid {
  background: none; border: 0; padding: 0; margin: 0; overflow-x: auto;
  text-align: center; color: var(--fg-faint); font-size: 12px; line-height: 1.45;
}
.seqcol .verdict { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.seqcol.bad .verdict  { color: var(--warn); }
.seqcol.good .verdict { color: var(--accent); }

/* ---- real-browser data from GLAM ---- */
.badge {
  display: inline-block; background: var(--bg-inset); border: 1px solid var(--accent);
  color: var(--accent); border-radius: 999px; padding: 1px 9px; font-size: 11px;
  letter-spacing: .03em; margin-right: 8px; vertical-align: 1px;
}

/* the four headline numbers */
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
@media (max-width: 560px) { .statgrid { grid-template-columns: repeat(2, 1fr); } }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 14px 12px; background: var(--bg-inset); text-align: center; }
.stat .n { font-size: clamp(24px, 6vw, 34px); font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.stat .l { color: var(--fg-dim); font-size: 12px; margin-top: 8px; }

/* shared bucket colors: text (stat numbers), bars, legend dots, svg bands */
.c-none   { color: var(--fg-faint); }
.c-altsvc { color: var(--warn); }
.c-https  { color: var(--accent); }
.c-both   { color: var(--accent-2); }
.bar-fill.c-none   { background: var(--fg-faint); }
.bar-fill.c-altsvc { background: var(--warn); }
.bar-fill.c-https  { background: var(--accent); }
.bar-fill.c-both   { background: var(--accent-2); }
.legend-dot.c-none,   .tip-dot.c-none   { background: var(--fg-faint); }
.legend-dot.c-altsvc, .tip-dot.c-altsvc { background: var(--warn); }
.legend-dot.c-https,  .tip-dot.c-https  { background: var(--accent); }
.legend-dot.c-both,   .tip-dot.c-both   { background: var(--accent-2); }
.band-none   { fill: var(--fg-faint); }
.band-altsvc { fill: var(--warn); }
.band-https  { fill: var(--accent); }
.band-both   { fill: var(--accent-2); }

.bars { margin: 6px 0 4px; }
.bar-row { display: flex; align-items: center; gap: 12px; margin: 7px 0; font-size: 13px; }
.bar-label { flex: 0 0 140px; color: var(--fg-dim); text-align: right; }
.bar-track { flex: 1 1 auto; background: var(--bg-inset); border: 1px solid var(--line); border-radius: 4px; height: 18px; overflow: hidden; }
.bar-fill { display: block; height: 100%; }
.bar-val { flex: 0 0 52px; color: var(--fg); }

/* stacked-area time series */
.trend { position: relative; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-inset); padding: 10px 8px 4px; }
.trend-svg { width: 100%; height: auto; display: block; }
.trend-svg rect { fill-opacity: 0.5; }
.trend-svg rect.hit { fill: transparent; fill-opacity: 0; pointer-events: all; }
.trend-svg .ax { fill: var(--fg-dim); font-size: 10px; font-family: var(--sans); fill-opacity: 1; }
.trend-tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 158px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; font-size: 12px; color: var(--fg);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.trend-tip[hidden] { display: none; }
.tip-date { color: var(--fg-dim); margin-bottom: 6px; }
.tip-row { display: flex; align-items: center; gap: 7px; line-height: 1.75; }
.tip-dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex: 0 0 auto; }
.tip-v { margin-left: auto; color: var(--fg); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 4px; font-size: 12.5px; color: var(--fg-dim); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.chart-cap { color: var(--fg-dim); font-size: 12.5px; margin: 2px 0 18px; }

/* measured round-trip bar vs the 100 ms "feels instant" line */
.rttbar { margin: 16px 0 4px; }
.rttbar[hidden] { display: none; }
.rttbar-track { position: relative; height: 22px; background: var(--bg-inset); border: 1px solid var(--line); border-radius: 5px; }
.rttbar-fill { height: 100%; background: var(--warn); opacity: .5; border-radius: 4px 0 0 4px; }
.rttbar-thresh { position: absolute; top: -3px; bottom: -3px; border-left: 2px dashed var(--fg-dim); }
.rttbar-key { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: 12.5px; color: var(--fg-dim); }
.rttbar-key b { color: var(--warn); }
.rttbar-swatch { display: inline-block; width: 11px; height: 11px; border-radius: 2px; background: var(--warn); opacity: .5; vertical-align: 1px; margin-right: 6px; }
.rttbar-how { font-size: 11.5px; color: var(--fg-faint); margin: 6px 0 0; }

/* per-field breakdown of the example record */
.fields { list-style: none; padding: 0; margin: 0 0 16px; font-size: 13.5px; }
.fields li { padding: 7px 0; border-bottom: 1px solid var(--line); color: var(--fg-dim); }
.fields li:last-child { border-bottom: 0; }
.fields li code { color: var(--accent-2); }

/* ---- comparison table ---- */
.cmp { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 8px 0 16px; }
.cmp th, .cmp td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cmp thead th { color: var(--fg-dim); font-weight: 600; border-bottom-color: var(--fg-faint); }
.cmp td.yes { color: var(--accent); }
.cmp td.no  { color: var(--bad); }
.cmp tr td:first-child { color: var(--fg-dim); }

/* ---- code / record samples ---- */
code { font-family: var(--mono); background: var(--bg-inset); padding: 1px 5px; border-radius: 4px; color: var(--fg); font-size: .9em; }
pre {
  font-family: var(--mono);
  background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 18px; overflow-x: auto; font-size: 13px; line-height: 1.5; margin: 0 0 16px;
}
pre code { background: none; padding: 0; }
.tok-key { color: var(--accent-2); }
.tok-val { color: var(--accent); }
.tok-com { color: var(--fg-faint); }

/* ---- the lookup tool ---- */
.tool {
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft);
  padding: 22px 24px;
}
.tool .prompt { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.tool .ps1 { color: var(--accent); align-self: center; white-space: nowrap; }
.tool input[type=text] {
  flex: 1 1 220px; min-width: 0;
  background: var(--bg-inset); border: 1px solid var(--line); border-radius: 6px;
  color: var(--fg); font-family: var(--mono); font-size: 15px; padding: 10px 12px;
}
.tool input[type=text]:focus { outline: none; border-color: var(--accent); }
.tool button {
  background: var(--accent); color: var(--bg); border: 0; border-radius: 6px;
  font-family: var(--sans); font-weight: 600; font-size: 14px; padding: 10px 18px; cursor: pointer;
}
.tool button:hover { filter: brightness(1.08); }
.tool button:disabled { opacity: .5; cursor: wait; }
.examples { margin-top: 12px; font-size: 12.5px; color: var(--fg-faint); }
.examples a { color: var(--fg-dim); border: 0; margin-right: 12px; }
.examples a:hover { color: var(--accent); }

/* ---- lookup result ---- */
#result { margin-top: 20px; }
#result:empty { display: none; }
.verdict-card {
  border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px;
  padding: 16px 18px; background: var(--bg-inset); margin-bottom: 16px;
}
.verdict-card.ok   { border-left-color: var(--accent); }
.verdict-card.warn { border-left-color: var(--warn); }
.verdict-card.err  { border-left-color: var(--bad); }
.verdict-card .v-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.verdict-card.ok   .v-title { color: var(--accent); }
.verdict-card.warn .v-title { color: var(--warn); }
.verdict-card.err  .v-title { color: var(--bad); }
.verdict-card .v-sub { color: var(--fg-dim); font-size: 13.5px; }

.facts { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.facts li { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.facts li:last-child { border-bottom: 0; }
.facts .k { color: var(--fg-dim); flex: 0 0 130px; }
.facts .val { color: var(--fg); word-break: break-word; }
.facts .val .pill {
  display: inline-block; font-family: var(--mono); background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 4px; padding: 0 7px; margin: 0 4px 4px 0; font-size: 12px;
}
.facts .val .pill.h3 { border-color: var(--accent); color: var(--accent); }
.spin { color: var(--fg-dim); }
.spin::after { content: "▏"; animation: blink .8s step-end infinite; }

/* publish hint shown in a lookup result when h3 is missing */
.publish-hint { margin-top: 14px; }
.publish-hint .ph-label { color: var(--fg-dim); font-size: 12.5px; margin-bottom: 6px; }
.publish-hint pre { margin: 0 0 8px; font-size: 12.5px; }
.copy-btn {
  background: transparent; color: var(--accent); border: 1px solid var(--line);
  border-radius: 6px; font-family: var(--mono); font-size: 12px; padding: 5px 12px; cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); }

/* noscript fallback notice */
.noscript {
  border: 1px solid var(--warn); color: var(--warn); background: var(--bg-inset);
  border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-top: 14px;
}

/* ---- footer ---- */
footer {
  margin-top: 80px; padding-top: 22px; border-top: 1px solid var(--line);
  color: var(--fg-faint); font-size: 12.5px;
}
footer a { color: var(--fg-dim); }
footer .refs-head { margin-top: 18px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; }
footer .refs { margin-top: 8px; line-height: 2; }
