/* ---------- fonts (self-hosted) ---------- */
@font-face { font-family: 'Hanken Grotesk'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(fonts/hanken-grotesk-latin-wght-normal.woff2) format('woff2'); }

/* ---------- tokens ---------- */
:root {
  --paper: #F2F3F4;
  --surface: #FFFFFF;
  --ink: #141414;
  --ink-2: #383A3C;
  --muted: #65686B;
  --line: #D5D8DB;
  --line-2: #E6E8EA;
  --accent: #EC7314;
  --accent-ink: #B0520A;
  --accent-wash: #FDE6D2;
  --pine: #1A1A1A;
  --pine-ink: #F4F5F6;
  --marker: #EC7314;
  --danger: #B42318;
  --danger-wash: #FDECEA;
  --c1: #1A1A1A; --c2: #EC7314; --c3: #9DA3A8; --c4: #F5B041; --c5: #5D6B73; --c6: #CDD1D4; --c7: #8C3B12;
  --dot-pine: #1A1A1A; --dot-clay: #EC7314; --dot-tomato: #EC7314; --dot-ochre: #E2A21E; --dot-slate: #5D6B73; --dot-plum: #8A9096;
  --display: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-sm: 0; --r-md: 0; --r-lg: 0;
  --wrap: 1240px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121314; --surface: #1B1C1E; --ink: #F2F2F2; --ink-2: #C9CBCD; --muted: #8E9195;
    --line: #313336; --line-2: #25272A; --accent: #F58A3A; --accent-ink: #F7A162; --accent-wash: #3A2414;
    --pine: #000000; --pine-ink: #F4F5F6; --marker: #F58A3A; --danger: #FF8A80; --danger-wash: #2C1716;
    --c1: #E6E6E6; --c2: #F58A3A; --c3: #7D8287; --c4: #F5B041; --c5: #8FA3B0; --c6: #4A4D51; --c7: #C4672A;
    --dot-pine: #E6E6E6; --dot-clay: #F58A3A; --dot-tomato: #F58A3A; --dot-ochre: #F5B041; --dot-slate: #8FA3B0; --dot-plum: #A3A8AD;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121314; --surface: #1B1C1E; --ink: #F2F2F2; --ink-2: #C9CBCD; --muted: #8E9195;
  --line: #313336; --line-2: #25272A; --accent: #F58A3A; --accent-ink: #F7A162; --accent-wash: #3A2414;
  --pine: #000000; --pine-ink: #F4F5F6; --marker: #F58A3A; --danger: #FF8A80; --danger-wash: #2C1716;
  --c1: #E6E6E6; --c2: #F58A3A; --c3: #7D8287; --c4: #F5B041; --c5: #8FA3B0; --c6: #4A4D51; --c7: #C4672A;
  --dot-pine: #E6E6E6; --dot-clay: #F58A3A; --dot-tomato: #F58A3A; --dot-ochre: #F5B041; --dot-slate: #8FA3B0; --dot-plum: #A3A8AD;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.6 var(--body); font-feature-settings: 'tnum' 0; overflow-x: hidden; }
a { color: var(--accent-ink); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.12; margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: var(--r-sm); z-index: 100; }
.skip:focus { top: 12px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
@media (min-width: 720px) { .wrap { padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); } }

/* ---------- header ---------- */
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; }
.brand:hover { color: var(--ink); }
.wm { font: 600 1.42rem/1 var(--display); letter-spacing: -0.01em; }
.wm i { font-style: italic; font-weight: 500; color: var(--accent); }
.logo-mark { width: 30px; height: 30px; flex: none; }
.header-search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.header-nav { display: flex; align-items: center; gap: 6px; }
.header-nav a, .browse-btn { color: var(--ink-2); text-decoration: none; font: 600 .95rem var(--body); white-space: nowrap; padding: 8px 12px; border-radius: var(--r-sm); background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.header-nav a:hover, .browse-btn:hover, .browse-btn[aria-expanded="true"] { color: var(--ink); background: var(--line-2); }
.burger { width: 18px; height: 18px; display: none; }
.home .header-search { visibility: hidden; }
.browse-menu { border-top: 1px solid var(--line); background: var(--surface); box-shadow: 0 24px 40px -24px rgba(30, 25, 15, .35); max-height: calc(100vh - 64px); overflow: auto; }
.browse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 20px; padding-top: 18px; padding-bottom: 22px; }
.browse-grid a { display: block; padding: 10px 12px 10px 26px; border-radius: var(--r-sm); text-decoration: none; position: relative; }
.browse-grid a::before { content: ''; position: absolute; left: 10px; top: 17px; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--ink-2)); }
.browse-grid a:hover { background: var(--paper); }
.browse-grid b { display: block; color: var(--ink); font-weight: 600; }
.browse-grid small { display: block; color: var(--muted); font-size: .84rem; line-height: 1.4; margin-top: 2px; }
.browse-grid .browse-all::before { background: none; border: 1.5px solid var(--ink-2); width: 5px; height: 5px; }
@media (max-width: 760px) {
  .header-inner { gap: 10px; }
  .browse-label, .az-link { display: none !important; }
  .burger { display: block; }
  .browse-btn { padding: 8px; }
  .site-header .wm { display: none; }
  .home .site-header .wm { display: inline; }
  .home .header-search { display: none; }
  .home .header-nav { margin-left: auto; }
}

