/* ==========================================================================
   Typografisystem
   Newsreader  – overskrifter, sitater, plansjetekster (optisk størrelse auto)
   Source Sans 3 – brødtekst, metadata, grensesnitt, diagramtekst
   Fonter lastes i HTML:
   https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300..700;1,6..72,300..600&family=Source+Sans+3:ital,wght@0,300..700;1,400..600&display=swap
   ========================================================================== */

:root {
  --font-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-text: "Source Sans 3", "Source Sans Pro", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Skala: fluid, ca. 1.25 på mobil → 1.333 på desktop */
  --fs-micro:   .75rem;                                      /* 12  – diagram-akser */
  --fs-small:   .875rem;                                     /* 14  – metadata, notater */
  --fs-ui:      .9375rem;                                    /* 15  – knapper, kontroller */
  --fs-body:    clamp(1.0625rem, 1rem + .25vw, 1.1875rem);   /* 17–19 */
  --fs-lead:    clamp(1.25rem, 1.12rem + .55vw, 1.5rem);     /* 20–24 – ingress */
  --fs-h4:      clamp(1.125rem, 1.05rem + .3vw, 1.25rem);
  --fs-h3:      clamp(1.375rem, 1.2rem + .7vw, 1.75rem);
  --fs-h2:      clamp(1.875rem, 1.45rem + 1.9vw, 3rem);
  --fs-quote:   clamp(1.625rem, 1.25rem + 1.7vw, 2.625rem);
  --fs-display: clamp(2.5rem, 1.5rem + 4.6vw, 5.5rem);

  --lh-tight: 1.04;
  --lh-head:  1.14;
  --lh-body:  1.62;
  --lh-ui:    1.35;

  --tracking-label: .12em;
}

html {
  font-family: var(--font-text);
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

body {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  font-feature-settings: "kern", "liga";
  hanging-punctuation: first;
}

h1, h2, h3, h4,
.t-display, .t-h2, .t-h3, .t-h4 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 400;
  line-height: var(--lh-head);
  text-wrap: balance;
  margin: 0;
  color: var(--text);
}

.t-display { font-size: var(--fs-display); line-height: var(--lh-tight); font-weight: 340; letter-spacing: -.015em; }
.t-display em { font-style: italic; font-weight: 300; color: var(--accent-text); }
h2, .t-h2   { font-size: var(--fs-h2); font-weight: 380; letter-spacing: -.01em; }
h3, .t-h3   { font-size: var(--fs-h3); font-weight: 450; }
h4, .t-h4   { font-size: var(--fs-h4); font-weight: 560; font-family: var(--font-text); letter-spacing: 0; }

p { margin: 0; text-wrap: pretty; }

.t-lead {
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  line-height: 1.45;
  font-weight: 360;
  color: var(--text);
}

/* Liten versal-etikett: kapittelnummer, seksjonsmarkør, motivnavn */
.t-kicker {
  font-family: var(--font-text);
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: var(--lh-ui);
}

.t-meta    { font-size: var(--fs-small); color: var(--text-muted); line-height: var(--lh-ui); }
.t-caption { font-size: var(--fs-small); color: var(--text-muted); line-height: 1.5; }
.t-caption b, .t-meta b { color: var(--text); font-weight: 600; }

/* Redaksjonelt sitat */
.t-quote {
  font-family: var(--font-display);
  font-size: var(--fs-quote);
  font-style: italic;
  font-weight: 330;
  line-height: 1.22;
  letter-spacing: -.005em;
  text-wrap: balance;
}
.t-quote cite {
  display: block;
  margin-top: var(--space-4);
  font: normal 600 var(--fs-small)/1.4 var(--font-text);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Initial for kapittelstart – brukes én gang per kapittel */
.t-initial::first-letter {
  font-family: var(--font-display);
  float: left;
  font-size: 4.1em;
  line-height: .82;
  font-weight: 330;
  padding: .06em .09em 0 0;
  color: var(--accent);
}

a {
  color: var(--accent-text);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}
a:hover { text-decoration-color: currentColor; }

/* Kildehenvisning i løpende tekst: hevet nummer som lenker til kildeliste */
.cite-ref {
  font-size: .68em;
  vertical-align: super;
  line-height: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  padding-inline: .1em;
}

.num { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-s);
}
