/*
 * The HeartCut site's one stylesheet.
 *
 * Every color is a token on :root, redefined for the dark theme, so a rule names what a color is for
 * and never the color itself. The values are the brand sheet's (logos/heartcut-brand-colors.png) and
 * the operator console's (heartcut_webui/static/console.css): navy, slate, blue and sky on white, and
 * their lighter steps on the dark ground. Filled buttons and links take the darker action blue, which
 * white text reads against at 4.5:1 or better.
 *
 * Headings, navigation and figures are set in Montserrat, the wordmark's face; running text is set
 * in the reader's system face. The page uses no script: the phone menu is a <details> element.
 */

@font-face { font-family: "Montserrat"; font-weight: 400; font-display: swap; src: url("fonts/Montserrat-400.ttf") format("truetype"); }
@font-face { font-family: "Montserrat"; font-weight: 500; font-display: swap; src: url("fonts/Montserrat-500.ttf") format("truetype"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-display: swap; src: url("fonts/Montserrat-600.ttf") format("truetype"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap; src: url("fonts/Montserrat-700.ttf") format("truetype"); }
@font-face { font-family: "Montserrat"; font-weight: 800; font-display: swap; src: url("fonts/Montserrat-800.ttf") format("truetype"); }

:root {
  color-scheme: light;
  --navy: #15253C;
  --navy-raised: #1B2E4A;
  --navy-line: #2C3F5C;
  --on-navy: #D4DCE6;
  --on-navy-quiet: #9FB0C6;
  --on-navy-strong: #F2F5F8;
  --ink: #15253C;
  --slate: #4B596C;
  --quiet: #5D6B7E;
  --blue: #1F7BEB;
  --action: #1867D1;
  --action-hover: #1253A8;
  --sky: #4BAEF7;
  --link: #1867D1;
  --page: #FFFFFF;
  --band: #F4F6F9;
  --surface: #FFFFFF;
  --surface-sunk: #F6F8FB;
  --line: #DDE3EA;
  --line-soft: #E8EDF2;
  --accent-ground: #E7F1FD;
  --accent-ink: #1453A8;
  --good-ground: #E3F4EA;
  --good-ink: #1E6B43;
  --bad-ground: #FDE8E6;
  --bad-ink: #A3271B;
  --context-bar: #8593A6;
  --code-ground: #15253C;
  --code-ink: #E3EAF2;
  --shadow: 0 1px 2px rgba(21, 37, 60, 0.06), 0 8px 24px rgba(21, 37, 60, 0.07);
  --shadow-float: 0 24px 60px rgba(8, 18, 33, 0.45), 0 2px 8px rgba(8, 18, 33, 0.3);
  --focus: #1867D1;

  --display: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 10px;
  --radius-card: 14px;
  --measure: 68ch;
  --gutter: 24px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --navy: #111D2E;
    --navy-raised: #18273D;
    --navy-line: #2A3B55;
    --ink: #F2F5F8;
    --slate: #B4BFCC;
    --quiet: #A3AFBE;
    --blue: #3B8EF5;
    --action: #1867D1;
    --action-hover: #3B8EF5;
    --sky: #6CC0FA;
    --link: #6CC0FA;
    --page: #1C252E;
    --band: #18212A;
    --surface: #232E39;
    --surface-sunk: #1F2933;
    --line: #3A4757;
    --line-soft: #2F3B48;
    --accent-ground: #16304F;
    --accent-ink: #9CC8FF;
    --good-ground: #173A2A;
    --good-ink: #8FE0B5;
    --bad-ground: #43201D;
    --bad-ink: #F4A39A;
    --context-bar: #6B788A;
    --code-ground: #121A22;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --focus: #6CC0FA;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --navy: #111D2E;
  --navy-raised: #18273D;
  --navy-line: #2A3B55;
  --ink: #F2F5F8;
  --slate: #B4BFCC;
  --quiet: #A3AFBE;
  --blue: #3B8EF5;
  --action: #1867D1;
  --action-hover: #3B8EF5;
  --sky: #6CC0FA;
  --link: #6CC0FA;
  --page: #1C252E;
  --band: #18212A;
  --surface: #232E39;
  --surface-sunk: #1F2933;
  --line: #3A4757;
  --line-soft: #2F3B48;
  --accent-ground: #16304F;
  --accent-ink: #9CC8FF;
  --good-ground: #173A2A;
  --good-ink: #8FE0B5;
  --bad-ground: #43201D;
  --bad-ink: #F4A39A;
  --context-bar: #6B788A;
  --code-ground: #121A22;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --focus: #6CC0FA;
}

/* ---- the frame ---- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--link);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--action-hover);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

figure {
  margin: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--action);
  color: #FFFFFF;
  font-weight: 600;
}

.skip:focus {
  top: 12px;
  color: #FFFFFF;
}

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

.wrap--narrow {
  max-width: 860px;
}

/* ---- the header ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--navy) 94%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--navy-line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  min-height: 44px;
}

/* the lockup's viewBox carries a margin of its own, which the negative inset takes back so the
   wordmark's left edge lines up with the content below it */
.brand img {
  height: 42px;
  width: auto;
  margin-left: -5px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius);
  color: var(--on-navy);
  font-family: var(--display);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
}

.nav a:hover {
  background: var(--navy-raised);
  color: #FFFFFF;
}

.nav a[aria-current="page"] {
  color: #FFFFFF;
  box-shadow: inset 0 -2px 0 var(--sky);
  border-radius: 0;
}

/* the phone menu: a <details> whose summary is the toggle, hidden at desktop width */
.menu {
  display: none;
  position: relative;
}

.menu > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--navy-line);
  border-radius: var(--radius);
  color: var(--on-navy);
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.menu[open] > summary::after {
  margin-top: 3px;
  transform: rotate(-135deg);
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(280px, calc(100vw - 32px));
  padding: 8px;
  border: 1px solid var(--navy-line);
  border-radius: var(--radius-card);
  background: var(--navy-raised);
  box-shadow: var(--shadow-float);
}

