/* Schibsted Grotesk (SIL OFL), self-hosted so no request goes to Google; one variable file per subset */
@font-face {
  font-family: "Schibsted Grotesk";
  font-weight: 400 800;
  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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-weight: 400 800;
  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;
}

:root {
  --bg: #e3e5da;
  --surface: #d6dacb;
  --ink: #0d3b2c;
  --muted: #39614f;
  --accent: #0d3b2c;
  --accent-ink: #e3e5da;
  --term-top: #134a38;
  --code-dim: #a8c9b8;

  --step-small: 1rem;
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
  --step-display: clamp(4.25rem, 17vw, 17rem);

  --m: clamp(16px, 3vw, 44px);
  --gap: clamp(96px, 10vw, 160px);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --font: "Schibsted Grotesk", system-ui, sans-serif;
}

/* cobalt alternative: open the page with ?cobalt */
:root[data-palette="cobalt"] {
  --bg: #e6dbc7;
  --surface: #ddd0b9;
  --ink: #062b8a;
  --muted: #34529e;
  --accent: #062b8a;
  --accent-ink: #e6dbc7;
  --term-top: #0a3399;
  --code-dim: #b7c6f0;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-body)/1.45 var(--font);
  letter-spacing: -0.01em;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.h-sec { font-size: var(--step-head); font-weight: 800; line-height: 0.95; letter-spacing: -0.04em; text-wrap: balance; }
.lead { font-size: var(--step-lead); line-height: 1.35; }

/* bar: fixed corners, takes the ink of the chapter beneath */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px var(--m);
  color: var(--ink);
  background: var(--bg);
  transition: color .3s ease, background-color .3s ease;
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.bar.on-cobalt { color: var(--bg); }
.wordmark { font-weight: 600; text-decoration: none; font-size: var(--step-body); }
.btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px;
  background: var(--ink); color: var(--bg);
  font-weight: 600; text-decoration: none; border-radius: 0;
  transition: background-color .3s ease, color .3s ease, transform .2s var(--ease);
}
.bar.on-cobalt .btn { background: var(--bg); color: var(--ink); }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(1px) scale(.98); }

/* hero */
.hero {
  min-height: 100svh;
  padding: 15svh var(--m) 48px;
  display: grid; grid-template-rows: auto 1fr auto;
}
.hero-title {
  font-size: var(--step-display); font-weight: 800; line-height: 0.84; letter-spacing: -0.05em;
}
.hero-title span:not(.sr) { display: block; }
.hero-title .pale { color: var(--muted); }
/* hyphen drawn by CSS so the heading's text stays the real surname */
.hero-title .pale::after { content: "-"; }
/* load sequence: the name rises line by line, the lead follows; settled by ~1s */
.hero-title span:not(.sr), .hero-lead { animation: rise .8s var(--ease) both; }
.hero-title .dark { animation-delay: .09s; }
.hero-lead { animation-delay: .25s; }
@keyframes rise { from { opacity: 0; transform: translateY(32px); } }
.hero-lead {
  grid-row: 3; justify-self: end;
  width: min(30rem, 34vw);
  font-size: var(--step-lead); line-height: 1.35;
}

/* about */
.about { background: var(--surface); padding: var(--gap) var(--m); }
.about-row { display: grid; grid-template-columns: 34% 1fr; column-gap: 0; }
.about-row + .about-row { margin-top: 120px; }
/* black-and-white portrait multiplied into its own ground so it takes the palette's tint;
   isolation keeps the blend stable while the parent fades in (no white flash) */
.me { display: block; width: clamp(120px, 12vw, 180px); aspect-ratio: 1; margin-top: 32px; background: var(--surface); isolation: isolate; }
.me img { display: block; width: 100%; height: 100%; mix-blend-mode: multiply; }
.facts dl { margin-top: 32px; display: grid; gap: 20px; }
.facts dt { color: var(--muted); font-size: var(--step-small); }
.facts dd { font-weight: 600; }
.about-text { max-width: 44rem; display: grid; gap: 24px; }
.about-row--lists { grid-template-columns: 34% 1fr 1fr; column-gap: 64px; align-items: start; }
.about-row--lists .side-word { grid-column: 1; font-size: var(--step-lead); font-weight: 800; letter-spacing: -0.03em; }
.about-row--lists { column-gap: 0; }
.about-row--lists .rec { padding-right: 48px; }
.rec li { padding: 6px 0; }
.rec li span:last-child { color: var(--muted); font-size: var(--step-small); align-self: center; }
figcaption { margin-top: 10px; font-size: var(--step-small); }