/* ---------- search ---------- */
.header-search .q, .hero-search .q { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; height: 42px; padding: 0 16px 0 40px; }
.header-search .q:focus, .hero-search .q:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 4px var(--accent-wash); }
.search-icon { position: absolute; left: 14px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.q::-webkit-search-cancel-button { cursor: pointer; }
.q-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 18px 40px -12px rgba(30, 25, 15, .3); max-height: min(70vh, 460px); overflow: auto; z-index: 50; }
.q-results li a { display: block; padding: 9px 12px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink); }
.q-results li a b { display: block; font-weight: 600; }
.q-results li a small { display: block; color: var(--muted); font-size: .82rem; }
.q-results li[aria-selected="true"] a, .q-results li a:hover { background: var(--accent-wash); }
.q-results .q-empty { padding: 10px 12px; color: var(--muted); font-size: .92rem; }

/* ---------- hero (home) ---------- */
.hero { padding: 52px 0 40px; }
.hero-grid { display: grid; gap: 40px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 980px) { .hero-grid { grid-template-columns: minmax(0, 1fr) 360px; gap: 64px; } }
.eyebrow { font-size: .9rem; font-weight: 600; color: var(--accent-ink); margin: 0 0 14px; letter-spacing: .01em; }
.hero h1 { font: 500 clamp(2.3rem, 5.2vw, 3.9rem)/1.05 var(--display); letter-spacing: -0.02em; max-width: 19ch; text-wrap: balance; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero-sub { color: var(--ink-2); font-size: 1.12rem; margin: 18px 0 26px; max-width: 52ch; }
.hero-search { position: relative; max-width: 620px; }
.hero-search .q { height: 60px; font-size: 1.12rem; padding-left: 52px; border: 2px solid var(--ink); background: var(--surface); box-shadow: 4px 4px 0 var(--ink); }
.hero-search .q:focus { border-color: var(--ink); box-shadow: 4px 4px 0 var(--accent); }
.hero-search .search-icon { left: 20px; width: 21px; height: 21px; color: var(--ink); }
.popular { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin: 22px 0 0; }
.popular span { color: var(--muted); font-size: .92rem; }
.popular a { font-size: .97rem; font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 2px; text-underline-offset: .25em; }
.popular a:hover { text-decoration-color: var(--accent); color: var(--ink); }

.quick { background: var(--pine); color: var(--pine-ink); border-radius: var(--r-lg); padding: 24px 24px 20px; position: relative; transform: rotate(-1.2deg); box-shadow: 0 20px 40px -24px rgba(20, 30, 25, .6); }
.quick a { color: var(--marker); }
.quick-tag { display: inline-block; font: italic 500 1.05rem var(--display); margin: 0 0 12px; color: var(--marker); }
.quick-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 8px; font-size: 1.05rem; }
.quick-in { display: inline-flex; align-items: center; gap: 2px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .25); border-radius: var(--r-sm); padding: 0 8px; height: 40px; }
.quick-in:focus-within { border-color: var(--marker); }
.quick-in i { font-style: normal; opacity: .7; }
.quick-in input { width: 4.2ch; background: none; border: 0; color: inherit; font: 600 1.05rem var(--body); font-variant-numeric: tabular-nums; outline: none; }
.quick-in input#qa { width: 6.5ch; }
.quick-out { font: 600 3rem/1 var(--display); margin: 18px 0 14px; font-variant-numeric: tabular-nums; }
.quick-foot { font-size: .9rem; opacity: .85; margin: 0; border-top: 1px solid rgba(255, 255, 255, .18); padding-top: 12px; }
@media (max-width: 979px) { .quick { transform: none; max-width: 460px; } }

