/* ---------- Tokens (driven by Tweaks via inline style on :root) ---------- */
:root {
  --bg: #0a0a0a;
  --bg-2: #111113;
  --fg: #f4f4f1;
  --fg-dim: #8a8a86;
  --fg-faint: #4a4a48;
  --line: #1f1f22;
  --accent: #ffffff;
  --thumb-bg: #161618;
  --thumb-line: #2a2a2e;
  --radius: 12px;
  --pad-y: 120px;
  --pad-x: clamp(24px, 6vw, 96px);
  --max-w: 1280px;
  --font-display: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'IBM Plex Mono', monospace;
}

[data-density="compact"] { --pad-y: 80px; }
[data-density="airy"]    { --pad-y: 180px; }

[data-theme="light"] {
  --bg: #f5f3ee;
  --bg-2: #ffffff;
  --fg: #0c0c0c;
  --fg-dim: #5a5a55;
  --fg-faint: #b6b4ad;
  --line: #e3e0d8;
  --accent: #0c0c0c;
  --thumb-bg: #eceae3;
  --thumb-line: #cfccc2;
}

[data-display="mono"] {
  --font-display: 'Geist Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  padding: 28px var(--pad-x) 40px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-bottom: 1px solid var(--line);
}

.hero-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 32px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-dim);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  letter-spacing: 0.04em;
}

.nav {
  display: flex;
  gap: 28px;
  justify-self: center;
}
.nav a {
  color: var(--fg-dim);
  transition: color 160ms ease;
}
.nav a:hover { color: var(--fg); }

.clocks {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-self: end;
}
.hero-top-right {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-self: end;
}
.hero-top-right .clocks { justify-self: auto; }
.hero-top-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.clock { display: flex; align-items: baseline; gap: 8px; }
.clock-label { color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.clock-time { color: var(--fg); font-variant-numeric: tabular-nums; }
.clock-sep { width: 1px; height: 14px; background: var(--line); }

.hero-main {
  align-self: center;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 80px 0;
}

.hero-meta { margin-bottom: 28px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-dim);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 4px color-mix(in oklab, #4ade80 25%, transparent);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(48px, 8vw, 128px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0 0 32px;
  text-wrap: balance;
}
.hero-sub {
  color: var(--fg-dim);
  font-weight: 400;
}

.hero-loc {
  max-width: 56ch;
  font-size: clamp(16px, 1.4vw, 20px);
  color: var(--fg-dim);
  margin: 0 0 40px;
  text-wrap: pretty;
}

.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: transform 160ms ease, background 160ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--fg); }

.hero-bottom {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
  letter-spacing: 0.04em;
}

.dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

/* ---------- Sections ---------- */
.section {
  padding: var(--pad-y) var(--pad-x);
  max-width: var(--max-w);
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.section:last-of-type { border-bottom: none; }

.section-head {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
  margin-bottom: 56px;
  align-items: start;
}
@media (max-width: 720px) {
  .section-head { grid-template-columns: 1fr; gap: 12px; }
}

.section-index {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  text-transform: uppercase;
  padding-top: 10px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.5vw, 64px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0;
  text-wrap: balance;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 200px 1fr 1fr;
  gap: 48px;
}
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; } }

.about-grid > .about-text {
  grid-column: 2;
  font-size: clamp(18px, 1.6vw, 22px);
  color: var(--fg);
  max-width: 60ch;
}
@media (max-width: 900px) { .about-grid > .about-text { grid-column: 1; } }

.about-text p { margin: 0 0 1.2em; text-wrap: pretty; }

.about-meta dl {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 24px;
}
.about-meta dt { color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; align-self: center; }
.about-meta dd { margin: 0; color: var(--fg); }

/* ---------- Work ---------- */
.work-grid { display: grid; gap: 24px; }
.work-grid.grid-3 { grid-template-columns: repeat(3, 1fr); }
.work-grid.grid-2 { grid-template-columns: repeat(2, 1fr); }
.work-grid.grid-list { grid-template-columns: 1fr; gap: 12px; }
@media (max-width: 900px) {
  .work-grid.grid-3, .work-grid.grid-2 { grid-template-columns: 1fr; }
}

