/* style.css — "Ink & Ember" design system.
 * Order: tokens → base → nav → hero → sections → timeline → pills → cards
 *        → footer → motion → responsive. All colors flow from the tokens. */

/* ---------- 1. Design tokens ---------- */

:root {
  /* light theme: warm paper + deep teal + ember */
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --ink: #1c1917;
  --muted: #57534e;
  --line: #e7e0d8;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #0f766e1a;
  --ember: #c2410c;
  --ember-soft: #c2410c14;
  --accent-glow: rgb(15 118 110 / 0.30); /* focused coverflow-card pop shadow */
  --shadow: 0 1px 2px rgb(28 25 23 / 0.06), 0 8px 24px rgb(28 25 23 / 0.08);
  --shadow-lift: 0 2px 4px rgb(28 25 23 / 0.08), 0 16px 40px rgb(28 25 23 / 0.14);
  --header-bg: rgb(250 247 242 / 0.82);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6.5rem;

  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 28px;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0c0a09;
  --surface: #1c1917;
  --surface-raised: #232019;
  --ink: #f5f5f4;
  --muted: #a8a29e;
  --line: #2e2a26;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --accent-soft: #2dd4bf1f;
  --ember: #fb923c;
  --ember-soft: #fb923c1f;
  --accent-glow: rgb(45 212 191 / 0.35); /* focused coverflow-card pop shadow */
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.45);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.5), 0 16px 40px rgb(0 0 0 / 0.55);
  --header-bg: rgb(12 10 9 / 0.82);

  color-scheme: dark;
}

/* ---------- 2. Base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0;
}

p {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: var(--accent);
}

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

.container {
  width: min(100% - 2.5rem, 68rem);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3.5rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #ffffff;
  border-radius: var(--radius-s);
  text-decoration: none;
  transition: top 150ms ease;
}

[data-theme="dark"] .skip-link {
  color: #042f2e;
}

.skip-link:focus {
  top: 1rem;
}

/* ---------- 3. Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

/* lusion-style morph: an arrow slides in and the pill widens on hover */
.btn::after {
  content: "\2192";
  display: inline-block;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateX(-8px);
  transition: max-width 200ms ease, opacity 200ms ease, transform 200ms ease;
}

.btn:hover::after,
.btn:focus-visible::after {
  max-width: 1.2em;
  opacity: 1;
  transform: translateX(0);
}

.btn--primary {
  background: var(--accent);
  color: #ffffff;
}

[data-theme="dark"] .btn--primary {
  color: #042f2e;
}

.btn--primary:hover {
  background: var(--accent-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

[data-theme="dark"] .btn--primary:hover {
  color: #042f2e;
}

.btn--ghost {
  color: var(--ink);
  border: 1px solid var(--line);
  background: transparent;
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- 4. Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4rem;
}

.nav__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
}

.nav__brand span {
  color: var(--ember);
}

.nav__menu {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav__link {
  position: relative;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.35rem 0;
  transition: color 150ms ease;
}

.nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms ease;
}

.nav__link:hover,
.nav__link--active {
  color: var(--ink);
}

.nav__link:hover::after,
.nav__link--active::after {
  transform: scaleX(1);
}

/* 7 links + toggle get tight between the mobile breakpoint and ~1100px */
@media (min-width: 861px) and (max-width: 1100px) {
  .nav__menu {
    gap: var(--space-2);
  }

  .nav__link {
    font-size: 0.9rem;
  }
}

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 0.6rem;
  background: none;
  border: none;
  cursor: pointer;
}

