/* ============================================================
   Peter Elgaard Krogh — Portfolio
   Nordic warm-minimal design system
   ============================================================ */

/* ---- Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;1,6..72,300;1,6..72,400&family=Schibsted+Grotesk:wght@400;500;600;700&display=swap');

/* ---- Shared tokens (type, rhythm) ---- */
:root {
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans:  'Schibsted Grotesk', system-ui, -apple-system, sans-serif;

  --maxw: 1240px;
  --gutter: clamp(20px, 5vw, 80px);
  --section-pad: clamp(80px, 12vh, 180px);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================================
   THEMES — dark is the default
   Axes: data-theme (dark|light) × data-tone (warm|cool)
   Accent (--accent / -deep / -tint) is set by JS per-mode,
   but each theme block carries a clay default to avoid flash.
   ============================================================ */

/* ---- DARK · warm (default) ---- */
[data-theme="dark"] {
  color-scheme: dark;
  --paper:       oklch(0.205 0.008 60);   /* deep warm charcoal */
  --paper-2:     oklch(0.245 0.010 60);   /* raised panel */
  --paper-3:     oklch(0.290 0.012 62);   /* deeper panel */
  --line:        oklch(0.345 0.012 60);   /* hairline */
  --line-soft:   oklch(0.305 0.010 60);
  --ink:         oklch(0.945 0.006 80);   /* soft warm white */
  --ink-2:       oklch(0.820 0.008 72);   /* secondary */
  --muted:       oklch(0.700 0.010 68);   /* captions — AA on paper */
  --faint:       oklch(0.605 0.010 65);

  --accent:      oklch(0.745 0.105 50);
  --accent-deep: oklch(0.825 0.090 52);   /* hover text on dark */
  --accent-tint: oklch(0.350 0.055 52);   /* selection / subtle */

  /* inverted "feature" block (contact + footer) */
  --feature-bg:     oklch(0.135 0.008 60);
  --feature-fg:     oklch(0.955 0.006 80);
  --feature-muted:  oklch(0.660 0.010 68);
  --feature-line:   oklch(0.300 0.010 60);
  --feature-accent: oklch(0.800 0.090 52);
}

/* ---- DARK · cool ---- */
[data-theme="dark"][data-tone="cool"] {
  --paper:       oklch(0.210 0.009 252);
  --paper-2:     oklch(0.250 0.011 250);
  --paper-3:     oklch(0.295 0.013 248);
  --line:        oklch(0.350 0.012 250);
  --line-soft:   oklch(0.310 0.010 250);
  --ink:         oklch(0.950 0.005 250);
  --ink-2:       oklch(0.825 0.009 250);
  --muted:       oklch(0.705 0.012 250);
  --faint:       oklch(0.610 0.010 250);
  --feature-bg:     oklch(0.140 0.010 252);
  --feature-fg:     oklch(0.960 0.005 250);
  --feature-muted:  oklch(0.665 0.012 250);
  --feature-line:   oklch(0.305 0.011 250);
}

/* ---- LIGHT · warm ---- */
[data-theme="light"] {
  color-scheme: light;
  --paper:       oklch(0.985 0.004 80);
  --paper-2:     oklch(0.962 0.006 75);
  --paper-3:     oklch(0.935 0.008 72);
  --line:        oklch(0.88  0.008 72);
  --line-soft:   oklch(0.91  0.007 74);
  --ink:         oklch(0.235 0.012 60);
  --ink-2:       oklch(0.40  0.012 60);
  --muted:       oklch(0.515 0.012 62);
  --faint:       oklch(0.63  0.010 65);

  --accent:      oklch(0.605 0.086 48);
  --accent-deep: oklch(0.50  0.086 45);
  --accent-tint: oklch(0.93  0.026 60);

  --feature-bg:     oklch(0.235 0.012 60);
  --feature-fg:     oklch(0.985 0.004 80);
  --feature-muted:  oklch(0.700 0.010 70);
  --feature-line:   oklch(0.500 0.010 60);
  --feature-accent: oklch(0.780 0.060 50);
}

/* ---- LIGHT · cool ---- */
[data-theme="light"][data-tone="cool"] {
  --paper:       oklch(0.986 0.003 250);
  --paper-2:     oklch(0.965 0.005 248);
  --paper-3:     oklch(0.940 0.007 246);
  --line:        oklch(0.885 0.006 248);
  --line-soft:   oklch(0.915 0.005 248);
  --ink:         oklch(0.255 0.014 252);
  --ink-2:       oklch(0.42  0.013 252);
  --muted:       oklch(0.525 0.012 252);
  --faint:       oklch(0.64  0.010 252);
  --feature-bg:     oklch(0.245 0.014 252);
  --feature-fg:     oklch(0.986 0.003 250);
  --feature-muted:  oklch(0.700 0.012 250);
  --feature-line:   oklch(0.510 0.011 252);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; scroll-behavior: smooth; background: var(--paper); }
body {
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  overflow-x: hidden;
  transition: color .5s var(--ease);
}

/* ============================================================
   Ambient scroll-reactive background
   ============================================================ */
#bg {
  position: fixed; inset: 0; z-index: -1;
  overflow: hidden; pointer-events: none;
  /* per-theme intensity */
  --blob-blur: 95px;
  --blob-op: 0.42;
  --grain-op: 0.10;
  --bg-cool: oklch(0.50 0.07 248);
}
[data-theme="light"] #bg {
  --blob-blur: 88px;
  --blob-op: 0.50;
  --grain-op: 0.05;
  --bg-cool: oklch(0.85 0.035 248);
}
.bg-base { position: absolute; inset: 0; background: var(--paper); transition: background .5s var(--ease); }
.bg-field {
  position: absolute; inset: -28%;
  will-change: transform;
  transform: translate3d(0,0,0);
}
.blob {
  position: absolute; border-radius: 50%;
  filter: blur(var(--blob-blur));
  opacity: var(--blob-op);
  will-change: transform;
}
.b1 { width: 48vw; height: 48vw; top: -6%;  left: -6%;  background: var(--accent);  animation: drift1 34s var(--ease) infinite; }
.b2 { width: 42vw; height: 42vw; top: 28%;  left: 58%;  background: var(--bg-cool);  animation: drift2 44s var(--ease) infinite; }
.b3 { width: 40vw; height: 40vw; bottom: -8%; left: 16%; background: color-mix(in oklab, var(--accent) 55%, var(--paper)); animation: drift3 38s var(--ease) infinite; }
.b4 { width: 32vw; height: 32vw; top: 52%;  left: 2%;   background: var(--paper-3);  animation: drift4 30s var(--ease) infinite; }

