/* ───────────── Tokens ───────────── */
:root {
  --bg: #f3f2ee;
  --bg-2: #e8e7e2;
  --fg: #131312;
  --muted: #6f6e69;
  --line: rgba(19, 19, 18, 0.12);
  --accent: #ff4d1c;

  --font-sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.76, 0, 0.24, 1);

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1920px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d0c; --bg-2: #171716; --fg: #ecebe6; --muted: #8b8a85;
    --line: rgba(236, 235, 230, 0.12); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0d0c; --bg-2: #171716; --fg: #ecebe6; --muted: #8b8a85;
  --line: rgba(236, 235, 230, 0.12); color-scheme: dark;
}

/* ───────────── Base ───────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.is-loading { overflow: hidden; }
::selection { background: var(--accent); color: #fff; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
ul { list-style: none; }
em { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
section[id] { scroll-margin-top: 40px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--font-mono); font-size: 12px; font-weight: 400; letter-spacing: 0.02em; text-transform: uppercase; }

/* Theme switch via View Transitions */
.theme-vt::view-transition-old(root), .theme-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
/* Smooth cross-fade between pages (Chrome/Edge/Safari; others just navigate) */
@view-transition { navigation: auto; }

/* Rolling text hover */
.roll { position: relative; display: inline-block; overflow: hidden; vertical-align: top; }
.roll > span { position: relative; display: inline-block; transition: transform 0.6s var(--ease-out); }
.roll > span::after { content: attr(data-text); position: absolute; left: 0; top: 100%; }
a:hover .roll > span, button:hover .roll > span { transform: translateY(-100%); }

/* Grain */
.grain {
  position: fixed; inset: 0; z-index: 9000; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Scroll progress */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 200;
  background: var(--accent); transform-origin: left; transform: scaleX(0);
}

