/* ---------- Tokens ---------- */
:root {
  --bg: #050608;
  --line: #2b2b2b;
  --heading: #e5e5e5;
  --text: #ffffff;
  --bio: #b9b9b9;
  --media: #111318;
  --brand: #ff7a36;
  --mark: #ff6a1a;          /* orange highlighter */
  --mark-ink: #050608;
  --badge-bg: rgba(60, 255, 89, .18);
  --badge-ink: #80ff92;
  --dim: .28;

  --ill-navy: #cadcfc;
  --ill-orange: #ff6a1a;
  --ill-blue: #cadcfc;
  color-scheme: dark;

  --serif: "Libre Baskerville", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --ease: cubic-bezier(.215, .61, .355, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--mark); color: var(--mark-ink); }
.ill { display: inline-block; width: 28px; height: 28px; flex-shrink: 0; }
.ill svg { width: 100%; height: 100%; overflow: visible; }

.shell { display: flex; min-height: 100dvh; }

/* ---------- Sticky bio column ---------- */
.side {
  flex-shrink: 0; width: 45.1%; max-width: 835px;
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  scrollbar-width: none;
}
.side::-webkit-scrollbar { display: none; }
.side-inner {
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
  min-height: 100%; padding: 44px 48px 30px;
}
.intro { max-width: 553px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

.side-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; width: 100%; margin-bottom: 20px; }
.nav { display: flex; gap: 24px; }
.nav a { font-size: 16px; color: var(--bio); transition: color .15s; }
.nav a:hover, .nav a[aria-current] { color: var(--text); }
.sound-toggle { white-space: nowrap; padding: 0; border: 0; background: none; font: inherit; font-size: 16px; color: var(--bio); cursor: pointer; transition: color .15s; }
.sound-toggle:hover { color: var(--text); }
.avatar-row { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--media); }
.logo { font: 400 16px/1.2 var(--serif); color: var(--brand); white-space: nowrap; }
.logo span { white-space: nowrap; }


h1 { margin: 0; font: italic 400 24px/1.45 var(--serif); color: var(--heading); letter-spacing: -.005em; }

.badge {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 2px;
  padding: 8px 12px; border-radius: 52px; background: var(--badge-bg); color: var(--badge-ink);
  font-size: 16px; line-height: 1;
}
.pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 2s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.bio { margin-top: 12px; }
.bio p { margin: 0 0 16px; font-size: 20px; line-height: 1.51; letter-spacing: .005em; color: var(--bio); }
.bio a {
  color: var(--text);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
  text-decoration-color: transparent; transition: text-decoration-color .25s var(--ease);
}
.bio a:hover { text-decoration-color: currentColor; }
.bio strong { font-weight: 400; color: var(--text); }

/* Kind words list (mirrors the "Side Projects" list) */
.list { max-width: 553px; }
.list h2 {
  display: flex; align-items: center; gap: 10px;
  margin: 0; padding-bottom: 14px; font: 400 20px/1.5 var(--sans); color: var(--bio);
}
.list ul { list-style: none; margin: 0; padding: 0; }
.list li { padding: 16px 0; border-top: 1px solid var(--line); }
.list li p { margin: 0 0 8px; font-size: 17px; line-height: 1.5; color: var(--text); }
.list li span { font-size: 15px; color: var(--bio); }
.list li b { font-weight: 500; color: var(--text); }

/* ---------- Work feed ---------- */
.feed {
  flex: 1; min-width: 0; border-left: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 68px; padding: 48px;
}
.project { display: flex; flex-direction: column; gap: 25px; opacity: var(--dim); transition: opacity .5s var(--ease); }
.project.active { opacity: 1; }
.project header { display: flex; flex-direction: column; gap: 2px; font-size: 21px; line-height: 1.3; }
.project h2 { margin: 0; font: 500 21px/1.3 var(--sans); color: var(--heading); }
.project h2 a { transition: color .15s; }
.project h2 a:hover { color: var(--brand); }
.project header p { margin: 0; color: var(--bio); max-width: 34em; }

/* Highlighter: sweeps in when the project becomes active */
mark { position: relative; display: inline-block; padding: 0 .18em; background: none; color: inherit; }
mark::before {
  content: ""; position: absolute; inset: -.04em 0; background: var(--mark);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform .6s var(--ease) .15s;
}
mark span { position: relative; transition: color .3s var(--ease) .25s; }
.project.active mark::before { transform: scaleX(1); }
.project.active mark span { color: var(--mark-ink); }

