@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;1,300;1,400&family=Courier+Prime:ital@0;1&display=swap');

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
  --bg:       #0d0d11;
  --text:     #fcfbf6;                  /* almost white */
  --text2:    rgba(252,251,246,0.88);   /* clearly readable secondary */
  --accent:   #d76e44;
  --gold:     #d4b477;
  --border:   rgba(255,255,255,0.07);
  --card-bg:  rgba(200,96,58,0.07);
  --tag-b:    rgba(200,160,80,0.22);
  --tag-c:    rgba(200,160,80,0.78);
  --sb:       rgba(200,96,58,0.32);
  --copy:     rgba(255,255,255,0.14);
  --lock-c:   rgba(255,255,255,0.13);
  --lock-h:   rgba(255,255,255,0.4);
  --mode-c:   rgba(255,255,255,0.28);
  --mode-h:   rgba(255,255,255,0.65);
  --ov-bg:    rgba(10,10,14,0.94);
}

body.light {
  --bg:       #f4f1e9;
  --text:     #070503;                  /* almost black */
  --text2:    rgba(10,8,4,0.90);        /* clearly readable secondary */
  --accent:   #b8431f;
  --gold:     #8a5d12;
  --border:   rgba(0,0,0,0.08);
  --card-bg:  rgba(160,70,30,0.06);
  --tag-b:    rgba(100,65,10,0.2);
  --tag-c:    rgba(85,50,5,0.7);
  --sb:       rgba(160,65,25,0.26);
  --copy:     rgba(0,0,0,0.18);
  --lock-c:   rgba(0,0,0,0.1);
  --lock-h:   rgba(0,0,0,0.35);
  --mode-c:   rgba(0,0,0,0.22);
  --mode-h:   rgba(0,0,0,0.55);
  --ov-bg:    rgba(236,232,222,0.95);
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Cormorant Garamond', Georgia, serif;
  cursor: none;
  transition: background 0.55s ease, color 0.55s ease;
  -webkit-font-smoothing: antialiased;
}

/* ── Canvas layers ─────────────────────────────────────────────── */
#bg-canvas, #fx-canvas {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  pointer-events: none;
}
#bg-canvas { z-index: 0; will-change: transform; }
#fx-canvas { z-index: 2; width: 100vw; }

/* ── Horizontal scroll track ───────────────────────────────────── */
#sections-track {
  position: fixed;
  top: 0; left: 0;
  width: 400vw; height: 100vh;
  display: flex;
  z-index: 1;
  will-change: transform;
}

/* ── Section ───────────────────────────────────────────────────── */
.section {
  width: 100vw; height: 100vh;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr);   /* pin row to viewport so columns can scroll inside */
  border-right: 1px solid var(--border);
  padding: 48px 0 50px;
  position: relative;
  transition: border-color 0.5s;
}

.col-left, .col-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  padding: 0 32px 0 52px;
}
.col-right { padding: 0 44px 0 18px; }
/* Sections that carry a scroll region top-align both columns, so a long
   list shrinks-and-scrolls in place rather than pushing content off-screen. */
.section.dense .col-left,
.section.dense .col-right { justify-content: flex-start; }

/* ── Vertical scroll within columns ───────────────────────────── */
/* flex:0 1 auto + min-height:0 lets the region shrink below its content
   height and scroll internally, so it is always fully contained. */
.vscroll {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--sb) transparent;
}
.vscroll::-webkit-scrollbar { width: 2px; }
.vscroll::-webkit-scrollbar-thumb { background: var(--sb); border-radius: 2px; }

/* ── Typography ────────────────────────────────────────────────── */
.section-label {
  font-family: 'Courier Prime', monospace;
  font-size: 9.5px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 16px;
}

.section-title {
  font-family: 'IM Fell English', Georgia, serif;
  font-size: 47px;
  font-weight: 400;
  line-height: 1.04;
  color: var(--text);
  margin-bottom: 16px;
}