/* ───────────── Cursor ───────────── */
html.has-cursor, html.has-cursor * { cursor: none !important; }
html:not(.has-cursor) .cursor, html:not(.has-cursor) .cursor-label { display: none; }
.cursor {
  position: fixed; top: 0; left: 0; z-index: 10000; pointer-events: none;
  mix-blend-mode: difference; opacity: 0; transition: opacity 0.3s;
}
.cursor.is-visible { opacity: 1; }
.cursor__dot, .cursor__ring { position: fixed; top: 0; left: 0; will-change: transform; }
.cursor__dot i {
  display: block; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: #fff; transition: transform 0.35s var(--ease-out);
}
.cursor__ring i {
  display: block; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.9);
  transition: transform 0.55s var(--ease-out), background-color 0.35s, opacity 0.3s;
}
.cursor.is-hover .cursor__ring i { transform: scale(1.65); background: #fff; }
.cursor.is-hover .cursor__dot i { transform: scale(0); }
.cursor.is-down .cursor__ring i { transform: scale(0.8); }
.cursor.is-hover.is-down .cursor__ring i { transform: scale(1.35); }
.cursor.is-label .cursor__ring i, .cursor.is-label .cursor__dot i { transform: scale(0); opacity: 0; }

.cursor-label { position: fixed; top: 0; left: 0; z-index: 10001; pointer-events: none; will-change: transform; }
.cursor-label__inner {
  display: grid; place-items: center; width: 92px; height: 92px; margin: -46px 0 0 -46px;
  border-radius: 50%; background: var(--accent); color: #fff;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
  transform: scale(0); transition: transform 0.55s var(--ease-out);
}
.cursor-label.is-active .cursor-label__inner { transform: scale(1); }
.cursor-label.is-down .cursor-label__inner { transform: scale(0.88); }

/* ───────────── Preloader ───────────── */
.preloader {
  position: fixed; inset: 0; z-index: 9500; background: var(--fg); color: var(--bg);
  display: flex; flex-direction: column; justify-content: space-between; padding: var(--gutter);
  transition: transform 1.1s var(--ease-io);
}
.preloader.is-done { transform: translateY(-100%); }
.preloader__top { display: flex; justify-content: space-between; opacity: 0.7; }
.preloader__bar {
  height: 1px; background: currentColor; opacity: 0.35; margin-bottom: 20px;
  transform: scaleX(0); transform-origin: left;
}
.preloader__count {
  text-align: right; font-size: clamp(88px, 20vw, 300px); line-height: 0.8;
  letter-spacing: -0.06em; font-weight: 500; font-variant-numeric: tabular-nums;
}

/* ───────────── Header ───────────── */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: transform 0.7s var(--ease-out), background-color 0.4s, color 0.5s;
  border-bottom: 1px solid transparent;
}
.header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  border-bottom-color: var(--line);
}
.header.is-hidden { transform: translateY(-100%); }
.header__inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 24px; }
.logo { display: inline-flex; align-items: center; gap: 12px; font-weight: 500; font-size: 15px; letter-spacing: -0.02em; transition: transform 0.5s var(--ease-out); }
.logo__mark {
  width: 34px; height: 34px; border-radius: 50%; background: var(--fg); color: var(--bg);
  display: grid; place-items: center; font-size: 12px; font-weight: 600; letter-spacing: 0;
  transition: background-color 0.5s, color 0.5s;
}
.nav { display: flex; gap: 32px; }
.nav a { position: relative; font-size: 14px; color: var(--muted); transition: color 0.3s; }
.nav a:hover, .nav a[aria-current="true"] { color: var(--fg); }
.nav a::before {
  content: ""; position: absolute; left: -12px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px;
  border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform 0.4s var(--ease-out);
}
.nav a[aria-current="true"]::before { transform: scale(1); }
.header__right { display: flex; align-items: center; gap: 20px; }
.clock { color: var(--muted); font-variant-numeric: tabular-nums; }
.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  display: grid; place-items: center; transition: transform 0.5s var(--ease-out), background-color 0.3s, border-color 0.3s;
}
.theme-toggle:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.theme-toggle svg { grid-area: 1 / 1; transition: transform 0.6s var(--ease-out), opacity 0.4s; }
[data-theme="dark"] .icon-moon, [data-theme="light"] .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
.menu-btn { display: none; align-items: center; gap: 10px; height: 38px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--line); }
.menu-btn__icon { position: relative; width: 12px; height: 8px; }
.menu-btn__icon::before, .menu-btn__icon::after {
  content: ""; position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor;
  transition: transform 0.5s var(--ease-out), top 0.5s var(--ease-out);
}
.menu-btn__icon::before { top: 0; }
.menu-btn__icon::after { top: 6.5px; }
body.menu-open .menu-btn__icon::before { top: 3.25px; transform: rotate(45deg); }
body.menu-open .menu-btn__icon::after { top: 3.25px; transform: rotate(-45deg); }
body.menu-open .header { color: var(--bg); background: transparent; border-bottom-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
body.menu-open .logo__mark { background: var(--bg); color: var(--fg); }
body.menu-open .menu-btn, body.menu-open .theme-toggle { border-color: color-mix(in srgb, var(--bg) 25%, transparent); }
body.menu-open .clock { color: inherit; opacity: 0.6; }

/* Mobile menu */
.menu {
  position: fixed; inset: 0; z-index: 90; background: var(--fg); color: var(--bg);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 48px;
  padding: 96px var(--gutter) max(32px, env(safe-area-inset-bottom));
  clip-path: inset(0 0 100% 0); transition: clip-path 0.9s var(--ease-io);
}
.menu.is-open { clip-path: inset(0 0 0 0); }
.menu__nav a { display: block; overflow: hidden; font-size: clamp(48px, 14vw, 96px); font-weight: 500; line-height: 1.02; letter-spacing: -0.05em; }
.menu__nav a span { display: block; transform: translateY(105%); transition: transform 0.9s var(--ease-out); }
.menu.is-open .menu__nav a span { transform: none; transition-delay: calc(0.3s + var(--i) * 0.06s); }
.menu__foot { display: flex; justify-content: space-between; gap: 16px; opacity: 0.6; }

/* ───────────── Reveal primitives ───────────── */
/* Extra room inside the mask so descenders (g, y, p) and italic overhangs never get clipped */
.line { display: block; overflow: hidden; padding: 0 0.1em 0.18em 0; margin: 0 -0.1em -0.18em 0; }
.line__inner { display: block; transform: translateY(110%); transition: transform 1.3s var(--ease-out); transition-delay: calc(var(--i, 0) * 0.09s); }
.is-ready .hero .line__inner, [data-split].is-in .line__inner { transform: none; }
.fade-up { opacity: 0; transform: translateY(16px); transition: opacity 1.1s var(--ease-out), transform 1.1s var(--ease-out); transition-delay: var(--d, 0s); }
.is-ready .fade-up { opacity: 1; transform: none; }
[data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity 1.2s var(--ease-out), transform 1.2s var(--ease-out); transition-delay: var(--d, 0s); }
[data-reveal].is-in { opacity: 1; transform: none; }
[data-magnetic] { transition: transform 0.6s var(--ease-out); will-change: transform; }

/* ───────────── Hero ───────────── */
.hero { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end; padding: 120px 0 40px; }
.hero__meta { display: flex; justify-content: space-between; gap: 24px; margin-bottom: clamp(28px, 5vh, 56px); color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); }
.status__dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #2fbf71; }
.status__dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: ping 2s var(--ease-out) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(3.2); opacity: 0; } }
.hero__name {
  font-size: clamp(64px, 12.5vw, 280px); line-height: 0.82; letter-spacing: -0.065em; font-weight: 500;
}
.hero__first, .hero__last { display: block; overflow: hidden; padding: 0 0.06em 0.1em 0.02em; margin: 0 0 -0.1em -0.07em; white-space: nowrap; }
@media (max-width: 860px) { .hero__name { font-size: 19vw; } }
.hero__row2 { display: flex; align-items: flex-end; justify-content: flex-end; gap: clamp(16px, 3vw, 64px); }
.hero__aside {
  font-size: clamp(18px, 2vw, 46px); line-height: 1.08; letter-spacing: -0.03em; font-weight: 400;
  color: var(--muted); padding-bottom: 0.9em; text-align: right;
}
.hero__aside em { color: var(--fg); font-size: 1.12em; }
.char { display: inline-block; transform: translateY(102%); transition: transform 1.3s var(--ease-out); transition-delay: calc(var(--i) * 0.045s + 0.05s); }
.is-ready .char { transform: none; }
.hero__bottom {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: clamp(32px, 5vw, 96px);
  margin-top: clamp(36px, 6vh, 72px); padding-top: 24px; border-top: 1px solid var(--line);
}
.hero__facts { display: flex; gap: clamp(24px, 3vw, 56px); }
.hero__facts dt { color: var(--muted); margin-bottom: 6px; }
.hero__facts dd { font-size: clamp(16px, 1.3vw, 20px); letter-spacing: -0.02em; white-space: nowrap; }
.hero__intro { max-width: 52ch; font-size: clamp(16px, 1.3vw, 20px); line-height: 1.55; color: var(--muted); }
.hero__intro em { color: var(--fg); font-size: 1.12em; }
.scroll-hint { display: inline-flex; align-items: center; gap: 14px; color: var(--muted); padding: 8px 0; }
.scroll-hint__line { position: relative; width: 64px; height: 1px; background: var(--line); overflow: hidden; }
.scroll-hint__line::after { content: ""; position: absolute; inset: 0; background: var(--fg); animation: scan 2.2s var(--ease-io) infinite; }
@keyframes scan { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }

/* ───────────── Marquee ───────────── */
.marquee {
  display: flex; overflow: hidden; user-select: none; border-block: 1px solid var(--line); padding: 26px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee__group { display: flex; flex-shrink: 0; align-items: center; gap: 44px; padding-right: 44px; animation: marquee 48s linear infinite; }
.marquee:hover .marquee__group { animation-play-state: paused; }
.marquee__item { font-size: clamp(30px, 4.2vw, 60px); font-weight: 500; letter-spacing: -0.045em; white-space: nowrap; line-height: 1.1; }
.marquee__item:nth-of-type(even) { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: -0.02em; }
.marquee__sep { color: var(--accent); font-size: clamp(16px, 1.8vw, 24px); }
@keyframes marquee { to { transform: translateX(-100%); } }

/* ───────────── Sections ───────────── */
.section { padding: clamp(100px, 17vh, 190px) 0 0; }
.section__title { font-size: clamp(44px, 7vw, 132px); font-weight: 500; letter-spacing: -0.05em; line-height: 0.98; margin-bottom: clamp(36px, 5vw, 64px); }
.section__head { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.section__head a { color: var(--fg); }

/* Tags */
.tag {
  display: inline-block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); white-space: nowrap;
}

/* ───────────── Work ───────────── */
.work-row { position: relative; border-bottom: 1px solid var(--line); }
.work-row::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--fg);
  transform: scaleX(0); transform-origin: right; transition: transform 0.9s var(--ease-out);
}
.work-row:hover::after { transform: scaleX(1); transform-origin: left; }
.work-row > a {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) minmax(0, 260px) 64px 46px; align-items: center; gap: 24px;
  padding: clamp(26px, 3.4vw, 44px) 0; transition: opacity 0.6s var(--ease-out);
}
@media (hover: hover) {
  .work-list:hover .work-row:not(:hover) > a { opacity: 0.28; }
}
.work-row__index, .work-row__year { color: var(--muted); }
.work-row__year { text-align: right; }
.work-row__main { display: block; transition: transform 0.8s var(--ease-out); }
.work-row:hover .work-row__main { transform: translateX(18px); }
.work-row__title { display: block; font-size: clamp(30px, 4.6vw, 88px); font-weight: 500; letter-spacing: -0.05em; line-height: 1; }
.work-row__desc { display: block; margin-top: 12px; max-width: 52ch; color: var(--muted); font-size: 15px; line-height: 1.45; }
.work-row__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.work-row__arrow {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center;
  transition: background-color 0.4s, color 0.4s, border-color 0.4s;
}
.work-row__arrow svg { transform: rotate(45deg); transition: transform 0.7s var(--ease-out); }
.work-row:hover .work-row__arrow { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.work-row:hover .work-row__arrow svg { transform: rotate(0); }
.work-row__thumb { display: none; }

/* Floating preview */
.preview {
  position: fixed; top: 0; left: 0; z-index: 60; pointer-events: none;
  width: clamp(280px, 25vw, 400px); aspect-ratio: 4 / 3; will-change: transform;
}
.preview__inner {
  width: 100%; height: 100%; overflow: hidden; border-radius: 14px;
  clip-path: inset(50% 50% 50% 50% round 14px); transition: clip-path 0.7s var(--ease-out);
}
.preview.is-active .preview__inner { clip-path: inset(0 0 0 0 round 14px); }
.preview__track { height: 100%; transition: transform 0.8s var(--ease-out); }
.preview__item { height: 100%; }

/* Generated project art */
.art { position: relative; width: 100%; height: 100%; background: var(--c3); overflow: hidden; display: grid; place-items: center; isolation: isolate; }
.art::before {
  content: ""; position: absolute; inset: -25%; z-index: -1; filter: blur(24px);
  background:
    radial-gradient(circle at 28% 32%, var(--c1), transparent 52%),
    radial-gradient(circle at 74% 70%, var(--c2), transparent 48%);
  animation: drift 14s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate(6%, -4%) rotate(14deg) scale(1.08); } }
