/* ==========================================================================
   Ivan Anikin — site styles
   Dark by default, light via [data-theme="light"]. Everything colour-related
   goes through the tokens below, so a theme is just a different token set.
   Motion is layered on top by site.js; without it the page is fully static
   and fully readable.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #0b0b0c;
  --bg-2: #111113;
  --surface: #151518;
  --surface-2: #1c1c20;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #eeede8;
  --muted: #8f8e88;
  --accent: #82cfff;          /* fills: buttons, dots, highlights */
  --accent-text: #82cfff;     /* accent used as text on --bg */
  --accent-ink: #0b0b0c;      /* text sitting on an accent fill */
  --accent-soft: rgba(130, 207, 255, 0.13);
  --danger: #ff7a6b;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
  --grain-opacity: 0.06;

  --tone-core: var(--accent);
  --tone-ai: #a78bfa;
  --tone-web: #fb923c;
  --tone-cloud: #fbbf24;
  --tone-test: #34d399;

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;

  --header-h: 64px;
  --gutter: clamp(16px, 4vw, 48px);
  --radius: 22px;
  --radius-sm: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f2ec;
  --bg-2: #eae9e2;
  --surface: #fbfaf6;
  --surface-2: #ffffff;
  --line: rgba(17, 17, 16, 0.1);
  --line-strong: rgba(17, 17, 16, 0.24);
  --text: #121211;
  --muted: #62615b;
  --accent: #82cfff;
  --accent-text: #0a6fb5;
  --accent-ink: #121211;
  --accent-soft: rgba(10, 111, 181, 0.1);
  --danger: #c2341f;
  --shadow: 0 30px 70px -35px rgba(40, 40, 30, 0.35);
  --grain-opacity: 0.035;
  --tone-ai: #7c3aed;
  --tone-web: #ea580c;
  --tone-cloud: #d97706;
  --tone-test: #059669;
  color-scheme: light;
}

/* No-JS visitors still get their OS preference. */
@media (prefers-color-scheme: light) {
  html:not(.js):not([data-theme="dark"]) { color-scheme: light; }
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 32px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: 1320px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.mono { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
.muted { color: var(--muted); }

.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 1000;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 999px; font-weight: 500;
  transition: top 0.2s;
}
.skip-link:focus { top: 16px; }

.link {
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.3s, text-decoration-color 0.3s;
}
.link:hover { color: var(--accent-text); text-decoration-color: currentColor; }

/* ---------- Lenis ---------- */
html.lenis, html.lenis body { height: auto; }
html.lenis { scroll-behavior: auto; } /* Lenis animates scrolling itself */
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- Ambient layers ---------- */
.grain {
  position: fixed; inset: -50%; z-index: 90; pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.scroll-progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 120; pointer-events: none;
}
.scroll-progress span {
  display: block; height: 100%; width: 100%;
  background: var(--accent);
  transform: scaleX(0); transform-origin: 0 50%;
}

/* ---------- Custom cursor (fine pointers only; enabled by JS) ---------- */
.cursor { display: none; }
html.has-cursor .cursor { display: block; }
html.has-cursor,
html.has-cursor a,
html.has-cursor button,
html.has-cursor [data-cursor] { cursor: none; }
html.has-cursor input,
html.has-cursor textarea { cursor: text; }
html.has-cursor canvas#flappy-canvas { cursor: pointer; }

.cursor-dot,
.cursor-ring {
  position: fixed; left: 0; top: 0; z-index: 200; pointer-events: none;
  border-radius: 50%;
  will-change: transform;
}
.cursor-dot {
  width: 6px; height: 6px; margin: -3px 0 0 -3px;
  background: var(--accent);
}
.cursor-ring {
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  display: grid; place-items: center;
}
.cursor-ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid var(--line-strong);
  transition: transform 0.45s var(--ease), background-color 0.35s, border-color 0.35s;
}
.cursor.is-hover .cursor-ring::before { transform: scale(1.55); border-color: var(--accent); background: var(--accent-soft); }
.cursor.is-label .cursor-ring::before { transform: scale(2.6); background: var(--accent); border-color: var(--accent); }
.cursor.is-label .cursor-dot,
.cursor.is-hidden .cursor-dot,
.cursor.is-hidden .cursor-ring { opacity: 0; }
.cursor-label {
  position: relative; font-family: var(--font-mono); font-size: 0.68rem;
  letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  color: var(--accent-ink); opacity: 0; transform: scale(0.6);
  transition: opacity 0.25s, transform 0.4s var(--ease);
}
.cursor.is-label .cursor-label { opacity: 1; transform: scale(1); }
.cursor-dot, .cursor-ring { transition: opacity 0.25s; }

/* ---------- Buttons ---------- */
.btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 24px; border-radius: 999px;
  font-weight: 500; font-size: 0.98rem; line-height: 1; white-space: nowrap;
  transition: color 0.4s var(--ease), border-color 0.4s;
}
.btn-sm { padding: 11px 18px; font-size: 0.9rem; }
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  transform: translateY(101%); transition: transform 0.5s var(--ease);
}
.btn:hover::before, .btn:focus-visible::before { transform: translateY(0); }

.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent::before { background: var(--text); }
.btn-accent:hover { color: var(--bg); }

.btn-ghost { border: 1px solid var(--line-strong); color: var(--text); }
.btn-ghost::before { background: var(--text); }
.btn-ghost:hover { color: var(--bg); border-color: var(--text); }