.menu-panel a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius);
  color: var(--on-navy);
  font-family: var(--display);
  font-weight: 600;
  text-decoration: none;
}

.menu-panel a:hover {
  background: var(--navy-line);
  color: #FFFFFF;
}

.menu-panel a[aria-current="page"] {
  color: #FFFFFF;
  background: var(--action);
}

/* ---- buttons ---- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.button--primary {
  background: var(--action);
  color: #FFFFFF;
}

.button--primary:hover {
  background: #1253A8;
  color: #FFFFFF;
}

.button--ghost {
  border-color: var(--navy-line);
  color: var(--on-navy-strong);
}

.button--ghost:hover {
  border-color: var(--sky);
  background: var(--navy-raised);
  color: #FFFFFF;
}

.button--outline {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button--outline:hover {
  border-color: var(--action);
  color: var(--ink);
}

.arrow::after {
  content: "\2192";
  font-family: var(--text);
}

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

.hero {
  position: relative;
  overflow: hidden;
  background: var(--navy);
  color: var(--on-navy);
}

/* the mark's grid, faded out toward the text so it reads as texture */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--navy-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--navy-line) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: -1px -1px;
  opacity: 0.55;
  mask-image: radial-gradient(ellipse 70% 90% at 85% 40%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 90% at 85% 40%, #000 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  right: -10%;
  top: -30%;
  width: 70%;
  height: 120%;
  background: radial-gradient(closest-side, rgba(31, 123, 235, 0.28), transparent);
  pointer-events: none;
}

.hero .wrap {
  position: relative;
  z-index: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
  padding-top: 88px;
  padding-bottom: 96px;
}

