/* Gatepuls – det nye kartet (/kart/).
   Kart, kategori, søk. Listen ligger i et panel som er lukket når man kommer inn.
   Én aksentfarge (korall). Lys stil, mørk når telefonen er i mørk modus. */
:root {
  color-scheme: light dark;
  --a: #ff4b3e; --a-svak: #ff4b3e26;
  --bg: #f1f0ec; --kort: #fff; --blekk: #141414; --stille: #6c6b66; --linje: #e4e2dc;
  --skygge: 0 2px 12px rgb(0 0 0 / .12);
  --topp: env(safe-area-inset-top, 0px); --bunn: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17181b; --kort: #222428; --blekk: #f2f1ed; --stille: #a09f9a; --linje: #34363b; --skygge: 0 2px 14px rgb(0 0 0 / .45); }
}
* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--blekk); font: 15px/1.45 "Schibsted Grotesk", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--a); outline-offset: 2px; }
a { color: inherit; }
#kart { position: fixed; inset: 0; }

/* Topp: logo + søk */
.topp { position: fixed; z-index: 5; left: 10px; right: 10px; top: calc(10px + var(--topp)); display: flex; gap: 8px; align-items: center; }
.logo { flex: none; display: grid; place-items: center; width: 64px; height: 44px; border-radius: 22px; background: var(--kort); color: var(--a); box-shadow: var(--skygge); }
.logo svg { width: 44px; height: 15px; }
.logo-prikk { animation: logopuls 2.4s ease-out infinite; transform-origin: 114px 30px; }
@keyframes logopuls { 0% { transform: scale(.6); opacity: .45; } 100% { transform: scale(1.7); opacity: 0; } }
.sok { flex: 1; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 22px; background: var(--kort); color: var(--stille); box-shadow: var(--skygge); }
.sok input { flex: 1; border: 0; outline: 0; background: none; color: var(--blekk); height: 100%; font-size: 16px; }
.sok input::placeholder { color: var(--stille); }

