/* ═══════════════════════════════════════════════════════════════
   base.css · Reset, Typografie, Layout-Grundraster
   Norwegen langsam lesen · Edition Nordroute 01 · Juni 2026
   ─────────────────────────────────────────────────────────────── */

/* Fonts loaded via <link> in HTML for performance — see head of each page */

:root {
  --font-sans: 'Manrope', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --paper: #f8f3ea;
  --paper-warm: #f2e9db;
  --paper-deep: #e8decd;
  --paper-raw: #f3efe5;
  --paper-cold: #eef1ef;
  --chalk-white: #fbf7ee;
  --fog-grey: #c7c4ba;
  --wet-stone: #5f6464;
  --north-sea-blue: #244f5f;
  --fjord-blue: #3f6f7d;
  --fjord-green: #4e6a50;       /* a11y: deepened from #5f7d61 → AA on paper (5.43:1) */
  --glacier-water: #8fb8bd;
  --tundra-ochre: #b08a57;
  --rust-red: #9b4d35;
  --coal-black: #1e2324;
  --muted-brass: #b49a63;       /* decorative only — not for text */
  --wood-white: #f4f0e7;
  --late-summer-light: #f3d7a1; /* decorative only — not for text */
  --ink: #171612;
  --ink-soft: rgba(23, 22, 18, 0.94);
  --ink-faint: rgba(24, 24, 20, 0.84);
  --ink-readable: rgba(23, 22, 18, 0.92);
  --ink-readable-strong: rgba(23, 22, 18, 0.95);
  --muted: #4e493f;
  --fjord: #1a4650;
  --deep: #102931;
  --deep-warm: #182f35;
  --moss: #516548;
  --rust: #a04a2d;              /* a11y: deepened from #b35a3a → AA on paper (5.41:1) */
  --rust-soft: rgba(160, 74, 45, 0.12);
  --rust-warm: #e3a08b;         /* a11y: warm peach-rust for dark-mode accents (≥6.0:1 on dark paper) */
  --rust-warm-strong: #ecb39c;  /* a11y: emphasis variant of --rust-warm on dark surfaces */
  --brass: #876829;             /* a11y: brighter brass for dark mode (≥4.5:1 on dark paper) */
  --ice: #7fb5c4;
  --shadow-sm: 0 2px 8px rgba(15, 41, 48, 0.06);
  --shadow-md: 0 8px 32px rgba(15, 41, 48, 0.1);
  --shadow-lg: 0 24px 64px rgba(15, 41, 48, 0.14);
  --shadow-xl: 0 30px 80px rgba(15, 41, 48, 0.18);
  --radius-sm: 2px;
  --radius-md: 4px;
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --content-width: 1320px;
  --prose-width: 720px;
  --spacing-section: clamp(var(--r-8), 12vw, var(--r-13));
  --reading-width: min(72ch, 100%);
  --texture-fjord: url('../assets/textures/summer-fjord-wash.webp');
  --texture-rain: url('../assets/textures/summer-rain-wash.webp');
  --texture-stones: url('../assets/textures/wet-fjord-stones.webp');
  --texture-field-note: url('../assets/curated/motifs/notes/summer-field-note.webp');
  --texture-source-stamps: url('../assets/curated/motifs/notes/summer-source-stamps.webp');
  --texture-compass: url('../assets/curated/motifs/route/summer-compass-2026.webp');
  /* ── Baseline rhythm (Fibonacci × 0.5rem: 1 2 3 5 8 13) ── */
  --baseline: 0.5rem;
  --r-1: 0.5rem;
  --r-2: 1rem;
  --r-3: 1.5rem;
  --r-5: 2.5rem;
  --r-8: 4rem;
  --r-13: 6.5rem;

  /* ── Mono token scale ── */
  --mono-xs: 0.7rem;
  --mono-sm: 0.75rem;
  --mono-md: 0.8125rem;
  --mono-tracking: 0.14em;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark-mode variants for tokens that previously clobbered the light :root
       (bug fixed 2026-05-23 — see docs/DESIGN_SYSTEM.md § Colors). */
    --fjord: #1a3f47;
    --fjord-green: #8fb592;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-optical-sizing: auto;
  hyphens: auto;
  -webkit-hyphens: auto;
}

