/* ===================================================================
   VEASD — Vi er bare som dere
   Print-faithful: navy + black + white. Single font (Space Grotesk).
   =================================================================== */

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/SpaceGrotesk.ttf") format("truetype-variations");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1a1a1a;
  --ink-soft: #555;
  --line: #e5e2d8;
  --navy: #0c1d4d;
  --paper: #ffffff;
  --type: "Space Grotesk", "Inter", system-ui, sans-serif;
  --header-h: 52px;

  /* Fluid scale anchored to the SHORTER viewport axis so things never
     overflow on a 13" MBP at 100% zoom (height-constrained). */
  --u: min(1vw, 1.5vh);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--type);
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
  /* Prevent browser auto-hyphenation triggered by lang="no"/"pl" */
  hyphens: none;
  -webkit-hyphens: none;
}

body { overflow: hidden; }

a { color: inherit; text-decoration: none; }

/* ---------- HEADER (sticky) ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 100;
}
.site-header .brand {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--navy);
  text-transform: uppercase;
}
.site-header .tools { display: flex; align-items: center; gap: 16px; }

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 150ms;
}
.logo-link:hover { opacity: 1; }
.header-logo {
  height: 18px;
  width: auto;
  display: block;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.lang-toggle button {
  background: none;
  border: 0;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  color: #9b9b9b;
  padding: 4px 2px;
}
.lang-toggle button.active { color: var(--navy); }
.lang-toggle .sep { color: #cfcabc; }

.index-btn {
  background: none;
  border: 1px solid var(--ink);
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 9px;
  cursor: pointer;
}

/* ---------- SCROLLER (snap container) ---------- */
.scroller {
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}
.scroller > section,
.scroller .story {
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  position: relative;
}