.art__label { color: #fff; font-family: var(--font-serif); font-style: italic; font-size: clamp(40px, 4.6vw, 72px); letter-spacing: -0.02em; line-height: 1; text-shadow: 0 2px 30px rgba(0, 0, 0, 0.2); }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ───────────── About ───────────── */
.about__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(40px, 6vw, 104px); padding-top: clamp(40px, 5vw, 64px); }
.about__side { position: relative; }
.portrait { position: sticky; top: 110px; aspect-ratio: 4 / 5; border-radius: 16px; overflow: hidden; }
.portrait .art__label { font-size: clamp(80px, 11vw, 180px); }
.statement { font-size: clamp(26px, 2.9vw, 44px); line-height: 1.16; letter-spacing: -0.035em; font-weight: 500; }
.statement .w { opacity: 0.16; transition: opacity 0.5s var(--ease-out); }
.statement .w.is-lit { opacity: 1; }
#about-paragraphs p { margin-top: 24px; max-width: 58ch; color: var(--muted); font-size: 17px; line-height: 1.6; }
#about-paragraphs p:first-child { margin-top: 48px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 64px; border-top: 1px solid var(--line); }
.stat { padding: 28px 16px 0 0; }
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--line); }
.stat__value { display: block; font-size: clamp(44px, 5.4vw, 80px); font-weight: 500; letter-spacing: -0.06em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat__label { display: block; margin-top: 12px; color: var(--muted); }
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 32px; margin-top: 72px; }
.skills h3 { color: var(--muted); margin-bottom: 14px; }
.skills li { font-size: 17px; padding: 3px 0; letter-spacing: -0.01em; }

