/* Tilbudskartet – designprinsipper
   - Én ting om gangen: startsiden er bare fire siffer, kartet tar over når de er skrevet.
   - Kartet er produktet. Steder med noe på gang lyser; resten er grå prikker.
   - Lite er mer: svart/hvitt, én rød for tilbud, én gul for marked.
   - Betalte plasser (glød på butikk, senter øverst) er alltid tydelig merket «Fremhevet». */

:root {
  color-scheme: light dark;
  --bg: light-dark(#fafaf8, #0f1113);
  --panel: light-dark(#ffffff, #1a1d20);
  --ink: light-dark(#141414, #f1f1ee);
  --quiet: light-dark(#6d6d68, #9b9b96);
  --line: light-dark(#e7e7e2, #2a2d31);
  --acc: light-dark(#e3372b, #ff5b4c);
  --ev: light-dark(#f0ae00, #ffc531);
  --ev-ink: light-dark(#8a6400, #ffc531);
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 8px 28px rgb(0 0 0 / .10);
  --sheet: 0px;
}
* { box-sizing: border-box; min-width: 0; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 Figtree, system-ui, sans-serif; overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Kart ---------- */
#map { position: fixed; inset: 0; background: var(--bg); z-index: 0; }
.leaflet-container { font: inherit; background: var(--bg); }
/* Kartverkets kartfliser er lyse; i mørk modus snus de og dempes */
.leaflet-tile-pane { filter: grayscale(1) contrast(.8) brightness(1.05); opacity: .5; }
@media (prefers-color-scheme: dark) { .leaflet-tile-pane { filter: grayscale(1) invert(1) contrast(.8); opacity: .45; } }
.leaflet-control-attribution { font-size: 11px; background: color-mix(in srgb, var(--panel) 85%, transparent) !important; color: var(--quiet); }
.leaflet-control-attribution a { color: var(--quiet); }
@media (max-width: 899px) { .leaflet-bottom { bottom: var(--sheet); transition: bottom .3s; } }
.ring { stroke: var(--ink); stroke-opacity: .4; stroke-width: 1.5px; stroke-dasharray: 4 6; fill: none; }
.tk-icon { background: none; border: 0; }
.tk-icon > * { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); }

.pin { display: block; width: 26px; height: 26px; border-radius: 50%; }
.pin::after { content: ""; position: absolute; inset: 0; margin: auto; width: 12px; height: 12px; border-radius: 50%; background: var(--acc); border: 2px solid var(--panel); }
.pin.on { background: color-mix(in srgb, var(--acc) 18%, transparent); }
.pin.ev::after { background: var(--ev); }
.pin.ev.on { background: color-mix(in srgb, var(--ev) 22%, transparent); }
.pin.off { width: 20px; height: 20px; }
.pin.off::after { width: 7px; height: 7px; border: 0; background: var(--quiet); opacity: .45; }
.pin.glod::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; background: var(--acc); animation: glod 2.6s ease-in-out infinite; }
.pin.glod { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--acc) 70%, transparent); }
.pin.glod::after { width: 15px; height: 15px; }
@keyframes glod { 0%, 100% { opacity: .14; transform: scale(.85); } 50% { opacity: .30; transform: scale(1); } }
.pin.sel::after { width: 18px; height: 18px; border: 3px solid var(--ink); }
.pin .lbl { position: absolute; left: 30px; top: 50%; transform: translateY(-50%); white-space: nowrap; font-size: 13px; font-weight: 700; color: var(--ink);
  background: var(--panel); padding: 4px 10px; border-radius: 999px; box-shadow: var(--shadow); pointer-events: none; z-index: 2; }

.pill { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--panel); border: 1.5px solid var(--line);
  font-size: 13.5px; font-weight: 700; white-space: nowrap; box-shadow: var(--shadow); }
.pill.on { border-color: var(--acc); }
.pill b { color: var(--acc); }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--ev); }
.pill.topp::before { content: ""; position: absolute; inset: -9px; border-radius: 999px; background: var(--acc); z-index: -1; animation: glod 2.6s ease-in-out infinite; }
.pill.sel { border-color: var(--ink); border-width: 2.5px; }
.home { width: 18px; height: 18px; border-radius: 50%; background: var(--ink); border: 3px solid var(--panel); box-shadow: var(--shadow); }
.home::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 2px solid var(--ink); animation: ping 2.2s ease-out infinite; }
@keyframes ping { from { transform: scale(.5); opacity: .5; } to { transform: scale(1.4); opacity: 0; } }
.ringlbl { font-size: 11.5px; color: var(--quiet); white-space: nowrap; text-shadow: 0 0 3px var(--bg), 0 0 3px var(--bg); }

/* ---------- Startside ---------- */
.veil { position: fixed; inset: 0; z-index: 400; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(1.5px); transition: opacity .35s; }
.hero { position: fixed; inset: 0; z-index: 401; display: grid; place-items: center; padding: 24px; transition: opacity .35s, transform .35s; }
.brand { position: fixed; left: 20px; top: 18px; z-index: 402; font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.brand i { width: 10px; height: 10px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 0 5px color-mix(in srgb, var(--acc) 22%, transparent); }
.foot { position: fixed; left: 0; right: 0; bottom: 18px; z-index: 402; text-align: center; font-size: 14px; color: var(--quiet); padding: 0 16px; }
body.kart .veil, body.kart .hero { opacity: 0; pointer-events: none; }
body.kart .hero { transform: translateY(-12px); }
body.kart .brand, body.kart .foot { display: none; }
.hero-in { text-align: center; max-width: 520px; }
.hero h1 { margin: 0 0 28px; font-size: clamp(34px, 6.4vw, 56px); line-height: 1.04; font-weight: 800; letter-spacing: -.02em; text-wrap: balance; }
.slots { position: relative; display: inline-grid; grid-template-columns: repeat(4, clamp(58px, 15vw, 76px)); gap: clamp(8px, 2vw, 12px); }
.slot { height: clamp(74px, 19vw, 92px); border-radius: 16px; background: var(--panel); border: 2px solid var(--line); display: grid; place-items: center;
  font-size: clamp(36px, 9vw, 46px); font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: var(--shadow); transition: border-color .15s; }
.slot.on { border-color: var(--ink); }
.slot.bad { border-color: var(--acc); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
#pn { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; border: 0; cursor: text; }
.lead { margin: 18px 0 0; color: var(--quiet); font-size: 17px; }
.msg { min-height: 44px; margin-top: 10px; font-size: 15px; color: var(--acc); }
.msg.wait { color: var(--quiet); }
.link { background: none; border: 0; padding: 6px 2px; color: var(--ink); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }

/* ---------- Toppfelt og filtre ---------- */
.top { position: fixed; left: 0; right: 0; top: 0; z-index: 500; padding: 14px 16px 0; display: flex; gap: 10px; align-items: center; pointer-events: none;
  opacity: 0; transform: translateY(-8px); transition: opacity .3s .1s, transform .3s .1s; }
body.kart .top { opacity: 1; transform: none; }
.top > * { pointer-events: auto; }
.where { flex: none; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 16px; border-radius: 999px; border: 0; background: var(--ink); color: var(--bg); font-weight: 700; box-shadow: var(--shadow); }
.where small { font-weight: 500; opacity: .7; font-size: 14px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 40px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--ev); }
@media (min-width: 900px) { .top { left: 412px; } }
@media (max-width: 899px) { .top { flex-direction: column; align-items: stretch; padding: 10px 10px 0; } .where { align-self: flex-start; } }
.zoom { position: fixed; right: 16px; bottom: 24px; z-index: 500; display: none; flex-direction: column; gap: 6px; }
body.kart .zoom { display: flex; }
.zoom button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); font-size: 22px; font-weight: 600; box-shadow: var(--shadow); display: grid; place-items: center; }
@media (max-width: 899px) { body.kart .zoom { display: none; } }

