/* ==========================================================================
   Base — design tokens, reset, typography
   Nasjonalmuseet Guide — Editorial Brutalist
   ========================================================================== */

:root {
  /* Paper — warm rough off-white */
  --paper:         #F1ECDF;
  --paper-soft:    #E5DEC9;
  --paper-warm:    #D9CFB4;

  /* Ink — true near-black */
  --ink:           #0A0A0A;
  --ink-deep:      #000000;
  --ink-soft:      #161616;
  --mute:          #4D4A44;
  --mute-soft:     #7E7A72;

  /* Lines — black hairlines + slabs */
  --line:          #0A0A0A;
  --line-strong:   #0A0A0A;
  --line-stone:    #B0AB9F;

  /* Accent — Scream orange (single hot accent) */
  --accent:        #E94A1F;
  --accent-deep:   #B53510;

  /* Brass alias — kept for legacy class refs but bound to accent for single-accent rule */
  --brass:         #E94A1F;
  --brass-deep:    #B53510;

  /* Type */
  --display: "Fraunces", "Times New Roman", serif;
  --body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:    "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --ff-display: var(--display); /* alias used by inline styles in 404.html */

  /* Sizes — pushed bigger for brutalist scale */
  --fs-d1: clamp(4rem, 13vw, 11rem);
  --fs-d2: clamp(3rem, 8vw, 6.5rem);
  --fs-d3: clamp(2rem, 4.4vw, 4rem);
  --fs-h1: clamp(2.5rem, 6vw, 5rem);
  --fs-h2: clamp(1.6rem, 3vw, 2.6rem);
  --fs-h3: clamp(1.25rem, 1.8vw, 1.6rem);
  --fs-lg: 1.125rem;
  --fs-md: 1rem;
  --fs-sm: 0.875rem;
  --fs-xs: 0.75rem;
  --fs-2xs: 0.6875rem;

  /* Spacing scale (8px base) */
  --s-1:  0.5rem;
  --s-2:  1rem;
  --s-3:  1.5rem;
  --s-4:  2rem;
  --s-5:  3rem;
  --s-6:  4.5rem;
  --s-7:  6rem;
  --s-8:  9rem;

  /* Layout */
  --container: 1440px;
  --container-narrow: 880px;
  --header-h: 64px;
  --notice-h: 32px;

  /* Brutalist rules */
  --rule-w-thin:  1px;
  --rule-w-med:   2px;
  --rule-w-thick: 6px;

  /* Motion — tighter, less floaty */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--body);
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "ss01", "cv11";
  font-variant-numeric: tabular-nums;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Subtle paper grain over everything for depth */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.045;
  mix-blend-mode: multiply;
  background-image:
    radial-gradient(circle at 25% 35%, #000 0.5px, transparent 0.6px),
    radial-gradient(circle at 75% 65%, #000 0.5px, transparent 0.6px);
  background-size: 3px 3px, 5px 5px;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease);
}

button {
  font: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  color: inherit;
}

ul, ol { list-style: none; }

/* Typography */
.t-eyebrow {
  font-family: var(--mono);
  font-size: var(--fs-2xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink);
}
.t-eyebrow::before {
  content: "● ";
  color: var(--accent);
  margin-right: 0.25em;
}

.t-display {
  font-family: var(--display);
  font-weight: 500;
  font-style: normal;
  letter-spacing: -0.035em;
  line-height: 0.86;
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 0;
  color: var(--ink);
}

.t-display em {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  color: var(--accent);
  font-weight: 600;
}

h1, h2, h3, h4, h5 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.0;
  color: var(--ink);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); font-weight: 600; letter-spacing: -0.04em; line-height: 0.92; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { max-width: 65ch; text-wrap: pretty; }
p + p { margin-top: var(--s-2); }

::selection { background: var(--accent); color: var(--paper); }

/* Container */
.wrap {
  width: 100%;
  max-width: var(--container);
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  margin: 0 auto;
}

.wrap--narrow { max-width: var(--container-narrow); }

/* Surfaces */
.surface-ink {
  background: var(--ink);
  color: var(--paper);
}
.surface-ink h1, .surface-ink h2, .surface-ink h3, .surface-ink h4 { color: var(--paper); }
.surface-ink .t-eyebrow { color: var(--paper); }
.surface-ink .t-eyebrow::before { color: var(--accent); }
.surface-ink .rule { background: var(--paper); }

.surface-soft { background: var(--paper-soft); }
.surface-warm { background: var(--paper-warm); }

/* Section spacing — asymmetric (more bottom than top) */
.section {
  padding: clamp(3.5rem, 7vw, 6rem) 0 clamp(4.5rem, 9vw, 8rem);
  position: relative;
}
.section--tight { padding: clamp(2rem, 4vw, 3.5rem) 0 clamp(2.5rem, 5vw, 4.5rem); }

/* Section divider — heavy ink slab between alternate surfaces */
.section + .section.surface-soft,
.section.surface-soft + .section,
.section.surface-ink + .section,
.section + .section.surface-ink {
  border-top: var(--rule-w-thick) solid var(--ink);
}

/* Decorative rule — thicker, ink black */
.rule {
  display: block;
  width: 88px;
  height: var(--rule-w-thick);
  background: var(--ink);
  margin: var(--s-3) 0;
  border: 0;
}

.rule--accent { background: var(--accent); height: var(--rule-w-thick); }
.rule--brass  { background: var(--accent); }

/* SR-only */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Focus — square outline for brutal feel */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Image placeholder + photo container */
.ph {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(135deg, var(--paper-soft) 25%, transparent 25%) -10px 0 / 20px 20px,
    linear-gradient(225deg, var(--paper-soft) 25%, transparent 25%) -10px 0 / 20px 20px,
    linear-gradient(315deg, var(--paper-soft) 25%, transparent 25%) 0 0 / 20px 20px,
    linear-gradient(45deg,  var(--paper-soft) 25%, var(--paper-warm) 25%) 0 0 / 20px 20px;
  position: relative;
  overflow: hidden;
}
.ph::after {
  content: attr(data-label);
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font: 700 0.7rem/1 var(--mono);
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--mute);
}
.ph > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
  aspect-ratio: auto;
}
.ph:has(> img) { background: var(--paper-soft); }
.ph:has(> img)::after { display: none; }

/* Mono utility */
.mono { font-family: var(--mono); }

/* Page-level brutalist counter for sections */
main { counter-reset: section-num; }