@keyframes drift1 { 0%,100%{ transform: translate(0,0) scale(1);} 50%{ transform: translate(5%, 4%) scale(1.12);} }
@keyframes drift2 { 0%,100%{ transform: translate(0,0) scale(1);} 50%{ transform: translate(-6%, 5%) scale(1.08);} }
@keyframes drift3 { 0%,100%{ transform: translate(0,0) scale(1);} 50%{ transform: translate(4%, -5%) scale(1.1);} }
@keyframes drift4 { 0%,100%{ transform: translate(0,0) scale(1);} 50%{ transform: translate(7%, -3%) scale(1.06);} }

.bg-grain {
  position: absolute; inset: -10%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  opacity: var(--grain-op);
  mix-blend-mode: overlay;
  will-change: transform;
}
[data-theme="light"] .bg-grain { mix-blend-mode: multiply; }

/* soft light that follows the cursor */
.bg-glow {
  position: absolute; top: 0; left: 0;
  width: 46vmax; height: 46vmax;
  margin: -23vmax 0 0 -23vmax;        /* center on the pointer coords */
  border-radius: 50%;
  background: radial-gradient(circle at center,
              color-mix(in oklab, var(--accent) 80%, transparent) 0%,
              color-mix(in oklab, var(--accent) 30%, transparent) 30%,
              transparent 64%);
  opacity: var(--glow-op, 0.22);
  filter: blur(36px);
  will-change: transform;
  transform: translate3d(-50vw, -50vh, 0);
  transition: opacity .6s var(--ease);
}
[data-theme="light"] .bg-glow { --glow-op: 0.30; mix-blend-mode: multiply; }
@media (hover: none) { .bg-glow { display: none; } }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
::selection { background: var(--accent-tint); color: var(--ink); }

/* ---- Type primitives ---- */
.display {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.015em;
  font-optical-sizing: auto;
}
.display em { font-style: italic; font-weight: 300; }

/* when headlines switch to the grotesque via Tweaks */
.sans-display .display { font-weight: 600; letter-spacing: -0.035em; line-height: 0.95; }
.sans-display .display em { font-weight: 500; font-style: normal; color: var(--accent-deep); }

.eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.serif-lead {
  font-family: var(--serif);
  font-weight: 300;
  line-height: 1.32;
  letter-spacing: -0.01em;
}

/* ---- Layout ---- */
.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section-pad); }

/* ============================================================
   Cursor dot
   ============================================================ */
.cursor {
  position: fixed; top: 0; left: 0;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width .25s var(--ease), height .25s var(--ease), background .25s var(--ease), opacity .3s;
  mix-blend-mode: multiply;
}
.cursor.hover { width: 46px; height: 46px; background: var(--accent-tint); }
[data-theme="dark"] .cursor { mix-blend-mode: normal; }
[data-theme="dark"] .cursor.hover { background: color-mix(in oklab, var(--accent) 32%, transparent); }
@media (hover: none) { .cursor { display: none; } }

/* ============================================================
   Nav
   ============================================================ */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--gutter);
  transition: background .4s var(--ease), padding .4s var(--ease), border-color .4s;
  border-bottom: 1px solid var(--line);
}
.nav.scrolled {
  background: color-mix(in oklab, var(--paper) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  padding-block: 15px;
  border-color: var(--line);
}
.brand {
  display: flex; align-items: baseline; gap: 11px;
  font-family: var(--sans); font-weight: 600; letter-spacing: -0.01em; font-size: 16px;
}
.brand .mark {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); align-self: center;
}
.nav-links { display: flex; align-items: center; gap: 38px; }
.nav-links a {
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  position: relative; padding-block: 4px;
}
.nav-links a::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 1px; width: 0;
  background: var(--accent); transition: width .35s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { width: 100%; }
.nav-cta {
  font-size: 14px; font-weight: 600;
  border: 1px solid var(--ink); border-radius: 100px;
  padding: 9px 20px; color: var(--ink);
  transition: background .3s var(--ease), color .3s var(--ease);
}
.nav-cta:hover { background: var(--ink); color: var(--paper); }

/* theme toggle */
.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--ink-2);
  transition: border-color .3s var(--ease), color .3s var(--ease), transform .5s var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); transform: rotate(18deg); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .ic-sun { display: none; }
.theme-toggle .ic-moon { display: block; }
[data-theme="dark"] .theme-toggle .ic-sun { display: block; }
[data-theme="dark"] .theme-toggle .ic-moon { display: none; }
.nav-right { display: flex; align-items: center; gap: 16px; }

/* mobile menu toggle — subtle bordered button, matches the theme toggle stroke */
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  height: 38px; padding: 0 17px;
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 100px;
  background: transparent;
  transition: border-color .3s var(--ease), color .3s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle:hover { border-color: var(--accent); color: var(--accent); }
.nav-toggle[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }

/* mobile menu sheet */
.nav-sheet {
  display: none;
  position: fixed; inset: 0; z-index: 99;
  height: 100svh;
  flex-direction: column;
  align-items: center; justify-content: center;
  gap: clamp(8px, 3.2svh, 30px);
  padding: calc(env(safe-area-inset-top, 0px) + 78px) var(--gutter)
           calc(env(safe-area-inset-bottom, 0px) + 40px);
  background: color-mix(in oklab, var(--paper) 96%, transparent);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  opacity: 0; visibility: hidden;
  transition: opacity .32s var(--ease), visibility .32s var(--ease);
  pointer-events: none;
}
.nav-sheet.open { opacity: 1; visibility: visible; pointer-events: auto; }
.nav-sheet a {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(30px, 6.4svh, 42px); line-height: 1; letter-spacing: -0.015em;
  color: var(--ink); text-align: center;
  opacity: 0; transform: translateY(10px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.nav-sheet.open a { opacity: 1; transform: none; }
.nav-sheet.open a:nth-child(1) { transition-delay: .04s; }
.nav-sheet.open a:nth-child(2) { transition-delay: .10s; }
.nav-sheet.open a:nth-child(3) { transition-delay: .16s; }
.nav-sheet.open a:nth-child(4) { transition-delay: .22s; }
.nav-sheet.open a:nth-child(5) { transition-delay: .28s; }
/* quiet contact footer pinned to the bottom of the sheet */
.nav-sheet .sheet-foot {
  position: absolute; left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 34px);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  opacity: 0; transform: translateY(10px);
  transition: opacity .5s var(--ease) .36s, transform .5s var(--ease) .36s;
}
.nav-sheet.open .sheet-foot { opacity: 1; transform: none; }
.nav-sheet .sf-k {
  font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3);
}
.nav-sheet .sf-mail {
  font-family: var(--sans); font-size: 16px; font-weight: 600;
  color: var(--ink); opacity: 1; transform: none; transition: color .3s var(--ease);
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
}
.nav-sheet .sf-mail .a { color: var(--accent); margin-right: 2px; }
.nav-sheet .sf-mail:hover { color: var(--accent); }

