/* Kilowatt Almanac. See DESIGN.md for the token rationale. */
@font-face { font-family: "Schibsted Grotesk"; src: url("/fonts/schibsted-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk"; src: url("/fonts/schibsted-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk"; src: url("/fonts/schibsted-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url("/fonts/b612mono-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --glass: #E6ECEA;
  --face: #FAFBF8;
  --ink: #142330;
  --slate: #586A77;
  --needle: #CF3B2A;
  --brass: #9C7B3C;
  --rule: #C9D3D0;
  --ink-soft: #2C3E4C;

  --step--1: 0.889rem;
  --step-0: 1.125rem;   /* 18px body */
  --step-1: 1.406rem;
  --step-2: 1.758rem;
  --step-3: 2.197rem;
  --step-4: 2.747rem;
  --step-5: 3.433rem;

  --measure: 64ch;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius-field: 6px;
  --radius-panel: 14px;
  --font: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "B612 Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--glass); color: var(--ink);
  font-family: var(--font); font-size: var(--step-0); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-decoration-color: var(--slate); }
a:hover { text-decoration-color: var(--needle); }
:focus-visible { outline: 3px solid var(--needle); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--face); padding: .6rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; top: 1rem; }

.wrap { width: 100%; max-width: 76rem; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- header / footer ---------- */
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.25rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 800; letter-spacing: -0.01em; font-size: 1.15rem; }
.brand svg { width: 30px; height: 30px; }
.nav { display: flex; gap: clamp(.9rem, 2.5vw, 1.8rem); font-size: var(--step--1); }
.nav a { white-space: nowrap; text-decoration: none; color: var(--ink-soft); padding: .3rem 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { border-bottom-color: var(--ink); color: var(--ink); }

.site-foot { margin-top: clamp(4rem, 10vw, 7rem); border-top: 1px solid var(--rule); padding: 2.5rem 0 3rem; font-size: var(--step--1); color: var(--slate); }
.site-foot .cols { display: grid; gap: 2rem; grid-template-columns: 2fr 1fr 1fr; }
.site-foot h2 { font-size: var(--step--1); color: var(--ink); margin: 0 0 .6rem; font-weight: 600; }
.site-foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.site-foot a { color: var(--ink-soft); }
.site-foot p { margin: 0 0 .6rem; max-width: 46ch; }

/* ---------- type ---------- */
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; margin: 0; }
h1 { font-weight: 800; font-size: clamp(var(--step-3), 5.2vw, var(--step-5)); letter-spacing: -0.035em; max-width: 20ch; }
.lede { font-size: var(--step-1); line-height: 1.45; color: var(--ink-soft); max-width: 46ch; margin: 1rem 0 0; }
.crumbs { font-size: var(--step--1); color: var(--slate); margin: 2rem 0 1.25rem; }
.crumbs a { color: var(--slate); }

/* ---------- forms ---------- */
.field { display: grid; gap: .35rem; margin-bottom: 1.15rem; }
.field > label, .field > .label { font-weight: 600; font-size: var(--step--1); }
.hint { font-size: .82rem; color: var(--slate); line-height: 1.45; }
.input { display: flex; align-items: stretch; background: var(--face); border: 1.5px solid #AEBBB8; border-radius: var(--radius-field); overflow: hidden; }
.input:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(207, 59, 42, .22); }
.input input, .input select, select.input {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; font: inherit; color: var(--ink);
  padding: .62rem .8rem; width: 100%; min-width: 0;
}

.input input:focus, .input select:focus { outline: none; }
.input .unit { display: flex; align-items: center; padding: 0 .8rem; color: var(--slate); font-size: var(--step--1); border-left: 1px solid var(--rule); white-space: nowrap; background: #F1F4F2; }
.input .unit.pre { border-left: 0; border-right: 1px solid var(--rule); }
.select { position: relative; }
.select::after { content: ""; position: absolute; right: .9rem; top: 50%; width: .5rem; height: .5rem; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select select { padding-right: 2.2rem; cursor: pointer; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

.choice { display: flex; flex-wrap: wrap; gap: .4rem; border: 0; padding: 0; margin: 0 0 1.15rem; }
.choice legend { font-weight: 600; font-size: var(--step--1); margin-bottom: .45rem; padding: 0; }
.choice label { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span { display: inline-block; padding: .45rem .85rem; border: 1.5px solid #AEBBB8; border-radius: 999px; background: var(--face); font-size: var(--step--1); }
.choice input:checked + span { background: var(--ink); color: var(--face); border-color: var(--ink); }
.choice input:focus-visible + span { outline: 3px solid var(--needle); outline-offset: 2px; }

/* ---------- the tool layout ---------- */
.tool { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; margin-top: 2rem; }
.tool-form { padding-top: .25rem; }
.meter-col { position: sticky; top: 1.25rem; }

/* the meter: the one bold object on every page */
.meter {
  background: var(--ink); color: var(--face); border-radius: var(--radius-panel);
  padding: clamp(1.25rem, 3vw, 2rem); position: relative;
}
.meter-title { font-size: var(--step--1); color: #B9C7CF; margin: 0 0 1rem; font-weight: 400; }
.meter-title strong { color: var(--face); font-weight: 600; }
.register {
  display: flex; justify-content: center; align-items: stretch; gap: 4px;
  background: #0A141C; border-radius: 10px; padding: 12px 14px;
  box-shadow: inset 0 0 0 2px var(--brass), inset 0 6px 14px rgba(0,0,0,.55);
  font-family: var(--mono); font-weight: 700; font-size: clamp(2.2rem, 6.5vw, 4.1rem); line-height: 1;
}
.drum { height: 1.3em; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; }
.drum--digit { align-items: flex-start; }
.drum--digit {
  width: .78em; background: linear-gradient(#E8E4DA, #FFFFFF 45%, #FFFFFF 55%, #DCD7CB);
  color: #101A22; border-radius: 4px; position: relative;
}
.drum--digit::after { content: ""; position: absolute; inset: 0; border-radius: 4px; background: linear-gradient(rgba(0,0,0,.28), transparent 26%, transparent 74%, rgba(0,0,0,.28)); pointer-events: none; }
.drum--digit:nth-last-child(-n+2) { background: linear-gradient(#E7B8AF, #FFF4F1 45%, #FFF4F1 55%, #E1A79C); color: #7A1D12; }
.drum--digit.is-lead { color: #9AA3A6; }
.drum--sep { color: #E9EEF0; width: .5em; }
.strip { display: flex; flex-direction: column; height: 1000%; transition: transform .55s cubic-bezier(.2,.75,.25,1); }
.strip span { height: 10%; display: flex; align-items: center; justify-content: center; }
.register.is-negative { box-shadow: inset 0 0 0 2px var(--needle), inset 0 6px 14px rgba(0,0,0,.55); }
.meter-unit { text-align: center; margin: .8rem 0 0; color: #B9C7CF; font-size: var(--step--1); }

.readout { width: 100%; border-collapse: collapse; margin-top: 1.4rem; font-size: var(--step--1); }
.readout th, .readout td { padding: .55rem 0; border-top: 1px solid #2A3C4A; text-align: left; font-weight: 400; }
.readout td { text-align: right; font-weight: 600; color: var(--face); }
.readout th { color: #B9C7CF; }

.verdict { margin: 1.2rem 0 0; padding: .9rem 1rem; border-radius: 10px; background: #1D3040; font-size: var(--step--1); line-height: 1.5; }
.verdict strong { color: #FFC9BF; font-weight: 600; }

.scale { margin-top: 1.5rem; }
.scale p { margin: 0 0 .7rem; font-size: .82rem; color: #B9C7CF; }
.scale-bar { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #3C5566, #7E95A3); margin: 1.6rem 0 .5rem; }
.scale-mark { position: absolute; top: -7px; width: 2px; height: 22px; background: var(--face); transform: translateX(-1px); transition: left .4s ease; }
.scale-mark[data-mark=you] { background: var(--needle); width: 4px; transform: translateX(-2px); }
.scale-mark span { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .75rem; color: #DCE5EA; }
.scale-mark[data-mark=us] span { bottom: auto; top: 26px; color: #B9C7CF; }
.scale-ends { display: flex; justify-content: space-between; font-size: .75rem; color: #8FA2AE; margin-top: 1.7rem; }

.share { margin-top: 1.2rem; background: none; border: 1px solid #4A6070; color: var(--face); font: inherit; font-size: var(--step--1); padding: .5rem .9rem; border-radius: 999px; cursor: pointer; }
.share:hover { border-color: var(--face); }

/* ---------- reading column ---------- */
.article { max-width: var(--measure); margin-top: clamp(3rem, 7vw, 5rem); }
.article h2 { font-size: var(--step-2); font-weight: 800; margin: 3rem 0 1rem; }
.article h3 { font-size: var(--step-1); font-weight: 600; margin: 2rem 0 .6rem; }
.article p, .article li { color: var(--ink-soft); }
.article p { margin: 0 0 1.1rem; }
.article ul, .article ol { padding-left: 1.2rem; margin: 0 0 1.2rem; }
.article li { margin-bottom: .4rem; }
.formula { font-size: var(--step-0); background: var(--face); border-left: 4px solid var(--ink); padding: 1rem 1.2rem; margin: 1.2rem 0 1.6rem; border-radius: 0 var(--radius-field) var(--radius-field) 0; color: var(--ink); }
.formula b { font-weight: 600; }
.worked { border: 1.5px solid var(--rule); border-radius: var(--radius-field); padding: 1rem 1.2rem; margin: 1.2rem 0 1.6rem; background: var(--face); }
.worked p:last-child { margin: 0; }
.faq details { border-top: 1px solid var(--rule); padding: .9rem 0; }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 400; font-size: 1.4rem; line-height: 1; color: var(--slate); }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: .7rem 0 0; }
.sources { font-size: var(--step--1); }
.sources li { color: var(--slate); }
.reviewed { font-size: var(--step--1); color: var(--slate); border-top: 1px solid var(--rule); padding-top: 1rem; margin-top: 2.5rem; }

.data-table { width: 100%; border-collapse: collapse; font-size: var(--step--1); margin: 1rem 0 1.6rem; background: var(--face); border-radius: var(--radius-field); overflow: hidden; }
.data-table th, .data-table td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--rule); }
.data-table td.n, .data-table th.n { text-align: right; }
.data-table thead th { background: #DDE5E2; font-weight: 600; }
.data-table th[data-key] { cursor: pointer; }
.data-table th[aria-sort=ascending]::after { content: " \25B2"; font-size: .7em; }
.data-table th[aria-sort=descending]::after { content: " \25BC"; font-size: .7em; }
.data-table tbody tr:hover { background: #F0F4F2; }
.table-scroll { overflow-x: auto; }

/* ---------- ads: fixed space so nothing jumps ---------- */
.ad { margin: 2.5rem 0; min-height: 280px; display: flex; align-items: center; justify-content: center; }
.ad--empty { border: 1px dashed var(--rule); color: #95A4A0; font-size: .8rem; border-radius: var(--radius-field); }
.ad-label { font-size: .72rem; color: var(--slate); text-align: center; margin: 0 0 .3rem; }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(2.5rem, 6vw, 4.5rem); }
.ask { font-weight: 800; font-size: clamp(1.85rem, 4.4vw, 3.2rem); line-height: 1.32; letter-spacing: -0.03em; margin: 0; }
.ask .slot { display: inline-flex; vertical-align: baseline; }
.ask select, .ask input {
  font: inherit; letter-spacing: inherit; color: var(--ink); background: transparent; border: 0;
  border-bottom: 4px solid var(--ink); padding: 0 .1em; border-radius: 0; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.ask select:hover, .ask input:hover { border-bottom-color: var(--needle); }
.ask select:focus, .ask input:focus { outline: none; border-bottom-color: var(--needle); background: rgba(207,59,42,.07); }
.ask input { width: 2.1ch; text-align: center; }
.ask .select::after { right: .08em; width: .2em; height: .2em; border-width: 0 3px 3px 0; transform: translateY(-40%) rotate(45deg); }
.ask select { padding-right: .5em; }
.ask-note { margin: 1.4rem 0 0; color: var(--slate); font-size: var(--step--1); max-width: 52ch; }

.index { border-top: 2px solid var(--ink); }
.index-group { display: grid; grid-template-columns: 12rem 1fr; gap: 1.5rem; padding: 1.6rem 0; border-bottom: 1px solid var(--rule); }
.index-group h2 { font-size: var(--step-1); font-weight: 800; }
.index-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem 2.5rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.index-group a { font-weight: 600; font-size: var(--step-0); }
.index-group li p { margin: .2rem 0 0; font-size: var(--step--1); color: var(--slate); line-height: 1.45; }
.about-data { display: grid; grid-template-columns: 12rem 1fr; gap: 1.5rem; padding: 2.5rem 0 0; }
.about-data h2 { font-size: var(--step-1); font-weight: 800; }
.about-data p { margin: 0 0 1rem; max-width: var(--measure); color: var(--ink-soft); }

.page-head { padding: clamp(2rem, 5vw, 3.5rem) 0 0; }
.prose { max-width: var(--measure); }
.prose h2 { font-size: var(--step-2); font-weight: 800; margin: 2.6rem 0 .9rem; }
.prose p, .prose li { color: var(--ink-soft); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .tool, .hero { grid-template-columns: 1fr; }
  .meter-col { position: static; }
  .index-group, .about-data { grid-template-columns: 1fr; gap: .8rem; }
  .site-foot .cols { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .row2 { grid-template-columns: 1fr; }
  .nav { width: 100%; justify-content: space-between; padding-bottom: .6rem; font-size: .85rem; }
  .register { gap: 3px; padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .strip, .scale-mark { transition: none !important; }
}
@media print {
  .ad, .site-head nav, .share { display: none !important; }
  body { background: #fff; }
}