/* shelves */
.shelves { padding: 28px 0 8px; }
.shelves-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 4px; }
.shelves-head h2 { font: 500 clamp(1.7rem, 3.4vw, 2.3rem)/1.1 var(--display); }
.shelves-head p { margin: 0; font-weight: 600; }
.shelf-grid { display: grid; grid-template-columns: 1fr; column-gap: 40px; }
@media (min-width: 680px) { .shelf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .shelf-grid { column-gap: 64px; } .shelf ul { columns: 3; } }
.shelf { padding: 22px 0 24px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.shelf header { display: flex; align-items: baseline; gap: 12px; }
.shelf-no { font: 500 .95rem var(--display); color: var(--dot); font-style: italic; min-width: 1.6em; }
.shelf h3 { font: 600 1.5rem/1.15 var(--display); }
.shelf h3 a { color: var(--ink); text-decoration: none; }
.shelf h3 a:hover { color: var(--accent); }
.shelf-count { margin-left: auto; color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.shelf-blurb { color: var(--muted); font-size: .93rem; margin: 4px 0 12px calc(1.6em + 12px); }
.shelf ul { list-style: none; margin: 0 0 12px calc(1.6em + 12px); padding: 0; columns: 2; column-gap: 16px; }
.shelf li { padding: 3px 0; break-inside: avoid; font-size: .97rem; }
.shelf li a { color: var(--ink-2); text-decoration: none; }
.shelf li a:hover { color: var(--accent-ink); text-decoration: underline; }
.shelf-more { margin: auto 0 0 calc(1.6em + 12px); font-weight: 600; font-size: .93rem; color: var(--accent-ink); text-decoration: none; }
.shelf-more:hover { text-decoration: underline; }
@media (max-width: 420px) { .shelf ul { columns: 1; } }

.show-work { display: grid; gap: 14px 64px; grid-template-columns: 1fr; padding: 48px 0 8px; }
@media (min-width: 900px) { .show-work { grid-template-columns: 300px minmax(0, 62ch); } }
.show-work h2 { font: 500 1.9rem/1.12 var(--display); }
.show-work p { color: var(--ink-2); }

/* ---------- link lists ---------- */
.link-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 32px; }
.link-list li { border-top: 1px solid var(--line-2); }
.link-list a { display: block; padding: 13px 0; text-decoration: none; }
.link-list a span { display: block; color: var(--ink); font-weight: 600; }
.link-list a small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: .88rem; line-height: 1.45; margin-top: 2px; }
.link-list a:hover span { color: var(--accent); text-decoration: underline; text-underline-offset: .18em; }

/* ---------- page heads ---------- */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: .9rem; padding: 22px 0 0; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.page-head { padding: 14px 0 22px; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; }
.page-head::before { width: 14px; height: 14px; border-radius: 4px; }
.page-head:not([class*="dot-"])::before { display: none; }
.page-head:not([class*="dot-"]) { grid-template-columns: 1fr; }
.page-head h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); font-weight: 600; letter-spacing: -0.015em; }
.page-head .lede { grid-column: 1 / -1; color: var(--muted); font-size: 1.08rem; margin: 10px 0 0; max-width: 62ch; }
.link-list.wide { margin-bottom: 40px; }

