/* ---------- Tokens ---------- */
:root {
  --bg: #fbfbfb;
  --fg: #1e1e1e;
  --muted: #6c6c6c;
  --rule: #e4e4e4;
  --tint: #f4f4f2;
  --bone: #e3dac9; /* warm off-white for numbers laid over imagery; same in both themes */

  --serif: "DM Serif Text", "Times New Roman", Georgia, serif;
  --sans: "Hind", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --track: .04em; /* Figma: 18px Hind at 0.72px */

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1474px; /* 1378px of content at the 48px gutter, per Figma */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --fg: #f5f5f3;
  --muted: #9a9a9a;
  --rule: #262626;
  --tint: #151515;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .5s var(--ease), color .5s var(--ease);
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
em { font-style: italic; }
img { max-width: 100%; display: block; }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--fg); color: var(--bg); padding: 8px 12px;
}
.skip:focus { left: 8px; z-index: 100; }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }

/* ---------- Left rail ---------- */
:root { --rail: 212px; }
body { padding-left: var(--rail); }

.rail {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 10;
  width: var(--rail);
  display: flex; flex-direction: column; justify-content: flex-start;
  padding: 50px 40px 50px 50px;
  background: var(--bg);
  border-right: 1px solid var(--rule);
  transition: background-color .5s var(--ease), border-color .5s var(--ease);
}
.rail__title {
  font: 400 18px/1.25 var(--serif); letter-spacing: -.01em;
  text-decoration: none;
}
.rail__title em { display: block; } /* "mid-compile" on its own line in the rail */
.rail__menu { display: contents; }
.rail__nav { margin: auto 0; }
.menu { display: none; }

.tabs { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; }
.tabs a {
  font-size: 16px; font-weight: 400; letter-spacing: var(--track); line-height: 1.3;
  text-decoration: none; color: var(--muted);
  padding: 6px 0; position: relative;
  transition: color .25s var(--ease);
}
.tabs a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--fg); transform: scaleX(0); transform-origin: left;
  transition: transform .35s var(--ease);
}
.tabs a:hover, .tabs a[aria-selected="true"] { color: var(--fg); }

.tabs a[aria-selected="true"]::after { transform: scaleX(1); }

/* Bottom of the rail: theme and "elsewhere" icons (Figma 24px, 8px apart) */
.rail__tools { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: grid; place-items: center; width: 32px; height: 32px; margin: -4px;
  padding: 0; background: none; border: 0; border-radius: 50%;
  color: var(--fg); cursor: pointer;
  transition: opacity .25s var(--ease), transform .5s var(--ease-out);
}
.icon-btn + .icon-btn, .icon-btn + .elsewhere { margin-left: 4px; }
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }
.icon-btn:hover { opacity: .6; }
.invert svg { transition: transform .6s var(--ease-out); }
:root[data-theme="dark"] .invert svg { transform: rotate(180deg); }