/* Right-column heading — a smaller echo of the section title */
.col-head { margin-bottom: 4px; }
.col-title {
  font-family: 'IM Fell English', Georgia, serif;
  font-size: 33px;
  font-weight: 400;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 12px;
}

.flame-rule {
  width: 26px;
  height: 1.5px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  margin-bottom: 22px;
  border-radius: 1px;
}

.body-text {
  font-size: 18.5px;
  font-weight: 400;
  line-height: 1.74;
  color: var(--text2);
}
.body-text em { font-style: italic; color: var(--gold); }

/* ── Entrance reveals ──────────────────────────────────────────── */
/* Each top-level block in a section starts hidden and rises into place
   when its section gains .is-active (set by goTo). Stagger comes from the
   per-block --ri index assigned in renderContent(). The drift direction
   (--rev-dir, +1 from the right / -1 from the left) is set on the body by
   goTo() so content slides in the way you travelled. */
.reveal {
  opacity: 0;
  transform: translateY(18px) translateX(calc(var(--rev-dir, 1) * 22px));
  transition: opacity 0.6s ease,
              transform 0.7s cubic-bezier(.2,.7,.2,1);
  transition-delay: calc(var(--ri, 0) * 55ms);
}
.section.is-active .reveal {
  opacity: 1;
  transform: none;
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  margin-top: 10px;
  padding: 11px 14px;
  border: 1px solid var(--tag-b);
  border-left: 2px solid var(--accent);
  background: var(--card-bg);
  border-radius: 0 3px 3px 0;
  transition: background 0.4s, border-color 0.4s,
              transform 0.4s cubic-bezier(.2,.7,.2,1), box-shadow 0.4s ease;
}
.card:hover {
  transform: translateX(3px);
  border-left-width: 3px;
  box-shadow: -6px 0 18px -10px rgba(200,96,58,0.5);
}
.card-title {
  font-family: 'IM Fell English', Georgia, serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 6px;
}
.card-body {
  font-size: 15.5px;
  font-weight: 400;
  line-height: 1.62;
  color: var(--text2);
}

/* ── Timeline ──────────────────────────────────────────────────── */
.timeline {
  position: relative;
  margin-top: 14px;
  padding-left: 20px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 1px;
  background: var(--tag-b);
}
.timeline-entry {
  position: relative;
  margin-bottom: 20px;
}
.timeline-entry::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
  transition: background 0.4s, box-shadow 0.4s;
}
.tl-dates {
  font-family: 'Courier Prime', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tag-c);
}
.tl-dash { margin: 0 0.4em; opacity: 0.5; }
.tl-role {
  font-family: 'IM Fell English', Georgia, serif;
  font-size: 21px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
  margin-top: 5px;
}
.tl-org {
  font-family: 'Courier Prime', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.35;
  color: var(--gold);
  margin-top: 4px;
}
.tl-place {
  font-family: 'Courier Prime', monospace;
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text2);
  opacity: 0.85;
  margin-top: 3px;
}
.tl-body {
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text2);
  margin-top: 6px;
}

/* ── Images ────────────────────────────────────────────────────── */
.img-wrap {
  width: 100%;
  border: 1px solid var(--tag-b);
  border-radius: 2px;
  overflow: hidden;
  background: var(--card-bg);
  margin-top: 10px;
  position: relative;
}
.img-wrap img,
.img-wrap video {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0.84;
  filter: contrast(1.08);
  transition: opacity 0.3s;
}
.img-wrap img:hover,
.img-wrap video:hover { opacity: 0.96; }
.img-placeholder {
  display: none;
  width: 100%;
  aspect-ratio: 16 / 10;
  align-items: center;
  justify-content: center;
  font-family: 'Courier Prime', monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tag-c);
  background: repeating-linear-gradient(135deg, var(--card-bg) 0 10px, transparent 10px 20px);
  border: 1px dashed var(--tag-b);
}
.img-caption {
  font-family: 'Courier Prime', monospace;
  font-size: 9px;
  color: var(--tag-c);
  letter-spacing: 0.09em;
  margin-top: 5px;
  margin-bottom: 4px;
}


