/* ==========================================================================
   Alver i Alver — stilark
   Bygget rent (ingen inline CSS/JS), tro mot konsept «A Skogsreisen».
   Palett/typografi hentet fra nocturne-designsystemet:
   mørk blågrå bunn, Inter (heading-vekt 500), én lavendel-aksent som
   strek og glød, foto blandet inn med mix-blend-mode: lighten.
   ========================================================================== */

/* --- Self-hostet variabel Inter (dekker vekt 100–900) -------------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/Inter-latin.woff2") format("woff2");
}

/* --- Design-tokens ------------------------------------------------------- */
:root {
  --page: #101120;              /* bunn bak alt (som A) */
  --color-bg: #161826;          /* innholdsflate */
  --color-surface: #232532;
  --color-text: #e9e9ed;
  --color-accent: #9184d9;
  --color-divider: color-mix(in srgb, #e9e9ed 16%, transparent);

  /* Nøytral tonestige */
  --color-neutral-100: #f3f5fe;
  --color-neutral-200: #e4e7f5;
  --color-neutral-300: #cfd3e5;
  --color-neutral-400: #b2b6ca;
  --color-neutral-500: #9397ab;
  --color-neutral-600: #75798c;
  --color-neutral-700: #595d6c;
  --color-neutral-800: #3f424d;
  --color-neutral-900: #292b31;

  /* Aksent-tonestige (lavendel) */
  --color-accent-200: #e7e5fe;
  --color-accent-300: #d2cefd;
  --color-accent-400: #b5abfc;
  --color-accent-500: #968ae0;
  --color-accent-600: #796cbf;
  --color-accent-700: #5d5294;
  --color-accent-800: #423a6a;
  --color-accent-900: #2b2741;

  --font-heading: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --space-1: 2.8px;
  --space-2: 5.6px;
  --space-3: 8.4px;
  --space-4: 11.2px;
  --space-6: 16.8px;
  --space-8: 22.4px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  --shadow-sm: 0 0 0 1px #3f424d;
  --shadow-md: 0 0 0 1px #595d6c, 0 6px 18px rgba(0, 0, 0, .55);

  --alv-fog: .5;               /* tåke-intensitet (0–1) */
}

/* --- Reset / grunnlag ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { background: var(--page); }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 500;
  margin: 0;
}

p { margin: 0; }
img { display: block; max-width: 100%; }
figure { margin: 0; }

a { color: var(--color-accent-300); text-decoration: none; }
a:hover { color: var(--color-accent-200); }

:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* Foto blandes inn i bunnen — mørke verdier faller bort */
.lighten { mix-blend-mode: lighten; background-color: transparent; }

/* Skjult, men lesbart for skjermlesere */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* Hopp-til-innhold-lenke */
.skip-link {
  position: fixed; top: -60px; left: 12px; z-index: 100;
  padding: 10px 16px; border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
  border: 1px solid var(--color-accent-600);
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; }

/* --- Delte små byggeklosser --------------------------------------------- */
.kicker {
  display: flex; align-items: center; gap: 10px;
  font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--color-accent-300);
}
.kicker::before {
  content: ""; width: clamp(22px, 5vw, 44px); height: 1px;
  background: var(--color-accent-500);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-heading); font-weight: 500; font-size: 14px; line-height: 1.2;
  padding: 11px 18px; border-radius: var(--radius-md);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
}
.btn-primary { color: var(--color-accent-300); border-color: var(--color-accent-600); }
.btn-primary:hover { background: color-mix(in srgb, var(--color-accent) 14%, transparent); border-color: var(--color-accent-500); color: var(--color-accent-200); }
.btn-primary:active { background: color-mix(in srgb, var(--color-accent) 24%, transparent); }
.btn-ghost { color: var(--color-accent-300); border-color: var(--color-divider); }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-text) 8%, transparent); color: var(--color-accent-200); }

/* ==========================================================================
   Topplinje
   ========================================================================== */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: clamp(14px, 2.4vw, 22px) clamp(16px, 4vw, 44px);
  pointer-events: none;
}
.brand { display: flex; align-items: baseline; gap: 10px; pointer-events: auto; }
.brand__name { font-family: var(--font-heading); font-weight: 500; font-size: 15px; letter-spacing: -0.01em; }
.brand__sep { width: 16px; height: 1px; background: var(--color-accent-600); }
.brand__tag { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--color-neutral-500); }
.site-header .btn {
  pointer-events: auto;
  font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  padding: 9px 15px; backdrop-filter: blur(6px);
}

/* ==========================================================================
   Lanterne-glød som følger pekeren
   ========================================================================== */
.glow {
  position: fixed; left: 0; top: 0; z-index: 60;
  width: 520px; height: 520px; margin: -260px 0 0 -260px;
  border-radius: 50%; pointer-events: none; opacity: 0;
  transition: opacity .6s ease;
  background: radial-gradient(circle, rgba(200, 178, 120, .16) 0%, rgba(145, 132, 217, .09) 34%, transparent 68%);
  mix-blend-mode: screen;
  will-change: transform, opacity;
}