.work-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  transition: transform 200ms ease, border-color 200ms ease;
  /* Button reset (cards are now <button>) */
  appearance: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.work-card:hover { transform: translateY(-2px); border-color: var(--fg-dim); }

.work-card.layout-list {
  flex-direction: row;
  align-items: center;
  gap: 32px;
}
.work-card.layout-list .work-thumb { flex: 0 0 240px; aspect-ratio: 4/3; }
.work-card.layout-list .work-meta { flex: 1; }

.work-thumb {
  background: var(--thumb-bg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
.work-thumb svg { width: 100%; height: 100%; display: block; }

.work-meta { display: flex; flex-direction: column; gap: 4px; padding: 4px 8px 8px; }
.work-year { font-family: var(--font-mono); font-size: 12px; color: var(--fg-faint); }
.work-title { font-family: var(--font-display); font-size: 22px; font-weight: 500; margin: 2px 0 0; letter-spacing: -0.01em; }
.work-tag { font-family: var(--font-mono); font-size: 12px; color: var(--fg-dim); }
.work-blurb { color: var(--fg-dim); margin: 8px 0 0; max-width: 60ch; }

.work-arrow {
  position: absolute;
  top: 20px; right: 20px;
  font-family: var(--font-mono);
  color: var(--fg-faint);
  transition: transform 200ms ease, color 200ms ease;
}
.work-card:hover .work-arrow { transform: translate(2px, -2px); color: var(--fg); }

.work-foot {
  margin: 40px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
  max-width: 60ch;
}

.section-lede {
  margin: 0 0 32px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--fg-soft, var(--fg));
  max-width: 68ch;
}

/* ---------- Work modal ---------- */
.work-modal-backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in oklab, #000 70%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: workModalFade 180ms ease;
}
@keyframes workModalFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.work-modal {
  position: relative;
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  animation: workModalRise 220ms cubic-bezier(.4, 1.2, .4, 1);
}
@keyframes workModalRise {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.work-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg);
  border-radius: 999px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease;
  z-index: 2;
}
.work-modal-close:hover { border-color: var(--fg); transform: rotate(90deg); }
.work-modal-thumb {
  aspect-ratio: 2 / 1;
  background: var(--thumb-bg);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.work-modal-thumb svg { width: 100%; height: 100%; display: block; }
.work-modal-body {
  padding: 32px 36px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.work-modal-year {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
  text-transform: uppercase;
}
.work-modal-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0;
}
.work-modal-summary {
  font-size: 16px;
  color: var(--fg-dim);
  margin: 0;
  text-wrap: pretty;
  max-width: 60ch;
}
.work-modal-meta {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px 24px;
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 13px;
}
.work-modal-meta dt {
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  align-self: center;
}
.work-modal-meta dd { margin: 0; color: var(--fg); }
.work-modal-link {
  align-self: flex-start;
  margin-top: 8px;
}

@media (max-width: 640px) {
  .work-modal-backdrop { padding: 12px; }
  .work-modal { border-radius: 16px; }
  .work-modal-body { padding: 24px 22px 28px; gap: 14px; }
  .work-modal-meta { grid-template-columns: 80px 1fr; gap: 6px 16px; font-size: 12px; }
}

/* ---------- Languages ---------- */
.lang-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.lang-row {
  display: grid;
  grid-template-columns: 48px 200px 1fr 200px;
  gap: 24px;
  align-items: center;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 14px;
}
.lang-row:last-child { border-bottom: 1px solid var(--line); }
.lang-num { color: var(--fg-faint); }
.lang-name { font-family: var(--font-display); font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
.lang-bar { display: block; height: 2px; background: var(--line); position: relative; overflow: hidden; }
.lang-bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.lang-level { color: var(--fg-dim); text-align: right; }
@media (max-width: 720px) {
  .lang-row { grid-template-columns: 32px 1fr; }
  .lang-row .lang-bar, .lang-row .lang-level { display: none; }
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 200px 1fr 1fr;
  gap: 48px;
  align-items: start;
}
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-main { grid-column: 2; max-width: 60ch; }
@media (max-width: 900px) { .contact-main { grid-column: 1; } }

.contact-lede { font-size: clamp(18px, 1.5vw, 22px); margin: 0 0 32px; color: var(--fg); }

.contact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; font-family: var(--font-mono); font-size: 14px; }
.contact-list li {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  align-items: center;
}
.contact-list li:last-child { border-bottom: 1px solid var(--line); }
.contact-key { color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.contact-list a { color: var(--fg); }
.contact-list a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }

.contact-side { display: flex; justify-content: flex-end; }
.contact-stamp {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  align-items: center;
  min-width: 160px;
  border-radius: 16px;
}
.contact-stamp-sub { color: var(--fg-faint); }

/* ---------- About: external citations row ---------- */
.about-links {
  margin: 1.2em 0 0;
  color: var(--fg-dim);
}
.about-links a {
  color: var(--fg);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 0 1px;
  background-position: 0 100%;
  transition: background-size 360ms var(--ease-out-soft), color 200ms ease;
}
.about-links a:hover {
  color: var(--accent);
  background-size: 100% 1px;
}

/* ---------- FAQ ---------- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 760px;
}
.faq-item {
  --faq-i: 0;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.faq-item:last-child { border-bottom: 1px solid var(--line); }
.faq-q {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(17px, 1.4vw, 20px);
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.005em;
}
.faq-a {
  margin: 0;
  color: var(--fg-dim);
  max-width: 60ch;
  text-wrap: pretty;
}
.faq-a a {
  color: var(--fg);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 0 1px;
  background-position: 0 100%;
  transition: background-size 360ms var(--ease-out-soft), color 200ms ease;
}
.faq-a a:hover {
  color: var(--accent);
  background-size: 100% 1px;
}
.section[data-reveal].is-revealed .faq-item {
  animation: mk-rise 640ms var(--ease-out-soft) both;
  animation-delay: calc(260ms + var(--faq-i, 0) * 70ms);
}
@media (prefers-reduced-motion: reduce) {
  .section[data-reveal].is-revealed .faq-item {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  justify-content: space-between;
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
}

/* ---------- Selection ---------- */
::selection { background: var(--accent); color: var(--bg); }

/* ---------- Smooth scroll ---------- */
html { scroll-behavior: smooth; }

/* ─────────────────────────────────────────────────────────────
   Mobile (≤ 640px) — collapses the desktop layout to a single
   column, shrinks the hero, and hides chrome that doesn't fit.
   These rules used to live in a separate mobile.html + mobile.css;
   they're now applied responsively to the same markup.
   ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  :root {
    --pad-x: 20px;
    --pad-y: 64px;
  }
  html, body { font-size: 15px; }

  /* Hero */
  .hero {
    min-height: auto;
    padding: 28px 20px 28px;
    grid-template-rows: auto 1fr auto;
  }
  .hero-top {
    grid-template-columns: 1fr auto;
    gap: 14px;
    font-size: 11px;
  }
  .hero-top .nav { display: none; }
  .hero-top .clocks { display: none; }
  .hero-top-left { gap: 10px; }
  .hero-top-right { gap: 10px; }
  .hero-top-right .clocks { display: none; }

  .hero-main { padding: 40px 0 24px; }
  .hero-meta { margin-bottom: 20px; }
  .hero-title {
    font-size: 56px;
    letter-spacing: -0.045em;
    line-height: 0.92;
    margin-bottom: 24px;
  }
  .hero-loc {
    font-size: 15px;
    margin-bottom: 28px;
    max-width: 38ch;
  }
  .hero-cta { gap: 8px; }
  .btn {
    padding: 12px 18px;
    font-size: 12px;
    flex: 1;
    justify-content: center;
  }
  .hero-bottom { font-size: 10px; gap: 12px; flex-wrap: wrap; }

  /* Sections */
  .section { padding: 64px 20px; }
  .section-head {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 32px;
  }
  .section-title {
    font-size: 32px;
    letter-spacing: -0.025em;
  }

  /* About */
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .about-grid > .about-text { grid-column: 1; font-size: 17px; }
  .about-meta dl {
    grid-template-columns: 70px 1fr;
    font-size: 12px;
    gap: 6px 16px;
  }

  /* Work */
  .work-grid.grid-3,
  .work-grid.grid-2,
  .work-grid.grid-list {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .work-card { padding: 12px; }
  .work-card.layout-list {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
  .work-card.layout-list .work-thumb { flex: 0 0 auto; aspect-ratio: 16/10; }
  .work-title { font-size: 19px; }

  /* Languages */
  .lang-row {
    grid-template-columns: 28px 1fr auto;
    gap: 12px;
    padding: 18px 0;
    font-size: 13px;
  }
  .lang-row .lang-bar { display: none; }
  .lang-name { font-size: 17px; }
  .lang-level {
    display: inline;
    text-align: right;
    font-size: 11px;
    color: var(--fg-faint);
  }

  /* Contact */
  .contact-grid { grid-template-columns: 1fr; gap: 24px; }
  .contact-main { grid-column: 1; }
  .contact-lede { font-size: 17px; margin-bottom: 24px; }
  .contact-list { font-size: 13px; }
  .contact-list li {
    grid-template-columns: 80px 1fr;
    padding: 14px 0;
    gap: 10px;
  }
  .contact-side { justify-content: flex-start; }

  .footer {
    flex-direction: column;
    gap: 6px;
    margin-top: 48px;
    font-size: 10px;
  }
}

/* ─────────────────────────────────────────────────────────────
   Ultra-narrow (≤ 360px) — iPhone SE / small Androids.
   Tighter padding, smaller display type, single-row CTA stack.
   ───────────────────────────────────────────────────────────── */
@media (max-width: 360px) {
  :root {
    --pad-x: 14px;
    --pad-y: 48px;
  }
  html, body { font-size: 14px; }

  /* Hero */
  .hero { padding: 20px 14px 24px; }
  .hero-top {
    grid-template-columns: 1fr;
    gap: 10px;
    font-size: 10px;
  }
  .hero-top-left,
  .hero-top-right { justify-self: start; }
  .hero-top-right { justify-self: end; }

  .hero-main { padding: 28px 0 20px; }
  .hero-meta { margin-bottom: 16px; }
  .status { padding: 5px 10px; font-size: 11px; }
  .hero-title {
    font-size: 44px;
    letter-spacing: -0.04em;
    margin-bottom: 18px;
  }
  .hero-loc {
    font-size: 14px;
    margin-bottom: 22px;
    max-width: 32ch;
  }
  .hero-cta { flex-direction: column; gap: 8px; }
  .btn {
    width: 100%;
    padding: 11px 16px;
    font-size: 11px;
  }
  .hero-bottom { font-size: 9px; }

  /* Sections */
  .section { padding: 48px 14px; }
  .section-head { margin-bottom: 24px; gap: 10px; }
  .section-title {
    font-size: 26px;
    letter-spacing: -0.02em;
  }
  .section-index { font-size: 10px; padding-top: 0; }

  /* About */
  .about-grid { gap: 24px; }
  .about-grid > .about-text { font-size: 15px; }
  .about-meta dl {
    grid-template-columns: 60px 1fr;
    font-size: 11px;
    gap: 4px 12px;
  }

  /* Work */
  .work-grid.grid-3,
  .work-grid.grid-2,
  .work-grid.grid-list { gap: 12px; }
  .work-card { padding: 10px; gap: 12px; }
  .work-title { font-size: 17px; }
  .work-blurb { font-size: 13px; }
  .work-arrow { top: 14px; right: 14px; }

  /* Languages */
  .lang-row {
    grid-template-columns: 22px 1fr auto;
    gap: 10px;
    padding: 14px 0;
    font-size: 12px;
  }
  .lang-name { font-size: 15px; }
  .lang-level { font-size: 10px; }

  /* Contact */
  .contact-grid { gap: 20px; }
  .contact-lede { font-size: 15px; margin-bottom: 18px; }
  .contact-list { font-size: 12px; }
  .contact-list li {
    grid-template-columns: 1fr;
    padding: 12px 0;
    gap: 4px;
  }
  .contact-key { font-size: 10px; }
  .contact-stamp {
    padding: 18px 22px;
    min-width: 0;
    width: 100%;
    align-items: flex-start;
  }

  .footer { margin-top: 32px; font-size: 9px; }
}

/* ───────── Language switcher variants ───────── */

/* Shared button reset */
.lang-seg button, .lang-toggle, .lang-dd-btn, .lang-dd-menu button, .lang-pill button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  font-family: var(--font-mono);
}

/* — Variant 1: Segmented — */
.lang-seg {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in oklab, var(--bg-2) 60%, transparent);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.lang-seg button {
  position: relative;
  z-index: 2;
  padding: 5px 11px;
  border-radius: 999px;
  color: var(--fg-dim);
  transition: color 200ms ease;
  min-width: 32px;
}
.lang-seg button.on { color: var(--bg); }
.lang-seg button:hover:not(.on) { color: var(--fg); }
.lang-seg-thumb {
  position: absolute;
  top: 3px; bottom: 3px;
  width: calc(50% - 3px);
  background: var(--accent);
  border-radius: 999px;
  transition: transform 280ms cubic-bezier(.5,1.4,.4,1);
  z-index: 1;
  left: 3px;
}
.lang-seg-thumb[data-pos="ru"] { transform: translateX(100%); }

/* — Variant 2: Toggle — */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--fg);
  transition: border-color 160ms ease, transform 160ms ease;
}
.lang-toggle:hover { border-color: var(--fg); transform: translateY(-1px); }
.lang-toggle-current { color: var(--fg); }
.lang-toggle-other { color: var(--fg-faint); }
.lang-toggle-swap { color: var(--fg-faint); font-size: 10px; }