:where(h1,h2,h3,h4,.kicker,.label,.mono,.eyebrow,.marker,.button,.place-card__marker,.evidence-strip__label,.source-slip__kicker,.second-door-card__place,.second-door-card__marker,.hero-route,.edition,.main-nav a,.chapter-nav__label,.chapter-nav__progress,.breadcrumb) {
  hyphens: manual;
}

body {
  font-family: var(--font-sans);
  font-size: clamp(1.05rem, 0.4vw + 1rem, 1.15rem);
  font-weight: 500;
  line-height: 1.7;
  letter-spacing: 0;
  font-feature-settings: "liga" 1, "kern" 1, "ss01" 1, "cv11" 1;
  font-kerning: normal;
  font-optical-sizing: auto;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

@supports (overflow: clip) {
  body {
    overflow-x: clip;
  }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    var(--texture-rain) 92% 8% / clamp(220px, 24vw, 420px) auto no-repeat,
    var(--texture-fjord) 6% 88% / clamp(250px, 26vw, 460px) auto no-repeat,
    var(--texture-stones) 84% 86% / clamp(180px, 18vw, 320px) auto no-repeat,
    radial-gradient(ellipse at 15% 5%, rgba(198, 221, 226, 0.22), transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(182, 91, 61, 0.055), transparent 40%),
    linear-gradient(180deg, #faf5ec, var(--paper));
  opacity: 0.22;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, var(--grain) 3px 4px),
    repeating-linear-gradient(90deg, transparent 0 4px, rgba(20, 20, 18, 0.012) 4px 5px);
  pointer-events: none;
}

.place-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    url('../assets/textures/summer-fabric-scrap.webp') 7% 24% / clamp(120px, 13vw, 220px) auto no-repeat,
    url('../assets/textures/summer-driftwood.webp') 96% 56% / clamp(150px, 16vw, 260px) auto no-repeat,
    url('../assets/textures/summer-footprint-tag.webp') 11% 78% / clamp(120px, 12vw, 210px) auto no-repeat;
  opacity: 0.18;
  pointer-events: none;
}

::selection {
  background: rgba(181, 80, 58, 0.15);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.2em;
  transition: color 0.2s var(--ease-out);
}

img, svg { display: block; max-width: 100%; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }


/* ═══════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════ */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 560;
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.8rem, 7.5vw, 6.5rem);
  line-height: 0.91;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 72;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3.6rem);
  line-height: 1.04;
  font-variation-settings: "opsz" 48;
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  line-height: 1.1;
  font-variation-settings: "opsz" 32;
}

h4 {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  font-variation-settings: "opsz" 24;
}

body {
  --heading-accent: var(--place-accent, var(--rust));
  --heading-accent-soft: color-mix(in srgb, var(--heading-accent) 14%, var(--ink));
}

.home-page {
  --heading-accent: #9b4d35;
}

.collection-page {
  --heading-accent: #3f6f7d;
}

.tool-page--kompass {
  --heading-accent: #516548;
}

.tool-page--weather {
  --heading-accent: #547a84;
}

.hero-copy h1,
.section-header h2,
.atlas-panel__feature h3,
.second-door__title,
.photo-truth h3,
.family-realism h3,
.weather-script h3,
.second-door-index h3 {
  color: var(--heading-accent-soft);
}

.text-accent {
  color: var(--heading-accent);
  font: inherit;
}

.text-accent--quiet {
  color: color-mix(in srgb, var(--heading-accent) 76%, var(--ink));
  font: inherit;
}

/* ── Five emphasis types ── */

/* 1. Italic-rust: only for the 3 literary signatures (already inherited via .text-accent) */

/* 2. Spaced small-caps: for section kickers and formal labels */
.emphasis--smallcaps,
.prose h3 {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.12em;
  font-weight: 600;
}