.elsewhere { position: relative; }
.elsewhere__menu {
  position: absolute; left: -12px; bottom: calc(100% + 14px); z-index: 20;
  list-style: none; margin: 0; padding: 8px; min-width: 168px;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .28);
  opacity: 0; visibility: hidden; transform: translateY(8px) scale(.98); transform-origin: 16px 100%;
  transition: opacity .25s var(--ease), transform .4s var(--ease-out), visibility 0s linear .4s;
}
.elsewhere.is-open .elsewhere__menu { opacity: 1; visibility: visible; transform: none; transition: opacity .25s var(--ease), transform .4s var(--ease-out); }
.elsewhere__menu a {
  display: flex; justify-content: space-between; gap: 16px; padding: 9px 12px; border-radius: 8px;
  font-size: 16px; letter-spacing: var(--track); text-decoration: none; color: var(--fg);
  transition: background-color .2s var(--ease);
}
.elsewhere__menu a::after { content: "↗"; color: var(--muted); }
.elsewhere__menu a:hover, .elsewhere__menu a:focus-visible { background: var(--tint); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
}
.hero .display { font-size: clamp(48px, 6.6vw, 112px); max-width: none; }
.hero .lede { max-width: 46ch; }
.hero__actions { margin: 44px 0 0; display: flex; align-items: center; flex-wrap: wrap; gap: 24px 56px; }
.btn {
  display: inline-block; padding: 16px 28px; border-radius: 8px;
  background: var(--fg); color: var(--bg); border: 1px solid var(--fg);
  font-size: 14px; font-weight: 500; letter-spacing: 0; text-decoration: none;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.btn:hover { background: transparent; color: var(--fg); }

/* ---------- About (under the hero) ---------- */
.about { padding-top: 0; }
.about__grid {
  display: grid; grid-template-columns: 5fr 7fr; gap: clamp(32px, 6vw, 96px);
  align-items: start; margin-top: clamp(32px, 4vw, 56px);
}
.about__title {
  margin: 0; position: sticky; top: 48px;
  font: 400 clamp(32px, 3.6vw, 48px)/1.08 var(--serif); letter-spacing: -.02em;
}
.facts--about { margin-top: 0; max-width: 760px; }
.facts ul { list-style: none; margin: 0; padding: 0; }
.facts li + li { margin-top: 4px; }

/* ---------- Panels ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.panel { padding: clamp(48px, 9vw, 120px) 0 clamp(64px, 10vw, 140px); }
.panel[hidden] { display: none; }
.panel.is-entering { animation: rise .7s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.panel__head { max-width: 860px; margin-bottom: clamp(48px, 7vw, 96px); }
.kicker {
  margin: 0 0 20px;
  font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--muted);
}
.display {
  margin: 0;
  font: 400 clamp(46px, 7.4vw, 100px)/1.04 var(--serif);
  letter-spacing: -.01em;
  text-wrap: balance;
}
.lede {
  margin: 28px 0 0; max-width: 58ch; text-wrap: pretty;
  font: 400 clamp(17px, 1.3vw, 19px)/1.55 var(--sans); letter-spacing: var(--track); color: var(--muted);
}
.panel__actions { margin: 28px 0 0; }
.panel__actions--resume { margin-top: clamp(40px, 5vw, 64px); }
.elsewhere__top { display: none; }

.link-arrow {
  display: inline-block;
  font-size: 14px; font-weight: 500; letter-spacing: 0;
  text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 2px;
}

.section-rule {
  display: flex; align-items: center; gap: 16px;
  margin: clamp(40px, 6vw, 72px) 0 8px;
  font-size: 14px; font-weight: 500; letter-spacing: 0;
}
.section-rule::after { content: ""; flex: 1; height: 1px; background: var(--fg); }

/* ---------- Résumé ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.entry {
  display: grid; grid-template-columns: 220px 1fr; gap: 32px;
  padding: 32px 0; border-bottom: 1px solid var(--rule);
}
.entry__meta { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.entry__years { color: var(--fg); font-variant-numeric: tabular-nums; }
.entry__role { margin: 0; font: 400 clamp(28px, 3.2vw, 38px)/1.1 var(--serif); letter-spacing: -.01em; }
.entry__org { margin: 6px 0 0; font: 500 15px/1.4 var(--sans); color: var(--muted); }
.entry__points { margin: 16px 0 0; padding: 0; list-style: none; max-width: 62ch; }
.entry__points li { position: relative; padding-left: 22px; margin: 6px 0; }
.entry__points li::before { content: "—"; position: absolute; left: 0; color: var(--muted); }

/* Promotion ladder: several roles under one company */
.ladder { list-style: none; margin: 24px 0 8px; padding: 0; }
.ladder__step {
  position: relative; padding: 0 0 22px 28px;
  border-left: 1px solid var(--rule);
}
.ladder__step:last-child { padding-bottom: 0; }
.ladder__step::before {
  content: ""; position: absolute; left: -5px; top: 7px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--fg);
}
.ladder__step:first-child::before { background: var(--fg); }
.ladder__years { display: block; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ladder__title { margin: 4px 0 0; font: 400 clamp(22px, 2.2vw, 26px)/1.2 var(--serif); }
.ladder__area { margin: 2px 0 0; font: 400 15px/1.5 var(--sans); color: var(--muted); }

/* Accomplishments grouped by category */
.group { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--rule); }
.group__title {
  margin: 0;
  font: italic 400 22px/1.2 var(--serif); letter-spacing: -.01em;
}
.group .entry__points { margin-top: 10px; }

