/* Visjonen (Konsept-siden): animert historie i sju scener.
   Lyst tema som standard, mørkt via html[data-tema="mork"].
   Bare transform/opacity animeres. Scener utenfor skjermen pauses (klassen kv-aktiv settes av konsept.js).
   prefers-reduced-motion viser alt statisk. */

.kv-historie {
  --kv-glass: linear-gradient(135deg, rgba(255, 255, 255, .86), rgba(255, 255, 255, .56));
  --kv-glass-kant: rgba(255, 255, 255, .95);
  --kv-skygge: 0 22px 50px -26px rgba(74, 42, 122, .45);
  --kv-r: 26px;
  --kv-strek: #8a4fdc;
  --kv-dempet-form: #4a2a7a;
  position: relative;
  overflow-x: clip;
  font-family: var(--sans);
}
html[data-tema="mork"] .kv-historie {
  --kv-glass: linear-gradient(135deg, rgba(255, 255, 255, .11), rgba(255, 255, 255, .04));
  --kv-glass-kant: rgba(255, 255, 255, .16);
  --kv-skygge: 0 24px 50px -24px rgba(0, 0, 0, .7);
  --kv-strek: #b79cff;
  --kv-dempet-form: #d6c6ff;
}
.kv-historie h1, .kv-historie h2 { font-family: var(--serif); }
.kv-bredde { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px 0 26px; }
@media (min-width: 576px) { .kv-bredde { padding: 0 40px; } }

