/* ============================================================
   Royden Lam — Aviation Portfolio
   The 3D film is the page. Everything here sits over it, so the
   guiding rule is: never block the aircraft, always stay readable
   against a bright sunset.
   ============================================================ */

:root {
  --ink: #f4f1ec;
  --ink-2: rgba(244, 241, 236, 0.74);
  --ink-3: rgba(244, 241, 236, 0.50);
  --gold: #ffbc72;
  --gold-2: #ff9a52;
  --sky-deep: #0d1626;

  --glass: rgba(14, 20, 34, 0.44);
  --glass-line: rgba(255, 255, 255, 0.14);
  --blur: blur(22px) saturate(1.25);

  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;

  --pad: clamp(1.25rem, 4vw, 4.5rem);
  --panel-w: min(46ch, 42vw);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--sky-deep);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--sky-deep);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.locked { overflow: hidden; }

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--gold); color: #1a1005; }

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

/* ============================================================
   THE STAGE
   ============================================================ */
#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.1s ease 0.15s;
}
body.ready #stage { opacity: 1; }
body.is-switching #stage { opacity: 0.15; transition: opacity 0.3s ease; }

/* film grain — kills banding in the sky gradients */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 300 300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 7s steps(6) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -2%); }
  80% { transform: translate(3%, 1%); }
}
@media (prefers-reduced-motion: reduce) { .grain { animation: none; } }

/* ============================================================
   LOADER
   ============================================================ */
.loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 90% at 50% 60%, #16213a 0%, #080d18 70%);
  transition: opacity 0.8s var(--ease), visibility 0.8s;
}
/* pointer-events:none the instant it's dismissed — NOT when the fade ends.
   `visibility` transitions discretely: it stays `visible` for the whole 0.8s
   fade-out, so this full-screen z-index:200 overlay silently swallows every
   click during it (first click on the aircraft switcher just... did nothing). */
.loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-inner { display: grid; justify-items: center; gap: 1.1rem; width: min(320px, 74vw); }
.loader-mark { color: var(--gold); opacity: 0.9; animation: hover 3.2s ease-in-out infinite; }
@keyframes hover {
  0%,100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-9px) rotate(4deg); }
}
.loader-bar { width: 100%; height: 2px; background: rgba(255,255,255,0.12); border-radius: 2px; overflow: hidden; }
.loader-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold-2), var(--gold));
  transition: width 0.35s ease;
}
.loader-pct { font-size: 0.72rem; letter-spacing: 0.22em; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.loader-hint { font-size: 0.66rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-3); }

/* ============================================================
   CHROME
   ============================================================ */
.chrome {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem var(--pad);
  transition: background 0.4s ease, backdrop-filter 0.4s ease;
}
body.past-cabin .chrome {
  background: linear-gradient(180deg, rgba(8,12,22,0.55), transparent);
}

.brand { display: flex; align-items: center; gap: 0.65rem; }
.brand-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--glass-line);
  border-radius: 50%;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em;
  background: var(--glass);
  backdrop-filter: var(--blur);
}
.brand-text { font-size: 0.78rem; letter-spacing: 0.03em; color: var(--ink-2); }

.nav ul { display: flex; gap: 0.15rem; list-style: none; }
.nav a {
  display: block;
  padding: 0.4rem 0.7rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  border-radius: 999px;
  transition: color 0.25s, background 0.25s;
}
.nav a:hover { color: var(--ink); }
.nav a.on { color: #120c05; background: var(--gold); font-weight: 600; }

.chrome-right { display: flex; align-items: center; gap: 0.6rem; }

.plane-switch {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.42rem 0.8rem;
  font-size: 0.68rem; letter-spacing: 0.09em;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: var(--blur);
  color: var(--ink-2);
  transition: color 0.25s, border-color 0.25s;
  font-variant-numeric: tabular-nums;
}
.plane-switch:hover { color: var(--ink); border-color: rgba(255,255,255,0.3); }
.plane-switch:disabled { opacity: 0.5; cursor: wait; }
.plane-switch-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.nav-toggle { display: none; width: 38px; height: 30px; position: relative; }
.nav-toggle span {
  position: absolute; left: 8px; right: 8px; height: 1.5px;
  background: var(--ink); transition: transform 0.3s var(--ease), opacity 0.3s;
}
.nav-toggle span:nth-child(1) { top: 11px; }
.nav-toggle span:nth-child(2) { top: 18px; }
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(3.5px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { transform: translateY(-3.5px) rotate(-45deg); }

/* progress hairline */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  z-index: 95; background: rgba(255,255,255,0.07);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-2), var(--gold));
  transform: scaleX(0); transform-origin: 0 50%;
}