/* ── Tags ──────────────────────────────────────────────────────── */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tag {
  font-family: 'Courier Prime', monospace;
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--tag-c);
  border: 1px solid var(--tag-b);
  padding: 3px 8px;
  border-radius: 2px;
}

/* ── Skills list (contact section) ────────────────────────────── */
.skill-list { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.skill-item {
  font-family: 'Courier Prime', monospace;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tag-c);
  border: 1px solid var(--tag-b);
  border-left: 2px solid var(--accent);
  padding: 7px 12px;
  border-radius: 0 3px 3px 0;
  display: block;
  transition: background 0.3s, transform 0.3s cubic-bezier(.2,.7,.2,1);
}
.skill-item:hover { background: var(--card-bg); transform: translateX(3px); }

/* ── Contact links ─────────────────────────────────────────────── */
.mailto {
  display: inline-block;
  margin-top: 22px;
  font-family: 'Courier Prime', monospace;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(180,80,40,0.3);
  padding-bottom: 2px;
  transition: color 0.3s;
}
.mailto:hover { color: var(--gold); }

.ext-links {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.ext-link {
  position: relative;
  font-family: 'Courier Prime', monospace;
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text2);
  text-decoration: none;
  transition: color 0.2s;
  will-change: transform;
}
.ext-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%; height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(.2,.7,.2,1);
}
.ext-link:hover { color: var(--gold); }
.ext-link:hover::after { transform: scaleX(1); }

/* ── Engine-station nav rail ────────────────────────────────────── */
#dot-nav {
  position: fixed;
  top: 50%; right: 22px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 26px;
  z-index: 20;
  /* fuel line behind the dots, filled to --nav-progress (0..1) */
  --nav-progress: 0;
}
#dot-nav::before {
  content: '';
  position: absolute;
  right: 2px; top: 3px; bottom: 3px;
  width: 1px;
  background: var(--lock-c);
}
#dot-nav::after {
  content: '';
  position: absolute;
  right: 2px; top: 3px;
  width: 1px;
  height: calc(var(--nav-progress) * (100% - 6px));
  background: linear-gradient(180deg, var(--accent), var(--gold));
  box-shadow: 0 0 6px rgba(200,96,58,0.5);
  transition: height 0.5s cubic-bezier(.2,.7,.2,1);
}
.nav-dot {
  position: relative;
  width: 6px; height: 6px;
  border-radius: 50%;
  border: 1px solid var(--lock-c);
  cursor: pointer;
  transition: all 0.35s;
  background: transparent;
  align-self: flex-end;
  margin-right: -0.5px;
  will-change: transform;
}
.nav-dot:hover { border-color: var(--accent); }
.nav-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 6px rgba(215,110,68,0.45);
  transform: scale(1.5);
}

/* ── Footer ────────────────────────────────────────────────────── */
#footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 20;
  pointer-events: none;
}

.copyright {
  font-family: 'Courier Prime', monospace;
  font-size: 8.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--copy);
  transition: color 0.5s;
}

/* ── Mode toggle ───────────────────────────────────────────────── */
#mode-btn {
  background: none;
  border: none;
  cursor: pointer;
  pointer-events: all;
  color: var(--mode-c);
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.25s;
  padding: 0;
}
#mode-btn:hover { color: var(--mode-h); }
#mode-btn svg { width: 15px; height: 15px; }

/* ── Custom cursor ─────────────────────────────────────────────── */
#cursor-dot {
  position: fixed;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: background 0.4s, width 0.25s ease, height 0.25s ease, opacity 0.25s;
}
#cursor-ring {
  position: fixed;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(200,96,58,0.42);
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.28s cubic-bezier(.34,1.56,.64,1),
              height 0.28s cubic-bezier(.34,1.56,.64,1),
              border-color 0.28s ease, background 0.28s ease;
}
/* Hover state: ring blooms over interactive elements, dot recedes */
body.cursor-hover #cursor-ring {
  width: 46px; height: 46px;
  border-color: var(--accent);
  background: rgba(200,96,58,0.06);
}
body.cursor-hover #cursor-dot {
  width: 4px; height: 4px;
  opacity: 0.6;
}
body.light.cursor-hover #cursor-ring { background: rgba(176,58,32,0.07); }

