/* Square & Pitch — shared styles
   Galvanized paper, slate ink, one chalk-line blue. The slate board that holds
   the results is the one loud element on every page; everything else stays quiet. */
:root {
  --paper: #eef1f3;
  --panel: #ffffff;
  --ink: #18242b;
  --slate: #4b5a63;
  --rule: #c5cfd5;
  --rule-soft: #dbe2e6;
  --field: #7d8c95;
  --chalk: #1f5fbf;
  --chalk-soft: #dfe8f6;
  --grid: rgba(31, 95, 191, .075);
  /* on the slate board */
  --on: #ffffff;
  --on-soft: #b9c6ce;
  --on-line: #34444d;
  --on-chalk: #9cc0f5;
  --tape: #f5c518;   /* tape-measure yellow: only for measurements in drawings and charts */
  --warn: #8a4b00;
  --radius-s: 6px;
  --radius-m: 12px;
  --measure: 68ch;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variation-settings: "wdth" 100;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--chalk); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--chalk); outline-offset: 2px; border-radius: 2px; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 50; }
.skip:focus { left: 1rem; }

.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.num { font-variant-numeric: tabular-nums; }

/* Icons */
.icon { width: 48px; height: 36px; color: var(--ink); flex: none; }
.icon.sm { width: 32px; height: 24px; }
.ic-chalk { stroke: var(--chalk); }
.ic-chalk-fill { fill: var(--chalk); }
.ic-fill { fill: var(--panel); }
.logo-chalk { stroke: var(--chalk); }

/* ---------- Header ---------- */
.site-head { border-bottom: 1px solid var(--rule); background: var(--paper); position: relative; z-index: 20; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-weight: 780; font-variation-settings: "wdth" 118; font-size: 1.18rem; letter-spacing: -0.01em; }
.brand svg { width: 34px; height: 22px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem 1.35rem; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a { color: var(--slate); text-decoration: none; font-size: .95rem; font-weight: 520; padding: .4rem 0; display: inline-block; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 650; box-shadow: inset 0 -2px 0 var(--chalk); }

.menu { display: none; position: relative; }
.menu summary { list-style: none; cursor: pointer; font-weight: 650; font-size: .95rem; border: 1px solid var(--slate); border-radius: var(--radius-s); padding: .5rem .85rem; background: var(--panel); min-height: 44px; display: flex; align-items: center; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: ""; display: inline-block; margin-left: .55rem; width: .45em; height: .45em; border-right: 2px solid; border-bottom: 2px solid; transform: translateY(-.15em) rotate(45deg); }
.menu[open] summary::after { transform: translateY(.1em) rotate(-135deg); }
.menu nav { position: absolute; right: 0; top: calc(100% + .5rem); background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius-m);
  box-shadow: 0 18px 36px -18px rgba(24, 36, 43, .45); width: min(300px, calc(100vw - 32px)); padding: .35rem 0; }
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu a { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; color: var(--ink); text-decoration: none; font-weight: 560; }
.menu a:hover { background: var(--paper); }
.menu a[aria-current="page"] { color: var(--chalk); box-shadow: inset 3px 0 0 var(--chalk); }
.menu a[aria-current="page"] .icon { color: var(--chalk); }
.menu-group { font-size: .8rem; font-weight: 650; color: var(--slate); padding: .65rem 1rem .25rem; }
.menu-group + li { border-top: 0; }

/* ---------- Type ---------- */
h1, h2, h3 { line-height: 1.1; letter-spacing: -0.015em; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 4.8vw, 3.4rem); font-weight: 790; font-variation-settings: "wdth" 116; max-width: 20ch; }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.95rem); font-weight: 730; font-variation-settings: "wdth" 110; margin-top: 2.2em; }
h3 { font-size: 1.15rem; font-weight: 700; font-variation-settings: "wdth" 104; margin-top: 1.6em; }
p { margin: 0 0 1em; }
.lede { font-size: clamp(1.1rem, 1.6vw, 1.25rem); color: var(--slate); max-width: 52ch; line-height: 1.5; }

