/* ---------- Tokens ---------- */
:root {
  --paper: #EEEAE2;
  --paper-2: #E5E0D5;
  --card: #F7F4EE;
  --ink: #141413;
  --ink-2: #3A3936;
  --muted: #6E6B64;
  --line: rgba(20, 20, 19, .14);

  --cobalt: #3A5BD9;
  --sun: #EFC34F;
  --tomato: #E5583B;
  --violet: #A797F2;
  --green: #2E8A57;
  --black: #161615;

  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 22px;
  --nav-h: 76px;
  --tab-h: 44px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151513;
    --paper-2: #1E1D1A;
    --card: #1E1D1A;
    --ink: #F1EDE4;
    --ink-2: #CFCAC0;
    --muted: #9A958B;
    --line: rgba(241, 237, 228, .14);
    --black: #050505;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #151513;
  --paper-2: #1E1D1A;
  --card: #1E1D1A;
  --ink: #F1EDE4;
  --ink-2: #CFCAC0;
  --muted: #9A958B;
  --line: rgba(241, 237, 228, .14);
  --black: #050505;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 8px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg { display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.025em; line-height: 1.02; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: var(--muted); }
:focus-visible { outline: 2.5px solid var(--cobalt); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 10px;
}
.skip:focus { top: 12px; }

/* ---------- Buttons & pills ---------- */
.pill {
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border-radius: 999px; border: 1.5px solid transparent;
  font: 600 15px/1 var(--body); text-decoration: none;
  transition: transform .2s var(--ease), background-color .2s, color .2s;
}
.btn:active { transform: scale(.97); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-line { border-color: var(--ink); color: var(--ink); }
.btn-paper { background: #F1EDE4; color: #141413; }
.btn-ghost { border-color: rgba(241, 237, 228, .5); color: #F1EDE4; }
@media (hover: hover) {
  .btn-ink:hover { background: var(--ink-2); }
  .btn-line:hover { background: var(--ink); color: var(--paper); }
  .btn-ghost:hover { background: rgba(241, 237, 228, .1); }
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 clamp(16px, 3vw, 28px);
  background: linear-gradient(var(--paper) 55%, transparent);
}
.nav-name {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 5px 16px 5px 5px; font: 700 15px/1 var(--display); text-decoration: none;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--paper);
  font: 600 11px/1 var(--mono); letter-spacing: .04em;
}
.nav-links { display: flex; gap: 4px; padding: 4px; }
.nav-links a {
  padding: 8px 14px; border-radius: 999px; text-decoration: none;
  font: 500 14px/1 var(--body); transition: background-color .15s;
}
@media (hover: hover) { .nav-links a:hover { background: var(--paper-2); } }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-actions .btn { min-height: 42px; }
.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center;
  color: var(--ink); cursor: pointer; transition: transform .3s var(--ease);
}
.icon-btn:active { transform: scale(.94) rotate(20deg); }

@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-name { padding-right: 12px; }
}
@media (max-width: 420px) {
  .nav-name span:last-child { display: none; }
  .nav-name { padding: 4px; }
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 40px) 16px 72px;
}
.hello {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 14px/1 var(--mono); letter-spacing: .02em;
  padding: 8px 14px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line);
  margin-bottom: 28px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; flex: none; }
.hello .dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 25%, transparent); }

.hero-title {
  font-size: clamp(44px, 9vw, 112px);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1.12;
  max-width: 13ch;
}
@media (min-width: 900px) { .hero-title { max-width: none; } }
.br-lg { display: none; }
@media (min-width: 900px) { .br-lg { display: block; } }