.btn:disabled { opacity: 0.6; pointer-events: none; }
.btn .icon { transition: transform 0.4s var(--ease); }
.btn:hover .icon-arrow-up-right { transform: translate(2px, -2px); }
.btn:hover .icon-arrow-down { transform: translateY(2px); }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line);
  transition: border-color 0.3s, background-color 0.3s;
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }

.arrow-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 500; font-size: 0.92rem;
  padding-bottom: 2px;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0% 1px no-repeat;
  transition: background-size 0.45s var(--ease), color 0.3s;
}
.arrow-link:hover { background-size: 100% 1px; color: var(--accent-text); }
.arrow-link .icon { transition: transform 0.4s var(--ease); }
.arrow-link:hover .icon { transform: translate(2px, -2px); }

.pill {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.75rem;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; z-index: 100;
  top: 14px; left: 50%;
  width: calc(min(1320px, 100%) - 2 * var(--gutter) + 24px);
  height: var(--header-h);
  transform: translateX(-50%);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 10px 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.6s var(--ease), background-color 0.4s, border-color 0.4s, backdrop-filter 0.4s;
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-color: var(--line);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
}
.site-header.is-hidden { transform: translate(-50%, calc(-100% - 24px)); }

.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 500; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--text); color: var(--bg);
  font-size: 0.8rem; font-weight: 600; letter-spacing: -0.02em;
  transition: background-color 0.3s, transform 0.6s var(--ease);
}
.brand:hover .brand-mark { background: var(--accent); color: var(--accent-ink); transform: rotate(-12deg); }
.brand-name { font-size: 0.98rem; letter-spacing: -0.01em; }

.nav {
  position: relative; display: flex; gap: 2px;
  padding: 4px; border-radius: 999px;
}
.nav a {
  position: relative; z-index: 1;
  padding: 9px 16px; border-radius: 999px;
  font-size: 0.92rem; color: var(--muted);
  transition: color 0.3s;
}
.nav a:hover, .nav a.is-active { color: var(--text); }
.nav-indicator {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0;
  border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line);
  opacity: 0;
  transition: transform 0.5s var(--ease), width 0.5s var(--ease), opacity 0.3s;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle { position: relative; overflow: hidden; }
.theme-icon { position: absolute; inset: 0; display: grid; place-items: center; transition: transform 0.6s var(--ease), opacity 0.4s; }
:root[data-theme="dark"] .theme-icon-moon,
:root[data-theme="light"] .theme-icon-sun { transform: translateY(120%) rotate(90deg); opacity: 0; }

.menu-toggle { display: none; }
.menu-bars { position: relative; width: 18px; height: 10px; display: block; }
.menu-bars span {
  position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor; border-radius: 2px;
  transition: transform 0.5s var(--ease), top 0.5s var(--ease);
}
.menu-bars span:first-child { top: 0; }
.menu-bars span:last-child { top: 8.5px; }
html.menu-open .menu-bars span:first-child { top: 4.25px; transform: rotate(45deg); }
html.menu-open .menu-bars span:last-child { top: 4.25px; transform: rotate(-45deg); }

.mobile-menu {
  position: fixed; inset: 0; z-index: 95;
  background: var(--bg);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(var(--header-h) + 56px) var(--gutter) 32px;
  clip-path: inset(0 0 100% 0);
  visibility: hidden;
  transition: clip-path 0.8s var(--ease-in-out), visibility 0s linear 0.8s;
}
html.menu-open .mobile-menu {
  clip-path: inset(0 0 0 0); visibility: visible;
  transition: clip-path 0.8s var(--ease-in-out), visibility 0s;
}
.mobile-menu nav { display: flex; flex-direction: column; }
.mobile-menu nav a {
  display: flex; align-items: baseline; gap: 16px;
  font-size: clamp(2.4rem, 11vw, 4rem); font-weight: 500; letter-spacing: -0.04em; line-height: 1.15;
  border-bottom: 1px solid var(--line); padding: 6px 0;
  transform: translateY(30px); opacity: 0;
  transition: transform 0.7s var(--ease), opacity 0.5s;
}
.mobile-menu nav a span { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.04em; color: var(--accent-text); }
html.menu-open .mobile-menu nav a { transform: none; opacity: 1; }
html.menu-open .mobile-menu nav a:nth-child(1) { transition-delay: 0.25s; }
html.menu-open .mobile-menu nav a:nth-child(2) { transition-delay: 0.3s; }
html.menu-open .mobile-menu nav a:nth-child(3) { transition-delay: 0.35s; }
html.menu-open .mobile-menu nav a:nth-child(4) { transition-delay: 0.4s; }
html.menu-open .mobile-menu nav a:nth-child(5) { transition-delay: 0.45s; }
html.menu-open .mobile-menu nav a:nth-child(6) { transition-delay: 0.5s; }
.mobile-menu-foot { display: flex; flex-direction: column; gap: 6px; color: var(--muted); }

/* ---------- Hero ---------- */
.hero {
  position: relative; isolation: isolate;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding-top: calc(var(--header-h) + 60px);
  overflow: hidden;
}
.hero-field { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; }
.hero-glow {
  position: absolute; z-index: -1; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px circle at var(--gx, 75%) var(--gy, 30%), var(--accent-soft), transparent 60%),
    linear-gradient(to bottom, transparent 55%, var(--bg));
}

.hero-inner { padding-bottom: clamp(24px, 4vw, 48px); }

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 60%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 0.88rem; color: var(--muted);
  margin-bottom: clamp(20px, 3vw, 36px);
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  80%, 100% { box-shadow: 0 0 0 10px transparent; }
}