/* Blueprint grid behind the top of every page, fading into plain paper */
main { background:
  linear-gradient(to bottom, rgba(238, 241, 243, 0) 0, var(--paper) 420px),
  linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
  linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px; }

/* ---------- Page intro ---------- */
.intro { padding-block: clamp(1.75rem, 4.5vw, 3rem) clamp(1.25rem, 3vw, 2rem); }
.intro .lede { margin-bottom: 0; }
.intro.has-icon { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 1.1rem; align-items: start; }
.intro.has-icon > :not(.intro-icon) { grid-column: 2; }
.intro-icon { grid-row: 1 / span 3; width: 64px; height: 56px; border-radius: var(--radius-m); background: var(--panel); border: 1px solid var(--rule); display: grid; place-items: center; margin-top: .35rem; }
.intro-icon .icon { width: 42px; height: 32px; }
.meta { font-size: .88rem; color: var(--slate); margin: .7rem 0 0; }

/* ---------- Tool ---------- */
.tool { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(1rem, 2vw, 1.5rem); align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--rule-soft); border-radius: var(--radius-m); padding: clamp(1.1rem, 2.5vw, 1.9rem); box-shadow: 0 1px 0 var(--rule-soft), 0 10px 30px -22px rgba(24, 36, 43, .35); }
.panel h2 { margin-top: 0; font-size: 1.2rem; font-variation-settings: "wdth" 104; }