.media { display: block; position: relative; overflow: hidden; background: var(--media); aspect-ratio: 16 / 9; }
.media img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .8s var(--ease); }
.media:hover img { transform: scale(1.02); }
/* Show the whole image instead of cropping it to 16:9 (for mockups with content near the edges) */
.media.media-fit { aspect-ratio: auto; }
.media.media-fit img { height: auto; }


.contact { padding-bottom: 8px; }
.contact .ill { width: 56px; height: 56px; }
.contact h2 { font: italic 400 clamp(28px, 3vw, 40px)/1.15 var(--serif); }
.channels { border-top: 1px solid var(--line); }
.channels a {
  display: flex; justify-content: space-between; gap: 16px; padding: 16px 0;
  border-bottom: 1px solid var(--line); font-size: 18px; color: var(--text); transition: padding .3s var(--ease), color .15s;
}
.channels a span { color: var(--bio); }
.channels a:hover { padding-left: 8px; color: var(--brand); }
.contact footer { font-size: 14px; color: var(--bio); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Stacked layout ---------- */
@media (max-width: 1023px) {
  .shell { flex-direction: column; }
  .side { position: static; width: 100%; max-width: none; height: auto; overflow: visible; }
  .side-inner { padding: 32px 24px 40px; }
  .intro, .list { max-width: 640px; }
  .feed { border-left: 0; border-top: 1px solid var(--line); padding: 40px 24px; gap: 56px; }
  .bio p { font-size: 18px; }
  .project header, .project h2 { font-size: 18px; }
}
@media (max-width: 560px) {
  .channels a { flex-direction: column; gap: 2px; }
}

/* ---------- Case study pages ---------- */
.back { display: inline-block; margin-bottom: 14px; font-size: 15px; color: var(--bio); transition: color .15s; }
.back:hover { color: var(--text); }

.badge-tag { background: rgba(202, 220, 252, .1); color: var(--ill-blue); font-size: 14px; padding: 6px 12px; margin: 0 0 6px; }
.summary { margin: 8px 0 0; font-size: 20px; line-height: 1.51; color: var(--bio); }
.summary.active mark::before { transform: scaleX(1); }
.summary.active mark span { color: var(--mark-ink); }

.facts { width: 100%; margin: 24px 0 0; border-top: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.facts dt { color: var(--bio); }
.facts dd { margin: 0; color: var(--text); }

.side-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: 15px; font-weight: 500; transition: opacity .15s;
}
.btn:hover { opacity: .85; }

.toc ul { counter-reset: toc; }
.toc li { padding: 0; }
.toc a {
  display: flex; gap: 12px; padding: 11px 0; font-size: 16px; line-height: 1.4; color: var(--bio);
  transition: color .2s;
}
.toc a::before {
  counter-increment: toc; content: counter(toc, decimal-leading-zero);
  flex-shrink: 0; width: 22px; font-size: 13px; padding-top: 2px; color: var(--line); transition: color .2s;
}
.toc a:hover { color: var(--text); }
.toc a[aria-current] { color: var(--text); }
.toc a[aria-current]::before { color: var(--mark); }

/* Right column */
.case { gap: 56px; }
.hero { margin: 0; aspect-ratio: auto; background: var(--media); }
.hero img { width: 100%; height: auto; }
.prose { display: flex; flex-direction: column; gap: 72px; }
.prose section { scroll-margin-top: 32px; }
.prose h2 { margin: 0 0 16px; font: 500 21px/1.3 var(--sans); color: var(--heading); max-width: 34em; }
.prose h3 { margin: 32px 0 12px; font: 500 18px/1.4 var(--sans); color: var(--heading); }
.prose p, .prose li { font-size: 18px; line-height: 1.6; color: var(--bio); max-width: 40em; }
.prose p { margin: 0 0 16px; }
.prose strong { font-weight: 500; color: var(--text); }
.prose ul { margin: 0 0 16px; padding: 0; list-style: none; }
.prose li { position: relative; padding-left: 22px; margin-bottom: 12px; }
.prose li:last-child { margin-bottom: 0; }
.prose li::before { content: ""; position: absolute; left: 2px; top: .68em; width: 8px; height: 1px; background: var(--mark); }

.prose figure { margin: 28px 0; }
.prose figure img, .prose figure video { width: 100%; height: auto; display: block; background: var(--media); }
/* One rhythm for every case study: headings sit a fixed distance above whatever follows,
   and the last element in a section never adds space on top of the gap between sections */
.prose :is(h2, h3) + * { margin-top: 0; }
.prose section > :last-child { margin-bottom: 0; }
.prose figcaption { margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--bio); max-width: 46em; }