/* HUD */
.hud {
  position: fixed;
  left: var(--pad); bottom: 1.5rem;
  z-index: 60;
  display: grid; gap: 0.3rem;
  font-size: 0.6rem; letter-spacing: 0.16em;
  opacity: 0; transition: opacity 0.6s ease;
  pointer-events: none;
}
body.ready .hud { opacity: 1; }
.hud-row { display: flex; gap: 0.6rem; align-items: baseline; }
.hud-k { color: var(--ink-3); min-width: 3.4em; }
.hud-v { color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============================================================
   SCROLL RUNWAY — height set in JS from ACTS.length
   ============================================================ */
main { position: relative; z-index: 1; pointer-events: none; }
.acts { width: 100%; }

/* ============================================================
   PANELS
   ============================================================ */
.panels { position: fixed; inset: 0; z-index: 10; pointer-events: none; }

.panel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 5.5rem var(--pad) 4.5rem;
  opacity: 0;
  visibility: hidden;
  will-change: opacity, transform;
  pointer-events: none;
}
.panel-inner {
  width: var(--panel-w);
  max-height: calc(100dvh - 10rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.22) transparent;
}
.panel-inner::-webkit-scrollbar { width: 5px; }
.panel-inner::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.22); border-radius: 3px; }

.panel--left { justify-content: flex-start; }
.panel--right { justify-content: flex-end; }
.panel--center { justify-content: center; text-align: center; }
.panel--center .panel-inner { width: min(70ch, 82vw); }
.panel--wide .panel-inner { width: min(58ch, 50vw); }
.panel--tall .panel-inner,
.panel--gallery .panel-inner { max-height: calc(100dvh - 8rem); }
.panel--gallery .panel-inner { width: min(1100px, 92vw); }

/* Legibility scrim — a wash on the TEXT side only, so the aircraft on the
   other side of frame stays untouched.
   This has to be heavier than instinct suggests: the backdrop behind it is a
   sunlit cloud deck, i.e. near-white, and light text over that is unreadable
   without a real gradient. It must also reach further than the text column,
   because the copy runs to ~55% of viewport width. */
.panel--left::before,
.panel--right::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: min(82%, 1050px);
  pointer-events: none;
  z-index: -1;
}
.panel--left::before {
  left: 0;
  background: linear-gradient(90deg,
    rgba(5,8,16,0.90) 0%, rgba(5,8,16,0.82) 30%,
    rgba(5,8,16,0.58) 58%, rgba(5,8,16,0.22) 82%, transparent 100%);
}
.panel--right::before {
  right: 0;
  background: linear-gradient(270deg,
    rgba(5,8,16,0.90) 0%, rgba(5,8,16,0.82) 30%,
    rgba(5,8,16,0.58) 58%, rgba(5,8,16,0.22) 82%, transparent 100%);
}
.panel--center::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(60% 45% at 50% 50%, rgba(5,8,16,0.72), transparent 75%);
  pointer-events: none; z-index: -1;
}

/* belt-and-braces for body copy sitting over the brightest cloud tops */
.about-story, .ac-desc, .card-text, .hi-quote, .tl-desc {
  text-shadow: 0 1px 12px rgba(3, 6, 12, 0.75);
}

/* ============================================================
   TYPE
   ============================================================ */
.eyebrow {
  font-size: 0.62rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 0.75rem;
}
.p-title {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 4.4vw, 3.5rem);
  font-weight: 400; line-height: 1.02; letter-spacing: -0.015em;
  margin-bottom: 0.5rem;
}
.p-sub { font-size: 0.86rem; color: var(--ink-3); margin-bottom: 1.5rem; }