/* — Variant 3: Dropdown — */
.lang-dd { position: relative; display: inline-block; }
.lang-dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--fg);
  transition: border-color 160ms ease;
}
.lang-dd-btn:hover { border-color: var(--fg-dim); }
.lang-dd-globe { font-size: 12px; opacity: 0.7; }
.lang-dd-caret { color: var(--fg-faint); font-size: 9px; }
.lang-dd-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 160px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
  box-shadow: 0 16px 32px rgba(0,0,0,0.3);
}
.lang-dd-menu button {
  display: grid;
  grid-template-columns: 28px 1fr 16px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  text-align: left;
  color: var(--fg);
  transition: background 120ms ease;
}
.lang-dd-menu button:hover { background: color-mix(in oklab, var(--fg) 8%, transparent); }
.lang-dd-menu button.on { background: color-mix(in oklab, var(--accent) 12%, transparent); }
.lang-dd-code { color: var(--fg-faint); font-size: 11px; letter-spacing: 0.06em; }
.lang-dd-label { color: var(--fg); }
.lang-dd-check { color: var(--accent); font-size: 11px; }

/* — Variant 4: Pill outline — */
.lang-pill {
  display: inline-flex;
  gap: 4px;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.lang-pill button {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg-dim);
  transition: all 160ms ease;
}
.lang-pill button:hover { color: var(--fg); border-color: var(--fg-dim); }
.lang-pill button.on {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 10%, transparent);
}