/* ---------- Intro ---------- */
.kv-intro {
  padding: clamp(48px, 9vw, 110px) 0 clamp(40px, 7vw, 80px);
  background:
    radial-gradient(600px 340px at 85% 10%, rgba(255, 79, 139, .18), transparent 70%),
    radial-gradient(520px 320px at 10% 90%, rgba(255, 154, 47, .18), transparent 70%);
}
html[data-tema="mork"] .kv-intro {
  background:
    radial-gradient(600px 340px at 85% 10%, rgba(183, 156, 255, .16), transparent 70%),
    radial-gradient(520px 320px at 10% 90%, rgba(255, 126, 182, .12), transparent 70%);
}
.kv-etikett {
  display: inline-block; margin-top: 12px; padding: 6px 14px; border-radius: 999px;
  background: var(--kv-glass); border: 1.5px solid var(--kv-glass-kant);
  font-family: var(--serif); font-weight: 600; font-size: .9rem; color: var(--tekst);
}
.kv-tittel { margin: 16px 0 14px; font-size: clamp(2rem, 6vw, 3.6rem); max-width: 16ch; overflow-wrap: anywhere; }
.kv-godteri { background: var(--godteri); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kv-ingress { font-size: clamp(1.05rem, 1.8vw, 1.3rem); color: var(--dempet); max-width: 60ch; }
.kv-signatur { font-family: var(--serif); font-weight: 600; color: var(--tekst); }
.kv-scroll-hint {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 18px; border-radius: 999px;
  background: var(--kv-glass); border: 1.5px solid var(--kv-glass-kant); box-shadow: var(--kv-skygge);
  color: var(--tekst); text-decoration: none; font-family: var(--serif); font-weight: 600;
}
.kv-scroll-hint:hover { color: var(--tekst); }
.kv-scroll-hint i { animation: kv-hopp 1.8s ease-in-out infinite; }
@keyframes kv-hopp { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ---------- Fremdriftssti ---------- */
.kv-sti {
  position: fixed; left: 6px; top: 50%; z-index: 1030; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 12px; padding: 8px 0;
  opacity: 0; pointer-events: none; transition: opacity .4s;
}
.kv-sti.kv-sti-synlig { opacity: 1; pointer-events: auto; }
.kv-sti-spor { position: absolute; left: 50%; top: 12px; bottom: 12px; width: 3px; margin-left: -1.5px; border-radius: 3px; background: rgba(138, 79, 220, .18); overflow: hidden; }
.kv-sti-fyll { position: absolute; inset: 0; background: linear-gradient(180deg, #ff7a2f, #ff4f8b 50%, #8a4fdc); transform-origin: 50% 0; transform: scaleY(0); }
.kv-sti a {
  position: relative; display: block; width: 10px; height: 10px; border-radius: 50%;
  background: #fff; border: 2px solid rgba(138, 79, 220, .45); transition: transform .3s, background-color .3s, border-color .3s;
}
.kv-sti a.kv-naa { transform: scale(1.45); background: #ff4f8b; border-color: #fff; }
.kv-sti a.kv-forbi { background: #8a4fdc; border-color: #8a4fdc; }
html[data-tema="mork"] .kv-sti a { background: #10162a; border-color: rgba(183, 156, 255, .5); }
html[data-tema="mork"] .kv-sti a.kv-naa { background: #ff7eb6; border-color: #fff; }
html[data-tema="mork"] .kv-sti a.kv-forbi { background: #b79cff; border-color: #b79cff; }
@media (min-width: 768px) {
  .kv-sti { left: 18px; gap: 18px; }
  .kv-sti a { width: 14px; height: 14px; }
}

/* ---------- Scener ---------- */
.kv-scene { position: relative; overflow: clip; padding: clamp(48px, 9vw, 96px) 0; }
@media (min-width: 900px) { .kv-scene { min-height: min(100vh, 860px); display: flex; align-items: center; } }
.kv-s1 { background: radial-gradient(700px 400px at 20% 30%, rgba(255, 210, 138, .35), transparent 70%); }
.kv-s2 { background: radial-gradient(700px 400px at 80% 40%, rgba(41, 168, 255, .16), transparent 70%); }
.kv-s3 { background: radial-gradient(700px 420px at 25% 60%, rgba(255, 179, 199, .32), transparent 70%); }
.kv-s4 { background: radial-gradient(700px 420px at 75% 50%, rgba(255, 154, 47, .18), transparent 70%); }
.kv-s5 { background: radial-gradient(700px 420px at 25% 50%, rgba(47, 207, 122, .14), transparent 70%); }
.kv-s6 { background: radial-gradient(700px 420px at 75% 50%, rgba(143, 91, 255, .16), transparent 70%); }
.kv-s7 { background: radial-gradient(800px 460px at 50% 40%, rgba(255, 79, 139, .16), transparent 70%); }
html[data-tema="mork"] .kv-scene { background-blend-mode: normal; }
html[data-tema="mork"] .kv-s1 { background: radial-gradient(700px 400px at 20% 30%, rgba(255, 209, 102, .10), transparent 70%); }
html[data-tema="mork"] .kv-s3 { background: radial-gradient(700px 420px at 25% 60%, rgba(255, 126, 182, .12), transparent 70%); }

.kv-rad { display: grid; gap: clamp(24px, 4vw, 56px); align-items: center; }
@media (min-width: 900px) {
  .kv-rad { grid-template-columns: 1fr 1fr; }
  .kv-snu .kv-illu { order: 2; }
}

.kv-kort {
  position: relative; padding: clamp(22px, 4vw, 38px); border-radius: var(--kv-r);
  background: var(--kv-glass); border: 1.5px solid var(--kv-glass-kant); box-shadow: var(--kv-skygge);
  color: var(--tekst); min-width: 0;
}
.kv-kort h2 { font-size: clamp(1.55rem, 3.6vw, 2.3rem); margin: 6px 0 14px; overflow-wrap: anywhere; }
.kv-kort p { font-size: clamp(1rem, 1.5vw, 1.12rem); line-height: 1.7; margin: 0 0 12px; }
.kv-kort p:last-child { margin-bottom: 0; }
.kv-nr {
  display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--godteri); color: #fff;
  font-family: var(--serif); font-weight: 600; font-size: .82rem; letter-spacing: .04em;
}
html[data-tema="mork"] .kv-nr { color: #1a1030; }

.kv-illu {
  position: relative; width: 100%; max-width: 460px; margin: 0 auto; min-width: 0;
  border-radius: var(--kv-r); background: var(--kv-glass); border: 1.5px solid var(--kv-glass-kant); box-shadow: var(--kv-skygge);
  padding: clamp(14px, 3vw, 24px);
}
.kv-svg { display: block; width: 100%; height: auto; overflow: visible; }

/* Avsløring ved scrolling (bare når JS kjører) */
.kv-klar .kv-scene .kv-kort, .kv-klar .kv-scene .kv-illu { opacity: 0; transition: opacity .9s ease, transform .9s cubic-bezier(.2, .8, .2, 1); }
.kv-klar .kv-scene .kv-kort { transform: translateY(40px); }
.kv-klar .kv-scene .kv-illu { transform: scale(.92); }
.kv-klar .kv-scene.kv-vis .kv-kort, .kv-klar .kv-scene.kv-vis .kv-illu { opacity: 1; transform: none; }
.kv-klar .kv-scene.kv-vis .kv-kort { transition-delay: .15s; }

/* Pause alle animasjoner i scener som ikke er synlige */
.kv-klar .kv-scene:not(.kv-aktiv) .kv-illu,
.kv-klar .kv-scene:not(.kv-aktiv) .kv-illu * { animation-play-state: paused !important; }

/* ---------- 1 · Reisen ---------- */
.kv-s1 .kv-illu { padding-top: 34px; padding-bottom: 34px; }
.kv-rute { fill: none; stroke: var(--kv-strek); stroke-width: 2.5; stroke-dasharray: 7 7; stroke-linecap: round; opacity: .6; }
.kv-punkt { fill: #ff4f8b; }
.kv-punkt-mal { fill: #ff9a2f; }
.kv-fly { transform: translate(160px, 72px) rotate(-14deg); animation: kv-fly 7s ease-in-out infinite; }
.kv-fly-kropp { fill: var(--kv-dempet-form); }
.kv-fly-vinge { fill: #ff4f8b; }
@keyframes kv-fly {
  0% { transform: translate(20px, 160px) rotate(-45deg); opacity: 0; }
  6% { opacity: 1; }
  25% { transform: translate(90px, 103px) rotate(-32deg); }
  50% { transform: translate(160px, 72px) rotate(-14deg); }
  75% { transform: translate(230px, 68px) rotate(7deg); }
  92% { opacity: 1; }
  100% { transform: translate(300px, 90px) rotate(27deg); opacity: 0; }
}
.kv-emoji { position: absolute; font-size: clamp(1.8rem, 6vw, 2.6rem); line-height: 1; animation: kv-dupp 4s ease-in-out infinite; }
.kv-sekk { left: 6%; bottom: 8%; }
.kv-kart { right: 8%; bottom: 10%; animation-delay: -1.3s; }
.kv-kompass { left: 12%; top: 8%; font-size: clamp(1.4rem, 4.5vw, 2rem); animation-delay: -2.6s; }
@keyframes kv-dupp { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }

/* ---------- 2 · Kloden ---------- */
.kv-klode-ramme { --d: min(300px, 70vw); position: relative; width: var(--d); height: var(--d); margin: 0 auto; }
.kv-klode { position: absolute; inset: 14%; width: 72%; height: 72%; }
.kv-hav { fill: #6cc0ff; }
.kv-klode-land { fill: #2fcf7a; animation: kv-klode 14s linear infinite; }
.kv-meridian { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 1.2; }
.kv-klode-glans { fill: rgba(255, 255, 255, .28); }
html[data-tema="mork"] .kv-hav { fill: #2b5c9e; }
html[data-tema="mork"] .kv-klode-land { fill: #3fb87a; }
@keyframes kv-klode { from { transform: translateX(0); } to { transform: translateX(-140px); } }
.kv-ring { position: absolute; inset: 0; animation: kv-snurr 40s linear infinite; }
.kv-ring span {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  transform: rotate(calc(var(--i) * 60deg)) translateY(calc(var(--d) * -.43)) rotate(calc(var(--i) * -60deg));
}
.kv-ring i {
  display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%;
  background: var(--kv-glass); border: 1.5px solid var(--kv-glass-kant); box-shadow: var(--kv-skygge);
  color: var(--kv-strek); font-size: 1.15rem; animation: kv-snurr 40s linear infinite reverse;
}
@keyframes kv-snurr { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ---------- 3 · Asia ---------- */
.kv-s3 .kv-illu { padding: 10px; }
.kv-sol { fill: #fff3c4; animation: kv-sol 12s ease-in-out infinite alternate; }
@keyframes kv-sol { from { transform: translateY(36px); } to { transform: translateY(0); } }
.kv-fjell-bak { fill: #c58ad8; }
.kv-fjell-sno { fill: #fff; opacity: .85; }
.kv-fjell-for { fill: #8a4fdc; }
.kv-vann { fill: #6c49b8; }
html[data-tema="mork"] .kv-himmel { opacity: .55; }
html[data-tema="mork"] .kv-fjell-bak { fill: #5b3a8c; }
html[data-tema="mork"] .kv-fjell-for { fill: #3a2466; }
html[data-tema="mork"] .kv-vann { fill: #2a1a4c; }
.kv-blad { transform-box: fill-box; transform-origin: 50% 100%; transform: rotate(var(--v)); animation: kv-lotus 7s ease-in-out infinite; }
.kv-blad-y { fill: #ff8fb4; }
.kv-blad-m { fill: #ffb3cf; }
.kv-blad-i { fill: #ffd6e5; }
@keyframes kv-lotus {
  0%, 100% { transform: rotate(calc(var(--v) * .12)) scale(.82); }
  50% { transform: rotate(var(--v)) scale(1); }
}

/* ---------- 4 · Munken ---------- */
.kv-munk-scene { position: relative; display: grid; justify-items: center; gap: 14px; }
.kv-pustering {
  position: absolute; top: 2%; left: 50%; width: min(240px, 62vw); aspect-ratio: 1; margin-left: calc(min(240px, 62vw) / -2);
  border-radius: 50%; background: radial-gradient(circle, rgba(255, 154, 47, .4), rgba(255, 79, 139, .18) 60%, transparent 72%);
  animation: kv-pust 8s ease-in-out infinite;
}
@keyframes kv-pust { 0%, 100% { transform: scale(.78); opacity: .7; } 50% { transform: scale(1.06); opacity: 1; } }
.kv-munk { position: relative; width: min(220px, 58vw); height: auto; }
.kv-munk-form { fill: var(--kv-dempet-form); }
.kv-munk-kappe { fill: #ff9a2f; opacity: .85; }
.kv-munk path:first-of-type { transform-box: fill-box; transform-origin: 50% 100%; animation: kv-munkpust 8s ease-in-out infinite; }
@keyframes kv-munkpust { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.03, 1.04); } }
.kv-ekg {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px; border-radius: 999px;
  background: var(--kv-glass); border: 1.5px solid var(--kv-glass-kant);
}
.kv-ekg-svg { flex: 1; min-width: 0; height: 44px; }
.kv-ekg-linje { fill: none; stroke: #ff4f8b; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; animation: kv-ekg 18s linear infinite; }
@keyframes kv-ekg { from { transform: translateX(0); } to { transform: translateX(-680px); } }
.kv-hjerte { color: #ff4757; font-size: 1.3rem; line-height: 1; animation: kv-slag var(--slag, .8s) ease-out infinite; }
@keyframes kv-slag { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.3); } 30% { transform: scale(1); } }
.kv-puls { font-family: var(--serif); font-size: .82rem; color: var(--dempet); white-space: nowrap; }
.kv-puls b { font-size: 1.05rem; color: var(--tekst); font-variant-numeric: tabular-nums; }

/* ---------- 5 · Barnet og følelsene ---------- */
.kv-barn-scene { position: relative; height: clamp(240px, 62vw, 320px); display: grid; place-items: center; }
.kv-barn { position: relative; z-index: 2; width: 34%; max-width: 130px; height: auto; fill: var(--kv-dempet-form); }
.kv-klatt { position: absolute; width: 22%; aspect-ratio: 1; border-radius: 46% 54% 60% 40% / 50% 40% 60% 50%; opacity: .85; animation: kv-uro .55s ease-in-out infinite alternate; }
.kv-k1 { background: #ff4757; left: 10%; top: 12%; }
.kv-k2 { background: #ff9a2f; right: 10%; top: 8%; animation-delay: -.2s; }
.kv-k3 { background: #ffd23f; left: 6%; bottom: 14%; animation-delay: -.35s; }
.kv-k4 { background: #29a8ff; right: 8%; bottom: 16%; animation-delay: -.1s; }
.kv-k5 { background: #8f5bff; left: 40%; top: 0; width: 15%; animation-delay: -.4s; }
@keyframes kv-uro {
  from { transform: translate(-6px, 3px) rotate(-8deg) scale(1.05); }
  to { transform: translate(6px, -4px) rotate(8deg) scale(.95); }
}
.kv-ro-ring {
  position: absolute; z-index: 1; width: 64%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 207, 122, .35), rgba(41, 168, 255, .15) 62%, transparent 72%);
  opacity: 0; transform: scale(.6); transition: opacity 1.2s;
}
.kv-ro-tekst {
  position: absolute; z-index: 3; bottom: 4px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--serif); font-weight: 600; color: var(--tekst); opacity: 0; transition: opacity 1.2s;
}
/* Etter noen sekunder i bildet: pusten roer følelsene */
.kv-roligere .kv-klatt { opacity: .55; animation: kv-flyt 7s ease-in-out infinite; }
.kv-roligere .kv-ro-ring { opacity: 1; animation: kv-pust 8s ease-in-out infinite; }
.kv-roligere .kv-ro-tekst { opacity: 1; }
@keyframes kv-flyt { 0%, 100% { transform: translateY(0) scale(.92); } 50% { transform: translateY(-10px) scale(1); } }

/* ---------- 6 · Spillet ---------- */
.kv-spill { display: grid; gap: 14px; }
.kv-spill-topp { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--serif); font-weight: 600; }
.kv-poeng { padding: 6px 14px; border-radius: 999px; background: var(--godteri); color: #fff; font-variant-numeric: tabular-nums; }
html[data-tema="mork"] .kv-poeng { color: #1a1030; }
.kv-niva { color: var(--dempet); }
.kv-spill-kropp { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; gap: 12px 16px; align-items: center; }
.kv-chakra { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; grid-row: 1 / 3; }
.kv-chakra li {
  width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px rgba(255, 255, 255, .5);
  opacity: 1; animation: kv-tenn 8s ease-in-out infinite; animation-delay: calc(var(--i) * .6s);
}
@keyframes kv-tenn {
  0% { opacity: .22; transform: scale(.75); }
  6% { opacity: 1; transform: scale(1.25); }
  12%, 78% { opacity: 1; transform: scale(1); }
  90%, 100% { opacity: .22; transform: scale(.75); }
}
.kv-dyr-felt { position: relative; display: grid; place-items: center; min-height: 170px; }
.kv-dyr { font-size: clamp(4rem, 16vw, 6rem); line-height: 1; animation: kv-pust 5s ease-in-out infinite; }
.kv-pluss {
  position: absolute; top: 40%; font-family: var(--serif); font-weight: 700; color: #ff4f8b; white-space: nowrap;
  opacity: 0; animation: kv-pluss 3.4s ease-out infinite;
}
.kv-p1 { left: 8%; }
.kv-p2 { right: 8%; animation-delay: 1.7s; }
html[data-tema="mork"] .kv-pluss { color: #ffd166; }
@keyframes kv-pluss { 0% { opacity: 0; transform: translateY(10px); } 20% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-60px); } }
.kv-dyr-rad { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.kv-lite-dyr {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 16px; font-size: 1.5rem;
  background: var(--kv-glass); border: 1.5px solid var(--kv-glass-kant);
  animation: kv-dupp 3.2s ease-in-out infinite; animation-delay: calc(var(--i) * -.8s);
}

/* ---------- 7 · Invitasjon ---------- */
.kv-slutt { display: grid; gap: 28px; justify-items: center; text-align: center; }
.kv-illu-slutt { max-width: 340px; display: grid; place-items: center; padding: 26px; }
.kv-stor-pust {
  position: relative; display: grid; place-items: center; width: min(240px, 64vw); aspect-ratio: 1; border-radius: 50%;
  background: var(--godteri); box-shadow: 0 20px 50px -20px rgba(255, 79, 139, .7);
  animation: kv-storpust 10s ease-in-out infinite;
}
.kv-stor-pust > span { grid-area: 1 / 1; font-family: var(--serif); font-weight: 700; font-size: clamp(1.3rem, 5vw, 1.7rem); color: #fff; }
html[data-tema="mork"] .kv-stor-pust > span { color: #1a1030; }
.kv-inn { animation: kv-inn 10s ease-in-out infinite; }
.kv-ut { opacity: 0; animation: kv-ut 10s ease-in-out infinite; }
@keyframes kv-storpust { 0%, 100% { transform: scale(.72); } 50% { transform: scale(1); } }
@keyframes kv-inn { 0%, 44% { opacity: 1; } 50%, 94% { opacity: 0; } 100% { opacity: 1; } }
@keyframes kv-ut { 0%, 44% { opacity: 0; } 50%, 94% { opacity: 1; } 100% { opacity: 0; } }
.kv-kort-slutt { max-width: 720px; }
.kv-knapper { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 22px 0 18px; }
.kv-knapp-glass {
  background: var(--kv-glass) !important; color: var(--tekst) !important; border: 1.5px solid var(--kv-glass-kant) !important;
  box-shadow: 0 5px 0 rgba(138, 79, 220, .25), 0 12px 22px -12px rgba(74, 42, 122, .5) !important;
}
.kv-knapp-glass:hover { transform: translateY(-2px); }
.kv-notis {
  display: flex; gap: 10px; align-items: flex-start; justify-content: center; text-align: left;
  margin: 0 auto !important; max-width: 52ch; font-size: .95rem !important; color: var(--dempet);
}
.kv-notis i { color: #ff4f8b; margin-top: 4px; }

/* ---------- Redusert bevegelse: alt statisk og synlig ---------- */
@media (prefers-reduced-motion: reduce) {
  .kv-historie *, .kv-historie *::before, .kv-historie *::after { animation: none !important; transition: none !important; }
  .kv-klar .kv-scene .kv-kort, .kv-klar .kv-scene .kv-illu { opacity: 1; transform: none; }
  .kv-ro-ring, .kv-ro-tekst { opacity: 1; }
  .kv-ro-ring { transform: none; }
  .kv-klatt { opacity: .6; }
  .kv-ut, .kv-pluss { display: none; }
  .kv-sti-fyll { transition: none; }
}