/* ---------- calculator page ---------- */
.calc-head { padding: 12px 0 22px; max-width: 760px; }
.calc-head h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); font-weight: 600; letter-spacing: -0.015em; }
.calc-head .lede { color: var(--muted); font-size: 1.08rem; margin: 10px 0 0; }

.calc-grid { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 820px) { .calc-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } }
@media (min-width: 1200px) { .calc-grid.has-rail { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) 300px; } }
.rail { display: none; }
@media (min-width: 1200px) { .rail { display: block; position: sticky; top: 84px; } }

.panel { border-radius: var(--r-lg); background: var(--surface); }
.panel-inputs { border: 1px solid var(--line); padding: 22px; }
.panel-results { border: 1.5px solid var(--ink); padding: 0 24px 24px; overflow: hidden; box-shadow: 4px 4px 0 var(--ink); }
.panel-results .primary { margin: 0 -24px 18px; padding: 22px 24px 22px; background: var(--pine); color: var(--pine-ink); }
.panel-results .primary .p-label { color: var(--pine-ink); opacity: .85; }
.panel-results .primary .p-sub { color: var(--pine-ink); opacity: .8; }
.panel-results .primary mark { color: var(--pine-ink); background-position: 0 96%; background-size: 100% 13%; }
.panel-results .primary mark.fresh { animation: swipe2 .42s cubic-bezier(.3, .7, .3, 1); }
@keyframes swipe2 { from { background-size: 0% 13%; } to { background-size: 100% 13%; } }
#results > :first-child:not(.primary) { margin-top: 24px; }
@media (min-width: 820px) { .panel-results { position: sticky; top: 84px; } }
@media (max-width: 520px) { .panel-inputs { padding: 18px 16px; } .panel-results { padding: 0 16px 18px; } .panel-results .primary { margin: 0 -16px 16px; padding: 18px 16px; } }