/* ---- hero ---- */
.panel--hero .panel-inner { width: min(52ch, 46vw); }
.hero-school {
  font-size: 0.64rem; letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 1.1rem;
}
.hero-name {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 6.4vw, 5.6rem);
  font-weight: 400; line-height: 0.95; letter-spacing: -0.025em;
  margin-bottom: 1.2rem;
  text-shadow: 0 2px 40px rgba(0,0,0,0.5);
}
.hero-tagline {
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.5; color: var(--ink-2); font-weight: 300;
  max-width: 34ch; margin-bottom: 1.5rem;
}
.hero-tagline em { font-style: normal; font-weight: 600; color: var(--ink); }
.hero-goal {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--glass-line); border-radius: 999px;
  background: var(--glass); backdrop-filter: var(--blur);
  font-size: 0.76rem; letter-spacing: 0.08em;
}
.goal-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 10px var(--gold);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.hero-scroll {
  display: flex; align-items: center; gap: 0.7rem;
  margin-top: 3rem;
  font-size: 0.6rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--ink-3);
}
.hero-scroll-line {
  width: 46px; height: 1px; background: linear-gradient(90deg, var(--gold), transparent);
  position: relative; overflow: hidden;
}
.hero-scroll-line::after {
  content: ''; position: absolute; inset: 0;
  background: var(--gold); animation: slide 2.2s ease-in-out infinite;
}
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(200%); } }

/* ---- big sky statements ---- */
.sky-line, .chase-line {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4.2vw, 3.4rem);
  font-weight: 400; line-height: 1.2; letter-spacing: -0.015em;
  text-shadow: 0 2px 50px rgba(0,0,0,0.55);
}
.chase-line em { font-style: italic; color: var(--gold); }

/* ---- about ---- */
.about-grid { display: grid; gap: 1.3rem; }
.about-photo {
  width: 148px; height: 148px; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--glass-line);
  box-shadow: 0 20px 50px rgba(0,0,0,0.45);
  flex-shrink: 0;
}
.about-photo img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; transition: transform 0.6s var(--ease); }
.about-photo:hover img { transform: scale(1.06); }
.about-story { font-size: 0.94rem; line-height: 1.72; color: var(--ink-2); font-weight: 300; }

/* ---- skills ---- */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  padding: 0.45rem 0.9rem;
  font-size: 0.76rem;
  border: 1px solid var(--glass-line); border-radius: 999px;
  background: var(--glass); backdrop-filter: var(--blur);
  transition: transform 0.3s var(--ease), border-color 0.3s, color 0.3s;
}
.chip:hover { transform: translateY(-2px); border-color: var(--gold); color: var(--gold); }

/* ---- highlights ---- */
.hi-list { display: grid; gap: 0.7rem; }
.hi {
  display: flex; gap: 0.9rem; align-items: flex-start;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--glass-line); border-radius: 14px;
  background: var(--glass); backdrop-filter: var(--blur);
  transition: transform 0.35s var(--ease), border-color 0.35s;
}
.hi:hover { transform: translateX(5px); border-color: rgba(255,188,114,0.5); }
.hi-icon { font-size: 1.3rem; line-height: 1.2; }
.hi-title { font-size: 0.92rem; font-weight: 600; line-height: 1.3; margin-bottom: 0.15rem; }
.hi-sub { font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-bottom: 0.4rem; }
.hi-quote { font-size: 0.82rem; line-height: 1.6; color: var(--ink-3); font-style: italic; }

/* ---- flying hours ---- */
.stats { display: flex; flex-wrap: wrap; gap: 2.2rem; margin-bottom: 1.5rem; }
.stat-v {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 5.5vw, 4.2rem);
  line-height: 0.9; color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 60px rgba(255,154,82,0.35);
}
.stat-l { font-size: 0.7rem; line-height: 1.5; color: var(--ink-3); margin-top: 0.5rem; letter-spacing: 0.04em; }
.hours-plane { width: 120px; opacity: 0.5; filter: drop-shadow(0 8px 24px rgba(0,0,0,0.5)); }

