/* ============================================================
   base.css — Reset, selvhostet font, typografi, layout-primitiver
   Kræver tokens.css indlæst først.
   ============================================================ */

/* ---- Selvhostet Schibsted Grotesk (SIL OFL 1.1) --------------
   Kilde: Google Fonts / fonts.gstatic.com (officiel OFL-distribution).
   Licens: se assets/fonts/OFL.txt
   Strukturen spejler upstream-leveringen: vægt 400, 500 og 600 med
   unicode-range-opdeling (latin / latin-ext).
   Vægt 600 bruges af heroens lead-linje (målt på referencen) og er en
   RIGTIG skåret vægt — ikke browser-syntetiseret fed.
   INGEN eksterne fontkald — alt serveres lokalt.               */

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* INGEN scroll-behavior: smooth — den ville konkurrere med Lenis om
     anchor-scroll. Native anchor-hop bruges kun ved reduced-motion / ingen JS. */
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  -webkit-font-smoothing: antialiased;
  /* 'clip' (ikke 'hidden'): klipper horisontal overflow UDEN at tvinge
     overflow-y til auto → body bliver ikke en scroll-container, og
     position: sticky forbliver relativ til viewporten. */
  overflow-x: clip;
}

/* Sticky-nav-offset — KUN faktiske navigationsmål (ikke alle [id]).
   Native anchor-hop og fokus lander under den sticky menurække. */
#main,
main[id],
section[id],
[data-scroll-target] {
  scroll-margin-top: calc(var(--sticky-nav-h) + 16px);
}

img, video, svg, iframe { display: block; max-width: 100%; }
img, video { height: auto; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---- Typografi ---- */
h1, h2, h3, h4 {
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-display);
  line-height: var(--lh-display);
  text-wrap: balance;
}

/* Lange ord må aldrig tvinge horisontal overflow på smalle skærme.
   BEMÆRK: 'break-word' reducerer IKKE min-content — det gør 'anywhere'.
   Display-typografi bruger derfor 'anywhere', så grid/flex-items kan krympe. */
h1, h2, h3, h4, .section-title { overflow-wrap: anywhere; hyphens: auto; }
p, li, a { overflow-wrap: break-word; hyphens: auto; }
:where(.container) > *,
:where(.container) > * > * { min-width: 0; }
h1 { font-size: var(--fs-display); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-md); letter-spacing: var(--ls-body); line-height: var(--lh-tight); }

p { max-width: 68ch; }

/* Sektionsoverskrift: versaler + punktum (redaktionel signatur) */
.section-title {
  font-size: var(--fs-2xl);
  text-transform: uppercase;
  letter-spacing: var(--ls-display);
  line-height: var(--lh-display);
}

.eyebrow {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--fg-muted);
}

.text-muted { color: var(--fg-muted); }

/* ---- Layout ---- */
/* Fluid container — ingen max-width, ingen centrering.
   box-sizing: border-box (sat i reset) sikrer at padding ligger
   INDE i de 100%, så der aldrig opstår horisontal overflow. */
.container {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding-inline: var(--page-gutter);
}

/* Projektsektionen bruger smallere gutter på mobil (målt på referencen) */
@media (max-width: 768px) {
  .container--work { padding-inline: var(--work-gutter-mobile); }
}

.section { padding-block: var(--space-m); }
.section--lg { padding-block: var(--space-l); }

.hairline { border: 0; border-top: 1px solid var(--line); }

/* ---- Tilgængelighed ---- */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: var(--pad-x);
  top: -100px;
  z-index: 200;
  background: var(--inv-bg);
  color: var(--inv-fg);
  padding: 10px 16px;
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus { top: 12px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Scroll-reveal (Fase 7) ----
   Progressiv forbedring: skjul-tilstanden gælder KUN når site.js har sat
   html.reveal-ready (dvs. IntersectionObserver findes OG ikke reduced-motion).
   Uden JS, uden observer eller ved reduced motion forbliver ALT fuldt synligt —
   derfor sættes opacity/transform-starttilstanden aldrig af CSS alene (intet
   flash hvor indhold vises og derefter pludselig skjules). data-reveal tilføjes
   KUN til below-the-fold-indhold; above-the-fold har aldrig data-reveal. */
[data-reveal] {
  transition: opacity var(--motion-normal) var(--ease-out),
              transform var(--motion-normal) var(--ease-out);
}
html.reveal-ready [data-reveal]:not(.is-revealed) {
  opacity: 0;
  transform: translateY(16px);            /* standard tekst-reveal */
}
html.reveal-ready [data-reveal="card"]:not(.is-revealed) {
  transform: translateY(24px);            /* kort-/medie-reveal */
}
[data-reveal].is-revealed { opacity: 1; transform: none; }

/* Let stagger — KUN i erklærede grupper, maks 4 trin á 50ms (≤150ms samlet).
   Børn ud over 4 får ingen ekstra forsinkelse (ingen lang kaskade). */
[data-reveal-group] > [data-reveal]:nth-child(2) { transition-delay: 50ms; }
[data-reveal-group] > [data-reveal]:nth-child(3) { transition-delay: 100ms; }
[data-reveal-group] > [data-reveal]:nth-child(4) { transition-delay: 150ms; }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  /* Sikkerhedsnet: hvis reduced motion slås til EFTER load (html.reveal-ready
     allerede sat), skal alt reveal-indhold være synligt straks. */
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