/* ───────────── Experience ───────────── */
.xp__item { border-bottom: 1px solid var(--line); }
.xp__btn { width: 100%; display: grid; grid-template-columns: 200px minmax(0, 1.2fr) minmax(0, 1fr) 40px; gap: 24px; align-items: center; text-align: left; padding: 30px 0; }
.xp__period { color: var(--muted); }
.xp__role { font-size: clamp(20px, 2.1vw, 30px); font-weight: 500; letter-spacing: -0.035em; line-height: 1.15; transition: transform 0.7s var(--ease-out); }
.xp__btn:hover .xp__role { transform: translateX(10px); }
.xp__company { color: var(--muted); font-size: 16px; }
.xp__company strong { color: var(--fg); font-weight: 500; }
.xp__icon { position: relative; justify-self: end; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); transition: background-color 0.4s, color 0.4s, transform 0.7s var(--ease-out); }
.xp__icon::before, .xp__icon::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 1.5px; margin: -0.75px 0 0 -6px; background: currentColor; transition: transform 0.6s var(--ease-out); }
.xp__icon::after { transform: rotate(90deg); }
.xp__btn:hover .xp__icon { background: var(--fg); color: var(--bg); }
.xp__item.is-open .xp__icon { transform: rotate(180deg); }
.xp__item.is-open .xp__icon::after { transform: rotate(0); }
.xp__panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.8s var(--ease-out); }
.xp__item.is-open .xp__panel { grid-template-rows: 1fr; }
.xp__panel > div { overflow: hidden; min-height: 0; }
.xp__content {
  display: grid; gap: 18px; max-width: 64ch; margin-left: 224px; padding-bottom: 36px;
  opacity: 0; transform: translateY(-8px); transition: opacity 0.6s var(--ease-out), transform 0.8s var(--ease-out);
}
.xp__item.is-open .xp__content { opacity: 1; transform: none; transition-delay: 0.1s; }
.xp__content p { color: var(--muted); font-size: 17px; line-height: 1.6; }
.xp__content ul { display: grid; gap: 8px; }
.xp__content li { position: relative; padding-left: 22px; }
.xp__content li::before { content: ""; position: absolute; left: 0; top: 0.7em; width: 10px; height: 1px; background: var(--accent); }
.xp__tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ───────────── Contact ───────────── */
#contact { text-align: center; }
.contact__label { color: var(--muted); }
.socials { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px 36px; margin-top: 28px; }
.social { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; color: var(--muted); transition: color 0.3s; }
.social:hover { color: var(--fg); }
.social svg { transition: transform 0.6s var(--ease-out); }
.social:hover svg { transform: translate(2px, -2px); }
.footer {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: clamp(110px, 16vh, 180px); padding: 24px 0 max(28px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted);
}
.footer [data-clock] { color: var(--fg); font-variant-numeric: tabular-nums; }
.to-top { color: var(--fg); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 300; display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: 99px; background: var(--fg); color: var(--bg); font-size: 14px;
  transform: translate(-50%, calc(100% + 60px)); visibility: hidden; pointer-events: none;
  transition: transform 0.7s var(--ease-out), visibility 0s 0.7s;
}
.toast.is-show { visibility: visible; transition: transform 0.7s var(--ease-out), visibility 0s; }
.toast::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #2fbf71; }
.toast.is-show { transform: translate(-50%, 0); }