.hero-title {
  font-size: clamp(4.6rem, 21vw, 16.5rem);
  font-weight: 500;
  line-height: 0.86;
  letter-spacing: -0.065em;
  margin-left: -0.05em;
}
.hero-line { display: block; overflow: hidden; padding-bottom: 0.04em; }
.hero-line-2 { padding-left: clamp(0px, 14vw, 230px); }

/* First line: "Ivan" + face. The mask moves onto the letters so the round
   avatar (and its ring) is never clipped by the line box. */
.hero-line-1 { display: flex; align-items: center; gap: 0.16em; overflow: visible; }
.hero-chars { display: inline-block; overflow: hidden; padding-bottom: 0.04em; }
.hero-avatar {
  position: relative; flex-shrink: 0;
  width: max(0.7em, 64px); height: max(0.7em, 64px);
  border-radius: 50%;
  padding: max(0.022em, 3px);
  margin-top: 0.06em;
}
.hero-avatar::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), transparent 35%, transparent 55%, var(--accent));
  animation: spin 7s linear infinite;
}
.hero-avatar img {
  position: relative; width: 100%; height: 100%; border-radius: 50%;
  object-fit: cover; border: max(0.016em, 2px) solid var(--bg);
  transition: transform 0.8s var(--ease);
}
.hero-avatar:hover img { transform: scale(1.06) rotate(-4deg); }
@keyframes spin { to { transform: rotate(360deg); } }
.hero-dot { font-style: normal; color: var(--accent); }
.char { display: inline-block; will-change: transform; }

.hero-bottom {
  display: grid; grid-template-columns: 1.1fr 1fr auto; align-items: end; gap: 24px 48px;
  margin-top: clamp(28px, 4vw, 48px);
}
.hero-roles { font-size: clamp(1.4rem, 2.6vw, 2.2rem); letter-spacing: -0.02em; line-height: 1.2; }
.role-rotator { display: inline-grid; vertical-align: bottom; overflow: hidden; padding-right: 0.1em; }
.role {
  grid-area: 1 / 1; white-space: nowrap;
  font-family: var(--font-serif); font-style: italic; font-size: 1.12em; color: var(--accent-text);
  transform: translateY(105%); opacity: 0;
  transition: transform 0.8s var(--ease), opacity 0.5s;
}
.role.is-active { transform: none; opacity: 1; }
.role.is-leaving { transform: translateY(-105%); opacity: 0; }

.hero-lede { color: var(--muted); max-width: 42ch; font-size: 1.02rem; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.hero-meta {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 18px; padding-bottom: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.clock { color: var(--text); margin-left: 6px; font-variant-numeric: tabular-nums; }
.scroll-cue { display: inline-flex; align-items: center; gap: 10px; }
.scroll-cue-line { width: 1px; height: 28px; background: var(--line-strong); position: relative; overflow: hidden; }
.scroll-cue-line::after {
  content: ""; position: absolute; left: 0; top: -100%; width: 100%; height: 100%;
  background: var(--accent); animation: cue 2s var(--ease-in-out) infinite;
}
@keyframes cue { 0% { top: -100%; } 60%, 100% { top: 100%; } }

/* Hero entrance — hidden only while JS is about to animate it in. */
.js .hero-anim { opacity: 0; }
.js [data-split-chars] { visibility: hidden; }
.js .hero-dot,
.js .hero-avatar { opacity: 0; }

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding: clamp(18px, 2.4vw, 30px) 0;
  font-size: clamp(1.8rem, 4.6vw, 4.2rem);
  font-weight: 500; letter-spacing: -0.04em; line-height: 1;
  user-select: none;
}
.marquee-track { display: flex; width: max-content; will-change: transform; }
html:not(.has-motion) .marquee-track { animation: marquee 45s linear infinite; }
.marquee-group { display: flex; align-items: center; flex-shrink: 0; }
.marquee-group span { padding-inline: 0.45em; }
.marquee-group span:nth-of-type(even) { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--muted); }
.marquee-group i { font-style: normal; font-size: 0.4em; color: var(--accent); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { padding-block: clamp(96px, 13vw, 180px); position: relative; }

.section-head {
  display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 8px 28px;
  margin-bottom: clamp(48px, 7vw, 96px);
}
.section-index {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-text);
  padding-top: 1.2em;
}
.section-index::before { content: "("; color: var(--muted); }
.section-index::after { content: ")"; color: var(--muted); }
.section-title {
  font-size: clamp(3rem, 9vw, 8rem); font-weight: 500;
  letter-spacing: -0.055em; line-height: 0.95;
}
.section-intro {
  grid-column: 2; max-width: 52ch; color: var(--muted); font-size: 1.05rem;
  margin-top: 14px;
}

/* Split words (built by JS): a mask for each word so it can slide up. */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.w > span { display: inline-block; will-change: transform; }

/* ---------- Cards ---------- */
.card {
  position: relative; isolation: isolate;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(22px, 2.6vw, 32px);
  transition: border-color 0.4s, background-color 0.5s;
}
[data-spotlight]::before,
[data-spotlight]::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: 0; transition: opacity 0.5s;
}
[data-spotlight]::before {
  z-index: -1;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 45%);
}
[data-spotlight]::after {
  padding: 1px;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), var(--accent), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
[data-spotlight]:hover::before,
[data-spotlight]:hover::after { opacity: 1; }