/* ---- achievements accordion ---- */
.ac-list { display: grid; gap: 1px; border-top: 1px solid var(--glass-line); }
.ac-row { border-bottom: 1px solid var(--glass-line); }
.ac-head {
  display: flex; align-items: center; gap: 0.7rem;
  width: 100%; text-align: left; padding: 0.85rem 0;
}
.ac-plus {
  position: relative; width: 11px; height: 11px; flex-shrink: 0;
}
.ac-plus::before, .ac-plus::after {
  content: ''; position: absolute; background: var(--gold);
  transition: transform 0.35s var(--ease), opacity 0.35s;
}
.ac-plus::before { left: 0; right: 0; top: 5px; height: 1.5px; }
.ac-plus::after { top: 0; bottom: 0; left: 5px; width: 1.5px; }
.ac-row.open .ac-plus::after { transform: scaleY(0); opacity: 0; }
.ac-name { font-size: 0.86rem; font-weight: 500; line-height: 1.35; transition: color 0.3s; }
.ac-row:hover .ac-name { color: var(--gold); }
.ac-row.open .ac-name { color: var(--gold); font-weight: 600; }

/* grid-template-rows 0fr -> 1fr animates height without knowing it up front */
.ac-detail {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease), opacity 0.35s;
  opacity: 0;
}
.ac-row.open .ac-detail { grid-template-rows: 1fr; opacity: 1; }
.ac-detail-in {
  min-height: 0; overflow: hidden;
  display: grid; gap: 0.6rem;
  padding-left: 1.8rem;
}
.ac-row.open .ac-detail-in { padding-bottom: 1rem; }
.ac-cat { font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.ac-desc { font-size: 0.82rem; line-height: 1.68; color: var(--ink-2); font-weight: 300; }
.ac-meta { font-size: 0.7rem; color: var(--ink-3); }

/* Unmissable marker for copy that still needs Royden's own words.
   Driven by "[Please change]" in data.js — remove the marker there and this
   vanishes automatically. */
.todo-flag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  margin-right: 0.35rem;
  border-radius: 4px;
  background: #ffcf4a;
  color: #2b1d00;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  vertical-align: 1px;
  text-shadow: none;
}
/* NOT a fixed aspect-ratio box.
   Royden's photos are a mix of landscape DSLR shots and portrait phone shots
   (886x1920, 1081x1920). Forcing them all into 16:10 threw away up to 71% of
   the tall ones — cropped from the centre, so it sliced the tops off people's
   heads. Height-capping instead means:
     landscape  -> shorter than the cap, shown UNCROPPED
     portrait   -> capped, and cropped from 35% (see below), not the centre
   35% rather than 50%: in a photo of people, faces sit in the upper third. */
.ac-photo {
  width: 100%;
  max-height: 42vh;
  object-fit: cover;
  object-position: center 35%;
  border-radius: 12px; border: 1px solid var(--glass-line);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  cursor: zoom-in;
}
.ac-cert, .letter-btn {
  justify-self: start;
  padding: 0.55rem 1.1rem;
  font-size: 0.72rem; letter-spacing: 0.09em;
  border: 1px solid var(--gold); border-radius: 999px;
  color: var(--gold);
  transition: background 0.3s, color 0.3s;
}
.ac-cert:hover, .letter-btn:hover { background: var(--gold); color: #150d04; }

/* ---- rails ---- */
.rail {
  display: flex; gap: 0.85rem;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 0.75rem;
  scrollbar-width: none;
  cursor: grab;
}
.rail::-webkit-scrollbar { display: none; }
.rail.dragging { cursor: grabbing; scroll-snap-type: none; }
.card {
  flex: 0 0 clamp(230px, 24vw, 290px);
  scroll-snap-align: start;
  border: 1px solid var(--glass-line); border-radius: 14px;
  background: var(--glass); backdrop-filter: var(--blur);
  overflow: hidden;
  transition: transform 0.4s var(--ease), border-color 0.4s;
}
.card:hover { transform: translateY(-4px); border-color: rgba(255,188,114,0.42); }
/* Cards keep a fixed box so the rail stays tidy — but the crop is anchored at
   30%, not the centre. Half these sources are portrait phone photos (960x1280)
   losing 53% of their height; centred, that decapitates everyone in them. */
.card-img { aspect-ratio: 16 / 10; overflow: hidden; }
.card-img img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: center 30%;
  cursor: zoom-in; transition: transform 0.7s var(--ease);
}
.card:hover .card-img img { transform: scale(1.07); }
.card-body { padding: 0.95rem 1rem 1.1rem; }
.card-when { font-size: 0.6rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--gold); margin-bottom: 0.35rem; }
.card-title { font-size: 0.9rem; font-weight: 600; line-height: 1.32; margin-bottom: 0.2rem; }
.card-org { font-size: 0.72rem; color: var(--ink-3); margin-bottom: 0.55rem; }
.card-text { font-size: 0.78rem; line-height: 1.62; color: var(--ink-2); font-weight: 300; }