/* ───────────── Responsive ───────────── */
@media (max-width: 1100px) {
  .hero__bottom { grid-template-columns: minmax(0, 1fr) auto; }
  .scroll-hint { display: none; }
  .work-row > a { grid-template-columns: 44px minmax(0, 1fr) 56px 46px; }
  .work-row__tags { display: none; }
  .clock__place { display: none; }
}
@media (max-width: 860px) {
  .nav, .clock { display: none; }
  .menu-btn { display: inline-flex; }
  .hide-sm { display: none; }
  .hero__bottom { grid-template-columns: 1fr; gap: 28px; }
  .hero__row2 { flex-direction: column-reverse; align-items: flex-start; gap: 0; }
  .hero__aside { text-align: left; padding: 0.7em 0 0; }
  .work-row > a { grid-template-columns: minmax(0, 1fr) auto; gap: 16px 20px; padding: 28px 0 32px; }
  .work-row__thumb { display: block; grid-column: 1 / -1; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; }
  .work-row__index { display: none; }
  .work-row__main { grid-column: 1 / -1; }
  .work-row:hover .work-row__main { transform: none; }
  .work-row__tags { display: flex; grid-column: 1; }
  .work-row__year { display: none; }
  .work-row__arrow { grid-column: 2; grid-row: 3; }
  .about__grid { grid-template-columns: 1fr; }
  .portrait { position: relative; top: 0; max-width: 420px; }
  .stat + .stat { padding-left: 14px; }
  .xp__btn { grid-template-columns: minmax(0, 1fr) 40px; gap: 6px 16px; padding: 24px 0; }
  .xp__period { grid-column: 1; grid-row: 1; }
  .xp__role { grid-column: 1; grid-row: 2; }
  .xp__company { grid-column: 1; grid-row: 3; }
  .xp__icon { grid-column: 2; grid-row: 1 / 4; align-self: center; }
  .xp__content { margin-left: 0; }
  .footer { justify-content: center; flex-direction: column; }
}
@media (hover: none) { .preview { display: none; } }