.nav__toggle-bar {
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 200ms ease, opacity 200ms ease;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:first-child {
  transform: translateY(4px) rotate(45deg);
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 150ms ease, transform 150ms ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: rotate(15deg);
}

.theme-toggle__icon--moon,
[data-theme="dark"] .theme-toggle__icon--sun {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--moon {
  display: block;
}

/* ---------- 5. Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  align-items: center;
  gap: var(--space-5);
  min-height: calc(100vh - 4rem);
  padding-block: var(--space-5);
}

.hero__kicker {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ember);
  margin-bottom: var(--space-2);
}

.hero__name {
  font-size: clamp(3rem, 9.5vw, 7.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.98;
}

.hero__tagline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  margin-top: var(--space-2);
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 500;
  color: var(--accent);
}

.hero__tagline-dot {
  color: var(--muted);
}

.hero__about {
  margin-top: var(--space-3);
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.hero__socials {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.hero__social-link,
.footer__social-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border-bottom: 1px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
}

.hero__social-link:hover,
.footer__social-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.hero__visual {
  position: relative;
  justify-self: center;
}

.hero__avatar-frame {
  position: relative;
  z-index: 2;
  width: clamp(200px, 26vw, 300px);
  aspect-ratio: 1;
  border-radius: 42% 58% 55% 45% / 48% 44% 56% 52%;
  overflow: hidden;
  background: var(--accent-soft);
  border: 1px solid var(--line);
}

.hero__avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__ring {
  position: absolute;
  z-index: 1;
  inset: -1.2rem -1.2rem auto auto;
  width: 55%;
  aspect-ratio: 1;
  border: 2px solid var(--ember);
  border-radius: 50%;
  opacity: 0.55;
}

.hero__dots {
  position: absolute;
  z-index: 1;
  left: -1.8rem;
  bottom: -1.4rem;
  width: 6rem;
  height: 4.5rem;
  background-image: radial-gradient(var(--accent) 1.5px, transparent 1.6px);
  background-size: 14px 14px;
  opacity: 0.5;
}

/* ---------- 6. Sections ---------- */

.section {
  padding-block: var(--space-6) 0;
}

.section:last-of-type {
  padding-bottom: var(--space-6);
}

.section__kicker {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ember);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

.section__title {
  font-size: clamp(2.4rem, 6.5vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: var(--space-4);
}

/* ---------- 7. Focus cards ---------- */
/* Focus cards ride the #focus rail track (section 10) — sizing lives in the
 * .rail__track--focus modifier there. */

.focus-card {
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.focus-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  border-color: var(--accent);
}

.focus-card__title {
  font-size: 1.35rem;
  margin-bottom: var(--space-1);
}

.focus-card__desc {
  color: var(--muted);
}

/* ---------- 8. Timeline cards (experience & education rails) ---------- */
/* Cards ride the horizontal rail tracks (section 10): each item is a
 * fixed-basis flex child, newest first; the card fills the item so all
 * cards in a track share the tallest card's height. */

.timeline__item {
  display: flex;
}

.timeline__card {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.timeline__card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lift);
}

.timeline__heading {
  font-size: 1.25rem;
}

.timeline__meta {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

.timeline__details {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: var(--space-1);
}

/* ---------- 9. Skill pills ---------- */

.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pill {
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 500;
  font-size: 0.95rem;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.pill:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Skills are grouped into category cards (Languages / Cloud / …) riding the
 * #skills rail track (section 10) — sizing lives in the .rail__track--skills
 * modifier there; pills flow inside each card. */
.skill-group {
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.skill-group:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  border-color: var(--accent);
}

.skill-group__label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-2);
}

.skill-group .pill-grid {
  gap: var(--space-1);
}

.skill-group .pill {
  padding: 0.4rem 0.95rem;
  font-size: 0.9rem;
}

/* Clearly-marked placeholder pills (groups awaiting real content) */
.pill--placeholder {
  border-style: dashed;
  color: var(--muted);
  background: transparent;
}

/* ---------- 10. Rails — pinned horizontal scroll sections ---------- */
/* Desktop (>860px): the section is a tall runway (height set inline by the
 * Rail module in js/effects.js); the sticky .rail__pin holds one viewport
 * while vertical scroll maps to the track's translateX, so rails inherit
 * the Lenis glide. ≤860px: native swipe row (Rail adds data-lenis-prevent
 * there so Lenis leaves the scroller alone). */

.section.section--rail {
  padding-block: 0; /* runway height is set inline by Rail.measure() */
}

.rail__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 5rem; /* clearance under the fixed .site-header */
}

.rail__head .section__title {
  margin-bottom: var(--space-3);
}

.rail__viewport {
  overflow: hidden; /* fallback for browsers without overflow: clip */
  overflow: clip;   /* forbids programmatic scroll of the clip box, so keyboard
                       focus can't fight the transform (Rail glides the page) */
  /* clipping happens at the padding edge: vertical breathing room so card
     reveal/hover transforms and lift shadows aren't shaved off */
  padding-block: 2.5rem;
  margin-block: -2.5rem;
}

.rail__track {
  display: flex;
  align-items: stretch;
  gap: var(--space-3);
  width: max-content;
  padding-inline: var(--rail-inset, 1.25rem); /* px value set by Rail.measure() */
  will-change: transform;
}

.rail__track--projects > .card {
  flex: 0 0 24rem;
}

.rail__track--certificates > .card {
  flex: 0 0 20rem;
}

.rail__track--timeline > .timeline__item {
  flex: 0 0 min(30rem, 82vw);
}

.rail__track--focus > .focus-card {
  flex: 0 0 min(28rem, 82vw);
}

.rail__track--skills > .skill-group {
  flex: 0 0 20rem;
}

/* Dwell rail (Experience): each card permanently reserves a fixed-height
 * expand box so the track's geometry NEVER changes per frame; collapsed
 * state shows the text as a teaser under a gradient mask whose opacity is
 * driven by --dwell-reveal (written by Rail.updateDwell in js/effects.js).
 * [data-dwell-ready] is set by Rail.init() — without JS (or with
 * data-effects="off") the box is auto height and fully visible. This is
 * progressive enhancement, NOT a reduced-motion gate. */
[data-rail-dwell] .timeline__expand {
  margin-top: var(--space-2);
}

[data-rail-dwell][data-dwell-ready] .timeline__expand {
  height: var(--dwell-box-h, 13rem);
  overflow: hidden;
  position: relative;
}

.timeline__expand p {
  color: var(--muted);
  font-size: 0.95rem;
}

.timeline__expand p + p {
  margin-top: var(--space-1);
}

.timeline__expand-inner {
  will-change: transform;
}

[data-rail-dwell][data-dwell-ready] .timeline__expand::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, var(--surface) 78%);
  opacity: calc(1 - var(--dwell-reveal, 0));
}