/* fields */
#calc-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
.field { min-width: 0; margin: 0; padding: 0; border: 0; grid-column: span 1; }
.field-toggle, .field-textarea, .field-select, .field-text { grid-column: 1 / -1; }
@media (max-width: 420px) { #calc-form { grid-template-columns: 1fr; } }
.field > label, .field > legend { display: block; font-size: .9rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.field[hidden] { display: none; }
.help { color: var(--muted); font-size: .82rem; margin: 6px 0 0; line-height: 1.4; }
.control { position: relative; display: flex; align-items: center; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-sm); transition: border-color .12s, box-shadow .12s; }
.control:hover { border-color: color-mix(in srgb, var(--line) 50%, var(--ink-2)); }
.control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }
.control input, .control select, .control textarea { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; color: var(--ink); font: 500 1.02rem/1.3 var(--body); font-variant-numeric: tabular-nums; height: 46px; padding: 0 12px; outline: none; }
.control textarea { height: auto; padding: 10px 12px; font-size: .95rem; line-height: 1.5; resize: vertical; }
.control.has-pre input { padding-left: 4px; }
.control.has-suf input { padding-right: 4px; }
.affix { color: var(--muted); font-weight: 500; padding: 0 0 0 12px; user-select: none; white-space: nowrap; }
.affix.suf { padding: 0 12px 0 0; }
.control.select::after { content: ''; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.control select { appearance: none; padding-right: 36px; cursor: pointer; }
.control select option { color: #131722; background: #fff; }
.control input[type="date"], .control input[type="time"] { cursor: text; }
.control input[aria-invalid="true"] { color: var(--danger); }

.seg { display: flex; flex-wrap: wrap; gap: 3px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { flex: 1 1 auto; text-align: center; padding: 8px 12px; border-radius: 7px; font-weight: 600; font-size: .93rem; color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap; }
.seg label:hover { color: var(--ink); }
.seg input:checked + label { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 20, 40, .12), 0 0 0 1px var(--line); }
.seg input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 1px; }

.form-actions { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.btn-quiet { font: 600 .9rem var(--body); color: var(--accent-ink); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: .2em; }
.btn-quiet:hover { text-decoration-color: currentColor; }

/* results */
.primary { margin-bottom: 18px; }
.p-label { font-weight: 600; color: var(--ink-2); margin: 0 0 4px; }
.p-value { font: 600 clamp(2.3rem, 5.4vw, 3.3rem)/1.08 var(--display); letter-spacing: -0.015em; font-variant-numeric: tabular-nums; margin: 0; overflow-wrap: anywhere; }
.p-value .unit { font-size: .5em; font-weight: 650; letter-spacing: -0.01em; color: var(--ink-2); }
.p-sub { color: var(--muted); margin: 6px 0 0; }
mark { color: var(--mark-ink, inherit); background: linear-gradient(100deg, transparent 0 1%, var(--marker) 1.5% 98%, transparent 99%) no-repeat 0 78% / 100% 46%; padding: 0 .1em; margin: 0 -.1em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
mark.fresh { animation: swipe .42s cubic-bezier(.3, .7, .3, 1); }
@keyframes swipe { from { background-size: 0% 46%; } to { background-size: 100% 46%; } }
@media (prefers-reduced-motion: reduce) { mark.fresh { animation: none; } }

.rows { margin: 0; }
.rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line-2); }
.rows dt { color: var(--muted); font-size: .95rem; }
.rows dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.rows .unit { color: var(--muted); font-weight: 500; }
.res-note { color: var(--muted); font-size: .86rem; margin: 14px 0 0; line-height: 1.45; }
.res-error { background: var(--danger-wash); color: var(--danger); border-radius: var(--r-sm); padding: 14px 16px; font-weight: 600; }
.res-error p { margin: 0; }

.chart { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.chart.donut { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: center; }
.chart.donut svg { width: 120px; height: 120px; }
.legend { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.legend li { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 8px; align-items: center; padding: 3px 0; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend span { color: var(--ink-2); min-width: 0; line-height: 1.3; }
.legend b { font-weight: 600; font-variant-numeric: tabular-nums; }
.legend em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 3.4em; text-align: right; }
.legend.inline { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; }
.legend.inline li { display: flex; gap: 6px; }
.chart.bars svg { width: 100%; height: 150px; display: block; }
.chart.bars rect:hover { opacity: .8; }
.chart .axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; margin-top: 6px; }
@media (max-width: 380px) { .chart.donut { grid-template-columns: 1fr; } }

/* schedule table */
.table-wrap { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.table-wrap summary { cursor: pointer; padding: 16px 20px; font: 600 1.1rem var(--display); display: flex; align-items: center; gap: 14px; list-style: none; }
.table-wrap summary::-webkit-details-marker { display: none; }
.table-wrap summary span { font: 500 .88rem var(--body); color: var(--muted); margin-left: auto; align-self: center; white-space: nowrap; }
@media (max-width: 520px) { .table-wrap summary span { display: none; } .table-wrap summary { justify-content: space-between; } }
.table-wrap summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: -4px 4px 0 0; flex: none; order: 3; transition: transform .15s; }
.table-wrap[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.table-wrap .scroll { overflow: auto; max-height: 520px; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 16px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line-2); }
thead th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-weight: 600; font-size: .84rem; z-index: 1; box-shadow: 0 1px 0 var(--line); }
th:first-child, td:first-child { text-align: left; }
tbody th { font-weight: 600; }
tbody tr:hover { background: var(--paper); }

/* explanation */
.explain-grid { display: grid; gap: 40px; grid-template-columns: 1fr; margin-top: 44px; }
@media (min-width: 980px) { .explain-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 64px; } }
.explain { max-width: 68ch; }
.explain h2 { font-size: 1.6rem; font-weight: 600; margin: 0 0 14px; }
.explain h2:not(:first-child) { margin-top: 40px; }
.explain h3 { font-size: 1.1rem; font-weight: 650; margin: 26px 0 10px; }
.explain p { color: var(--ink-2); }
.formula { font: 500 .98rem/1.6 var(--body); background: var(--surface); border-left: 3px solid var(--accent); padding: 12px 16px; border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--ink) !important; font-variant-numeric: tabular-nums; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 15px 34px 15px 0; font-weight: 600; position: relative; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 4px; top: 11px; font: 500 1.4rem/1 var(--body); color: var(--muted); }
.faq details[open] summary::after { content: '−'; }
.faq details p { margin: 0 0 16px; }
.related h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 8px; }
.related ul { list-style: none; margin: 0; padding: 0; }
.related li { border-top: 1px solid var(--line-2); }
.related a { display: block; padding: 11px 0; text-decoration: none; }
.related a span { color: var(--ink); font-weight: 600; display: block; }
.related a small { color: var(--muted); display: block; font-size: .85rem; line-height: 1.4; }
.related a:hover span { color: var(--accent); text-decoration: underline; }
@media (min-width: 980px) { .related { position: sticky; top: 84px; } }