/* ───────────── Reduced motion ───────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .statement .w { opacity: 1; }
}

/* ═════════════ Project cover: a phone screenshot inside the art ═════════════ */
.art--phone { place-items: end center; }
.art--phone::before {
  background:
    radial-gradient(circle at 50% 115%, var(--c1), transparent 55%),
    radial-gradient(circle at 15% 5%, var(--c2), transparent 50%);
  opacity: 0.85;
}
.art__phone {
  position: relative; width: 40%; aspect-ratio: 9 / 19.5; margin-bottom: -30%;
  border-radius: 14% / 6.5%; background: linear-gradient(145deg, #2c2c2c, #0a0a0a);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5); transform: rotate(-6deg);
  transition: transform 1.2s var(--ease-out);
}
.art__phone img { position: absolute; top: 1.1%; left: 2.4%; width: 95.2%; height: 97.8%; max-width: none; object-fit: cover; object-position: top; border-radius: 12% / 5.6%; }
.work-row:hover .art__phone, .preview.is-active .art__phone { transform: rotate(-2deg) translateY(-6%); }

/* ═════════════ Case study pages ═════════════ */
.case-page { --accent: #34c759; }
.case-hero { padding: 130px 0 0; }
.case-hero__top { display: flex; justify-content: space-between; gap: 24px; color: var(--muted); padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.back { display: inline-flex; align-items: center; gap: 8px; color: var(--fg); }
.case-hero__title { display: flex; align-items: center; gap: clamp(16px, 3vw, 56px); margin-top: clamp(40px, 8vh, 96px); }
.case-hero__mark { width: clamp(64px, 10vw, 200px); height: auto; flex-shrink: 0; }
.case-hero__mark g g { transform-box: view-box; transform-origin: 512px 512px; animation: aperture 24s linear infinite; }
@keyframes aperture { to { transform: rotate(360deg); } }
.case-title { font-size: clamp(64px, 12.5vw, 260px); line-height: 0.86; letter-spacing: -0.065em; font-weight: 500; }
.case-title__sub { font-size: 0.4em; line-height: 1; color: var(--muted); letter-spacing: -0.02em; }
.is-ready .case-hero .line__inner { transform: none; }
.case-hero__bottom {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px 64px; align-items: end;
  margin-top: clamp(32px, 6vh, 64px); padding-top: 24px; border-top: 1px solid var(--line);
}
.case-lede { max-width: 46ch; font-size: clamp(18px, 1.6vw, 24px); line-height: 1.45; letter-spacing: -0.015em; }
.case-lede em { font-size: 1.1em; }
.case-meta { display: flex; gap: clamp(24px, 3vw, 48px); }
.case-meta dt { color: var(--muted); margin-bottom: 6px; }
.case-meta dd { font-size: 15px; white-space: nowrap; }
.case-links { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 22px; border-radius: 99px;
  border: 1px solid var(--line); font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
  transition: background-color 0.4s, color 0.4s, border-color 0.4s, transform 0.6s var(--ease-out);
}
.pill:hover { border-color: var(--fg); }
.pill--solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pill--solid:hover { background: #34c759; border-color: #34c759; color: #04140a; }

/* Phones */
.phone {
  position: relative; aspect-ratio: 9 / 19.5; border-radius: 13% / 6%;
  background: linear-gradient(145deg, #2e2e2e, #0a0a0a);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 40px 80px -24px rgba(0, 0, 0, 0.55);
}
/* inset % is measured against the phone itself: top/bottom by height, sides by width */
.phone > img, .phone > video { position: absolute; top: 1.1%; left: 2.4%; display: block; width: 95.2%; height: 97.8%; max-width: none; object-fit: cover; object-position: top; border-radius: 11% / 5.1%; background: #000; }

/* Hero stage */
.stage {
  position: relative; isolation: isolate; overflow: hidden; aspect-ratio: 16 / 9; margin-top: clamp(40px, 6vw, 80px);
  border-radius: clamp(16px, 2vw, 28px); background: #050806;
}
.stage__glow {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 70% at 50% 105%, rgba(52, 199, 89, 0.5), transparent 70%),
    radial-gradient(40% 50% at 12% 0%, rgba(52, 199, 89, 0.14), transparent 70%);
}
.stage__phones { display: flex; justify-content: center; align-items: flex-start; gap: clamp(16px, 3.4vw, 64px); height: 100%; padding-top: 6%; }
.stage .phone--main { width: clamp(150px, 27%, 420px); }
.stage .phone--side { width: clamp(120px, 21.5%, 335px); margin-top: 10%; }

/* Sections */
.case-section { padding-top: clamp(110px, 18vh, 200px); }
.case-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; }
.case-label { color: var(--muted); padding-top: 0.8em; }
.case-section .statement { font-size: clamp(28px, 3.6vw, 60px); line-height: 1.12; }
.case-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); }
.case-cols h3 { color: var(--muted); margin-bottom: 12px; }
.case-cols p { font-size: 16px; line-height: 1.6; }

/* Steps */
.steps { display: grid; gap: clamp(64px, 10vw, 140px); margin-top: clamp(48px, 6vw, 96px); }
.step { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 120px); align-items: center; }
.step--flip .step__text { order: 2; }
.step__num { display: block; margin-bottom: 20px; color: var(--accent); }
.step h3 { margin-bottom: 24px; font-size: clamp(36px, 4.6vw, 80px); font-weight: 500; letter-spacing: -0.05em; line-height: 1; }
.step p { max-width: 44ch; color: var(--muted); font-size: clamp(16px, 1.3vw, 19px); line-height: 1.6; }
.step__media {
  position: relative; overflow: hidden; display: grid; place-items: center; padding: clamp(32px, 5vw, 72px) 0;
  border-radius: clamp(16px, 2vw, 28px); background: var(--bg-2);
}
.step__media .phone { width: clamp(180px, 46%, 320px); transition: transform 1.2s var(--ease-out); }
.step__media:hover .phone { transform: translateY(-10px) rotate(-1.5deg); }

/* Bento */
.bento { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 40px; }
.tile { display: flex; flex-direction: column; overflow: hidden; border-radius: clamp(16px, 1.6vw, 24px); background: var(--bg-2); }
.tile--wide { grid-column: span 2; }
.tile figcaption, .tile--list { padding: 24px 26px 28px; }
.tile h3 { margin-bottom: 6px; font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
.tile p { color: var(--muted); font-size: 15px; line-height: 1.5; }
.tile__media { flex: 1; display: grid; place-items: center; padding: 28px 28px 0; }
.tile__media img { width: 100%; max-width: 380px; border-radius: 18px; }
.tile__media--widgets { grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; padding-bottom: 0; }
.tile__media--widgets img { max-width: none; border-radius: 18px; }
.compare {
  --pos: 50%; position: relative; overflow: hidden; width: min(62%, 250px); aspect-ratio: 900 / 1957; margin: 28px auto 0;
  border-radius: 26px; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.4);
}
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.compare__top { clip-path: inset(0 0 0 var(--pos)); }
.compare__handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; pointer-events: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15); }
.compare__handle::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  background: #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6 3 12l6 6M15 6l6 6-6 6'/%3E%3C/svg%3E");
  background-size: 16px; background-position: center; background-repeat: no-repeat;
}
.compare input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.mini { display: grid; gap: 20px; }
.mini li { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.mini li:last-child { padding-bottom: 0; border-bottom: 0; }

/* Engineering */
.case-stats { margin-top: 0; border-top: 0; }
.stack { margin-top: 56px; border-top: 1px solid var(--line); }
.stack__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 24px; padding: 32px 0; border-bottom: 1px solid var(--line); }
.stack__name { font-size: clamp(22px, 2.4vw, 36px); font-weight: 500; letter-spacing: -0.04em; line-height: 1.1; }
.stack__row p { max-width: 62ch; color: var(--muted); font-size: 17px; line-height: 1.6; }
.stack__row p em { color: var(--fg); }
code { padding: 2px 6px; border-radius: 6px; background: var(--bg-2); color: var(--fg); font-family: var(--font-mono); font-size: 0.86em; }