/* ==========================================================================
   Scroll-scenen (sticky «viewport» som glir)
   ========================================================================== */
.track { position: relative; height: 580svh; }

.stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background: radial-gradient(130% 95% at 50% 118%, #2b2741 0%, #1a1b2d 46%, #101120 100%);
}

.stage__topglow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(58% 40% at 68% 16%, rgba(145, 132, 217, .20), transparent 70%);
}

/* Foto-lag som krysstoner + parallakserer */
.layer {
  position: absolute; inset: -10%;
  opacity: 0; will-change: transform, opacity;
}
.layer[data-layer="0"] { opacity: 1; }
.layer img { width: 100%; height: 100%; object-fit: cover; }

.layer[data-layer="0"] img { filter: saturate(.82) contrast(1.06); }
.layer[data-layer="1"] img { filter: saturate(.70) contrast(1.04) brightness(.86); }
.layer[data-layer="2"] img { filter: saturate(.68) contrast(1.02) brightness(.72); }
.layer[data-layer="3"] img { filter: saturate(.80) contrast(1.05) brightness(.60); }
.layer[data-layer="4"] img { filter: saturate(.72) contrast(1.08) brightness(.90); }

/* Tåke */
.fog {
  position: absolute; inset: -20%; pointer-events: none;
  opacity: var(--alv-fog); mix-blend-mode: screen;
}
.fog--1 {
  background:
    radial-gradient(42% 34% at 22% 68%, rgba(233, 233, 237, .13), transparent 72%),
    radial-gradient(38% 30% at 78% 42%, rgba(167, 161, 219, .11), transparent 70%);
  animation: alv-drift 46s ease-in-out infinite alternate;
}
.fog--2 {
  background: radial-gradient(50% 26% at 60% 88%, rgba(233, 233, 237, .10), transparent 74%);
  animation: alv-drift2 63s ease-in-out infinite alternate;
}

/* Sporer / alvestøv */
.spore {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: #d2cefd; box-shadow: 0 0 8px 2px rgba(210, 206, 253, .55);
  animation: alv-spore 16s linear infinite;
}
.spore--1 { left: 14%; bottom: 22%; width: 3px; height: 3px; animation-duration: 14s; }
.spore--2 { left: 38%; bottom: 12%; width: 2px; height: 2px; animation-duration: 19s; animation-delay: 4s; background: #e7e5fe; }
.spore--3 { left: 72%; bottom: 18%; width: 2.5px; height: 2.5px; animation-duration: 16s; animation-delay: 9s; }
.spore--4 { left: 88%; bottom: 30%; width: 2px; height: 2px; animation-duration: 22s; animation-delay: 2s; background: #f5f4ff; }

/* Vignett + korn */
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top,
    rgba(16, 17, 32, .94) 0%, rgba(16, 17, 32, .55) 34%,
    rgba(16, 17, 32, .05) 62%, rgba(16, 17, 32, .45) 100%);
}
.vignette--inset {
  background: none;
  box-shadow: inset 0 0 clamp(60px, 14vw, 220px) clamp(20px, 5vw, 90px) rgba(16, 17, 32, .75);
}
.grain {
  position: absolute; inset: 0; pointer-events: none;
  opacity: .18; mix-blend-mode: overlay;
  background-image: radial-gradient(rgba(255, 255, 255, .5) .5px, transparent .5px);
  background-size: 3px 3px;
}

/* Tekst-«beats» som toner inn/ut i takt med scroll */
.beats { position: absolute; inset: 0; }
.beat {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 clamp(18px, 5vw, 64px) clamp(60px, 9vh, 110px);
  opacity: 0; will-change: transform, opacity;
}
.beat[data-beat="0"] { opacity: 1; }
.beat .kicker { margin-bottom: var(--space-4); }

.beat h1 {
  font-size: clamp(46px, 13.5vw, 148px); line-height: .88;
  letter-spacing: -0.045em; text-wrap: balance;
}
.beat h2 {
  max-width: 20ch; font-size: clamp(30px, 7.6vw, 74px); line-height: 1;
  letter-spacing: -0.035em;
}
.beat p {
  margin-top: var(--space-6); max-width: 42ch;
  font-size: clamp(14.5px, 3.4vw, 19px); line-height: 1.55;
  color: var(--color-neutral-300);
}
.beat .lede { max-width: 30ch; font-size: clamp(15px, 3.6vw, 20px); line-height: 1.5; }
.beat .quote { font-style: italic; max-width: 38ch; }
.beat .source {
  margin-top: var(--space-3); font-size: 11.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--color-neutral-500);
}