.overline {
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

.hero .overline,
.page-hero .overline,
.cta .overline {
  color: var(--sky);
}

.hero h1 {
  color: var(--on-navy-strong);
  font-size: clamp(2.3rem, 4.6vw, 3.55rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.hero h1 em,
.page-hero h1 em {
  font-style: normal;
  color: var(--sky);
}

.hero-lead {
  max-width: 34em;
  margin-top: 22px;
  color: var(--on-navy);
  font-size: 19px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.hero-note {
  margin-top: 26px;
  color: var(--on-navy-quiet);
  font-size: 14px;
}

/* ---- the answer card: one answer with its evidence resolved ---- */

.answer {
  position: relative;
  border: 1px solid var(--navy-line);
  border-radius: 16px;
  background: #FFFFFF;
  color: #15253C;
  box-shadow: var(--shadow-float);
  overflow: hidden;
}

.answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid #E8EDF2;
  background: #F6F8FB;
}

.answer-ask {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.answer-field {
  font-family: var(--display);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #1F7BEB;
}

.answer-question {
  font-family: var(--display);
  font-size: 13.5px;
  font-weight: 600;
  color: #15253C;
}

.answer-tag {
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: #E7F1FD;
  color: #1453A8;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
}

.answer-body {
  padding: 20px 22px 18px;
  font-size: 15.5px;
  line-height: 1.75;
  color: #26364D;
}

.cite {
  padding: 1px 6px;
  border-radius: 5px;
  background: #E7F1FD;
  box-shadow: inset 0 -2px 0 #4BAEF7;
  color: #1453A8;
  font-family: var(--display);
  font-size: 0.92em;
  font-weight: 700;
  white-space: nowrap;
}

/* a quoted log line is too long to keep on one line at phone width */
.cite--wrap {
  white-space: normal;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.answer-foot {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid #E8EDF2;
  background: #F6F8FB;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: #1E6B43;
}

.check + .check {
  border-left: 1px solid #E8EDF2;
}

.check::before {
  content: "";
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1E6B43 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.2 2.2 4.8-4.8' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}

.resolve {
  margin: 0;
  padding: 12px 20px 14px;
  border-top: 1px dashed #DDE3EA;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: #4B596C;
}

.resolve b {
  color: #1453A8;
  font-weight: 600;
}

.resolve .ok {
  color: #1E6B43;
  font-weight: 600;
}

/* ---- the answer carousel: the slides share one grid cell, so the tallest sets the height ---- */

.carousel-slides {
  display: grid;
}

.carousel-slides > .answer {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s;
}

.carousel-slides > .answer:not(.is-active) {
  visibility: hidden;
  opacity: 0;
  transform: translateX(24px);
}

.carousel-slides .answer-body {
  flex: 1 0 auto;
}

.carousel-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.carousel-controls[hidden] {
  display: none;
}

.carousel-controls :focus-visible {
  outline-color: var(--sky);
}

.carousel-toggle {
  min-height: 28px;
  padding: 3px 12px;
  border: 1px solid var(--navy-line);
  border-radius: 999px;
  background: none;
  color: var(--on-navy);
  font-family: var(--display);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.carousel-toggle:hover {
  border-color: var(--sky);
}

.carousel-dots {
  display: flex;
  gap: 2px;
}

/* the button is the 24px target; the dot drawn inside it is 8px */
.carousel-dot {
  position: relative;
  width: 22px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: width 0.3s ease;
}

.carousel-dot::before,
.carousel-dot::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 7px;
  right: 7px;
  height: 8px;
  margin-top: -4px;
  border-radius: 999px;
}

.carousel-dot::before {
  background: var(--on-navy-quiet);
  opacity: 0.5;
}

.carousel-dot:hover::before {
  opacity: 0.85;
}

.carousel-dot[aria-current="true"] {
  width: 48px;
}

.carousel-dot[aria-current="true"]::before {
  opacity: 0.3;
}

/* the active dot fills over the slide's interval, and freezes while the carousel is held */
.carousel-dot[aria-current="true"]::after {
  background: var(--sky);
  transform-origin: left center;
  animation: carousel-progress var(--carousel-interval, 10s) linear forwards;
}

.carousel.is-paused .carousel-dot::after {
  animation-play-state: paused;
}

@keyframes carousel-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ---- sections ---- */

.section {
  padding: 96px 0;
}

.section--band {
  background: var(--band);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.section-head {
  max-width: 760px;
  margin-bottom: 48px;
}

.section-head--center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.section-head h2 {
  font-size: clamp(1.8rem, 3.2vw, 2.45rem);
}

.section-head p:not(.overline) {
  margin-top: 16px;
  color: var(--slate);
  font-size: 18.5px;
}

/* ---- the four properties ---- */

.pillars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.pillar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px 24px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pillar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--accent-ground);
  color: var(--blue);
}

.pillar-icon svg {
  width: 22px;
  height: 22px;
}

.pillar h3 {
  font-size: 19px;
}

.pillar-figure {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  color: var(--blue);
}

.pillar p {
  color: var(--slate);
  font-size: 15.5px;
}

/* ---- the cut: heads, heart, tails ---- */

.cut {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 64px;
  align-items: center;
}

.cut-copy h2 {
  font-size: clamp(1.8rem, 3.2vw, 2.45rem);
}

.cut-copy p {
  margin-top: 16px;
  color: var(--slate);
  font-size: 17.5px;
}

.cut-copy p strong {
  color: var(--ink);
}

.fractions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fraction {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  overflow: hidden;
}

.fraction-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 16px 18px;
  border-right: 1px solid var(--line-soft);
  background: var(--surface-sunk);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
}

.fraction-label small {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fraction--drop .fraction-label small {
  color: var(--bad-ink);
}

.fraction--keep .fraction-label small {
  color: var(--good-ink);
}

.fraction-body {
  padding: 16px 20px;
  font-size: 15px;
  color: var(--slate);
}

.fraction-body strong {
  color: var(--ink);
}

.fraction--keep {
  border: 2px solid var(--blue);
  box-shadow: 0 10px 30px rgba(31, 123, 235, 0.16);
}

.fraction--keep .fraction-label {
  background: var(--accent-ground);
  color: var(--accent-ink);
}

.fraction--drop {
  opacity: 0.92;
}

.fraction--drop .fraction-body {
  text-decoration-line: none;
}

/* ---- the cost chart: one row per path, log-scaled annual cost ---- */

.chart {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 22px 26px 6px;
}

.chart-title {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
  color: var(--slate);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.swatch--api { background: var(--context-bar); }
.swatch--hc { background: var(--blue); }

.bars {
  margin: 0;
  padding: 14px 26px 8px;
  list-style: none;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr) 86px 70px;
  align-items: center;
  gap: 18px;
  min-height: 52px;
  padding: 6px 8px;
  border-radius: 8px;
}

.bar-row:hover {
  background: var(--surface-sunk);
}

.bar-name {
  font-size: 14.5px;
  line-height: 1.35;
}

.bar-name small {
  display: block;
  color: var(--quiet);
  font-size: 12.5px;
}

.bar-track {
  position: relative;
  height: 14px;
}

.bar-fill {
  display: block;
  height: 14px;
  border-radius: 0 4px 4px 0;
  background: var(--context-bar);
}

.bar-row--hc .bar-fill {
  background: var(--blue);
}

.bar-value,
.bar-time {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bar-time {
  color: var(--slate);
  font-weight: 600;
}

.bar-row--hc .bar-value {
  color: var(--blue);
}

.bar-divider {
  height: 1px;
  margin: 6px 8px;
  background: var(--line-soft);
}

.bar-cols {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr) 86px 70px;
  gap: 18px;
  padding: 0 8px 4px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--quiet);
}

.bar-cols span:nth-child(3),
.bar-cols span:nth-child(4) {
  text-align: right;
}

.chart-foot {
  padding: 14px 26px 20px;
  border-top: 1px solid var(--line-soft);
  color: var(--quiet);
  font-size: 13.5px;
}

/* ---- stats ---- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.stat {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.stat-value {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.stat-value span {
  color: var(--blue);
}

.stat p {
  margin-top: 6px;
  color: var(--slate);
  font-size: 14.5px;
}

/* ---- cards and grids ---- */

.grid-2,
.grid-3 {
  display: grid;
  gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2--center { align-items: center; gap: 56px; }
.grid-2--wide { gap: 56px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.card h3 {
  font-size: 18.5px;
}

.card p,
.card li {
  color: var(--slate);
  font-size: 15.5px;
}

.card ul {
  margin: 4px 0 0;
  padding-left: 20px;
}

.card li + li {
  margin-top: 6px;
}

a.card {
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

a.card:hover {
  border-color: var(--action);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card-link {
  margin-top: auto;
  padding-top: 8px;
  color: var(--link);
  font-family: var(--display);
  font-size: 14.5px;
  font-weight: 700;
}

.card--quiet {
  background: var(--surface-sunk);
}

.card .card-reader {
  margin-top: auto;
  padding-top: 6px;
  color: var(--quiet);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
}

.card-kicker {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
}

/* ---- questions list ---- */

.questions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.questions li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--display);
  font-size: 15.5px;
  font-weight: 600;
}

.questions li::before {
  content: "";
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, var(--sky) 0 46%, transparent 46% 54%, var(--blue) 54% 100%);
  border-radius: 2px;
}

/* ---- the call to action band ---- */

.cta {
  position: relative;
  overflow: hidden;
  background: var(--navy);
  color: var(--on-navy);
}

.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--navy-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--navy-line) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.5;
  mask-image: radial-gradient(ellipse 60% 120% at 50% 100%, #000, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 120% at 50% 100%, #000, transparent 70%);
}

.cta .wrap {
  position: relative;
  padding-top: 88px;
  padding-bottom: 88px;
  text-align: center;
}

.cta h2 {
  max-width: 820px;
  margin: 0 auto;
  color: var(--on-navy-strong);
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
}

.cta p:not(.overline) {
  max-width: 640px;
  margin: 18px auto 0;
  font-size: 18px;
}

.cta .hero-actions {
  justify-content: center;
}

.claim-lines {
  display: grid;
  gap: 4px;
  margin: 22px auto 0;
  max-width: 560px;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  color: var(--on-navy);
}

.claim-lines span:last-child {
  color: var(--sky);
}

/* ---- inner page hero ---- */

.page-hero {
  position: relative;
  overflow: hidden;
  background: var(--navy);
  color: var(--on-navy);
}

.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--navy-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--navy-line) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.5;
  mask-image: radial-gradient(ellipse 55% 110% at 92% 50%, #000, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 55% 110% at 92% 50%, #000, transparent 72%);
}

.page-hero .wrap {
  position: relative;
  padding-top: 76px;
  padding-bottom: 72px;
}

.page-hero h1 {
  max-width: 820px;
  color: var(--on-navy-strong);
  font-size: clamp(2.1rem, 4.2vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.page-hero p:not(.overline) {
  max-width: 700px;
  margin-top: 20px;
  font-size: 19px;
}

/* ---- prose ---- */

.prose {
  max-width: var(--measure);
}

.prose > * + * {
  margin-top: 18px;
}

.prose h2 {
  margin-top: 56px;
  font-size: clamp(1.55rem, 2.6vw, 2rem);
}

.prose h2:first-child,
.prose > .overline + * {
  margin-top: 0;
}

.prose h3 {
  margin-top: 36px;
  font-size: 20px;
}

.prose p:not(.overline),
.prose li {
  color: var(--slate);
}

.prose strong {
  color: var(--ink);
}

.prose ul,
.prose ol {
  padding-left: 22px;
}

.prose li + li {
  margin-top: 8px;
}

.lede {
  font-size: 19px;
}

.callout {
  padding: 22px 26px;
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--accent-ground);
}

.callout p {
  color: var(--ink);
}

.callout p + p {
  margin-top: 10px;
}

/* ---- the pipeline ---- */

.pipeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

/* a list resuming after the freeze line keeps counting from the list before it */
.pipeline--continued {
  counter-reset: none;
}

.step {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 24px;
  padding-bottom: 36px;
  counter-increment: step;
}

.step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 27px;
  top: 56px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(var(--line), var(--line));
}

.step-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-family: var(--display);
  font-size: 18px;
  font-weight: 800;
  color: var(--slate);
}

.step-mark::before {
  content: counter(step, decimal-leading-zero);
}

.step--gate .step-mark {
  border-color: var(--blue);
  background: var(--blue);
  color: #FFFFFF;
}

.step--freeze .step-mark {
  border-style: dashed;
  border-color: var(--blue);
  color: var(--blue);
}

.step-body {
  padding-top: 6px;
}

.step-body h3 {
  font-size: 20px;
}

.step-tag {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-ground);
  color: var(--accent-ink);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 3px;
}

.step-tag--quiet {
  background: var(--surface-sunk);
  color: var(--quiet);
  border: 1px solid var(--line-soft);
}

.step-body p {
  margin-top: 8px;
  max-width: 64ch;
  color: var(--slate);
}

.step-body ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--slate);
}