/* Next / footer */
.next { display: block; padding: clamp(48px, 8vw, 120px) 0; border-block: 1px solid var(--line); text-align: center; }
.next__label { display: block; margin-bottom: 16px; color: var(--muted); }
.next__title { display: inline-block; font-size: clamp(56px, 10vw, 200px); font-weight: 500; letter-spacing: -0.06em; line-height: 0.95; transition: transform 0.9s var(--ease-out); }
.next:hover .next__title { transform: translateX(-12px); }
.case-contact { margin-top: clamp(80px, 12vh, 140px); text-align: center; }

@media (max-width: 860px) {
  .case-hero { padding-top: 104px; }
  .case-title { font-size: 25vw; }
  .case-hero__bottom { grid-template-columns: 1fr; }
  .case-meta { flex-wrap: wrap; gap: 16px 28px; }
  .stage { aspect-ratio: 4 / 5; }
  .stage .phone--side:first-child { display: none; }
  .stage .phone--main { width: 50%; }
  .stage .phone--side { width: 38%; }
  .case-grid { grid-template-columns: 1fr; }
  .case-cols { grid-template-columns: 1fr; gap: 28px; margin-top: 48px; }
  .step { grid-template-columns: 1fr; }
  .step--flip .step__text { order: 0; }
  .bento { grid-template-columns: 1fr; }
  .tile--wide { grid-column: auto; }
  .stack__row { grid-template-columns: 1fr; gap: 10px; }
}
