/* Layout idea: a spec sheet. Inputs read like a form you fill in for the electrician; results read like
   the line items on a quote. One axis carries the identity: cold on the left in glacier blue, hot on the
   right in ember, and every result is placed on a ruler drawn in one of the two. */
:root {
  --bg: #f3f6f7; --panel: #ffffff; --ink: #1f262b; --muted: #58646b; --line: #d3dce1; --soft: #e8eef1;
  --hot: #c93a17; --cold: #0b68a4; --btn: #1f262b; --btn-ink: #ffffff; --focus: #0b68a4;
  --display: "Familjen Grotesk", "Segoe UI", system-ui, sans-serif;
  --body: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
  --r: 6px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14191c; --panel: #1b2226; --ink: #e8eef1; --muted: #9eabb2; --line: #303b41; --soft: #232c31;
    --hot: #ff7d58; --cold: #62b9ee; --btn: #e8eef1; --btn-ink: #14191c; --focus: #62b9ee; }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.55 var(--body); font-variant-numeric: tabular-nums; }
h1, h2, h3, .big, .brand { font-family: var(--display); line-height: 1.12; letter-spacing: -0.01em; margin: 0; }
h1, .h1 { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 700; max-width: 20ch; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; margin-top: 32px; }
p { margin: 0 0 14px; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.sr { position: absolute; left: -9999px; }
.sr:focus { left: 12px; top: 12px; background: var(--panel); padding: 8px 12px; z-index: 5; }
.small { font-size: 0.875rem; } .muted { color: var(--muted); } .r { text-align: right; }
.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
main.wrap { padding-block: 40px 72px; }
main.narrow { width: min(760px, 100% - 40px); }

/* Header and footer */
.top { border-bottom: 1px solid var(--line); background: var(--panel); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; padding-block: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 700; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 4px; font-size: 0; background: linear-gradient(90deg, var(--cold) 50%, var(--hot) 50%); }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-left: auto; }
.top nav a { text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.top nav a:hover, .top nav a[aria-current] { border-bottom-color: var(--ink); }
.foot { border-top: 1px solid var(--line); padding-block: 28px 40px; font-size: 0.875rem; color: var(--muted); }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 16px; color: var(--ink); }
.foot p { max-width: 75ch; margin-bottom: 8px; }

/* Intro */
.intro { padding-bottom: 28px; }
.intro p { font-size: 1.15rem; max-width: 58ch; margin-top: 14px; color: var(--muted); }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.875rem; color: var(--muted); margin-bottom: 18px; }