/* ---------- About ---------- */
.statement {
  font-size: clamp(1.6rem, 3.7vw, 3.3rem);
  line-height: 1.18; letter-spacing: -0.035em; font-weight: 400;
  max-width: 24em;
  margin-bottom: clamp(64px, 9vw, 128px);
}
.statement .sw { transition: none; }

.about-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: start; }

.portrait { position: sticky; top: calc(var(--header-h) + 40px); }
.portrait-inner {
  border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 4 / 5; background: var(--surface);
}
.portrait img { width: 100%; height: 115%; object-fit: cover; object-position: 50% 30%; transform-origin: 50% 50%; }
.portrait figcaption { margin-top: 14px; color: var(--muted); }

.about-body { display: flex; flex-direction: column; gap: clamp(40px, 5vw, 64px); }

.quote {
  position: relative;
  font-family: var(--font-serif); font-style: italic;
  font-size: clamp(1.5rem, 2.6vw, 2.15rem); line-height: 1.25;
  padding-left: 1.1em;
}
.quote-mark { position: absolute; left: 0; top: -0.12em; color: var(--accent-text); font-size: 1.6em; line-height: 1; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.fact { padding: 18px 0; border-top: 1px solid var(--line); min-width: 0; }
.fact dt { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; margin-bottom: 4px; }
.fact dd { font-size: 1.05rem; overflow-wrap: anywhere; }


.about-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.list-title { font-size: 0.8rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 400; margin-bottom: 14px; }
.clean-list li { position: relative; padding: 10px 0 10px 22px; border-top: 1px solid var(--line); }
.clean-list li::before { content: ""; position: absolute; left: 2px; top: 1.15em; width: 8px; height: 1px; background: var(--accent-text); }
.clean-list.small li { font-size: 0.92rem; padding-block: 8px; }

/* ---------- Experience ---------- */
.resume-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.resume-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--header-h) + 40px); }
.resume-side .card h3 { font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; margin: 10px 0 8px; }
.summary-text { color: var(--muted); margin-bottom: 14px; }
.edu-card p { color: var(--muted); margin-bottom: 14px; }
.downloads { padding: 8px 4px; }
.downloads-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.timeline { position: relative; display: flex; flex-direction: column; gap: clamp(40px, 5vw, 64px); padding-left: 44px; }
.timeline-track { position: absolute; left: 7px; top: 10px; bottom: 10px; width: 1px; background: var(--line); }
.timeline-progress { position: absolute; inset: 0; background: var(--accent); transform: scaleY(0); transform-origin: 50% 0; }
/* Without scroll-linked motion the line is simply drawn and every dot lit. */
html:not(.has-motion) .timeline-progress { transform: none; }

.job { position: relative; }
.job-dot {
  position: absolute; left: -44px; top: 6px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line-strong);
  transition: background-color 0.5s, border-color 0.5s, box-shadow 0.5s;
}
html:not(.has-motion) .job-dot,
.job.is-active .job-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft); }
.job-period { color: var(--accent-text); }
.job-role { font-size: clamp(1.6rem, 2.8vw, 2.4rem); font-weight: 500; letter-spacing: -0.035em; line-height: 1.1; margin-top: 8px; }
.job-company { font-family: var(--font-serif); font-style: italic; font-size: 1.3rem; color: var(--muted); margin-top: 4px; }
.job-points { margin-top: 18px; display: grid; gap: 8px; }
.job-points li { position: relative; padding-left: 22px; color: var(--muted); }
.job-points li::before { content: "→"; position: absolute; left: 0; color: var(--accent-text); }

/* ---------- Skills ---------- */
.tag-cloud { display: flex; flex-direction: column; gap: 14px; margin-bottom: clamp(48px, 6vw, 72px); }
.tag-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.tag-group-name { width: 130px; color: var(--muted); flex-shrink: 0; }
.tag {
  --tone: var(--tone-core);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 0.92rem;
  transition: transform 0.4s var(--ease), border-color 0.3s, background-color 0.3s;
}
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }
.tag:hover { transform: translateY(-3px); border-color: var(--tone); }
.tone-ai { --tone: var(--tone-ai); }
.tone-web { --tone: var(--tone-web); }
.tone-cloud { --tone: var(--tone-cloud); }
.tone-test { --tone: var(--tone-test); }

.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; perspective: 1200px; }
.bento-card { grid-column: span 2; min-height: 260px; display: flex; flex-direction: column; transform-style: preserve-3d; }
.bento-1, .bento-2 { grid-column: span 3; min-height: 300px; }
.bento-num { color: var(--muted); }
.bento-card h3 { font-size: clamp(1.6rem, 2.6vw, 2.3rem); font-weight: 500; letter-spacing: -0.04em; line-height: 1.05; margin-top: auto; padding-top: 48px; }
.bento-card p { color: var(--muted); margin-top: 12px; max-width: 46ch; }
.bento-1 { background: linear-gradient(140deg, var(--surface) 40%, color-mix(in srgb, var(--accent) 10%, var(--surface))); }

/* ---------- Work ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 36px; }
.filter {
  padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); font-size: 0.92rem;
  transition: color 0.3s, background-color 0.4s var(--ease), border-color 0.3s;
}
.filter sup { font-family: var(--font-mono); font-size: 0.65rem; margin-left: 2px; }
.filter:hover { color: var(--text); border-color: var(--line-strong); }
.filter.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }

.work-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: dense; gap: 20px;
}
.work-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.4s, translate 0.6s var(--ease), box-shadow 0.6s var(--ease);
}
/* `translate`, not `transform`: GSAP owns transform for reveals and Flip. */
.work-card:hover { border-color: var(--line-strong); translate: 0 -4px; box-shadow: var(--shadow); }
.work-grid.is-flipping .work-card { transition: none; translate: none; }
.work-card.is-featured { grid-column: span 2; }
.work-card.is-hidden { display: none; }

