/* smartbilbytte.no – se DESIGN.md for reglene bak verdiene. */

@font-face { font-family: 'Barlow'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/barlow-400.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/barlow-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/barlow-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/barlow-700.woff2') format('woff2'); }

:root {
  color-scheme: light;
  --canvas: #f2f3ef;
  --surface: #fbfbf9;
  --surface-2: #e6e8e2;
  --ink: #14181d;
  --muted: #4b525b;
  --line: #c9ccc4;
  --accent: #ffc61a;
  --on-accent: #14181d;
  --focus: #1f45b5;
  --plate: #ffffff;
  --plate-ink: #111111;
  --plate-strip: #1a3b9c;
  --series-beholde: #2a78d6;
  --series-bytte: #eb6834;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --axis-text: #6c6f6a;
  --warn-bg: #fff3cf;
  --warn-ink: #5a4100;
  --error: #b3261e;
  --asfalt: #17191c;
  --asfalt-2: #24272c;
  --asfalt-3: #31353b;
  --asfalt-ink: #f3f4f0;
  --asfalt-muted: #b1b6bc;
  --asfalt-feil: #ff9a90;
  --midtlinje: #ffc61a;
  --konklusjon-under: #3d3000;

  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --t-display: clamp(2.75rem, 1.5rem + 5.2vw, 6rem);
  --t-heading: clamp(1.6rem, 1.2rem + 1.6vw, 2.5rem);
  --t-body: 1.0625rem;
  --t-small: 0.9375rem;

  --margin: clamp(16px, 4vw, 40px);
  --gap-section: clamp(72px, 10vw, 140px);
  --radius: 999px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #121519;
    --surface: #1a1e23;
    --surface-2: #242930;
    --ink: #eef0ec;
    --muted: #b4bac2;
    --line: #3a4048;
    --accent: #ffc61a;
    --on-accent: #14181d;
    --focus: #8fb0ff;
    --series-beholde: #3987e5;
    --series-bytte: #d95926;
    --grid: #2c2f33;
    --axis: #42474e;
    --axis-text: #9aa0a7;
    --warn-bg: #3a2f10;
    --warn-ink: #ffe3a1;
    --error: #ff8a80;
    --asfalt: #0b0d10;
    --asfalt-2: #1a1e24;
    --asfalt-3: #262b32;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #121519;
  --surface: #1a1e23;
  --surface-2: #242930;
  --ink: #eef0ec;
  --muted: #b4bac2;
  --line: #3a4048;
  --focus: #8fb0ff;
  --series-beholde: #3987e5;
  --series-bytte: #d95926;
  --grid: #2c2f33;
  --axis: #42474e;
  --axis-text: #9aa0a7;
  --warn-bg: #3a2f10;
  --warn-ink: #ffe3a1;
  --error: #ff8a80;
  --asfalt: #0b0d10;
  --asfalt-2: #1a1e24;
  --asfalt-3: #262b32;
  --konklusjon-under: #3d3000;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.5;
  caret-color: var(--focus);
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent); color: var(--on-accent); }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
button, input, select { font: inherit; color: inherit; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.hopp { position: absolute; left: 16px; top: -48px; background: var(--ink); color: var(--canvas); padding: 10px 16px; z-index: 10; border-radius: 6px; }
.hopp:focus { top: 12px; }

/* Asfalt: toppmeny, intro og bilvalg ligger på samme mørke flate */
.vei { background: var(--asfalt); color: var(--asfalt-ink); }
.vei ::selection { background: var(--accent); color: var(--on-accent); }
.ramme { max-width: 1320px; margin: 0 auto; padding: 0 var(--margin); }

/* Toppmeny */
.topp { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 20px; padding-bottom: 20px; }
.ordmerke { display: inline-flex; align-items: center; font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; text-decoration: none; }
.ordmerke span { color: var(--asfalt-muted); font-weight: 500; }
.ordmerke-skilt { width: 34px; height: 21px; flex: none; margin-right: 10px; }
.topp nav { display: flex; gap: 28px; font-size: var(--t-small); }
.topp nav a { text-decoration: none; color: var(--asfalt-muted); padding: 10px 0; transition: color 160ms ease; }
.topp nav a:hover { color: var(--asfalt-ink); }

/* Intro */
.vei-hero { padding-bottom: clamp(48px, 7vw, 104px); }
.intro { padding: clamp(32px, 7vw, 96px) 0 clamp(36px, 5vw, 64px); max-width: 1040px; }
h1 {
  font-size: var(--t-display);
  line-height: 0.95;
  letter-spacing: -0.035em;
  font-weight: 700;
  text-wrap: balance;
}
.ingress { margin-top: 24px; font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem); line-height: 1.45; max-width: 36em; color: var(--asfalt-ink); }

