:root {
  --paper: #ffffff;
  --surface: #f4f5f7;
  --ink: #000000;
  --muted: #4b5563;
  --rule: #e1e4e8;
  --accent: #2742b8;
  --accent-soft: #dfe4f7;
  --on-accent: #ffffff;

  --display: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --body: "Literata", Georgia, "Times New Roman", serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.75rem;
  --step-3: clamp(2rem, 1.4rem + 2.4vw, 3rem);
  --step-4: clamp(2.5rem, 1.2rem + 5.2vw, 5.25rem);

  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 5rem); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }

.wrap { width: min(100% - 2.5rem, 74rem); margin-inline: auto; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem 1rem; z-index: 20; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 11;
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px);
}
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.9rem; font-family: var(--display); }
.brand { font-weight: 800; text-decoration: none; font-size: 1.05rem; }
.top nav { display: flex; gap: 1.4rem; font-size: var(--step--1); font-weight: 500; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.45em; }
@media (max-width: 480px) { .top nav { gap: 0.9rem; } .brand { font-size: 0.95rem; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; font-family: var(--display); font-weight: 600; font-size: var(--step--1);
  padding: 0.7rem 1.15rem; border-radius: 999px; text-decoration: none;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent);
}
.btn:hover { filter: brightness(1.08); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-quiet:hover { border-color: var(--ink); filter: none; }

/* ---------- hero ---------- */
.hero { padding-block: clamp(3.5rem, 9vw, 7.5rem) clamp(3rem, 7vw, 5.5rem); }
.hero {
  display: grid; grid-template-columns: clamp(9rem, 16vw, 13rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center;
}
.headshot { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }
.hero-intro { max-width: 40rem; }
.hero-intro p {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.75rem); line-height: 1.35;
  letter-spacing: -0.012em; text-wrap: pretty;
}
.hero-intro p + p { margin-top: 0.9rem; }
.hero-intro .hero-cta { margin-top: 1.25rem; font-size: var(--step-0); font-weight: 600; }
.hero-cta a { color: var(--accent); text-decoration-thickness: 2px; text-decoration-color: currentColor; }
.hero-cta a:hover { text-decoration-thickness: 3px; }
@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .headshot { width: 7.5rem; }
}
.hero-links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.75rem; }
@media (prefers-reduced-motion: no-preference) {
  .hero { animation: rise 0.9s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
}

/* ---------- section heads ---------- */
.sec-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1rem 3rem; align-items: baseline; padding-block: 1.25rem 2rem; border-top: 2px solid var(--ink); }
.sec-head:has(> h2:only-child) { grid-template-columns: 1fr; }
.sec-head h2 { font-size: var(--step-3); font-weight: 800; letter-spacing: -0.025em; }
.sec-head p { color: var(--muted); max-width: 38rem; }
@media (max-width: 760px) { .sec-head { grid-template-columns: 1fr; } }

/* ---------- ledger ---------- */
.work, .more, .exp { padding-bottom: clamp(3rem, 7vw, 5.5rem); }
.group + .group { margin-top: 3rem; }
.group-h { font-size: var(--step-1); font-weight: 700; padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule); }
.group-h span { font-weight: 400; color: var(--muted); font-size: var(--step--1); margin-left: 0.6rem; }
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { border-bottom: 1px solid var(--rule); }
.row {
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) 15rem; gap: 1.5rem; align-items: center;
  padding-block: 1.25rem; text-decoration: none;
}
.thumb { width: 5.5rem; aspect-ratio: 612 / 792; object-fit: cover; object-position: top; border-radius: 3px; box-shadow: 0 1px 0 var(--rule), 0 6px 18px -10px rgba(10, 20, 40, 0.45); }
.thumb.thumb-wide { aspect-ratio: 1224 / 792; align-self: center; }
.row h3 { font-size: var(--step-1); font-weight: 700; letter-spacing: -0.015em; }
.row:hover h3 { color: var(--accent); }
.row-sum { margin-top: 0.3rem; color: var(--muted); max-width: 46ch; }
.row-meta { margin-top: 0.55rem; display: flex; flex-wrap: wrap; gap: 0.35rem; font-family: var(--display); font-size: 0.8125rem; }
.row-meta span { padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--rule); color: var(--muted); }