.work-media {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 16 / 10; background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.work-media img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 0;
  transform: scale(1.02);
  transition: transform 1.1s var(--ease), filter 0.6s;
}
.work-card:hover .work-media img { transform: scale(1.07); }
.work-media.is-contain { display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, var(--surface-2), var(--bg-2)); }
.work-media.is-contain img { width: 42%; height: auto; object-fit: contain; }

.work-body { display: flex; flex-direction: column; gap: 12px; padding: 22px 24px 24px; flex: 1; }
.work-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.work-title { font-size: 1.4rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; }
.is-featured .work-title { font-size: clamp(1.6rem, 2.4vw, 2.1rem); }
.work-text { color: var(--muted); font-size: 0.96rem; }
.work-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.work-meta li {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.02em;
  padding: 5px 10px; border-radius: 999px; background: var(--bg-2); color: var(--muted);
}
.work-meta .is-duration { background: transparent; border: 1px solid var(--line); }
.work-links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: auto; padding-top: 6px; }

/* ---------- Focus (stacking cards) ---------- */
.focus-stack { display: flex; flex-direction: column; gap: 24px; }
.focus-card {
  position: sticky;
  top: calc(var(--header-h) + 48px + var(--i) * 18px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 32px;
  min-height: clamp(280px, 34vw, 380px);
  padding: clamp(28px, 4vw, 56px);
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid var(--line);
  background: var(--surface);
  transform-origin: 50% 0;
  will-change: transform;
}
.focus-card:nth-child(even) { background: var(--surface-2); }
.focus-card:nth-child(4) { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.focus-card:nth-child(4) .focus-body p { color: color-mix(in srgb, var(--accent-ink) 75%, transparent); }
.focus-card:nth-child(4) .btn-accent { background: var(--accent-ink); color: var(--accent); }
.focus-card:nth-child(4) .btn-accent::before { background: var(--bg); }
.focus-card:nth-child(4) .focus-num { color: var(--accent-ink); }
.focus-num {
  font-size: clamp(4.5rem, 12vw, 10rem); font-weight: 500; line-height: 0.8; letter-spacing: -0.07em;
  color: var(--accent-text);
}
.focus-body { display: flex; flex-direction: column; justify-content: flex-end; gap: 16px; align-items: flex-start; }
.focus-body h3 { font-size: clamp(1.9rem, 3.6vw, 3.2rem); font-weight: 500; letter-spacing: -0.045em; line-height: 1; }
.focus-body p { color: var(--muted); font-size: 1.05rem; max-width: 48ch; }

/* ---------- Playground ---------- */
.play { padding-block: clamp(64px, 9vw, 120px); }
.play-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.play-title { font-size: clamp(2.2rem, 4.4vw, 3.8rem); font-weight: 500; letter-spacing: -0.045em; line-height: 1.02; margin: 12px 0 16px; }
.play-title em { font-family: var(--font-serif); font-weight: 400; color: var(--accent-text); }
.flappy {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 14px; max-width: 520px; width: 100%; justify-self: end;
}
.flappy-head { display: flex; justify-content: space-between; color: var(--muted); padding: 2px 4px 12px; }
.flappy-stage { position: relative; aspect-ratio: 252 / 196; border-radius: var(--radius-sm); overflow: hidden; }
#flappy-canvas { display: block; width: 100%; height: 100%; touch-action: manipulation; }
#flappy-canvas:focus-visible { outline-offset: -2px; }
.flappy-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: rgba(5, 5, 6, 0.42); color: #fff; pointer-events: none;
  transition: opacity 0.3s;
}
.flappy-overlay.is-hidden { opacity: 0; }
.flappy-overlay-title { font-size: 1.6rem; font-weight: 500; letter-spacing: -0.03em; }
.flappy-overlay-hint { opacity: 0.75; }

/* ---------- Contact ---------- */
.contact-title {
  font-size: clamp(3rem, 9.5vw, 9rem); font-weight: 500;
  letter-spacing: -0.06em; line-height: 0.92;
  max-width: 12em;
}
.contact-title em { font-family: var(--font-serif); font-weight: 400; color: var(--accent-text); letter-spacing: -0.03em; }

.contact-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 6vw, 96px); align-items: start; }

.contact-row {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 22px 4px; border-top: 1px solid var(--line);
}
.contact-row:last-of-type { border-bottom: 1px solid var(--line); }
.contact-row::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--accent-soft);
  transform: scaleY(0); transform-origin: 50% 100%; transition: transform 0.5s var(--ease);
}
.contact-row:hover::before { transform: scaleY(1); }
.contact-row-label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.contact-row-value { font-size: clamp(1.05rem, 1.7vw, 1.35rem); letter-spacing: -0.01em; overflow-wrap: anywhere; transition: transform 0.5s var(--ease); }
.contact-row:hover .contact-row-value { transform: translateX(8px); }
.contact-row-arrow { color: var(--muted); transition: transform 0.5s var(--ease), color 0.3s; }
.contact-row:hover .contact-row-arrow { transform: rotate(45deg); color: var(--accent-text); }