.entry__note { margin: 14px 0 0; max-width: 62ch; color: var(--muted); }
.entry__points strong, .case__body strong { font-weight: 500; }

.compact { list-style: none; margin: 0; padding: 0; }
.compact li {
  display: grid; grid-template-columns: 220px 1fr 1fr; gap: 32px; align-items: baseline;
  padding: 18px 0; border-bottom: 1px solid var(--rule);
}
.compact__years { font-size: 14px; font-variant-numeric: tabular-nums; }
.compact__role { font: 400 22px/1.25 var(--serif); }
.compact__note { font-size: 14px; color: var(--muted); }

.columns-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px 32px; padding-top: 24px; }
.columns-3 p { margin: 0; }
.mini-head {
  margin: 0 0 8px; font: 400 24px/1.2 var(--serif); font-style: italic;
}

/* ---------- Portfolio ---------- */
.grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  column-gap: clamp(24px, 4vw, 56px); row-gap: clamp(48px, 6vw, 80px);
}
.card { display: flex; flex-direction: column; }
.card__thumb { display: block; color: inherit; text-decoration: none; }
.card__media {
  aspect-ratio: 4 / 3; background: var(--tint);
  display: grid; place-items: end start; padding: 20px; margin-bottom: 20px;
  overflow: hidden; transition: background-color .5s var(--ease);
}
.card__media span { font: 400 64px/1 var(--serif); color: var(--muted); transition: transform .6s var(--ease); }
.card:hover .card__media span { transform: translateY(-6px); }
.card__media--img { padding: 0; place-items: stretch; position: relative; }
.card__media--img span { position: absolute; left: 20px; bottom: 20px; color: var(--bone); }
.card__media--img img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 0;
  transition: transform .6s var(--ease);
}
.card:hover .card__media--img img { transform: scale(1.02); }

/* Holo hover: the thumbnail tilts a few degrees toward the pointer and a soft,
   faintly iridescent sheen follows it, like a foil card turned in the light. */
.card__thumb {
  --mx: 50%; --my: 50%; --rx: 0deg; --ry: 0deg; --hue: 140deg;
  transform: perspective(1400px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .7s var(--ease);
}
.card__thumb.is-holo { transition: transform .15s ease-out; }
.card__media--img::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(circle at var(--mx) var(--my), rgba(255,255,255,.28), rgba(255,255,255,0) 42%),
    linear-gradient(115deg,
      hsl(var(--hue) 90% 70% / 0) 20%,
      hsl(calc(var(--hue) + 0deg) 90% 72% / .16) 38%,
      hsl(calc(var(--hue) + 80deg) 90% 72% / .14) 50%,
      hsl(calc(var(--hue) + 160deg) 90% 72% / .16) 62%,
      hsl(var(--hue) 90% 70% / 0) 80%);
  background-size: 100% 100%, 220% 220%;
  background-position: 0 0, var(--mx) var(--my);
  mix-blend-mode: soft-light; opacity: 0; transition: opacity .6s var(--ease);
}
.card__thumb.is-holo .card__media--img::after { opacity: 1; }
.card__media--img span { z-index: 2; }
@media (prefers-reduced-motion: reduce) { .card__thumb { transform: none; } .card__media--img::after { display: none; } }
.card__meta { margin: 0 0 8px; font-size: 14px; letter-spacing: 0; color: var(--muted); }
.card__title { margin: 0; font: 400 clamp(26px, 2.6vw, 34px)/1.1 var(--serif); letter-spacing: -.01em; }
.card__desc { margin: 10px 0 16px; color: var(--muted); max-width: 48ch; }