.row-res { font-family: var(--display); }
.res { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 0.4rem; }
.res-pipe, .res-views { font-size: var(--step-2); font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.res-unit { color: var(--muted); font-size: var(--step--1); }
.res-mql { flex-basis: 100%; font-size: var(--step--1); font-weight: 600; }

.bar { margin-top: 0.55rem; height: 6px; background: var(--accent-soft); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; width: var(--w); background: var(--accent); border-radius: inherit; }
@media (prefers-reduced-motion: no-preference) {
  .bar span { transform-origin: left; animation: grow 1.1s 0.3s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes grow { from { transform: scaleX(0); } }
}
@media (max-width: 760px) {
  .row { grid-template-columns: 4.25rem minmax(0, 1fr); gap: 1rem; align-items: start; }
  .thumb { width: 4.25rem; }
  .row-res { grid-column: 2; }
}

/* ---------- more writing ---------- */
.more-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 2.5rem 3rem; }
.more-col h3 { font-size: var(--step-1); font-weight: 700; }
.more-note { margin-top: 0.3rem; color: var(--muted); font-size: var(--step--1); }
.more-col ul { list-style: none; padding: 0; margin: 0.9rem 0 0; }
.more-col li { padding-block: 0.6rem; border-top: 1px solid var(--rule); display: grid; gap: 0.1rem; }
.more-col li a { font-weight: 500; line-height: 1.4; }
.more-col li span { font-family: var(--display); font-size: 0.8125rem; color: var(--muted); }

/* ---------- experience ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline > li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 0.5rem 3rem; padding-block: 1.4rem; border-top: 1px solid var(--rule); }
.t-dates { font-family: var(--display); color: var(--muted); font-size: var(--step--1); padding-top: 0.25rem; }
.timeline h3 { font-size: var(--step-1); font-weight: 700; }
.t-title { color: var(--muted); }
.timeline ul { margin: 0.6rem 0 0; padding-left: 1.1rem; max-width: 40rem; }
.timeline ul li { margin-bottom: 0.35rem; }
@media (max-width: 760px) { .timeline > li { grid-template-columns: 1fr; } }

/* ---------- contact ---------- */
.contact { padding-block: 2.5rem 5rem; border-top: 2px solid var(--ink); }
.contact h2 { font-size: var(--step-3); font-weight: 800; letter-spacing: -0.025em; max-width: 18ch; }
.contact > p { margin-top: 0.75rem; color: var(--muted); }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--rule); font-family: var(--display); font-size: var(--step--1); color: var(--muted); }
.foot-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; padding-block: 1.5rem; }
.foot-in p:last-child { display: flex; gap: 1.25rem; }

/* ---------- case study ---------- */
.cs { padding-bottom: 3rem; }
.crumb { padding-top: 2rem; font-family: var(--display); font-size: var(--step--1); }
.crumb a { color: var(--muted); }
.cs-head { padding-block: 2rem 2.25rem; }
.cs-co { font-family: var(--display); font-weight: 600; color: var(--accent); }
.cs-head h1 { margin-top: 0.6rem; font-size: var(--step-4); font-weight: 800; letter-spacing: -0.035em; line-height: 1; max-width: 22ch; text-wrap: balance; }
.cs-sum { margin-top: 1.25rem; font-size: var(--step-1); max-width: 40rem; color: var(--muted); }

