/* BTU Planner — "thermostat" look: cool teal for cooling, ember for heating, LCD-style readouts. */
:root {
  --paper: #f3f6f5; --sheet: #ffffff; --ink: #0f2629; --muted: #52686b; --rule: #d3dddb;
  --cool: #0b6e75; --cool-wash: #e2f1f1; --heat: #b93d0c; --heat-wash: #fbebe2;
  --lcd: #0d2b2e; --lcd-ink: #b9f3e9; --lcd-dim: #6fa9a1; --warn: #8a5a00; --warn-wash: #fff4d6;
  --r: 10px; --wrap: 1060px;
  --head: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c1415; --sheet: #121d1f; --ink: #e4efee; --muted: #9db3b3; --rule: #263739;
    --cool: #4fc3c9; --cool-wash: #10292b; --heat: #ff8a55; --heat-wash: #2e1a12;
    --lcd: #061011; --lcd-ink: #a8f0e3; --lcd-dim: #5f9790; --warn: #f2c35b; --warn-wash: #2c2410;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.6 var(--body); }
a { color: var(--cool); text-underline-offset: 2px; }
a:hover { color: var(--heat); }
img, svg { max-width: 100%; height: auto; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

/* header */
.top { border-bottom: 1px solid var(--rule); background: var(--sheet); }
.top .wrap { display: flex; align-items: center; gap: 18px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font: 700 19px/1 var(--head); letter-spacing: -.01em; }
.brand b { color: var(--heat); font-weight: 700; }
.brand svg { width: 30px; height: 30px; flex: none; }
.top nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.top nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 999px; font-size: 15px; }
.top nav a[aria-current] { background: var(--cool-wash); color: var(--cool); font-weight: 600; }
.top nav a:hover { color: var(--ink); }

.crumbs { font-size: 14px; color: var(--muted); margin: 18px 0 4px; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { margin: 0 6px; }

h1, h2, h3 { font-family: var(--head); line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: clamp(28px, 5vw, 40px); margin: 6px 0 10px; }
h2 { font-size: clamp(22px, 3.4vw, 27px); margin: 44px 0 12px; padding-top: 14px; border-top: 3px solid var(--rule); }
h3 { font-size: 19px; margin: 26px 0 8px; }
.answer { font-size: 19px; max-width: 760px; margin: 0 0 8px; }
.answer strong { color: var(--heat); }
.byline { font-size: 14px; color: var(--muted); margin: 0 0 22px; }
.byline a { color: var(--muted); }
main { padding-bottom: 40px; }
main p, main li { max-width: 760px; }
.lede-grid { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }

/* calculator */
.tool { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 18px; display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .tool { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); padding: 22px; } }
.fields { display: grid; gap: 12px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
.fields .full { grid-column: 1 / -1; }
.f label, .f .lab { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.f input, .f select { width: 100%; font: 17px/1.3 var(--body); color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: 10px 11px; min-height: 44px; }
.f input:focus, .f select:focus { outline: 2px solid var(--cool); outline-offset: 1px; }
.f .unit { font-weight: 400; text-transform: none; letter-spacing: 0; }
.seg { display: flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.seg label { flex: 1; margin: 0; text-transform: none; letter-spacing: 0; font-size: 15px; font-weight: 500; color: var(--ink); text-align: center; cursor: pointer; }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; width: 1px; height: 1px; min-height: 0; padding: 0; margin: 0; border: 0; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 10px 4px; min-height: 44px; }
.seg input:checked + span { background: var(--cool); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--heat); outline-offset: -2px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--cool); }

.lcd { background: var(--lcd); color: var(--lcd-ink); border-radius: var(--r); padding: 16px 18px; font-family: var(--mono); align-self: start; }
.lcd .k { font: 600 12px/1.2 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--lcd-dim); }
.lcd .big { font-size: clamp(34px, 8vw, 46px); line-height: 1.1; font-weight: 600; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.lcd .big small { font-size: 18px; color: var(--lcd-dim); margin-left: 4px; }
.lcd .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; border-top: 1px dashed #2f5155; padding-top: 12px; }
.lcd .v { font-size: 20px; font-variant-numeric: tabular-nums; }
.lcd .heat { color: #ffb18a; }
.lcd ol { margin: 12px 0 0; padding: 12px 0 0 18px; border-top: 1px dashed #2f5155; font-size: 13px; color: var(--lcd-dim); }
.lcd ol li { margin: 2px 0; }
.lcd .note { font: 13px/1.45 var(--body); color: var(--lcd-dim); margin: 12px 0 0; }

/* tables */
.tbl { overflow-x: auto; margin: 14px 0 6px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); }
table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
caption { text-align: left; padding: 10px 12px; font-size: 14px; color: var(--muted); caption-side: bottom; border-top: 1px solid var(--rule); }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--rule); white-space: nowrap; }
thead th { background: var(--cool-wash); color: var(--ink); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.wrap-ok, th.wrap-ok { white-space: normal; min-width: 180px; }

.formula { font-family: var(--mono); background: var(--sheet); border: 1px solid var(--rule); border-left: 4px solid var(--heat); border-radius: 6px; padding: 12px 14px; overflow-x: auto; font-size: 15px; max-width: 760px; }
.caveat { background: var(--warn-wash); color: var(--ink); border-left: 4px solid var(--warn); border-radius: 6px; padding: 12px 14px; max-width: 760px; font-size: 15px; }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin: 16px 0; }
.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 16px; text-decoration: none; color: var(--ink); display: block; }
.card:hover { border-color: var(--cool); color: var(--ink); }
.card b { display: block; font: 700 18px/1.25 var(--head); margin-bottom: 4px; color: var(--cool); }
.card span { font-size: 15px; color: var(--muted); }
.chain { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; font-family: var(--mono); font-size: 15px; }
.chain span { background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 6px 10px; }
.chain i { font-style: normal; color: var(--muted); }
details { border-bottom: 1px solid var(--rule); padding: 10px 0; max-width: 760px; }
summary { cursor: pointer; font-weight: 600; font-family: var(--head); font-size: 17px; }
details p { margin: 8px 0 2px; }
.related { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.related a { display: inline-block; border: 1px solid var(--rule); border-radius: 999px; padding: 7px 13px; text-decoration: none; background: var(--sheet); font-size: 15px; }
.src { font-size: 14px; color: var(--muted); }
.src li { margin: 4px 0; }
.report { font-size: 15px; }

/* footer */
footer { border-top: 1px solid var(--rule); background: var(--sheet); font-size: 14px; color: var(--muted); padding: 26px 0 34px; }
footer .cols { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
footer a { color: var(--muted); }
footer ul { list-style: none; padding: 0; margin: 6px 0 0; }
footer li { margin: 4px 0; }
footer .fine { margin-top: 18px; }
.err { text-align: center; padding: 50px 0 10px; }
.err .code { font: 600 72px/1 var(--mono); color: var(--cool); }
