:root {
  --bg: #FAF7F0; --surface: #FFFDF8; --sunk: #F3ECDF;
  --ink: #1A1A18; --muted: #6F6A60; --line: #E7DFD1;
  --accent: #C15F3C; --accent-soft: #E7C9B8;
  --accent-dim: rgba(193, 95, 60, 0.10);
  --ok: #3F7D5B; --warn: #B8762E; --bad: #B23A36;
  --status-critical: #B23A36; --status-high: #B8762E;
  --status-medium: #C9960A; --status-low: #3F7D5B; --status-pass: #3F7D5B;
  --score-excellent: #3F7D5B; --score-good: #5A8FA8;
  --score-warning: #C9960A; --score-critical: #B23A36;
  --display: 'Fraunces', Georgia, serif;
  --sans: 'Hanken Grotesk', system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --maxw: 1120px;
}
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.6; -webkit-font-smoothing: antialiased; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
a { color: inherit; text-decoration: none; }
em { font-style: italic; color: var(--accent); }
code { font-family: var(--mono); font-size: .86em; background: var(--sunk); padding: .1em .4em; border-radius: 6px; }

/* --- Header (DriftGate style) --- */
.site { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(8px); background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-family: var(--display); font-weight: 600; font-size: 20px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.logo span { color: var(--accent); }
.logo .shield { width: 26px; height: 26px; }
.top-nav { display: flex; gap: 24px; align-items: center; font-size: 15px; color: var(--muted); }
.top-nav a:hover { color: var(--ink); }
.top-nav .ghost { color: var(--accent); }
.mode-toggle { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--sunk); overflow: hidden; }
.mode-toggle button { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--muted); background: transparent; border: 0; padding: 6px 14px; cursor: pointer; transition: all .15s; }
.mode-toggle button.active { background: var(--accent); color: #fff; }

/* --- Live banner --- */
#mode-banner { display: none; margin-top: 16px; background: linear-gradient(180deg, #FBF1EA, var(--surface)); border: 1px solid var(--accent-soft); border-radius: 16px; padding: 24px; font-size: 14px; color: var(--ink); }
.banner-head { font-family: var(--display); font-size: 18px; margin-bottom: 12px; }
.banner-head b { color: var(--accent); }
.banner-body p { color: var(--muted); font-size: 14px; margin-bottom: 12px; max-width: 640px; }
.banner-body ol { margin: 0 0 12px 20px; color: var(--ink); font-size: 13.5px; line-height: 1.8; }
.banner-body ol b { font-weight: 600; }
.banner-body ol code { font-size: 12px; }
.banner-note { font-family: var(--mono); font-size: 12px; color: var(--muted); }
#mode-banner > button { margin-top: 8px; font-family: var(--sans); font-size: 13px; font-weight: 600; cursor: pointer; background: transparent; border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 8px 16px; transition: border-color .15s; }
#mode-banner > button:hover { border-color: var(--accent-soft); }

/* --- Hero --- */
.hero { display: grid; grid-template-columns: 1fr 240px; gap: 48px; align-items: center; padding: 96px 24px 64px; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 20px; }
h1 { font-family: var(--display); font-weight: 500; font-size: clamp(36px, 6vw, 64px); line-height: 1.04; letter-spacing: -0.02em; margin-bottom: 24px; }
.lede { max-width: 660px; font-size: 18px; color: var(--muted); }
.lede em { color: var(--ink); font-style: normal; font-weight: 600; }
.value { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--line); max-width: 700px; }
.value dt { font-family: var(--display); font-weight: 600; font-size: 20px; letter-spacing: -0.01em; color: var(--accent); }
.value dd { margin-top: 6px; font-size: 14px; color: var(--muted); line-height: 1.5; }

.gauge-wrap { position: relative; width: 220px; height: 220px; }
.gauge-wrap canvas { width: 220px; height: 220px; }
.gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-score { font-family: var(--display); font-weight: 600; font-size: 56px; line-height: 1; letter-spacing: -0.02em; }
.gauge-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; margin-top: 6px; }
.hero-meta { display: flex; gap: 16px; color: var(--muted); font-size: 13px; margin-top: 12px; justify-content: center; }
.hero-meta .trend.up { color: var(--ok); }
.hero-meta .trend.down { color: var(--warn); }
.hero-meta b { font-family: var(--mono); }

/* --- Section heading --- */
.section { padding: 48px 0; border-top: 1px solid var(--line); }
.section > h3 { font-family: var(--display); font-weight: 500; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 24px; display: flex; align-items: center; gap: 12px; }
.section > h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* --- Metric cards --- */
.metric-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; transition: border-color .15s, transform .3s ease; opacity: 0; transform: translateY(12px); }
.card.in { opacity: 1; transform: none; }
.card:hover { border-color: var(--accent-soft); }
.card .label { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; }
.card .value { font-family: var(--display); font-weight: 600; font-size: 40px; margin: 12px 0 8px; letter-spacing: -0.02em; color: var(--accent); border-top: none; padding-top: 0; display: block; }
.card .sub { font-size: 13px; color: var(--muted); font-family: var(--mono); }
.card .sub.good { color: var(--ok); }
.card .sub.warn { color: var(--warn); }

/* --- Chart --- */
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
#timeline { width: 100%; height: 280px; display: block; }
.chart-legend { display: flex; gap: 24px; margin-top: 16px; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.chart-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* --- Heatmap --- */
#heatmap { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 8px; }
.hm-week { display: flex; flex-direction: column; gap: 3px; }
.hm-cell { width: 12px; height: 12px; border-radius: 2px; background: var(--sunk); }

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; padding: 12px 16px; border-bottom: 1px solid var(--line); }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--sunk); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.benchmark-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-family: var(--mono); padding: 2px 8px; border-radius: 999px; }
.pill.pass { background: #E6F0EA; color: var(--ok); }
.pill.warn { background: #F5E2D7; color: var(--accent); }
.score-badge { font-family: var(--mono); padding: 2px 8px; border-radius: 4px; border: 1px solid; font-size: 13px; }

/* --- Pipeline diagram --- */
.pipeline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pnode { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; font-size: 13px; position: relative; cursor: default; font-family: var(--mono); }
.pnode.pulse { animation: nodepulse 6s infinite; }
.parrow { color: var(--muted); }
@keyframes nodepulse {
  0%, 100% { border-color: var(--line); box-shadow: none; }
  8% { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
}

/* --- Footer (DriftGate style) --- */
.site-foot { border-top: 1px solid var(--line); padding: 30px 0; margin-top: 24px; }
.site-foot .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 14px; }
.site-foot a { color: var(--accent); }

/* --- Animations --- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .hero-copy { order: 1; }
  .gauge-wrap { order: 2; }
  .value { grid-template-columns: 1fr; gap: 16px; }
  .metric-row { grid-template-columns: repeat(2, 1fr); }
  .benchmark-cols { grid-template-columns: 1fr; }
  .top-nav a:not(.ghost) { display: none; }
  .mode-toggle { display: inline-flex; }
}
@media (max-width: 560px) {
  .metric-row { grid-template-columns: 1fr; }
  .top-nav a:not(.ghost) { display: none; }
}