.freeze-line {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 36px 80px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
}

.freeze-line::before,
.freeze-line::after {
  content: "";
  flex: 1 1 auto;
  border-top: 2px dashed var(--blue);
  opacity: 0.6;
}

/* ---- code ---- */

.code {
  margin: 0;
  padding: 18px 22px;
  border-radius: var(--radius);
  background: var(--code-ground);
  color: var(--code-ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.7;
  overflow-x: auto;
}

.code .tag { color: #6CC0FA; }
.code .attr { color: #9FB0C6; }
.code .val { color: #F5C77A; }
.code .txt { color: #FFFFFF; font-weight: 700; }

/* ---- token and tensor example ---- */

.tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 14px;
}

.tokens span {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-ground);
  color: var(--accent-ink);
}

.tokens span:nth-child(even) {
  background: var(--surface-sunk);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.vector {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 14px;
  border: 2px solid var(--blue);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
}

/* ---- tables ---- */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

thead th {
  background: var(--surface-sunk);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--quiet);
  white-space: nowrap;
}

thead th.num {
  text-align: right;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

tbody th {
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
}

td {
  color: var(--slate);
}

td.num {
  font-family: var(--display);
  font-weight: 600;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

tr.row--hc th,
tr.row--hc td {
  background: var(--accent-ground);
}

tr.row--hc td.num {
  color: var(--accent-ink);
}

/* the comparison matrix */

.matrix th,
.matrix td {
  padding-left: 12px;
  padding-right: 12px;
  text-align: center;
  vertical-align: middle;
}

/* the column headers wrap, so each column is as wide as its marks, not its uppercase title */
.matrix thead th {
  white-space: normal;
  line-height: 1.35;
  vertical-align: bottom;
  text-wrap: balance;
}

.matrix th:first-child,
.matrix td:first-child {
  text-align: left;
}

.matrix tbody th small {
  display: block;
  margin-top: 2px;
  font-family: var(--text);
  font-size: 12.5px;
  font-weight: 400;
  color: var(--quiet);
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.mark::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 18px;
}

.mark--yes { color: var(--good-ink); }
.mark--yes::before {
  background-color: var(--good-ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M5 9.3l2.6 2.6L13 6.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.mark--no { color: var(--quiet); }
.mark--no::before {
  border: 2px solid var(--line);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M6 9h6' fill='none' stroke='%238593A6' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.mark--part { color: var(--accent-ink); }
.mark--part::before {
  border: 2px solid var(--blue);
  background: linear-gradient(90deg, var(--blue) 50%, transparent 50%);
}

.matrix tr.row--hc th,
.matrix tr.row--hc td {
  border-top: 2px solid var(--blue);
}

.table-note {
  margin-top: 8px;
  color: var(--quiet);
  font-size: 13.5px;
}

/* ---- versus: the two failure modes ---- */

.versus {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.versus .card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.versus-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.versus-badge--bad { background: var(--bad-ground); color: var(--bad-ink); }
.versus-badge--good { background: var(--good-ground); color: var(--good-ink); }

.versus .card--keep {
  border: 2px solid var(--blue);
}

/* ---- the FAQ ---- */

.faq {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.faq details[open] {
  box-shadow: var(--shadow);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding: 18px 24px;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "";
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: -4px;
  border-right: 2px solid var(--blue);
  border-bottom: 2px solid var(--blue);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.faq details[open] summary::after {
  margin-top: 4px;
  transform: rotate(-135deg);
}

.faq summary:hover {
  color: var(--link);
}

.faq-body {
  padding: 0 24px 22px;
  max-width: 72ch;
}

.faq-body p {
  color: var(--slate);
}

.faq-body p + p {
  margin-top: 12px;
}

.faq-body p.faq-short {
  color: var(--ink);
  font-weight: 600;
}

/* ---- the footer ---- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--band);
  color: var(--slate);
  font-size: 14.5px;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: 40px;
  padding-top: 56px;
  padding-bottom: 40px;
}

.footer-brand img {
  height: 36px;
  width: auto;
  margin-left: -4px;
}

.footer-brand p {
  max-width: 36ch;
  margin-top: 16px;
}

.footer-col h2 {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--quiet);
}

.footer-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-col a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.footer-col a:hover {
  color: var(--link);
  text-decoration: underline;
}

.footer-base {
  margin: 0;
  padding: 18px 0 28px;
  border-top: 1px solid var(--line-soft);
  color: var(--quiet);
  font-size: 13px;
}

/* the dark-ground logo is shown on the light page only in the dark theme */
.logo-dark { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}

:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }

/* ---- spacing helpers ---- */

.mt-24 { margin-top: 24px; }
.mt-40 { margin-top: 40px; }
.mt-56 { margin-top: 56px; }

/* ---- narrower screens ---- */

@media (max-width: 1080px) {
  .pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 48px; padding-top: 64px; padding-bottom: 72px; }
  .hero-copy { max-width: 720px; }
  .answer { max-width: 640px; }
  .cut { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .nav { display: none; }
  .menu { display: block; }
  .bar-row,
  .bar-cols { grid-template-columns: minmax(0, 1fr) 80px 56px; }
  .bar-row .bar-name { grid-column: 1 / -1; }
  .bar-cols span:first-child { display: none; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .section { padding: 64px 0; }
  .section-head { margin-bottom: 32px; }
  .section-head p:not(.overline) { font-size: 17px; }
  .hero-grid { padding-top: 44px; padding-bottom: 56px; }
  .hero-lead { font-size: 17px; }
  .page-hero .wrap { padding-top: 52px; padding-bottom: 52px; }
  .page-hero p:not(.overline) { font-size: 17px; }
  .pillars,
  .grid-2,
  .grid-3,
  .versus,
  .questions { grid-template-columns: minmax(0, 1fr); }
  .answer-head { flex-wrap: wrap; }
  .answer-foot { grid-template-columns: minmax(0, 1fr); }
  .check + .check { border-left: 0; border-top: 1px solid #E8EDF2; }
  .fraction { grid-template-columns: minmax(0, 1fr); }
  .fraction-label { flex-direction: row; justify-content: flex-start; align-items: baseline; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line-soft); padding: 12px 18px; }
  .chart-head, .bars, .chart-foot { padding-left: 16px; padding-right: 16px; }
  .bar-row { gap: 4px 12px; padding: 8px 4px; }
  .step { grid-template-columns: 44px minmax(0, 1fr); gap: 16px; }
  .step-mark { width: 44px; height: 44px; border-radius: 11px; font-size: 15px; }
  .step:not(:last-child)::before { left: 21px; top: 44px; }
  .freeze-line { margin-left: 0; }
  .cta .wrap { padding-top: 64px; padding-bottom: 64px; }
  .hero-actions .button { flex: 1 1 auto; }
  .faq summary { padding: 16px 18px; font-size: 16px; }
  .faq-body { padding: 0 18px 18px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  th, td { padding: 12px 14px; }

  /* the matrix scrolls sideways inside its frame, and its row names stay in view while it does */
  .matrix { min-width: 700px; }
  .matrix tbody th,
  .matrix thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 150px;
    background: var(--surface);
    box-shadow: 1px 0 0 var(--line-soft);
  }
  .matrix thead th:first-child { background: var(--surface-sunk); }
  .matrix tr.row--hc th { background: var(--accent-ground); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