@media (max-width: 820px) {
  .nav-links { display: none; }
  .nav-cta { display: none; }
  .nav-right { gap: 12px; }
  .nav {
    padding: 13px var(--gutter);
    /* persistent faint backdrop so the bar + line read clearly over the hero */
    background: color-mix(in oklab, var(--paper) 72%, transparent);
    backdrop-filter: blur(10px) saturate(1.1);
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
  }
  .nav.scrolled { padding-block: 13px; }
  .nav-toggle { display: inline-flex; }
  .nav-sheet { display: flex; }
  .brand { gap: 9px; font-size: 15.5px; }
  .brand .mark { width: 8px; height: 8px; }
}
@media (max-width: 380px) {
  .nav { padding-inline: 18px; }
  .brand { font-size: 14.5px; }
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding-top: 90px; position: relative;
}

.hero h1 {
  font-size: clamp(46px, 7.6vw, 100px);
  margin-bottom: clamp(26px, 4.5vh, 44px);
  text-wrap: balance;
}
.hero h1 .l { display: block; }
.hero h1 .l > span { display: inline; }
.hero h1 em { color: var(--accent); }

/* Big screens: let the hero breathe wider and scale the headline up for impact.
   Everything below 1440px is unchanged. Sizes are capped so the longest line
   ("Designing experiences") never overflows its column. */
@media (min-width: 1440px) {
  .hero { max-width: min(1760px, 94vw); }
  .hero h1 {
    font-size: clamp(108px, 8vw, 156px);
    margin-bottom: clamp(34px, 4.5vh, 56px);
  }
}

.hero-foot {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 40px; flex-wrap: wrap;
}
.hero-foot p {
  max-width: 46ch; font-size: clamp(18px, 2vw, 22px);
  color: var(--ink-2); line-height: 1.5;
}
.hero-foot p strong { font-weight: 500; color: var(--ink); }
.scroll-hint {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.scroll-hint .arrow {
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%;
  display: grid; place-items: center;
  animation: bob 2.4s var(--ease) infinite;
}
@keyframes bob { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(5px);} }

/* ============================================================
   Marquee strip
   ============================================================ */
.strip {
  border-block: 1px solid var(--line);
  background: var(--paper-2);
  overflow: hidden; padding-block: 20px;
  margin-block: clamp(48px, 9vh, 110px);
}
.strip-track {
  display: flex; gap: 60px; width: max-content;
  animation: scroll-x 38s linear infinite;
  font-family: var(--serif); font-size: clamp(22px, 3vw, 34px); font-weight: 300;
  color: var(--ink-2);
}
.strip-track span { display: flex; align-items: center; gap: 60px; }
.strip-track .sep { color: var(--accent); font-style: italic; }
@keyframes scroll-x { to { transform: translateX(-50%); } }

/* ============================================================
   Section header
   ============================================================ */
.sec-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 40px; margin-bottom: clamp(40px, 6vh, 72px); flex-wrap: wrap;
}
.sec-head .left { display: flex; flex-direction: column; gap: 18px; }
.sec-head h2 {
  font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em;
  font-size: clamp(34px, 5vw, 64px); line-height: 1; max-width: 16ch;
}
.sec-head h2 em { font-style: italic; font-weight: 300; }
.sec-head h2.oneline { max-width: none; white-space: nowrap; }
.sec-head h2.accent-em em { color: var(--accent); }
@media (max-width: 560px) {
  .sec-head h2.oneline { white-space: normal; }
}
.sec-count { font-size: 14px; color: var(--muted); font-weight: 500; }
.sec-count b { color: var(--ink); font-weight: 600; }

/* ============================================================
   Work
   ============================================================ */