.card--feature {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 1.6fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: center;
  padding-bottom: clamp(48px, 6vw, 80px); border-bottom: 1px solid var(--rule);
}
.card--feature .card__media { aspect-ratio: 16 / 10; margin: 0; }
.card--feature .card__media--img { aspect-ratio: 4 / 3; } /* full device mockup, no crop */
.card--feature .card__title { font-size: clamp(36px, 4.4vw, 56px); }
/* Case studies alternate: image left, then image right */
.card--flip { grid-template-columns: 1fr 1.6fr; }
.card--flip .card__thumb { order: 2; }
.card--feature:last-child { border-bottom: 0; padding-bottom: 0; }

.card__cta {
  align-self: flex-start; margin-top: auto;
  font-size: 14px; font-weight: 500; text-decoration: none;
  border-bottom: 1px solid currentColor; padding-bottom: 2px;
}
.card__cta::after { content: " →"; }

/* ---------- Case study pages ---------- */
.case__head { max-width: 980px; padding: clamp(48px, 6vw, 66px) 0 clamp(40px, 5vw, 64px); }
.case__head .display { font-size: clamp(46px, 7vw, 100px); }
.case__head--reel { max-width: none; padding-bottom: clamp(16px, 1.6vw, 24px); }

/* Breadcrumb: arrow, muted "Portfolio", then the case number */
.crumb { display: flex; flex-wrap: wrap; align-items: center; column-gap: .3em; margin: 0 0 8px; font-size: 14px; letter-spacing: var(--track); line-height: 1.35; color: var(--fg); }
.case__back { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); text-decoration: none; transition: color .25s var(--ease); }
.case__back:hover { color: var(--fg); }
.crumb__arrow { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--ease-out); }
.case__back:hover .crumb__arrow { transform: translateX(-4px); }

/* Facts: label over value, three columns (Figma: 18px label, 24px value) */
.case__facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px clamp(32px, 6vw, 110px);
  margin: clamp(32px, 4vw, 56px) 0 0; padding-top: clamp(28px, 3.6vw, 72px); border-top: 1px solid var(--rule);
}
.case__facts div { margin: 0; }
.case__facts dt { font-size: clamp(15px, 1vw, 18px); letter-spacing: var(--track); color: var(--muted); }
.case__facts dd { margin: 8px 0 0; font-size: clamp(18px, 1.3vw, 24px); line-height: 1.35; letter-spacing: -.01em; text-wrap: pretty; }
.case__facts--bar { margin: clamp(40px, 4vw, 56px) 0 0; padding-bottom: clamp(28px, 3.6vw, 72px); }
.case__section--intro + .media--hero { margin-top: clamp(8px, 1vw, 16px); }