[data-rail-dwell] .timeline__card {
  will-change: transform, opacity;
}

/* Coverflow pop: the focused card gets an accent ring + tinted glow */
.timeline__card[data-dwell-focus] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft), 0 18px 60px -12px var(--accent-glow), var(--shadow-lift);
}

/* Coverflow card composition (Experience dwell rail only): centered text,
 * accent period/company lines, small tech pill row. Education keeps the
 * plain timeline layout. */
[data-rail-dwell] .timeline__card {
  text-align: center;
}

.timeline__period {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

[data-rail-dwell] .timeline__heading {
  margin-top: 0.2rem;
}

.timeline__org {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.98rem;
  margin-top: 0.15rem;
}

.timeline__tech {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.timeline__tech .pill {
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
}

/* "01 / 0N" wheel counter in the rail head (written by Rail.updateDwell) */
.rail__counter {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: calc(-1 * var(--space-2));
  margin-bottom: var(--space-2);
}

.rail__counter b {
  color: var(--accent);
  font-size: 1.25em;
  font-weight: 700;
}

/* Track fits the viewport (very wide screens): Rail sets data-rail-static
   and the section degrades to a normal static row. */
.section--rail[data-rail-static] {
  padding-block: var(--space-6) 0;
}

.section--rail[data-rail-static] .rail__pin {
  position: static;
  height: auto;
  padding-top: 0;
  display: block;
}

/* Short desktop viewports: keep head + card row inside the 100vh pin */
@media (min-width: 861px) and (max-height: 700px) {
  .rail__track--projects > .card { flex-basis: 19rem; }
  .rail__track--certificates > .card { flex-basis: 16rem; }
  .rail__track--timeline > .timeline__item { flex-basis: 24rem; }
  .rail__track--focus > .focus-card { flex-basis: 23rem; }
  .rail__track--skills > .skill-group { flex-basis: 17rem; }
  [data-rail-dwell] { --dwell-box-h: 7.5rem; } /* short pins: smaller reserved box
     (the coverflow composition adds period/org/tech rows — 9rem overflowed a
     660px-tall pin by 1px, measured in verify5) */
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  border-color: var(--accent);
}

.card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

/* Cards whose URL is still a "#" TODO render as a non-anchor (render.js):
 * same layout, no link affordance, no page-jump on click. */
.card__link--static {
  cursor: default;
}

.card__media {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--accent-soft);
}

/* Certificates are documents: contain (never crop) on the soft accent
 * letterbox, with a little padding so the sheet floats inside the box. */
.card--certificate .card__media {
  aspect-ratio: 4 / 3;
  padding: 0.5rem;
}

.card--certificate .card__image {
  object-fit: contain;
}

.card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
}