.work-list { display: flex; flex-direction: column; }
.work-item {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 28px; align-items: center;
  padding-block: clamp(26px, 4vh, 40px);
  position: relative; cursor: pointer;
  transition: padding-inline .5s var(--ease);
}
.work-item .idx { font-size: 13px; font-weight: 600; color: var(--faint); letter-spacing: 0.05em; transition: color .35s var(--ease), transform .45s var(--ease); }
.work-item .meta { display: flex; flex-direction: column; gap: 9px; transition: transform .45s var(--ease); }
.work-item .meta h3 {
  font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em;
  font-size: clamp(28px, 4.4vw, 52px); line-height: 1; transition: color .35s var(--ease);
}
.work-item .tags { display: flex; gap: 8px; flex-wrap: wrap; }
.work-item .tags span {
  font-size: 12px; font-weight: 500; color: var(--muted);
  border: 1px solid var(--line); border-radius: 100px; padding: 4px 12px;
  transition: border-color .35s var(--ease), color .35s var(--ease);
}
.work-item .year { font-size: 14px; font-weight: 500; color: var(--muted); justify-self: end; }
.work-item .go {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%) translateX(8px);
  width: 52px; height: 52px; border-radius: 50%; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; opacity: 0;
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.work-item:hover { background: transparent; }
.work-item:hover .meta { transform: translateX(14px); }
.work-item:hover .idx { color: var(--accent); transform: translateX(4px); }
.work-item:hover .meta h3 { color: var(--accent-deep); }
.work-item:hover .tags span { border-color: var(--accent-tint); color: var(--ink-2); }
.work-item:hover .year { opacity: 0; }
.work-item:hover .go { opacity: 1; transform: translateY(-50%) translateX(0); }

/* preview thumb that follows cursor */
.work-preview {
  position: fixed; z-index: 80; width: 320px; height: 220px;
  border-radius: 10px; overflow: hidden; pointer-events: none;
  opacity: 0; transform: translate(-50%, -50%) scale(0.92);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
  box-shadow: 0 30px 60px -20px oklch(0.3 0.02 60 / 0.35);
}
.work-preview.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ============================================================
   Placeholder visual (striped)
   ============================================================ */
.ph {
  position: relative; width: 100%; height: 100%;
  background:
    repeating-linear-gradient(135deg,
      var(--paper-2) 0, var(--paper-2) 11px,
      var(--paper-3) 11px, var(--paper-3) 22px);
  display: grid; place-items: center; overflow: hidden;
}
.ph::after {
  content: attr(data-label);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
  background: var(--paper); padding: 6px 12px; border-radius: 100px;
  border: 1px solid var(--line);
}

/* ============================================================
   About
   ============================================================ */
.about { background: var(--paper-2); border-block: 1px solid var(--line); }
.about-grid {
  display: grid; grid-template-columns: 0.85fr 1.15fr; gap: clamp(40px, 7vw, 110px);
  align-items: start;
}
.about-portrait {
  aspect-ratio: 4/5; border-radius: 8px; overflow: hidden;
  position: sticky; top: 110px;
}
.about-portrait img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 18%;
  mix-blend-mode: normal;
}
.about-body .serif-lead {
  font-size: clamp(24px, 3.2vw, 38px); margin-bottom: 40px; color: var(--ink);
}
.about-body .serif-lead em { color: var(--accent-deep); }
.about-body p {
  font-size: 17px; color: var(--ink-2); max-width: 52ch; margin-bottom: 20px;
}
.about-facts {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px 40px;
  margin-top: 52px; padding-top: 40px; border-top: 1px solid var(--line);
}
.about-facts .f .k { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); margin-bottom: 7px; }
.about-facts .f .v { font-size: 16px; color: var(--ink); font-weight: 500; }
.about-facts .f .v span { display: block; color: var(--muted); font-weight: 400; font-size: 14px; }

/* ============================================================
   Services
   ============================================================ */