/* ═══ Intro layout: heading + body (left) · portrait (right) · lab images ═══ */
.section.intro-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto minmax(0, 1fr) 0.9fr;
  grid-template-areas:
    "head head portrait"
    "body body portrait"
    "laba labb labb";
  gap: 20px 26px;
  padding: 46px 52px 50px;
}
.intro-head { grid-area: head; align-self: end; }
.intro-body {
  grid-area: body;
  min-height: 0;
  overflow-y: auto;
  padding-right: 8px;
}
.intro-portrait { grid-area: portrait; }
.intro-lab-a    { grid-area: laba; }
.intro-lab-b    { grid-area: labb; }

/* Fill-the-cell image slots (Intro only — cropped to fit the grid) */
.intro-layout .img-wrap {
  height: 100%;
  margin: 0;
  min-height: 0;
  position: relative;
}
.intro-layout .img-wrap img,
.intro-layout .img-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.intro-layout .img-placeholder {
  height: 100%;
  aspect-ratio: auto;
}
/* caption overlays the bottom of the intro fill slots */
.intro-layout .img-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  margin: 0;
  padding: 16px 12px 7px;
  color: rgba(255,255,255,0.92);
  background: linear-gradient(transparent, rgba(0,0,0,0.66));
}

/* ═══ Research layout: skills bar + master-detail ═══════════════════ */
.section.research-layout {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 14px;
  padding: 44px 52px 48px;
}
.research-head { flex: 0 0 auto; }
.research-head .section-title { margin-bottom: 6px; }
.research-intro {
  font-size: 15px;
  line-height: 1.6;
  max-width: 72ch;
  margin-top: 2px;
}

/* Skills — categorized bubbles, compact, at the top */
.skills-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px 24px;
  padding: 13px 0 5px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.skill-group-label {
  font-family: 'Courier Prime', monospace;
  font-size: 8.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--tag-c);
  margin-bottom: 7px;
}
.bubbles { display: flex; flex-wrap: wrap; gap: 5px; }
.bubble {
  font-family: 'Courier Prime', monospace;
  font-size: 10px;
  letter-spacing: 0.03em;
  color: var(--text2);
  border: 1px solid var(--tag-b);
  background: var(--card-bg);
  padding: 3px 9px;
  border-radius: 11px;
  white-space: nowrap;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}
.bubble:hover { border-color: var(--accent); color: var(--text); }

/* Master-detail: project list (left) + detail stage (right) */
.research-md {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 24px;
  padding-top: 2px;
}
.proj-list {
  flex: 0 0 33%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-right: 1px solid var(--border);
  padding-right: 14px;
}
.proj-item {
  text-align: left;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 0 3px 3px 0;
  transition: background 0.3s, border-color 0.3s, transform 0.3s cubic-bezier(.2,.7,.2,1);
}
.proj-item:hover { background: var(--card-bg); transform: translateX(2px); }
.proj-item.active { background: var(--card-bg); border-left-color: var(--accent); }
.proj-item-title {
  font-family: 'IM Fell English', Georgia, serif;
  font-size: 18px;
  line-height: 1.16;
  color: var(--text);
}
.proj-item-org {
  font-family: 'Courier Prime', monospace;
  font-size: 9px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--tag-c);
}
.proj-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 8px;
}
.proj-detail { display: none; }
.proj-detail.active { display: block; animation: proj-in 0.45s cubic-bezier(.2,.7,.2,1); }
@keyframes proj-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.proj-detail { padding: 0 4px 0 0; }
/* Research media shows its full, uncropped aspect ratio; tall media just makes
   the detail panel (.proj-stage) scroll. */