/* ─────────────────────────────────────────────────────────────
   Motion — entrance, scroll reveal, ambient micro-interactions.
   Driven by animations.js + a couple of JSX hooks (hero-word,
   data-reveal). Everything respects prefers-reduced-motion.
   ───────────────────────────────────────────────────────────── */

/* Curve used across all motion */
:root {
  --ease-out-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring:   cubic-bezier(0.5, 1.4, 0.4, 1);
}

/* ── Scroll progress bar ── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 9999;
  pointer-events: none;
  transform: scaleX(var(--scroll-progress, 0));
  transform-origin: 0 50%;
  background: var(--accent);
  opacity: 0.55;
  transition: opacity 200ms ease;
  will-change: transform;
}

/* ── Hero entrance ── */
@keyframes mk-rise {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes mk-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes mk-word {
  from { opacity: 0; transform: translate3d(0, 36px, 0); filter: blur(6px); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); filter: blur(0); }
}

.hero-top    { opacity: 0; animation: mk-fade 700ms var(--ease-out-soft) 80ms forwards; }
.hero-meta   { opacity: 0; animation: mk-rise 780ms var(--ease-out-soft) 160ms forwards; }
.hero-loc    { opacity: 0; animation: mk-rise 800ms var(--ease-out-soft) 520ms forwards; }
.hero-cta    { opacity: 0; animation: mk-rise 800ms var(--ease-out-soft) 640ms forwards; }
.hero-bottom { opacity: 0; animation: mk-fade 800ms var(--ease-out-soft) 800ms forwards; }