.stats { display: flex; flex-wrap: wrap; margin: 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.stats > div { padding: 1rem 2.5rem 1.1rem 0; display: flex; flex-direction: column-reverse; }
.stats > div + div { padding-left: 2.5rem; border-left: 1px solid var(--rule); }
.stats dt { font-family: var(--display); font-size: var(--step--1); color: var(--muted); }
.stats dd { margin: 0; font-family: var(--display); font-weight: 800; font-size: var(--step-3); letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .stats > div { padding-right: 1.25rem; }
  .stats > div + div { padding-left: 1.25rem; }
}

.cs-grid { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 4rem; padding-top: 3rem; }
.brief { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 5rem); align-self: start; }
.brief-cover { width: 100%; border-radius: 4px; box-shadow: 0 14px 40px -22px rgba(10, 20, 40, 0.6); }
.brief dl { margin: 1.5rem 0; }
.brief dl > div { padding-block: 0.65rem; border-top: 1px solid var(--rule); }
.brief dt { font-family: var(--display); font-size: 0.8125rem; color: var(--muted); }
.brief dd { margin: 0.1rem 0 0; font-size: 0.95rem; line-height: 1.45; }

.story { max-width: 40rem; }
.story > section + section { margin-top: 2.75rem; }
.story h2 { font-size: var(--step-2); font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.75rem; }
.story p { line-height: 1.7; }

.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 0 0 1.4rem 3rem; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0.05rem;
  width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 0.9rem; background: var(--accent); color: var(--on-accent);
}
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 0.93rem; top: 2.2rem; bottom: 0.3rem; width: 1px; background: var(--rule); }
.steps h3 { font-size: var(--step-0); font-weight: 700; margin-bottom: 0.2rem; }

.pages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; }
.pages-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pages-wide .page:first-child { grid-column: 1 / -1; }
.pages-tall { grid-template-columns: 1fr; }
.pages-tall .page { max-height: 34rem; overflow: auto; }
.page { padding: 0; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface); cursor: zoom-in; overflow: hidden; }
.page img { width: 100%; }
.page:hover { border-color: var(--ink); }

.rel { list-style: none; padding: 0; margin: 0; }
.rel li { display: flex; justify-content: space-between; gap: 1rem; padding-block: 0.7rem; border-top: 1px solid var(--rule); }
.rel span { font-family: var(--display); font-size: var(--step--1); color: var(--muted); white-space: nowrap; }

.next { margin-top: 4.5rem; }
.next a { display: block; padding: 1.5rem 0; border-top: 2px solid var(--ink); text-decoration: none; }
.next span { font-family: var(--display); color: var(--muted); font-size: var(--step--1); }
.next strong { display: block; font-family: var(--display); font-size: var(--step-3); font-weight: 800; letter-spacing: -0.025em; line-height: 1.05; margin-top: 0.3rem; max-width: 22ch; }
.next a:hover strong { color: var(--accent); }

@media (max-width: 860px) {
  .cs-grid { grid-template-columns: 1fr; gap: 2rem; }
  .brief { position: static; display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 0 1.25rem; align-items: start; }
  .brief dl { margin: 0; }
  .brief .btn { grid-column: 1 / -1; justify-self: start; margin-top: 1rem; }
  .pages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- lightbox ---------- */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(92vw, 60rem); max-height: 92vh; overflow: auto; }
.lightbox::backdrop { background: rgba(8, 12, 18, 0.82); }
.lightbox img { width: 100%; border-radius: 4px; }
.lb-close { position: sticky; top: 0; float: right; margin: 0.5rem; font-family: var(--display); font-weight: 600; padding: 0.45rem 0.9rem; border-radius: 999px; border: 0; background: var(--surface); color: var(--ink); cursor: pointer; }

/* ---------- placeholder pages ---------- */
.soon { padding-block: clamp(4rem, 12vw, 8rem); min-height: 50vh; }
.soon h1 { font-size: var(--step-4); font-weight: 800; letter-spacing: -0.035em; }
.soon p { margin-top: 1rem; font-size: var(--step-1); color: var(--muted); max-width: 36rem; }

/* ---------- resume page ---------- */
.resume-page { padding-block: clamp(3rem, 8vw, 5.5rem) 4rem; }
.resume-page > h1 { font-size: var(--step-4); font-weight: 800; letter-spacing: -0.035em; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.resume-page .exp { padding-bottom: 3rem; }
.edu { padding-top: 0.25rem; }
