/* Layout: two-column index grid. A narrow left rail carries section names and dates,
   the right column carries the work at a reading measure. Type-led, one family,
   boldness spent on the hero statement only. */
:root {
  --paper: #fcfcfb;
  --ink: #1b1c1f;
  --muted: #696c73;
  --rule: #e4e4e1;
  --wash: #f1f1ee;      /* image placeholders, gate field */
  --accent: #2c3e9e;    /* links and focus only */
  --font: "Schibsted Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.5rem;
  --step-hero: clamp(1.875rem, 1.2rem + 2.6vw, 3.25rem);

  --rail: 11rem;
  --measure: 40rem;
  --gap: clamp(1.5rem, 1rem + 2vw, 3rem);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141518; --ink: #ebebe8; --muted: #9a9ca3; --rule: #2a2c31;
    --wash: #1e2024; --accent: #9aa8f2; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141518; --ink: #ebebe8; --muted: #9a9ca3; --rule: #2a2c31;
  --wash: #1e2024; --accent: #9aa8f2; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
  font-feature-settings: "ss01" on;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px;
    text-underline-offset: 0.2em; text-decoration-color: var(--rule); transition: text-decoration-color .15s; }
a:hover { text-decoration-color: currentColor; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px;
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Theme switch: a cross-fade via the View Transitions API (see assets/theme.js), not
   per-property colour transitions — those interpolate through a muddy mid-tone. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*) { animation: none !important; } }

.wrap { max-width: 68rem; margin-inline: auto; }

/* Header */
.site-header {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: .5rem 1.5rem; padding-block: 1.75rem;
}
.site-header .name { font-weight: 600; text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.25rem; color: var(--muted); }
.site-header nav a { text-decoration: none; }
.site-header nav a:hover { color: var(--ink); }

/* Theme toggle */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; padding: 0; margin: 0;
  background: none; border: 0; appearance: none; -webkit-appearance: none; -moz-appearance: none;
  font: inherit; line-height: 1; color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun circle,