.hero-title { perspective: 800px; }
.hero-word {
  display: inline-block;
  opacity: 0;
  transform: translate3d(0, 36px, 0);
  filter: blur(6px);
  animation: mk-word 900ms var(--ease-out-soft) forwards;
  animation-delay: calc(220ms + var(--i, 0) * 70ms);
  will-change: transform, opacity, filter;
}

/* Soft accent halo behind the hero title */
.hero-main { position: relative; }
.hero-main::before {
  content: '';
  position: absolute;
  inset: -10% -5% auto -5%;
  height: 70%;
  pointer-events: none;
  background: radial-gradient(
    600px 320px at 30% 40%,
    color-mix(in oklab, var(--accent) 14%, transparent),
    transparent 70%
  );
  opacity: 0;
  animation: mk-fade 1400ms var(--ease-out-soft) 300ms forwards;
  z-index: 0;
  filter: blur(20px);
}
.hero-main > * { position: relative; z-index: 1; }

/* ── Status dot — gentle living pulse ── */
@keyframes mk-status-pulse {
  0%, 100% {
    box-shadow: 0 0 0 4px color-mix(in oklab, #4ade80 25%, transparent);
  }
  50% {
    box-shadow: 0 0 0 7px color-mix(in oklab, #4ade80 8%, transparent);
  }
}
.status-dot {
  animation: mk-status-pulse 2.8s ease-in-out infinite;
}

/* ── Section scroll reveal ── */
/* Only sections below the viewport pick up `data-reveal` (see animations.js).
   The hidden state intentionally carries NO transition, so tagging an off-
   screen section snaps it to opacity:0 instead of playing a 720ms fade-out
   the user could catch mid-scroll. The transition lives on `.is-revealed`
   so the reveal itself still animates in. */
.section[data-reveal] .section-head,
.section[data-reveal] .section-body {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  /* Intentionally no `will-change: transform` here: it makes the section-body
     a containing block for position:fixed descendants, which pulls the work
     modal out of the viewport and pins it inside the section. */
  will-change: opacity;
}
.section[data-reveal].is-revealed .section-head,
.section[data-reveal].is-revealed .section-body {
  opacity: 1;
  transform: none;
  transition:
    opacity   720ms var(--ease-out-soft),
    transform 720ms var(--ease-out-soft);
}
.section[data-reveal].is-revealed .section-head { transition-delay: 40ms; }
.section[data-reveal].is-revealed .section-body { transition-delay: 180ms; }

/* ── Magnetic buttons ── */
.btn {
  transform: translate3d(var(--mx-magnet, 0px), var(--my-magnet, 0px), 0);
  transition:
    transform 380ms var(--ease-spring),
    background 200ms ease,
    border-color 200ms ease,
    color 200ms ease;
  will-change: transform;
}
/* Override the old hover lift so it composes with the magnet */
.btn:hover { transform: translate3d(var(--mx-magnet, 0px), calc(var(--my-magnet, 0px) - 1px), 0); }

/* ── Nav links — animated underline ── */
.nav a {
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
}
.nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform 420ms var(--ease-out-soft);
}
.nav a:hover::after {
  transform: scaleX(1);
  transform-origin: 0 50%;
}

/* ── Work cards — cursor spotlight + smoother lift ── */
.work-card {
  isolation: isolate;
  overflow: hidden;
  transition:
    transform 360ms var(--ease-out-soft),
    border-color 260ms ease,
    box-shadow 360ms var(--ease-out-soft);
}
.work-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    340px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in oklab, var(--accent) 14%, transparent),
    transparent 55%
  );
  opacity: 0;
  transition: opacity 240ms ease;
  z-index: 0;
}
.work-card > * { position: relative; z-index: 1; }
.work-card:hover {
  transform: translate3d(0, -4px, 0);
  box-shadow: 0 24px 48px -24px color-mix(in oklab, #000 60%, transparent);
}
.work-card:hover::before { opacity: 1; }
/* Kill the browser default focus ring (it hugs the rounded corner and reads
   as a glitchy halo on click). Keep a designed indicator for keyboard users. */
.work-card:focus { outline: none; }
.work-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Thumb subtle zoom + arrow drift */
.work-thumb {
  transition: transform 600ms var(--ease-out-soft);
  will-change: transform;
}
.work-card:hover .work-thumb { transform: scale(1.03); }
.work-arrow {
  transition: transform 360ms var(--ease-out-soft), color 240ms ease;
}
.work-card:hover .work-arrow { transform: translate3d(4px, -4px, 0); color: var(--accent); }

/* Stagger the cards on reveal */
.section[data-reveal].is-revealed .work-grid .work-card {
  animation: mk-rise 720ms var(--ease-out-soft) both;
  animation-delay: calc(260ms + var(--card-i, 0) * 90ms);
}

/* ── Language bars — fill on reveal ── */
.lang-bar-fill {
  width: 0 !important;
  transition: width 1400ms var(--ease-out-soft);
  background: linear-gradient(
    90deg,
    var(--accent),
    color-mix(in oklab, var(--accent) 70%, transparent)
  );
}
.section[data-reveal].is-revealed .lang-bar-fill {
  width: var(--pct, 0%) !important;
  transition-delay: 380ms;
}
.lang-row {
  --lang-i: 0;
  transition: background 260ms ease;
}
.section[data-reveal].is-revealed .lang-row {
  animation: mk-rise 680ms var(--ease-out-soft) both;
  animation-delay: calc(280ms + var(--lang-i, 0) * 80ms);
}
.lang-name {
  transition: letter-spacing 360ms var(--ease-out-soft), color 200ms ease;
}
.lang-row:hover .lang-name { letter-spacing: 0.005em; }

/* ── Contact list — staggered ── */
.section[data-reveal].is-revealed .contact-list li {
  animation: mk-rise 640ms var(--ease-out-soft) both;
}
.section[data-reveal].is-revealed .contact-list li:nth-child(1) { animation-delay: 280ms; }
.section[data-reveal].is-revealed .contact-list li:nth-child(2) { animation-delay: 360ms; }
.section[data-reveal].is-revealed .contact-list li:nth-child(3) { animation-delay: 440ms; }
.contact-list a {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 0 1px;
  background-position: 0 100%;
  transition: background-size 360ms var(--ease-out-soft), color 200ms ease;
}
.contact-list a:hover {
  background-size: 100% 1px;
  text-decoration: none;
}

/* ── Language switcher thumb is already animated — tighten curve ── */
.lang-seg-thumb { transition: transform 360ms var(--ease-spring); }

/* ── Reduced motion: turn everything off, keep functional state ── */
@media (prefers-reduced-motion: reduce) {
  .scroll-progress { display: none; }
  .hero-top, .hero-meta, .hero-loc, .hero-cta, .hero-bottom,
  .hero-word, .hero-main::before {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
  .section[data-reveal] .section-head,
  .section[data-reveal] .section-body,
  .section[data-reveal].is-revealed .work-grid .work-card,
  .section[data-reveal].is-revealed .lang-row,
  .section[data-reveal].is-revealed .contact-list li {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
  .lang-bar-fill {
    transition: none !important;
    width: var(--pct, 0%) !important;
  }
  .status-dot { animation: none !important; }
  .btn, .work-card, .work-thumb, .work-arrow,
  .nav a::after, .contact-list a {
    transition: none !important;
  }
}