.rail-nav { display: flex; gap: 0.4rem; margin-top: 0.8rem; }
.rail-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--glass-line);
  background: var(--glass); backdrop-filter: var(--blur);
  display: grid; place-items: center; font-size: 1rem; line-height: 1;
  color: var(--ink-2);
  transition: color 0.25s, border-color 0.25s;
}
.rail-btn:hover { color: var(--gold); border-color: var(--gold); }

/* ---- competition timeline ---- */
.timeline { display: grid; gap: 0.75rem; }
.tl {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem; align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid var(--glass-line); border-radius: 14px;
  background: var(--glass); backdrop-filter: var(--blur);
  transition: transform 0.35s var(--ease), border-color 0.35s;
}
.tl:hover { transform: translateX(-5px); border-color: rgba(255,188,114,0.42); }
.tl-year {
  font-family: var(--serif); font-size: 1.5rem; color: var(--gold);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.tl-result { font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); margin-bottom: 0.25rem; }
.tl-title { font-size: 0.86rem; font-weight: 600; line-height: 1.3; }
.tl-org { font-size: 0.7rem; color: var(--ink-3); margin-top: 0.15rem; }
.tl-desc { font-size: 0.76rem; color: var(--ink-2); margin-top: 0.4rem; line-height: 1.6; }
.tl-img { width: 74px; height: 74px; border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.tl-img img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }

/* ---- letters ---- */
.letters { display: grid; gap: 0.7rem; }
.letter {
  padding: 1.05rem;
  border: 1px solid var(--glass-line); border-radius: 14px;
  background: var(--glass); backdrop-filter: var(--blur);
  display: grid; gap: 0.9rem;
  transition: transform 0.35s var(--ease), border-color 0.35s;
}
.letter:hover { transform: translateY(-3px); border-color: rgba(255,188,114,0.42); }
.letter-top { display: flex; align-items: center; gap: 0.8rem; }
.letter-ini {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(140deg, var(--gold), var(--gold-2));
  color: #180e04; font-size: 0.76rem; font-weight: 700;
}
.letter-name { font-size: 0.88rem; font-weight: 600; }
.letter-role { font-size: 0.7rem; color: var(--ink-3); line-height: 1.45; margin-top: 0.1rem; }

/* ---- gallery ---- */
.gal {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
  margin-top: 1.2rem;
}
.gal-item {
  aspect-ratio: 1; overflow: hidden; border-radius: 10px;
  border: 1px solid var(--glass-line);
  position: relative;
}
.gal-item img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: center 30%;   /* faces, not chests — see .card-img */
  cursor: zoom-in;
  transition: transform 0.7s var(--ease);
}
.gal-item:hover img { transform: scale(1.1); }
.gal-item figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0.5rem; font-size: 0.62rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
}
.foot { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--glass-line); text-align: center; }
.foot p { font-size: 0.76rem; color: var(--ink-2); }
.foot-sub { font-size: 0.68rem; color: var(--ink-3); margin-top: 0.3rem; }

/* ============================================================
   OVERLAYS
   ============================================================ */