.proj-img {
  width: 100%;
  margin-bottom: 8px;
  position: relative;
  background: var(--card-bg);
}
.proj-img img,
.proj-img video {
  width: 100%;
  height: auto;
  display: block;
}
.proj-img .img-placeholder { aspect-ratio: 16 / 10; height: auto; }
.proj-detail .card-title { font-size: 25px; margin-bottom: 3px; }
.proj-detail-org {
  font-family: 'Courier Prime', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 13px;
}
.proj-detail .card-body { font-size: 15.5px; line-height: 1.72; }
.proj-link { display: inline-block; margin-top: 16px; }
.proj-link::after { bottom: -3px; }

/* ═══ Hobbies (Contact) ═════════════════════════════════════════════ */
.hobbies { margin-top: 24px; }
.hobbies-head {
  font-family: 'Courier Prime', monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tag-c);
  margin-bottom: 11px;
}
.hobbies .bubble { font-size: 11px; padding: 5px 12px; }
.bubble-link { text-decoration: none; cursor: pointer; }
.bubble-link::after { content: ' ↗'; opacity: 0.55; }
.bubble-link:hover { border-color: var(--accent); color: var(--text); }

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  html, body { cursor: auto; }
  #cursor-dot, #cursor-ring { display: none; }

  /* Every section becomes a simple vertical document that scrolls inside its
     own 100vh panel. Block flow (not fixed-height flex/grid) is the key — it
     prevents the children from compressing on top of each other. */
  #sections-track {
    width: 400vw;
    height: 100vh;
    height: 100dvh;   /* track the visible area, not the address-bar-hidden height */
  }
  .section,
  .section.intro-layout,
  .section.research-layout {
    display: block;
    width: 100vw;
    height: 100vh;
    height: 100dvh;   /* so the fixed footer never overlaps the last line on phones */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 52px 26px 96px;   /* room for top nav; breathing space above footer */
  }

  /* Generic two-column sections → stacked */
  .col-left, .col-right {
    display: block;
    min-height: 0;
    padding: 0;
  }
  .col-right { margin-top: 30px; }
  .vscroll { display: block; max-height: none; overflow: visible; }
  .col-head { margin-top: 4px; }

  /* Intro (phone): plain block flow in DOM order — name, portrait, bio, lab
     images. (Block flow, not a fixed-height grid, so tall media can't overflow
     its row onto the next block.) display:block is inherited from the rule
     above; just space the blocks and set image ratios. */
  .intro-head, .intro-body { overflow: visible; padding: 0; }
  .intro-body { margin-top: 14px; }
  .intro-layout .img-wrap { height: auto; aspect-ratio: 3 / 2; margin-top: 14px; }
  .intro-layout .intro-portrait { aspect-ratio: 4 / 5; }

  /* Research → skills stack full-width so long labels never get clipped */
  .skills-bar { grid-template-columns: 1fr; gap: 13px 0; }
  .bubble { white-space: normal; max-width: 100%; }
  .research-md { display: block; }
  .proj-list {
    display: block;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0 0 14px;
    margin-bottom: 18px;
  }
  .proj-item { padding: 10px 12px; }
  .proj-stage { display: block; overflow: visible; padding-right: 0; }
  .proj-img { height: auto; aspect-ratio: auto; }

  /* Tighter headings on small screens */
  .section-title { font-size: 34px; }
  .col-title { font-size: 26px; }
  .proj-detail .card-title { font-size: 23px; }

  /* Nav rail → horizontal strip pinned top-centre (more room up there) */
  #dot-nav {
    top: 18px; bottom: auto; right: 50%;
    transform: translateX(50%);
    flex-direction: row;
    gap: 22px;
    --nav-progress: 0;
  }
  #dot-nav::before {
    right: auto; top: auto;
    left: 3px; right: 3px; bottom: 2px;
    width: auto; height: 1px;
  }
  #dot-nav::after {
    right: auto; top: auto;
    left: 3px; bottom: 2px;
    height: 1px;
    width: calc(var(--nav-progress) * (100% - 6px));
    transition: width 0.5s cubic-bezier(.2,.7,.2,1);
  }
  .nav-dot {
    width: 9px; height: 9px;        /* larger touch target */
    align-self: center;
    margin: 0;
  }
  /* labels would collide horizontally — hide on mobile */
  .nav-dot::after { display: none; }
  .nav-dot.active { transform: scale(1.4); }

  /* Bigger footer hit areas for thumbs; fade content out behind it */
  #footer {
    height: 54px; padding: 0 22px;
    background: linear-gradient(transparent, var(--bg) 55%);
  }
  #mode-btn { width: 34px; height: 34px; }
  #mode-btn svg { width: 18px; height: 18px; }
  .copyright { font-size: 7.5px; letter-spacing: 0.16em; }
}