.socials { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.social {
  display: inline-block; padding: 9px 15px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 0.9rem;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
.social:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

.contact-form { display: flex; flex-direction: column; gap: 10px; }
.contact-form h3 { font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 4px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field { position: relative; }
.field input,
.field textarea {
  width: 100%; display: block;
  background: transparent; color: var(--text);
  border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0;
  padding: 28px 0 10px; font: inherit; font-size: 1.05rem;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1px; background-position: 0 100%; background-repeat: no-repeat;
  transition: background-size 0.6s var(--ease);
  resize: vertical;
}
.field textarea { min-height: 140px; }
.field input:focus,
.field textarea:focus { outline: none; background-size: 100% 1px; }
.field label {
  position: absolute; left: 0; top: 28px; color: var(--muted); pointer-events: none;
  transform-origin: 0 0; transition: transform 0.4s var(--ease), color 0.3s;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field textarea:focus + label,
.field textarea:not(:placeholder-shown) + label { transform: translateY(-22px) scale(0.78); color: var(--accent-text); }

.contact-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 18px; }
.contact-status { font-size: 0.92rem; color: var(--muted); }
.contact-status.is-success { color: var(--accent-text); }
.contact-status.is-error { color: var(--danger); }

/* ---------- Footer ---------- */
.site-footer { padding: clamp(48px, 7vw, 96px) 0 28px; border-top: 1px solid var(--line); overflow: hidden; }
.footer-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.back-top {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line-strong); transition: background-color 0.3s, color 0.3s;
}
.back-top:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.footer-word {
  /* Sized so the name spans the container: ~4.45em wide at this tracking. */
  font-size: min(18.6vw, 272px); font-weight: 600; letter-spacing: -0.07em; line-height: 0.8;
  white-space: nowrap; margin: clamp(32px, 5vw, 64px) 0 clamp(24px, 3vw, 40px) -0.04em;
  background: linear-gradient(180deg, var(--text) 10%, color-mix(in srgb, var(--text) 8%, transparent) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; }
.footer-socials { display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* ---------- Technology icons ----------
   Monochrome by default; they take their brand colour (--b, tuned per theme
   in content.py) when lit by scroll or on hover. --i staggers a group. */
.ti {
  --b: var(--b-d);
  position: relative;
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 1em; height: 1em;
  color: var(--muted);
  transition:
    color 0.5s var(--ease) calc(var(--i, 0) * 70ms),
    transform 0.55s var(--ease) calc(var(--i, 0) * 70ms),
    border-color 0.4s, background-color 0.4s;
}
:root[data-theme="light"] .ti { --b: var(--b-l); }
.ti svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.ti:hover { transition-delay: 0s; }

/* Hover label for icons that stand on their own. */
.ti[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 10px); z-index: 5;
  padding: 6px 9px; border-radius: 8px;
  background: var(--text); color: var(--bg);
  font: 500 0.72rem/1 var(--font-sans); letter-spacing: 0; white-space: nowrap;
  opacity: 0; transform: translate(-50%, 6px); pointer-events: none;
  transition: opacity 0.25s, transform 0.35s var(--ease);
}
.ti[data-tip]:hover::after { opacity: 1; transform: translate(-50%, 0); }

/* Rows of icon tiles (experience, projects). */
.tech-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.tech-row .ti {
  width: 42px; height: 42px; padding: 10px; border-radius: 13px;
  border: 1px solid var(--line); background: var(--surface);
}
.tech-row .ti:hover { color: var(--b); border-color: color-mix(in srgb, var(--b) 45%, transparent); transform: translateY(-4px) rotate(-6deg); }
/* Experience: a job's tools light up, one by one, when its dot does. */
.job.is-active .tech-row .ti,
html:not(.has-motion) .job .tech-row .ti { color: var(--b); }
.work-tech { margin-top: 2px; }
.work-tech .ti { width: 36px; height: 36px; padding: 8px; border-radius: 11px; background: var(--bg-2); }
.work-card:hover .work-tech .ti { color: var(--b); }

/* Skill tags: icon replaces the coloured dot; the cloud lights up on scroll. */
.tag.has-icon::before { display: none; }
.tag .ti { width: 1.05em; height: 1.05em; }
.tag .ti + .ti { margin-left: -3px; }
.tag-group.is-lit .ti,
html:not(.has-motion) .tag .ti { color: var(--b); }
.tag:hover .ti { color: var(--b); transform: rotate(-12deg) scale(1.18); }

/* Skill cards: a little constellation of tools + a big watermark glyph. */
.bento-card { overflow: hidden; }
.bento-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.bento-icons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; transition: gap 0.6s var(--ease); }
.bento-icons .ti {
  width: 40px; height: 40px; padding: 9px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.bento-icons .ti svg { animation: ti-float 4.5s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -0.8s); }
.bento-icons .ti[data-tip]::after { bottom: auto; top: calc(100% + 10px); transform: translate(-50%, -6px); }
.bento-icons .ti[data-tip]:hover::after { transform: translate(-50%, 0); }
.bento-card:hover .bento-icons { gap: 12px; }
.bento-card:hover .bento-icons .ti { color: var(--b); border-color: color-mix(in srgb, var(--b) 40%, transparent); transform: translateY(-3px); }
@keyframes ti-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

.bento-mark {
  position: absolute; z-index: -1; right: -7%; bottom: -16%;
  width: 46%; aspect-ratio: 1; pointer-events: none;
  opacity: 0.05; transform: rotate(8deg);
  transition: transform 1.2s var(--ease), opacity 0.6s;
}
.bento-mark .ti { width: 100%; height: 100%; color: var(--text); }
.bento-card:hover .bento-mark { opacity: 0.16; transform: rotate(-8deg) scale(1.06); }
.bento-card:hover .bento-mark .ti { color: var(--b); }

/* Marquee: words that are a technology carry its logo, in colour. */
.marquee .ti { width: 0.78em; height: 0.78em; margin-right: 0.28em; vertical-align: -0.06em; display: inline-block; color: var(--b); }

/* Touch screens have no hover: show the colours straight away. */
@media (hover: none) {
  .bento-icons .ti, .work-tech .ti { color: var(--b); }
}

/* ---------- Company logos ----------
   Logos come in their own colours, so each sits on a white chip that reads in
   both themes. A light sheen sweeps across on hover. */
.logo-chip {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; place-items: center;
  width: 136px; height: 68px; padding: 12px 16px;
  border-radius: 18px; background: #fff;
  box-shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  transform-style: preserve-3d;
}
:root[data-theme="light"] .logo-chip { box-shadow: 0 14px 30px -18px rgba(40, 40, 30, 0.45), inset 0 0 0 1px var(--line); }
.logo-chip img { width: 100%; height: 100%; object-fit: contain; }
.logo-chip::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(130, 207, 255, 0.5) 50%, transparent 62%) no-repeat;
  background-size: 260% 100%; background-position: 130% 0;
  transition: background-position 0.9s var(--ease);
}
.logo-chip:hover::after { background-position: -30% 0; }
.logo-chip.is-wordmark span { font: 600 1.2rem/1 var(--font-sans); letter-spacing: -0.04em; color: #16161a; }
.logo-chip-sm { width: 104px; height: 52px; padding: 8px 12px; border-radius: 14px; }

.job-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px 28px; }
.job-head { min-width: 0; }
.job-logo { flex-shrink: 0; perspective: 700px; }
/* Scroll entrance: the logo springs in when the job's timeline dot lights up. */
.has-motion .job-logo {
  opacity: 0; filter: blur(6px);
  transform: translateY(16px) scale(0.7) rotate(-8deg);
  transition: opacity 0.6s, filter 0.6s, transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.has-motion .job.is-active .job-logo { opacity: 1; filter: none; transform: none; }
.job.is-active .logo-chip { box-shadow: 0 0 0 4px var(--accent-soft), 0 14px 34px -16px rgba(0, 0, 0, 0.6); }

.edu-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ---------- Header language switch ---------- */
.lang-switch { font-family: var(--font-mono); font-size: 0.74rem; font-weight: 500; letter-spacing: 0.04em; }

/* ---------- Services: page hero ---------- */
.svc-hero {
  position: relative; isolation: isolate; overflow: hidden;
  padding: calc(var(--header-h) + clamp(64px, 10vw, 128px)) 0 clamp(48px, 7vw, 88px);
  border-bottom: 1px solid var(--line);
}
.breadcrumbs { margin-bottom: 22px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line-strong); }
.breadcrumbs a { transition: color 0.3s; }
.breadcrumbs a:hover { color: var(--accent-text); }
.breadcrumbs [aria-current] { color: var(--text); }
.svc-title {
  font-size: clamp(2.7rem, 7.2vw, 6.4rem); font-weight: 500;
  letter-spacing: -0.055em; line-height: 0.98;
  max-width: 13em; margin-bottom: clamp(20px, 3vw, 32px);
}
.svc-lede { max-width: 62ch; color: var(--muted); font-size: clamp(1.05rem, 1.4vw, 1.22rem); margin-bottom: 32px; }
.svc-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: clamp(36px, 5vw, 56px); }
.svc-tools .tech-row { margin-top: 0; }