/* ---------- Panel (venstre på PC, ark nederst på mobil) ---------- */
.panel { position: fixed; z-index: 600; background: var(--panel); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; pointer-events: none; transition: opacity .3s .15s, transform .35s .15s, height .3s; }
body.kart .panel { opacity: 1; pointer-events: auto; transform: none; }
@media (min-width: 900px) { .panel { left: 16px; top: 16px; bottom: 16px; width: 380px; border-radius: 20px; transform: translateX(-12px); } .grip { display: none; } }
@media (max-width: 899px) { .panel { left: 0; right: 0; bottom: 0; height: 44vh; border-radius: 20px 20px 0 0; transform: translateY(24px); } .panel.mid { height: 62vh; } .panel.open { height: 86vh; } }
.grip { flex: none; height: 26px; border: 0; background: none; display: grid; place-items: center; }
.grip::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.pv { overflow-y: auto; padding: 4px 20px 24px; flex: 1; overscroll-behavior: contain; }
@media (min-width: 900px) { .pv { padding: 22px; } }
.ph { margin: 0; font-size: 22px; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; }
.sub { color: var(--quiet); font-size: 14px; margin-top: 3px; }
.lbl-h { margin: 22px 0 8px; font-size: 13px; font-weight: 700; color: var(--quiet); }
.back { background: none; border: 0; padding: 8px 0; margin: -4px 0 6px; color: var(--quiet); font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 12px 2px; min-height: 58px; }
.rows li:first-child .row { border-top: 0; }
.row:hover { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--acc); }
.dot.ev { background: var(--ev); }
.dot.off { background: var(--line); }
.nm { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.nm > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt { font-size: 13.5px; color: var(--quiet); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cnt { font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--acc); }
.cnt.ev { color: var(--ev-ink); }
.tag { flex: none; display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--acc) 14%, transparent); color: var(--acc); }
.promo { display: block; width: 100%; text-align: left; border: 1.5px solid color-mix(in srgb, var(--acc) 55%, var(--line)); background: color-mix(in srgb, var(--acc) 5%, var(--panel)); border-radius: 16px; padding: 14px 16px; margin-bottom: 8px; }
.promo b { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.note { font-size: 13px; color: var(--quiet); margin-top: 16px; }
.empty { margin-top: 18px; }
.btn { margin-top: 12px; height: 44px; padding: 0 18px; border-radius: 999px; border: 0; background: var(--ink); color: var(--bg); font-weight: 700; }

/* ---------- Tilbud ---------- */
.offers { list-style: none; margin: 0; padding: 0; }
.offer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.offers li:first-child { border-top: 0; padding-top: 4px; }
.o-navn { font-weight: 500; line-height: 1.3; }
.o-pris { font-weight: 800; font-size: 19px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.2; }
.o-pris s { display: block; font-weight: 400; font-size: 13px; color: var(--quiet); }
.o-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--quiet); }
.o-meta .spar { color: var(--acc); font-weight: 700; }
.evcard { display: block; border-radius: 14px; padding: 12px 14px; background: color-mix(in srgb, var(--ev) 16%, var(--panel)); border: 1px solid color-mix(in srgb, var(--ev) 45%, transparent); width: 100%; text-align: left; margin-top: 14px; }
.acts { display: flex; gap: 16px; margin-top: 18px; font-size: 14px; }
.acts a { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }

/* ---------- Dialog ---------- */
.dlg { position: fixed; inset: 0; z-index: 900; display: none; place-items: center; background: rgb(0 0 0 / .35); padding: 20px; }
.dlg.show { display: grid; }
.dlg > div { background: var(--panel); border-radius: 20px; max-width: 420px; padding: 24px; box-shadow: var(--shadow); }
.dlg h2 { margin: 0 0 8px; font-size: 22px; }
.dlg p { margin: 0 0 10px; color: var(--quiet); }