/* duo: two giant words */
.duo { background: var(--ink); color: var(--bg); padding: var(--gap) var(--m) 0; overflow: hidden; }
.duo-head { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; align-items: start; }
.duo-head .h-sec { grid-column: 1 / 7; }
.duo-head p { grid-column: 7 / 13; max-width: 36rem; }
.duo-specs { margin-top: 12vh; display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; height: clamp(220px, 30vw, 460px); overflow: hidden; }
.spec .cap { font-size: var(--step-body); font-weight: 600; margin-bottom: 8px; }
.giant { display: block; font-size: clamp(180px, 31vw, 520px); font-weight: 800; line-height: 0.8; letter-spacing: -0.06em; }
.spec--b .giant { font-weight: 400; }

/* session: live tool switcher with interface fragment */
.session { padding: var(--gap) var(--m); display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: clamp(32px, 5vw, 96px); align-items: start; }
.session-head { display: grid; gap: 24px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tabs button {
  font: 600 var(--step-body)/1 var(--font); letter-spacing: -0.01em;
  min-height: 48px; padding: 0 20px; border: 0; border-radius: 0; cursor: pointer;
  background: var(--surface); color: var(--ink);
  transition: background-color .2s ease, color .2s ease, transform .2s var(--ease);
}
.tabs button:hover { transform: translateY(-2px); }
.tabs button:active { transform: scale(.97); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.term { background: var(--ink); color: var(--bg); min-height: 420px; min-width: 0; }
.term-top { display: flex; justify-content: space-between; padding: 14px 22px; background: var(--term-top); font-size: var(--step-small); font-weight: 600; }
.panel { padding: 24px 22px 32px; }
.panel .use { font-size: var(--step-lead); line-height: 1.3; margin-bottom: 24px; max-width: 34rem; }
.panel pre { margin: 0; overflow-x: auto; font: 15px/1.6 ui-monospace, "SF Mono", Menlo, monospace; }
.panel b { color: #fff; }
.panel i { font-style: normal; color: var(--code-dim); }
.panel em { font-style: normal; color: #fff; font-weight: 600; }
.js .panel:not([hidden]) { animation: panel-in .45s var(--ease); }
@keyframes panel-in { from { opacity: 0; transform: translateY(12px); } }
.ln { transition: opacity .25s ease; }
.ln.wait { opacity: 0; }
.typing .panel:not([hidden]) .ln:first-child::after { content: ""; display: inline-block; width: .55em; height: 1.1em; margin-left: 2px; vertical-align: -.2em; background: currentColor; animation: caret .8s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }


/* projects: one large figure per project, its story beside it */
.projects { background: var(--ink); color: var(--bg); padding: var(--gap) var(--m); }
.projects .h-sec { margin-bottom: 48px; }
.proj { display: grid; grid-template-columns: 34% minmax(0, 44rem); align-items: center; }
.proj + .proj { margin-top: 96px; }
.proj .fig { font-size: clamp(3.5rem, 10vw, 10.5rem); font-weight: 800; line-height: 0.9; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.proj h3 { font-size: var(--step-lead); font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 10px; }
.proj h3 a { text-decoration-thickness: 2px; text-underline-offset: 4px; transition: opacity .2s ease; }
.proj h3 a:hover { opacity: .8; }
.proj .stack { margin-top: 10px; opacity: .8; }

/* work: ledger */
.work { background: var(--surface); padding: var(--gap) var(--m); }
.ledger { display: grid; grid-template-columns: 34% minmax(0, 1fr); align-items: start; }
.ledger .h-sec { margin-bottom: 32px; }
.rows a, .rows .row { display: grid; grid-template-columns: 1fr 1fr 9rem; align-items: center; column-gap: 16px; min-height: 44px; text-decoration: none; transition: color .2s ease; }
.rows .n { font-weight: 600; }
.rows .k { font-size: var(--step-small); color: var(--muted); }
.rows .y { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.rows:hover a, .rows:hover .row, .rows:focus-within a { color: var(--muted); }
.rows a:hover, .rows a:focus-visible, .rows .row:hover { color: var(--ink); }
.rows a:hover .n { text-decoration: underline; text-underline-offset: 4px; }
.edu { margin-top: 40px; max-width: 34rem; }

/* poster */
.poster { padding: var(--gap) var(--m); }
.poster .h-sec { margin-bottom: 48px; }
.poster-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; }
.poster-list .w { font-size: clamp(3.5rem, 10vw, 10.5rem); font-weight: 800; line-height: 0.92; letter-spacing: -0.05em; text-transform: lowercase; transition: color .25s ease; }
.poster-list .d { font-size: var(--step-lead); font-variant-numeric: tabular-nums; text-align: right; }
.poster-list li:nth-child(n+4) .w { color: var(--muted); }
.poster-list li:hover .w { color: var(--ink); }

/* footer */
.foot { background: var(--ink); color: var(--bg); padding: var(--gap) var(--m) 32px; display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 48px; }
.foot-top { display: grid; }
.notes { display: grid; gap: 10px; max-width: 32rem; }
.mail {
  align-self: end; text-decoration: none; display: block;
  font-size: clamp(2.75rem, 8.6vw, 10rem); font-weight: 800; line-height: 0.9; letter-spacing: -0.05em;
  transition: opacity .2s ease;
}
.mail span { display: inline-block; }
.mail:hover { opacity: .8; }
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; font-size: var(--step-small); }
.meta p:last-child { text-align: right; }
.fine { margin-top: -24px; font-size: 0.75rem; text-align: center; opacity: .75; }

/* motion: entrances only when script runs */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0ms); }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .js .panel:not([hidden]), .hero-title span, .hero-lead { animation: none; }
}

/* tablet */
@media (max-width: 1024px) {
    .about-row--lists { grid-template-columns: 1fr 1fr; row-gap: 32px; }
  .about-row--lists .side-word { grid-column: 1 / -1; }
    .session { grid-template-columns: minmax(0, 1fr); row-gap: 48px; }
  .ledger { grid-template-columns: 1fr; }
  .proj { grid-template-columns: 1fr; row-gap: 12px; }
}

/* phone */
@media (max-width: 640px) {
  .wordmark { font-size: var(--step-small); }
  .btn { padding: 0 16px; font-size: var(--step-small); }
  .hero { min-height: 0; padding-top: 112px; padding-bottom: 72px; row-gap: 32px; }
  .hero-title { font-size: 21vw; }
  .hero-lead { justify-self: stretch; width: auto; font-size: var(--step-lead); }
  .about-row { grid-template-columns: 1fr; row-gap: 32px; }
  .facts dl { grid-template-columns: 1fr 1fr; }
  .about-row--lists { grid-template-columns: 1fr 1fr; }
  .about-row--lists .rec { padding-right: 16px; }
  .duo-head { grid-template-columns: 1fr; row-gap: 20px; }
  .duo-head .h-sec, .duo-head p { grid-column: 1; }
  .duo-specs { grid-template-columns: 1fr; height: auto; margin-top: 48px; }
  .spec { height: 38svh; overflow: hidden; padding-top: 16px; }
  .spec--b { background: var(--bg); color: var(--ink); margin: 0 calc(var(--m) * -1); padding-left: var(--m); padding-right: var(--m); }
  .giant { font-size: 62vw; }
  .term { min-height: 0; }
  .panel pre { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
  .ledger { grid-template-columns: 1fr; }
      .rows a, .rows .row { grid-template-columns: 1fr auto; min-height: 52px; padding: 6px 0; }
  .rows .k { grid-row: 2; grid-column: 1 / -1; }
  .poster-list li { flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 22px; }
  .poster-list .w { font-size: 14vw; }
  .poster-list .d { text-align: left; font-size: var(--step-body); }
  .foot { padding-top: 88px; }
  .foot-top { grid-template-columns: 1fr; row-gap: 32px; }
  .mail { font-size: 10.4vw; }
  .mail span { display: block; }
  .meta { grid-template-columns: 1fr; gap: 8px; }
  .meta p:last-child { text-align: left; }
}