/* ---------- ads ---------- */
.ad { margin: 24px auto; text-align: center; overflow: hidden; }
.ad-placeholder { display: grid; place-items: center; border: 1px dashed var(--line); border-radius: var(--r-md); color: var(--muted); font-size: .78rem; background: repeating-linear-gradient(-45deg, transparent 0 10px, color-mix(in srgb, var(--line-2) 60%, transparent) 10px 11px); }
.ad-top { min-height: 100px; max-width: 970px; margin-top: 0; }
.ad-mid, .ad-bottom { min-height: 250px; max-width: 970px; }
.ad-rail { min-height: 600px; width: 300px; margin: 0; }
.calc-wrap .ad-top { margin-bottom: 22px; }

/* ---------- A–Z ---------- */
.az { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 24px; }
.az a { display: grid; place-items: center; min-width: 36px; height: 36px; border: 1px solid var(--line); border-radius: var(--r-sm); text-decoration: none; font-weight: 700; color: var(--ink-2); background: var(--surface); }
.az a:hover { border-color: var(--accent); color: var(--accent); }
.az-group { display: grid; grid-template-columns: 56px 1fr; gap: 16px; padding: 18px 0; border-top: 1px solid var(--line); }
.az-group h2 { font-size: 1.9rem; font-weight: 600; color: var(--accent); }
.az-list { list-style: none; margin: 0; padding: 0; columns: 3 240px; column-gap: 32px; }
.az-list li { padding: 4px 0; break-inside: avoid; }
.az-list a { color: var(--ink); text-decoration: none; }
.az-list a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- prose pages ---------- */
.prose { max-width: 68ch; padding: 40px 0 56px; }
.prose h1 { font-size: clamp(2rem, 4.6vw, 3rem); font-weight: 600; letter-spacing: -0.015em; margin-bottom: 22px; }
.prose h2 { font-size: 1.3rem; font-weight: 600; margin: 30px 0 10px; }
.prose p { color: var(--ink-2); }
.notfound { padding-top: 80px; min-height: 50vh; }

