/* ─────────────────────────────────────────────────────────────
   Glenn Svendsen: quiet paper.
   Ink on warm paper, one rose accent, hand-drawn strokes.
   Light/dark via color-scheme + light-dark(); [data-theme] overrides the system.
   ───────────────────────────────────────────────────────────── */

/* Fonts, self-hosted (SIL Open Font License; Latin subset, which covers æ ø å). */
@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/instrument-serif.woff2) format('woff2'); }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/instrument-serif-italic.woff2) format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/instrument-sans.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-400.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-500.woff2) format('woff2'); }

@view-transition { navigation: auto; }

@property --rx { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@property --ry { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@property --bleed { syntax: '<percentage>'; inherits: false; initial-value: 0%; }

:root {
  color-scheme: light dark;

  --snow:    light-dark(oklch(1 0 0),          oklch(0.93 0.012 240));
  --ice:     light-dark(oklch(0.93 0.03 225),  oklch(0.62 0.035 230 / 0.5));

  --paper:   light-dark(oklch(0.976 0.008 85), oklch(0.205 0.012 260));
  --paper-2: light-dark(oklch(0.952 0.013 82), oklch(0.245 0.014 260));
  --ink:     light-dark(oklch(0.24 0.012 60),  oklch(0.93 0.012 85));
  --muted:   light-dark(oklch(0.46 0.012 60),  oklch(0.76 0.012 85));
  --faint:   light-dark(oklch(0.6 0.012 60),   oklch(0.6 0.014 85));
  --line:    light-dark(oklch(0.24 0.012 60 / 0.13), oklch(0.93 0.012 85 / 0.13));
  --accent:  light-dark(oklch(0.56 0.15 6),    oklch(0.8 0.1 6));
  --shadow:  light-dark(oklch(0.3 0.03 60 / 0.16), oklch(0 0 0 / 0.45));

  --ff-serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --ff-sans: 'Instrument Sans', system-ui, sans-serif;
  --ff-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --wrap: 72rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --space: clamp(5rem, 12vw, 9rem);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark']  { color-scheme: dark; }

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

html {
  background: var(--paper);
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: var(--ff-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* Paper: fibres lit from the top left (feTurbulence + feDiffuseLighting), one cached tile.
   A faint warm light drifts down the sheet as you scroll. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6 0.9' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeDiffuseLighting lighting-color='%23fff' surfaceScale='1.6' diffuseConstant='1.1'%3E%3CfeDistantLight azimuth='225' elevation='58'/%3E%3C/feDiffuseLighting%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  opacity: 0.32;
}
:root { --paper-blend: multiply; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) body::before { mix-blend-mode: soft-light; opacity: 0.22; } }
:root[data-theme='dark'] body::before { mix-blend-mode: soft-light; opacity: 0.22; }

body::after {
  content: '';
  position: fixed;
  inset: -20vh -10vw;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(60vmax 45vmax at 18% 0%, light-dark(oklch(0.99 0.03 85 / 0.9), oklch(0.32 0.03 260 / 0.55)), transparent 70%);
}
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    body::after { animation: light-drift linear both; animation-timeline: scroll(root); }
  }
}
@keyframes light-drift { to { translate: 40vw 90vh; } }

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
/* Snappy on touch: no double-tap zoom delay, and a small press so taps feel registered. */
a, button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (prefers-reduced-motion: no-preference) {
  button:active, .card:active, .link:active { scale: 0.97; }
}
::selection { background: color-mix(in oklch, var(--accent) 28%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.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;
}
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 200;
  padding: 0.6rem 1rem; background: var(--ink); color: var(--paper); border-radius: 6px;
}
.skip-link:focus { top: 1rem; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.mono { font-family: var(--ff-mono); font-size: 0.74rem; letter-spacing: 0.06em; }
.section { padding-block: var(--space); position: relative; }

.title {
  font-family: var(--ff-serif);
  font-weight: 400;
  font-size: clamp(2.6rem, 6.4vw, 4.6rem);
  line-height: 1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.title em, .hero-lede em { font-style: italic; color: var(--accent); }
.kicker { color: var(--accent); text-transform: uppercase; margin-bottom: 1rem; }
.intro { color: var(--muted); max-width: 38rem; text-wrap: pretty; margin-top: 1.2rem; font-size: 1.1rem; }
p { text-wrap: pretty; }

/* Scroll progress hairline */
.progress {
  position: fixed; inset: 0 0 auto; height: 2px; z-index: 60;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
  display: none;
}
@supports (animation-timeline: scroll()) {
  .progress { display: block; animation: grow linear both; animation-timeline: scroll(root); }
}
@keyframes grow { to { transform: scaleX(1); } }

/* ── HEADER ───────────────────────────────── */
.top {
  position: fixed; inset: 0 0 auto; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem var(--gutter);
  transition: background-color 0.4s, box-shadow 0.4s;
}
.top.is-scrolled {
  background: color-mix(in oklch, var(--paper) 82%, transparent);
  backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 1px 0 var(--line);
}
.brand { display: block; color: var(--ink); view-transition-name: brand; }
.brand-sig { width: 7.5rem; height: auto; aspect-ratio: 272.2 / 53.6; }
/* The wordmark writes itself in once the big hero signature has scrolled away. */
.js .brand-sig { opacity: 0; translate: 0 6px; transition: opacity 0.5s var(--ease), translate 0.5s var(--ease); }
.js .top.is-scrolled .brand-sig { opacity: 1; translate: 0 0; }
@supports (animation-timeline: view()) {
  body { timeline-scope: --hero-sig; }
  .signature--hero { view-timeline: --hero-sig block; }
  .js .brand-sig, .js .top.is-scrolled .brand-sig {
    opacity: 1; translate: none; transition: none;
    animation: brand-in linear both;
    animation-timeline: --hero-sig;
    animation-range: exit 30% exit 100%;
  }
}
@keyframes brand-in { from { opacity: 0; translate: 0 8px; scale: 0.92; } to { opacity: 1; translate: 0 0; scale: 1; } }

.top-links { display: flex; align-items: center; gap: clamp(0.9rem, 2.5vw, 2rem); }
.top-links a {
  font-size: 0.92rem; text-decoration: none; color: var(--muted); white-space: nowrap;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: color 0.25s, background-size 0.35s var(--ease);
}
.top-links a:hover { color: var(--ink); background-size: 100% 1px; }
@media (max-width: 560px) { .top-links a:not([href='#hello']) { display: none; } }

/* EN / NO: the active language is circled by hand, like a word ringed in a notebook. Switching
   erases the old ring quickly and draws a new one around the other language. */
.lang-switch { display: inline-flex; align-items: center; gap: 0.35rem; margin-inline: 0.3rem; font-family: var(--ff-mono); font-size: 0.72rem; letter-spacing: 0.08em; }
.lang-switch[hidden] { display: none; }
.lang-switch button > span { position: relative; display: inline-block; letter-spacing: 0.04em; }
.lang-switch button { position: relative; padding: 0.4rem 0.65rem; color: var(--faint); transition: color 0.3s; }
.lang-switch button[aria-pressed='true'] { color: var(--ink); }
.lang-switch button[aria-pressed='false']:hover { color: var(--muted); }
.lang-slash { font-family: var(--ff-serif); font-style: italic; font-size: 1rem; color: var(--faint); rotate: 8deg; }
.lang-ring {
  position: absolute; top: -0.5em; left: -0.75em; width: calc(100% + 1.5em); height: calc(100% + 1em); max-width: none;
  overflow: visible; pointer-events: none;
  fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round;
  filter: url(#sketch-rough);
}
.lang-ring path { vector-effect: non-scaling-stroke; stroke-dasharray: 1 2; stroke-dashoffset: 1.01; transition: stroke-dashoffset 0.22s ease-in; }
.lang-switch button[aria-pressed='true'] .lang-ring path { stroke-dashoffset: 0; transition: stroke-dashoffset 0.6s cubic-bezier(0.5, 0, 0.25, 1) 0.15s; }
/* A faint pencil preview of the ring on hover. */
.lang-switch button[aria-pressed='false']:hover .lang-ring path { stroke-dashoffset: 0.55; transition-duration: 0.35s; }
.lang-switch button[aria-pressed='false']:hover .lang-ring { stroke: var(--faint); }

.theme-toggle { width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border-radius: 50%; color: var(--ink); }
.theme-toggle:hover { background: var(--line); }
.theme-toggle svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.theme-toggle :is(.tt-sun, .tt-moon) { transform-origin: 12px 12px; transition: opacity 0.4s, rotate 0.5s var(--ease), scale 0.5s var(--ease); }
.theme-toggle .tt-moon { opacity: 0; rotate: -60deg; scale: 0.6; }
:root.is-dark .theme-toggle .tt-sun { opacity: 0; rotate: 60deg; scale: 0.6; }
:root.is-dark .theme-toggle .tt-moon { opacity: 1; rotate: 0deg; scale: 1; }

/* Theme switch: the new page is revealed by a circle of ink spreading from the toggle. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root.theme-wipe::view-transition-new(root) { animation: ink-wipe 0.55s var(--ease); }
@keyframes ink-wipe { from { clip-path: circle(0 at var(--wx, 100%) var(--wy, 0%)); } to { clip-path: circle(var(--wr, 150%) at var(--wx, 100%) var(--wy, 0%)); } }
/* Page to page (home ↔ /work/): a quiet cross-fade, the brand morphs. */
:root:not(.theme-wipe)::view-transition-old(root) { animation: fade-out 0.2s ease both; }
:root:not(.theme-wipe)::view-transition-new(root) { animation: fade-in 0.3s 0.05s ease both; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; translate: 0 10px; } }

/* ── HERO ─────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding-top: clamp(6rem, 16vh, 10rem);
  isolation: isolate;
}
.hero-text { position: relative; z-index: 2; align-self: center; }
/* Phones are tall: sit the words just above the skyline instead of floating mid-screen. */
@media (max-width: 600px) {
  .hero { min-height: 92svh; }
  .hero-text { align-self: end; padding-bottom: 0.5rem; }
}

.signature { color: var(--ink); width: 100%; height: auto; overflow: visible; }
.signature--hero { width: min(100%, 46rem); margin-left: -1%; }
/* Writing: the outline is masked by the pen strokes (pathLength="1"), drawn one after another.
   main.js applies the mask only while writing, so without JS the full signature shows. */
.signature .pen path { stroke-dasharray: 1 2; stroke-dashoffset: 1.01; }
.js .signature--hero:not(.is-writing):not(.is-written) .sig-ink { opacity: 0; }
.js .signature.is-writing .pen path {
  animation: write var(--dur, 0.3s) var(--delay, 0s) cubic-bezier(0.45, 0.05, 0.4, 1) both;
}
@keyframes write { from { stroke-dashoffset: 1.01; } to { stroke-dashoffset: 0; } }

.hero-lede {
  font-family: var(--ff-serif);
  font-size: clamp(1.9rem, 4.6vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
}
.js .hero-lede, .js .hero-meta { opacity: 0; translate: 0 12px; transition: opacity 0.6s var(--ease), translate 0.6s var(--ease); }
.js .hero.is-in .hero-lede { opacity: 1; translate: 0 0; }
.js .hero.is-in .hero-meta { opacity: 1; translate: 0 0; transition-delay: 0.1s; }
.hero-meta { margin-top: 1.4rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; text-transform: uppercase; }
.hero-clock { display: inline-flex; gap: 0.6rem; }
.hero-clock::before { content: ''; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--accent); align-self: center; animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.35; } }

/* The land: hand-drawn Oslo (generated by assets-src/make_skyline.py) */
/* Height follows the drawing's 1200:260 shape (21.7vw), so on desktop widths the whole panorama shows,
   from Holmenkollen to Ekeberg; narrower screens crop to the middle. */
.land { position: relative; z-index: 1; height: clamp(13rem, 21.7vw, 24rem); margin-top: 1rem; }
.land svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.fjord { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
.fjord .ink { filter: url(#sketch-fine); }
.fjord .ink path { stroke-width: 1.5; }
.fjord .ink .thin { stroke-width: 1; stroke-opacity: 0.75; }
.fjord .ink .hand { stroke-width: 1.2; stroke-opacity: 0.95; }
.fjord .ink .hand--hour { stroke-width: 1.5; }
.fjord .ink .trees { stroke-opacity: 0.6; fill: var(--paper); }
.fjord .ink .trees--near { stroke-opacity: 0.45; }
.fjord .ink .trees.pine { stroke-opacity: 1; stroke-width: 1.7; }   /* the nearest thing: darkest line */
.fjord .ink .hatch { stroke-opacity: 0.3; }
.fjord .ink .people { stroke-opacity: 0.9; stroke-width: 0.7; }
.fjord .fill { fill: var(--paper); stroke: none; }
.fjord .accent { stroke: var(--accent); }
.layer--far path:not(.fill) { stroke-opacity: 0.7; }
/* Atmosphere: the further back, the fainter and finer the line. */
.fjord .layer--back.ink path:not(.fill) { stroke-opacity: 0.32; stroke-width: 1.1; }
.fjord .layer--far.ink path:not(.fill):not(.thin) { stroke-width: 1.25; }

/* Draw-in on first load: far ridge first, then the city, then the water (main.js sets
   pathLength="1" and .is-drawing). Fills are paper, so they need no drawing. */
.js .land:not(.is-drawn) .ink path:not(.fill) { stroke-dasharray: 1 2; stroke-dashoffset: 1.01; }
.js .land.is-drawing .ink path:not(.fill) { animation: draw 1.2s var(--d, 0s) cubic-bezier(0.45, 0.05, 0.3, 1) forwards; }
.js .land .layer--back { --d: 0s; }
.js .land .layer--far  { --d: 0.1s; }
.js .land .layer--mid  { --d: 0.3s; }
.js .land .layer--near { --d: 0.7s; }
.js .land .layer--mid path:nth-child(3n + 2)  { --d: 0.45s; }
.js .land .layer--mid path:nth-child(3n)      { --d: 0.6s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.js .land:not(.is-drawn) :is(.life, .sky, .flagpole, .lights, .beacon-layer) { opacity: 0; }
.land :is(.life, .sky, .flagpole, .beacon-layer) { transition: opacity 0.9s ease 0.2s; }
/* The red aviation light on the Tryvann tower: a slow glowing pulse after dusk, a dim dot by day. */
.beacon, .beacon-halo { fill: oklch(0.62 0.24 27); stroke: none; }
.beacon { opacity: 0.3; filter: drop-shadow(0 0 1.5px oklch(0.62 0.24 27 / 0.8)) drop-shadow(0 0 4px oklch(0.62 0.24 27 / 0.45)); }
.beacon-halo { opacity: 0; filter: blur(1.6px); transform-box: fill-box; transform-origin: 50% 50%; }
.land:is([data-sky='dusk'], [data-sky='night']) .beacon { opacity: 0.85; animation: beacon 2.6s ease-in-out infinite; }
.land:is([data-sky='dusk'], [data-sky='night']) .beacon-halo { animation: beacon-halo 2.6s ease-out infinite; }
@keyframes beacon { 0%, 100% { opacity: 0.25; } 40% { opacity: 0.85; } }
@keyframes beacon-halo { 0%, 100% { opacity: 0; scale: 0.5; } 40% { opacity: 0.3; scale: 1.1; } 80% { opacity: 0; scale: 1.5; } }
@media (prefers-reduced-motion: reduce) { .land:is([data-sky='dusk'], [data-sky='night']) .beacon { opacity: 0.85; } }
/* The flag on City Hall: the one place with real colours (Norway's), drawn small with an ink edge. */
/* Night lights: windows glow warm after dark (data-lights from main.js; "late" keeps only l2 on). */
.land { --glow: light-dark(oklch(0.8 0.13 80), oklch(0.86 0.13 85)); }
.lights path, .ferry-lit { fill: var(--glow); stroke: none; opacity: 0; transition: opacity 1.4s ease; }
.lights-reflect path { fill: none; stroke: var(--glow); stroke-width: 1.6; stroke-linecap: round; }
/* light-dark() only takes colours, so the strength is a custom property that dark mode raises. */
.land { --lit: 0.75; } .is-dark .land { --lit: 0.92; }
.land[data-lights='on'] .lights :is(.l1, .l2), .land[data-lights='late'] .lights .l2,
.land[data-lights]:not([data-lights='dusk']) .ferry-lit { opacity: var(--lit); }
.land[data-lights='dusk'] .lights .l2, .land[data-lights='dusk'] .ferry-lit { opacity: calc(var(--lit) * 0.55); }
.land[data-lights]:not([data-lights='dusk']) .lights-reflect path { opacity: calc(var(--lit) * 0.5); }
/* A soft halo around the lit windows: one blur for the whole group, stronger on dark paper. */
.lights:not(.lights-reflect) { filter: drop-shadow(0 0 1.6px var(--glow)) drop-shadow(0 0 4px color-mix(in oklch, var(--glow) 55%, transparent)); }
.is-dark .lights:not(.lights-reflect) { filter: drop-shadow(0 0 1.8px var(--glow)) drop-shadow(0 0 6px color-mix(in oklch, var(--glow) 70%, transparent)); }
.life .ferry-lit { filter: drop-shadow(0 0 2px var(--glow)); }
.flagpole path { stroke: none; }

/* Days of the year (data-day from main.js; debug on localhost: ?day=17mai|jul|nyttar).
   17 May: flags on the rooftops and a bigger one on City Hall. Christmas: a tree on Rådhusplassen.
   New Year's Eve: fireworks over the fjord. Snowy days: a ski jumper now and then. */
.land .day { display: none; }
.land[data-day='17mai'] .day-17mai, .land[data-day='jul'] .day-jul, .land[data-day='nyttar'] .day-nyttar { display: inline; }
.land[data-day='17mai'] .flagpole { scale: 1.5; transform-origin: 568px 77px; }
.day-17mai .pole { stroke: var(--ink); stroke-width: 0.6; stroke-opacity: 0.8; }
.day-jul .tree { fill: var(--paper); stroke: var(--ink); stroke-width: 1.1; }
.day-jul .thin { stroke: var(--ink); stroke-width: 0.6; stroke-opacity: 0.6; }
.day-jul :is(.bulbs, .star) { fill: var(--glow); stroke: none; }
.day-jul .star { stroke: var(--ink); stroke-width: 0.4; }
.day-nyttar .burst path { stroke: var(--accent); stroke-width: 1.2; }
.day-nyttar .b2 path, .day-nyttar .b4 path { stroke: var(--glow); }
.jumper-layer { display: none; }
.land[data-cover='light'] .jumper-layer, .land[data-cover='deep'] .jumper-layer { display: inline; }
.jumper path { stroke: var(--ink); stroke-width: 0.9; }
.jumper { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .day-jul .bulbs { animation: twinkle 1.6s steps(2) infinite; filter: drop-shadow(0 0 1.5px var(--glow)); }
  .day-nyttar .burst { animation: burst 3.4s ease-out infinite; }
  .day-nyttar .b2 { animation-delay: -1.1s; } .day-nyttar .b3 { animation-delay: -2.3s; }
  .day-nyttar .b4 { animation-delay: -0.6s; animation-duration: 2.9s; } .day-nyttar .b5 { animation-delay: -1.8s; animation-duration: 3.8s; }
  .jumper { animation: jump 17s linear infinite 4s; }
  .land.is-paused :is(.burst, .jumper, .bulbs) { animation-play-state: paused; }
}
@keyframes burst { 0% { scale: 0.15; opacity: 0; } 8% { opacity: 1; } 45% { scale: 1; opacity: 0.85; } 75%, 100% { scale: 1.08; opacity: 0; } }
@keyframes jump {
  0% { opacity: 0; translate: 0 0; } 0.5% { opacity: 1; }
  3% { translate: calc(var(--jx) * 0.35) calc(var(--jy) * 0.12); }
  6% { translate: calc(var(--jx) * 0.7) calc(var(--jy) * 0.5); }
  8.5% { translate: var(--jx) var(--jy); opacity: 1; }
  11%, 100% { translate: calc(var(--jx) + 14px) calc(var(--jy) + 1px); opacity: 0; }
}
.land .nf-red { fill: oklch(0.52 0.19 25); stroke: none; }
.land .nf-white { fill: oklch(0.98 0.005 85); stroke: none; }
.land .nf-blue { fill: oklch(0.36 0.13 265); stroke: none; }
.flagpole .nf-edge { fill: none; stroke: var(--ink); stroke-width: 0.5; stroke-opacity: 0.6; }

/* Parallax: as the hero scrolls away, the sky sinks fastest, the ridge slower, the city a little. */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .land .layer { animation: parallax linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }
    .land .layer--sky  { --py: 90px; }
    .land .layer--back { --py: 68px; }
    .land .layer--far  { --py: 52px; }
    .land .layer--mid  { --py: 22px; }
    .land .layer--near { --py: 0px; }
  }
}
@keyframes parallax { to { translate: 0 var(--py, 0px); } }

/* Life on the fjord */
.life path { stroke-width: 1.2; }
.life .ferry > g path { fill: var(--paper); }
@media (prefers-reduced-motion: no-preference) {
  .ferry { animation: sail 110s linear infinite; }
  .sailboat { animation: bob 5s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
  .gulls { animation: glide 46s linear infinite; }
  .gulls path { animation: flap 1.1s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
  .gulls path + path { animation-delay: -0.4s; }
  .flag { animation: wave 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 0% 50%; }
}
.flag { stroke-width: 1.4; }
@keyframes sail  { from { translate: -80px 0; } to { translate: 1280px 0; } }
@keyframes bob   { 0%, 100% { rotate: -2.5deg; translate: 0 0; } 50% { rotate: 2.5deg; translate: 0 1.5px; } }
@keyframes glide { from { translate: -500px 10px; } 50% { translate: 300px -12px; } to { translate: 1100px 6px; } }
@keyframes flap  { 50% { scale: 1 0.55; } }
@keyframes wave  { 0%, 100% { scale: 1 1; } 50% { scale: 0.8 1.15; } }

.sky { filter: url(#sketch-fine); stroke-width: 1.3; }
.sky > g { opacity: 0; transition: opacity 1.2s; }
.sun circle { fill: color-mix(in oklch, var(--accent) 12%, transparent); stroke: var(--accent); }
.sun .thin { stroke: var(--accent); stroke-width: 1; animation: spin 60s linear infinite; transform-box: fill-box; transform-origin: 50% 50%; }
.moon .lit { fill: color-mix(in oklch, var(--glow) 38%, transparent); }
.moon .earth { fill: none; stroke-width: 0.9; stroke-opacity: 0.4; stroke-dasharray: 1.5 2.5; }   /* the dark side, faintly */
/* A soft halo around the moon (one tight, one wide), stronger on dark paper. */
.moon { filter: drop-shadow(0 0 2px var(--glow)) drop-shadow(0 0 9px color-mix(in oklch, var(--glow) 65%, transparent)); }
:root.is-dark .moon { filter: drop-shadow(0 0 3px var(--glow)) drop-shadow(0 0 14px color-mix(in oklch, var(--glow) 85%, transparent)); }
.stars path { stroke-width: 1; animation: twinkle 3.2s ease-in-out infinite; }
.stars path:nth-child(3n) { animation-delay: -1.1s; }
.stars path:nth-child(3n + 1) { animation-delay: -2.2s; animation-duration: 4.1s; }
@keyframes twinkle { 50% { opacity: 0.25; } }
@keyframes spin { to { rotate: 360deg; } }
.land[data-sky='day'] .sun,
.land[data-sky='dusk'] .sun { opacity: 1; }
.land[data-sky='night'] .stars { opacity: 1; }
/* The moon shows whenever it is really above the horizon (pale by day); main.js sets data-moon. */
.land[data-moon] .moon { opacity: 0.55; }
.land[data-moon][data-sky='night'] .moon { opacity: 1; }
.land[data-sky='dusk'] .stars { opacity: 0.45; }
.glint { stroke: var(--accent); stroke-width: 1; opacity: 0; transition: opacity 1.2s; }
.land[data-sky] .glint { opacity: 0.7; }
.land[data-noglint] .glint { opacity: 0; }

/* Aurora: watercolour bands, only on winter nights. */
.aurora { opacity: 0; transition: opacity 2s; mix-blend-mode: multiply; }
/* Golden hour: a warm haze low over the horizon around the sun, at sunset and sunrise, in clear-ish
   weather (data-glow from main.js). Same blending as the aurora: tints paper, lights up night paper. */
.afterglow { opacity: 0; transition: opacity 3s; mix-blend-mode: multiply; overflow: hidden !important; }   /* stays inside the skyline */
.land[data-glow] .afterglow { opacity: 0.9; }
:root.is-dark .land[data-glow] .afterglow { opacity: 0.42; mix-blend-mode: screen; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .aurora { mix-blend-mode: screen; } }
:root[data-theme='dark'] .aurora { mix-blend-mode: screen; }
.land[data-aurora] .aurora { opacity: 0.55; }
:root.is-dark .land[data-aurora] .aurora { opacity: 0.8; }
.ab { animation: aurora 14s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 50%; }
.ab2 { animation-duration: 19s; animation-delay: -6s; }
.ab3 { animation-duration: 23s; animation-delay: -11s; }
@keyframes aurora {
  0%   { translate: -3% 0; scale: 1 0.8; opacity: 0.55; }
  50%  { translate: 2% -4%; scale: 1.05 1.25; opacity: 1; }
  100% { translate: 4% 2%; scale: 0.96 0.9; opacity: 0.7; }
}

/* Weather and seasons over the skyline (main.js sets data-wx, data-clouds, data-intensity,
   data-cover and data-ice on .land from the current weather in Oslo). Snow and ice sit in the
   `.cover` groups so they parallax with what they lie on; falling weather is in `.wx-front`. */
.js .land:not(.is-drawn) :is(.cover, .wx-clouds) { opacity: 0; }
.land :is(.cover, .wx-clouds) { transition: opacity 1.2s ease 0.4s; }
.fjord .snow { fill: var(--snow); stroke: var(--ink); stroke-width: 0.5; stroke-opacity: 0.3; opacity: 0; transition: opacity 1.6s; }
.land[data-cover='light'] .snow-light,
.land[data-cover='deep'] :is(.snow-light, .snow-deep) { opacity: 1; }
.fjord .ice { fill: var(--ice); stroke: var(--ink); stroke-width: 0.6; stroke-opacity: 0.35; opacity: 0; transition: opacity 2s; }
.fjord .ice-line { fill: none; stroke: var(--ink); stroke-width: 0.8; stroke-opacity: 0.35; opacity: 0; transition: opacity 2s; }
.fjord .skate { stroke-dasharray: 5 4; stroke-opacity: 0.25; }
.land[data-ice='1'] .ice-1,
.land[data-ice='2'] :is(.ice-1, .ice-2) { opacity: 1; }
.land[data-ice='2'] .sailboat { opacity: 0; }
.sailboat { transition: opacity 1.5s; }

.wx-clouds .cloud { opacity: 0; transition: opacity 2.4s; }
.land[data-clouds='1'] .c2,
.land[data-clouds='2'] :is(.c1, .c3),
.land[data-clouds='3'] .cloud { opacity: 1; }
.cloud path { fill: var(--paper); stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
.cloud path.thin { fill: none; stroke-width: 0.9; stroke-opacity: 0.5; }
.cloud-drift { animation: drift 70s ease-in-out infinite alternate; }
.c1 .cloud-drift { animation-delay: -25s; }
.c3 .cloud-drift { animation-delay: -50s; animation-duration: 90s; }
@keyframes drift { from { translate: -36px 0; } to { translate: 36px 0; } }
/* Heavy cloud dims the sun and moon; rain, snow and thunder hide them; fog leaves a pale, rayless disc. */
.land[data-clouds='3'] .sky :is(.sun, .moon) { opacity: 0.18; }
.land:is([data-wx='rain'], [data-wx='snow'], [data-wx='storm']) .sky :is(.sun, .moon),
.land:is([data-wx='rain'], [data-wx='snow'], [data-wx='storm']) .glint { opacity: 0; }
.land[data-wx='fog'] .sky :is(.sun, .moon) { opacity: 0.4; }
.land[data-wx='fog'] .sun .thin { opacity: 0; }
.land[data-wx='fog'] .glint { opacity: 0.2; }
.sun .thin { transition: opacity 1.2s; }
.land[data-clouds='3'] .sky .stars,
.land[data-wx]:not([data-wx='clear']):not([data-wx='cloud']) .sky .stars { opacity: 0; }

.wx-front > * { opacity: 0; transition: opacity 1.5s; }
.land[data-wx='rain'] .wx-rain,
.land[data-wx='storm'] .wx-rain,
.land[data-wx='snow'] .wx-snow,
.land[data-wx='fog'] .wx-fog { opacity: 1; }
.wx-rain path { fill: none; stroke: var(--muted); stroke-width: 1; stroke-linecap: round; stroke-opacity: 0.55; animation: fall var(--t, 1s) linear var(--d, 0s) infinite; }
.wx-snow circle { fill: var(--snow); stroke: var(--faint); stroke-width: 0.5; animation: flake var(--t, 9s) linear var(--d, 0s) infinite; }
.land[data-intensity='light'] :is(.wx-rain path, .wx-snow circle):nth-child(2n) { display: none; }
.land:not([data-intensity='heavy']) :is(.wx-rain path, .wx-snow circle):nth-child(5n) { display: none; }
@keyframes fall { from { translate: 0 -30px; } to { translate: -22px 250px; } }
@keyframes flake {
  0%   { translate: 0 -20px; }
  25%  { translate: var(--s, 10px) 50px; }
  50%  { translate: 0 120px; }
  75%  { translate: calc(var(--s, 10px) * -1) 190px; }
  100% { translate: 0 262px; }
}
.wx-fog { filter: blur(5px); }
.wx-fog path { fill: none; stroke: var(--paper); stroke-width: 18; stroke-linecap: round; opacity: 0.85; animation: fog 14s ease-in-out var(--d, 0s) infinite alternate; }
@keyframes fog { from { opacity: 0.55; translate: -20px 0; } to { opacity: 0.9; translate: 20px 0; } }
.bolt { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.land[data-wx='storm'] .wx-front > .bolt { animation: bolt 11s linear infinite; }
/* One soft double flash every 11 s (well under the 3-flashes-a-second limit). */
@keyframes bolt { 0%, 92% { opacity: 0; } 93% { opacity: 1; } 94% { opacity: 0; } 95.5% { opacity: 0.8; } 97%, 100% { opacity: 0; } }
/* Off-screen, everything on the skyline holds still. */
.land.is-paused :is(.wx-front *, .cloud-drift, .ferry, .gulls, .gulls path, .sailboat, .flag, .ab, .stars path, .smoke, .beacon, .beacon-halo) { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .wx-rain, .wx-snow, .bolt { display: none; }
}

/* ── ABOUT ────────────────────────────────── */
.about { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: clamp(2rem, 7vw, 6rem); align-items: center; }
.about-text p { color: var(--muted); margin-top: 1.2rem; max-width: 36rem; font-size: 1.12rem; }
.about-text p:first-of-type { margin-top: 1.6rem; }
/* The portrait is a print taped to the page; once developed, a hand-drawn speech bubble says hi. It "develops" from a washed-out, blurry proof to full
   colour as it scrolls into view, then straightens a little on hover. */
.portrait { position: relative; max-width: 21rem; }
.print {
  position: relative;
  padding: 0.7rem 0.7rem 0.4rem;
  background: oklch(0.975 0.01 85);
  border-radius: 3px;
  box-shadow: 0 1px 2px var(--shadow), 0 22px 40px -22px var(--shadow);
  rotate: -2deg;
  transition: rotate 0.7s var(--ease), translate 0.7s var(--ease);
}
.portrait:hover .print { rotate: 0.4deg; translate: 0 -4px; }
.print-photo { position: relative; overflow: hidden; border-radius: 1px; background: oklch(0.9 0.01 85); }
.print-photo img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 40%; }
.print-caption {
  font-family: var(--ff-serif); font-style: italic; font-size: 1.45rem; line-height: 1;
  color: oklch(0.3 0.012 60); text-align: center; padding: 0.7rem 0 0.55rem;
}
.tape {
  position: absolute; z-index: 2; width: 5.2rem; height: 1.6rem;
  background: color-mix(in oklch, var(--accent) 28%, oklch(0.96 0.02 85) 72%); opacity: 0.8;
  box-shadow: 0 1px 2px var(--shadow);
  clip-path: polygon(0 8%, 4% 0, 8% 10%, 12% 0, 100% 0, 96% 12%, 100% 25%, 96% 38%, 100% 50%, 96% 62%, 100% 75%, 96% 88%, 100% 100%, 8% 100%, 4% 92%, 0 100%, 3% 80%, 0 60%, 3% 40%, 0 20%);
}
.tape--a { top: -0.55rem; left: 1.2rem; rotate: -9deg; }
.tape--b { top: -0.4rem; right: 0.6rem; rotate: 7deg; width: 4.4rem; }
.js .print-photo img {
  filter: grayscale(1) sepia(0.45) brightness(1.3) contrast(0.6) blur(5px);
  transition: filter 1.6s cubic-bezier(0.3, 0.1, 0.2, 1) 0.1s;
}
.js .portrait.is-developed .print-photo img { filter: none; }
.bubble { position: absolute; right: 3%; top: 9%; width: 36%; aspect-ratio: 90 / 64; transform-origin: 28% 100%; pointer-events: none; }
.bubble svg { width: 100%; height: 100%; overflow: visible; fill: oklch(0.99 0.008 85); stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 2px 3px oklch(0 0 0 / 0.18)); }
.bubble-line { stroke-dasharray: 1 2; stroke-dashoffset: 1.01; fill-opacity: 0; transition: stroke-dashoffset 0.6s var(--ease) 1.9s, fill-opacity 0.4s ease 2.4s; }
.portrait.is-developed .bubble-line { stroke-dashoffset: 0; fill-opacity: 1; }
.bubble-text {
  position: absolute; inset: 0 0 20% 0; display: grid; place-items: center;
  font-family: var(--ff-serif); font-style: italic; font-size: clamp(1.3rem, 2.6vw, 1.8rem); line-height: 1;
  color: oklch(0.3 0.012 60); rotate: -4deg;
  opacity: 0; transition: opacity 0.3s ease 2.6s;
}
.portrait.is-developed .bubble-text { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .portrait:hover .bubble { animation: hi 0.9s var(--ease); }
}
@keyframes hi { 30% { rotate: -6deg; scale: 1.08; } 60% { rotate: 4deg; scale: 1.04; } }
@media (prefers-reduced-motion: reduce) { .js .print-photo img { filter: none; } .bubble-line { stroke-dashoffset: 0; fill-opacity: 1; } .bubble-text { opacity: 1; } }
@media (max-width: 760px) {
  .about { grid-template-columns: 1fr; }
  .portrait { max-width: 16rem; margin-inline: auto; }
}

/* ── PROJECTS ─────────────────────────────── */
.section-head { margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.cards {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
}
.cards > li { container-type: inline-size; }
.card {
  --lift: 0px;
  display: flex; flex-direction: column; height: 100%;
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--lift));
  transition: --rx 0.3s var(--ease), --ry 0.3s var(--ease), transform 0.3s var(--ease), box-shadow 0.3s var(--ease), opacity 0.25s, filter 0.25s;
  box-shadow: 0 1px 1px var(--shadow);
}
.card:hover, .card:focus-visible { --lift: -4px; box-shadow: 0 1px 1px var(--shadow), 0 22px 40px -24px var(--shadow); }
.card.is-tilting { transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease); }
/* Focus the one you're looking at: the others step back a little. */
@media (hover: hover) {
  .cards:has(.card:hover) .card:not(:hover) { opacity: 0.6; filter: saturate(0.6); }
}

.plate {
  position: relative;
  aspect-ratio: 16 / 10;
  background:
    radial-gradient(circle at 30% 20%, light-dark(oklch(1 0 0 / 0.7), oklch(1 0 0 / 0.04)), transparent 60%),
    var(--paper-2);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.plate-art { position: absolute; inset: 0; display: grid; place-items: center; }
.plate .cover { width: 100%; height: 100%; object-fit: cover; transition: scale 0.5s var(--ease); }
/* Clips: a short silent loop fades in over the plate (hover on desktop, mostly in view on touch;
   main.js decides, and only downloads it when first wanted). The card stays one big link: the video is
   decorative and ignores the pointer. */
.plate .clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; transition: opacity 0.5s var(--ease); }
.plate .clip.is-playing { opacity: 1; }
html:not(.js) .plate .clip { display: none; }
@media (prefers-reduced-motion: reduce) { .plate .clip { display: none; } }
.plate .logo {
  width: 30%; height: auto; border-radius: 22%;
  box-shadow: 0 1px 2px var(--shadow), 0 16px 26px -14px var(--shadow);
  transition: scale 0.5s var(--ease), rotate 0.5s var(--ease);
}
.plate .logo--wide { width: 44%; border-radius: 12px; }
.card:hover .cover { scale: 1.04; }
.card:hover .logo { scale: 1.06; rotate: -3deg; }

/* Ink bleed: the art soaks into the paper as it scrolls into view. The radial mask grows and
   the wrapper's #ink-bleed filter roughens its edge into a watercolour bloom. JS only. */
.js .plate.will-bleed .plate-art { -webkit-mask-image: radial-gradient(circle at 50% 55%, #000 var(--bleed), transparent calc(var(--bleed) + 10%)); mask-image: radial-gradient(circle at 50% 55%, #000 var(--bleed), transparent calc(var(--bleed) + 10%)); }
.js .plate.will-bleed { filter: url(#ink-bleed); }
.js .plate.is-bleeding .plate-art { animation: bleed 1.1s var(--ease) forwards; }
@keyframes bleed { to { --bleed: 110%; } }

.card-body {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  column-gap: 0.8rem;
  padding: 1.1rem 1.25rem 1.3rem;
  flex: 1;
}
.card-num { color: var(--faint); grid-row: 1; }
.card-name { font-family: var(--ff-serif); font-weight: 400; font-size: 1.7rem; line-height: 1.1; grid-column: 2; }
.card-desc { grid-column: 2; color: var(--muted); margin-top: 0.3rem; font-size: 0.98rem; }
.card-tag { grid-column: 2; color: var(--faint); margin-top: 0.8rem; }
.card-arrow { grid-column: 3; grid-row: 1; color: var(--accent); font-size: 1.1rem; transition: translate 0.25s var(--ease); }
.card:hover .card-arrow { translate: 3px -3px; }
@container (min-width: 30rem) {
  .card-name { font-size: 2rem; }
}

/* Cards and other blocks rise in as they enter. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .js .reveal, .js .cards > li {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
  }
}
@supports not (animation-timeline: view()) {
  .js .reveal, .js .cards > li { opacity: 0; translate: 0 12px; transition: opacity 0.5s var(--ease), translate 0.5s var(--ease); }
  .js .is-visible { opacity: 1; translate: 0 0; }
}
@keyframes rise { from { opacity: 0; translate: 0 16px; } }

/* ── SKETCHES ─────────────────────────────── */
.sketch-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(3rem, 7vw, 5rem) clamp(2rem, 6vw, 5rem);
}
@media (min-width: 720px) { .sketch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sketch-card h3 { font-family: var(--ff-serif); font-weight: 400; font-size: 1.9rem; line-height: 1.1; margin-bottom: 0.5rem; }
.sketch-card > p:last-child { color: var(--muted); max-width: 34rem; }
.sketch-fig { color: var(--accent); margin: 0.6rem 0 0.4rem; font-family: var(--ff-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.sketch {
  color: var(--ink);
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M3 25 L5 18 L20 3 L25 8 L10 23 Z' fill='%23f6f1e7' stroke='%23332e2a' stroke-width='1.4' stroke-linejoin='round'/%3E%3Cpath d='M3 25 L5 18 L10 23 Z' fill='%23332e2a'/%3E%3Cpath d='M17 6 L22 11' stroke='%23332e2a' stroke-width='1.2'/%3E%3C/svg%3E") 3 25, crosshair;
}
.sketch svg { width: 100%; max-width: 30rem; height: auto; aspect-ratio: 200 / 140; overflow: visible; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.sketch .ink, .sketch .notes path, .sketch .trail { filter: url(#sketch-rough); }
.sketch .ink > * { stroke-width: 1.4; }
.sketch .ink > .thin { stroke-width: 0.9; stroke-opacity: 0.8; }
.sketch .ink > .ghost { stroke-opacity: 0.3; stroke-width: 0.9; fill: none; }
.sketch .ink > .solid { fill: var(--paper); }   /* parts that sit in front of lines behind them */
.sketch .ink > .accent { stroke: var(--accent); stroke-width: 1.4; }
.sketch .notes path { stroke-width: 0.8; stroke-opacity: 0.5; }
.sketch .trail { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 4; stroke-opacity: 0.8; }
.sketch text { font-family: var(--ff-mono); font-size: 7px; fill: var(--faint); stroke: none; }

/* Draw-in. Paths get pathLength="1" from main.js, so one dash is the whole stroke. With
   scroll-driven animations the sketch draws as fast as you scroll (and undraws going back);
   elsewhere it draws once when it comes into view. */
.js .sketch [pathLength] { stroke-dasharray: 1 2; }
.js .sketch text, .js .sketch .trail { opacity: 0; transition: opacity 0.45s ease 0.1s; }
.js .sketch.is-drawn text, .js .sketch.is-drawn .trail { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .js .sketch { view-timeline: --sketch block; }
    .js .sketch [pathLength] {
      animation: undraw linear both reverse;
      animation-timeline: --sketch;
      animation-range: entry 10% cover 30%;
    }
    .js .sketch [pathLength]:nth-child(3n + 2) { animation-range: entry 20% cover 36%; }
    .js .sketch [pathLength]:nth-child(3n)     { animation-range: entry 30% cover 40%; }
  }
  @supports not (animation-timeline: view()) {
    .js .sketch [pathLength] { stroke-dashoffset: 1.01; transition: stroke-dashoffset 0.9s cubic-bezier(0.4, 0, 0.2, 1); }
    .js .sketch [pathLength]:nth-child(3n + 2) { transition-delay: 0.1s; }
    .js .sketch [pathLength]:nth-child(3n)     { transition-delay: 0.2s; }
    .js .sketch.is-drawn [pathLength] { stroke-dashoffset: 0; }
  }
}
@keyframes undraw { to { stroke-dashoffset: 1.01; } }

/* Once drawn, one detail per sketch comes alive (keyed by card class, so the order can change). */
@media (prefers-reduced-motion: no-preference) {
  .sketch.is-drawn .accent { transform-box: fill-box; }
  .sketch-card--run .sketch.is-drawn .accent { transform-origin: 100% 100%; animation: flutter 1.4s ease-in-out infinite; }
  .sketch-card--hike .sketch.is-drawn .accent { transform-origin: 0% 50%; animation: wave 1.8s ease-in-out infinite; }
  .sketch-card--bike .sketch.is-drawn :is(path[d^='M50 76'], path[d^='M172 76']) { transform-box: fill-box; transform-origin: 50% 50%; animation: spin 7s linear infinite; }
  .sketch-card--bike .sketch.is-drawn .accent { animation: blink 2.4s steps(1) infinite; }
  .sketch-card--board .sketch.is-drawn .accent { transform-origin: 0% 100%; animation: spray 2.2s ease-out infinite; }
  .sketch-card--board .sketch.is-drawn .flake { transform-box: fill-box; animation: flake-drift 5s ease-in-out infinite; }
  .sketch-card--board .sketch.is-drawn .flake:nth-of-type(2n) { animation-duration: 6.5s; animation-delay: -2s; }
  .sketch-card--board .sketch.is-drawn .flake:nth-of-type(3n) { animation-duration: 4.2s; animation-delay: -3.1s; }
  .sketch-card--camera .sketch.is-drawn .accent { animation: nudge 3s ease-in-out infinite; }
  .sketch-card--music .sketch.is-drawn .platter { transform-box: fill-box; transform-origin: 50% 50%; animation: spin 1.8s linear infinite; }
  .sketch.is-paused :is(.accent, .platter, .flake, path[d^='M50 76'], path[d^='M172 76']) { animation-play-state: paused; }
}
@keyframes flutter { 50% { rotate: -6deg; } }
@keyframes wave { 0%, 100% { scale: 1 1; } 50% { scale: 0.82 1.1; } }
@keyframes blink { 50% { stroke-opacity: 0.15; } }
@keyframes spray { 0% { opacity: 0; scale: 0.6; } 25% { opacity: 1; } 70%, 100% { opacity: 0; scale: 1.15; translate: 3px -2px; } }
@keyframes flake-drift { 0%, 100% { translate: 0 -3px; opacity: 0.4; } 50% { translate: 2px 4px; opacity: 1; } }
@keyframes nudge { 0%, 80%, 100% { translate: 0 0; } 86% { translate: 0 1.6px; } 92% { translate: 0 0; } }

/* The turntable drawing is a link to the playlist. */
.sketch-link { display: block; text-decoration: none; cursor: pointer; }
.sketch-link:hover .notes text { fill: var(--accent); }
.sketch-card p .link-inline { font-size: 1.12em; color: var(--ink); }
.sketch-card p .link-inline:hover { color: var(--accent); }

.sketch-close { margin-top: clamp(3rem, 7vw, 5rem); font-family: var(--ff-serif); font-style: italic; font-size: clamp(1.4rem, 3vw, 1.9rem); color: var(--muted); text-align: center; text-wrap: balance; }

/* ── HELLO ────────────────────────────────── */
.hello { padding-bottom: 3rem; border-top: 1px solid var(--line); }
.links { margin-top: clamp(2rem, 5vw, 3rem); border-top: 1px solid var(--line); container-type: inline-size; }
.link {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 1.15rem 0.2rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: padding 0.4s var(--ease), color 0.3s;
}
.link:hover { padding-inline: 0.8rem 0.2rem; }
.link-text { font-family: var(--ff-serif); font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.1; white-space: nowrap; }
/* The email address is the longest line: size the text to the column so it always fits on one line. */
@supports (width: 1cqi) { .link-text { font-size: clamp(1.15rem, calc((100cqi - 7.5rem) / 10), 2.4rem); } }
.link-meta { color: var(--faint); white-space: nowrap; text-transform: uppercase; transition: color 0.3s; }
.link:hover .link-meta { color: var(--accent); }

/* Contact form: a taped letter card (cream in both themes, like .note), links beside it on wide screens. */
.hello-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.hello-body .links { margin-top: clamp(2rem, 5vw, 3rem); }
@media (max-width: 1060px) { .hello-body { grid-template-columns: 1fr; } .hello-body .letter { order: -1; max-width: 32rem; } }
.no-js .letter, .letter[hidden] { display: none; }
.letter {
  --l-ink: oklch(0.28 0.012 60); --l-soft: oklch(0.5 0.012 60); --l-accent: oklch(0.52 0.15 8); --l-rule: oklch(0.62 0.07 240 / 0.2);
  position: relative; margin-top: clamp(2rem, 5vw, 3rem);
  padding: 2rem 1.6rem 1.3rem; border-radius: 3px; rotate: 1deg;
  background: oklch(0.975 0.01 85); color: var(--l-ink);
  box-shadow: 0 1px 2px var(--shadow), 0 24px 40px -24px var(--shadow);
  transition: rotate 0.6s var(--ease);
}
.letter:focus-within { rotate: 0deg; }
.letter::before {
  content: ''; position: absolute; top: -0.55rem; left: 1.4rem; width: 4.6rem; height: 1.4rem; rotate: -6deg;
  background: color-mix(in oklch, var(--l-accent) 26%, oklch(0.96 0.02 85) 74%); opacity: 0.85; box-shadow: 0 1px 2px var(--shadow);
}
.stamp { position: absolute; top: 1rem; right: 1.1rem; width: 2.9rem; rotate: 4deg; overflow: visible; }
.stamp-edge { fill: oklch(0.96 0.02 85); stroke: var(--l-soft); stroke-width: 1.4; stroke-dasharray: 2 2.6; }
.stamp-art { fill: none; stroke: var(--l-accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; filter: url(#sketch-rough); }
.stamp text { font: 600 9px var(--ff-mono); letter-spacing: 0.08em; fill: var(--l-soft); }
.letter-kicker { color: var(--l-accent); text-transform: uppercase; letter-spacing: 0.08em; padding-right: 3.5rem; }
.letter-dear { margin-top: 0.9rem; font-family: var(--ff-serif); font-style: italic; font-size: 1.5rem; line-height: 1.2; }
.letter textarea, .letter input {
  width: 100%; font: inherit; color: inherit; background: transparent; border: 0; border-radius: 0; outline: none;
}
.letter textarea {
  display: block; margin-top: 0.3rem; resize: vertical; min-height: calc(1.72rem * 5);
  font-family: var(--ff-serif); font-style: italic; font-size: 1.28rem; line-height: 1.72rem;
  background-image: repeating-linear-gradient(transparent 0 calc(1.72rem - 1px), var(--l-rule) calc(1.72rem - 1px) 1.72rem);
  background-attachment: local;
}
.letter ::placeholder { color: oklch(0.6 0.012 60); opacity: 1; }
.letter-from { margin-top: 1.1rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem 1.2rem; }
@media (max-width: 420px) { .letter-from { grid-template-columns: 1fr; } }
.letter-from label { display: grid; gap: 0.15rem; }
.letter-from .mono { color: var(--l-soft); text-transform: uppercase; }
.letter input { padding: 0.25rem 0 0.3rem; font-family: var(--ff-serif); font-size: 1.15rem; border-bottom: 1px solid oklch(0.28 0.012 60 / 0.3); transition: border-color 0.3s; }
.letter input:focus, .letter textarea:focus { border-color: var(--l-accent); }
.letter textarea:focus { background-image: repeating-linear-gradient(transparent 0 calc(1.72rem - 1px), oklch(0.52 0.15 8 / 0.3) calc(1.72rem - 1px) 1.72rem); }
.letter :focus-visible { outline: 2px solid var(--l-accent); outline-offset: 3px; }
.letter textarea:focus-visible, .letter input:focus-visible { outline: none; }
.letter-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.letter-check:not(:empty) { margin-top: 0.9rem; }
.letter-foot { margin-top: 1.1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.letter-status { color: var(--l-soft); min-height: 1em; text-wrap: pretty; }
.letter-status.is-error { color: var(--l-accent); }
.letter-status a { color: inherit; }
.letter-send {
  display: inline-flex; align-items: center; gap: 0.55rem; flex: none;
  padding: 0.6rem 1rem; font-size: 0.8rem; text-transform: uppercase; color: var(--l-ink); cursor: pointer; touch-action: manipulation;
  background: none; border: 1.4px solid currentColor; border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  transition: color 0.3s, translate 0.3s var(--ease);
}
.letter-send svg { width: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; overflow: visible; transition: translate 0.4s var(--ease); }
.letter-send:hover, .letter-send:focus-visible { color: var(--l-accent); }
.letter-send:hover svg { translate: 3px -2px; }
.letter-send:disabled { opacity: 0.5; cursor: progress; }
.letter-send[hidden] { display: none; }
.letter-privacy { margin-top: 0.9rem; padding-top: 0.7rem; border-top: 1px dashed oklch(0.5 0.012 60 / 0.3); font-size: 0.78rem; line-height: 1.45; color: var(--l-soft); text-wrap: pretty; }
/* Sent: the card gets a postmark, drawn on like a stamp hitting paper. */
.postmark { position: absolute; right: 12%; top: 26%; width: 9.5rem; rotate: -14deg; overflow: visible; pointer-events: none; opacity: 0; }
.postmark circle, .postmark path { fill: none; stroke: var(--l-accent); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 1 1; stroke-dashoffset: 1; filter: url(#sketch-rough); }
.postmark text { fill: var(--l-accent); font-family: var(--ff-mono); letter-spacing: 0.12em; text-transform: uppercase; }
.postmark .pm-big { font-size: 15px; font-weight: 600; }
.postmark .pm-small { font-size: 9px; }
.letter.is-sent .postmark { opacity: 0.85; }
.letter.is-sent .postmark :is(circle, path) { stroke-dashoffset: 0; transition: stroke-dashoffset 0.7s var(--ease); }
.letter.is-sent .postmark circle + circle { transition-delay: 0.15s; }
.letter.is-sent .postmark path { transition-delay: 0.3s; }
.letter.is-sent :is(textarea, input) { color: var(--l-soft); }
@media (prefers-reduced-motion: no-preference) {
  .letter.is-sent .postmark { animation: thud 0.35s var(--ease); }
}
@keyframes thud { from { scale: 1.4; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .postmark circle, .postmark path { stroke-dashoffset: 0; } }

.signoff { margin-top: clamp(3rem, 8vw, 5rem); display: flex; justify-content: flex-end; }
.signature--signoff { width: min(70%, 22rem); }
.fine a { color: inherit; text-underline-offset: 2px; }
.fine a:hover { color: var(--accent); }
.fine { margin-top: 2.5rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; color: var(--faint); }
.fine { align-items: baseline; }
.fine-group { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.4rem; }
.fine .how-btn { letter-spacing: inherit; line-height: inherit; padding-block: 0.4rem; margin-block: -0.4rem; } /* same tap area, no shift */

/* ── WORK PAGE (/work/) ───────────────────── */
.work-intro { padding-top: clamp(8rem, 18vw, 12rem); padding-bottom: 0; }
.work-intro .title { max-width: 14ch; }
.work-cases, .work-people { padding-block: clamp(4rem, 9vw, 7rem); }
.work-people { background: var(--paper-2); }
.case-list { border-top: 1px solid var(--line); }
.case {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
  gap: 1rem clamp(1.5rem, 5vw, 4rem);
  padding-block: clamp(2.2rem, 5vw, 3.4rem);
  border-bottom: 1px solid var(--line);
}
.case-meta { display: flex; flex-direction: column; gap: 0.3rem; color: var(--faint); text-transform: uppercase; padding-top: 0.7rem; }
.case-num { color: var(--accent); }
.case-title { font-family: var(--ff-serif); font-weight: 400; font-size: clamp(2.1rem, 4.6vw, 3.2rem); line-height: 1.02; letter-spacing: -0.01em; text-wrap: balance; }
.case-lede { font-family: var(--ff-serif); font-style: italic; font-size: clamp(1.2rem, 2.2vw, 1.5rem); line-height: 1.25; color: var(--muted); margin-top: 0.7rem; max-width: 34rem; text-wrap: balance; }
.case-role { color: var(--muted); margin-top: 1.3rem; max-width: 40rem; }
.case-role .mono { display: block; color: var(--accent); text-transform: uppercase; margin-bottom: 0.3rem; }
.case-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 1.4rem 2rem; margin-top: 1.8rem; padding-top: 1.4rem; border-top: 1px dashed var(--line); }
.case-stats dt { font-family: var(--ff-serif); font-size: clamp(2rem, 3.6vw, 2.6rem); line-height: 1; color: var(--ink); }
.case-stats dd { margin-top: 0.35rem; font-size: 0.88rem; line-height: 1.4; color: var(--muted); max-width: 15rem; }
.case-more { margin-top: 2.2rem; }
.link-inline { font-family: var(--ff-serif); font-size: 1.35rem; text-decoration: none; background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 1px no-repeat; transition: background-size 0.4s var(--ease), color 0.3s; padding-bottom: 2px; }
.link-inline:hover { color: var(--accent); }
/* Privacy page (/privacy/): the case rows, with plain readable text. */
.policy-text p { color: var(--muted); margin-top: 1rem; max-width: 40rem; text-wrap: pretty; }
.policy-text h2 + p { margin-top: 1.1rem; }
.policy-text code { font-family: var(--ff-mono); font-size: 0.85em; }
.policy-text .link-inline { font-size: 1.15em; }
.policy-updated { margin-top: 2.5rem; color: var(--faint); text-transform: uppercase; }
.letter-privacy a { color: inherit; text-underline-offset: 2px; }
.letter-privacy a:hover { color: var(--l-accent); }
@media (max-width: 720px) { .case { grid-template-columns: 1fr; } .case-meta { flex-direction: row; gap: 1rem; padding-top: 0; } }

/* Colleague quotes as index cards taped to the page. Like the portrait print they stay cream in dark mode. */
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: clamp(1.6rem, 4vw, 2.6rem); align-items: start; }
.note {
  position: relative;
  padding: 2rem 1.7rem 1.5rem;
  background: oklch(0.975 0.01 85);
  color: oklch(0.28 0.012 60);
  border-radius: 3px;
  box-shadow: 0 1px 2px var(--shadow), 0 20px 34px -22px var(--shadow);
  rotate: -1.2deg;
  transition: rotate 0.6s var(--ease), translate 0.6s var(--ease);
  background-image: repeating-linear-gradient(transparent 0 1.72rem, oklch(0.62 0.07 240 / 0.16) 1.72rem calc(1.72rem + 1px));
  background-position: 0 1.7rem;
}
.note:nth-child(even) { rotate: 1deg; margin-top: 1.4rem; }
.note:nth-child(3) { rotate: 0.8deg; }
.note:hover { rotate: 0deg; translate: 0 -4px; }
.note::before {
  content: ''; position: absolute; top: -0.5rem; left: 50%; width: 4.4rem; height: 1.4rem; translate: -50% 0; rotate: -3deg;
  background: color-mix(in oklch, var(--accent) 26%, oklch(0.96 0.02 85) 74%); opacity: 0.8; box-shadow: 0 1px 2px var(--shadow);
}
.note:nth-child(even)::before { rotate: 4deg; }
.note p { font-family: var(--ff-serif); font-style: italic; font-size: 1.28rem; line-height: 1.72rem; text-wrap: pretty; }
.note p::before { content: '\201C'; color: var(--accent); font-size: 1.6em; line-height: 0; vertical-align: -0.3em; margin-right: 0.08em; }
.note footer { margin-top: 1.1rem; color: oklch(0.5 0.012 60); text-transform: uppercase; }
.note footer::before { content: '— '; }

/* ── HOW THIS PAGE WORKS ──────────────────── */
/* A taped index card in the top layer (Popover API: Escape, click outside and focus all work natively). */
.how-btn { font: inherit; color: inherit; background: none; border: 0; padding: 0.3rem 0; cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in oklch, currentColor 35%, transparent); text-underline-offset: 3px; touch-action: manipulation; }
.how-btn:hover, .how-btn:focus-visible { color: var(--accent); text-decoration-color: currentColor; }
.how {
  --how-ink: oklch(0.28 0.012 60); --how-soft: oklch(0.5 0.012 60); --how-accent: oklch(0.52 0.15 8);
  border: 0; padding: 1.6rem 1rem 1rem; background: none; color: var(--how-ink); inset: 0; margin: auto;
  width: min(37rem, 100vw); max-height: 100dvh; overflow: auto; overscroll-behavior: contain;
}
.how::backdrop { background: color-mix(in oklch, var(--paper) 80%, transparent); backdrop-filter: blur(3px); }
.how-card {
  position: relative; padding: 2.3rem 1.9rem 1.5rem; border-radius: 3px; rotate: -0.8deg;
  background: oklch(0.975 0.01 85);
  box-shadow: 0 1px 2px var(--shadow), 0 30px 60px -28px var(--shadow);
}
.how-card::before {
  content: ''; position: absolute; top: -0.6rem; left: 50%; width: 5rem; height: 1.5rem; translate: -50% 0; rotate: -3deg;
  background: color-mix(in oklch, var(--how-accent) 26%, oklch(0.96 0.02 85) 74%); opacity: 0.85; box-shadow: 0 1px 2px var(--shadow);
}
.how-title { font-family: var(--ff-serif); font-weight: 400; font-size: clamp(1.9rem, 5vw, 2.4rem); line-height: 1.05; text-wrap: balance; }
.how-intro { margin-top: 0.7rem; color: var(--how-soft); text-wrap: pretty; }
.how-list { list-style: none; margin-top: 1.1rem; display: grid; gap: 0.85rem; }
.how-list li { position: relative; padding-left: 1.5rem; line-height: 1.55; text-wrap: pretty; }
.how-list li::before { content: ''; position: absolute; left: 0.1rem; top: 0.5em; width: 0.55rem; height: 0.55rem; border: 1.3px solid var(--how-accent); border-radius: 55% 45% 50% 50%; rotate: -12deg; }
.how-list strong { font-family: var(--ff-serif); font-weight: 400; font-size: 1.12em; }
.how-livebox { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px dashed oklch(0.5 0.012 60 / 0.4); }
.how-label { color: var(--how-accent); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72rem; }
.how-live { margin-top: 0.6rem; display: grid; gap: 0.3rem; font-size: 0.88rem; }
.how-live > div { display: grid; grid-template-columns: 4.4rem 1fr; gap: 0.6rem; }
.how-live dt { color: var(--how-soft); }
.how-live dd { color: var(--how-ink); }
.how-foot { margin-top: 1.2rem; color: var(--how-soft); font-size: 0.74rem; line-height: 1.5; text-wrap: pretty; }
.how-close { display: block; margin: 1rem 0 0 auto; padding: 0.5rem 0.2rem; font: inherit; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--how-soft); background: none; border: 0; cursor: pointer; touch-action: manipulation; }
.how-close:hover, .how-close:focus-visible { color: var(--how-accent); }
@media (prefers-reduced-motion: no-preference) {
  .how, .how::backdrop { transition: opacity 0.3s var(--ease), translate 0.35s var(--ease), display 0.35s allow-discrete, overlay 0.35s allow-discrete; }
  .how:not(:popover-open), .how:not(:popover-open)::backdrop { opacity: 0; }
  .how:not(:popover-open) { translate: 0 1.5rem; }
  @starting-style { .how:popover-open { opacity: 0; translate: 0 2rem; } .how:popover-open::backdrop { opacity: 0; } }
}

/* ── MOTION PREFERENCES ───────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .js .signature .sig-ink { opacity: 1 !important; }
  .js .sketch [pathLength] { stroke-dashoffset: 0 !important; }
}