.svc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.svc {
  background: var(--paper); padding: clamp(28px, 3vw, 44px);
  display: flex; flex-direction: column; gap: 16px; min-height: 280px;
  transition: background .4s var(--ease);
}
.svc:hover { background: var(--paper-2); }
.svc .num { font-family: var(--serif); font-size: 30px; color: var(--accent); font-style: italic; font-weight: 300; }
.svc h3 { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.svc p { font-size: 15px; color: var(--muted); line-height: 1.55; }
.svc .skills { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.svc .skills span { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.svc .skills span:not(:last-child)::after { content: '·'; margin-left: 6px; color: var(--faint); }

/* ============================================================
   Experience
   ============================================================ */
.exp-list { display: flex; flex-direction: column; }
.exp-row {
  display: grid; grid-template-columns: 120px 1fr 1fr; gap: 30px; align-items: baseline;
  padding-block: 28px; border-top: 1px solid var(--line);
}
.exp-row:last-child { border-bottom: 1px solid var(--line); }
.exp-row .yr { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0.03em; }
.exp-row .role { font-family: var(--serif); font-size: clamp(22px, 2.6vw, 30px); font-weight: 400; letter-spacing: -0.01em; }
.exp-row .org { font-size: 15px; color: var(--ink-2); }
.exp-row .org span { color: var(--muted); display: block; font-size: 14px; margin-top: 5px; max-width: 40ch; }
.org-link {
  color: inherit; position: relative;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1px; background-position: 0 100%; background-repeat: no-repeat;
  transition: background-size .35s var(--ease), color .35s var(--ease);
}
.org-link:hover { color: var(--accent); background-size: 100% 1px; }
.org-link.is-accent { color: var(--accent); }

/* ============================================================
   Contact
   ============================================================ */
.contact { background: var(--feature-bg); color: var(--feature-fg); border: none; transition: background .5s var(--ease); }
.contact .eyebrow { color: var(--feature-muted); }
.contact h2 {
  font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em;
  font-size: clamp(44px, 9vw, 130px); line-height: 0.95; margin-block: 22px 44px;
  color: var(--feature-fg);
}
.contact h2 em { font-style: italic; font-weight: 300; color: var(--feature-accent); }
.contact-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.mail-link {
  font-family: var(--serif); font-size: clamp(22px, 3.5vw, 40px); font-weight: 300;
  display: inline-flex; align-items: center; gap: 16px; color: var(--feature-fg);
  border-bottom: 1px solid var(--feature-line); padding-bottom: 8px;
  transition: border-color .4s var(--ease), gap .4s var(--ease);
}
.mail-link:hover { border-color: var(--feature-accent); gap: 24px; }
.mail-link .a { color: var(--feature-accent); }
.socials { display: flex; gap: 26px; }
.socials a {
  font-size: 14px; font-weight: 500; color: var(--feature-muted);
  position: relative; padding-bottom: 3px;
}
.socials a::after { content:''; position:absolute; left:0; bottom:0; height:1px; width:0; background: var(--feature-accent); transition: width .35s var(--ease); }
.socials a:hover { color: var(--feature-fg); }
.socials a:hover::after { width: 100%; }

/* footer */
.foot {
  background: var(--feature-bg); color: var(--feature-muted);
  border-top: 1px solid var(--feature-line);
  padding: 30px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  font-size: 13px;
  transition: background .5s var(--ease);
}
.foot .clock { font-variant-numeric: tabular-nums; }

/* ============================================================
   Work overlay (case study)
   ============================================================ */
/* ============================================================
   Dissolve page transition (tile mosaic)
   ============================================================ */
.dissolve {
  position: fixed; inset: 0; z-index: 2000;
  display: grid; pointer-events: none;
}
.dtile {
  background: var(--paper);
  opacity: 0;
  transition: opacity .3s ease;
  box-shadow: 0 0 0 1px var(--paper);   /* hides sub-pixel seams */
}
.dissolve.cover .dtile { opacity: 1; }

/* ============================================================
   Work overlay (case study)
   ============================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--paper); overflow-y: auto;
  opacity: 0; visibility: hidden;
  /* No fade/slide of its own — the case study is swapped while the curtain
     fully covers the screen, so it just appears underneath. The curtain wipe
     is the only motion in the redirect. */
}
.overlay.open { opacity: 1; visibility: visible; }
.overlay-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--gutter);
  background: color-mix(in oklab, var(--paper) 85%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.overlay-bar .crumb { font-size: 13px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.overlay-bar .crumb b { color: var(--ink); }
.close-btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 600;
  border: 1px solid var(--ink); border-radius: 100px; padding: 8px 18px;
  transition: background .3s var(--ease), color .3s var(--ease);
}
.close-btn:hover { background: var(--ink); color: var(--paper); }

.cs-hero { padding-block: clamp(50px, 9vh, 110px) clamp(36px, 5vh, 60px); }
.cs-hero .eyebrow { margin-bottom: 22px; }
.cs-hero h1 {
  font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em;
  font-size: clamp(40px, 8vw, 104px); line-height: 0.96; max-width: 14ch; margin-bottom: 34px;
}
.cs-hero h1 em { font-style: italic; font-weight: 300; color: var(--accent-deep); }
.cs-summary { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(30px, 6vw, 80px); align-items: start; }
.cs-summary > p { font-size: clamp(18px, 2.1vw, 24px); color: var(--ink-2); line-height: 1.5; font-family: var(--serif); font-weight: 300; }
.cs-facts { display: grid; gap: 22px; }
.cs-facts .f { display: grid; gap: 5px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.cs-facts .f .k { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.cs-facts .f .v { font-size: 16px; color: var(--ink); font-weight: 500; }

.cs-cover { aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; margin-block: clamp(40px, 6vh, 70px); }
.cs-body { display: grid; grid-template-columns: 1fr; gap: clamp(40px, 6vh, 64px); padding-bottom: clamp(60px, 9vh, 120px); }
.cs-block { display: grid; grid-template-columns: 0.6fr 1.4fr; gap: clamp(24px, 5vw, 70px); align-items: start; }
.cs-block h4 { font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.cs-block .txt p { font-size: 18px; color: var(--ink-2); margin-bottom: 16px; max-width: 58ch; }
.cs-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cs-duo .ph { aspect-ratio: 4/3; border-radius: 8px; }
.cs-single .ph { aspect-ratio: 16/8; border-radius: 8px; }
.cs-next {
  border-top: 1px solid var(--line); padding-block: 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  cursor: pointer; transition: padding-inline .5s var(--ease);
}
.cs-next:hover { padding-inline: 8px; }
.cs-next .lbl { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.cs-next h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 4vw, 48px); letter-spacing: -0.015em; transition: color .35s; }
.cs-next:hover h3 { color: var(--accent-deep); }

/* ============================================================
   Reveal animations
   ============================================================ */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: .08s; }
.reveal-d2 { transition-delay: .16s; }
.reveal-d3 { transition-delay: .24s; }

.hero h1 .l { opacity: 0; transform: translateY(34px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.hero.ready h1 .l { opacity: 1; transform: none; }
.hero.ready h1 .l:nth-child(2) { transition-delay: .1s; }
.hero.ready h1 .l:nth-child(3) { transition-delay: .2s; }
.hero .hero-foot { opacity: 0; transform: translateY(18px); transition: opacity 1s var(--ease) .5s, transform 1s var(--ease) .5s; }
.hero.ready .hero-foot { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .hero h1 .l { opacity: 1; transform: none; }
  .hero .hero-foot { opacity: 1; transform: none; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-portrait { position: relative; top: 0; max-width: 380px; }
  .svc-grid { grid-template-columns: 1fr 1fr; }
  .cs-summary { grid-template-columns: 1fr; }
  .cs-block { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 680px) {
  body { font-size: 16px; }
  .work-item { grid-template-columns: 32px 1fr; }
  .work-item .year { display: none; }
  .work-item .go { display: none; }
  .svc-grid { grid-template-columns: 1fr; }
  .about-facts { grid-template-columns: 1fr; }
  .exp-row { grid-template-columns: 70px 1fr; }
  .exp-row .org { grid-column: 2; }
  .cs-duo { grid-template-columns: 1fr; }
  .hero-foot { gap: 28px; }
  .scroll-hint { display: none; }
}
@media (max-width: 560px) {
  /* Hero: smaller, denser heading that scales down instead of overflowing.
     Top-align so the headline sits close to the nav (no big centered gap),
     and drop text-wrap:balance — Safari mis-measures the nested line spans
     and clips a glyph ("experiences"). */
  .hero { padding-top: 104px; padding-bottom: 40px; min-height: auto; justify-content: flex-start; }
  .hero h1 {
    font-size: clamp(28px, 8.7vw, 54px);
    line-height: 1.06;
    letter-spacing: -0.02em;
    margin-bottom: 26px;
    text-wrap: normal;
  }
  .hero-foot { gap: 22px; }
  .hero-foot p { font-size: 17px; line-height: 1.45; }
  /* tighter gap between hero and the marquee strip on small screens */
  .strip { margin-block: clamp(28px, 5vh, 46px); }
  /* match the gap below the strip to the gap above it */
  #work.section { padding-top: clamp(28px, 5vh, 46px); }
}