/* ---------- footer ---------- */
.site-footer { margin-top: 72px; background: var(--surface); border-top: 1px solid var(--line); padding: 44px 0 0; }
.footer-grid { display: grid; gap: 32px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.3fr 2fr 1fr; } }
.footer-brand p { color: var(--muted); margin-top: 12px; max-width: 32ch; font-size: .95rem; }
.site-footer h2 { font: 700 .95rem var(--body); color: var(--ink); margin-bottom: 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer nav[aria-label="Categories"] ul { columns: 2 160px; }
.site-footer li { padding: 3px 0; }
.site-footer li a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.site-footer li a:hover { color: var(--accent); text-decoration: underline; }
.footer-base { border-top: 1px solid var(--line-2); margin-top: 36px; padding-top: 18px; padding-bottom: 28px; }
.footer-base p { color: var(--muted); font-size: .85rem; margin: 0; }

@media print {
  .site-header, .site-footer, .ad, .rail, .form-actions, .related, .crumbs { display: none !important; }
  .panel-results { position: static; }
}

.panel-results .primary mark { --marker: var(--accent); }

/* category colors */
.dot-pine { --dot: var(--dot-pine); } .dot-clay { --dot: var(--dot-clay); } .dot-tomato { --dot: var(--dot-tomato); }
.dot-ochre { --dot: var(--dot-ochre); } .dot-slate { --dot: var(--dot-slate); } .dot-plum { --dot: var(--dot-plum); }
.page-head::before { content: ''; background: var(--dot, var(--accent)); }
.panel-results .primary .unit { color: var(--pine-ink); opacity: .75; }

/* ---------- hardware direction ---------- */
.hero h1 em, .wm i { font-style: normal; }
.quick { transform: none; }
.shelf-no { font-style: normal; }
h1, h2, h3, .wm { font-weight: 800 !important; letter-spacing: -0.025em !important; }
.hero h1 { font-weight: 800; font-size: clamp(2.4rem, 5.4vw, 4.2rem); letter-spacing: -0.04em; }
.hero h1 em { color: var(--accent); }
.wm i { color: var(--accent); font-weight: 800; }
.eyebrow { color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }
.hero-search .q { border-radius: 14px; box-shadow: none; border: 2px solid var(--ink); }
.hero-search .q:focus { box-shadow: 0 0 0 4px var(--accent-wash); }
.quick { border-radius: 0; padding: 26px; box-shadow: inset 0 0 0 1px #000, 0 30px 50px -30px rgba(0,0,0,.6); }
.quick-tag { font: 700 .75rem var(--body); text-transform: uppercase; letter-spacing: .1em; color: #9DA3A8; }
.quick-out { font-weight: 700; color: var(--pine-ink); letter-spacing: -0.03em; }
.quick a { color: #F7A162; }
.quick-in { background: #2A2A2A; border-color: #3A3A3A; }
.panel-results { box-shadow: none; border: 0; border-radius: 0; background: var(--surface); }
.panel-results .primary { border-radius: 0; }
.panel-inputs { border-radius: 0; border: 0; }
.p-value { font-weight: 700; letter-spacing: -0.035em; }
.shelf h3 { font-weight: 800; }
.shelves-head { border-bottom-width: 3px; }
.popular a { text-decoration-color: var(--accent); }

/* square corners everywhere */
.panel, .panel-inputs, .panel-results, .panel-results .primary, .control, .seg, .seg label, .q, .header-search .q, .hero-search .q,
.q-results, .q-results li a, .quick, .quick-in, .table-wrap, .browse-grid a, .header-nav a, .browse-btn, .res-error, .az a, .formula, .skip { border-radius: 0 !important; }
.chart.donut circle { stroke-linecap: butt; }

.panel-results .primary .p-label { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; opacity: .7; }
.panel-results .primary mark { color: var(--pine-ink); }
.panel-inputs, .panel-results { border: 1px solid var(--line) !important; }
.quick { box-shadow: 0 30px 50px -30px rgba(0,0,0,.55); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .quick, :root:not([data-theme="light"]) .panel-results .primary { box-shadow: inset 0 0 0 1px #333; } }

/* ---------- embed code panel ---------- */
.embed-panel { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; }
.embed-panel h2 { font-size: 1.15rem; margin: 0 0 6px; }
.embed-panel p { color: var(--muted); margin: 0 0 12px; max-width: 62ch; }
.embed-panel textarea { width: 100%; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; resize: vertical; }
.embed-actions { display: flex; gap: 18px; align-items: center; margin-top: 10px; }
.embed-actions a { font-weight: 600; font-size: .9rem; }

/* ---------- embedded calculator (inside other sites) ---------- */
body.embed { background: var(--paper); }
.embed-main { padding: 16px; max-width: 980px; margin: 0 auto; }
.embed-title { font-size: 1.25rem; margin: 0 0 12px; }
body.embed .panel-results { position: static; }
.embed-credit { margin: 14px 0 0; font-size: .85rem; color: var(--muted); }
