@font-face { font-family: "Barlow SC"; src: url("font/barlow-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow SC"; src: url("font/barlow-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

/* Fargene er boreskjermens egne. Gul/lilla/grønn/rosa brukes bare med den betydningen de har der. */
:root {
  color-scheme: dark;
  --flate: #2a2c33;
  --felt: #373a43;
  --kant: #737886;
  --tekst: #f7f7f9;
  --dempet: #c5c8d2;
  --aktiv: #4fe0e6;
  --planlagt: #f2e63a;
  --boret: #b9a2ff;
  --bolt-plan: #62e04a;
  --bolt-boret: #f3bcc6;
  --bue: #ff4b3e;
  --fare: #ff9c90;
}
* { box-sizing: border-box; }
html { background: var(--flate); -webkit-text-size-adjust: 100%; scroll-padding-bottom: 140px; }
body { margin: 0; color: var(--tekst); font: 400 18px/1.4 "Barlow SC", "Arial Narrow", system-ui, sans-serif; }
main { max-width: 1120px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); outline: none; }
h1, h2, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 600; text-wrap: balance; }
h2 { font-size: 21px; line-height: 1.25; font-weight: 600; }
a { color: var(--aktiv); }
:focus-visible { outline: 3px solid var(--tekst); outline-offset: 3px; }
[hidden] { display: none !important; }
.dempet { color: var(--dempet); }
.tall { font-variant-numeric: tabular-nums; }
.stabel { display: grid; gap: 16px; }
.stabel > * { min-width: 0; }

/* Knapper */
.knapp {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 56px; padding: 8px 20px; border: 2px solid var(--kant); border-radius: 6px;
  background: transparent; color: var(--tekst); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.knapp.hoved { background: var(--aktiv); border-color: var(--aktiv); color: #0b2a2c; }
.knapp.fare { border-color: var(--fare); color: var(--fare); }
.knapp.full { width: 100%; }
.knapp.stor { min-height: 72px; font-size: 22px; }
.knapp:disabled { opacity: .55; cursor: default; }
.knapper { display: grid; gap: 12px; }
.lenke { min-height: 48px; padding: 0; border: 0; background: none; color: var(--aktiv); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; text-align: left; }
.filvalg { position: relative; overflow: hidden; }
.filvalg input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.filvalg:focus-within { outline: 3px solid var(--tekst); outline-offset: 3px; }

/* Topp */
.topp { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.topp > div { flex: 1; min-width: 0; }
.topp h1 { overflow-wrap: anywhere; }
.ikon { flex: none; width: 56px; padding: 0; font-size: 26px; }
.dato { position: relative; text-align: center; min-height: 56px; display: grid; place-content: center; }
.dato input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dato:focus-within { outline: 3px solid var(--tekst); border-radius: 6px; }
.dato h1 { font-size: 25px; }
.dato h1::first-letter { text-transform: uppercase; }
.dato span { color: var(--aktiv); text-decoration: underline; text-underline-offset: 3px; }

/* Dag: totalene står inne i tunnelprofilen */
.dag { display: grid; gap: 24px; }
.profil { position: relative; width: 100%; max-width: 460px; margin: 0 auto; aspect-ratio: 400 / 372; }
.profil svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.profil .rute { stroke: #454954; stroke-width: 1; }
.profil .bue { fill: none; stroke: var(--bue); stroke-width: 5; stroke-linecap: round; }
.profil .saale { fill: none; stroke: var(--bolt-plan); stroke-width: 5; stroke-linejoin: round; stroke-linecap: round; }
.totaler { position: absolute; inset: 11% 10% 14%; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1.15fr 1fr; align-items: center; text-align: center; }
.totaler div { display: flex; flex-direction: column-reverse; }
.totaler div:first-child { grid-column: 1 / -1; }
.totaler dt { color: var(--dempet); line-height: 1.2; }
.totaler dd { font-size: 34px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.totaler .stort dd { font-size: 56px; }
.totaler dd small { font-size: .6em; font-weight: 400; margin-left: .15em; }

.varsel { border-left: 6px solid var(--planlagt); padding: 12px 16px; background: var(--felt); display: grid; gap: 8px; overflow-wrap: anywhere; }
.varsel.feil { border-color: var(--bue); }
.varsel.info { border-color: var(--aktiv); }
.varsel ul { display: grid; gap: 4px; }
.varsel .knapp { justify-self: start; }

.salver > li { border-top: 1px solid var(--kant); }
.salver > li:last-child { border-bottom: 1px solid var(--kant); }
.salver a { display: grid; gap: 4px; padding: 16px 4px; min-height: 72px; color: inherit; text-decoration: none; }
.salver .linje { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.salver strong { font-size: 24px; font-weight: 600; overflow-wrap: anywhere; }

/* Registreringer */
.reg { border-top: 1px solid var(--kant); padding: 16px 0; display: grid; gap: 8px 16px; grid-template-columns: 1fr auto; }
.reg img { width: 72px; height: 96px; object-fit: cover; border-radius: 4px; display: block; }
.bildeknapp { border: 0; padding: 0; background: none; cursor: zoom-in; }
.reg .knapp { grid-column: 1 / -1; justify-self: start; min-height: 48px; }
.reg p { overflow-wrap: anywhere; }

/* Skjema */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend, .etikett { padding: 0; font-weight: 600; margin-bottom: 8px; display: block; }
.valg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.valg label { position: relative; }
.valg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.valg span { display: grid; place-items: center; min-height: 60px; border: 2px solid var(--kant); border-radius: 6px; font-weight: 600; }
.valg input:checked + span { background: var(--tekst); border-color: var(--tekst); color: var(--flate); }
.valg input:focus-visible + span { outline: 3px solid var(--tekst); outline-offset: 3px; }
.inn { width: 100%; min-height: 60px; padding: 8px 16px; border: 2px solid var(--kant); border-radius: 6px; background: var(--felt); color: var(--tekst); font: inherit; font-size: 22px; }
textarea.inn { font-size: 18px; min-height: 88px; resize: vertical; }
.inn[aria-invalid="true"] { border-color: var(--bue); }
.inn::placeholder { color: var(--dempet); opacity: 1; }
.teller { display: grid; grid-template-columns: 72px 1fr 72px; gap: 8px; }
.teller .knapp { min-height: 72px; padding: 0; font-size: 34px; touch-action: manipulation; }
.teller .inn { text-align: center; font-size: 40px; font-weight: 600; min-width: 0; font-variant-numeric: tabular-nums; }
.teller .inn:placeholder-shown { font-size: 20px; font-weight: 400; }
.knapp.forslag { margin-top: 8px; border-color: var(--aktiv); color: var(--aktiv); }
.hint { margin-top: 8px; color: var(--dempet); }
.hint.ai { color: var(--tekst); }
.feiltekst { margin-top: 8px; color: var(--fare); }
.lengde { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }

/* Kontrollskjerm */
.kontroll { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
.foto { position: relative; margin: 0 -16px; background: #000; }
.foto img { display: block; width: 100%; height: 46vh; min-height: 260px; object-fit: cover; object-position: 50% 42%; }
.foto .bildeknapp { display: block; width: 100%; }
.foto figcaption { position: absolute; right: 12px; top: 12px; padding: 8px 12px; background: rgb(0 0 0 / .78); border-radius: 4px; pointer-events: none; }
.lest { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lest th { font-weight: 400; color: var(--dempet); text-align: left; padding: 6px 0; vertical-align: top; }
.lest thead th:not(:first-child), .lest td { text-align: right; }
.lest td { padding: 6px 0 6px 8px; vertical-align: top; }
.lest tbody tr { border-top: 1px solid #555a67; }
.lest td b { font-size: 24px; line-height: 1.1; font-weight: 600; display: block; }
.lest td small { color: var(--dempet); font-size: 15px; display: block; line-height: 1.25; }
.lest .p::before, .forklaring i { content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 7px; background: currentColor; }
.lest .p.gul::before { color: var(--planlagt); } .lest .p.lilla::before { color: var(--boret); }
.lest .p.gronn::before { color: var(--bolt-plan); } .lest .p.rosa::before { color: var(--bolt-boret); }
details summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; color: var(--aktiv); text-decoration: underline; text-underline-offset: 3px; }
.bunn { position: sticky; bottom: 0; z-index: 2; margin: 8px -16px -48px; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); background: var(--flate); border-top: 2px solid var(--kant); display: grid; gap: 10px; }
.bunn .sum { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.bunn .sum b { font-size: 28px; line-height: 1.1; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Ventetilstand */
.vent { display: grid; gap: 20px; }
.vent .foto { overflow: hidden; }
.vent .foto::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--aktiv); animation: sveip 3.2s ease-in-out infinite alternate; }
@keyframes sveip { to { left: calc(100% - 4px); } }
.klokke { font-size: 56px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Dialoger */
dialog { width: min(480px, calc(100vw - 32px)); border: 2px solid var(--kant); border-radius: 8px; background: var(--flate); color: var(--tekst); padding: 20px; }
dialog::backdrop { background: rgb(0 0 0 / .75); }
dialog .stabel { gap: 14px; }
dialog.full { width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; border-radius: 0; padding: 0; background: #000; }
dialog.full[open] { display: grid; grid-template-rows: 1fr auto; }
dialog.full .rull { overflow: auto; display: grid; }
dialog.full img { width: 100%; height: 100%; object-fit: contain; min-height: 0; }
dialog.full .rull:not(.zoom) { grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
dialog.full .zoom img { width: 250vw; max-width: 2400px; height: auto; }
dialog.full .linje { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); background: var(--flate); }
#melding:not(:empty) { position: fixed; pointer-events: none; z-index: 5; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); padding: 14px 20px; border-radius: 6px; background: var(--tekst); color: #202228; font-weight: 600; }

@media (min-width: 860px) {
  main { padding: 32px 32px 64px; }
  .dag { grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 56px; align-items: start; }
  .kontroll { grid-template-columns: minmax(0, 1fr) minmax(0, 500px); gap: 48px; align-items: start; }
  .kontroll > .foto { position: sticky; top: 24px; margin: 0; }
  .kontroll > .foto img { height: calc(100vh - 150px); object-fit: contain; }
  .kontroll:not(:has(> .foto)) { grid-template-columns: minmax(0, 560px); justify-content: center; }
  .vent { grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 48px; align-items: center; }
  .vent .foto { margin: 0; }
  .vent .foto img { height: 70vh; }
  .bunn { margin: 8px 0 -64px; padding-inline: 0; }
  .smal { max-width: 640px; margin-inline: auto; }
}
@media (hover: hover) {
  .salver a:hover { background: var(--felt); }
  .knapp:not(.hoved, :disabled):hover { background: var(--felt); }
}
@media (prefers-reduced-motion: reduce) { .vent .foto::after { animation: none; left: 50%; } }
