:root {
  color-scheme: light;
  --paper: #f4f1e9;
  --card: #fffdf8;
  --ink: #1f292c;
  --muted: #555d59;
  --border: #d6d0c1;
  --strong: #a7a494;
  --blue: #164873;
  --blue-deep: #1e3a8a;
  --blue-soft: #e9eff2;
  --amber: #b45309;
  --amber-bright: #ca8a04;
  --amber-soft: #f7eddb;
  --ok: #265d46;
  --ok-paper: #e8f0e8;
  --danger: #963d20;
  --dark-sheet: #26383e;
  --sheet-ink: #f7f5eb;
  --sheet-faint: #a9babd;
  --d-paper: #f8f8f1;
  --d-grid: #e3e5d9;
  --d-line: #758787;
  --d-ink: #25383b;
  --d-blue: #174d7a;
  --d-warm: #985006;
  --d-asphalt: #35474b;
  --d-base: #c2d5d9;
  --d-soil: #dad1b5;
  --d-roadbed: #e8dfc9;
  --d-cool: #739da9;
  --d-slab: #d9e3e1;
  --d-amber: #e3b65d;
  --d-ice: #a1c7d7;
  --sans: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --page: 1264px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #202a2b;
  --card: #283537;
  --ink: #f4f0df;
  --muted: #c5c8bb;
  --border: #455252;
  --strong: #7e8f88;
  --blue: #a8d2ef;
  --blue-deep: #aec4fa;
  --blue-soft: #344b56;
  --amber: #f0b461;
  --amber-bright: #efb64c;
  --amber-soft: #4d3c29;
  --ok: #b3dabf;
  --ok-paper: #314b43;
  --danger: #ffba99;
  --dark-sheet: #192628;
  --d-paper: #253437;
  --d-grid: #314448;
  --d-line: #a3b9b9;
  --d-ink: #f2f2e3;
  --d-blue: #c0e1ff;
  --d-warm: #f2be6d;
  --d-asphalt: #3b5156;
  --d-base: #5b7780;
  --d-soil: #74674b;
  --d-roadbed: #655d4b;
  --d-cool: #8bb4ca;
  --d-slab: #4d6769;
  --d-amber: #cca657;
  --d-ice: #4d798f;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 1rem; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 1rem; line-height: 1.55; }
a { color: var(--blue); text-underline-offset: 0.19em; }
a:hover { color: var(--amber); }
h1, h2, h3, p, figure { margin: 0; }
p + p { margin-top: 0.75rem; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.035em; }
svg { max-width: 100%; }
button, input, select { font: inherit; }
button { color: inherit; }
button, select, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.48; }
:is(a, button, input, summary, select):focus-visible, [tabindex="-1"]:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }
.container { width: min(var(--page), calc(100% - 5rem)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 9; top: 0.5rem; left: 1rem; padding: 0.6rem 1rem; background: var(--card); transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.mono, .eyebrow, .tag { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.site-header { border-bottom: 1px solid var(--strong); background: var(--card); }
.header-inner { min-height: 67px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: 0.65rem; color: var(--ink); text-decoration: none; font-size: 1.16rem; font-weight: 750; letter-spacing: -0.04em; white-space: nowrap; }
.brand-mark { flex: none; width: 38px; height: 38px; }
.brand-mark rect { fill: var(--dark-sheet); }
.brand-mark path { fill: none; stroke: #f4f0df; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark .brand-stripe { stroke: #e6ac4d; stroke-width: 1.75; stroke-dasharray: 3 3; }
.header-tools, .desktop-nav { display: flex; align-items: center; gap: 1.5rem; }
.desktop-nav a { font-size: 0.9rem; font-weight: 650; color: var(--muted); text-decoration: none; }
.desktop-nav a:hover { color: var(--blue); text-decoration: underline; }
.theme-button, .mobile-menu summary { min-width: 43px; min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 0.42rem; padding: 0.35rem 0.65rem; border: 1px solid var(--border); border-radius: 4px; background: var(--card); color: var(--ink); }
.theme-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.theme-button:hover, .mobile-menu summary:hover { background: var(--blue-soft); border-color: var(--strong); }
.mobile-menu { display: none; position: relative; }
.mobile-menu summary { list-style: none; font-size: 0.875rem; font-weight: 650; }
.mobile-menu summary::-webkit-details-marker { display: none; }
.menu-links { position: absolute; z-index: 5; top: calc(100% + 0.45rem); right: 0; width: min(80vw, 14rem); display: grid; gap: 0.2rem; padding: 0.45rem; border: 1px solid var(--strong); background: var(--card); box-shadow: 0 8px 24px #1116; }
.menu-links a { display: flex; align-items: center; min-height: 42px; padding: 0.4rem 0.75rem; color: var(--ink); text-decoration: none; }
.menu-links a:hover { background: var(--blue-soft); }

.site-footer { margin-top: 4.2rem; border-top: 1px solid var(--strong); background: var(--card); }
.footer-inner { min-height: 100px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem 1.5rem; padding-block: 1.25rem; }
.footer-note { color: var(--muted); font-size: 0.87rem; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.3rem; font-size: 0.88rem; align-items: center; }
.footer-inner nav a { padding-block: 0.45rem; }

.eyebrow { color: var(--amber); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.095em; font-weight: 750; }
.eyebrow::before { content: ""; display: inline-block; width: 1.23rem; height: 0.18rem; vertical-align: middle; background: var(--amber-bright); margin-right: 0.55rem; }
.button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 0.42rem; padding: 0.5rem 0.84rem; border: 1px solid var(--border); border-radius: 4px; color: var(--ink); background: var(--card); text-decoration: none; font-weight: 700; font-size: 0.875rem; text-align: center; }
.button:hover { color: var(--blue); background: var(--blue-soft); border-color: var(--strong); }
.button.primary { background: var(--dark-sheet); color: var(--sheet-ink); border-color: var(--dark-sheet); }
.button.primary:hover { background: #0f4c81; }
.button svg { flex: none; width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.home-hero { display: grid; grid-template-columns: minmax(0, 1.035fr) minmax(0, 1fr); align-items: center; gap: 4.3%; padding-block: 3.5rem 3.1rem; border-bottom: 1px solid var(--strong); }
.hero-copy h1 { font-size: clamp(2.65rem, 4.25vw, 4.2rem); font-weight: 700; line-height: 1.02; margin: 0.6rem 0 1.05rem; letter-spacing: -0.049em; }
.hero-copy h1 span { color: var(--blue); }
.hero-copy .intro { max-width: 34rem; color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.15rem); }
.hero-actions { display: flex; gap: 0.65rem; flex-wrap: wrap; margin-top: 1.55rem; }
.hero-sheet { min-width: 0; overflow: hidden; border: 1px solid var(--strong); background: var(--dark-sheet); color: var(--sheet-ink); border-radius: 5px; }
.hero-sheet svg { display: block; width: 100%; height: auto; }
.hero-sheet figcaption { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.64rem 0.98rem; border-top: 1px solid #4c6064; color: var(--sheet-faint); font-size: 0.79rem; }
.hero-sheet figcaption strong { color: var(--sheet-ink); font-size: 0.82rem; }
.hero-sheet figcaption span { text-align: right; }
.hero-markup .hero-grid { stroke: #415358; fill: none; stroke-width: 0.7; }
.hero-markup .hero-rule { stroke: #9cb1b4; fill: none; stroke-width: 1; }
.hero-markup text { font-family: var(--mono); font-size: 14px; fill: #d8e2db; font-weight: 600; }
.hero-markup .hero-kicker { font-size: 15px; fill: #edbd68; letter-spacing: 1.4px; }

.home-section { margin-top: 2.45rem; }
.section-header { display: flex; align-items: end; justify-content: space-between; gap: 1.2rem; margin-bottom: 1.15rem; }
.section-header h2, .worked h2 { font-size: clamp(1.75rem, 3.2vw, 2.42rem); }
.section-header p { color: var(--muted); }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.82rem; }
.tool-card { display: flex; min-width: 0; flex-direction: column; gap: 0.5rem; padding: 1rem; border: 1px solid var(--border); border-top: 2px solid var(--line-color, var(--blue)); border-radius: 4px; color: var(--ink); text-decoration: none; background: var(--card); }
.tool-card:hover { background: var(--blue-soft); color: var(--ink); border-color: var(--blue); }
.tool-card h3 { font-size: 1.18rem; min-height: 2.65rem; display: flex; align-items: end; font-weight: 760; }
.tool-card p { font-size: 0.88rem; color: var(--muted); }
.tool-card .card-top { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; min-height: 37px; }
.tool-card .card-icon { width: 40px; height: 36px; flex: none; }
.tool-card .card-icon path { stroke: var(--blue); stroke-width: 1.5; fill: none; stroke-linecap: square; stroke-linejoin: round; }
.tool-card .card-icon .icon-highlight { stroke: var(--amber); }
.tool-card .tag { color: var(--blue); font-size: 0.75rem; line-height: 1.2; text-align: right; }
.tool-card.heavy { --line-color: var(--amber-bright); }
.case-index { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 0.6rem; }
.case-group { background: var(--card); border: 1px solid var(--border); border-radius: 4px; min-width: 0; }
.case-group > summary, .details-box > summary { min-height: 46px; display: flex; justify-content: space-between; gap: 0.75rem; align-items: center; list-style: none; font-weight: 700; padding: 0.55rem 0.88rem; }
.case-group > summary::-webkit-details-marker, .details-box > summary::-webkit-details-marker { display: none; }
.case-group > summary::after, .details-box > summary::after { content: "+"; font-family: var(--mono); font-weight: 700; color: var(--blue); }
.case-group[open] > summary::after, .details-box[open] > summary::after { content: "−"; }
.case-list { list-style: none; margin: 0; padding: 0.2rem 0.9rem 0.7rem; }
.case-list a { display: flex; min-height: 40px; align-items: center; text-decoration: none; border-top: 1px solid var(--border); font-size: 0.92rem; }
.case-list a:hover { text-decoration: underline; }
.case-list a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.count { margin-left: auto; color: var(--muted); font: 0.8rem var(--mono); }

.calc-head { padding-block: 1.35rem 1.26rem; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0.34rem 0.6rem; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.62rem; }
.breadcrumb a { padding-block: 0.12rem; text-decoration-color: var(--strong); }
.calc-head h1 { font-size: clamp(2rem, 3.6vw, 3.3rem); font-weight: 700; letter-spacing: -0.042em; }
.calc-head .intro { max-width: 49rem; color: var(--muted); margin-top: 0.52rem; }
.calc-links { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-top: 0.7rem; }
.calc-links .tag { color: var(--blue); background: var(--blue-soft); border: 1px solid var(--border); border-radius: 3px; padding: 0.24rem 0.48rem; font-size: 0.78rem; }
.calc-links .work-jump { font-size: 0.84rem; padding: 0.35rem 0.1rem; }
.calc-links .mobile-jump { display: none; }
.workspace { display: grid; grid-template-columns: minmax(0, 0.52fr) minmax(0, 1fr); grid-template-areas: "inputs result"; gap: 1.04rem; align-items: start; }
.inputs { grid-area: inputs; padding: 0.9rem 1.05rem 0.9rem; }
.readout { grid-area: result; padding: 0.9rem 1rem 1rem; min-width: 0; }
.panel { border: 1px solid var(--border); border-top: 3px solid var(--blue); border-radius: 5px; background: var(--card); min-width: 0; }
.inputs.panel { border-top-color: var(--amber-bright); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 0.45rem; min-height: 42px; margin-bottom: 0.68rem; }
.panel-heading h2 { font-size: clamp(1.25rem, 2.1vw, 1.6rem); }
.panel-heading p { color: var(--muted); font-size: 0.82rem; }
.unit-switch { display: inline-flex; flex: none; padding: 2px; border: 1px solid var(--border); background: var(--paper); border-radius: 5px; }
.unit-switch button { min-width: 42px; min-height: 40px; padding: 0.25rem 0.45rem; background: transparent; border: 1px solid transparent; border-radius: 3px; color: var(--muted); font: 700 0.83rem var(--mono); }
.unit-switch button[aria-pressed="true"] { color: var(--ink); background: var(--card); border-color: var(--strong); }
.unit-switch button:hover { color: var(--blue); }
.form-group { position: relative; border: 0; border-top: 1px solid var(--border); margin: 0 0 0.85rem; padding: 0.5rem 0 0; min-inline-size: 0; }
.form-group:last-child { margin-bottom: 0; }
.form-group legend { font-weight: 760; font-size: 0.9rem; padding: 0 0.45rem 0 0; color: var(--blue); }
.group-note { color: var(--muted); font-size: 0.82rem; margin: 0.4rem 0 0.15rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.59rem 0.65rem; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 0.21rem; justify-content: end; }
.field.wide { grid-column: 1 / -1; }
.field label { display: block; color: var(--ink); font-weight: 680; font-size: 0.86rem; line-height: 1.3; }
.control { position: relative; min-width: 0; display: flex; align-items: center; border: 1px solid var(--strong); border-radius: 4px; background: var(--card); }
.control:focus-within { box-shadow: 0 0 0 2px var(--blue); }
.control:has([aria-invalid="true"]) { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.control :is(input, select) { background: transparent; border: 0; border-radius: 4px; color: var(--ink); min-width: 0; width: 100%; min-height: 43px; padding: 0.43rem 0.55rem; outline: 0; }
.control input { font: 650 0.95rem var(--mono); appearance: textfield; }
.control input::-webkit-inner-spin-button, .control input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.control select { appearance: none; font-weight: 650; font-size: 0.88rem; padding-right: 1.5rem; }
.control select option { color: var(--ink); background: var(--card); }
.select-control::after { content: ""; position: absolute; pointer-events: none; right: 0.59rem; top: calc(50% - 0.18rem); width: 0.43rem; height: 0.43rem; border-right: 1.5px solid var(--blue); border-bottom: 1.5px solid var(--blue); transform: rotate(45deg); }
.field-unit { display: inline-block; font: 0.73rem var(--mono); white-space: nowrap; color: var(--muted); margin-right: 0.45rem; pointer-events: none; }
.field:not(.wide) .field-unit { max-width: 59%; }
.field-unit:empty { display: none; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; margin: 0 0 0.75rem; }
.kpi { min-width: 0; min-height: 81px; padding: 0.56rem 0.65rem 0.5rem; border: 1px solid var(--border); border-top: 2px solid var(--line-color, var(--blue)); background: var(--blue-soft); border-radius: 3px; }
.kpi:nth-child(4) { --line-color: var(--amber-bright); background: var(--amber-soft); }
.kpi dt { white-space: nowrap; font: 700 0.75rem var(--mono); letter-spacing: 0.025em; color: var(--muted); text-transform: uppercase; }
.kpi dd { margin: 0; font: 740 clamp(1.14rem, 2.12vw, 1.78rem)/1.17 var(--mono); letter-spacing: -0.08em; overflow-wrap: anywhere; color: var(--ink); }
.kpi dd[title] { text-decoration: none; }
.kpi-unit { display: block; color: var(--muted); min-height: 1.1rem; font: 0.73rem var(--mono); margin-top: 0.13rem; }
.figure-card { overflow: hidden; border: 1px solid var(--border); border-radius: 4px; background: var(--d-paper); }
.anatomy-svg { display: block; width: 100%; height: auto; }
.figure-card > figcaption { padding: 0.55rem 0.72rem; background: var(--paper); color: var(--muted); border-top: 1px solid var(--border); font-size: 0.8rem; }
.svg-error { min-height: 11rem; padding: 1rem; display: grid; place-content: center; text-align: center; color: var(--danger); }
.diagram-title { margin-bottom: 0.35rem; color: var(--blue); font-size: 0.93rem; font-weight: 760; }
.check { display: grid; gap: 0.2rem; margin-top: 0.63rem; padding: 0.58rem 0.7rem; border: 1px solid var(--border); border-left: 3px solid var(--blue); background: var(--blue-soft); border-radius: 3px; }
.check[data-state="met"] { border-left-color: var(--ok); background: var(--ok-paper); }
.check[data-state="review"] { border-left-color: var(--amber); background: var(--amber-soft); }
.check[data-state="invalid"] { border-left-color: var(--danger); background: var(--amber-soft); }
.check-title { font-size: 0.93rem; font-weight: 760; letter-spacing: -0.02em; }
.check-detail { font-size: 0.83rem; color: var(--muted); }
.meter-svg { display: block; width: 100%; height: 16px; }
.actions { margin-top: 0.74rem; display: flex; flex-wrap: wrap; gap: 0.38rem; }
.actions .button { flex: 1 0 auto; }
.action-status { min-height: 1.2rem; color: var(--blue); margin-top: 0.25rem; font-size: 0.83rem; }
.share-box { margin-top: 0.6rem; font-size: 0.86rem; background: var(--paper); padding: 0.58rem; border: 1px solid var(--border); border-radius: 4px; }
.share-box label { display: block; font-weight: 650; }
.share-box input { margin-top: 0.25rem; width: 100%; min-height: 43px; font: 0.82rem var(--mono); background: var(--card); color: var(--ink); border: 1px solid var(--strong); border-radius: 4px; padding: 0.48rem; }
.details-box { margin-top: 0.4rem; border: 1px solid var(--border); border-radius: 4px; }
.ledger { margin: 0; padding: 0 0.86rem 0.5rem; }
.ledger > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(6.5rem, auto); align-items: start; gap: 0.65rem; border-top: 1px solid var(--border); padding: 0.36rem 0; }
.ledger dt { font-size: 0.89rem; color: var(--muted); }
.ledger dd { text-align: right; margin: 0; font: 700 0.86rem/1.55 var(--mono); }

.worked { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; gap: 1rem; margin-top: 1.1rem; }
.worked .panel { padding: 1rem 1.15rem; }
.worked h2 { font-size: 1.55rem; margin-bottom: 0.52rem; }
.worked p, .worked li { color: var(--muted); }
.worked ol { margin: 0.5rem 0 0.6rem; padding-left: 1.3rem; }
.worked li { padding-left: 0.19rem; margin: 0.3rem 0; }
.worked .example-tip { border-left: 2px solid var(--amber-bright); padding-left: 0.65rem; color: var(--ink); }
.worked .case-list { padding: 0; }
.worked .case-list a { min-height: 42px; }
.worked .case-list li { padding-left: 0; margin: 0; }

.prose { max-width: 900px; padding: 1.2rem 0 0; }
.prose > header { border-bottom: 1px solid var(--strong); padding-bottom: 1rem; }
.prose h1 { font-size: clamp(2.35rem, 4.9vw, 4rem); margin: 0.33rem 0 0.6rem; }
.prose h2 { font-size: 1.55rem; margin-bottom: 0.65rem; }
.prose section { padding: 1.25rem 0; border-bottom: 1px solid var(--border); }
.prose section p { color: var(--muted); }
.prose .equation { border-left: 2px solid var(--amber-bright); padding: 0.55rem 0.75rem; background: var(--card); color: var(--ink); font: 0.86rem/1.6 var(--mono); overflow-wrap: anywhere; margin-block: 0.6rem; }
.prose .source { font-size: 0.92rem; margin-top: 0.65rem; }
.prose .method-index { padding: 0.75rem 0 0; display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; }
.prose .method-index a { display: inline-flex; min-height: 40px; align-items: center; font-size: 0.88rem; }

.d-paper { fill: var(--d-paper); }
.d-grid { fill: none; stroke: var(--d-grid); stroke-width: 1; }
.d-label, .d-value, .d-micro, .d-warm-value, .d-white { font-family: var(--mono); font-variant-numeric: tabular-nums; fill: var(--d-ink); font-weight: 700; }
.d-label, .d-white { font-size: 17px; }
.d-value, .d-warm-value { font-size: 19px; letter-spacing: -0.45px; }
.d-value { fill: var(--d-blue); }
.d-warm-value { fill: var(--d-warm); }
.d-micro { font-size: 14px; letter-spacing: 0.35px; }
.d-white { fill: #f8f5e9; }
.d-line, .d-hair, .d-measure, .d-road-lines, .d-dash, .d-joint-hatch, .d-frost-front, .d-aggregate, .d-lane-marker { fill: none; stroke: var(--d-line); stroke-width: 1.4; }
.d-hair { stroke-width: 0.9; }
.d-measure { stroke: var(--d-blue); stroke-width: 1.12; }
.d-dash { stroke-dasharray: 5 5; }
.d-joint-hatch, .d-aggregate { stroke-width: 1.05; }
.d-frost-front { stroke: var(--amber); stroke-width: 2; stroke-dasharray: 5 5; }
.d-road-lines { stroke: var(--d-blue); stroke-width: 2; }
.d-lane-marker { stroke: #f7edcf; stroke-dasharray: 7 9; stroke-width: 1.4; }
.d-asphalt { fill: var(--d-asphalt); }
.d-base { fill: var(--d-base); stroke: var(--d-line); stroke-width: 0.55; }
.d-soil { fill: var(--d-soil); }
.d-roadbed { fill: var(--d-roadbed); }
.d-concrete { fill: var(--d-slab); stroke: var(--d-line); stroke-width: 1.1; }
.d-void { fill: var(--d-paper); stroke: var(--d-line); stroke-width: 0.85; stroke-dasharray: 3 5; }
.d-air { fill: var(--d-paper); stroke: var(--d-line); stroke-width: 0.85; }
.d-ice { fill: var(--d-ice); opacity: 0.67; }
.d-dowel { fill: var(--d-asphalt); }
.d-steel { fill: var(--d-cool); }
.d-amber { fill: var(--d-amber); }
.d-milling { fill: var(--d-amber); stroke: var(--d-warm); stroke-width: 1.25; stroke-dasharray: 5 5; }
.d-tack { fill: var(--d-amber); opacity: 0.64; }
.d-truck { fill: var(--d-cool); stroke: var(--d-ink); stroke-width: 1.2; }
.d-point { fill: var(--d-blue); }
.d-signal { fill: var(--d-amber); }
.d-stress-spot { fill: var(--d-paper); stroke: var(--d-blue); stroke-width: 1.45; }
.d-track { fill: var(--border); }
.d-meter-band { fill: var(--ok); opacity: 0.3; }
.d-meter-tick, .d-meter-marker { fill: none; stroke: var(--blue); stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.d-meter-marker { stroke: var(--amber); stroke-width: 3; }

.print-sheet { display: none; }

@media (min-width: 820px) {
  .calc-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "crumb crumb" "heading heading" "lead links";
    align-items: end;
    gap: 0.48rem 1.4rem;
    padding-block: 1.15rem 1.05rem;
  }
  .calc-head .breadcrumb { grid-area: crumb; margin-bottom: 0; }
  .calc-head h1 { grid-area: heading; }
  .calc-head .intro { grid-area: lead; max-width: 58rem; margin-top: 0; }
  .calc-links { grid-area: links; justify-content: flex-end; margin-top: 0; }
  .figure-card .anatomy-svg { max-height: 305px; }
}
@media (max-width: 1099px) {
  .container { width: calc(100% - 3.25rem); }
  .hero-copy h1 { font-size: clamp(2.6rem, 5.05vw, 4rem); }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-card h3 { min-height: auto; }
  .kpi { padding-inline: 0.44rem; }
  .kpi dt { font-size: 0.7rem; letter-spacing: 0; }
}
@media (max-width: 819px) {
  .container { width: calc(100% - 2rem); }
  .header-inner { min-height: 59px; gap: 0.55rem; }
  .header-tools { gap: 0.4rem; }
  .desktop-nav { display: none; }
  .mobile-menu { display: block; }
  .home-hero { grid-template-columns: minmax(0, 1fr); gap: 1.45rem; padding-block: 2rem 1.8rem; }
  .hero-copy h1 { font-size: clamp(2.05rem, 8.8vw, 4.1rem); }
  .hero-sheet { max-width: 640px; }
  .section-header { align-items: start; flex-direction: column; gap: 0.3rem; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-areas: "result" "inputs"; }
  .calc-links .mobile-jump { display: inline-flex; min-height: 42px; align-items: center; }
  .calc-head { padding-block: 0.86rem 0.75rem; }
  .worked { grid-template-columns: minmax(0, 1fr); }
  .readout { padding: 0.65rem 0.72rem 0.75rem; }
  .inputs { padding: 0.85rem 0.8rem; }
  .kpi dd { font-size: clamp(1.12rem, 4.75vw, 1.75rem); }
  .site-footer { margin-top: 2.5rem; }
}
@media (max-width: 510px) {
  .home-section { margin-top: 1.9rem; }
  .hero-sheet figcaption { font-size: 0.72rem; padding-inline: 0.6rem; }
  .tool-grid { gap: 0.51rem; }
  .tool-card { padding: 0.65rem; }
  .tool-card h3 { font-size: 1.03rem; }
  .tool-card p { font-size: 0.82rem; line-height: 1.42; }
  .tool-card .card-icon { width: 32px; height: 30px; }
  .tool-card .tag { font-size: 0.65rem; }
  .case-index { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem; margin-bottom: 0.48rem; }
  .kpi { padding: 0.34rem 0.52rem; min-height: 65px; }
  .kpi dt { font-size: 0.71rem; }
  .kpi-unit { font-size: 0.69rem; min-height: 0.86rem; }
  .panel-heading { margin-bottom: 0.45rem; }
  .figure-card > figcaption { padding: 0.38rem 0.49rem; }
  .calc-links { column-gap: 0.5rem; }
  .calc-links .work-jump, .calc-links .tag { font-size: 0.76rem; }
  .actions .button { padding-inline: 0.56rem; }
  .control :is(input, select) { font-size: 1rem; }
}
@media (max-width: 355px) {
  .container { width: calc(100% - 1.44rem); }
  .brand { font-size: 1.01rem; gap: 0.38rem; }
  .brand-mark { width: 31px; height: 31px; }
  .hero-copy h1 { font-size: 1.945rem; }
  .actions { gap: 0.28rem; }
  .ledger > div { grid-template-columns: minmax(0, 1fr) minmax(4.6rem, auto); }
}

@page { size: A4; margin: 12mm; }
@media print {
  :root, :root[data-theme="dark"] {
    color-scheme: light;
    --d-paper: #fbfaf5;
    --d-grid: #e3e5d9;
    --d-line: #758787;
    --d-ink: #263339;
    --d-blue: #174d7a;
    --d-warm: #985006;
    --d-asphalt: #35474b;
    --d-base: #c2d5d9;
    --d-soil: #dad1b5;
    --d-roadbed: #e8dfc9;
    --d-cool: #739da9;
    --d-slab: #d9e3e1;
    --d-amber: #e3b65d;
    --d-ice: #a1c7d7;
    --amber: #b45309;
  }
  body { background: #fff; color: #182328; font: 9pt/1.36 var(--sans); }
  body.has-calculator > :not(.print-sheet) { display: none !important; }
  .print-sheet { display: block; print-color-adjust: exact; break-inside: avoid; }
  .print-sheet header { padding: 0 0 2.8mm; border-bottom: 1px solid #122a3b; }
  .print-sheet header p { color: #174d7a; font: 700 8.2pt var(--mono); }
  .print-sheet h1 { font-size: 19pt; margin: 1.2mm 0 0.8mm; }
  .print-sheet h2 { margin-bottom: 1.6mm; font-size: 11.3pt; }
  .print-note { margin-top: 2.8mm; }
  .print-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5mm; margin-top: 3mm; }
  .print-grid table { border-collapse: collapse; width: 100%; }
  .print-grid :is(th, td) { border-top: 0.5pt solid #b0b6b5; padding: 0.65mm 0.2mm; vertical-align: top; }
  .print-grid th { font-weight: 520; text-align: left; }
  .print-grid td { text-align: right; font: 670 8.2pt/1.4 var(--mono); }
  .print-figure { width: 119mm; margin: 3mm auto 1.7mm; border: 1px solid #c0c7c4; }
  .print-caveat { color: #35464b; font-size: 8.1pt; border-top: 1px solid #a6afaa; padding-top: 1.6mm; }
}