/* 3. Inverse gesture: ink-on-paper punch for key phrases */
.emphasis--inverse {
  background: var(--ink);
  color: var(--paper);
  padding: 0.08em 0.35em;
  margin: 0 -0.05em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* 4. SVG underline wash: via border-image on pull-quote keywords */
.emphasis--wash {
  text-decoration: none;
  border-bottom: 2px solid color-mix(in srgb, var(--heading-accent) 40%, transparent);
  padding-bottom: 0.05em;
}

/* ── Two voices: System (Manrope) vs Author (Newsreader) ── */
/* System speaks: data, evidence, manifesto descriptions, weather, footer */
.evidence-strip__item p:last-child,
.manifesto__text,
.weather-script__item span,
.weather-script__pull,
.source-slip__text,
.footer-sub,
.footer-colophon,
.decision p,
.note-card p,
.safety p,
.map-card p,
.reality-cut__card p,
.weather-logic p {
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.5vw + 0.9rem, 1.05rem);
  line-height: 1.55;
  letter-spacing: 0;
}

/* Author speaks: literary passages stay Newsreader */
.hero__lede, .hero-pull,
.section-header .lede, .lede,
.place-card__sentence,
.second-door-intro p,
.second-door__pull,
.second-door-card__pull,
.decision blockquote,
.prose blockquote,
.ortsbuch-panel__sentences li {
  font-variation-settings: "opsz" 14;
}

/* ── Numeral systems by meaning ── */
.place-card__number,
.evidence-strip__label,
.second-door-card__marker,
.hero-route span,
.chapter-nav__progress {
  font-variant-numeric: tabular-nums;
}

.prose h2 {
  color: color-mix(in srgb, var(--heading-accent) 18%, var(--ink));
}

.section--dark {
  --heading-accent: #d89272;
  --heading-accent-soft: var(--paper);
}

.kicker {
  display: inline-block;
  color: var(--rust);
  font-family: var(--font-sans);
  font-size: var(--mono-sm);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: var(--r-2);
  text-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.lede {
  max-width: min(48ch, var(--prose-width));
  color: var(--ink-soft);
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
  line-height: 1.6;
  letter-spacing: 0;
  text-wrap: pretty;
  font-variation-settings: "opsz" 14;
}

.chapter-number {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(4rem, 10vw, 8rem);
  font-weight: 400;
  color: rgba(26, 26, 24, 0.06);
  line-height: 1;
  letter-spacing: 0;
  margin-bottom: -0.5rem;
  user-select: none;
}


/* ═══════════════════════════════════════
   SECTIONS
   ═══════════════════════════════════════ */

.section {
  padding: var(--spacing-section) clamp(1.25rem, 5vw, 5rem);
  content-visibility: auto;
  contain-intrinsic-size: auto 760px;
}

.section--dark {
  background: var(--deep);
  color: var(--paper);
}

.section--dark {
  background-image:
    radial-gradient(circle at 12% 18%, rgba(159, 217, 232, 0.08), transparent 35%),
    radial-gradient(circle at 88% 78%, rgba(181, 80, 58, 0.09), transparent 34%),
    linear-gradient(180deg, rgba(15, 41, 48, 0.99), rgba(12, 31, 36, 0.99));
}

.section--dark .kicker { color: var(--rust-warm); }              /* a11y: 6.99:1 on --deep (was 2.73:1) */
.section--dark .lede { color: rgba(245, 241, 232, 0.95); }
.section--dark a { color: var(--ice); }
.section--dark .line-accent { background: rgba(227, 160, 139, 0.55); } /* a11y: matched to --rust-warm */

.section--dark .section-header p,
.section--dark .manifesto__text,
.section--dark .place-card__sentence,
.section--dark .evidence-strip__item p:last-child {
  color: rgba(245, 241, 232, 0.94);
}

.section--warm {
  background:
    radial-gradient(circle at 82% 18%, rgba(181, 80, 58, 0.08), transparent 36%),
    radial-gradient(circle at 12% 86%, rgba(26, 63, 71, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(246, 242, 234, 0.96), rgba(243, 238, 228, 0.95));
}

.section--accent {
  background: var(--fjord);
  color: var(--paper);
}

.section-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.6fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: end;
  margin-bottom: clamp(var(--r-5), 6vw, var(--r-8));
  max-width: var(--content-width);
}

.section-header p {
  margin: 0;
  color: var(--ink-readable);
  font-size: 1rem;
  line-height: 1.55;
  max-width: var(--reading-width);
  text-wrap: pretty;
}

.section--dark .section-header p {
  color: rgba(245, 241, 232, 0.92);
}

.line-accent {
  display: block;
  width: 48px;
  height: 2px;
  background: var(--rust);
  margin-bottom: 1.5rem;
}


/* ═══════════════════════════════════════
   GRIDS
   ═══════════════════════════════════════ */

.grid {
  display: grid;
  gap: 1.25rem;
  max-width: var(--content-width);
}

.grid--places {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}


/* ═══════════════════════════════════════
   PROSE
   ═══════════════════════════════════════ */

.prose {
  max-width: var(--prose-width);
  font-size: clamp(1.08rem, 0.35vw + 1.05rem, 1.25rem);
  line-height: 1.7;
}

.prose p + p { margin-top: var(--r-3); }

.place-page .prose > .lede:first-child {
  position: relative;
  padding-top: 0.2rem;
}

.place-page .prose > .lede:first-child::first-letter {
  float: left;
  margin: 0.08em 0.12em 0 0;
  color: color-mix(in srgb, var(--place-accent, var(--rust)) 82%, var(--ink));
  font-family: var(--font-display);
  font-size: 4.1em;
  font-style: italic;
  font-weight: 400;
  line-height: 0.76;
  font-variation-settings: "opsz" 72;
}

.prose h2 {
  margin-top: var(--r-8);
  margin-bottom: var(--r-2);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.prose h2::before {
  content: "";
  display: block;
  width: 32px;
  height: 2px;
  background: var(--rust);
  margin-bottom: var(--r-2);
}

.prose h3 {
  margin-top: var(--r-5);
  margin-bottom: var(--r-1);
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.5vw + 0.9rem, 1.05rem);
  text-transform: none;
  color: var(--muted);
}

.prose ul {
  padding-left: 0;
  list-style: none;
}

.prose li {
  position: relative;
  padding-left: 1.25rem;
}

.prose li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 5px;
  height: 5px;
  background: var(--rust);
  transform: rotate(45deg);
}