/* Bilene: to kolonner med gul midtlinje mellom, som på en norsk landevei */
.bilene { display: grid; grid-template-columns: 1fr 96px 1fr; align-items: start; }
.midtlinje { align-self: stretch; position: relative; display: flex; justify-content: center; }
.midtlinje::before {
  content: ''; position: absolute; top: 8px; bottom: 8px; left: 50%; width: 6px; margin-left: -3px;
  background: repeating-linear-gradient(to bottom, var(--midtlinje) 0 28px, transparent 28px 52px);
  border-radius: 3px;
}
.midtlinje span {
  position: relative; margin-top: 108px; align-self: flex-start;
  background: var(--asfalt); color: var(--asfalt-muted); padding: 10px 0; font-size: var(--t-small); font-weight: 500;
}
.bilkolonne { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.kolonnetittel { font-size: 1.25rem; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.serie-merke { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.serie-beholde { background: var(--series-beholde); }
.serie-bytte { background: var(--series-bytte); }

.skiltform { display: flex; gap: 10px; align-items: stretch; }
.skilt {
  flex: 1; min-width: 0;
  display: flex; align-items: stretch;
  background: var(--plate); color: var(--plate-ink);
  border: 3px solid var(--plate-ink);
  box-shadow: 0 0 0 2px var(--plate);
  border-radius: 10px;
  overflow: hidden;
  height: 76px;
  cursor: text;
}
.skilt:focus-within { outline: 3px solid var(--accent); outline-offset: 4px; }
.skilt-landkode {
  flex: none; width: 42px;
  background: var(--plate-strip); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
  padding: 0 0 9px; font-weight: 700; font-size: 1rem; line-height: 1;
}
.flagg { width: 22px; height: 16px; margin-bottom: auto; margin-top: 10px; }
.skilt-input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font-weight: 700; font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.75rem);
  letter-spacing: 0.06em; text-transform: uppercase; padding: 0 14px;
  font-variant-numeric: tabular-nums;
  color: var(--plate-ink); caret-color: var(--plate-strip);
}
.skilt-input::placeholder { color: #b4b7b2; }

.knapp {
  border: 0; cursor: pointer; border-radius: var(--radius);
  padding: 0 26px; min-height: 48px; font-weight: 600;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}
.knapp:active { transform: scale(0.97); }
.knapp-primar { background: var(--accent); color: var(--on-accent); font-size: 1.0625rem; }
@media (hover: hover) and (pointer: fine) { .knapp-primar:hover { background: #ffd54f; } }
.knapp-primar[aria-busy="true"] { cursor: progress; opacity: 0.75; }
.knapp-stille { background: var(--surface); color: var(--ink); margin-top: 20px; }
@media (hover: hover) and (pointer: fine) { .knapp-stille:hover { background: var(--canvas); } }

.skiltstatus { min-height: 1.5em; font-size: var(--t-small); color: var(--asfalt-muted); }
.skiltstatus.feil { color: var(--asfalt-feil); font-weight: 500; }

.bilkort {
  background: var(--asfalt-2); border-radius: 20px; padding: 20px 22px;
  display: grid; gap: 8px;
}
.bilkort-navn { font-size: 1.375rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
.bilkort-fakta { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--asfalt-muted); font-size: var(--t-small); margin: 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.bilkort-varsel { display: flex; gap: 8px; align-items: flex-start; background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 10px 12px; font-size: var(--t-small); margin-top: 6px; }
.vei .bilkort-varsel { background: #3a2f10; color: #ffe3a1; }
.ikon { width: 18px; height: 18px; flex: none; margin-top: 2px; }

.maler { border: 0; margin: 4px 0 0; padding: 0; min-width: 0; }
.maler legend { font-size: var(--t-small); color: var(--asfalt-muted); padding: 0; margin-bottom: 10px; }
.malvalg { display: flex; flex-wrap: wrap; gap: 8px; }
.malvalg label { position: relative; }
.malvalg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.malvalg span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border-radius: var(--radius); background: var(--asfalt-2); color: var(--asfalt-ink); font-size: var(--t-small); font-weight: 500;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.malvalg label:active span { transform: scale(0.97); }
.malvalg input:checked + span { background: var(--asfalt-ink); color: var(--asfalt); }
.malvalg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .malvalg input:not(:checked):hover + span { background: var(--asfalt-3); } }

/* Regnestykket */
.regnestykket {
  display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: clamp(24px, 4vw, 64px);
  padding-top: clamp(48px, 6vw, 80px); align-items: start;
}
.seksjonstittel { font-size: 1.25rem; font-weight: 600; margin-bottom: 20px; }
.kontroller { display: flex; flex-direction: column; gap: 26px; }
@media (min-width: 961px) and (min-height: 860px) {
  .kontroller:not(:has(details[open])) { position: sticky; top: 16px; }
}

.glider-topp { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.glider-topp label { font-weight: 500; }
.verdifelt { display: inline-flex; align-items: baseline; gap: 6px; }
.verdifelt input {
  width: 7.5ch; text-align: right; border: 0; border-bottom: 2px solid var(--line);
  background: transparent; padding: 2px 0; font-weight: 600; font-size: 1.125rem;
  font-variant-numeric: tabular-nums; border-radius: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.verdifelt input::-webkit-outer-spin-button, .verdifelt input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.verdifelt input:focus { border-bottom-color: var(--focus); outline: none; }
.verdifelt input::placeholder { color: var(--muted); font-weight: 400; }
.enhet { color: var(--muted); font-size: var(--t-small); }
.hjelp { font-size: var(--t-small); color: var(--muted); margin-top: 6px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; cursor: pointer; margin: 0;
  --fyll: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--ink) var(--fyll), var(--surface-2) var(--fyll));
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--surface-2); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; margin-top: -10px;
  background: var(--surface); border: 3px solid var(--ink);
  transition: transform 160ms var(--ease-out);
}
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 3px solid var(--ink); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--focus); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--focus); }

.horisont { border: 0; padding: 0; margin: 0; }
.horisont legend { font-weight: 500; margin-bottom: 10px; padding: 0; }
.segment { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface-2); border-radius: var(--radius); padding: 4px; }
.segment label { position: relative; }
.segment input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segment span {
  display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: var(--radius);
  font-weight: 500; font-size: var(--t-small); transition: background-color 160ms ease, color 160ms ease;
}
.segment input:checked + span { background: var(--ink); color: var(--canvas); }
.segment input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.flere { background: var(--surface-2); border-radius: 18px; }
.flere summary { cursor: pointer; padding: 14px 20px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 48px; }
.flere summary::-webkit-details-marker { display: none; }
.flere summary::after { content: '+'; font-size: 1.5rem; line-height: 1; font-weight: 500; transition: transform 200ms var(--ease-out); }
.flere[open] summary::after { transform: rotate(45deg); }
.flere-innhold { padding: 0 20px 20px; }
.flere h3 { font-size: 1rem; font-weight: 600; margin: 18px 0 10px; }
.flere h3:first-child { margin-top: 0; }
.feltrad { display: grid; gap: 10px; }
.felt { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: var(--t-small); }
.felt .verdifelt input { font-size: 1rem; width: 7ch; }