/* Calculator */
.bench { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 36px; align-items: start; }
.inputs, .results { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; }
.group + .group, .seg + .group { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.group h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 14px; }
.f { display: block; margin-bottom: 14px; }
.f > span:first-child { display: block; font-size: 0.9rem; font-weight: 700; margin-bottom: 5px; }
.f small, .hint { display: block; font-size: 0.8125rem; color: var(--muted); margin-top: 5px; }
.inp { display: flex; align-items: center; border: 1px solid var(--muted); border-radius: var(--r); background: var(--bg); }
.inp:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; }
.inp input { flex: 1; min-width: 0; border: 0; background: none; color: inherit; font: inherit; padding: 9px 10px; outline: none; }
.inp i { font-style: normal; font-size: 0.8125rem; color: var(--muted); padding-right: 10px; white-space: nowrap; }
select { width: 100%; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--muted); border-radius: var(--r); padding: 9px 10px; }
.f3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.f3 .f { margin-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chips button { font: inherit; font-size: 0.9rem; color: inherit; background: none; border: 1px solid var(--muted); border-radius: 999px; padding: 4px 14px; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.seg { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg legend { font-family: var(--display); font-size: 1.1rem; font-weight: 600; padding: 0; margin-bottom: 14px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; text-align: center; padding: 10px 8px; border: 1px solid var(--muted); border-radius: var(--r); cursor: pointer; font-size: 0.95rem; }
.seg input:checked + span { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); font-weight: 700; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Results */
.verdict .lead { margin: 0; color: var(--muted); }
.verdict .big { font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 700; margin: 2px 0 10px; }
.verdict p:last-child { max-width: 52ch; }
.note { border: 1px solid var(--line); background: var(--soft); border-radius: var(--r); padding: 12px 14px; font-size: 0.95rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn { display: inline-block; background: var(--btn); color: var(--btn-ink); border: 1px solid var(--btn); border-radius: var(--r); padding: 10px 16px; font-weight: 700; text-decoration: none; }
.btn.ghost { background: none; color: var(--ink); border-color: var(--muted); font-weight: 400; }
.btn:hover { text-decoration: underline; }

/* The ruler */
.ruler { margin: 30px 0 34px; --tone: var(--hot); }
.ruler.cold { --tone: var(--cold); }
.ruler-track { position: relative; height: 14px; background: var(--soft); border: 1px solid var(--line); border-radius: 2px; }
.ruler-fill { position: absolute; inset: 0 auto 0 0; background: var(--tone); border-radius: 1px 0 0 1px; }
.ruler-mark { position: absolute; top: -8px; bottom: -8px; width: 2px; background: var(--ink); }
.ruler-mark b { position: absolute; bottom: 100%; left: 6px; font-size: 0.8125rem; white-space: nowrap; padding-bottom: 2px; }
.ruler-mark.flip b { left: auto; right: 6px; }
.ruler-ticks { position: relative; list-style: none; margin: 0; padding: 0; height: 30px; }
.ruler-ticks li { position: absolute; top: 0; transform: translateX(-50%); font-size: 0.8125rem; color: var(--muted); padding-top: 9px; }
.ruler-ticks li::before { content: ""; position: absolute; left: 50%; top: 0; width: 1px; height: 7px; background: var(--muted); }
.ruler-ticks li.on { color: var(--ink); font-weight: 700; }
.ruler-ticks li.on::before { width: 3px; margin-left: -1px; background: var(--tone); height: 9px; }

/* Tables */
.tablewrap { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; font-weight: 400; }
th + td, td + td, th + th { padding-left: 16px; }
thead th { font-size: 0.8125rem; color: var(--muted); border-bottom-color: var(--muted); }
th.r, td.r { text-align: right; }
td.r { white-space: nowrap; }
th small, td small { display: block; font-size: 0.8125rem; color: var(--muted); white-space: normal; }
tr.pick th, tr.pick td { font-weight: 700; }
tr.pick th { box-shadow: inset 3px 0 0 var(--cold); padding-left: 10px; }
.prose table { margin-bottom: 8px; }

/* Articles and lists */
.prose { max-width: 72ch; }
.prose h1 { margin-bottom: 18px; }
.prose h2 { margin: 44px 0 12px; }
.prose h3 { margin: 28px 0 8px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.prose .tablewrap { margin-bottom: 18px; }
.wide { max-width: none; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0 28px; max-width: none; }
.cards a { display: block; padding: 16px 0; border-top: 1px solid var(--line); text-decoration: none; }
.cards a strong { display: block; font-family: var(--display); font-size: 1.1rem; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.cards a span { display: block; color: var(--muted); font-size: 0.95rem; margin-top: 4px; }
.linklist { list-style: none; padding: 0; columns: 2 260px; column-gap: 28px; }
.linklist li { break-inside: avoid; padding: 5px 0; }
.cta-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 40px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.cta-strip p { margin: 0; max-width: 46ch; }

.dock { display: none; }
@media (max-width: 860px) {
  .dock { display: flex; justify-content: space-between; align-items: center; gap: 12px; position: sticky; bottom: 0; z-index: 2; margin: 0 -20px; padding: 10px 20px; background: var(--btn); color: var(--btn-ink); font-size: 0.9rem; font-weight: 700; }
  .dock a { font-weight: 400; white-space: nowrap; }
  .results { order: 3; } .dock { order: 2; }
  body { font-size: 16px; }
  .bench { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .inputs, .results { padding: 18px; }
  .top nav { margin-left: 0; width: 100%; }
}
@media print {
  .top, .foot, .inputs, .actions { display: none; }
  .bench { display: block; } .results { border: 0; padding: 0; }
}