fieldset { border: 0; margin: 0 0 1.15rem; padding: 0; min-width: 0; }
legend { font-weight: 650; margin-bottom: .45rem; padding: 0; }
.field { margin-bottom: 1.1rem; }
.field label, .label, legend { display: block; font-weight: 650; font-size: 1rem; margin-bottom: .35rem; }
.hint { display: block; color: var(--slate); font-size: .9rem; font-weight: 400; margin-top: .3rem; line-height: 1.5; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.row + .hint { margin: -.5rem 0 1.1rem; }

.unit-input { display: flex; align-items: stretch; border: 1px solid var(--field); border-radius: var(--radius-s); background: #fff; overflow: hidden; transition: border-color .15s; }
.unit-input:hover { border-color: var(--slate); }
.unit-input:focus-within { outline: 3px solid var(--chalk); outline-offset: 1px; border-color: var(--chalk); }
.unit-input input, .unit-input select { border: 0; outline: 0; min-width: 0; width: 100%; padding: .75rem .85rem; font: inherit; font-size: 1.12rem; font-weight: 620; font-variant-numeric: tabular-nums; background: transparent; color: var(--ink); }
.unit-input span { display: flex; align-items: center; padding: 0 .8rem; color: var(--slate); background: #f4f6f7; border-left: 1px solid var(--rule-soft); font-size: .9rem; white-space: nowrap; }
select.plain, input.plain { width: 100%; font: inherit; font-weight: 560; padding: .75rem .85rem; border: 1px solid var(--field); border-radius: var(--radius-s); background: #fff; color: var(--ink); }

/* Option buttons (radio) */
.choices { display: flex; gap: .5rem; flex-wrap: wrap; }
.choices label { flex: 1 1 6.5rem; display: flex; align-items: center; gap: .55rem; border: 1px solid var(--field); border-radius: var(--radius-s); padding: .65rem .85rem; cursor: pointer; font-weight: 560; background: #fff; min-height: 46px; line-height: 1.25; }
.choices label:hover { border-color: var(--slate); }
.choices input { accent-color: var(--chalk); margin: 0; width: 1.05rem; height: 1.05rem; flex: none; }
.choices label:has(input:checked) { border-color: var(--chalk); background: var(--chalk-soft); box-shadow: inset 0 0 0 1px var(--chalk); color: var(--ink); }
.choices label:has(input:focus-visible) { outline: 3px solid var(--chalk); outline-offset: 2px; }

/* Pitch chips: a little roof drawn at each pitch */
.pitch-chips { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .4rem; margin-bottom: .5rem; }
.pitch-chips button { display: flex; flex-direction: column; align-items: center; gap: .2rem; font: inherit; font-size: .85rem; font-weight: 650; font-variant-numeric: tabular-nums;
  color: var(--slate); background: #fff; border: 1px solid var(--field); border-radius: var(--radius-s); padding: .5rem .2rem .4rem; cursor: pointer; min-height: 48px; transition: border-color .15s, color .15s; }
.pitch-chips svg { width: 32px; height: 18px; }
.pitch-chips button:hover { border-color: var(--chalk); color: var(--ink); }
.pitch-chips button[aria-pressed="true"] { border-color: var(--chalk); background: var(--chalk-soft); color: var(--chalk); box-shadow: inset 0 0 0 1px var(--chalk); }

/* Range slider */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; margin: .2rem 0; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--chalk) 0 var(--fill, 25%), var(--rule) var(--fill, 25%) 100%); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--rule); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--chalk); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%; background: #fff; border: 2px solid var(--chalk); box-shadow: 0 2px 6px rgba(24, 36, 43, .25); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--chalk); }
input[type="range"]:focus-visible { outline-offset: 4px; }

details.more { border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 0; margin: 0 0 1.1rem; }
details.more summary { cursor: pointer; font-weight: 650; font-size: .95rem; padding: .75rem .9rem; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 46px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: ""; width: .5em; height: .5em; border-right: 2px solid var(--slate); border-bottom: 2px solid var(--slate); transform: rotate(45deg) translateY(-.15em); }
details.more[open] summary::after { transform: rotate(-135deg) translateY(-.1em); }
details.more > :not(summary) { margin-inline: .9rem; }
details.more > :last-child { margin-bottom: .9rem; }

.error { color: var(--warn); font-size: .92rem; font-weight: 600; margin: .3rem 0 0; }

/* ---------- The slate board (results) ---------- */
.board { background: var(--ink); color: var(--on); border-color: var(--ink); }
.board.panel { box-shadow: 0 24px 48px -28px rgba(24, 36, 43, .7); }
.board h2 { color: var(--on-soft); font-weight: 600; font-size: 1.05rem; }
.board a { color: var(--on-chalk); }
.board .error { color: #ffcf8a; }
.board :focus-visible, .peek:focus-visible, .site-foot :focus-visible { outline-color: var(--on-chalk); }
.results { position: sticky; top: 1rem; }
.answer { border-bottom: 1px solid var(--on-line); padding-bottom: 1.1rem; margin-bottom: 1rem; }
.big { margin: 0; font-size: clamp(2.8rem, 6.5vw, 4.6rem); font-weight: 800; font-variation-settings: "wdth" 120; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.025em; }
.big.range { font-size: clamp(1.75rem, 7.2vw, 3.3rem); }
.big small { font-size: .36em; font-weight: 600; color: var(--on-soft); font-variation-settings: "wdth" 100; letter-spacing: 0; margin-left: .3em; }
.answer p { margin: .6rem 0 0; color: var(--on-soft); }
.list { display: grid; grid-template-columns: minmax(0, 1fr) fit-content(55%); margin: 0; }
.list dt, .list dd { padding: .6rem 0; border-bottom: 1px dashed var(--on-line); margin: 0; }
.list dd { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; padding-left: 1rem; }
.list dt small { display: block; color: var(--on-soft); font-size: .84rem; }
.next { margin-top: 1.25rem; display: flex; flex-wrap: wrap; gap: .75rem; }
.board .sources { color: var(--on-soft); margin: 1rem 0 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; background: var(--ink); color: #fff; text-decoration: none; border: 0; border-radius: var(--radius-s); padding: .75rem 1.1rem; font: inherit; font-weight: 650; cursor: pointer; min-height: 46px; transition: background .15s; }
.btn:hover { background: var(--chalk); }
.btn.quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--slate); }
.btn.quiet:hover { background: var(--chalk-soft); }
.board .btn { background: #fff; color: var(--ink); }
.board .btn:hover { background: var(--on-chalk); }
.board .btn.quiet { background: transparent; color: #fff; box-shadow: inset 0 0 0 1px var(--on-soft); }
.board .btn.quiet:hover { background: #24343d; }
.panel:not(.board) .btn.quiet { min-height: 44px; }

/* Roof profile diagram: chalk on slate */
.diagram { margin: 0 0 1rem; }
.diagram svg { width: 100%; height: auto; }
.diagram figcaption { font-size: .85rem; color: var(--on-soft); }
.d-roof { fill: rgba(156, 192, 245, .13); stroke: #fff; stroke-width: 2.5; stroke-linejoin: round; }
.d-wall { fill: none; stroke: #7f929c; stroke-width: 1.5; }
.d-chalk { stroke: var(--on-chalk); stroke-width: 2; stroke-dasharray: 7 5; fill: none; }
.d-label { font: 600 15px var(--font); fill: #fff; }
.d-label.blue { fill: var(--on-chalk); }
.d-arc { fill: none; stroke: var(--on-chalk); stroke-width: 1.5; }

/* The one orchestrated motion: the roof line snaps in once on the home page */
.draw-in .d-roof { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: snap 1.1s cubic-bezier(.3, .7, .2, 1) .15s forwards; fill-opacity: 0; }
.draw-in .d-chalk, .draw-in .d-label, .draw-in .d-arc { opacity: 0; animation: appear .4s ease-out 1.05s forwards; }
@keyframes snap { to { stroke-dashoffset: 0; fill-opacity: 1; } }
@keyframes appear { to { opacity: 1; } }

/* Phone: answer bar while the results are off screen */
.peek { display: none; }

/* ---------- Article ---------- */
.article { max-width: var(--measure); padding-bottom: 3rem; }
.article > h2:first-child { margin-top: 1.5em; }
.article ul, .article ol { padding-left: 1.25rem; }
.article li { margin-bottom: .45rem; }
.formula { background: var(--panel); border-left: 4px solid var(--chalk); padding: .9rem 1.1rem; font-variant-numeric: tabular-nums; font-weight: 560; margin: 0 0 1.2em; border-radius: 0 var(--radius-s) var(--radius-s) 0; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; margin: 0 0 1.25em; background: var(--panel); border-radius: var(--radius-s); overflow: hidden; box-shadow: 0 0 0 1px var(--rule-soft); }
caption { text-align: left; font-weight: 680; padding-bottom: .5rem; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--rule-soft); }
tbody tr:last-child td { border-bottom: 0; }
th { font-weight: 650; background: #f4f6f7; font-size: .95rem; }
td.r, th.r { text-align: right; }
.table-scroll { overflow-x: auto; }
.sources { font-size: .9rem; color: var(--slate); }

/* FAQ */
.article details { border-bottom: 1px solid var(--rule); }
.article details:first-of-type { border-top: 1px solid var(--rule); }
.article summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .85rem 0; min-height: 48px; }
.article summary::-webkit-details-marker { display: none; }
.article summary::after { content: ""; flex: none; width: 14px; height: 14px; background:
  linear-gradient(var(--chalk), var(--chalk)) center / 14px 2px no-repeat,
  linear-gradient(var(--chalk), var(--chalk)) center / 2px 14px no-repeat; transition: transform .2s; }
.article details[open] summary::after { transform: rotate(45deg); }
.article details p { margin: 0 0 1rem; color: var(--slate); }

/* Calculator lists: home groups and related block */
.calc-groups { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: clamp(1.5rem, 3vw, 2.5rem); }
.calc-group h3 { margin: 0 0 .75rem; font-size: 1rem; font-weight: 650; color: var(--slate); font-variation-settings: "wdth" 100; letter-spacing: 0; }
.calc-grid, .calc-list { list-style: none; margin: 0; padding: 0; display: grid; }
.calc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.calc-group:last-child .calc-grid { grid-template-columns: 1fr; }
.calc-grid a { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr; align-content: start; column-gap: 1rem; height: 100%;
  padding: 1.2rem 1.25rem 1.3rem; background: var(--panel); border: 1px solid var(--rule-soft); border-radius: var(--radius-m); color: var(--ink); text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s; }
.calc-grid a:hover { border-color: var(--chalk); box-shadow: 0 14px 30px -22px rgba(31, 95, 191, .55); transform: translateY(-2px); }
.calc-grid .icon { grid-row: 1 / span 2; width: 52px; height: 40px; padding: 4px; border-radius: 8px; background: var(--paper); box-sizing: content-box; }
.calc-grid h4 { margin: .15rem 0 .3rem; font-size: 1.15rem; font-weight: 720; font-variation-settings: "wdth" 106; line-height: 1.2; }
.calc-grid p { margin: 0; color: var(--slate); font-size: .95rem; }
.calc-grid a:hover h4 { color: var(--chalk); }
.calc-grid a:hover .icon { color: var(--chalk); background: var(--chalk-soft); }

.related { border-top: 2px solid var(--ink); padding-block: 1.25rem 3.5rem; }
.related h2 { margin-top: 0; font-size: 1.3rem; }
.calc-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 0 1.75rem; }
.calc-list li { border-bottom: 1px solid var(--rule); }
.calc-list a { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr; align-content: start; column-gap: .85rem; padding: .85rem 0; text-decoration: none; color: var(--ink); }
.calc-list .icon { width: 40px; height: 30px; grid-row: 1 / span 2; }
.calc-list h3 { margin: 0; font-size: 1rem; color: var(--chalk); font-variation-settings: "wdth" 100; }
.calc-list p { margin: .1rem 0 0; font-size: .9rem; color: var(--slate); }
.calc-list a:hover h3 { text-decoration: underline; }
.calc-list a:hover .icon { color: var(--chalk); }

/* ---------- The house drawing ---------- */
.house-svg, .house-fig svg { width: 100%; height: auto; overflow: visible; }
.h-ground { fill: rgba(24, 36, 43, .07); stroke: none; }
.h-wall-front { fill: #fff; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.h-wall-side { fill: #dde4e8; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.h-door { fill: var(--slate); stroke: var(--ink); stroke-width: 1.5; }
.h-window { fill: #c9daf2; stroke: var(--ink); stroke-width: 1.5; }
.h-roof-left { fill: #2b3a42; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.h-roof-right, .h-roof-front { fill: #44565f; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.h-roof-front { fill: #3a4b54; }
.h-course { fill: none; stroke: rgba(255, 255, 255, .16); stroke-width: 1.2; }
.h-ridge { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.h-dim { fill: none; stroke: var(--chalk); stroke-width: 1.6; stroke-dasharray: 6 4; }
.h-square { fill: none; stroke: var(--tape); stroke-width: 2.2; stroke-dasharray: 6 4; }
.h-tag rect { fill: var(--tape); stroke: rgba(24, 36, 43, .35); stroke-width: 1; }
.h-tag text { font: 750 14px var(--font); font-variation-settings: "wdth" 88; fill: var(--ink); font-variant-numeric: tabular-nums; }
/* on the slate board */
.board .h-ground { fill: rgba(255, 255, 255, .05); }
.board .h-wall-front { fill: #2c3c45; stroke: #e7eef2; }
.board .h-wall-side { fill: #24333b; stroke: #e7eef2; }
.board .h-door { fill: #18242b; stroke: #e7eef2; }
.board .h-window { fill: rgba(156, 192, 245, .35); stroke: #e7eef2; }
.board .h-roof-left { fill: #4b616c; stroke: #fff; }
.board .h-roof-right, .board .h-roof-front { fill: #5c7380; stroke: #fff; }
.board .h-roof-front { fill: #536a76; }
.board .h-course { stroke: rgba(255, 255, 255, .2); }
.board .h-ridge { stroke: #fff; }
.board .h-dim { stroke: var(--on-chalk); }
.board .house-fig figcaption { margin-top: .25rem; }
/* First view: walls rise, roof settles, tags appear. Once, on load. */
.house-intro .h-walls { animation: rise .55s cubic-bezier(.2, .7, .2, 1) both; }
.house-intro .h-roof { animation: settle .6s cubic-bezier(.2, .7, .2, 1) .3s both; }
.house-intro .h-dims { animation: appear .4s ease-out .8s both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes settle { from { opacity: 0; transform: translateY(-22px); } }

/* ---------- Charts in the results board ---------- */
.viz { margin: 0 0 1.1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--on-line); }
.viz-cap { font-size: .88rem; color: var(--on-soft); margin-bottom: .6rem; }
.viz-note { font-size: .82rem; color: var(--on-soft); margin: .6rem 0 0; }
.vr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.vr-btn { width: 100%; display: grid; grid-template-columns: minmax(7.5rem, 11rem) minmax(0, 1fr); grid-template-rows: auto auto; column-gap: .9rem; align-items: center;
  background: transparent; border: 0; color: var(--on-soft); font: inherit; font-size: .86rem; text-align: left; padding: .35rem .4rem; border-radius: 6px; cursor: pointer; }
.vr-btn:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.vr-name { grid-row: 1 / span 2; line-height: 1.25; }
.vr-track { position: relative; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .06); }
.vr-bar { position: absolute; top: 0; bottom: 0; border-radius: 5px; background: #6d8290; }
.vr-val { font-size: .78rem; font-variant-numeric: tabular-nums; display: none; margin-top: .2rem; }
.is-on .vr-btn { color: #fff; font-weight: 650; background: rgba(255, 255, 255, .06); }
.is-on .vr-bar { background: var(--tape); }
.is-on .vr-val, .vr-btn:hover .vr-val { display: block; color: #fff; }
.vr-axis { display: flex; justify-content: space-between; margin: .35rem .4rem 0 calc(min(11rem, 40%) + 1.3rem); font-size: .74rem; color: var(--on-soft); font-variant-numeric: tabular-nums; }

.vg-plot { position: relative; display: grid; gap: .45rem; padding-top: 1.6rem; }
.vg-row { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) 3.6rem; align-items: center; column-gap: .7rem; font-size: .86rem; color: var(--on-soft); }
.vg-track { height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .06); position: relative; }
.vg-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: #6d8290; }
.vg-val { text-align: right; font-variant-numeric: tabular-nums; }
.vg-row.is-short .vg-bar { background: repeating-linear-gradient(135deg, #4a5d68 0 4px, #3a4b55 4px 8px); }
.vg-row.is-on { color: #fff; font-weight: 650; }
.vg-row.is-on .vg-bar { background: var(--tape); }
.vg-mark { --x: .5; position: absolute; top: 0; bottom: -4px; left: calc(8.5rem + .7rem + (100% - 8.5rem - 3.6rem - 1.4rem) * var(--x)); width: 0; border-left: 2px dashed var(--on-chalk); }
.vg-mark-label { position: absolute; top: 0; left: 0; transform: translateX(-50%); white-space: nowrap; background: var(--ink); padding: 0 .35rem; line-height: 1.3; font-size: .76rem; font-weight: 650; color: var(--on-chalk); }

.vb-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.vb-block { width: 18px; height: 12px; border-radius: 2px; background: var(--tape); }
.vb-block.vb-gap { margin-right: 8px; }

/* ---------- Home ---------- */
.hero { padding-block: clamp(1.75rem, 4.5vw, 3.5rem) clamp(2.5rem, 5vw, 4rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(1.5rem, 3.5vw, 3rem); align-items: start; }
.hero h1 { font-size: clamp(2.5rem, 5.4vw, 4.3rem); font-variation-settings: "wdth" 122; font-weight: 800; letter-spacing: -0.03em; line-height: .98; max-width: 11ch; }
.hero .lede { margin-bottom: 1.5rem; }
.quick-form h2 { margin: 0 0 .9rem; font-size: 1.15rem; font-variation-settings: "wdth" 104; }
.quick-form fieldset { margin-bottom: 0; }

.sheet { position: sticky; top: 1rem; background: var(--panel); border: 1px solid var(--rule-soft); border-radius: 18px; overflow: hidden;
  box-shadow: 0 40px 70px -46px rgba(24, 36, 43, .6); }
.sheet-drawing { margin: 0; padding: clamp(1rem, 2.5vw, 1.75rem) clamp(.75rem, 2vw, 1.5rem) .75rem; background:
  linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 20px 20px,
  linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 20px 20px, #fbfcfc; }
.sheet-drawing figcaption { font-size: .82rem; color: var(--slate); text-align: right; margin-top: .25rem; }
.sheet-result { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 1rem 1.5rem; padding: clamp(1.1rem, 2.5vw, 1.6rem); }
.quick-label { color: var(--on-soft); font-size: .88rem; margin: 0 0 .25rem; }
.sheet .big { font-size: clamp(2.6rem, 5vw, 3.7rem); }
.sheet-stats { display: flex; flex-wrap: wrap; gap: .3rem 1.75rem; margin: .7rem 0 0; }
.sheet-stats div { display: flex; flex-direction: column; }
.sheet-stats dt { font-size: .8rem; color: var(--on-soft); }
.sheet-stats dd { margin: 0; font-weight: 700; font-size: 1.1rem; }
.sheet-result .btn { white-space: nowrap; }

.home-section { padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.home-section > h2 { margin-top: 0; }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2.5vw, 2rem); }
.steps li { counter-increment: step; background: var(--panel); border: 1px solid var(--rule-soft); border-radius: var(--radius-m); padding: 1.25rem 1.35rem 1.4rem; position: relative; }
.steps li::before { content: counter(step); position: absolute; top: 1rem; right: 1.15rem; font-weight: 800; font-variation-settings: "wdth" 120; font-size: 1.6rem; color: var(--chalk); line-height: 1; }
.steps svg { width: 120px; height: 70px; margin-bottom: .75rem; }
.steps h3 { margin: 0 0 .4rem; }
.steps p { margin: 0; color: var(--slate); font-size: .97rem; }
.s-line { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.s-chalk { fill: none; stroke: var(--chalk); stroke-width: 2; stroke-dasharray: 5 4; stroke-linecap: round; }
.steps text { font: 650 12px var(--font); fill: var(--chalk); }

.source-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: clamp(1rem, 3vw, 3rem); align-items: start; }
.source-lede { color: var(--slate); font-size: 1.08rem; max-width: 42ch; }
.source-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.source-list li { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--rule); }
.source-list a { font-weight: 650; }
.source-list span { color: var(--slate); }

/* Plain pages: article with a calculator list beside it */
.page-plain main .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); column-gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.page-plain main .intro { grid-column: 1 / -1; }
.page-aside { position: sticky; top: 1.5rem; background: var(--panel); border: 1px solid var(--rule-soft); border-radius: var(--radius-m); padding: 1.1rem 1.25rem .5rem; margin-bottom: 3rem; }
.page-aside h2 { font-size: 1.05rem; margin: 0 0 .25rem; font-variation-settings: "wdth" 104; }
.page-aside .calc-list { grid-template-columns: 1fr; }
.page-aside .calc-list li:last-child { border-bottom: 0; }
.page-aside .calc-list p { display: none; }
.page-aside .calc-list a { align-items: center; grid-template-rows: auto; }
.page-aside .calc-list .icon { grid-row: auto; width: 34px; height: 26px; }

/* Ad slots stay collapsed until AdSense is approved */
.ad-slot:empty { display: none; }

/* ---------- Footer ---------- */
.site-foot { background: var(--ink); color: var(--on-soft); padding-block: clamp(2.25rem, 5vw, 3.5rem); font-size: .93rem; }
.site-foot .wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .7fr); gap: 2rem; }
.site-foot .brand { color: #fff; margin-bottom: .8rem; }
.site-foot .logo-chalk { stroke: var(--on-chalk); }
.foot-brand p { max-width: 40ch; margin: 0; }
.site-foot h2 { font-size: .95rem; color: #fff; margin: .4rem 0 .7rem; font-variation-settings: "wdth" 100; letter-spacing: 0; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.site-foot a:not(.brand) { color: var(--on-soft); text-decoration: none; display: inline-block; padding: .2rem 0; }
.site-foot a:not(.brand):hover { color: #fff; text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .site-nav { display: none; }
  .menu { display: block; }
}
@media (max-width: 1060px) {
  .calc-groups { grid-template-columns: 1fr; }
  .calc-group:last-child .calc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .tool, .hero-grid, .source-grid, .page-plain main .wrap { grid-template-columns: 1fr; }
  .page-aside { position: static; }
  .results, .sheet { position: static; }
  .hero h1 { max-width: 14ch; }
  .steps { grid-template-columns: 1fr; }
  .site-foot .wrap { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }

  .peek:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 1rem; position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 30;
    background: var(--ink); color: #fff; text-decoration: none; border-radius: 14px; padding: .65rem 1rem; box-shadow: 0 14px 34px -10px rgba(24, 36, 43, .65); }
  .peek-label { grid-column: 1; font-size: .78rem; color: var(--on-soft); }
  .peek strong { grid-column: 1; font-size: 1.35rem; font-variant-numeric: tabular-nums; line-height: 1.15; font-variation-settings: "wdth" 112; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .peek-go { grid-column: 2; grid-row: 1 / span 2; font-size: .9rem; font-weight: 650; color: var(--on-chalk); }
  .page-calc .site-foot { padding-bottom: 7rem; }
}
@media (max-width: 600px) {
  .site-head .wrap { min-height: 60px; }
  .calc-grid, .calc-group:last-child .calc-grid { grid-template-columns: 1fr; }
  .intro.has-icon { grid-template-columns: 1fr; }
  .intro.has-icon > :not(.intro-icon) { grid-column: 1; }
  .intro-icon { display: none; }
  .intro { padding-block: 1.25rem 1.1rem; }
  .intro .lede { font-size: 1.05rem; }
  .meta { font-size: .82rem; }
  .hero { padding-top: 1.25rem; }
  .sheet-result { grid-template-columns: 1fr; }
  .sheet-result .btn { justify-self: stretch; }
  .source-list li { grid-template-columns: 1fr; gap: 0; }
  .vr-btn { grid-template-columns: 1fr; row-gap: .3rem; }
  .vr-name { grid-row: auto; }
  .vr-axis { margin-left: .4rem; }
  .vg-row { grid-template-columns: 6.6rem minmax(0, 1fr) 3.2rem; font-size: .8rem; }
  .vg-mark { left: calc(6.6rem + .7rem + (100% - 6.6rem - 3.2rem - 1.4rem) * var(--x)); }
}
@media (max-width: 420px) {
  .pitch-chips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .site-foot .wrap { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .draw-in .d-roof { stroke-dasharray: none; stroke-dashoffset: 0; fill-opacity: 1; }
  .draw-in .d-chalk, .draw-in .d-label, .draw-in .d-arc { opacity: 1; }
  .calc-grid a:hover { transform: none; }
}
@media print {
  .site-head, .site-foot, .next, .ad-slot, .related, .peek, .menu { display: none !important; }
  body, main { background: #fff; }
  .board { background: #fff; color: var(--ink); }
}
.page-plain main .wrap:not(:has(.article)) { grid-template-columns: 1fr; }
.page-plain main .wrap:not(:has(.article)) .page-aside { position: static; max-width: 760px; }
.page-plain main .wrap:not(:has(.article)) .calc-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); column-gap: 1.5rem; }
@media (min-width: 601px) and (max-width: 860px) { .sheet-drawing svg { max-height: 380px; margin-inline: auto; } }