/* Resultat */
.resultat { min-width: 0; display: flex; flex-direction: column; gap: 28px; }
/* Svaret står på vegskiltgult: det eneste stedet utenom primærknappen som får aksentfargen. */
.konklusjon {
  background: var(--accent); color: var(--on-accent);
  border-radius: 28px; padding: clamp(26px, 4vw, 52px);
}
.konklusjon ::selection { background: var(--on-accent); color: var(--accent); }
.konklusjon-tekst {
  font-size: clamp(1.9rem, 1.3rem + 2.2vw, 3.25rem); line-height: 1.04; letter-spacing: -0.03em; font-weight: 700; text-wrap: balance;
  font-variant-numeric: tabular-nums;
}
.krysning-tekst { margin-top: 18px; font-size: 1.125rem; color: var(--konklusjon-under); max-width: 40em; }

.nokkeltall { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0; }
.nokkel { background: var(--surface); border-radius: 20px; padding: 18px 22px; }
.nokkel dt { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; }
.nokkel dd { margin: 4px 0 0; font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.nokkel dd .enhet { font-size: 1rem; font-weight: 500; letter-spacing: 0; }
.nokkel-under { display: block; font-size: var(--t-small); color: var(--muted); font-weight: 400; margin-top: 2px; letter-spacing: 0; }

.varsler { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.varsler:empty { display: none; }
.varsler li { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-bg); color: var(--warn-ink); border-radius: 14px; padding: 12px 16px; }
.varsler li.info { background: var(--surface); color: var(--ink); }

.graf { margin: 0; background: var(--surface); border-radius: 28px; padding: clamp(18px, 3vw, 32px); }
.graf figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; margin-bottom: 12px; }
.graf-tittel { font-weight: 600; font-size: 1.125rem; }
.tegnforklaring { display: flex; gap: 20px; font-size: var(--t-small); color: var(--muted); }
.tegnforklaring > span { display: inline-flex; align-items: center; gap: 8px; }
.strek { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.graf-flate { position: relative; height: clamp(260px, 32vw, 360px); touch-action: pan-y; }
.graf-flate svg { display: block; width: 100%; height: 100%; overflow: visible; }
.graf-flate svg:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 8px; }
.graf-flate text { font-family: var(--font); font-variant-numeric: tabular-nums; }
.akse-tekst { fill: var(--axis-text); font-size: 13px; }
.rutenett { stroke: var(--grid); stroke-width: 1; }
.grunnlinje { stroke: var(--axis); stroke-width: 1; }
.linje { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.linje-beholde { stroke: var(--series-beholde); }
.linje-bytte { stroke: var(--series-bytte); }
.punkt-beholde { fill: var(--series-beholde); stroke: var(--surface); stroke-width: 2; }
.punkt-bytte { fill: var(--series-bytte); stroke: var(--surface); stroke-width: 2; }
.serie-etikett { font-size: 14px; font-weight: 600; fill: var(--ink); }
.horisont-linje { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.horisont-tekst { fill: var(--muted); font-size: 13px; font-weight: 500; }
.krysning-punkt { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.krysning-etikett { fill: var(--ink); font-size: 13px; font-weight: 600; }
.sikte { stroke: var(--muted); stroke-width: 1; }
.verktoytips {
  position: absolute; top: 0; left: 0; pointer-events: none;
  background: var(--ink); color: var(--canvas); border-radius: 12px; padding: 10px 14px;
  font-size: var(--t-small); line-height: 1.4; white-space: nowrap; font-variant-numeric: tabular-nums;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
  opacity: 0; transform: translateY(4px); transition: opacity 120ms ease, transform 160ms var(--ease-out);
}
.verktoytips.synlig { opacity: 1; transform: none; }
.verktoytips b { font-weight: 600; }
.verktoytips .rad { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.verktoytips .rad span:first-child { display: inline-flex; align-items: center; gap: 6px; }

.tabellboks { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 600; font-size: 1.125rem; padding: 0 0 12px; }
th, td { padding: 11px 12px; text-align: right; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { font-weight: 500; color: var(--muted); font-size: var(--t-small); }
tbody tr:nth-child(odd) td, tbody tr:nth-child(odd) th { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
tbody th { font-weight: 400; }
tfoot th, tfoot td { font-weight: 700; padding-top: 14px; }
.kostnadstabell td.lavest { font-weight: 600; }

.aarstabell summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.aarstabell[open] summary { margin-bottom: 8px; }

/* Metode */
.metode { padding: var(--gap-section) 0 0; }
.metode h2 { font-size: var(--t-heading); letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 24px; }
.metode-formel {
  font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem); font-weight: 600; line-height: 1.3; max-width: 34em;
  background: var(--surface-2); border-radius: 20px; padding: 22px 26px; margin-bottom: 40px;
}
.metode-kolonner { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 48px; }
.metode h3 { font-size: 1.125rem; font-weight: 600; margin: 0 0 6px; }
.metode p + h3 { margin-top: 24px; }
.metode-kolonner p { max-width: 36em; }
.forbehold { margin-top: 40px; color: var(--muted); max-width: 46em; }

/* Bunn: veien kommer tilbake, med midtlinjen på tvers */
.bunn {
  background: var(--asfalt); color: var(--asfalt-muted); font-size: var(--t-small);
  margin-top: var(--gap-section);
  padding: 0 max(var(--margin), calc((100% - 1320px) / 2 + var(--margin))) 120px;
}
.bunn::before {
  content: ''; display: block; height: 6px; margin-bottom: clamp(48px, 7vw, 96px);
  background: repeating-linear-gradient(to right, var(--midtlinje) 0 44px, transparent 44px 80px);
}
.bunn-ordmerke { font-size: clamp(2.75rem, 1.5rem + 7vw, 8rem); font-weight: 700; letter-spacing: -0.045em; line-height: 0.92; color: var(--asfalt-ink); margin-bottom: 20px; }

.mobilsvar { display: none; }
.noscript { position: fixed; inset: auto 16px 16px; background: var(--ink); color: var(--canvas); padding: 16px; border-radius: 16px; }

/* Nettbrett og mobil */
@media (max-width: 960px) {
  .regnestykket { grid-template-columns: 1fr; }
  .kontroller { position: static; }
  .metode-kolonner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .topp { flex-wrap: wrap; row-gap: 4px; padding-bottom: 8px; }
  .topp nav { order: 2; width: 100%; gap: 20px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
  .topp nav::-webkit-scrollbar { display: none; }
  .bilene { grid-template-columns: 1fr; }
  .midtlinje { height: 72px; align-items: center; }
  .midtlinje::before {
    top: 50%; bottom: auto; left: 0; right: 0; width: auto; height: 6px; margin: -3px 0 0;
    background: repeating-linear-gradient(to right, var(--midtlinje) 0 28px, transparent 28px 52px);
  }
  .midtlinje span { margin-top: 0; align-self: center; padding: 0 14px; }
  .metode-kolonner { grid-template-columns: 1fr; }
  .skilt { height: 64px; }
  .nokkeltall { gap: 10px; }
  .nokkel { padding: 14px 16px; }
  .konklusjon, .graf { border-radius: 22px; }
  .mobilsvar {
    display: block; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 5;
    transform: translateY(140%); transition: transform 240ms var(--ease-out);
  }
  .mobilsvar.synlig { transform: none; }
  .mobilsvar a {
    display: block; background: var(--ink); color: var(--canvas); text-decoration: none;
    border-radius: 18px; padding: 14px 18px; font-weight: 600; font-variant-numeric: tabular-nums;
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
  }
}

/* Bevegelse. Innhold er synlig uten JavaScript; klassen .js settes av app.js. */
@media (prefers-reduced-motion: no-preference) {
  .js .intro h1, .js .intro .ingress, .js .bilkolonne, .js .midtlinje {
    animation: opp 700ms var(--ease-out) both;
  }
  .js .intro .ingress { animation-delay: 70ms; }
  .js .bilkolonne[data-rolle="naa"] { animation-delay: 140ms; }
  .js .midtlinje { animation-delay: 200ms; }
  .js .bilkolonne[data-rolle="ny"] { animation-delay: 260ms; }
  .js .midtlinje::before { animation: kjor 1600ms var(--ease-out) 200ms both; }
  @media (max-width: 720px) { .js .midtlinje::before { animation-name: kjor-tvers; } }

  .js [data-inn] { opacity: 0; transform: translateY(24px); transition: opacity 600ms var(--ease-out), transform 700ms var(--ease-out); transition-delay: var(--forsinkelse, 0ms); }
  .js [data-inn].inne { opacity: 1; transform: none; }
}
@keyframes opp { from { opacity: 0; transform: translateY(20px); } }
@keyframes kjor { from { background-position: 0 -260px; } to { background-position: 0 0; } }
@keyframes kjor-tvers { from { background-position: -260px 0; } to { background-position: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
.belop { white-space: nowrap; }
@media (max-width: 480px) {
  th, td { padding: 10px 6px; font-size: var(--t-small); }
  caption { font-size: 1.0625rem; }
}

/* Gjeldende side i menyen */
.topp nav a[aria-current="page"] { color: var(--asfalt-ink); text-decoration: underline; text-decoration-color: var(--midtlinje); text-decoration-thickness: 3px; text-underline-offset: 8px; }

/* ---------- Artikler ---------- */
.artikkel-topp { padding-top: clamp(28px, 5vw, 72px); padding-bottom: clamp(40px, 6vw, 88px); }
.artikkel-topp h1 { font-size: clamp(2.5rem, 1.5rem + 4vw, 5rem); max-width: 16ch; }
.artikkel-topp .ingress { max-width: 38em; }
.smuler { font-size: var(--t-small); color: var(--asfalt-muted); margin-bottom: 20px; display: flex; gap: 8px; flex-wrap: wrap; }
.smuler a { color: var(--asfalt-muted); }
.smuler a:hover { color: var(--asfalt-ink); }
.artikkel-meta { margin-top: 20px; font-size: var(--t-small); color: var(--asfalt-muted); }

.artikkel-ramme {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(32px, 6vw, 96px);
  padding-top: clamp(40px, 6vw, 80px); align-items: start;
}
.artikkel { max-width: 44rem; font-size: 1.125rem; line-height: 1.6; }
.artikkel > * + * { margin-top: 1.1em; }
.artikkel h2 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem); line-height: 1.12; letter-spacing: -0.02em; margin-top: 2.2em; text-wrap: balance; }
.artikkel h2:first-child { margin-top: 0; }
.artikkel h3 { font-size: 1.25rem; line-height: 1.25; margin-top: 1.8em; }
.artikkel h2 + *, .artikkel h3 + * { margin-top: 0.6em; }
.artikkel ul, .artikkel ol { padding-left: 1.3em; margin-bottom: 0; }
.artikkel li + li { margin-top: 0.45em; }
.artikkel li::marker { color: var(--muted); }
.artikkel a { text-decoration-thickness: 2px; text-decoration-color: var(--midtlinje); }
.artikkel a:hover { text-decoration-color: var(--ink); }
.artikkel strong { font-weight: 600; }
.artikkel .tabellboks { margin-top: 1.4em; }
.artikkel table { font-size: 1rem; }
.artikkel caption { font-size: 1rem; }
.kilde { font-size: var(--t-small); color: var(--muted); }

.faktaboks { background: var(--surface); border-radius: 22px; padding: clamp(20px, 3vw, 32px); }
.faktaboks h2, .faktaboks h3 { margin-top: 0; }
.faktaboks > * + * { margin-top: 0.8em; }
.sjekkliste { list-style: none; padding: 0 !important; counter-reset: punkt; }
.sjekkliste li { position: relative; padding-left: 44px; counter-increment: punkt; }
.sjekkliste li + li { margin-top: 1em; }
.sjekkliste li::before {
  content: counter(punkt); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--canvas);
  display: grid; place-items: center; font-size: 0.9375rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

.artikkel-side { display: grid; gap: 20px; position: sticky; top: 24px; }
.cta-kort { background: var(--accent); color: var(--on-accent); border-radius: 24px; padding: 26px; }
.cta-kort h2 { font-size: 1.5rem; line-height: 1.15; letter-spacing: -0.02em; }
.cta-kort p { margin-top: 10px; color: var(--konklusjon-under); }
.knapp-blekk {
  display: inline-flex; align-items: center; justify-content: center; margin-top: 18px; text-decoration: none;
  background: var(--on-accent); color: var(--accent); border-radius: var(--radius); min-height: 48px; padding: 0 24px; font-weight: 600;
  transition: transform 160ms var(--ease-out);
}
.knapp-blekk:active { transform: scale(0.97); }
.les-ogsa { background: var(--surface); border-radius: 24px; padding: 22px 26px; }
.les-ogsa h2 { font-size: 1.0625rem; font-weight: 600; margin-bottom: 8px; }
.les-ogsa ul { list-style: none; margin: 0; padding: 0; }
.les-ogsa a { display: block; padding: 10px 0; text-decoration: none; font-weight: 500; }
.les-ogsa a:hover { text-decoration: underline; text-decoration-color: var(--midtlinje); text-decoration-thickness: 2px; }

/* Omregistreringskalkulator i artikkelen */
.minikalk { background: var(--surface-2); border-radius: 24px; padding: clamp(20px, 3vw, 32px); display: grid; gap: 18px; }
.minikalk h2 { margin-top: 0 !important; }
.minikalk-felter { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.minikalk label { display: grid; gap: 6px; font-size: var(--t-small); font-weight: 500; }
.minikalk input, .minikalk select {
  min-height: 48px; border-radius: 14px; border: 2px solid transparent; background: var(--surface); padding: 0 14px;
  font-size: 1.0625rem; font-variant-numeric: tabular-nums; width: 100%;
}
.minikalk input:focus, .minikalk select:focus { outline: none; border-color: var(--focus); }
.minikalk-svar { background: var(--accent); color: var(--on-accent); border-radius: 18px; padding: 18px 22px; }
.minikalk-svar strong { display: block; font-size: clamp(2rem, 1.4rem + 2vw, 3rem); line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.minikalk-svar span { display: block; margin-top: 8px; color: var(--konklusjon-under); font-size: var(--t-small); }
.minikalk-skilt { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.minikalk-skilt label { flex: 1 1 200px; }
.minikalk-skilt .knapp { background: var(--ink); color: var(--canvas); }
.minikalk-status { font-size: var(--t-small); color: var(--muted); min-height: 1.4em; }
.minikalk-status.feil { color: var(--error); }

/* Spørsmål og svar på forsiden */
.sporsmal { padding-top: var(--gap-section); }
.sporsmal > h2 { font-size: var(--t-heading); letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 28px; }
.sporsmal-liste { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sporsmal-liste > div { background: var(--surface); border-radius: 22px; padding: 24px 26px; }
.sporsmal-liste h3 { font-size: 1.1875rem; line-height: 1.3; margin-bottom: 8px; }
.sporsmal-liste a { text-decoration-color: var(--midtlinje); text-decoration-thickness: 2px; }

/* Guider i bunnen */
.bunn-lenker { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0 0 24px; padding: 0; list-style: none; font-size: 1rem; }
.bunn-lenker a { color: var(--asfalt-ink); text-decoration: none; }
.bunn-lenker a:hover { text-decoration: underline; text-decoration-color: var(--midtlinje); text-decoration-thickness: 2px; }

@media (max-width: 960px) {
  .artikkel-ramme { grid-template-columns: 1fr; }
  .artikkel-side { position: static; }
  .sporsmal-liste { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .minikalk-felter { grid-template-columns: 1fr; }
  .artikkel { font-size: 1.0625rem; }
}