/* ---------- LANDING ---------- */
.intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: calc(var(--header-h) + clamp(8px, 1vh, 16px)) 24px clamp(8px, 1.5vh, 18px);
  overflow: hidden;
}
.intro .hero {
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.9;
  color: var(--navy);
  /* width-driven cap, height-driven cap, hard ceiling */
  font-size: clamp(40px, min(7.2vw, 11vh), 104px);
  margin: clamp(4px, 1vh, 20px) 0 0;
}
.intro .hero span {
  display: block;
  white-space: nowrap;
}
.intro .subtitle {
  margin: clamp(8px, 1.4vh, 18px) 0 0;
  font-size: clamp(13px, min(1.4vw, 2vh), 19px);
  font-weight: 600;
  color: var(--navy);
  max-width: 720px;
}
.intro .author {
  margin: 4px 0 0;
  font-size: clamp(10px, 1.1vh, 12px);
  color: var(--ink-soft);
  white-space: nowrap;
}
.intro .body {
  margin-top: clamp(10px, 2vh, 26px);
  max-width: 880px;
  width: 100%;
  font-size: clamp(11px, min(0.88vw, 1.55vh), 14px);
  line-height: 1.5;
  text-align: left;
  color: var(--ink);
  column-count: 2;
  column-gap: 32px;
  column-fill: balance;
  hyphens: none;
  -webkit-hyphens: none;
  overflow-wrap: break-word;
}
.intro .body p { margin: 0 0 8px; break-inside: avoid; }
.intro .partners {
  margin-top: auto;
  padding-top: clamp(8px, 1.4vh, 18px);
}
.intro .partners-label {
  font-size: clamp(9px, 1vh, 11px);
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.intro .partners img {
  max-height: clamp(28px, 4.4vh, 44px);
  max-width: min(560px, 80vw);
  object-fit: contain;
}

.scroll-cue {
  margin-top: clamp(6px, 1vh, 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--navy);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ---------- MAP SECTION ---------- */
.map-section {
  padding: calc(var(--header-h) + clamp(8px, 1vh, 16px)) clamp(20px, 3vw, 48px) clamp(16px, 2vh, 24px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(16px, 2.4vw, 36px);
  align-items: stretch;
}
.map-section h2 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--navy);
  font-size: clamp(20px, min(2.2vw, 3vh), 28px);
  margin: 0 0 4px;
}
.map-section .hint {
  font-size: clamp(11px, 1.4vh, 13px);
  color: var(--ink-soft);
  margin: 14px 0 0;
  max-width: 56ch;
}
.big-map {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.big-map .map-host {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.big-map svg {
  width: 100%;
  height: 100%;
  display: block;
}
.big-map .pin {
  fill: var(--navy);
  cursor: pointer;
  transition: r 120ms ease, fill 120ms ease;
}
.big-map .pin:hover { fill: #1e3a8a; }

/* Desktop: scale pins to 75% of their SVG radius so Norway isn't over-dotted */
@media (min-width: 761px) {
  .big-map .pin {
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(0.75);
  }
}
.big-map .cluster {
  fill: var(--navy);
  cursor: pointer;
}
.big-map .cluster-label {
  fill: #fff;
  font-family: var(--type);
  font-weight: 700;
  font-size: 90px;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: central;
}

.map-text {
  display: flex;
  flex-direction: column;
  justify-content: center; /* vertically centered */
  min-width: 0;
}
.map-text .about {
  font-size: clamp(12px, min(0.95vw, 1.6vh), 14px);
  line-height: 1.55;
  color: var(--ink);
  text-align: left;
  max-width: 56ch;
}
.map-text .about p { margin: 0 0 10px; }

/* ---------- STORY ---------- */
.story {
  /* Photo column = full content height → photo is always a perfect square,
     same size on every story regardless of text length.
     Left column gets the remaining width → text wrapping is also consistent. */
  --_content-h: calc(100vh - var(--header-h)
                     - clamp(12px, 1.6vh, 22px)
                     - clamp(16px, 2vh, 28px));
  display: grid;
  grid-template-columns: minmax(260px, 1fr) var(--_content-h);
  gap: clamp(28px, 3.4vw, 56px);
  padding: calc(var(--header-h) + clamp(12px, 1.6vh, 22px)) clamp(24px, 3.4vw, 48px) clamp(16px, 2vh, 28px);
  align-items: stretch;
  overflow: hidden;
}
.story-left {
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* map always anchored top-left */
  gap: clamp(12px, 1.6vh, 24px);
  min-width: 0;
}
.story-mini-map {
  display: flex;
  align-items: flex-start;
}
.story-mini-map .mini-norway {
  height: clamp(200px, 38vh, 440px);
  width: auto;
  aspect-ratio: 2802/3080;
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-mini-map .mini-norway svg {
  width: 100%;
  height: 100%;
  display: block;
}

.story-body-block {
  margin-top: auto; /* pushes text to bottom of the flex column */
}
.story-body-block .person-name {
  font-size: clamp(20px, min(2vw, 3vh), 30px);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}
.story-body-block .person-loc {
  font-size: clamp(11px, 1.4vh, 13px);
  letter-spacing: 0.18em;
  font-weight: 600;
  margin-top: 5px;
  color: var(--ink);
  text-transform: uppercase;
}
.story-body-block .person-body {
  margin-top: clamp(10px, 1.6vh, 18px);
  font-size: clamp(12px, min(0.95vw, 1.7vh), 14.5px);
  line-height: 1.5;
  max-width: 640px;
  color: var(--ink);
  hyphens: none;
  -webkit-hyphens: none;
  overflow-wrap: break-word;
}
.story-body-block .person-body p { margin: 0 0 10px; }

.story-photo {
  /* width = var(--_content-h) column, height = row height = same value → always square */
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #f0ece0;
}
.story-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 320ms ease;
}
.story-photo img.loaded { opacity: 1; }

/* ---------- MINI-WIDGET (top-right under header) ---------- */
.mini-widget {
  position: fixed;
  right: 12px;
  top: calc(var(--header-h) + 10px);
  z-index: 90;
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--ink);
  padding: 5px 10px;
  display: flex;
  align-items: center;
  user-select: none;
  cursor: pointer;
  transition: opacity 220ms, transform 220ms;
}
#mini-map { display: none; }
.mini-widget .count {
  font-size: 11px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.06em;
}

/* Story mini-map pin (only active one is visible) */
.story-mini-map .pin { fill: var(--navy); }
.story-mini-map .pin.active { fill: var(--navy); }

.mini-widget[data-context="intro"],
.mini-widget[data-context="map"] {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
}

/* ---------- INDEX DRAWER ---------- */
.index-drawer {
  position: fixed;
  top: var(--header-h);
  right: 0;
  width: min(420px, 92vw);
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  background: white;
  border-left: 1px solid var(--ink);
  z-index: 95;
  transform: translateX(100%);
  transition: transform 280ms ease;
  display: flex;
  flex-direction: column;
}
.index-drawer.open { transform: translateX(0); }
.index-drawer .head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.index-drawer .head h3 {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--navy);
}
.index-drawer .head .close {
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.index-drawer .list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.index-drawer .list button {
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
  padding: 9px 16px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f4f1e7;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.index-drawer .list button:hover { background: #f7f4ea; }
.index-drawer .list button.active { color: var(--navy); font-weight: 700; }
.index-drawer .list button .num {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  width: 22px;
}
.index-drawer .list button .city {
  color: var(--ink-soft);
  font-size: 10px;
  margin-left: auto;
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 90;
  pointer-events: none;
  transition: background 280ms;
}
.scrim.open {
  background: rgba(0,0,0,0.15);
  pointer-events: auto;
}

/* ---------- CLUSTER ZOOM OVERLAY ---------- */
.cluster-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.97);
  z-index: 110;
  display: none;
  flex-direction: column;
  padding: calc(var(--header-h) + 12px) 24px 24px;
}
.cluster-overlay.open { display: flex; }
.cluster-overlay .close {
  position: absolute;
  top: calc(var(--header-h) + 10px);
  right: 18px;
  background: white;
  border: 1px solid var(--ink);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 6px 10px;
  cursor: pointer;
}
.cluster-overlay h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cluster-overlay .list {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  padding: 8px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}
.cluster-overlay .list button {
  background: white;
  border: 1px solid var(--line);
  text-align: left;
  padding: 10px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cluster-overlay .list button:hover { border-color: var(--ink); background: #faf8f0; }
.cluster-overlay .list button .name { font-weight: 600; color: var(--ink); }
.cluster-overlay .list button .city { font-size: 10px; color: var(--ink-soft); letter-spacing: 0.12em; text-transform: uppercase; }
.cluster-overlay .list button .cluster-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  margin-bottom: 8px;
  background: #f0ece0;
}

/* ---------- MOBILE (≤ 760 px) ---------- */
@media (max-width: 760px) {
  :root { --header-h: 48px; }

  /* Drop snap on mobile — natural scrolling fits long content better.
     KEEP the .scroller container as the scrollable area (the JS uses it
     for scrollTo() and as the IntersectionObserver root). */
  .scroller {
    scroll-snap-type: none;
    height: 100dvh;
    overflow-y: auto;
  }
  .scroller > section,
  .scroller .story {
    height: auto;
    min-height: 100dvh;
    scroll-snap-align: none;
  }
  body { overflow: hidden; }

  .site-header { padding: 0 12px; overflow: hidden; }
  .brand-group { gap: 0; min-width: 0; flex-shrink: 0; }
  .header-logo { height: 16px; width: auto; display: block; }
  /* Hide the title text in the header on mobile — it's already huge on the landing page */
  .site-header .brand { display: none; }
  .index-btn { padding: 4px 7px; font-size: 9px; }
  .lang-toggle { font-size: 11px; gap: 4px; }

  /* INTRO mobile — no scroll cue */
  .intro {
    min-height: 100dvh;
    padding: calc(var(--header-h) + 16px) 18px 28px;
    overflow: visible;
  }
  .intro .hero { font-size: clamp(40px, 11vw, 60px); }
  .intro .subtitle { font-size: 13px; margin-top: 12px; }
  .intro .author { font-size: 11px; white-space: normal; }
  .intro .body {
    column-count: 1;
    margin-top: 18px;
    font-size: 13px;
    line-height: 1.55;
  }
  .intro .partners img { max-height: 28px; }
  .intro .partners-label { font-size: 10px; }
  .scroll-cue { display: none; }

  /* MAP mobile — stack: map + text (no title or hint copy needed) */
  .map-section {
    min-height: 100dvh;
    grid-template-columns: 1fr;
    padding: calc(var(--header-h) + 16px) 18px 28px;
    gap: 18px;
  }
  .big-map { height: 56vh; }
  .map-text { padding-top: 0; justify-content: flex-start; }
  .map-text .hint { display: none; } /* hint not needed on mobile */
  .map-text .about { font-size: 13px; max-width: none; }

  /* STORY mobile — photo on top, then map + name/text row */
  .story {
    min-height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 16px;
    padding: calc(var(--header-h) + 12px) 18px 24px;
    overflow: visible;
  }
  .story-photo {
    aspect-ratio: 1 / 1;
    height: auto;
    width: 100%;
    order: 1;
  }
  .story-left {
    order: 2;
    display: grid;
    grid-template-columns: 92px 1fr;
    grid-template-rows: auto;
    gap: 14px;
    align-items: start;
  }
  .story-mini-map { display: block; }
  .story-mini-map .mini-norway { height: auto; width: 88px; }
  .story-body-block { min-width: 0; }
  .story-body-block .person-name { font-size: 18px; }
  .story-body-block .person-loc { font-size: 10px; }
  .story-body-block .person-body { font-size: 13px; line-height: 1.55; }

  /* mobile: no scroll-hint label */
  .story .scroll-hint { display: none; }

  .mini-widget { width: 58px; padding: 5px; right: 8px; top: calc(var(--header-h) + 6px); }
  .mini-widget svg { width: 48px; }
  .mini-widget .count { font-size: 8px; }

  .cluster-overlay { padding: calc(var(--header-h) + 14px) 14px 14px; }
  .cluster-overlay .list { grid-template-columns: 1fr; }
}

/* scroll-hint: shown on desktop only inside the story (not used on mobile) */
.scroll-hint { display: none; }

/* ---------- AUTOR BUTTON (header) ---------- */
.autor-btn {
  background: none;
  border: 1px solid var(--navy);
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 9px;
  cursor: pointer;
  color: var(--navy);
}
.autor-btn:hover { background: var(--navy); color: #fff; }

/* ---------- OD AUTORA OVERLAY ---------- */
#autor-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--paper);
  color: var(--ink);
  overflow-y: auto;
  overflow-x: hidden;
  transform: translateY(100%);
  transition: transform 420ms cubic-bezier(0.4, 0, 0.2, 1);
  overscroll-behavior: contain;
}
#autor-overlay.open {
  transform: translateY(0);
}

.autor-overlay-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.autor-overlay-header h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 0;
}
.autor-overlay-header .close {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background 150ms, border-color 150ms;
}
.autor-overlay-header .close:hover { background: #f4f1e7; border-color: var(--ink); }

.autor-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

/* Each paragraph row */
.autor-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
}
.autor-row:last-child { border-bottom: none; }

/* Alternate: odd rows photo right, even rows photo left */
.autor-row:nth-child(even) .autor-text { order: 2; }
.autor-row:nth-child(even) .autor-photo { order: 1; }

.autor-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.autor-num {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}
.autor-text p {
  font-size: clamp(14px, 1.1vw, 17px);
  line-height: 1.7;
  color: var(--ink);
  margin: 0;
  hyphens: none;
  -webkit-hyphens: none;
}

.autor-photo {
  aspect-ratio: 3 / 2;
  background: #f4f1e8;
  border: 1px solid var(--line);
  overflow: hidden;
}
.autor-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 400ms;
}
.autor-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #ccc;
  letter-spacing: 0.06em;
}

/* Mobile adjustments for overlay */
@media (max-width: 760px) {
  .autor-overlay-header { padding: 14px 18px; }
  .autor-content { padding: 24px 18px 60px; }
  .autor-row {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 28px 0;
  }
  /* On mobile, photo always comes first */
  .autor-row .autor-photo { order: 1 !important; }
  .autor-row .autor-text  { order: 2 !important; }
  .autor-btn { font-size: 9px; padding: 4px 7px; }
}

/* ---------- AUTOR COLOPHON (bottom of Od autora overlay) ---------- */
.autor-colophon {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
}