/* Framdriftsskinne (høyre) */
.rail {
  position: absolute; right: clamp(12px, 2.2vw, 30px); top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.rail__num { font-size: 10px; letter-spacing: .12em; color: var(--color-neutral-600); font-variant-numeric: tabular-nums; }
.rail__num--end { color: var(--color-neutral-700); }
.rail__line {
  position: relative; width: 1px; height: clamp(90px, 16vh, 160px);
  background: linear-gradient(to bottom, transparent, var(--color-divider) 12px, var(--color-divider) calc(100% - 12px), transparent);
}
.rail__fill {
  position: absolute; left: -1px; top: 0; width: 3px; height: 0%;
  border-radius: 2px; background: var(--color-accent-400);
  box-shadow: 0 0 10px 1px rgba(181, 171, 252, .55);
}

/* Scroll-hint */
.cue {
  position: absolute; left: 50%; bottom: clamp(16px, 3vh, 30px);
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  transition: opacity .5s ease; pointer-events: none;
}
.cue span:first-child { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--color-neutral-500); }
.cue__bob { width: 1px; height: 26px; background: linear-gradient(to bottom, var(--color-accent-400), transparent); animation: alv-bob 2.6s ease-in-out infinite; }

/* ==========================================================================
   Galleri
   ========================================================================== */
.gallery { position: relative; padding: clamp(64px, 12vh, 150px) clamp(18px, 5vw, 64px) clamp(40px, 8vh, 90px); }
.gallery__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--space-6); flex-wrap: wrap; margin-bottom: clamp(24px, 4vh, 48px);
}
.gallery__head .kicker { margin-bottom: var(--space-3); }
.gallery__head h2 { font-size: clamp(28px, 6.6vw, 62px); line-height: 1.02; letter-spacing: -0.035em; }
.gallery__head p { max-width: 32ch; font-size: 14px; line-height: 1.6; color: var(--color-neutral-500); }

.gallery__grid {
  display: grid; gap: clamp(8px, 1.6vw, 18px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}
.tile {
  position: relative; overflow: hidden; border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); background: var(--color-neutral-900);
  aspect-ratio: 3 / 4;
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s cubic-bezier(.16, 1, .3, 1); }
.tile:hover img { transform: scale(1.06); }
.tile figcaption {
  position: absolute; left: 12px; bottom: 10px;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--color-neutral-200); text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
}

/* ==========================================================================
   Kontakt
   ========================================================================== */
.contact {
  position: relative; min-height: 88svh; display: flex; align-items: flex-end;
  overflow: hidden; margin-top: clamp(30px, 6vh, 70px);
}
.contact__bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; filter: saturate(.6) brightness(.55) contrast(1.05);
}
.contact__veil {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(16, 17, 32, .97) 8%, rgba(16, 17, 32, .6) 48%, rgba(16, 17, 32, .9) 100%);
}
.contact__inner { position: relative; padding: clamp(40px, 8vh, 110px) clamp(18px, 5vw, 64px); width: 100%; }
.contact .kicker { margin-bottom: var(--space-4); }
.contact h2 { max-width: 16ch; font-size: clamp(34px, 9vw, 96px); line-height: .94; letter-spacing: -0.045em; }
.contact p { margin-top: var(--space-6); max-width: 40ch; font-size: clamp(15px, 3.4vw, 19px); line-height: 1.6; color: var(--color-neutral-300); }
.contact__actions { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: clamp(20px, 4vh, 36px); }
.contact__note { margin-top: clamp(28px, 5vh, 54px); font-size: 11.5px; letter-spacing: .08em; color: var(--color-neutral-500); }

/* ==========================================================================
   Bunntekst
   ========================================================================== */
.site-footer {
  padding: clamp(24px, 4vh, 44px) clamp(18px, 5vw, 64px);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); flex-wrap: wrap;
  border-top: 1px solid var(--color-divider);
  font-size: 12px; color: var(--color-neutral-500);
}

/* ==========================================================================
   Reveal ved scroll (galleri + overskrifter)
   ========================================================================== */
[data-reveal] {
  opacity: 0; transform: translateY(26px) scale(.985);
  transition: opacity 1s cubic-bezier(.16, 1, .3, 1), transform 1.1s cubic-bezier(.16, 1, .3, 1);
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ==========================================================================
   Keyframes
   ========================================================================== */
@keyframes alv-drift {
  from { transform: translate3d(-6%, 2%, 0) scale(1.15); }
  to   { transform: translate3d(6%, -3%, 0) scale(1.35); }
}
@keyframes alv-drift2 {
  from { transform: translate3d(5%, -1%, 0) scale(1.25); }
  to   { transform: translate3d(-7%, 3%, 0) scale(1.10); }
}
@keyframes alv-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(7px); }
}
@keyframes alv-spore {
  0%   { transform: translate3d(0, 0, 0) scale(.6); opacity: 0; }
  12%  { opacity: .55; }
  100% { transform: translate3d(22px, -130px, 0) scale(1); opacity: 0; }
}

/* ==========================================================================
   Responsivt
   ========================================================================== */
@media (max-width: 640px) {
  .rail { display: none; }               /* skjul skinne på smal skjerm */
  .beat { padding-bottom: clamp(72px, 12vh, 120px); }
}

/* ==========================================================================
   Redusert bevegelse — respekter brukerens valg
   Beholder rolige krysstoninger, fjerner parallakse, drift, sporer og glød.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .fog, .spore, .cue__bob { animation: none; }
  .spore { display: none; }
  .glow { display: none; }
  .tile img { transition: none; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}