.card:hover .card__image {
  transform: scale(1.04);
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: var(--space-2) var(--space-3) var(--space-3);
}

.card__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.3;
}

.card--certificate .card__title {
  font-size: 0.98rem;
}

.card__cta {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.card:hover .card__cta,
.card__link:focus-visible .card__cta {
  opacity: 1;
  transform: translateX(0);
}

/* ---------- 11. Footer / contact ---------- */

.footer {
  margin-top: var(--space-4);
  padding-block: var(--space-5) var(--space-4);
  background: transparent; /* continuous flow — the scene tint shows through */
  text-align: center;
}

.footer__title {
  font-size: clamp(2.6rem, 8vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: var(--space-3);
}

.footer__email {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 150ms ease;
}

.footer__email:hover {
  border-color: var(--accent);
}

.footer__cta {
  margin-top: var(--space-3);
}

.footer__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.footer__location {
  color: var(--muted);
  font-size: 0.95rem;
}

.footer__socials {
  display: flex;
  gap: var(--space-3);
}

.footer__copyright {
  margin-top: var(--space-5);
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- 12. Motion (scroll reveals + masked text) ---------- */

.reveal,
.section__title,
.section__kicker,
.hero__text > *,
.hero__visual,
.footer__title {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 450ms ease var(--reveal-delay, 0ms),
              transform 450ms ease var(--reveal-delay, 0ms);
}

.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Masked word reveal (lusion-style): the outer clip stays put; the inner
 * word slides up out of it. Split elements skip the generic fade above. */
.split-mask {
  opacity: 1;
  transform: none;
  transition: none;
}

.mask-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 0.08em; /* keep descenders inside the clip */
  margin-bottom: -0.08em;
}

.mask-word__inner {
  display: inline-block;
  transform: translateY(115%);
  transition: transform 650ms cubic-bezier(0.22, 1, 0.36, 1) calc(var(--wi, 0) * 60ms);
}

.revealed .mask-word__inner {
  transform: translateY(0);
}

/* ---------- 13. Responsive (mobile-first adjustments) ---------- */

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    min-height: auto;
    padding-block: var(--space-4);
    text-align: center;
  }

  .hero__visual {
    order: -1;
    margin-top: var(--space-3);
  }

  .hero__tagline,
  .hero__actions,
  .hero__socials {
    justify-content: center;
  }

  .hero__about {
    margin-inline: auto;
  }

  .nav__toggle {
    display: flex;
  }

  .nav__menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-2) var(--space-3) var(--space-3);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: none;
  }

  .nav__menu--open {
    display: flex;
  }

  .nav__menu li {
    padding-block: 0.4rem;
  }

  .nav__link {
    display: block;
    font-size: 1.05rem;
  }

  .section {
    padding-block: var(--space-5) 0;
  }

  /* Rails fall back to native horizontal swipe rows: static pin, snap
   * scrolling, no runway. Rail.measure() clears its inline styles when the
   * breakpoint flips; the !importants below are the backstop if a resize
   * crosses the boundary before that listener runs. */
  .section.section--rail {
    height: auto !important;
    padding-block: var(--space-5) 0;
  }

  .section--rail .rail__pin {
    position: static;
    height: auto;
    padding-top: 0;
    display: block;
  }

  .section--rail .rail__viewport {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 1.25rem;
    scrollbar-width: none;
  }

  .section--rail .rail__viewport::-webkit-scrollbar {
    display: none;
  }

  .rail__track {
    transform: none !important;
    padding-inline: 1.25rem;
  }

  .rail__track > .card,
  .rail__track > .timeline__item,
  .rail__track > .focus-card,
  .rail__track > .skill-group {
    scroll-snap-align: start;
  }

  .rail__track--projects > .card {
    flex-basis: min(80vw, 21rem);
  }

  .rail__track--certificates > .card {
    flex-basis: min(70vw, 17rem);
  }

  .rail__track--timeline > .timeline__item {
    flex-basis: min(84vw, 24rem);
  }

  .rail__track--focus > .focus-card {
    flex-basis: min(80vw, 22rem);
  }

  .rail__track--skills > .skill-group {
    flex-basis: min(75vw, 18rem);
  }

  /* Dwell rail on mobile: swipe row with details always visible — no mask,
   * no reserved-height clip, and !important backstops against any inline
   * dwell transforms left behind when a resize crosses the breakpoint. */
  [data-rail-dwell] .timeline__expand,
  [data-rail-dwell][data-dwell-ready] .timeline__expand {
    height: auto;
    overflow: visible;
  }

  [data-rail-dwell][data-dwell-ready] .timeline__expand::after {
    content: none;
  }

  [data-rail-dwell] .timeline__expand-inner {
    transform: none !important;
  }

  [data-rail-dwell] .timeline__card {
    transform: none !important;
    opacity: 1 !important;
  }

  /* wheel counter is meaningless in the swipe row */
  .rail__counter {
    display: none;
  }
}