/* ── Ignition preloader ────────────────────────────────────────── */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  transition: opacity 0.6s ease;
}
body.loaded #preloader {
  opacity: 0;
  pointer-events: none;
}
.pre-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  color: var(--accent);
}
.pre-glyph {
  width: 76px; height: 76px;
  color: var(--text2);
}
/* the cowl/duct strokes draw themselves in, then the axis ignites */
.pre-glyph path, .pre-glyph line {
  stroke-dasharray: 90;
  stroke-dashoffset: 90;
  animation: pg-draw 0.7s cubic-bezier(.4,0,.2,1) forwards;
}
.pre-glyph .pg-duct { animation-delay: 0.25s; }
.pre-glyph .pg-axis {
  stroke: var(--accent);
  animation: pg-draw 0.5s ease forwards 0.55s;
}
@keyframes pg-draw { to { stroke-dashoffset: 0; } }

.pre-label {
  font-family: 'Courier Prime', monospace;
  font-size: 9px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--text2);
  text-indent: 0.42em;
}
.pre-bar {
  width: 190px; height: 1.5px;
  background: var(--lock-c);
  border-radius: 2px;
  overflow: hidden;
}
.pre-fill {
  display: block;
  width: 0%; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  box-shadow: 0 0 8px rgba(200,96,58,0.6);
}
.pre-mach {
  font-family: 'Courier Prime', monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--text2);
}
.pre-mach em { font-style: normal; color: var(--gold); }
/* radial ignition flash on completion */
.pre-flash {
  position: absolute;
  left: 50%; top: 50%;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200,96,58,0.55), transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
}
#preloader.igniting .pre-flash {
  animation: pre-flash 0.6s ease-out forwards;
}
@keyframes pre-flash {
  0%   { opacity: 0.9; transform: translate(-50%,-50%) scale(0); }
  100% { opacity: 0;   transform: translate(-50%,-50%) scale(60); }
}

/* ── Mobile swipe affordance (shown once, JS-toggled) ──────────── */
#swipe-hint {
  position: fixed;
  left: 50%; bottom: 84px;
  transform: translateX(-50%);
  z-index: 30;
  font-family: 'Courier Prime', monospace;
  font-size: 8.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text2);
  display: none;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
#swipe-hint.show { display: flex; opacity: 0.85; }
#swipe-hint .sh-arrow { animation: sh-slide 1.4s ease-in-out infinite; }
@keyframes sh-slide {
  0%,100% { transform: translateX(0); opacity: 0.4; }
  50%     { transform: translateX(7px); opacity: 1; }
}

/* ── Reduced motion: strip all the new motion, keep it usable ──── */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  #preloader { display: none !important; }
  .pre-glyph path, .pre-glyph line { animation: none; stroke-dashoffset: 0; }
  .card:hover { transform: none; box-shadow: none; }
  .nav-dot, #cursor-ring, #cursor-dot, #dot-nav::after { transition: none; }
  #swipe-hint .sh-arrow { animation: none; }
}