.pdf-overlay, .lightbox {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: center;
  background: rgba(4, 7, 14, 0.9);
  backdrop-filter: blur(14px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s;
  padding: clamp(0.75rem, 3vw, 2rem);
}
.pdf-overlay.on, .lightbox.on { opacity: 1; visibility: visible; }

.pdf-panel {
  width: min(880px, 100%); height: min(90dvh, 100%);
  display: flex; flex-direction: column;
  border: 1px solid var(--glass-line); border-radius: 14px;
  background: #10141f; overflow: hidden;
}
.pdf-head {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--glass-line);
}
.pdf-title { font-size: 0.84rem; font-weight: 600; flex: 1; }
.pdf-pages { font-size: 0.66rem; color: var(--ink-3); }
.pdf-close, .lightbox-close {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--glass-line);
  color: var(--ink-2); font-size: 0.8rem;
  transition: background 0.25s, color 0.25s;
}
.pdf-close:hover, .lightbox-close:hover { background: var(--gold); color: #150d04; }
.pdf-body { flex: 1; overflow-y: auto; padding: 1rem; background: #0a0d15; }
#pdf-canvases { display: grid; gap: 1rem; }
.pdf-canvas { border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); background: #fff; }
.pdf-loading { display: grid; place-items: center; gap: 0.8rem; padding: 3rem 0; color: var(--ink-3); font-size: 0.8rem; }
.pdf-err { text-align: center; color: #ff8c8c; font-size: 0.82rem; line-height: 1.7; }
.pdf-err a { color: var(--gold); text-decoration: underline; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.14);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.lightbox-close { position: absolute; top: 1.2rem; right: 1.2rem; z-index: 2; }
.lightbox img {
  max-width: 100%; max-height: 86dvh;
  object-fit: contain; border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.7);
}
.lightbox-cap {
  position: absolute; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  font-size: 0.74rem; color: var(--ink-2);
}

.noscript {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; gap: 1rem;
  padding: 2rem; text-align: center; background: var(--sky-deep);
}
body.no-webgl .panel { position: relative; opacity: 1 !important; visibility: visible !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  :root { --panel-w: min(48ch, 54vw); }
  .panel--wide .panel-inner { width: min(52ch, 60vw); }
}

@media (max-width: 860px) {
  .nav {
    position: fixed; inset: 0;
    background: rgba(8,12,22,0.96);
    backdrop-filter: blur(20px);
    display: grid; place-items: center;
    opacity: 0; visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s;
  }
  body.nav-open .nav { opacity: 1; visibility: visible; }
  .nav ul { flex-direction: column; gap: 0.4rem; text-align: center; }
  .nav a { font-size: 1rem; padding: 0.6rem 1.4rem; }
  .nav-toggle { display: block; z-index: 2; position: relative; }
  .brand-text { display: none; }

  /* one column: copy sits low, aircraft keeps the top of frame */
  :root { --panel-w: 100%; }
  .panel {
    align-items: flex-end;
    padding: 4.5rem 1.25rem 3.5rem;
  }
  .panel--left, .panel--right, .panel--center { justify-content: center; }
  .panel-inner,
  .panel--wide .panel-inner,
  .panel--center .panel-inner,
  .panel--gallery .panel-inner { width: 100%; max-height: 68dvh; }

  /* Cards carry Royden's full reflections — nothing is truncated, so on a
     narrow screen the text has to shrink and the card scrolls internally
     rather than losing words. */
  .card { flex-basis: 78vw; }
  .card-text { font-size: 0.74rem; line-height: 1.55; }
  .card-img { aspect-ratio: 16 / 9; }
  .card-body { padding: 0.8rem 0.85rem 0.95rem; }

  .panel--left::before, .panel--right::before {
    width: 100%; left: 0; right: 0; top: auto; bottom: 0; height: 78%;
    background: linear-gradient(0deg, rgba(6,10,20,0.9) 0%, rgba(6,10,20,0.6) 50%, transparent 100%);
  }
  /* hero copy stacks under the window rather than across it */
  .panel--hero { align-items: flex-end; }
  .panel--hero .panel-inner { width: 100%; }
  .hero-name { font-size: clamp(2.2rem, 11vw, 3.2rem); }
  .hero-scroll { margin-top: 1.6rem; }

  .hud { display: none; }
  .stats { gap: 1.4rem; }
  .gal { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .tl { grid-template-columns: auto 1fr; }
  .tl-img { display: none; }
}

@media (max-width: 520px) {
  .plane-switch span:last-child { display: none; }
  .plane-switch { padding: 0.42rem 0.55rem; }
  .about-photo { width: 100px; height: 100px; }
}