/* ---------- 14. Effects layers (js/effects.js) ---------- */

/* Fixed background layers: scene tint wash below the constellation canvas,
 * both behind all content and never intercepting input. */
.scene-layer,
#constellation-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.scene-layer {
  z-index: -2;
  transition: none;
}

#constellation-canvas {
  z-index: -1;
  width: 100%;
  height: 100%;
}

/* Magnetic elements are moved per-frame by JS; a CSS transition here would
 * fight the lerp, so transforms stay untransitioned. */
.magnetic {
  transition: color 160ms ease, background-color 160ms ease,
              border-color 160ms ease, box-shadow 160ms ease;
  will-change: transform;
}

/* Custom cursor (js/effects.js Cursor module, fine-pointer devices only).
 * Dot follows instantly; ring chases and scales over interactive targets;
 * the trail canvas draws the dissolving ribbon. All ignore pointer events. */
html.has-custom-cursor,
html.has-custom-cursor * {
  cursor: none !important;
}

.cursor-dot,
.cursor-ring,
.cursor-trail {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
}

.cursor-trail {
  width: 100%;
  height: 100%;
  z-index: 9997;
}

.cursor-ring {
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  z-index: 9998;
  will-change: transform;
}

.cursor-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ember);
  z-index: 9999;
  will-change: transform;
}

/* Lenis recommended CSS (vendored from lenis@1.3.25/dist/lenis.css). */
html.lenis,
html.lenis body {
  height: auto;
}

/* Native smooth-scroll would fight Lenis while it drives the scroll. */
html.lenis {
  scroll-behavior: auto;
}

.lenis:not(.lenis-autoToggle).lenis-stopped {
  overflow: clip;
}

.lenis [data-lenis-prevent],
.lenis [data-lenis-prevent-wheel],
.lenis [data-lenis-prevent-touch],
.lenis [data-lenis-prevent-vertical],
.lenis [data-lenis-prevent-horizontal] {
  overscroll-behavior: contain;
}

.lenis.lenis-smooth iframe {
  pointer-events: none;
}

.lenis.lenis-autoToggle {
  transition-property: overflow;
  transition-duration: 1ms;
  transition-behavior: allow-discrete;
}
