/* ==========================================================================
   local-ai.clepore.com
   Design tokens and layout from the "AI VM Homepage" design handoff.
   All styling lives here — the page CSP forbids inline styles.
   ========================================================================== */

@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/open-sans-latin-var.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: 'Open Sans';
  font-style: normal;
  font-weight: 300 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/open-sans-latin-ext-var.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;
}

:root {
  --bg: #0f0e0c;
  --card: #141311;
  --panel: #17160f;
  --track: #1c1b18;
  --border: #262420;
  --divider: #211f1c;
  --row: #1c1b18;

  --text: #ece9e3;
  --muted: #a5a097;
  --dim: #8f8b82;
  --faint: #5f5c55;

  --accent: #f0983c;
  --accent-hover: #f6b667;
  --violet: #8b7ff0;
  --amber: #f6b342;
  --green: #58c47a;
  --red: #e2564a;

  /* Pinned nav: a true inversion of the card, so the bar reads as chrome. */
  --nav-inv-bg: var(--text);
  --nav-inv-text: var(--bg);
  --nav-inv-dim: #6d685f;
  --nav-inv-border: #c9c5bd;

  --gradient: linear-gradient(90deg, #8b7ff0, #f0983c, #f6b342);
  --font: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --pad-x: 40px;
  --section-y: 44px;
  /* Measured onto the root by nav.js; this is the pre-script fallback. */
  --nav-h: 64px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 40px 24px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
a:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

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

/* --------------------------------------------------------------- card ---- */

.card {
  width: 100%;
  max-width: 1180px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  /* clip, not hidden: it still trims children to the radius, but does not make
     the card a scroll container — which would stop the nav from ever pinning. */
  overflow: clip;
}

.section {
  padding: var(--section-y) var(--pad-x);
  border-bottom: 1px solid var(--divider);
}

/* Anchor targets clear the pinned nav instead of landing behind it. Every id
   in the card, not just the sections — #hardware is a div inside the two-up. */
.card [id] { scroll-margin-top: calc(var(--nav-h) + 16px); }
.section:last-child { border-bottom: 0; padding-bottom: 48px; }
/* The footer draws its own top rule; without this the two stack into a 2px
   line on pages whose last section sits directly above it. */
.section:has(+ .footer) { border-bottom: 0; }

.section-label {
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 18px;
  font-weight: 400;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.section-head .section-label { margin-bottom: 0; }
.section-note { font-size: 12px; color: var(--dim); }

/* ----------------------------------------------------------------- nav ---- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px var(--pad-x);
  /* Opaque: the page scrolls underneath once the bar is pinned. */
  background: var(--card);
  border-bottom: 1px solid var(--divider);
  font-size: 13px;
  flex-wrap: wrap;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.wordmark {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
  transition: color .18s ease;
}
.wordmark:hover { color: var(--text); }
.wordmark .slash { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 26px;
  color: var(--dim);
  flex-wrap: wrap;
}
.nav-links a { color: var(--dim); transition: color .18s ease; }
.nav-links a:hover { color: var(--text); }
.nav-links a[aria-current='page'] { color: var(--text); }

/* Pinned to the top of the viewport — the point at which the bar would
   otherwise have scrolled away. Everything inverts except the slash. */
.nav.is-stuck {
  background: var(--nav-inv-bg);
  border-bottom-color: var(--nav-inv-border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.nav.is-stuck .wordmark,
.nav.is-stuck .wordmark:hover { color: var(--nav-inv-text); }
.nav.is-stuck .wordmark .slash { color: var(--accent); }
.nav.is-stuck .nav-links { color: var(--nav-inv-dim); }
.nav.is-stuck .nav-links a { color: var(--nav-inv-dim); }
.nav.is-stuck .nav-links a:hover,
.nav.is-stuck .nav-links a[aria-current='page'] { color: var(--nav-inv-text); }
/* The global focus ring is accent orange, which all but vanishes on cream. */
.nav.is-stuck a:focus-visible { outline-color: var(--nav-inv-text); }

@media (prefers-reduced-motion: reduce) {
  .nav,
  .wordmark,
  .nav-links a { transition: none; }
}

/* ---------------------------------------------------------------- hero ---- */

.hero {
  padding: 72px var(--pad-x) 60px;
  border-bottom: 1px solid var(--divider);
}

.hero h1 {
  line-height: .98;
  font-weight: 300;
  letter-spacing: -.03em;
  margin: 0 0 20px;
  text-align: center;
}

.hero-lead {
  display: block;
  font-size: clamp(26px, 4.4vw, 46px);
  color: var(--muted);
}

.hero-status {
  display: block;
  font-size: clamp(44px, 8.4vw, 100px);
  margin-top: .12em;
}

.hero-state {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero h1[data-state='offline'] .hero-state,
.hero h1[data-state='degraded'] .hero-state,
.hero h1[data-state='checking'] .hero-state {
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
}
.hero h1[data-state='offline'] .hero-state { color: var(--red); }
.hero h1[data-state='degraded'] .hero-state { color: var(--amber); }
.hero h1[data-state='checking'] .hero-state { color: var(--dim); }

.hero-sub {
  font-size: 17px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 auto 44px;   /* auto side-margins center the block under the headline */
  max-width: 720px;      /* narrower measure = clearly centered, ~65ch reading width */
}
.hero-sub strong { color: var(--text); font-weight: 400; }

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.tile {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px 28px;
  background: var(--panel);
}
.tile-label {
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 14px;
}
.tile-value {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tile-value .label {
  font-size: clamp(26px, 3.6vw, 38px);
  font-weight: 300;
  letter-spacing: -.02em;
  color: var(--text);
}
.tile-detail {
  margin-top: 10px;
  font-size: 12px;
  color: var(--dim);
  min-height: 1em;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--dim);
  flex: none;
}
[data-state='online'] .dot { background: var(--green); }
[data-state='degraded'] .dot { background: var(--amber); }
[data-state='offline'] .dot { background: var(--red); }
[data-state='checking'] .dot { background: var(--faint); }

/* -------------------------------------------------------- model cards ---- */

.model-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.model-card {
  flex: 0 1 calc((100% - 2 * 16px) / 3);  /* 3 per row: 3 cards + 2 gaps = 100% */
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  background: var(--panel);
}
.model-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.model-name { font-size: 14px; color: var(--text); }
.model-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 6px;
}

.kv-list {
  font-size: 12px;
  color: var(--dim);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.kv .v {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.kv .v.pending { color: var(--faint); }

.vram-bar { margin-top: 14px; }
.vram-bar-track {
  height: 6px;
  background: var(--track);
  border-radius: 3px;
  overflow: hidden;
}
.vram-bar-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 3px;
}
.vram-bar-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
/* Footprint exceeds the card: the fill is pinned full and recoloured to warn. */
.vram-bar.over .vram-bar-fill { background: linear-gradient(90deg, var(--amber), var(--red)); }
.vram-bar.over .vram-bar-note { color: var(--amber); }

.model-live {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--row);
  font-size: 12px;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.model-live .dot { width: 8px; height: 8px; }
.model-live[data-live='loaded'] .dot { background: var(--green); }
.model-live[data-live='loaded'] .live-text { color: var(--text); }
.model-live[data-live='idle'] .dot { background: var(--faint); }
.model-live[hidden] { display: none; }

/* ---------------------------------------------------------------- bars ---- */

.bars-plot { position: relative; }
.gridlines {
  position: absolute;
  inset: 0 0 26px 0;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.gridlines span { width: 1px; background: var(--divider); }

.bars {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.bar-row-head {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.bar-row-head .value {
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.bar-track {
  height: 30px;
  background: var(--track);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 4px;
}

.axis {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- chart ---- */

.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--divider); stroke-width: 1; }
.chart .axis-text {
  fill: var(--faint);
  font-size: 11px;
  font-family: var(--font);
}
.chart .series-line { fill: none; stroke-width: 2; }
.chart .series-dot { stroke: var(--card); stroke-width: 2; }

.legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 12px;
  color: var(--dim);
}
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-swatch { width: 12px; height: 2px; flex: none; }

/* interactive crosshair on the depth chart */
.chart-wrap { position: relative; }
.chart-capture { fill: transparent; cursor: crosshair; }
.chart-crosshair { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 4 4; pointer-events: none; }
.chart-focus { fill: none; stroke-width: 2; pointer-events: none; }

.chart-tooltip {
  position: absolute;
  transform: translateX(-50%);
  pointer-events: none;
  min-width: 140px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
  z-index: 2;
}
.chart-tooltip-head {
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
}
.chart-tooltip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.9;
}
.chart-tooltip-swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.chart-tooltip-model { color: var(--text); }
.chart-tooltip-val {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- table ---- */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
table.data caption {
  text-align: left;
  font-size: 12px;
  color: var(--dim);
  padding-bottom: 10px;
}
table.data th,
table.data td {
  padding: 12px 12px 12px 0;
  text-align: right;
  border-bottom: 1px solid var(--row);
  white-space: nowrap;
}
table.data th:first-child,
table.data td:first-child {
  text-align: left;
  color: var(--text);
  padding-left: 0;
}
table.data thead th {
  padding: 10px 12px 10px 0;
  color: var(--dim);
  font-weight: 400;
  border-bottom: 1px solid var(--border);
}
/* Row labels are th, not td, so the selector has to reach both or the label
   column keeps a border stub the rest of the row has dropped. */
table.data tbody tr:last-child > * { border-bottom: 0; }
table.data td { color: var(--muted); }

.group-head td {
  padding: 22px 0 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-align: left;
}
tbody:first-of-type .group-head td { padding-top: 8px; }
.group-head .group-note {
  margin-left: 12px;
  color: var(--faint);
  text-transform: none;
  letter-spacing: 0;
}

.sd { color: var(--faint); font-size: 11px; margin-left: 4px; }
.na { color: var(--faint); }

.run-meta {
  font-size: 12px;
  color: var(--faint);
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}
.run-meta code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--dim);
}

.copy-btn {
  font-family: var(--font);
  font-size: 11px;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 8px;
  margin-left: 8px;
  cursor: pointer;
  vertical-align: baseline;
  transition: color .15s ease, border-color .15s ease;
}
.copy-btn:hover { color: var(--text); border-color: var(--faint); }
.copy-btn.is-copied { color: var(--green); border-color: var(--green); }
@media (prefers-reduced-motion: reduce) { .copy-btn { transition: none; } }

/* -------------------------------------------------------- lists / 2-up ---- */

.two-up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  font-size: 13px;
}

.spec-list { color: var(--muted); line-height: 2; }
.spec-list div { display: flex; justify-content: space-between; gap: 16px; }
.spec-list .role { color: var(--faint); }
.spec-list .value { color: var(--text); }
.spec-list div.diff span { color: var(--amber); }

.prose {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  max-width: 900px;
}
.prose p { margin: 0 0 14px; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--text); font-weight: 400; }
.prose dl { margin: 0; }
.prose dt {
  color: var(--text);
  margin-top: 12px;
}
.prose dd { margin: 2px 0 0; }

.prose-group { margin-top: 22px; }
.prose-group:first-of-type { margin-top: 0; }  /* first group follows a <p> intro */

.prose-head {
  font-size: 13px;
  font-weight: 400;
  color: var(--text);       /* brighter than --muted body text, sits above dt terms */
  letter-spacing: .01em;
  margin: 0 0 8px;
}

/* -------------------------------------------------------------- picker ---- */

.picker-bar {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.picker { display: flex; flex-direction: column; gap: 8px; min-width: 240px; flex: 1; }
.picker-head { display: flex; align-items: center; gap: 8px; }
.picker label {
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--dim);
}
.current-pill {
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: 3px;
  padding: 2px 6px;
  line-height: 1;
}
.current-pill[hidden] { display: none; }
select {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  width: 100%;
}
select:hover { border-color: var(--faint); }

/* --------------------------------------------------- empty / error box ---- */

.notice {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  padding: 32px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  max-width: 720px;
}
.notice strong { color: var(--text); font-weight: 400; display: block; margin-bottom: 6px; }
.notice.error { border-color: var(--red); }

/* ------------------------------------------------------------- compare ---- */

.compare-heads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  margin-bottom: 26px;
}
.compare-head .eyebrow {
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
}
.compare-head .title { font-size: 20px; font-weight: 300; color: var(--text); }
.compare-head .sub { font-size: 12px; color: var(--faint); margin-top: 6px; }

.delta { font-variant-numeric: tabular-nums; }
.delta.better { color: var(--green); }
.delta.worse { color: var(--red); }
.delta.noise { color: var(--faint); }
.delta.none { color: var(--faint); }

.delta-key {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--dim);
  margin-top: 18px;
}

/* ------------------------------------------------------- architecture ---- */

.arch-figure { margin: 0; }
.arch-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.arch-diagram {
  width: 100%;
  height: auto;
  min-width: 660px;   /* below this the labels crowd; the container scrolls instead */
  display: block;
}
.arch-diagram text { font-family: var(--font); }

.arch-host { fill: var(--bg); stroke: var(--border); stroke-width: 1; }
.arch-vm { fill: var(--card); stroke: var(--border); stroke-width: 1; }
.arch-docker { fill: var(--panel); stroke: var(--divider); stroke-width: 1; }

.arch-node { fill: var(--panel); stroke: var(--border); stroke-width: 1; }
.arch-node.is-accent { stroke: var(--accent); }
/* The remote benchmark client sits off-box; a dashed edge marks it as external. */
.arch-node.is-external { stroke: var(--dim); stroke-dasharray: 5 4; }
.arch-gpu { fill: var(--panel); stroke: var(--green); stroke-width: 1; }

.arch-title { fill: var(--text); font-size: 14px; }
.arch-sub { fill: var(--dim); font-size: 11px; }
.arch-zone { fill: var(--dim); font-size: 11px; letter-spacing: .16em; }

.arch-flow { fill: none; stroke: var(--accent); stroke-width: 2; }
.arch-hw { fill: none; stroke: var(--green); stroke-width: 2; }

.ah-flow { fill: var(--accent); }
.ah-hw { fill: var(--green); }

.arch-hw-text { fill: var(--green); font-size: 11px; }

.arch-legend {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 20px;
  font-size: 12px;
  color: var(--dim);
}
.arch-legend-item { display: flex; align-items: center; gap: 10px; }
.arch-key {
  width: 26px;
  height: 0;
  border-top: 2px solid;
  flex: none;
}
.arch-key.flow { border-top-color: var(--accent); }
.arch-key.hw { border-top-color: var(--green); }

/* ---------------------------------------------------------------- misc ---- */

.footer {
  padding: 28px var(--pad-x);
  font-size: 12px;
  color: var(--faint);
  border-top: 1px solid var(--divider);
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------- responsive ---- */

@media (max-width: 900px) {
  :root { --pad-x: 24px; --section-y: 32px; }
  body { padding: 20px 12px; }
  .hero { padding: 48px var(--pad-x) 40px; }
  .tiles,
  .two-up,
  .compare-heads { grid-template-columns: 1fr; gap: 20px; }
  .model-card { flex-basis: calc((100% - 16px) / 2); }  /* 2 per row: 2 cards + 1 gap */
  .nav { gap: 14px; }
  .nav-links { gap: 18px; font-size: 12px; }
}

@media (max-width: 620px) {
  .model-card { flex-basis: 100%; }
  .hero-sub { font-size: 15px; }
  .picker-bar { gap: 16px; }
}