/* Reel: sizzle at the top of every case study; plays when pressed */
.reel { position: relative; }
.reel__frame { position: relative; aspect-ratio: 1378 / 774; border-radius: 8px; overflow: hidden; background: #0b0d12; }
.reel__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.reel__controls { position: absolute; right: 16px; bottom: 16px; z-index: 2; display: flex; gap: 8px; }
.reel__btn {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 50%;
  background: rgba(10, 10, 12, .45); color: #fff; cursor: pointer;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background-color .25s var(--ease), transform .4s var(--ease-out);
}
.reel__btn:hover { background: rgba(10, 10, 12, .7); transform: scale(1.06); }
.reel__btn svg { grid-area: 1 / 1; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.reel__btn .i-play, .reel__btn .i-sound { display: none; }
.reel__play[aria-pressed="true"] .i-pause, .reel__sound[aria-pressed="true"] .i-muted { display: none; }
.reel__play[aria-pressed="true"] .i-play, .reel__sound[aria-pressed="true"] .i-sound { display: block; }
.reel__play .i-play { fill: currentColor; }
.reel__video:fullscreen { object-fit: contain; background: #000; }

/* Media slots: image or video, any ratio via --ratio */
.media { margin: 0; min-width: 0; } /* wide rows scroll inside, never widen the page */
.media__frame {
  aspect-ratio: var(--ratio, 16 / 9); background: var(--tint); overflow: hidden;
  display: grid; place-items: center; border-radius: 12px;
  transition: background-color .5s var(--ease);
}
.media__frame > img, .media__frame > video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media__frame { border-radius: 8px; }
.media figcaption { letter-spacing: .01em; }
.media__ph { font: italic 400 18px var(--serif); color: var(--muted); padding: 16px; text-align: center; }
.media figcaption { margin-top: 12px; font-size: 14px; color: var(--muted); max-width: 62ch; }
.media--hero { margin-bottom: clamp(56px, 8vw, 112px); }
.media--wide { grid-column: 1 / -1; margin-top: clamp(32px, 4vw, 48px); }

/* Phone stills: a row of three under a desktop hero */
.media--hero:has(+ .media--phones) { margin-bottom: clamp(32px, 4vw, 56px); }
.media--phones { margin-bottom: clamp(56px, 8vw, 112px); }
.media__row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 32px); }
.media--phones .media__frame { border-radius: clamp(18px, 2.4vw, 28px); }
.media--native .media__frame { border-radius: 0; background: transparent; } /* Figma exports carry their own corners */
.media--board .board-dark { display: none; } /* same board exported from Pencil with light type for dark mode */
:root[data-theme="dark"] .media--board .board-light { display: none; }
:root[data-theme="dark"] .media--board .board-dark { display: block; }
.case__section .media--phones { margin-bottom: 0; } /* phone rows inside a section follow the section rhythm */
.media__row--pair { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* two stills side by side */
.media__row--four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 700px) { .media__row--four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.media__row--screens .media__frame { background: transparent; } /* app windows carry their own backdrop */

/* Workflow diagrams: inline SVG themed by the page tokens */
.diagram__svg { display: block; width: 100%; height: auto; }
.diagram { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.diagram .box { fill: var(--bg); stroke: var(--fg); stroke-width: 1; }
.diagram .box.tool { fill: var(--tint); }
.diagram .band { fill: var(--tint); stroke: var(--rule); }
.diagram .t { fill: var(--fg); font: 500 15px var(--sans); }
.diagram .s { fill: var(--muted); font: 400 12.5px var(--sans); }
.diagram .l { fill: var(--muted); font: italic 400 13px var(--serif); }
.diagram .arrow { fill: none; stroke: var(--fg); stroke-width: 1; stroke-linejoin: round; stroke-linecap: round; }
.diagram .arrow.dashed { stroke-dasharray: 4 4; }
.diagram marker path { fill: var(--fg); }

/* Sections: numbered label on the left, measure on the right, media spans both */
.case__section {
  display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 3fr); column-gap: clamp(32px, 5vw, 80px);
  padding: clamp(40px, 5vw, 64px) 0; border-top: 1px solid var(--rule);
}
.case__label { align-self: start; }
.case__num { display: block; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.case__label h2 { margin: 6px 0 0; font: 400 clamp(26px, 2.6vw, 34px)/1.1 var(--serif); letter-spacing: -.01em; }
.case__body { max-width: 62ch; font-size: clamp(16px, 1.2vw, 18px); line-height: 1.65; }
.case__body > p { margin: 0 0 1.1em; }
.case__body > p:last-child { margin-bottom: 0; }
.case__body ul { margin: 0 0 1.1em; padding-left: 0; list-style: none; }
.case__body li { position: relative; padding-left: 22px; margin: 6px 0; }
.case__body li::before { content: "—"; position: absolute; left: 0; color: var(--muted); }
/* Icon bullets: a thin line glyph in place of the dash */
.case__body .icon-list li { padding-left: 36px; margin: 14px 0; }
.case__body .icon-list li::before { content: none; }
.li-icon { position: absolute; left: 0; top: .28em; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.case__body .note { color: var(--muted); font-style: italic; }

.case__next {
  display: flex; flex-direction: column; gap: 10px;
  padding: clamp(48px, 6vw, 80px) 0 clamp(64px, 10vw, 140px); border-top: 1px solid var(--rule);
}
.case__next .kicker { margin: 0; }
.case__next-link { font: 400 clamp(32px, 4vw, 56px)/1.1 var(--serif); letter-spacing: -.02em; text-decoration: none; }
.case__next-link:hover { font-style: italic; }

/* ---------- Summary: portrait beside the biography, under the hero ---------- */
.profile {
  display: grid; grid-template-columns: 5fr 7fr; gap: clamp(32px, 6vw, 96px);
  align-items: start; padding-top: 24px;
}
.portrait { margin: 0; position: sticky; top: 48px; }
.portrait__frame {
  aspect-ratio: 4 / 5; overflow: hidden; background: var(--tint);
  border-radius: 16px; isolation: isolate;
}
.portrait__img {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%;
  transform-origin: 50% 40%; will-change: transform;
  animation: kenburns 18s ease-in-out infinite alternate;
}
@keyframes kenburns {
  from { transform: scale(1); }
  to   { transform: scale(1.12) translate(-1%, 2%); }
}
.profile__text { max-width: 60ch; font: 400 clamp(16px, 1.3vw, 18px)/1.65 var(--sans); }
.dropcap::first-letter { font-family: var(--serif); }
.profile__text p { margin: 0 0 1.1em; max-width: 60ch; }
.dropcap::first-letter {
  float: left; font-size: 4.6em; line-height: .82; padding: .06em .1em 0 0;
}
.pull {
  margin: 1.6em 0; padding: 1em 0;
  border-top: 1px solid var(--fg); border-bottom: 1px solid var(--fg);
  font: italic 400 clamp(28px, 3.4vw, 42px)/1.2 var(--serif); letter-spacing: -.01em;
}
.facts { margin: 2em 0 0; font-family: var(--sans); font-size: 15px; }
.facts div { display: grid; grid-template-columns: 140px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.facts dt { font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--muted); padding-top: 2px; }
.facts dd { margin: 0; word-break: break-word; }

/* ---------- Footer ---------- */
.colophon {
  max-width: var(--max); margin: 0 auto; padding: 28px var(--gutter) 40px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-top: 1px solid var(--rule);
  font-size: 14px; letter-spacing: 0; color: var(--muted);
}

/* ---------- Motion: text and media ease in as they arrive, images drift on scroll ---------- */
.reveal-on [data-reveal] {
  opacity: 0; transform: translate3d(0, 28px, 0); filter: blur(6px);
  transition: opacity .9s var(--ease-out), transform 1.1s var(--ease-out), filter .9s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.reveal-on [data-reveal].is-in { opacity: 1; transform: none; filter: none; }
/* Display titles rise word by word from behind a mask */
.w { display: inline-block; overflow: clip; overflow-clip-margin: .2em; vertical-align: bottom; padding-bottom: .06em; margin-bottom: -.06em; }
.w__i { display: inline-block; }
.reveal-on .split .w__i { transform: translate3d(0, 108%, 0); transition: transform 1.1s var(--ease-out); transition-delay: calc(var(--d, 0ms) + var(--i, 0) * 70ms); }
.reveal-on .split.is-in .w__i { transform: none; }
.reveal-on .split[data-reveal] { opacity: 1; transform: none; filter: none; }
/* Parallax: JS sets --py on figures in view; frame and caption drift together, so nothing crops or collides */
.media[data-parallax] > *, .card__media[data-parallax] { transform: translate3d(0, var(--py, 0px), 0); will-change: transform; }
.panel.is-entering { animation: none; }

/* ---------- Responsive ---------- */
/* The rail eats ~250px: give the copy more room below 1200, stack below 900 */
@media (max-width: 1200px) {
  .card--feature { grid-template-columns: 1.2fr 1fr; }
  .card--flip { grid-template-columns: 1fr 1.2fr; }
}
@media (max-width: 900px) {
  .card--feature, .card--flip { grid-template-columns: 1fr; align-items: start; }
  .card--flip .card__thumb { order: 0; }
}

@media (max-width: 860px) {
  /* Rail collapses to a top bar with a menu icon */
  body { padding-left: 0; }
  .rail {
    position: sticky; bottom: auto; width: auto;
    flex-direction: row; align-items: center;
    padding: 14px var(--gutter);
    border-right: 0; border-bottom: 1px solid var(--rule);
  }
  .rail__title { font-size: 17px; white-space: nowrap; position: relative; z-index: 2; }
  .rail__title em { display: inline; }

  .menu {
    display: grid; place-items: center; position: relative; z-index: 2;
    width: 40px; height: 40px; margin-right: -8px; padding: 0;
    background: none; border: 0; color: var(--fg); cursor: pointer;
  }
  .menu span, .menu span::before, .menu span::after {
    display: block; width: 22px; height: 1px; background: currentColor;
    transition: transform .35s var(--ease), opacity .2s var(--ease);
  }
  .menu span { position: relative; }
  .menu span::before, .menu span::after { content: ""; position: absolute; left: 0; }
  .menu span::before { top: -7px; }
  .menu span::after { top: 7px; }
  .menu-open .menu span { background: transparent; }
  .menu-open .menu span::before { transform: translateY(7px) rotate(45deg); }
  .menu-open .menu span::after { transform: translateY(-7px) rotate(-45deg); }

  /* Bottom tab bar: chip tabs, then the globe and the theme toggle, on frosted glass the page scrolls behind */
  .menu { display: none !important; }
  body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .rail__menu {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; align-items: center; gap: 8px;
    padding: 18px var(--gutter) calc(14px + env(safe-area-inset-bottom));
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .rail__menu::-webkit-scrollbar { display: none; }
  .rail__menu::before {
    content: ""; position: fixed; left: 0; right: 0; bottom: 0; z-index: -1; pointer-events: none;
    height: calc(96px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 0%, transparent) 0%, color-mix(in srgb, var(--bg) 62%, transparent) 38%, color-mix(in srgb, var(--bg) 86%, transparent) 100%);
    -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5);
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 34%); mask-image: linear-gradient(180deg, transparent 0%, #000 34%);
  }
  .rail__nav { margin: 0; flex: none; }
  .tabs { flex-direction: row; align-items: center; gap: 8px; }
  .tabs a {
    flex: none; padding: 13px 18px 10px; border: 1px solid var(--fg); border-radius: 8px; /* Hind sits high in its box: extra top padding centres it optically */
    font: 500 16px/1 var(--sans); letter-spacing: .01em; text-transform: none; color: var(--fg);
    background: color-mix(in srgb, var(--bg) 55%, transparent);
    transition: background-color .25s var(--ease), color .25s var(--ease), transform .2s var(--ease);
  }
  .tabs a::after { display: none; }
  .tabs a:active { transform: scale(.96); }
  .tabs a[aria-selected="true"] { background: var(--fg); color: var(--bg); font-style: normal; }
  .rail__tools { flex: none; gap: 8px; }
  .rail__tools .icon-btn {
    width: 40px; height: 40px; margin: 0; border: 1px solid var(--fg); border-radius: 8px;
    background: color-mix(in srgb, var(--bg) 55%, transparent);
  }
  .rail__tools .icon-btn svg { width: 20px; height: 20px; }
  .rail__tools .elsewhere { order: 1; margin: 0; }
  .rail__tools .invert { order: 2; margin: 0; }
  .elsewhere.is-open .elsewhere__btn { background: var(--fg); color: var(--bg); }

  /* Elsewhere becomes a bottom sheet that slides up over a dimmed page */
  .elsewhere::after {
    content: ""; position: fixed; inset: 0; z-index: 35; background: rgba(10, 8, 14, .38);
    opacity: 0; visibility: hidden; transition: opacity .3s var(--ease), visibility 0s linear .3s;
  }
  .elsewhere.is-open::after { opacity: 1; visibility: visible; transition: opacity .3s var(--ease); }
  .elsewhere__menu {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40; min-width: 0;
    padding: 10px 16px calc(24px + env(safe-area-inset-bottom));
    border: 0; border-radius: 24px 24px 0 0; box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, .35);
    background: color-mix(in srgb, var(--bg) 90%, var(--fg) 10%);
    opacity: 1; transform: translateY(105%); transform-origin: 50% 100%;
    transition: transform .45s var(--ease-out), visibility 0s linear .45s;
  }
  .elsewhere__menu::before { content: ""; display: block; width: 40px; height: 5px; margin: 0 auto 6px; border-radius: 3px; background: var(--rule); }
  .elsewhere__top { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 8px 12px; font-size: 14px; font-weight: 500; color: var(--muted); }
  .elsewhere__close { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--rule); border-radius: 12px; background: none; color: var(--fg); cursor: pointer; }
  .elsewhere__close svg { stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; fill: none; }
  .elsewhere.is-open .elsewhere__menu { transform: none; transition: transform .45s var(--ease-out); }
  .elsewhere__menu a { padding: 16px 12px; font-size: 18px; border-bottom: 1px solid var(--rule); border-radius: 0; }
  .elsewhere__menu li:last-child a { border-bottom: 0; }

  /* Summary: the Resume button and the download link share one row, even on narrow phones */
  .hero__actions { flex-wrap: nowrap; gap: 28px; }
  .hero__actions .btn { flex: none; padding: 15px 24px; }
  .hero__actions .link-arrow { white-space: nowrap; }

  /* View titles: "Selected work." on one line, the resume title on two */
  .panel__head .display { font-size: clamp(32px, 10.2vw, 46px); }

  /* Résumé: portrait stacks above the biography */
  .profile { grid-template-columns: 1fr; gap: 28px; }
  .portrait { position: static; max-width: 440px; }

  .hero { min-height: calc(100svh - 69px - 84px); }

  .entry { grid-template-columns: 1fr; gap: 12px; }
  .entry__meta { flex-direction: row; gap: 12px; }
  .entry__meta > * + *::before { content: "·"; margin-right: 12px; }

  .compact li { grid-template-columns: 1fr; gap: 4px; }

  .columns-3 { grid-template-columns: 1fr; gap: 24px; }
  .grid { grid-template-columns: 1fr; }
  .card--feature { grid-template-columns: 1fr; }
  .card--feature .card__title { font-size: clamp(26px, 2.6vw, 34px); } /* every card title the same on phones */
  .case__section { grid-template-columns: 1fr; row-gap: 20px; }
  .case__facts { grid-template-columns: 1fr; gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal-on [data-reveal], .reveal-on .split .w__i { opacity: 1; transform: none; filter: none; }
  .media[data-parallax] > *, .card__media[data-parallax] { transform: none; }
  html { scroll-behavior: auto; }
}

/* Competitive scan (Atmos problem framing) */
.scan { margin: clamp(28px, 3vw, 40px) 0 0; border-top: 1px solid var(--rule, rgba(127,127,127,.25)); }
.scan > div { display: grid; grid-template-columns: 9.5em 1fr; gap: 6px 24px; padding: 14px 0; border-bottom: 1px solid var(--rule, rgba(127,127,127,.25)); }
.scan dt { font-weight: 600; }
.scan dd { margin: 0; }
.scan__src { margin-top: 16px; font-size: .82em; opacity: .75; }
.scan__src a { color: inherit; }
@media (max-width: 600px) { .scan > div { grid-template-columns: 1fr; } }