/* Filtre: tid + én rad kategorier */
.filtre { position: fixed; z-index: 4; left: 0; right: 0; top: calc(62px + var(--topp)); display: flex; gap: 6px; padding: 0 10px; overflow-x: auto; scrollbar-width: none; }
.filtre::-webkit-scrollbar { display: none; }
.filtre button { flex: none; height: 34px; padding: 0 13px; border-radius: 17px; border: 0; background: var(--kort); box-shadow: var(--skygge); font-weight: 700; font-size: 14px; white-space: nowrap; }
.filtre button .ik { width: 15px; height: 15px; margin: 0 5px 0 -2px; vertical-align: -3px; }
.filtre .tid { display: inline-flex; align-items: center; gap: 5px; background: var(--blekk); color: var(--bg); }
.kat { display: flex; gap: 6px; flex: none; }
.kat button[aria-pressed="true"] { background: var(--a); color: #fff; }
.tidmeny[hidden] { display: none; }
.tidmeny { position: fixed; z-index: 6; left: 10px; top: calc(102px + var(--topp)); display: grid; min-width: 200px; padding: 6px; border-radius: 16px; background: var(--kort); box-shadow: 0 10px 30px rgb(0 0 0 / .2); }
.tidmeny button, .tidmeny .dato { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; text-align: left; font-weight: 600; }
.tidmeny button[aria-current="true"] { color: var(--a); }
.tidmeny button:hover, .tidmeny .dato:hover { background: var(--bg); }
.tidmeny input { border: 1px solid var(--linje); border-radius: 8px; padding: 4px 6px; background: var(--kort); }

/* Markører: ikon og klokkeslett synlig før man trykker. Punkter som ligger tett, blir klynger («5 · 19–23»). */
.ik { flex: none; width: 15px; height: 15px; vertical-align: -2px; }
/* position: absolute som i maplibre-gl.css (.maplibregl-marker). Med relative ble markørene liggende i flyt under
   hverandre, så hver markør ble skjøvet ned med høyden av markørene før den, og klynger kunne overlappe. */
.m { position: absolute; left: 0; top: 0; display: block; padding: 0; border: 0; background: none; color: inherit; }
.pille { position: relative; display: flex; width: max-content; align-items: center; gap: 4px; height: 27px; padding: 0 9px 0 7px; border: 2px solid #fff; border-radius: 14px; background: var(--a); color: #fff; font-weight: 800; font-size: 12.5px; line-height: 1; white-space: nowrap; box-shadow: 0 1px 6px rgb(0 0 0 / .3); transition: transform .15s; font-variant-numeric: tabular-nums; }
.pille .ik { width: 14px; height: 14px; }
.pille .sym { font-size: 13px; }
.pille .pluss { font-weight: 700; opacity: .85; }
.m:hover .pille { transform: scale(1.08); }
/* Klynge: samme pille, «stablet» bak, med de vanligste kategoriene som små ikoner */
.klynge .pille { padding: 0 10px 0 7px; box-shadow: 0 1px 6px rgb(0 0 0 / .3), 3px -3px 0 -1px var(--a), 3px -3px 0 1px #fff; }
.klynge .ikoner { display: inline-flex; gap: 1px; }
.klynge .ikoner .ik { width: 13px; height: 13px; }
.klynge .antall { font-weight: 900; font-size: 13px; margin-left: 1px; }
.klynge .skille { opacity: .75; font-weight: 700; }
.klynge .klokke { font-weight: 700; }
/* Valgt: svart pille, tydelig i begge moduser (hvit kant i lys modus, korallkant og glød i mørk) */
.m.valgt { z-index: 3; }
.m.valgt .pille { background: #141414; color: #fff; border-color: #fff; transform: scale(1.14); box-shadow: 0 2px 10px rgb(0 0 0 / .45); }
.m.valgt .pille .ik { color: var(--a); }
.m.klynge.valgt .pille { box-shadow: 0 2px 10px rgb(0 0 0 / .45), 3px -3px 0 -1px #141414, 3px -3px 0 1px #fff; }
/* «Skjer nå»: pulserende glød bak pillen (på .m, så den ligger under pillen også når den er valgt) */
.m.na::before { content: ""; position: absolute; left: -7px; right: -7px; top: -7px; height: 41px; border-radius: 22px; background: var(--a); opacity: .35; z-index: -1; animation: puls 2s ease-out infinite; pointer-events: none; }
@keyframes puls { 0% { transform: scale(.85); opacity: .5; } 100% { transform: scale(1.35); opacity: 0; } }
.m.plass .pille { justify-content: center; height: 26px; padding: 0 5px; background: var(--kort); color: var(--a); border-color: var(--a); }
.m.plass:not(.klynge) .pille { width: 26px; padding: 0; }
.m.plass.klynge .pille { box-shadow: 0 1px 6px rgb(0 0 0 / .3), 3px -3px 0 -1px var(--kort), 3px -3px 0 1px var(--a); }
.m.plass.valgt .pille { background: var(--a); color: #fff; border-color: #fff; }
.m.plass.valgt .pille .ik { color: #fff; }
.m .etikett { position: absolute; left: 50%; top: calc(100% + 4px); transform: translateX(-50%); max-width: 160px; overflow: hidden; text-overflow: ellipsis; padding: 2px 8px; border-radius: 8px; background: var(--kort); color: var(--blekk); font-size: 12px; font-weight: 700; white-space: nowrap; box-shadow: var(--skygge); pointer-events: none; display: none; }
.vis-etiketter .m .etikett, .m.valgt .etikett { display: block; }
@media (prefers-color-scheme: dark) {
  .m.valgt .pille { border-color: var(--a); box-shadow: 0 0 0 4px rgb(255 75 62 / .35), 0 2px 12px rgb(0 0 0 / .6); }
  .m.klynge.valgt .pille { box-shadow: 0 0 0 4px rgb(255 75 62 / .35), 3px -3px 0 -1px #141414, 3px -3px 0 1px var(--a); }
  .m.plass .pille { background: #141414; }
  .m .etikett { background: #141414; color: #fff; }
}
.kat button.tom { opacity: .45; }
.filtre .akt[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--a), var(--skygge); color: var(--a); }

/* Panel: bunnark på mobil */
.ark { position: fixed; z-index: 3; left: 0; right: 0; bottom: 0; height: 78vh; display: flex; flex-direction: column; background: var(--kort); border-radius: 22px 22px 0 0; box-shadow: 0 -6px 24px rgb(0 0 0 / .14); transform: translateY(calc(78vh - var(--kikk, 96px) - var(--bunn))); transition: transform .28s cubic-bezier(.2, .8, .2, 1); touch-action: none; }
.ark[data-tilstand="halv"] { transform: translateY(calc(78vh - 50vh)); }
.ark[data-tilstand="hel"] { transform: translateY(0); }
.ark.drar { transition: none; }
.handtak { flex: none; height: 26px; border: 0; background: none; display: grid; place-items: center; }
.handtak i { width: 40px; height: 5px; border-radius: 3px; background: var(--linje); }
.ark-inn { flex: 1; overflow-y: auto; padding: 0 16px calc(16px + var(--bunn)); touch-action: pan-y; overscroll-behavior: contain; }
.ark[data-tilstand="kikk"] .ark-inn { overflow: hidden; }

.hode { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.veksle { flex: none; min-height: 36px; padding: 0 14px; border-radius: 18px; border: 0; background: var(--a); color: #fff; font-weight: 700; font-size: 14px; }
.veksle .lukk, .ark[data-tilstand="kikk"] .veksle .apne { display: inline; }
.veksle .apne, .ark[data-tilstand="kikk"] .veksle .lukk { display: none; }
.ark:not([data-tilstand="kikk"]) .veksle { background: var(--bg); color: var(--blekk); }
.ark[data-tilstand="kikk"] :is(.rader, .dag, .liten, .tom) { display: none; }
.tittel { margin: 0; font-size: 19px; font-weight: 900; letter-spacing: -.01em; }
.under { margin: 0 0 10px; color: var(--stille); font-size: 13px; }
.dag { margin: 14px 0 2px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--stille); }
.rader { list-style: none; margin: 0; padding: 0; }
.rad { display: grid; grid-template-columns: 52px 1fr; gap: 10px; width: 100%; padding: 10px 0; border: 0; border-bottom: 1px solid var(--linje); background: none; text-align: left; }
.rad .kl { font-weight: 900; color: var(--a); font-variant-numeric: tabular-nums; }
.rad b { display: block; font-weight: 700; }
.rad small { color: var(--stille); font-size: 13px; }
.rad small .ik { width: 13px; height: 13px; margin-right: 4px; color: var(--a); vertical-align: -2px; }
.rad .kl .ik { width: 18px; height: 18px; }
.rad .na-merke { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: var(--a-svak); color: var(--a); font-size: 11px; font-weight: 700; vertical-align: 1px; }
.tom { color: var(--stille); padding: 8px 0 20px; }

/* Detalj */
.tilbake { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 8px -6px; padding: 6px; border: 0; background: none; color: var(--stille); font-weight: 600; }
.detalj h2 { margin: 0 0 4px; font-size: 22px; line-height: 1.2; font-weight: 900; letter-spacing: -.01em; }
.detalj .nar { margin: 0 0 12px; color: var(--a); font-weight: 700; }
.fakta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 12px; font-size: 14px; }
.fakta dt { color: var(--stille); }
.fakta dd { margin: 0; }
.detalj p { margin: 0 0 12px; }
.knapper { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.knapper a, .knapper button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1.5px solid var(--linje); background: var(--kort); font-weight: 700; text-decoration: none; }
.knapper .hoved { background: var(--a); border-color: var(--a); color: #fff; }
.liten { color: var(--stille); font-size: 12px; }

.kreditt { position: fixed; z-index: 2; right: 8px; bottom: calc(100px + var(--bunn)); margin: 0; padding: 1px 6px; border-radius: 6px; background: rgb(255 255 255 / .75); color: #444; font-size: 10px; }
.kreditt a { text-decoration: none; }
.maplibregl-ctrl-attrib { display: none; }

/* PC: panelet står til venstre */
@media (min-width: 900px) {
  .topp { right: auto; width: 400px; left: 16px; top: 16px; }
  .filtre { left: 432px; right: 16px; top: 21px; padding: 0; }
  .tidmeny { left: 432px; top: 62px; }
  .ark { left: 16px; right: auto; top: 72px; bottom: 16px; width: 400px; height: auto; border-radius: 20px; transform: none !important; box-shadow: var(--skygge); }
  .handtak { display: none; }
  .ark-inn { padding-top: 14px; }
  .ark[data-tilstand] .ark-inn { overflow-y: auto; }
  .ark[data-tilstand="kikk"] { bottom: auto; }
  .ark[data-tilstand="kikk"] .ark-inn { padding-bottom: 14px; }
  .kreditt { bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