/* ---------- Services: cards ---------- */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.svc-grid.is-compact { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.svc-card {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; gap: 14px;
  min-height: 250px; padding: 26px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color 0.4s, translate 0.6s var(--ease), box-shadow 0.6s var(--ease);
}
.svc-card:hover { translate: 0 -4px; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow); }
.svc-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.svc-icon {
  width: 54px; height: 54px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text);
  transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.4s, color 0.4s;
}
.svc-card:hover .svc-icon { transform: rotate(-8deg) scale(1.08); background: var(--accent); color: var(--accent-ink); }
.svc-card-name { font-size: 1.4rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; margin-top: 14px; }
.svc-card-text { color: var(--muted); font-size: 0.95rem; }
.svc-card-more { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 500; color: var(--accent-text); }
.svc-card-more .icon { transition: transform 0.5s var(--ease); }
.svc-card:hover .svc-card-more .icon { transform: translateX(5px); }
.svc-card.is-compact { min-height: 0; padding: 20px; gap: 10px; }
.svc-card.is-compact .svc-icon { width: 44px; height: 44px; border-radius: 13px; }
.svc-card.is-compact .svc-card-name { font-size: 1.12rem; margin-top: 8px; }
.svc-teaser-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }

/* ---------- Services: why / deliverables ---------- */
.why-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.why-card h3 { font-size: 1.35rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; margin: 40px 0 10px; }
.why-card p { color: var(--muted); font-size: 0.96rem; }

.deliver-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.deliver-check {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.4s, color 0.4s;
}
.deliver-card:hover .deliver-check { transform: scale(1.12) rotate(-10deg); background: var(--accent); color: var(--accent-ink); }
.deliver-card h3 { font-size: 1.22rem; font-weight: 500; letter-spacing: -0.02em; line-height: 1.2; margin: 22px 0 8px; }
.deliver-card p { color: var(--muted); font-size: 0.96rem; }

