:root {
  color-scheme: light;
  --cinder: #111827;
  --crimson: #C23B2B;
  --crimson-dark: #A52E20;
  --teal: #0D9488;
  --teal-ink: #08776C;
  --bib: #F8F9FA;
  --white: #FFFFFF;
  --muted: #49576C;
  --line: #D8DFE7;
  --faint: #EDF1F4;
  --display: "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --body: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --gutter: clamp(16px, 4vw, 56px);
  background: var(--bib);
  color: var(--cinder);
  font-family: var(--body);
  line-height: 1.55;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 0; margin: 0; }
main { min-height: 60vh; }
a { color: inherit; }
a, button, summary { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
svg { max-width: 100%; }
h1, h2, h3 { margin: 0; font-family: var(--display); line-height: 1.04; }
p { margin: 0; }
.page-width { width: min(100% - var(--gutter) * 2, 1300px); margin-inline: auto; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  z-index: 10;
  top: 8px;
  left: 8px;
  transform: translateY(-150%);
  padding: 10px 16px;
  color: var(--cinder);
  background: var(--white);
}
.skip-link:focus { transform: translateY(0); }

.site-header { background: var(--cinder); color: var(--bib); border-bottom: 1px solid #344055; }
.header-inner, .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.header-inner { min-height: 68px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: none;
  font-family: var(--display);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -.035em;
  text-decoration: none;
  white-space: nowrap;
}
.brand svg { flex: none; }
.brand-accent { color: #FF806A; }
.header-inner nav, .footer-inner nav { display: flex; align-items: center; flex-wrap: wrap; gap: clamp(12px, 2.7vw, 36px); }
.header-inner nav a, .footer-inner nav a {
  font-size: .89rem;
  font-weight: 650;
  text-decoration: none;
}
.header-inner nav a:hover, .footer-inner nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.site-footer { background: var(--cinder); color: var(--bib); }
.footer-inner { min-height: 104px; }
.footer-inner > span { color: #B0BDD0; font-size: .87rem; }

.home-hero { border-bottom: 1px solid var(--line); background: var(--white); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .92fr);
  align-items: center;
  gap: clamp(24px, 5vw, 78px);
  padding-block: clamp(34px, 5.8vw, 82px);
}
.hero-copy { min-width: 0; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 15px;
  color: var(--crimson-dark);
  font-family: var(--mono);
  font-size: .76rem;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.eyebrow::before {
  width: 23px;
  height: 11px;
  flex: none;
  content: "";
  background: repeating-linear-gradient(132deg, var(--crimson) 0 4px, transparent 4px 7px);
}
.hero-copy h1 {
  font-size: clamp(3.25rem, 6.45vw, 6.06rem);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: .875;
}
.hero-lede { max-width: 35ch; margin-top: 23px; color: var(--muted); font-size: clamp(1rem, 1.55vw, 1.23rem); }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 13px 24px; margin-top: 24px; }
.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: .91rem;
  line-height: 1.15;
  font-weight: 750;
  text-decoration: none;
}
.btn--primary { background: var(--crimson); color: #fff; }
.btn--primary:hover { background: var(--crimson-dark); }
.btn--quiet { background: var(--white); border-color: var(--line); color: var(--cinder); }
.btn--quiet:hover { border-color: var(--teal-ink); color: var(--teal-ink); }
.text-link {
  color: var(--teal-ink);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: .2em;
  text-decoration-thickness: 1px;
}
.text-link:hover { color: var(--crimson-dark); }
.privacy-line { display: flex; align-items: center; gap: 8px; margin-top: 19px; color: var(--muted); font-size: .81rem; }
.local-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--teal); }

.hero-board {
  position: relative;
  display: block;
  min-width: 0;
  padding: clamp(16px, 3vw, 37px);
  overflow: hidden;
  border-radius: 8px;
  background: var(--cinder);
  border-top: 6px solid var(--crimson);
  color: var(--bib);
  text-decoration: none;
  box-shadow: 8px 8px 0 #DDE7EB;
}
.hero-board::after {
  position: absolute;
  right: -39px;
  top: 44px;
  width: 145px;
  height: 156px;
  transform: rotate(-32deg);
  background: repeating-linear-gradient(90deg, #273247 0 1px, transparent 1px 25px);
  content: "";
  pointer-events: none;
}
.hero-board:hover { border-top-color: var(--teal); }
.board-head, .board-pace, .board-footer { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.board-head {
  justify-content: space-between;
  margin-bottom: 12px;
  color: #B0BDD0;
  font: 700 clamp(.66rem, 1.1vw, .85rem) / 1.2 var(--mono);
  text-transform: uppercase;
  letter-spacing: .055em;
}
.board-tag { color: #51DBC6; border: 1px solid #3A5865; border-radius: 2px; padding: 5px 8px; white-space: nowrap; }
.board-clock {
  position: relative;
  z-index: 1;
  font: 800 clamp(2.9rem, 6.5vw, 6.15rem) / .98 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.085em;
}
.board-pace { margin-top: 10px; gap: clamp(15px, 3vw, 35px); font: 750 clamp(.94rem, 1.36vw, 1.22rem) / 1.3 var(--mono); }
.board-pace small { color: #B0BDD0; font-size: .72em; }
.hero-board > svg { display: block; position: relative; z-index: 1; width: 100%; height: auto; margin-top: 13px; }
.board-footer {
  justify-content: space-between;
  padding-top: 14px;
  color: #EDF1F4;
  font: 650 clamp(.66rem, 1.1vw, .82rem) / 1.2 var(--mono);
}
.board-footer span:first-child { color: #FF806A; }
.board-footer span:nth-child(2) { color: #51DBC6; }

.home-content { padding-block: clamp(30px, 4vw, 60px) 66px; }
.home-section + .home-section { margin-top: 55px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 20px; }
.section-head h2, .page-intro h1, .error-page h1 { letter-spacing: -.03em; }
.section-head h2 { font-size: clamp(2.1rem, 3.3vw, 3.2rem); }
.section-head p { color: var(--muted); font-size: .95rem; }
.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tool-card {
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 170px;
  padding: 16px 18px 17px;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 3px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 130ms ease, background-color 130ms ease;
}
.tool-card:hover { border-color: var(--teal); background: #F3FAF8; }
.tool-icon { display: block; color: var(--teal-ink); height: 35px; }
.card-arrow { position: absolute; right: 17px; top: 14px; color: var(--crimson-dark); font: 750 1.1rem var(--mono); }
.card-category { color: var(--muted); font: 650 .68rem var(--mono); letter-spacing: .035em; text-transform: uppercase; }
.tool-card h3 { font-size: clamp(1.34rem, 1.72vw, 1.75rem); letter-spacing: -.02em; }
.tool-card p { color: var(--muted); font-size: .89rem; }
.example-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 10px 15px; }
.example-group { background: var(--white); border: 1px solid var(--line); border-radius: 5px; }
.example-group summary { padding: 14px 15px; font-weight: 750; }
.example-group summary::marker { color: var(--teal-ink); }
.example-group summary span { float: right; color: var(--muted); font: 650 .8rem/1.8 var(--mono); }
.example-group .example-links { margin: 0 14px 14px; }

.tool-page, .info-page { padding-block: 18px 62px; }
.breadcrumbs { margin: 0 0 20px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 9px; margin: 0; padding: 0; list-style: none; }
.breadcrumbs li { color: var(--muted); font-size: .79rem; min-width: 0; overflow-wrap: anywhere; }
.breadcrumbs li + li::before { content: "/"; margin-right: 9px; color: #76869B; }
.breadcrumbs a { color: var(--teal-ink); text-underline-offset: .17em; }
.page-intro { padding: 14px 0 27px; max-width: 1030px; }
.page-intro .eyebrow { margin-bottom: 11px; }
.page-intro h1, .error-page h1 { font-size: clamp(2.67rem, 5.15vw, 4.75rem); font-weight: 700; overflow-wrap: anywhere; }
.page-intro > p:not(.eyebrow), .error-page > p:not(.eyebrow) {
  max-width: 68ch;
  margin-top: 13px;
  color: var(--muted);
  font-size: clamp(.99rem, 1.5vw, 1.16rem);
}
.workbench {
  display: grid;
  grid-template-columns: minmax(265px, 1fr) minmax(0, 2.36fr);
  align-items: start;
  gap: clamp(14px, 2.2vw, 28px);
}
.control-rail, .readout {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: clamp(14px, 2.6vw, 28px);
}
.control-rail { border-top: 4px solid var(--crimson); }
.readout { border-top: 4px solid var(--teal); }
.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  margin-bottom: 15px;
}
.pane-head h2 { font-size: 1.83rem; letter-spacing: -.025em; }
.readout-mark { width: 28px; height: 14px; background: repeating-linear-gradient(132deg, var(--teal) 0 4px, transparent 4px 7px); }
.units { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--faint); }
.units button {
  min-height: 30px;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: 700 .76rem var(--mono);
}
.units button[aria-pressed=true] { border-color: var(--teal-ink); background: var(--teal-ink); color: var(--white); }
.quick-result { display: none; }
.tool-form { min-width: 0; }
.tool-form fieldset {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0 0 14px;
  padding: 12px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.tool-form fieldset legend {
  padding: 0 7px 0 0;
  color: var(--muted);
  font: 750 .7rem var(--mono);
  letter-spacing: .045em;
  text-transform: uppercase;
}
.field { display: grid; min-width: 0; gap: 3px; }
.field label, .share-box label { font-size: .88rem; font-weight: 700; }
.input-wrap { position: relative; min-width: 0; }
.input-wrap > input, .input-wrap > select, .input-wrap > textarea, .share-box input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: 8px 9px;
  border: 1px solid #BCC7D3;
  border-radius: 4px;
  background: var(--bib);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.input-wrap:has([data-suffix]) > input { padding-right: 81px; }
.input-wrap > input[type=number] { appearance: textfield; }
.input-wrap > input::-webkit-inner-spin-button, .input-wrap > input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.input-wrap > textarea { resize: vertical; font-family: var(--mono); font-size: .79rem; }
.input-wrap > select { text-overflow: ellipsis; }
[data-suffix] {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  color: var(--muted);
  font: 650 .72rem var(--mono);
  pointer-events: none;
}
.field-hint, .clock-help { color: var(--muted); font-size: .78rem; line-height: 1.45; }
[aria-invalid=true] { border-color: var(--crimson) !important; }
.form-actions, .export-bar { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.share-box { display: grid; gap: 4px; margin-top: 13px; }
.share-box input { font-family: var(--mono); font-size: .78rem; }
.control-rail .privacy-line { border-top: 1px solid var(--line); padding-top: 13px; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 0 0 15px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 5px;
}
.stat { display: grid; align-content: start; gap: 4px; padding: 10px 12px 11px; background: var(--bib); }
.stat:first-child { background: #E5F3F0; }
.stat dt { color: var(--muted); font-size: .74rem; font-weight: 750; }
.stat dd { margin: 0; }
.stat [data-stat] {
  color: var(--cinder);
  font: 800 clamp(1.25rem, 2.1vw, 2rem) / 1.07 var(--mono);
  letter-spacing: -.06em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat:first-child [data-stat] { color: var(--teal-ink); }
.stat .stat-suffix { color: var(--muted); font-size: .73rem; overflow-wrap: anywhere; }
.result-figure { margin: 0 0 15px; }
.result-figure svg { display: block; width: 100%; height: auto; border-radius: 4px; }
.result-figure figcaption, .result-note { margin: 6px 0 0; color: var(--muted); font-size: .83rem; overflow-wrap: anywhere; }
.result-note { padding-left: 10px; border-left: 2px solid var(--teal); }
.table-section { margin-top: 22px; }
.table-section h3 { margin-bottom: 8px; font-size: 1.27rem; }
.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { background: var(--cinder); color: var(--bib); font-weight: 750; white-space: nowrap; }
tbody th { font-weight: 650; min-width: 80px; max-width: 200px; overflow-wrap: anywhere; }
tbody td { color: var(--muted); }
tbody td:only-child { white-space: normal; }
tbody tr:nth-child(even) { background: #F2F5F7; }
tbody tr:last-child > * { border-bottom: 0; }
.stat-suffix:empty, .action-status:empty { display: none; }
.status-error { border-left: 3px solid var(--crimson); padding: 12px; background: #FFF0EE; color: #802316; }
.action-status { min-height: 1.2em; margin-top: 9px; color: var(--teal-ink); font-size: .83rem; }
.print-band { display: none; }

.editorial-stack { display: grid; gap: 35px; width: min(100%, 860px); margin-top: 35px; }
.editorial { min-width: 0; }
.editorial h2 { margin-bottom: 11px; font-size: clamp(1.75rem, 3.4vw, 2.48rem); letter-spacing: -.028em; }
.editorial h3 { margin: 17px 0 5px; font-size: 1.2rem; }
.editorial p { max-width: 76ch; color: var(--muted); overflow-wrap: anywhere; }
.editorial p + p { margin-top: 9px; }
.reference-list { margin: 0; padding-left: 21px; color: var(--teal-ink); font-size: .9rem; }
.reference-list li + li { margin-top: 4px; }
.limits { margin-top: 14px; border-left: 3px solid var(--teal); padding: 11px 13px; background: #E9F3F2; font-size: .9rem; }
.worked-math { display: grid; gap: 7px; padding-left: 23px; margin: 0 0 10px; }
.worked-math li { padding-left: 5px; }
.worked-math li::marker { color: var(--crimson-dark); font: 800 .85rem var(--mono); }
.faq-list { border-top: 1px solid var(--line); }
.faq-list details { padding: 11px 0 12px; border-bottom: 1px solid var(--line); }
.faq-list summary { font-weight: 750; }
.faq-list summary::marker { color: var(--teal-ink); }
.faq-list p { padding: 7px 0 0 15px; }
.example-links { list-style: none; margin: 0 0 17px; padding: 0; }
.example-links li { border-bottom: 1px solid var(--line); }
.example-links a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 3px;
  color: var(--teal-ink);
  font-size: .93rem;
  font-weight: 650;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.example-links a:hover { color: var(--crimson-dark); text-decoration: underline; text-underline-offset: 3px; }
.example-links a span { flex: none; font-family: var(--mono); }
.info-page .editorial-stack { margin-top: 0; }
.error-page { padding-block: 65px; }
.error-page .btn { margin-top: 17px; }

@media (max-width: 1020px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 699px) {
  .header-inner { flex-wrap: wrap; justify-content: space-between; gap: 5px 15px; padding-block: 11px; }
  .header-inner nav { gap: 9px 15px; }
  .header-inner nav a { font-size: .8rem; }
  .brand { font-size: 23px; }
  .brand svg { width: 30px; height: 30px; }
  .hero-grid, .workbench, .example-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-grid { gap: 22px; }
  .hero-copy h1 { font-size: clamp(3.08rem, 9vw, 4.9rem); }
  .hero-board { max-width: 515px; box-shadow: 4px 4px 0 #DDE7EB; }
  .board-clock { font-size: clamp(3.4rem, 11vw, 5.3rem); }
  .home-section + .home-section { margin-top: 37px; }
  .tool-card { min-height: 156px; padding-inline: 12px; }
  .tool-card p { font-size: .82rem; }
  .footer-inner { display: grid; justify-content: start; gap: 13px; padding-block: 21px; }
  .page-intro { padding-bottom: 20px; }
  .page-intro h1 { font-size: clamp(2.3rem, 8vw, 3.7rem); }
  .tool-page { padding-top: 12px; }
  .breadcrumbs { margin-bottom: 9px; }
  .control-rail .privacy-line { margin-top: 13px; }
  .quick-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 13px;
    background: #E5F3F0;
    border-left: 2px solid var(--teal);
    font-size: .8rem;
  }
  .quick-result strong, .quick-result small { display: block; }
  .quick-result strong { color: var(--teal-ink); font-family: var(--mono); }
  .quick-result a { color: var(--teal-ink); font-weight: 700; text-underline-offset: 3px; }
  th, td { padding: 7px 8px; }
}

@media (max-width: 350px) {
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .board-head { letter-spacing: 0; }
}

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

@page { size: A4; margin: 13mm; }
@media print {
  :root, body { background: white; color: black; }
  .site-header, .site-footer, .skip-link, .breadcrumbs, .control-rail, .editorial-stack,
  .readout .pane-head, .export-bar, .action-status, .status-error { display: none !important; }
  .page-width { width: 100%; }
  .tool-page, .page-intro, .readout { padding: 0; }
  .page-intro { margin-bottom: 4mm; }
  .page-intro .eyebrow, .page-intro > p { display: none; }
  .page-intro h1 { font-size: 26pt; }
  .workbench { display: block; }
  .readout { border: 0; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .result-figure, .stat, tr { break-inside: avoid; }
  .result-figure svg { max-height: 70mm; }
  .table-scroll { overflow: visible; }
  table { table-layout: fixed; }
  th, td { min-width: 0; max-width: none; overflow-wrap: anywhere; }
  tbody th { min-width: 0; max-width: none; }
  thead { display: table-header-group; }
  thead th { background: white; color: black; white-space: normal; }
  th, td { padding: 4px 5px; font-size: 9pt; }
  body:has([data-tool=splits]) .page-intro { display: none; }
  [data-tool=splits] [data-output] > :not(.print-band) { display: none; }
  .print-band { display: block; margin: 0; break-inside: avoid; }
  .print-band svg { display: block; width: 100%; height: auto; }
}