.prose li + li { margin-top: var(--r-1); }

.prose blockquote {
  margin: var(--r-5) 0;
  padding: var(--r-3) 0 var(--r-3) var(--r-3);
  border-left: 2px solid var(--rust);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink-soft);
  hanging-punctuation: first last;
  quotes: "\201E" "\201C" "\201A" "\2018";
  text-wrap: pretty;
}


/* ═══════════════════════════════════════
   SPLIT LAYOUT (prose + sidebar)
   ═══════════════════════════════════════ */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
  max-width: calc(var(--prose-width) + 340px + 5rem);
}

.side-rail {
  position: sticky;
  top: 5rem;
  display: grid;
  gap: 1.25rem;
}

.side-rail > section {
  border: 1px solid color-mix(in srgb, var(--place-accent, var(--rust)) 18%, var(--line));
  box-shadow: 0 12px 28px rgba(15, 41, 48, 0.08);
  backdrop-filter: blur(4px) saturate(1.03);
  -webkit-backdrop-filter: blur(4px) saturate(1.03);
}

.side-rail > section:hover {
  border-color: color-mix(in srgb, var(--place-accent, var(--rust)) 30%, var(--line));
}

.side-rail > section {
  content-visibility: auto;
  contain-intrinsic-size: auto 260px;
}


/* ═══════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════ */

.text-center { text-align: center; }
.max-prose { max-width: var(--prose-width); }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-section { margin-top: var(--spacing-section); }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}


/* ═══════════════════════════════════════
   READING PROGRESS
   ═══════════════════════════════════════ */

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--rust);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 60;
  pointer-events: none;
  will-change: transform;
}


/* ═══════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════ */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  opacity: 1;
  transform: translateY(0);
  animation: fadeInUp 0.5s var(--ease-out) both;
}

.animate-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-in:nth-child(2) { animation-delay: 0.06s; }
.animate-in:nth-child(3) { animation-delay: 0.12s; }
.animate-in:nth-child(4) { animation-delay: 0.18s; }
.animate-in:nth-child(5) { animation-delay: 0.24s; }
.animate-in:nth-child(6) { animation-delay: 0.3s; }


/* ═══════════════════════════════════════
   PRINT
   ═══════════════════════════════════════ */