/* ---------- Services: process ---------- */
.process { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 28px 20px; counter-reset: step; }
.process-step { position: relative; padding-top: 22px; border-top: 1px solid var(--line); }
/* An accent bar draws across each step as it scrolls in (site.js adds .is-in). */
.process-step::before {
  content: ""; position: absolute; left: 0; top: -1px; width: 100%; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: 0 50%;
  transition: transform 1.2s var(--ease) 0.15s;
}
.process-step.is-in::before,
html:not(.has-motion) .process-step::before { transform: scaleX(1); }
.process-num { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-text); }
.process-step h3 { font-size: 1.18rem; font-weight: 500; letter-spacing: -0.02em; margin: 12px 0 8px; }
.process-step p { color: var(--muted); font-size: 0.94rem; }

/* ---------- Services: FAQ ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(24px, 6vw, 96px); align-items: start; }
.faq-grid .section-head { grid-template-columns: 1fr; position: sticky; top: calc(var(--header-h) + 40px); margin-bottom: 0; }
.faq-grid .section-index { padding-top: 0; }
.faq-grid .section-title { font-size: clamp(2.4rem, 5vw, 4.4rem); }
.faq { border-top: 1px solid var(--line); interpolate-size: allow-keywords; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  padding: 22px 0; cursor: pointer; list-style: none;
  font-size: clamp(1.05rem, 1.5vw, 1.25rem); font-weight: 500; letter-spacing: -0.015em;
  transition: color 0.3s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--accent-text); }
.faq-icon {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid var(--line-strong);
  transition: transform 0.5s var(--ease), background-color 0.3s, color 0.3s, border-color 0.3s;
}
.faq-item[open] .faq-icon { transform: rotate(45deg); background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* Smooth open/close where the browser supports animating <details>. */
.faq-item::details-content {
  block-size: 0; overflow: hidden;
  transition: block-size 0.55s var(--ease), content-visibility 0.55s allow-discrete;
}
.faq-item[open]::details-content { block-size: auto; }
.faq-a p { color: var(--muted); max-width: 64ch; padding: 0 56px 24px 0; }

/* ---------- Footer: legal business details (small print) ---------- */
.footer-legal {
  display: flex; flex-wrap: wrap; gap: 4px 0;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 0.76rem; line-height: 1.5; color: var(--muted);
}
.footer-legal span:not(:last-child)::after { content: "·"; margin: 0 8px; color: var(--line-strong); }

/* ---------- Footer: services list ---------- */
.footer-services { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 24px; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.footer-services-title { color: var(--accent-text); }
.footer-services ul { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.92rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .nav { display: none; }
  .menu-toggle { display: inline-grid; }
  .hero-bottom { grid-template-columns: 1fr 1fr; }
  .hero-actions { grid-column: 1 / -1; }
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento-card, .bento-1, .bento-2 { grid-column: span 1; }
  .bento-5 { grid-column: span 2; }
  .why-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deliver-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  body { font-size: 16px; }
  .header-cta { display: none; }
  .brand-name { display: none; }
  .site-header { top: 10px; }
  .hero-bottom { grid-template-columns: 1fr; gap: 20px; }
  .hero-meta-right { display: none; }
  .section-head { grid-template-columns: 1fr; }
  .section-index { padding-top: 0; }
  .section-intro { grid-column: 1; }
  .about-grid, .resume-grid, .contact-grid, .play-grid, .faq-grid { grid-template-columns: 1fr; }
  .faq-grid .section-head { position: static; }
  .portrait, .resume-side { position: static; }
  .portrait { max-width: 460px; }
  .flappy { justify-self: stretch; max-width: none; }
  .focus-card { grid-template-columns: 1fr; gap: 24px; }
  .contact-row { grid-template-columns: 1fr auto; }
  .contact-row-label { grid-column: 1 / -1; }
  .contact-row-arrow { grid-row: 2; grid-column: 2; }
}

@media (max-width: 620px) {
  .work-grid { grid-template-columns: 1fr; }
  .work-card.is-featured { grid-column: auto; }
  .bento { grid-template-columns: 1fr; }
  .bento-5 { grid-column: auto; }
  .bento-card { min-height: 0; }
  .facts, .about-lists, .field-row { grid-template-columns: 1fr; }
  .tag-group-name { width: 100%; }
  .hero-actions .btn { flex: 1 1 auto; }
  .hero-line-2 { padding-left: 0; }
  .job-top { flex-direction: column; }
  .job-logo { order: -1; }
  .job-logo .logo-chip { width: 116px; height: 58px; padding: 10px 14px; border-radius: 16px; }
  .bento-icons .ti { width: 36px; height: 36px; padding: 8px; }
  .bento-mark { width: 36%; right: -6%; bottom: -10%; opacity: 0.035; }
  .why-grid, .deliver-grid, .process { grid-template-columns: 1fr; }
  .faq-grid { grid-template-columns: 1fr; }
  .faq-grid .section-head { position: static; }
  .faq-a p { padding-right: 0; }
  .svc-card { min-height: 0; }
  /* Ten services stacked full-width is a long scroll on a phone: two compact
     columns instead; each service's own page carries the description. */
  .svc-grid, .svc-grid.is-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .svc-card, .svc-card.is-compact { padding: 16px; gap: 8px; }
  .svc-card .svc-icon { width: 42px; height: 42px; border-radius: 12px; }
  .svc-card .svc-card-name { font-size: 1.02rem; margin-top: 6px; }
  .svc-card .svc-card-text { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .marquee-track { animation: none !important; }
}
