/* Benchmark Studio: SaaS Billing & Revenue 2026 (Lab demo)
   Editorial paper-and-ink look: Fraunces for headings, Instrument Sans for text and figures, IBM Plex Mono for labels.
   Chart colours are validated (CVD and contrast) for both modes; app.js reads them from these tokens. */

:root {
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  --text-xl: clamp(1.5rem, 1.25rem + 1vw, 2.125rem);
  --text-2xl: clamp(1.875rem, 1.4rem + 1.9vw, 3rem);
  --text-hero: clamp(2.5rem, 1.6rem + 4vw, 5.25rem);

  --gutter: clamp(16px, 4vw, 40px);
  --radius: 4px;
  --nav-h: 60px;
  --seg-h: 0px;

  color-scheme: light;
  --paper: #F4EFE6;
  --paper-2: #ECE5D8;
  --surface: #FFFCF6;
  --line: #DCD3C3;
  --line-soft: #E9E1D3;
  --ink: #1D2621;
  --ink-2: #47524B;
  --ink-3: #626B64;
  --accent: #A4471F;
  --accent-ink: #FFFCF6;
  --accent-soft: rgba(164, 71, 31, 0.08);
  --nav-bg: rgba(244, 239, 230, 0.92);

  /* Chart tokens: categorical slots in fixed order, an ordinal teal ramp (light to dark), a neutral reference */
  --c1: #007A5E; --c2: #A97C00; --c3: #3A55C4; --c4: #D06A36;
  --o1: #7DBBA4; --o2: #4E9F84; --o3: #228265; --o4: #00664D; --o5: #004A38;
  --ghost: #ADA597;
  --grid: rgba(29, 38, 33, 0.08);
  --critical: #B23A2E;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101613;
  --paper-2: #141C18;
  --surface: #18201C;
  --line: #2C3832;
  --line-soft: #232D28;
  --ink: #ECE7DD;
  --ink-2: #B9C0B8;
  --ink-3: #8C958E;
  --accent: #E38A5F;
  --accent-ink: #101613;
  --accent-soft: rgba(227, 138, 95, 0.1);
  --nav-bg: rgba(16, 22, 19, 0.92);

  --c1: #1E9A78; --c2: #B98E1E; --c3: #6F86E6; --c4: #D9733F;
  --o1: #0E5A46; --o2: #17785E; --o3: #2A9878; --o4: #55B596; --o5: #8ED1B8;
  --ghost: #56625B;
  --grid: rgba(236, 231, 221, 0.07);
  --critical: #E0715F;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  overflow-x: clip;
}
h1, h2, h3, p, dl, dd, figure { margin: 0; }
a { color: var(--accent); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img, svg, canvas { display: block; max-width: 100%; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: var(--lab-bar-h, 0px);
  z-index: 40;
  background: var(--nav-bg);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter);
  height: var(--nav-h); display: flex; align-items: center; gap: 20px;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px; flex: none;
  color: var(--ink); text-decoration: none;
  font-family: var(--font-display); font-weight: 600; font-size: 1.125rem; letter-spacing: -0.01em;
}
.nav-logo svg { color: var(--c1); }
.logo-dot { fill: var(--accent); }
.nav-links { display: flex; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; justify-content: flex-end; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-link {
  flex: none; padding: 6px 9px; border-radius: var(--radius);
  color: var(--ink-2); text-decoration: none; font-size: 0.8125rem; font-weight: 500; white-space: nowrap;
  transition: color .15s ease, background-color .15s ease;
}
.nav-link:hover { color: var(--ink); background: var(--paper-2); }
.nav-link.active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.nav-link-cta-mobile { display: none; }
.nav-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.theme-toggle {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink-2);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
.nav-cta {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px;
  background: var(--ink); color: var(--paper); text-decoration: none; border-radius: var(--radius);
  font-size: 0.8125rem; font-weight: 600; white-space: nowrap;
}
.nav-cta:hover { background: var(--accent); color: var(--accent-ink); }
.nav-hamburger { display: none; width: 40px; height: 36px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 10px; flex-direction: column; justify-content: center; gap: 4px; }
.nav-hamburger span { display: block; height: 2px; background: var(--ink); border-radius: 2px; }

@media (max-width: 1120px) {
  .nav-hamburger { display: flex; }
  .nav-links {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; gap: 0; padding: 8px var(--gutter) 16px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    max-height: calc(100vh - var(--lab-bar-h, 0px) - var(--nav-h)); overflow-y: auto;
  }
  .nav-links.open { display: flex; }
  .nav-link { padding: 11px 4px; font-size: 0.9375rem; border-bottom: 1px solid var(--line-soft); border-radius: 0; }
  .nav-link.active { box-shadow: inset 3px 0 0 var(--accent); padding-left: 12px; }
  .nav-inner { justify-content: space-between; }
}
@media (max-width: 560px) {
  :root { --nav-h: 54px; }
  .nav-cta { display: none; }
  .nav-link-cta-mobile { display: block; font-weight: 600; color: var(--accent); }
  .nav-logo { font-size: 1rem; }
}

/* ---------- Cover ---------- */
.hero { padding: clamp(40px, 7vw, 96px) 0 clamp(48px, 7vw, 88px); border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--lab-bar-h, 0px) + var(--nav-h)); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: center; }
.hero-badge { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.hero-badge span { padding: 4px 9px; border: 1px solid var(--line); background: var(--surface); }
.hero-badge span:first-child { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.hero-title { font-family: var(--font-display); font-weight: 500; font-size: var(--text-hero); line-height: 1.02; letter-spacing: -0.025em; font-variation-settings: "opsz" 144; }
.hero-title .amp { font-style: italic; color: var(--accent); font-weight: 400; }
.hero-subtitle { margin-top: 20px; max-width: 34em; color: var(--ink-2); font-size: var(--text-lg); line-height: 1.55; }
.demo-notice {
  display: flex; gap: 12px; align-items: flex-start; margin-top: 26px; padding: 14px 16px;
  background: var(--accent-soft); border: 1px solid var(--accent); border-left-width: 4px; color: var(--ink);
}
.demo-notice svg { flex: none; color: var(--accent); margin-top: 1px; }
.demo-notice p { font-size: 0.9375rem; line-height: 1.5; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 28px; border-top: 1px solid var(--line); }
.hero-stat { padding: 14px 14px 0 0; display: flex; flex-direction: column-reverse; gap: 4px; }
.hero-stat + .hero-stat { padding-left: 14px; border-left: 1px solid var(--line); }
.hero-stat dt { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.hero-stat-value { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.hero-stat-text { font-size: 1.0625rem; font-weight: 600; letter-spacing: 0; line-height: 1.3; display: block; }
.hero-scroll { display: inline-flex; align-items: center; gap: 8px; margin-top: 28px; color: var(--ink); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--ink); padding-bottom: 2px; }
.hero-scroll:hover { color: var(--accent); border-color: var(--accent); }
.hero-figure { align-self: center; }
.hero-figure-cap { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 10px; font-size: var(--text-sm); color: var(--ink-2); }
.hero-figure-cap b { color: var(--ink); }
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .hero-stats { grid-template-columns: minmax(0, 1fr); }
  .hero-stat { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
  .hero-stat + .hero-stat { padding-left: 0; border-left: 0; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 8vw, 104px) 0; scroll-margin-top: calc(var(--lab-bar-h, 0px) + var(--nav-h) + var(--seg-h) + 8px); }
.section-alt { background: var(--paper-2); }
.section-header { max-width: 760px; margin-bottom: clamp(28px, 4vw, 44px); }
.section-tag { display: inline-block; margin-bottom: 12px; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.section-title { font-family: var(--font-display); font-weight: 500; font-size: var(--text-2xl); line-height: 1.1; letter-spacing: -0.02em; font-variation-settings: "opsz" 96; }
.section-desc { margin-top: 14px; color: var(--ink-2); font-size: var(--text-lg); line-height: 1.6; }

/* Note */
.note-layout { max-width: 820px; }
.note-body { margin-top: 20px; display: grid; gap: 14px; color: var(--ink-2); font-size: var(--text-lg); }
.note-body p:first-child::first-letter { font-family: var(--font-display); float: left; font-size: 3.4em; line-height: 0.85; padding: 6px 10px 0 0; color: var(--accent); }
.note-sign { margin-top: 22px; font-family: var(--font-display); font-style: italic; font-size: 1.125rem; }
.note-sign span { font-style: normal; font-family: var(--font-body); color: var(--ink-3); font-size: var(--text-sm); }

/* ---------- Segment bar ---------- */
.seg-bar {
  position: sticky; top: calc(var(--lab-bar-h, 0px) + var(--nav-h)); z-index: 35;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 6px 16px rgba(0,0,0,0.04);
}
.seg-inner { display: flex; align-items: center; min-height: 60px; padding-top: 8px; padding-bottom: 8px; }
.seg-toggle { display: none; }
.seg-controls { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; width: 100%; }
.seg-head { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; align-self: center; margin-right: 4px; }
.seg-title { font-family: var(--font-display); font-weight: 600; font-size: 1rem; line-height: 1.1; white-space: nowrap; }
.seg-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.seg-field > span { font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.seg-field select {
  appearance: none; -webkit-appearance: none;
  height: 34px; min-width: 150px; max-width: 100%; padding: 0 30px 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background-color: var(--paper);
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat;
  font-size: 0.875rem; cursor: pointer;
}
.seg-field select.is-set { border-color: var(--c1); box-shadow: inset 0 0 0 1px var(--c1); background-color: var(--surface); }
.seg-end { display: flex; align-items: center; gap: 12px; margin-left: auto; align-self: center; }
.seg-reset { height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: transparent; font-size: 0.8125rem; font-weight: 600; }
.seg-reset:disabled { opacity: .45; cursor: default; }
.seg-reset:not(:disabled):hover { border-color: var(--ink); }
.seg-count { font-size: var(--text-sm); color: var(--ink-2); white-space: nowrap; }
.seg-count b { color: var(--ink); font-size: 1rem; }
.seg-chip { font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent); padding: 3px 6px; white-space: nowrap; }
.seg-warning { padding-top: 6px; padding-bottom: 8px; font-size: var(--text-sm); color: var(--ink); }
.seg-warning::before { content: "!"; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 8px; border-radius: 50%; background: var(--critical); color: var(--surface); font-weight: 700; font-size: 12px; vertical-align: -3px; }
@media (max-width: 1120px) {
  .seg-title { display: none; }
  .seg-field select { min-width: 118px; }
  #segNWord { display: none; }
  .seg-count::before { content: "n = "; }
  .seg-controls { gap: 12px; }
}
@media (max-width: 860px) {
  .seg-inner { flex-direction: column; align-items: stretch; min-height: 0; padding-top: 6px; padding-bottom: 6px; }
  .seg-toggle {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0;
    border: 0; background: none; text-align: left;
  }
  .seg-toggle-k { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
  .seg-toggle-v { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .seg-toggle-n { font-size: 0.8125rem; color: var(--ink-2); white-space: nowrap; }
  .seg-toggle-n::before { content: "n = "; }
  .seg-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  .seg-controls { display: none; padding: 8px 0 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .seg-bar.open .seg-controls { display: grid; }
  .seg-field select { width: 100%; min-width: 0; }
  .seg-end { grid-column: 1 / -1; margin-left: 0; justify-content: space-between; }
  .seg-head { grid-column: 1 / -1; flex-direction: row; align-items: center; }
  .seg-head .seg-title { display: none; }
}

/* ---------- Snapshot rings ---------- */
.snapshot-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.snapshot-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 16px 20px; text-align: center; }
.snapshot-ring { position: relative; width: 112px; height: 112px; margin: 0 auto 14px; }
.snapshot-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg, .ring-fill { fill: none; stroke-width: 7; }
.ring-bg { stroke: var(--line-soft); }
.ring-fill { stroke: var(--c1); stroke-linecap: butt; stroke-dasharray: 326.73; stroke-dashoffset: 326.73; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }
.snapshot-ring-value { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; }
.snapshot-label { font-size: var(--text-sm); color: var(--ink-2); line-height: 1.45; }
@media (max-width: 1000px) { .snapshot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .snapshot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .snapshot-card:last-child { grid-column: 1 / -1; }
  .snapshot-ring { width: 92px; height: 92px; }
  .snapshot-ring-value { font-size: 1.375rem; }
}

/* ---------- Cards & charts ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.profile-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-gap-top { margin-top: 20px; }
@media (max-width: 980px) { .profile-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .profile-grid-3 > :last-child { grid-column: 1 / -1; } }
@media (max-width: 768px) { .profile-grid, .profile-grid-3 { grid-template-columns: minmax(0, 1fr); } .profile-grid-3 > :last-child { grid-column: auto; } }

.chart-card { position: relative; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 2.4vw, 26px); }
.chart-card-wide { width: 100%; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chart-title { font-family: var(--font-body); font-weight: 600; font-size: 1.0625rem; line-height: 1.35; letter-spacing: -0.005em; }
.chart-subtitle { margin-top: 4px; font-size: var(--text-sm); color: var(--ink-2); }
.chart-hint { margin-top: 4px; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.04em; color: var(--ink-3); }
.chart-container { position: relative; height: 290px; margin-top: 16px; }
.chart-container-tall { height: 380px; }
.chart-container canvas { width: 100% !important; }
.chart-card.is-tabled .chart-container { display: none; }
.table-btn {
  flex: none; height: 26px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: transparent;
  font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.04em; color: var(--ink-2);
}
.table-btn:hover, .table-btn[aria-pressed="true"] { color: var(--ink); border-color: var(--ink-3); }
.chart-table { margin-top: 16px; overflow-x: auto; max-height: 380px; overflow-y: auto; }
.chart-table table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.chart-table th, .chart-table td { padding: 7px 10px; border-bottom: 1px solid var(--line-soft); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; white-space: normal; }
.chart-table thead th { position: sticky; top: 0; background: var(--surface); font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.chart-table caption { text-align: left; font-size: var(--text-xs); color: var(--ink-3); padding-bottom: 6px; }

.chart-callout { display: flex; align-items: baseline; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); font-size: var(--text-sm); color: var(--ink-2); }
.chart-callout-value { flex: none; font-size: 1.625rem; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; line-height: 1; }
.chart-callout-warning .chart-callout-value::before { content: "!"; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 8px; border-radius: 50%; background: var(--critical); color: var(--surface); font-size: 12px; font-weight: 700; vertical-align: 4px; }

.insight-callout { margin-top: 28px; padding: 18px 20px; border-left: 3px solid var(--accent); background: var(--surface); font-size: var(--text-lg); line-height: 1.55; }
.section-alt .insight-callout { background: var(--surface); }
.insight-callout-inset { margin-top: 18px; font-size: var(--text-sm); background: var(--paper); }
.insight-k { display: block; margin-bottom: 6px; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--ink); }
.kpi-card { padding: 20px 18px 22px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.kpi-card:not(:nth-child(4n+1)) { padding-left: 18px; border-left: 1px solid var(--line); }
.kpi-value { font-size: clamp(2rem, 1.6rem + 1.4vw, 2.75rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.kpi-label { font-size: var(--text-sm); color: var(--ink-2); line-height: 1.4; }
.kpi-meter { height: 4px; background: var(--line-soft); margin-top: 6px; }
.kpi-meter i { display: block; height: 100%; width: 0; background: var(--c1); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.kpi-delta { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--ink-3); min-height: 1em; }
@media (max-width: 860px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card:not(:nth-child(4n+1)) { padding-left: 0; border-left: 0; }
  .kpi-card:nth-child(2n) { padding-left: 16px; border-left: 1px solid var(--line); }
}

/* Improvement list and bar lists */
.improvement-list { display: grid; gap: 4px; margin-top: 14px; }
.improvement-item { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.improvement-item:last-child { border-bottom: 0; }
.improvement-value { font-size: 1.875rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.improvement-label { color: var(--ink-2); font-size: 0.9375rem; line-height: 1.4; }
.bar-list { display: grid; gap: 14px; margin-top: 18px; }
.bar-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.bar-label { font-size: 0.9375rem; color: var(--ink-2); }
.bar-pct { font-weight: 600; font-size: 1rem; }
.bar-track { grid-column: 1 / -1; height: 8px; background: var(--line-soft); position: relative; }
.bar-track i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--c1); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.bar-track b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-3); transition: left .8s cubic-bezier(.2,.8,.2,1); }
.bar-note { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--ink-3); }

/* Feature banner (replaces the quote banner) */
.feature-banner { margin-top: 24px; display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 28px; align-items: center; padding: clamp(22px, 3vw, 36px); background: var(--ink); color: var(--paper); border-radius: var(--radius); }
.feature-stat { display: flex; flex-direction: column; gap: 6px; }
.feature-value { font-size: clamp(2.75rem, 2rem + 3vw, 4.25rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.feature-label { font-size: var(--text-sm); opacity: .82; line-height: 1.45; }
.feature-text { font-family: var(--font-display); font-size: clamp(1.125rem, 1rem + 0.6vw, 1.5rem); line-height: 1.45; font-weight: 400; }
@media (max-width: 768px) { .feature-banner { grid-template-columns: minmax(0, 1fr); gap: 16px; } }

/* Explorer */
.explorer-controls { margin-bottom: 16px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 0.875rem; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.explorer-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.ex-stat { padding: 14px 16px; min-width: 0; }
.ex-stat + .ex-stat { border-left: 1px solid var(--line-soft); }
.ex-stat-k { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.ex-stat-v { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.ex-stat-s { font-size: var(--text-xs); color: var(--ink-2); }
.ex-desc { grid-column: 1 / -1; padding: 10px 16px; border-top: 1px solid var(--line-soft); font-size: var(--text-sm); color: var(--ink-2); }
@media (max-width: 700px) {
  .explorer-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ex-stat:nth-child(3) { border-left: 0; }
  .ex-stat:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .chip-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); scrollbar-width: thin; }
}
.seg-buttons { display: inline-flex; flex-wrap: wrap; margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg-buttons button { height: 32px; padding: 0 11px; border: 0; background: transparent; font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); }
.seg-buttons button + button { border-left: 1px solid var(--line); }
.seg-buttons button:hover { color: var(--ink); background: var(--paper); }
.seg-buttons button[aria-pressed="true"] { background: var(--paper-2); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.mix-controls { display: flex; flex-wrap: wrap; gap: 0 12px; }

/* Impact list */
.impact-list { display: grid; gap: 14px; margin-top: 18px; }
.impact-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: center; }
/* Each bubble is a small ring: the arc is the share, so colour carries no rank */
.impact-bubble { position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 1rem; color: var(--ink); background: conic-gradient(var(--c1) calc(var(--p, 0) * 1%), var(--line-soft) 0); }
.impact-bubble::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.impact-bubble span { position: relative; }
.impact-label { color: var(--ink-2); font-size: 0.9375rem; line-height: 1.4; }
.big-stat { display: flex; align-items: baseline; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.big-stat-value { font-size: 2.5rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.big-stat-label { font-size: var(--text-sm); color: var(--ink-2); }

/* Benchmark yourself */
.compare-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 2.6vw, 30px); }
.compare-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.compare-peer { font-size: 0.9375rem; color: var(--ink-2); }
.compare-peer b { color: var(--ink); }
.ghost-btn { height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: transparent; font-size: 0.8125rem; font-weight: 600; }
.ghost-btn:hover { border-color: var(--ink); }
.compare-rows { display: grid; }
.cmp-row { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) minmax(0, 210px); gap: 10px 24px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.cmp-name { font-weight: 600; font-size: 0.9375rem; line-height: 1.35; }
.cmp-name small { display: block; font-weight: 400; color: var(--ink-3); font-size: var(--text-xs); margin-top: 2px; }
.cmp-input { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.cmp-input input[type="range"] { flex: 1 1 auto; min-width: 0; accent-color: var(--accent); }
.cmp-input output { flex: none; min-width: 74px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.cmp-strip { position: relative; height: 34px; }
.cmp-strip .track { position: absolute; left: 0; right: 0; top: 15px; height: 4px; background: var(--line-soft); }
.cmp-strip .band-outer { position: absolute; top: 12px; height: 10px; background: var(--o1); opacity: .55; }
.cmp-strip .band-inner { position: absolute; top: 10px; height: 14px; background: var(--o3); }
.cmp-strip .med { position: absolute; top: 6px; width: 2px; height: 22px; background: var(--ink); }
.cmp-strip .you { position: absolute; top: 4px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); transition: left .2s ease; }
.cmp-strip .you::after { content: "You"; position: absolute; top: 18px; left: 50%; transform: translateX(-50%); font-family: var(--font-mono); font-size: 10px; color: var(--accent); font-weight: 500; }
.cmp-scale { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.625rem; color: var(--ink-3); margin-top: 2px; }
.cmp-result { font-size: var(--text-sm); color: var(--ink-2); line-height: 1.45; }
.cmp-result b { display: block; color: var(--ink); font-size: 1rem; }
.cmp-q { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.04em; text-transform: uppercase; }
.cmp-q::before { content: ""; width: 10px; height: 10px; border: 1.5px solid currentColor; border-radius: 50%; }
.cmp-q.q1::before { background: currentColor; }
.cmp-q.q2::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 16px; padding-top: 14px; font-size: var(--text-xs); color: var(--ink-3); }
.cmp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cmp-legend i { display: inline-block; width: 18px; height: 8px; }
.compare-summary { margin-top: 18px; padding: 16px 18px; background: var(--paper); border-left: 3px solid var(--accent); font-size: var(--text-lg); }
@media (max-width: 860px) {
  .cmp-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}

/* Glossary */
.glossary-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.glossary-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.glossary-table th { text-align: left; padding: 12px 16px; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; border-bottom: 1px solid var(--line); }
.glossary-table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); color: var(--ink-2); vertical-align: top; }
.glossary-table td:first-child { font-weight: 600; color: var(--ink); white-space: nowrap; }
.glossary-table tr:last-child td { border-bottom: 0; }
@media (max-width: 600px) {
  .glossary-table thead { display: none; }
  .glossary-table tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
  .glossary-table td { display: block; padding: 0; border: 0; white-space: normal !important; }
  .glossary-table td:nth-child(2) { font-size: var(--text-xs); color: var(--ink-3); margin-bottom: 4px; }
}

/* About */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: start; }
.about-text p { margin-top: 14px; color: var(--ink-2); font-size: var(--text-lg); }
.about-stats { display: grid; gap: 0; border-top: 1px solid var(--ink); }
.about-stat { padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; gap: 16px; }
.about-stat-value { flex: none; min-width: 64px; font-size: 2.25rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.about-stat-label { color: var(--ink-2); font-size: 0.9375rem; }
@media (max-width: 768px) { .about-grid { grid-template-columns: minmax(0, 1fr); } }

/* CTA */
.cta-section { padding-top: 0; }
.cta-card { padding: clamp(28px, 5vw, 64px); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius); text-align: center; }
.cta-title { font-family: var(--font-display); font-weight: 500; font-size: var(--text-2xl); letter-spacing: -0.02em; line-height: 1.1; }
.cta-desc { max-width: 36em; margin: 14px auto 0; color: var(--ink-2); font-size: var(--text-lg); }
.cta-button { display: inline-flex; align-items: center; height: 46px; padding: 0 22px; margin-top: 24px; background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 700; border-radius: var(--radius); }
.cta-button:hover { background: var(--ink); color: var(--paper); }
.cta-contact { margin-top: 12px; font-size: var(--text-sm); color: var(--ink-3); }

/* Footer */
.footer { padding: 36px 0 48px; border-top: 1px solid var(--line); background: var(--paper-2); }
.footer-inner { display: grid; gap: 10px; }
.footer-title { font-family: var(--font-display); font-weight: 600; }
.footer-disclaimer { max-width: 52em; padding: 12px 14px; border: 1px solid var(--accent); background: var(--accent-soft); font-size: var(--text-sm); color: var(--ink); }
.footer-links { font-size: var(--text-sm); color: var(--ink-3); }
.noscript { padding: 16px; text-align: center; }

/* Scroll progress and reveal */
.scroll-progress { position: fixed; left: 0; right: 0; bottom: 0; height: 3px; z-index: 46; background: var(--accent); transform-origin: left; transform: scaleX(0); pointer-events: none; }
[data-animate] { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1); }
[data-animate].visible { opacity: 1; transform: none; }
html.no-motion [data-animate], html.lab-capture [data-animate] { opacity: 1; transform: none; transition: none; }
@media (prefers-reduced-motion: reduce) { [data-animate] { opacity: 1; transform: none; transition: none; } .ring-fill, .kpi-meter i, .bar-track i { transition: none; } }

/* Redraw feedback: hold the frame while a slice recalculates */
.is-updating .chart-container { opacity: .92; }

/* ---------- Empty slice: charts built from the slice say so instead of showing flat zeros ---------- */
.chart-card.is-empty .chart-container::after {
  content: "No companies match this slice. Remove a filter above.";
  position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center;
  background: var(--surface); opacity: .94; color: var(--ink-2); font-size: var(--text-sm);
}
.chart-card.is-empty .table-btn { visibility: hidden; }

/* ---------- Wide screens: give the charts more room ---------- */
@media (min-width: 1600px) {
  .container, .nav-inner { max-width: 1320px; }
  .chart-container { height: 320px; }
  .chart-container-tall { height: 420px; }
}

/* ---------- Touch targets: at least 44px on phones, tablets and any coarse pointer ---------- */
@media (max-width: 860px), (pointer: coarse) {
  .theme-toggle, .nav-hamburger { width: 44px; height: 44px; }
  .nav-cta { height: 44px; }
  .seg-toggle { min-height: 44px; }
  .seg-field select, .seg-reset, .ghost-btn { height: 44px; }
  .table-btn { min-height: 44px; min-width: 56px; }
  .chip { height: 44px; }
  .seg-buttons button { height: 44px; padding: 0 12px; }
  .cmp-input input[type="range"] { height: 44px; }
  .footer-links a { display: inline-block; padding: 12px 0; }
  .hero-scroll { padding: 12px 0 6px; }
  .nav-logo { min-height: 44px; }
}