.chip {
  display: inline-block;
  padding: .02em .22em .1em;
  margin: .06em .02em;
  border-radius: .16em;
  transform: rotate(var(--r, 0deg));
  line-height: 1;
}
.c-cobalt { background: var(--cobalt); color: #F7F4EE; }
.c-paper { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.c-tomato { background: var(--tomato); color: #F7F4EE; }
.c-sun { background: var(--sun); color: #141413; }

.hero-lede {
  max-width: 58ch; margin-top: 32px;
  font-size: clamp(17px, 1.6vw, 19px); color: var(--ink-2);
  text-wrap: pretty;
}
.hero-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 30px; }
.hero-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 44px; }
.hero-tags li {
  font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 8px 12px; border-radius: 999px; border: 1px dashed var(--line); color: var(--muted);
}

/* Hero entrance */
@media (prefers-reduced-motion: no-preference) {
  .hero > * { animation: rise .8s var(--ease) both; }
  .hero > :nth-child(2) { animation-delay: .06s; }
  .hero > :nth-child(3) { animation-delay: .14s; }
  .hero > :nth-child(4) { animation-delay: .2s; }
  .hero > :nth-child(5) { animation-delay: .26s; }
  .hero-title .chip { animation: pop .7s var(--ease) both; }
  .hero-title .chip:nth-of-type(2) { animation-delay: .08s; }
  .hero-title .chip:nth-of-type(3) { animation-delay: .16s; }
  .hero-title .chip:nth-of-type(4) { animation-delay: .24s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop { from { opacity: 0; transform: translateY(18px) rotate(calc(var(--r, 0deg) * -2)) scale(.94); } }

/* ---------- Sections ---------- */
section { padding-inline: clamp(16px, 3vw, 28px); }
.section-head {
  max-width: 1240px; margin: 0 auto 40px;
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px;
}
.section-title { font-size: clamp(38px, 6vw, 72px); font-weight: 800; letter-spacing: -.045em; }
.section-sub { max-width: 46ch; }
/* The highlight is a separate layer so it can sweep in when the heading is revealed. */
.mark {
  --mark-bg: var(--tomato); --mark-fg: #F7F4EE;
  position: relative; isolation: isolate;
  display: inline-block; padding: 0 .18em .06em; border-radius: .2em;
  color: var(--mark-fg); transform: rotate(-1.5deg);
  transition: color .5s var(--ease) .25s;
}
.mark::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--mark-bg); border-radius: inherit;
  transform-origin: left center;
  transition: transform .7s var(--ease) .15s;
}
.mark-sun { --mark-bg: var(--sun); --mark-fg: #141413; }
.mark-violet { --mark-bg: var(--violet); --mark-fg: #141413; }
@media (prefers-reduced-motion: no-preference) {
  .js .reveal:not(.in) .mark { color: var(--ink); }
  .js .reveal:not(.in) .mark::before { transform: scaleX(0); }
}

/* ---------- Work: stacked folders ---------- */
.work { padding-top: 40px; padding-bottom: 80px; }
.folders { max-width: 1240px; margin: 0 auto; }

/* Folders stick and stack. script.js sets --stick per folder: the nav line when the folder fits
   the screen, or higher (negative) when it's taller, so it only sticks once its bottom is in view.
   --cover (0–1) is how much of it the next folder has slid over; it shrinks and dims it. */
.folder {
  --tab-w: clamp(46px, calc((100% - 40px) / 6), 190px);
  --fg: #F7F4EE;
  --fg-muted: rgba(247, 244, 238, .74);
  --chip-bg: rgba(247, 244, 238, .14);
  position: sticky;
  top: var(--stick, calc(var(--nav-h) + 4px));
  margin-bottom: 64px;
  color: var(--fg);
  transform-origin: 50% 0;
  transform: scale(calc(1 - var(--cover, 0) * .06));
}
.folder-body { position: relative; }
.folder-body::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: #000; opacity: calc(var(--cover, 0) * .4);
}
.folder:last-child { margin-bottom: 0; }
.folder-tab {
  position: relative;
  height: var(--tab-h);
  width: var(--tab-w);
  margin-left: calc(var(--i) * (var(--tab-w) + 6px));
  display: flex; align-items: center; padding: 0 16px;
  background: var(--bg);
  border-radius: 14px 14px 0 0;
  white-space: nowrap; overflow: hidden;
}
/* slanted shoulder on the tab's right edge */
.folder-tab::after {
  content: ""; position: absolute; right: -22px; bottom: 0;
  width: 24px; height: 100%;
  background: var(--bg);
  clip-path: polygon(0 0, 30% 0, 100% 100%, 0 100%);
}
.folder-tab { overflow: visible; }
.folder-tab .mono { overflow: hidden; text-overflow: ellipsis; }

.folder-body {
  background: var(--bg);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  min-height: min(600px, calc(100svh - var(--nav-h) - var(--tab-h) - 24px));
  padding: clamp(24px, 4vw, 52px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(24px, 4vw, 56px); align-items: center;
  box-shadow: 0 -10px 40px -20px rgba(0, 0, 0, .35);
}
.folder[style*="--i:0"] .folder-body { border-top-left-radius: 0; }

.f-ink    { --bg: var(--black); }
.f-cobalt { --bg: var(--cobalt); }
.f-sun    { --bg: var(--sun);    --fg: #141413; --fg-muted: rgba(20,20,19,.72); --chip-bg: rgba(20,20,19,.08); }
.f-violet { --bg: var(--violet); --fg: #141413; --fg-muted: rgba(20,20,19,.72); --chip-bg: rgba(20,20,19,.08); }
.f-tomato { --bg: var(--tomato); }
.f-green  { --bg: var(--green); }

.kicker { display: flex; align-items: center; gap: 8px; color: var(--fg-muted); }
.kicker .dot { background: currentColor; }
.folder h3 {
  font-size: clamp(32px, 4.2vw, 58px); font-weight: 700; letter-spacing: -.04em;
  margin-top: 16px; text-wrap: balance;
}
.folder-desc { margin-top: 18px; color: var(--fg-muted); max-width: 46ch; text-wrap: pretty; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.stats li {
  font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 9px 12px; border-radius: 8px; background: var(--chip-bg); color: var(--fg-muted);
}
.stats b { color: var(--fg); font-weight: 600; }
.folder-link {
  display: inline-flex; gap: 6px; margin-top: 28px;
  font: 500 13px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  text-decoration: none; padding-bottom: 6px; border-bottom: 1.5px solid currentColor;
}
@media (hover: hover) {
  .folder-link span { transition: transform .2s var(--ease); display: inline-block; }
  .folder-link:hover span { transform: translate(2px, -2px); }
}

.folder-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 28px; }
.folder-links .folder-link { margin-top: 0; }
.folder-link-quiet { color: var(--fg-muted); border-bottom-color: transparent; }
@media (hover: hover) { .folder-link-quiet:hover { color: var(--fg); border-bottom-color: currentColor; } }

/* ---------- Real screenshots ---------- */
.shot {
  margin: 0; width: 100%;
  background: #0E1220; color: #ECE8DF;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .08);
  transform: rotate(1.2deg);
}
.folder:nth-child(even) .shot { transform: rotate(-1.2deg); }
.shot img { width: 100%; height: auto; }
/* Folder cards crop the shot to its left/top so the product, not the empty right edge, shows. */
.folder .shot img { aspect-ratio: 1.35; object-fit: cover; object-position: left top; }
.phone {
  margin: 0; width: min(270px, 70%);
  aspect-ratio: 9 / 18; border-radius: 34px; overflow: hidden;
  border: 8px solid #111; background: #111;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5);
  transform: rotate(-3deg);
}
.phone img { width: 100%; height: 100%; object-fit: cover; object-position: top; }

/* ---------- Visual frames ---------- */
.folder-visual { display: flex; justify-content: center; }
.device-card {
  margin: 0; width: 100%; max-width: 560px;
  background: #FFFFFF; border-radius: 18px; padding: 4% 3%;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .45);
  transform: rotate(-1.2deg);
}
.device-card img { width: 100%; height: auto; }
.screen-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 14px; border-bottom: 1px solid rgba(127, 127, 127, .18);
}
.screen-bar i { width: 9px; height: 9px; border-radius: 50%; background: rgba(127, 127, 127, .35); }
.screen-bar span { margin-left: 8px; font: 500 12px/1 var(--mono); opacity: .7; }

/* Folder responsiveness */
@media (max-width: 860px) {
  .folder-body { grid-template-columns: 1fr; min-height: 0; }
  .folder-visual { order: -1; }
}
@media (max-width: 640px) {
  /* Phones keep the stack: tabs show just their number so all six fit in a row. */
  .folder { margin-bottom: 40px; }
  .tab-name { display: none; }
  .folder-tab { padding: 0 0 0 12px; border-radius: 10px 10px 0 0; }
  .folder-tab::after { right: -12px; width: 14px; }
  .folder-body { padding: 22px 20px 26px; gap: 22px; }
  .shot, .folder:nth-child(even) .shot, .device-card { transform: none; }
  .phone { width: 62%; max-height: 420px; }
}
/* A stuck folder must fit the screen, or its bottom is hidden under the next one.
   So the scene shrinks with the viewport height instead of disappearing. */
@media (min-width: 861px) {
  .folder .scene { max-width: min(580px, calc((100svh - var(--nav-h) - var(--tab-h) - 90px) * 1.2)); }
}
@media (max-height: 800px) and (min-width: 861px) {
  .folder-body { padding: 28px 36px; min-height: calc(100svh - var(--nav-h) - var(--tab-h) - 16px); }
  .folder h3 { font-size: clamp(28px, 3.2vw, 44px); margin-top: 12px; }
  .folder-desc { margin-top: 12px; font-size: 16px; }
  .stats { margin-top: 16px; }
  .folder-links { margin-top: 18px; }
}

/* ---------- How I work ---------- */
.skills { padding-top: 100px; padding-bottom: 60px; }
.cards {
  max-width: 1240px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px;
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; min-height: 260px; display: flex; flex-direction: column;
}
.card-num { color: var(--muted); }
.card h3 { margin-top: auto; padding-top: 48px; font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.card p { margin-top: 10px; color: var(--muted); font-size: 15px; }
@media (max-width: 1000px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cards { grid-template-columns: 1fr; } .card { min-height: 0; } .card h3 { padding-top: 28px; } }

/* ---------- Timeline ---------- */
.timeline { padding-top: 80px; padding-bottom: 60px; }
.xp { max-width: 1240px; margin: 0 auto; border-top: 1.5px solid var(--ink); }
.xp li {
  display: grid; grid-template-columns: 1fr auto 140px; align-items: baseline; gap: 16px;
  padding: 22px 0; border-bottom: 1px solid var(--line);
}
.xp-co { font: 700 clamp(26px, 3.4vw, 40px)/1 var(--display); letter-spacing: -.035em; }
.xp-role, .xp-yr { color: var(--muted); }
.xp-yr { text-align: right; }
@media (max-width: 560px) {
  .xp li { grid-template-columns: 1fr auto; }
  .xp-role { grid-column: 1; grid-row: 2; }
  .xp-yr { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
}

/* ---------- Quotes ---------- */
.quotes { padding-top: 80px; padding-bottom: 60px; }
.quote-grid { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.quote { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 24px; }
.quote blockquote { margin: 0; font: 500 20px/1.4 var(--display); letter-spacing: -.01em; }
.quote figcaption { margin-top: auto; display: grid; gap: 4px; }
.quote figcaption .mono { color: var(--muted); }

/* ---------- Contact ---------- */
.contact {
  max-width: 1240px; margin: 80px auto 0;
  margin-inline: max(16px, calc((100% - 1240px) / 2));
  background: var(--black); color: #F1EDE4;
  border-radius: calc(var(--radius) + 8px);
  padding: clamp(40px, 8vw, 96px) clamp(20px, 5vw, 64px);
  text-align: center;
}
.contact h2 { font-size: clamp(36px, 6.4vw, 80px); font-weight: 800; letter-spacing: -.045em; line-height: 1.1; text-wrap: balance; }
.contact > p { max-width: 50ch; margin: 22px auto 0; color: rgba(241, 237, 228, .7); }
.socials { display: flex; justify-content: center; gap: 22px; margin-top: 36px; }
.socials a { font: 500 13px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: rgba(241, 237, 228, .7); text-decoration: none; }
@media (hover: hover) { .socials a:hover { color: #F1EDE4; } }

/* ---------- Footer ---------- */
.foot {
  max-width: 1240px; margin: 0 auto;
  display: flex; justify-content: space-between; gap: 16px;
  padding: 28px clamp(16px, 3vw, 28px) 40px; color: var(--muted);
}
.foot a { text-decoration: none; }

/* ---------- Reveal on scroll ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
  .js .reveal.in { opacity: 1; transform: none; }
}

/* =========================================================
   Case study pages (work/*.html)
   ========================================================= */
.cs { --accent: var(--cobalt); --accent-fg: #F7F4EE; }
.cs.t-ink    { --accent: var(--black); }
.cs.t-cobalt { --accent: var(--cobalt); }
.cs.t-sun    { --accent: var(--sun);    --accent-fg: #141413; }
.cs.t-violet { --accent: var(--violet); --accent-fg: #141413; }
.cs.t-tomato { --accent: var(--tomato); }
.cs.t-green  { --accent: var(--green); }

.cs-head {
  max-width: 1080px; margin: 0 auto;
  padding: calc(var(--nav-h) + 56px) clamp(16px, 3vw, 28px) 40px;
}
.back {
  display: inline-flex; gap: 8px; align-items: center;
  font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  text-decoration: none; color: var(--muted);
}
@media (hover: hover) { .back:hover { color: var(--ink); } }
.cs-kicker { display: flex; align-items: center; gap: 10px; margin-top: 36px; color: var(--muted); }
.cs-kicker .tag { background: var(--accent); color: var(--accent-fg); padding: 6px 10px; border-radius: 6px; }
.cs-title {
  margin-top: 18px;
  font-size: clamp(44px, 7.4vw, 96px); font-weight: 800; letter-spacing: -.05em; line-height: .98;
  text-wrap: balance;
}
.cs-lede { margin-top: 24px; max-width: 60ch; font-size: clamp(18px, 1.8vw, 21px); color: var(--ink-2); text-wrap: pretty; }
.cs-meta {
  margin-top: 40px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1.5px solid var(--ink);
}
.cs-meta div { padding: 16px 16px 16px 0; border-bottom: 1px solid var(--line); }
.cs-meta dt { font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cs-meta dd { margin: 8px 0 0; font-weight: 600; }
@media (max-width: 760px) { .cs-meta { grid-template-columns: 1fr 1fr; } }
.cs-head .hero-cta { justify-content: flex-start; }

.cs-cover {
  max-width: 1240px; margin: 0 auto;
  margin-inline: max(16px, calc((100% - 1240px) / 2));
  background: var(--accent); border-radius: calc(var(--radius) + 6px);
  padding: clamp(20px, 5vw, 64px) clamp(16px, 5vw, 64px) 0;
  overflow: hidden;
  display: flex; justify-content: center;
}
.cs-cover .shot { transform: none; border-radius: 14px 14px 0 0; max-width: 1080px; }
.cs-cover .phone { transform: none; border-radius: 34px 34px 0 0; border-bottom: 0; aspect-ratio: auto; height: 520px; width: 280px; }
.cs-cover.pad { padding-bottom: clamp(20px, 5vw, 64px); }
.cs-cover .device-card { transform: none; max-width: 900px; }

.cs-body {
  max-width: 1080px; margin: 0 auto;
  padding: 80px clamp(16px, 3vw, 28px) 40px;
  display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 56px;
}
.toc { position: sticky; top: calc(var(--nav-h) + 24px); align-self: start; display: grid; gap: 4px; }
.toc a {
  font: 500 12px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px;
  border-left: 2px solid transparent;
}
.toc a.on { color: var(--ink); border-left-color: var(--accent); background: var(--card); }
@media (hover: hover) { .toc a:hover { color: var(--ink); } }
@media (max-width: 860px) {
  .cs-body { grid-template-columns: 1fr; gap: 0; padding-top: 56px; }
  .toc { display: none; }
}

.prose section { padding: 0 0 64px; }
.prose h2 { font-size: clamp(30px, 3.6vw, 44px); font-weight: 700; letter-spacing: -.035em; margin-bottom: 20px; }
.prose h3 { font-size: 21px; font-weight: 700; letter-spacing: -.02em; margin: 28px 0 10px; }
.prose p { color: var(--ink-2); max-width: 66ch; text-wrap: pretty; }
.prose p + p { margin-top: 14px; }
.prose ul.bullets { display: grid; gap: 12px; margin-top: 16px; max-width: 66ch; }
.prose ul.bullets li { position: relative; padding-left: 22px; color: var(--ink-2); }
.prose ul.bullets li::before {
  content: ""; position: absolute; left: 0; top: .62em; width: 8px; height: 8px; border-radius: 2px;
  background: var(--accent); box-shadow: 0 0 0 1px var(--line);
}
.prose strong { color: var(--ink); }
.pullquote {
  margin: 28px 0 0; padding: 22px 24px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line);
  font: 600 clamp(20px, 2.2vw, 26px)/1.3 var(--display); letter-spacing: -.02em;
}

.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.feature b { display: block; font: 700 18px/1.2 var(--display); letter-spacing: -.02em; }
.feature span { display: block; margin-top: 8px; color: var(--muted); font-size: 15px; }
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 20px; }
.metric { background: var(--accent); color: var(--accent-fg); border-radius: 16px; padding: 22px; }
.metric b { display: block; font: 800 clamp(36px, 4vw, 48px)/1 var(--display); letter-spacing: -.045em; }
.metric span { display: block; margin-top: 10px; font-size: 14px; opacity: .85; }

.gallery { display: grid; gap: 28px; margin-top: 24px; }
.gallery figure { margin: 0; }
.gallery .shot { transform: none; }
.gallery figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); }

.note {
  margin-top: 18px; padding: 12px 14px; border-radius: 10px;
  border: 1px dashed var(--line); color: var(--muted); font-size: 14px; max-width: 66ch;
}

.next {
  max-width: 1240px; margin: 40px auto 0;
  margin-inline: max(16px, calc((100% - 1240px) / 2));
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: clamp(28px, 5vw, 56px); border-radius: calc(var(--radius) + 6px);
  background: var(--next-bg, var(--ink)); color: var(--next-fg, var(--paper)); text-decoration: none;
}
.next small { display: block; opacity: .7; }
.next b { display: block; margin-top: 10px; font: 800 clamp(32px, 5vw, 64px)/1 var(--display); letter-spacing: -.045em; }
.next .arrow { font-size: clamp(32px, 5vw, 56px); transition: transform .3s var(--ease); }
@media (hover: hover) { .next:hover .arrow { transform: translateX(8px); } }

/* Case studies: phone screenshots side by side, chat feedback, photos */
.phones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.phones figure { margin: 0; }
.phones img {
  width: 100%; height: auto; border-radius: 22px;
  border: 6px solid #111; background: #111;
  box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .5);
}
.phones figcaption, .chats figcaption, .photo figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); }
@media (max-width: 560px) { .phones { grid-template-columns: 1fr 1fr; } }

.chats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; align-items: start; }
.chats figure { margin: 0; }
.chats img { width: 100%; height: auto; border-radius: 16px; }
.chats .wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .chats { grid-template-columns: 1fr; } }

.photo { margin: 24px 0 0; }
.photo img { width: 100%; height: auto; border-radius: 16px; }

.flow { display: grid; gap: 10px; margin-top: 20px; counter-reset: step; max-width: 66ch; }
.flow li {
  counter-increment: step; display: grid; grid-template-columns: 36px 1fr; gap: 14px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; color: var(--ink-2);
}
.flow li::before {
  content: counter(step); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: var(--accent-fg); font: 600 13px/1 var(--mono);
}

.roadmap { display: grid; gap: 0; margin-top: 20px; border-top: 1.5px solid var(--ink); max-width: 66ch; }
.roadmap li { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.roadmap li b { font: 500 12px/1.6 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
@media (max-width: 560px) { .roadmap li { grid-template-columns: 1fr; gap: 4px; } }

/* =========================================================
   Scenes: a framed product screen with floating callouts.
   Sizes use container units so a scene scales as one piece.
   ========================================================= */
.scene {
  container-type: inline-size;
  position: relative; width: 100%; max-width: 580px;
  aspect-ratio: 6 / 5;
  margin: 0;
}
.s-browser {
  position: absolute; left: 0; top: 7%; width: 84%;
  background: #fff; border-radius: 2.6cqw; overflow: hidden;
  box-shadow: 0 6cqw 12cqw -6cqw rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .08);
}
.s-browser.dark { background: #0E1220; box-shadow: 0 6cqw 12cqw -6cqw rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .1); }
.s-browser .screen-bar { padding: 1.9cqw 2.2cqw; gap: 1cqw; }
.s-browser .screen-bar i { width: 1.5cqw; height: 1.5cqw; }
.s-browser .screen-bar span { font-size: 1.9cqw; margin-left: 1.2cqw; }
.s-browser.dark .screen-bar { color: #ECE8DF; }
.s-browser img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10.5; object-fit: cover; object-position: left top; }

.s-phone {
  position: absolute; right: 2%; bottom: 0; width: 33%;
  aspect-ratio: 9 / 19; border: 1.6cqw solid #0D0D0D; border-radius: 6cqw;
  background: #0D0D0D; overflow: hidden;
  box-shadow: 0 6cqw 12cqw -5cqw rgba(0, 0, 0, .6);
}
.s-phone img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 4.4cqw; }
.scene.solo .s-phone { right: auto; left: 50%; width: 42%; translate: -50% 0; bottom: 0; top: 0; aspect-ratio: auto; }

.s-chip {
  position: absolute; z-index: 2;
  display: flex; align-items: center; gap: 2cqw;
  padding: 2.2cqw 2.8cqw; border-radius: 2.6cqw;
  background: #FFFFFF; color: #141413;
  box-shadow: 0 3cqw 8cqw -3cqw rgba(0, 0, 0, .45), 0 0 0 1px rgba(0, 0, 0, .05);
  font: 600 2.5cqw/1.2 var(--body); white-space: nowrap;
}
.s-chip small { display: block; font: 500 1.8cqw/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: #6E6B64; margin-bottom: .6cqw; }
.s-chip b { font: 800 4.4cqw/1 var(--display); letter-spacing: -.03em; }
.s-chip .ico {
  flex: none; width: 6cqw; height: 6cqw; border-radius: 1.8cqw;
  display: grid; place-items: center; font-size: 3cqw; font-weight: 700;
}
.ico-red { background: rgba(215, 56, 15, .14); color: #C2340F; }
.ico-green { background: rgba(46, 138, 87, .16); color: #1F6B41; }
.ico-blue { background: rgba(58, 91, 217, .14); color: #2C49B8; }
.ico-sun { background: rgba(239, 195, 79, .3); color: #7A5A0C; }
.ico-violet { background: rgba(122, 102, 224, .16); color: #5A46C8; }
.s-chip.dark { background: #141413; color: #F1EDE4; }
.s-chip.dark small { color: rgba(241, 237, 228, .6); }

.s-ring {
  flex: none; width: 7cqw; height: 7cqw; border-radius: 50%;
  background: radial-gradient(circle, #fff 58%, transparent 60%), conic-gradient(var(--c, #7A66E0) calc(var(--v) * 1%), #E5E0D5 0);
  display: grid; place-items: center; font: 700 2.1cqw/1 var(--mono);
}
.s-logo {
  position: absolute; z-index: 2; width: 13cqw; height: 13cqw; border-radius: 3.4cqw;
  display: grid; place-items: center; background: #fff; color: #0B1020;
  box-shadow: 0 3cqw 8cqw -3cqw rgba(0, 0, 0, .5);
}
.s-logo svg, .s-logo img { width: 62%; height: auto; }
.s-logo.wide { width: auto; height: 9cqw; padding: 0 3cqw; }
.s-logo.wide img { width: auto; height: 4.2cqw; }
.s-wave { display: flex; align-items: center; gap: .7cqw; height: 4cqw; }
.s-wave i { width: .8cqw; height: var(--h); border-radius: 1cqw; background: #7A66E0; }
.s-pill-btn { padding: 1.6cqw 3cqw; border-radius: 2cqw; background: #2563EB; color: #fff; font: 600 2.4cqw/1 var(--body); }

@media (prefers-reduced-motion: no-preference) {
  .s-chip, .s-logo { animation: drift 6s ease-in-out infinite alternate; }
  .s-chip:nth-of-type(2n) { animation-duration: 7.5s; animation-delay: -2s; }
  .s-chip:nth-of-type(3n) { animation-duration: 8.5s; animation-delay: -4s; }
  .s-wave i { animation: speak 1.1s ease-in-out infinite alternate; }
  .s-wave i:nth-child(2n) { animation-delay: -.5s; }
  .s-wave i:nth-child(3n) { animation-delay: -.8s; }
}
@keyframes drift { to { translate: 0 -1.4cqw; } }
@keyframes speak { to { scale: 1 .45; } }

.cs-cover .scene { max-width: 940px; margin-bottom: clamp(20px, 4vw, 48px); }
.cs-cover .scene.solo { max-width: 640px; }
.cs-cover.scene-cover { padding-bottom: 0; }

/* =========================================================
   About
   ========================================================= */
.about { padding-top: 110px; padding-bottom: 30px; }
.about-grid {
  max-width: 1240px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); align-items: center;
}
.portrait { position: relative; margin: 0; max-width: 440px; }
.portrait img {
  width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 20%;
  border-radius: calc(var(--radius) + 6px); transform: rotate(-2deg);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .45);
}
.portrait .sticker {
  position: absolute; right: -10px; bottom: 28px; transform: rotate(4deg);
  background: var(--sun); color: #141413; padding: 10px 14px; border-radius: 12px;
  font: 600 13px/1.2 var(--mono); letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .4);
}
.portrait .sticker-2 { right: auto; left: -10px; bottom: auto; top: 26px; transform: rotate(-5deg); background: var(--cobalt); color: #F7F4EE; }
.about-copy h2 { font-size: clamp(36px, 5vw, 64px); font-weight: 800; letter-spacing: -.045em; }
.about-copy p { margin-top: 18px; color: var(--ink-2); max-width: 56ch; font-size: 18px; text-wrap: pretty; }
.creds { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.creds li { font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 9px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.creds b { color: var(--ink); }
@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 320px; margin: 0 auto; }
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar:has(img) { background: none; }

/* Skills toolkit under "How I work" */
.toolkit {
  max-width: 1240px; margin: 14px auto 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px;
}
.toolkit > div { padding: 20px; border-radius: var(--radius); border: 1px dashed var(--line); }
.toolkit h3 { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.toolkit p { margin-top: 10px; font-size: 14px; line-height: 1.6; color: var(--muted); }
@media (max-width: 1100px) { .toolkit { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .toolkit { grid-template-columns: 1fr; } }

/* One-line outcome under each role */
.xp .xp-what { grid-column: 1 / -1; color: var(--ink-2); max-width: 70ch; margin-top: -4px; }
@media (max-width: 560px) { .xp .xp-what { grid-row: 3; } }


/* =========================================================
   Motion. Hover is for pointers that can hover; everything
   that moves on its own respects reduced-motion.
   ========================================================= */

/* --- Ticker between the hero and the work --- */
.ticker {
  overflow: hidden; border-block: 1.5px solid var(--ink);
  background: var(--ink); color: var(--paper);
  padding: 16px 0; margin: 0 0 40px;
  transform: rotate(-1.2deg) scale(1.02);
}
.ticker-track { display: flex; width: max-content; will-change: transform; }
.ticker-track span {
  display: inline-flex; align-items: center; gap: 22px; padding-right: 22px;
  font: 700 clamp(18px, 2.2vw, 28px)/1 var(--display); letter-spacing: -.02em; white-space: nowrap;
}
.ticker-track b { color: var(--sun); font-weight: 800; }
.ticker-track i { font-style: normal; color: var(--tomato); }

/* --- Buttons and links --- */
.btn { transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .2s, color .2s; }
@media (hover: hover) {
  .btn:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -14px rgba(0, 0, 0, .6); }
  .btn:active { transform: translateY(0) scale(.97); }

  .nav-links a { position: relative; }
  .nav-name .avatar { transition: transform .4s var(--ease); }
  .nav-name:hover .avatar { transform: rotate(-12deg) scale(1.08); }

  /* Hero chips wobble when touched */
  .hero-title .chip { transition: scale .35s var(--ease), rotate .35s var(--ease); }
  .hero-title .chip:hover { scale: 1.05; rotate: calc(var(--r, 0deg) * -1.5); }

  /* Folder card: the scene lifts, callouts spread */
  .s-browser, .s-phone { transition: transform .6s var(--ease); }
  .s-chip, .s-logo { transition: scale .4s var(--ease); }
  .folder-body:hover .s-browser { transform: translateY(-1.5cqw) rotate(-.6deg); }
  .folder-body:hover .s-phone { transform: translateY(-2.5cqw) rotate(1.2deg); }
  .folder-body:hover .s-chip, .folder-body:hover .s-logo { scale: 1.06; }
  .folder-tab { transition: filter .2s; }
  .folder:hover .folder-tab { filter: brightness(1.08); }

  /* How I work cards */
  .card { transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s; }
  .cards .card:hover { transform: translateY(-6px) rotate(-.6deg); box-shadow: 0 24px 40px -28px rgba(0, 0, 0, .45); border-color: var(--ink); }
  .card .card-num { transition: color .3s, letter-spacing .3s var(--ease); }
  .card:hover .card-num { color: var(--tomato); letter-spacing: .2em; }
  .toolkit > div { transition: border-color .3s, background-color .3s; }
  .toolkit > div:hover { border-color: var(--ink); background: var(--card); }

  /* Experience rows slide and show an arrow */
  .xp li { position: relative; transition: padding-left .35s var(--ease), background-color .35s; border-radius: 12px; }
  .xp li::before {
    content: "→"; position: absolute; left: 6px; top: 24px; opacity: 0; translate: -8px 0;
    font: 700 28px/1 var(--display); transition: opacity .3s, translate .35s var(--ease);
  }
  .xp li:hover { padding-left: 44px; background: var(--card); }
  .xp li:hover::before { opacity: 1; translate: 0 0; }

  /* Portrait straightens up, stickers wiggle */
  .portrait img { transition: transform .5s var(--ease); }
  .portrait:hover img { transform: rotate(0deg) scale(1.02); }
  .portrait .sticker { transition: transform .4s var(--ease); }
  .portrait:hover .sticker { transform: rotate(-3deg) translateY(-4px); }
  .portrait:hover .sticker-2 { transform: rotate(4deg) translateY(-4px); }
  .creds li { transition: transform .25s var(--ease), background-color .25s; }
  .creds li:hover { transform: translateY(-2px); background: var(--paper-2); }

  /* Case study bits */
  .feature, .metric { transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
  .prose .feature:hover, .prose .metric:hover { transform: translateY(-4px); box-shadow: 0 18px 30px -22px rgba(0, 0, 0, .45); }
  .gallery .shot, .phones img, .chats img { transition: transform .45s var(--ease), box-shadow .45s var(--ease); }
  .gallery .shot:hover, .phones img:hover { transform: translateY(-6px) scale(1.01); box-shadow: 0 30px 50px -30px rgba(0, 0, 0, .55); }
  .toc a { transition: color .2s, background-color .2s, padding-left .25s var(--ease); }
  .toc a:hover { padding-left: 14px; }
  .back { transition: color .2s, translate .25s var(--ease); }
  .back:hover { translate: -4px 0; }
}

/* --- Mouse parallax: script.js sets --mx / --my (-1 to 1) on the element --- */
.hero-title .chip { translate: calc(var(--mx, 0) * var(--d, 10px)) calc(var(--my, 0) * var(--d, 10px)); }
.hero-title .chip:nth-of-type(1) { --d: 14px; }
.hero-title .chip:nth-of-type(2) { --d: -10px; }
.hero-title .chip:nth-of-type(3) { --d: 18px; }
.hero-title .chip:nth-of-type(4) { --d: -14px; }
.scene { transition: transform .5s var(--ease); transform: perspective(1400px) rotateY(calc(var(--mx, 0) * 5deg)) rotateX(calc(var(--my, 0) * -4deg)); }
.s-chip, .s-logo { transform: translate(calc(var(--mx, 0) * 1.6cqw), calc(var(--my, 0) * 1.6cqw)); transition: transform .5s var(--ease), scale .4s var(--ease); }

/* --- Scroll reveals for case study content --- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal.rise-2 { transition-delay: .08s; }
  .js .gallery figure.reveal { transform: translateY(28px) scale(.98); }
  .js .gallery figure.reveal.in { transform: none; }
  .js .flow li.reveal { transform: translateX(-16px); }
  .js .flow li.reveal.in { transform: none; }
}

/* --- Reading progress on case studies --- */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60;
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--p, 0));
}

/* =========================================================
   AI product stack: a dark panel; each tile has a glow that
   follows the cursor (script.js sets --x / --y on the tile).
   ========================================================= */
.ai { padding-top: 90px; padding-bottom: 30px; }
.ai-inner {
  max-width: 1240px; margin: 0 auto;
  background: #0E0E10; color: #F1EDE4;
  border-radius: calc(var(--radius) + 8px);
  padding: clamp(28px, 5vw, 64px);
  position: relative; overflow: hidden;
}
.ai-inner::before {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 60%; aspect-ratio: 1;
  background: radial-gradient(circle, rgba(167, 151, 242, .28), transparent 65%);
  pointer-events: none;
}
.ai .section-head { margin-bottom: 36px; position: relative; }
.ai .section-sub { color: rgba(241, 237, 228, .7); }
.ai .mark-violet { --mark-fg: #141413; }
.js .ai .reveal:not(.in) .mark { color: #F1EDE4; }

.ai-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; position: relative; }
.ai-tile {
  --x: 50%; --y: 50%;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px;
  padding: 22px; border-radius: 18px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .09);
  transition: border-color .3s, transform .35s var(--ease), background-color .3s;
}
.ai-tile::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(260px circle at var(--x) var(--y), rgba(167, 151, 242, .22), transparent 70%);
  transition: opacity .3s;
}
.ai-ico {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: rgba(167, 151, 242, .16); color: #C9BEFF;
  font: 700 17px/1 var(--mono);
  transition: transform .4s var(--ease), background-color .3s, color .3s;
}
.ai-tile h3 { margin-top: 6px; font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.ai-tile p { font-size: 15px; line-height: 1.55; color: rgba(241, 237, 228, .68); }
.ai-used {
  margin-top: auto; padding-top: 10px; font-size: 11px; color: var(--sun);
  border-top: 1px dashed rgba(255, 255, 255, .12);
}
@media (hover: hover) {
  .ai-grid .ai-tile:hover { border-color: rgba(167, 151, 242, .5); transform: translateY(-4px); background: rgba(255, 255, 255, .06); }
  .ai-tile:hover::before { opacity: 1; }
  .ai-tile:hover .ai-ico { transform: rotate(-10deg) scale(1.1); background: var(--violet); color: #141413; }
}
@media (max-width: 960px) { .ai-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .ai-grid { grid-template-columns: 1fr; } .ai-inner { padding: 26px 18px; } }