.tldr { margin: 28px 0; padding: 22px 24px; background: var(--media); border-left: 2px solid var(--mark); }
.tldr-label { display: block; margin-bottom: 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--mark); }
.prose .tldr p { margin: 0; color: var(--text); opacity: .88; }

.prose .pull { font: italic 400 22px/1.45 var(--serif); color: var(--heading); margin: 28px 0; }
.prose .intent { margin: 28px 0; display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text); }
.intent span { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--mark); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; margin: 28px 0; background: var(--line); border: 1px solid var(--line); }
.stats div { background: var(--bg); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.stats b { font: italic 400 34px/1.1 var(--serif); color: var(--heading); }
.stats span { font-size: 15px; line-height: 1.45; color: var(--bio); }

.next {
  display: grid; grid-template-columns: 1fr 200px; grid-template-rows: auto 1fr; column-gap: 24px; row-gap: 6px;
  padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.next-label { font-size: 15px; color: var(--bio); }
.next-title { grid-column: 1; font: 500 24px/1.3 var(--sans); color: var(--heading); transition: color .15s; }
.next:hover .next-title { color: var(--brand); }
.next-media { grid-column: 2; grid-row: 1 / 3; aspect-ratio: 16 / 10; overflow: hidden; background: var(--media); }
.next-media img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .8s var(--ease); }
.next:hover .next-media img { transform: scale(1.04); }

@media (max-width: 1023px) {
  .toc { display: none; }
  .summary { font-size: 18px; }
  .prose p, .prose li { font-size: 17px; }
  .prose { gap: 56px; }
}
@media (max-width: 560px) {
  .next { grid-template-columns: 1fr; }
  .next-media { grid-column: 1; grid-row: auto; margin-top: 12px; }
  .facts div { grid-template-columns: 90px 1fr; }
}

/* ---------- Playground ---------- */
.work-links li { padding: 0; }
.work-links a { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; font-size: 17px; color: var(--text); transition: color .15s, padding .3s var(--ease); }
.work-links a span { color: var(--bio); }
.work-links a:hover { color: var(--brand); padding-left: 6px; }

.gallery { columns: 2; column-gap: 12px; }
.tile {
  display: block; width: 100%; margin: 0 0 12px; padding: 0; border: 0; cursor: zoom-in;
  break-inside: avoid; overflow: hidden; background: var(--media);
}
.tile img, .tile video { display: block; width: 100%; height: auto; transition: transform .8s var(--ease), opacity .3s; }
.tile:hover img, .tile:hover video { transform: scale(1.03); }
.tile:focus-visible { outline: 2px solid var(--mark); outline-offset: 3px; }

.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(5, 6, 8, .94); color: var(--text);
}
.lightbox::backdrop { background: transparent; }
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 32px; }
.lightbox-stage img, .lightbox-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-bar { display: flex; justify-content: space-between; align-items: center; padding: 0 32px 24px; font-size: 15px; color: var(--bio); }
.lightbox-bar button {
  margin-left: 4px; height: 36px; min-width: 36px; padding: 0 14px; border: 0; border-radius: 999px;
  background: var(--line); color: var(--text); font: inherit; cursor: pointer; transition: background .15s;
}
.lightbox-bar button:hover { background: #3a3a3a; }

@media (max-width: 560px) {
  .gallery { columns: 1; }
  .lightbox-stage { padding: 16px; }
  .lightbox-bar { padding: 0 16px 16px; }
}

/* Narrow phones: the nav drops to its own row under the name */
@media (max-width: 420px) {
  .side-top { flex-wrap: wrap; row-gap: 16px; }
  .nav { width: 100%; gap: 20px; }
}