.theme-toggle .icon-moon path { fill: none; transition: fill .15s ease; }
.theme-toggle:hover .icon-sun circle,
.theme-toggle:hover .icon-moon path { fill: currentColor; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Rows: rail + content */
.row {
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 0 var(--gap); padding-block: clamp(2.5rem, 2rem + 3vw, 4.5rem);
  border-top: 1px solid var(--rule);
}
.row > .rail { color: var(--muted); font-size: var(--step-0); }
.row > .rail h2 { font: inherit; margin: 0; }
.row > .main { min-width: 0; }
@media (max-width: 720px) {
  .row { grid-template-columns: minmax(0, 1fr); row-gap: 1.25rem; }
}

/* Hero */
.hero { border-top: 0; padding-top: clamp(2rem, 1rem + 6vw, 6rem); }
.hero .statement {
  font-size: var(--step-hero); line-height: 1.12; letter-spacing: -0.022em;
  font-weight: 500; margin: 0; max-width: 20em; text-wrap: balance;
}
.hero .sub { margin: 1.5rem 0 0; color: var(--muted); font-size: var(--step-1); max-width: var(--measure); }

/* Work list */
.work { display: grid; gap: clamp(3rem, 2rem + 4vw, 5rem); }
.work-item a.cover { display: block; text-decoration: none; }
.work-item h3 { font-size: var(--step-2); line-height: 1.25; letter-spacing: -0.012em; font-weight: 500;
  margin: 1.25rem 0 .5rem; text-wrap: balance; max-width: 28em; }
.work-item h3 a { text-decoration: none; }
.work-item h3 a:hover { text-decoration: underline; text-decoration-color: currentColor; }
.work-item p { margin: 0; max-width: var(--measure); }
.work-item .meta { color: var(--muted); margin-top: .5rem; }
.work-item .result { margin-top: .75rem; font-variant-numeric: tabular-nums; }
.result strong { font-weight: 600; }

/* Image placeholders: swap for <img> once exported from Figma */
.ph {
  aspect-ratio: 16 / 10; width: 100%; max-width: 100%; background: var(--wash);
  border-radius: 6px; display: flex; align-items: flex-end; padding: 1rem 1.125rem;
  color: var(--muted); font-size: var(--step--1);
}
.ph.tall { aspect-ratio: 4 / 3; }
figure { margin: 2rem 0; }
figure img { border-radius: 6px; }
figcaption { color: var(--muted); font-size: var(--step--1); margin-top: .625rem; max-width: var(--measure); }

/* Experience */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.75rem; }
.timeline li { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: .25rem 1.5rem; }
.timeline .years { color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .role { font-weight: 500; }
.timeline p { margin: .25rem 0 0; color: var(--muted); max-width: var(--measure); }
@media (max-width: 480px) { .timeline li { grid-template-columns: minmax(0, 1fr); } }

.prose p { margin: 0 0 1rem; max-width: var(--measure); }
.prose p:last-child { margin-bottom: 0; }

.contact-line { font-size: var(--step-2); letter-spacing: -0.012em; margin: 1.75rem 0 0; }
.site-footer { border-top: 1px solid var(--rule); padding-block: 2rem 3rem; color: var(--muted);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; font-size: var(--step--1); }

/* Case study */
.cs-head { padding-top: clamp(2rem, 1rem + 4vw, 4.5rem); border-top: 0; }
.back { color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }
.cs-head h1 { font-size: var(--step-hero); line-height: 1.12; letter-spacing: -0.022em; font-weight: 500;
  margin: 0; max-width: 18em; text-wrap: balance; }
.cs-head .summary { font-size: var(--step-1); color: var(--muted); margin: 1.25rem 0 0; max-width: var(--measure); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 1rem 1.5rem; margin: 2.5rem 0 0; }
.facts dt { color: var(--muted); font-size: var(--step--1); }
.facts dd { margin: .125rem 0 0; }
.outcomes { list-style: none; padding: 0; margin: 2.5rem 0 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1.5rem; }
.outcomes li { border-top: 1px solid var(--ink); padding-top: .75rem; }
.outcomes .fig { display: block; font-size: var(--step-2); font-weight: 500; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; }
.outcomes .lab { color: var(--muted); font-size: var(--step--1); display: block; margin-top: .25rem; }

.article { max-width: var(--measure); }
.article h2 { font-size: var(--step-2); line-height: 1.25; letter-spacing: -0.012em; font-weight: 500;
  margin: 3.5rem 0 1rem; text-wrap: balance; }
.article h2:first-child { margin-top: 0; }
.article h3 { font-size: var(--step-1); font-weight: 600; margin: 2rem 0 .5rem; }
.article p { margin: 0 0 1rem; }
.article ul, .article ol { padding-left: 1.25rem; margin: 0 0 1rem; }
.article li { margin-bottom: .5rem; }
.article li::marker { color: var(--muted); }
.article blockquote { margin: 1.5rem 0; padding-left: 1rem; border-left: 2px solid var(--rule); color: var(--muted); }
.article figure { margin: 2.25rem 0; }
.wide { margin-inline: 0; }
.table-wrap { overflow-x: auto; margin: 0 0 1.5rem; }
.article table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.article th, .article td { text-align: left; padding: .6rem .75rem .6rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.article th { color: var(--muted); font-weight: 400; font-size: var(--step--1); }

.next { display: block; text-decoration: none; }
.next .lab { color: var(--muted); display: block; }
.next .t { font-size: var(--step-2); letter-spacing: -0.012em; font-weight: 500; text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: .2em; text-decoration-color: var(--rule); }
.next:hover .t { text-decoration-color: currentColor; }

/* Password gate */
.gate[hidden] { display: none !important; }
.gate { min-height: 70vh; display: grid; place-items: center; padding-block: 4rem; }
.gate form { width: 100%; max-width: 24rem; display: grid; gap: .75rem; }
.gate h1 { font-size: var(--step-2); font-weight: 500; letter-spacing: -0.012em; margin: 0; line-height: 1.25; }
.gate p { margin: 0 0 .5rem; color: var(--muted); }
.gate label { font-size: var(--step--1); color: var(--muted); }
.gate .field { display: flex; gap: .5rem; }
.gate input {
  flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--wash);
  border: 1px solid var(--rule); border-radius: 6px; padding: .7rem .85rem;
}
.gate button {
  font: inherit; font-weight: 500; color: var(--paper); background: var(--ink);
  border: 0; border-radius: 6px; padding: .7rem 1.1rem; cursor: pointer;
}
.gate .err { color: var(--ink); font-size: var(--step--1); min-height: 1.4em; margin: 0; }
.locked [data-protected] { display: none; }
