/* ============================================================
   PEPEHA OF PRACTICE, style.css
   A cinematic, personal narrative site.
   Dark mode. Deep blues, purples, soft blacks.
   The forcefield is the central visual metaphor.
   ============================================================ */


/* ─── Custom Properties ──────────────────────────────────── */

:root {
  /* Backgrounds - Warmer, more tactile dark mode */
  --bg-void:    #121110;
  --bg-deep:    #181715;
  --bg-dark:    #1c1a18;
  --bg-mid:     #24221f;
  --bg-surface: #2c2a26;

  /* Glassmorphism / Paper */
  --glass:         rgba(255, 250, 240, 0.03);
  --glass-mid:     rgba(255, 250, 240, 0.06);
  --glass-border:  rgba(255, 250, 240, 0.08);

  /* Text */
  --text-primary:   #f0ece1;
  --text-secondary: #b5b0a1;
  --text-muted:     #7a766c;
  --text-accent:    #e0d8c3;

  /* Accent colours - Retro sci-fi / scrapbook */
  --blue:         #5eb3f9;
  --blue-soft:    rgba(94, 179, 249, 0.7);
  --purple:       #b07bf7;
  --purple-soft:  rgba(176, 123, 247, 0.7);
  --teal:         #4ade80; /* more of a retro terminal green */
  --teal-soft:    rgba(74, 222, 128, 0.7);
  --amber:        #fbbf24; /* retro amber */

  /* Glows */
  --glow-blue:   rgba(94, 179, 249, 0.15);
  --glow-purple: rgba(176, 123, 247, 0.15);
  --glow-teal:   rgba(74, 222, 128, 0.12);
  --glow-amber:  rgba(251, 191, 36, 0.15);

  /* Forcefield colours */
  --ff-fill:   rgba(222, 74, 74, 0.05);
  --ff-border: rgba(222, 74, 74, 0.6);
  --ff-glow:   rgba(222, 74, 74, 0.2);
  --ff-scan:   rgba(222, 74, 74, 0.04);

  /* Typography */
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-body:    'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono:    'Courier Prime', 'Courier New', monospace;

  /* Spacing */
  --section-pad:   clamp(80px, 12vw, 160px);
  --content-max:   680px;
  --content-wide:  1080px;
  --gutter:        clamp(24px, 5vw, 80px);

  /* Transitions */
  --ease:       cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:    cubic-bezier(0.4, 0, 1, 1);
}


/* ─── Reset & Base ───────────────────────────────────────── */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Subtle noise overlay, makes the backgrounds feel less clinical */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

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

button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

ul { list-style: none; }

a {
  color: var(--blue);
  text-decoration: none;
}

::selection {
  background-color: rgba(74, 158, 255, 0.25);
  color: var(--text-primary);
}


/* ─── Typography ─────────────────────────────────────────── */

.chapter__title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.8rem, 6vw, 5.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.chapter__text-block p {
  font-size: clamp(1.05rem, 1.8vw, 1.15rem);
  line-height: 1.95;
  color: var(--text-secondary);
  max-width: var(--content-max);
  margin-bottom: 1.5em;
}

.chapter__text-block p:last-child { margin-bottom: 0; }

.chapter__text-block p em {
  color: inherit;
  font-style: italic;
}

.chapter__text-block p strong {
  color: var(--text-primary);
  font-weight: 500;
}

.chapter__label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--amber);
  margin-bottom: 1.2rem;
  padding: 4px 8px;
  border: 1px dashed rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.05);
  transform: rotate(-1deg);
}

.chapter__anchor-line {
  color: var(--text-primary) !important;
  font-weight: 400;
  font-style: italic;
}

/* ─── Personal Voice Styles ──────────────────────────────── */

/* Parenthetical aside, "Don't worry, this is very pertinent..." */
/* Feels like a marginal note or whispered aside */
.aside-parenthetical {
  display: block;
  font-family: 'Courier Prime', monospace;
  font-size: 0.85rem;
  color: var(--amber);
  padding: 0.6rem 1rem 0.6rem 1.25rem;
  border-left: 2px dashed rgba(251, 191, 36, 0.4);
  margin-top: 0.5em !important;
  margin-bottom: 0 !important;
  max-width: 520px;
  transform: rotate(-1deg);
}

/* Standalone one-liner moment, "That was where developer Andrew started." */
/* Key declarative beats that need their own space to land */
.standalone-moment {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.8vw, 1.8rem);
  font-style: italic;
  font-weight: 600;
  color: var(--teal) !important;
  margin-top: 1.25em !important;
  margin-bottom: 0 !important;
  opacity: 0.9;
}

/* "Yucky.", a throwaway that needs to land as a beat */
.standalone-yucky {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-style: italic;
  color: #84cc16 !important; /* gross green */
  margin-top: 0.25em !important;
  margin-bottom: 0.25em !important;
  padding-left: 1.5rem;
  transform: rotate(-2deg);
  display: inline-block;
  text-shadow: 0 0 10px rgba(132, 204, 22, 0.4);
}


/* ─── Chapter Navigation (Removed) ───────────────────────── */


/* ─── Hero ───────────────────────────────────────────────── */

.hero {
  position: relative;
  width: 100%;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-void);
}

/* Particle canvas sits behind everything */
.hero__particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Memory fragments container */
.hero__memories {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

/* Individual floating memory fragment */
.memory-fragment {
  position: absolute;
  left: var(--frag-x, 20%);
  top: var(--frag-y, 20%);
  width: var(--frag-width, clamp(120px, 16vw, 240px));
  max-width: 28vw;
  border-radius: 2px;
  overflow: hidden;
  will-change: transform;
  background: #fdfbf7;
  padding: 8px 8px 32px 8px;
  box-shadow: 2px 8px 24px rgba(0, 0, 0, 0.5);
  /* opacity and filter set dynamically by JS based on data-depth */
}

.memory-fragment img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border: 1px solid rgba(0,0,0,0.2);
  filter: sepia(0.4) contrast(1.2);
}

/* Photo-edge styling: thin glowing border */
.memory-fragment::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

/* Gradient overlays to keep hero text readable */
.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    radial-gradient(ellipse 60% 70% at 50% 50%, rgba(4, 6, 15, 0.7) 0%, transparent 100%),
    linear-gradient(to bottom, rgba(4, 6, 15, 0.5) 0%, rgba(4, 6, 15, 0.2) 40%, rgba(4, 6, 15, 0.6) 100%);
  pointer-events: none;
}

/* Main hero text block */
.hero__content {
  position: relative;
  z-index: 4;
  text-align: center;
  padding: 0 var(--gutter);
  max-width: 900px;
}

.hero__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-out) 0.3s forwards;
}

/* The main "Hey, I'm Andrew." heading */
.hero__title {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: clamp(2.5rem, 7vw, 6rem);
  line-height: 1.1;
  color: var(--teal);
  margin-bottom: 2rem;
  min-height: 2.2em; /* prevent layout shift during typing */
  text-shadow: 0 0 16px var(--glow-teal);
}

#typing-text {
  white-space: pre-line;
}

/* Blinking typing cursor - Retro Block */
.typing-cursor {
  display: inline-block;
  width: 0.5em;
  height: 0.85em;
  background: var(--amber);
  vertical-align: middle;
  margin-left: 6px;
  box-shadow: 0 0 12px var(--glow-amber);
  animation: cursorBlink 1s step-end infinite;
  opacity: 0;
}

.typing-cursor.visible { opacity: 1; }
.typing-cursor.done { animation: none; opacity: 0; }

/* Hero subtitle */
.hero__subtitle {
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  font-weight: 300;
  line-height: 1.8;
  max-width: 600px;
  margin: 0 auto 3rem;
  opacity: 0;
}

.hero__subtitle.visible {
  animation: fadeUp 0.9s var(--ease-out) forwards;
}

/* Scroll to begin hint */
.hero__scroll-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
}

.hero__scroll-hint.visible {
  animation: fadeIn 0.8s var(--ease-out) forwards;
}

.scroll-hint__text {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.scroll-hint__arrow {
  width: 2px;
  height: 40px;
  background: repeating-linear-gradient(
    to bottom,
    var(--amber) 0,
    var(--amber) 4px,
    transparent 4px,
    transparent 8px
  );
  animation: scrollPulse 2s ease-in-out infinite;
}

/* Hide line break on wider screens */
@media (min-width: 600px) {
  .hero__subtitle-break { display: none; }
}


/* ─── Chapter: General ───────────────────────────────────── */

.chapter {
  position: relative;
  padding: var(--section-pad) var(--gutter);
  background: var(--bg-deep);
}

/* Alternating subtle background variation */
.chapter:nth-child(even) { background: var(--bg-dark); }

.chapter__inner {
  max-width: var(--content-wide);
  margin: 0 auto;
}

.chapter__header {
  margin-bottom: clamp(48px, 6vw, 96px);
}

.chapter__content {
  display: flex;
  flex-direction: column;
  gap: clamp(40px, 5vw, 72px);
}

.chapter__text-block {
  max-width: var(--content-max);
}


/* ─── Reveal on Scroll ───────────────────────────────────── */

.reveal-item {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.75s var(--ease-out),
    transform 0.75s var(--ease-out);
}

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


/* ─── Pull Quotes ────────────────────────────────────────── */

.pull-quote {
  position: relative;
  max-width: 640px;
  padding: 1.25rem 0 1.25rem 2rem;
  border-left: 1px solid rgba(74, 158, 255, 0.3);
  background: transparent;
}

.pull-quote p {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.8vw, 1.85rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1.55;
  color: rgba(221, 230, 245, 0.85);
  margin: 0;
}

.pull-quote cite {
  display: block;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-style: normal;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

/* Quiet variant, grief section. Stripped back. */
.pull-quote--quiet {
  border-left-color: rgba(255, 255, 255, 0.1);
  padding-left: 1.5rem;
}

.pull-quote--quiet p {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  color: rgba(221, 230, 245, 0.7);
}

/* Bright variant, rediscovery section */
.pull-quote--bright {
  border-left-color: rgba(139, 92, 246, 0.4);
  max-width: 680px;
}

.pull-quote--bright p {
  font-size: clamp(1.3rem, 2.8vw, 1.9rem);
  color: rgba(221, 230, 245, 0.9);
}

/* Final quote, the closing statement. Most prominent. */
.pull-quote--final {
  max-width: 680px;
  border-left-color: rgba(74, 158, 255, 0.45);
  padding-left: 2rem;
}

.pull-quote--final p {
  font-size: clamp(1.2rem, 2.3vw, 1.65rem);
  color: var(--text-primary);
  opacity: 0.92;
  line-height: 1.65;
}


/* ─── Image Slots (Scrapbook/Polaroid Style) ─────────────── */

.chapter__image-slot {
  position: relative;
  max-width: 600px;
  background: #fdfbf7;
  padding: 12px 12px 48px 12px;
  border-radius: 2px;
  box-shadow: 2px 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0,0,0,0.1);
  transform: rotate(-1.5deg);
  transition: transform 0.4s var(--ease-out);
}

.chapter__image-slot:nth-child(even) {
  transform: rotate(2deg);
}

.chapter__image-slot:hover {
  transform: rotate(0deg) scale(1.02);
  z-index: 10;
}

/* Masking tape effect */
.chapter__image-slot::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  width: 120px;
  height: 28px;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  backdrop-filter: blur(2px);
  z-index: 2;
}

.chapter__image-slot img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid rgba(0,0,0,0.1);
  filter: sepia(0.3) contrast(1.1) brightness(0.9);
}

.chapter__image-slot--small {
  max-width: 420px;
}

.chapter__image-gallery {
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  width: min(100%, 960px);
}

.chapter__image-gallery--pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.chapter__image-gallery--pair .chapter__image-slot {
  padding-bottom: 64px;
}

.image-slot__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  text-align: center;
  font-family: 'Courier Prime', monospace;
  font-size: 0.8rem;
  line-height: 1.3;
  color: #333;
}

.image-slot__caption a {
  color: #005a9c;
  font-weight: 700;
  text-decoration: underline;
}


/* ─── Chapter: Forcefield ────────────────────────────────── */

.chapter--forcefield {
  background: var(--bg-deep);
  overflow: hidden;
}

/* The forcefield visual, retro glitchy barrier */
.forcefield-panel {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 140px;
  border: 2px dashed var(--ff-border);
  background: var(--ff-fill);
  box-shadow: 0 0 20px var(--ff-glow), inset 0 0 20px var(--ff-fill);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.forcefield-panel::before {
  content: 'WARNING: HAZARD TEAM ONLY';
  font-family: 'Courier Prime', monospace;
  color: var(--ff-border);
  opacity: 0.5;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
}

.forcefield-panel__glass {
  display: none; /* Removed generic glass */
}

.forcefield-panel__edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--ff-border);
  box-shadow: 0 0 16px var(--ff-border);
}

.forcefield-panel__edge--left  { left: -2px; }
.forcefield-panel__edge--right { right: -2px; }

/* Horizontal scanlines across the forcefield */
.forcefield-panel__scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 4px,
    var(--ff-scan) 4px,
    var(--ff-scan) 8px
  );
  animation: scanlineScroll 10s linear infinite;
}

@keyframes scanlineScroll {
  from { background-position: 0 0; }
  to { background-position: 0 100px; }
}

.forcefield-panel__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center,
    var(--ff-glow) 0%,
    transparent 70%);
  pointer-events: none;
}


/* ─── Chapter: Stillness ─────────────────────────────────── */

.chapter--stillness {
  background: var(--bg-void);
}

.chapter--stillness .chapter__title {
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  color: rgba(221, 230, 245, 0.8);
}

.chapter--stillness .chapter__content {
  gap: clamp(48px, 7vw, 96px); /* more breathing room */
}


/* ─── Chapter: Worlds ────────────────────────────────────── */

.chapter--worlds { background: var(--bg-dark); }

/* Assembling world blocks - Sticky Note style */
.world-builder {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  max-width: 600px;
  padding: 20px 0;
}

.world-block {
  padding: 12px 16px;
  background: #fef08a; /* yellow sticky */
  box-shadow: 2px 4px 10px rgba(0,0,0,0.2);
  font-family: 'Courier Prime', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: #333;
  opacity: 0;
  transform: translateY(10px) rotate(calc(var(--rot, -2deg)));
  transition:
    opacity 0.4s var(--ease-out) var(--delay, 0s),
    transform 0.4s var(--ease-out) var(--delay, 0s);
}

.world-block:nth-child(even) {
  background: #bae6fd; /* blue sticky */
  --rot: 3deg;
}

.world-block:nth-child(3n) {
  background: #fbcfe8; /* pink sticky */
  --rot: -4deg;
}

.world-block.revealed {
  opacity: 1;
  transform: translateY(0) rotate(calc(var(--rot, -2deg)));
}

.world-block--accent {
  background: #fca5a5 !important; /* red sticky */
  color: #7f1d1d;
  --rot: 5deg;
  font-size: 1rem;
}


/* ─── Chapter: Tools ─────────────────────────────────────── */

.chapter--tools { background: var(--bg-deep); }


/* ─── Chapter: Music ─────────────────────────────────────── */

.chapter--music { background: var(--bg-dark); }

/* NZ Map container */
.music-map {
  max-width: 320px;
  margin: 0;
}

.nz-map {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* NZ land shapes */
.nz-land {
  transition: fill 0.3s ease;
  fill: rgba(251, 191, 36, 0.05);
  stroke: rgba(251, 191, 36, 0.3);
  stroke-dasharray: 4 4;
}

/* Journey paths, initially hidden (dashoffset set by JS) */
.journey-path {
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  stroke: var(--teal);
  transition: stroke-dashoffset 1.2s var(--ease-out);
}

/* City dots */
.city-dot { transition: opacity 0.4s ease; fill: var(--teal); }
.city-dot--dest { opacity: 0; }

/* Pulsing ring on home city */
.city-pulse {
  transform-origin: 242.6px 245px;
  animation: cityPulse 2.5s ease-out infinite;
  stroke: var(--teal);
}

/* City labels */
.city-label {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  dominant-baseline: middle;
  pointer-events: none;
  fill: var(--amber);
}

.city-label--home {
  font-weight: 500;
}

/* Destination labels start hidden; JS reveals them as paths draw */
.city-label:not(.city-label--home) {
  opacity: 0;
}

.music-map__caption {
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
}


/* ─── Chapter: Loss ──────────────────────────────────────── */

/* Very restrained. Minimal decoration. Let the writing carry it. */
.chapter--loss {
  background: var(--bg-void);
}

.chapter--loss .chapter__title {
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  color: rgba(221, 230, 245, 0.7);
  font-weight: 300;
}

.chapter--loss .chapter__content {
  gap: clamp(56px, 8vw, 104px);
}

.chapter--loss .chapter__text-block p {
  color: rgba(138, 156, 192, 0.75);
}

/* The "But he was there." standalone moment in the loss section */
.chapter--loss .standalone-moment {
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
  color: var(--text-primary) !important;
  margin-top: 1.5em !important;
  padding-top: 0.5em;
}


/* ─── Chapter: Rediscovery ───────────────────────────────── */

.chapter--rediscovery {
  background: var(--bg-dark);
  position: relative;
  overflow: hidden;
}

/* Subtle glow emanating from the top, sense of light returning */
.chapter--rediscovery::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--purple), transparent);
  box-shadow: 0 0 40px 20px var(--glow-purple);
  pointer-events: none;
}


/* ─── Chapter: Future ────────────────────────────────────── */

.chapter--future {
  background: var(--bg-deep);
  position: relative;
  overflow: hidden;
}

/* Three future aspiration paths - Notebook style */
.future-paths {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 600px;
  padding: 20px 0;
}

.future-path {
  padding: 1.5rem 1.5rem 1.5rem 2.5rem;
  border-left: 2px dashed var(--amber);
  background: rgba(251, 191, 36, 0.03);
  position: relative;
  transition: transform 0.3s var(--ease);
}

.future-path:hover {
  transform: translateX(10px);
  background: rgba(251, 191, 36, 0.06);
}

.future-path__glyph {
  position: absolute;
  left: -12px;
  top: 1.5rem;
  font-family: 'Courier Prime', monospace;
  font-size: 1.2rem;
  color: var(--amber);
  background: var(--bg-deep);
  padding: 4px 0;
}

.future-path__title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.future-path__desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Final forcefield, opens/reveals at the end */
.final-forcefield {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 160px;
  overflow: visible;
  border-top: 2px dashed var(--ff-border);
  border-bottom: 2px dashed var(--ff-border);
}

.final-forcefield__panel {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 4px,
    var(--ff-scan) 4px,
    var(--ff-scan) 8px
  );
}

.final-forcefield__edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--ff-border);
  box-shadow: 0 0 20px var(--ff-border);
  transition: transform 2s var(--ease-out);
}

.final-forcefield__edge--left  { left: 0; }
.final-forcefield__edge--right { right: 0; }

.final-forcefield.revealed .final-forcefield__edge--left { transform: translateX(-40px); opacity: 0; }
.final-forcefield.revealed .final-forcefield__edge--right { transform: translateX(40px); opacity: 0; }
.final-forcefield.revealed .final-forcefield__panel { opacity: 0; transition: opacity 1s; }

/* Central beam of light passing through the forcefield */
.final-forcefield__beam {
  position: absolute;
  left: 50%;
  top: -20px;
  bottom: -20px;
  width: 0;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center,
    rgba(251, 191, 36, 0.4) 0%,
    rgba(251, 191, 36, 0.1) 40%,
    transparent 80%);
  transition: width 2s var(--ease-out) 0.5s;
  pointer-events: none;
}

.final-forcefield.revealed .final-forcefield__beam {
  width: 120%;
}

/* The space beyond the forcefield, a soft glow */
.final-forcefield__beyond {
  position: absolute;
  inset: -40px;
  background: radial-gradient(ellipse at center,
    rgba(251, 191, 36, 0.15) 0%,
    transparent 70%);
  opacity: 0;
  transition: opacity 2s var(--ease-out) 1s;
}

.final-forcefield.revealed .final-forcefield__beyond { opacity: 1; }


/* ─── Footer ─────────────────────────────────────────────── */

.site-footer {
  background: var(--bg-void);
  border-top: 1px solid var(--glass-border);
  padding: clamp(48px, 6vw, 80px) var(--gutter);
}

.site-footer__inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-footer__wordmark {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--text-secondary);
}

.site-footer__byline {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}

.site-footer__note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
}

.site-footer__link {
  align-self: center;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--amber);
  border-bottom: 1px dashed rgba(251, 191, 36, 0.45);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.site-footer__link:hover,
.site-footer__link:focus-visible {
  color: var(--text-primary);
  border-color: var(--text-primary);
}


/* ─── Standalone Essay Page ──────────────────────────────── */

.essay-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(94, 179, 249, 0.12), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(251, 191, 36, 0.1), transparent 34rem),
    var(--bg-void);
}

.essay-shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) var(--gutter);
}

.essay-back-link {
  display: inline-flex;
  margin-bottom: clamp(24px, 5vw, 48px);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--amber);
  border-bottom: 1px dashed rgba(251, 191, 36, 0.45);
}

.essay-back-link:hover,
.essay-back-link:focus-visible {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.essay-card {
  position: relative;
  padding: clamp(32px, 7vw, 72px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 250, 240, 0.075), rgba(255, 250, 240, 0.025)),
    rgba(18, 17, 16, 0.82);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.35);
}

.essay-card::before {
  content: '';
  position: absolute;
  inset: 18px;
  border: 1px dashed rgba(251, 191, 36, 0.16);
  border-radius: 20px;
  pointer-events: none;
}

.essay-header,
.essay-content,
.essay-actions {
  position: relative;
  z-index: 1;
}

.essay-header {
  max-width: 680px;
  margin-bottom: clamp(28px, 5vw, 48px);
}

.essay-kicker {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--amber);
  border: 1px dashed rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.05);
  transform: rotate(-1deg);
}

.essay-intro {
  max-width: 620px;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
}

.essay-content {
  max-width: 680px;
  margin: 0 auto;
}

.essay-header h1 {
  margin-bottom: clamp(28px, 5vw, 44px);
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 6.2rem);
  font-weight: 300;
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--text-primary);
}

.essay-content h2 {
  margin: 2.2em 0 0.8em;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.1;
  color: var(--text-primary);
}

.essay-content p {
  margin-bottom: 1.45em;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: clamp(1.24rem, 2vw, 1.46rem);
  font-weight: 300;
  line-height: 1.72;
}

.essay-content p:first-of-type {
  color: var(--text-primary);
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
  line-height: 1.45;
}

.essay-content em {
  color: var(--text-accent);
  font-style: italic;
}

.essay-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.essay-loading,
.essay-error,
.essay-error-detail {
  font-family: var(--font-body) !important;
}

.essay-error {
  color: var(--amber) !important;
}

.essay-error-detail {
  color: var(--text-muted) !important;
}

.essay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: clamp(40px, 7vw, 72px);
  padding-top: clamp(28px, 5vw, 44px);
  border-top: 1px solid var(--glass-border);
}

.essay-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.8rem 1.35rem;
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.08);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-align: center;
  box-shadow: 0 0 32px rgba(251, 191, 36, 0.08);
  transition: transform 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.essay-button:hover,
.essay-button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--text-primary);
  background: rgba(251, 191, 36, 0.13);
  color: var(--text-primary);
}


/* ─── Standalone Photos Page ─────────────────────────────── */

.photos-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 12%, rgba(176, 123, 247, 0.12), transparent 30rem),
    radial-gradient(circle at 86% 24%, rgba(94, 179, 249, 0.1), transparent 32rem),
    radial-gradient(circle at bottom, rgba(251, 191, 36, 0.08), transparent 34rem),
    var(--bg-void);
}

body.lightbox-open {
  overflow: hidden;
}

.photos-shell {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) var(--gutter);
}

.photos-card {
  position: relative;
  padding: clamp(28px, 6vw, 64px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 250, 240, 0.07), rgba(255, 250, 240, 0.02)),
    rgba(18, 17, 16, 0.82);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.35);
}

.photos-card::before {
  content: '';
  position: absolute;
  inset: 18px;
  border: 1px dashed rgba(251, 191, 36, 0.16);
  border-radius: 20px;
  pointer-events: none;
}

.photos-header,
.photos-gallery {
  position: relative;
  z-index: 1;
}

.photos-header {
  max-width: 720px;
  margin-bottom: clamp(32px, 5vw, 56px);
}

.photos-header h1 {
  margin-bottom: clamp(28px, 5vw, 44px);
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 8vw, 7rem);
  font-weight: 300;
  line-height: 0.94;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}

.photos-gallery {
  columns: 3 240px;
  column-gap: clamp(18px, 3vw, 32px);
}

.photo-card {
  position: relative;
  display: inline-block;
  width: 100%;
  margin: 0 0 clamp(18px, 3vw, 32px);
  padding: 12px 12px 74px;
  break-inside: avoid;
  border-radius: 3px;
  background: #fdfbf7;
  box-shadow: 2px 10px 28px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(0, 0, 0, 0.1);
  transform: rotate(var(--tilt));
  transition: transform 0.28s var(--ease-out), box-shadow 0.28s var(--ease-out);
}

.photo-card::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  z-index: 2;
  width: 112px;
  height: 27px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(2px);
  transform: translateX(-50%) rotate(-3deg);
}

.photo-card:hover,
.photo-card:focus-visible {
  z-index: 4;
  box-shadow: 3px 16px 36px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.12);
  outline: none;
  transform: rotate(0deg) translateY(-4px) scale(1.015);
}

.photo-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.5), 3px 16px 36px rgba(0, 0, 0, 0.5);
}

.photo-card img {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  filter: sepia(0.25) contrast(1.08) brightness(0.92);
}

.photo-card__caption {
  position: absolute;
  right: 12px;
  bottom: 10px;
  left: 12px;
  display: grid;
  gap: 4px;
  color: #333;
  text-align: center;
}

.photo-card__caption strong {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-card__caption span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  font-family: var(--font-body);
  font-size: 0.76rem;
  line-height: 1.25;
  color: #555;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 48px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

.photo-lightbox.is-open {
  pointer-events: auto;
  opacity: 1;
}

.photo-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 5, 5, 0.82);
  backdrop-filter: blur(10px);
}

.photo-lightbox__dialog {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  align-items: center;
  gap: clamp(20px, 4vw, 44px);
  width: min(100%, 1080px);
  height: min(86vh, 820px);
  overflow: hidden;
  padding: clamp(18px, 4vw, 34px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255, 250, 240, 0.09), rgba(255, 250, 240, 0.035)),
    rgba(18, 17, 16, 0.96);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.55);
}

.photo-lightbox__figure {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.photo-lightbox__figure img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  padding: 12px;
  box-sizing: border-box;
  object-fit: contain;
  background: #fdfbf7;
  box-shadow: 2px 12px 34px rgba(0, 0, 0, 0.45);
  filter: sepia(0.18) contrast(1.06) brightness(0.94);
}

.photo-lightbox__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  padding: 0.55rem 0.85rem;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 999px;
  background: rgba(18, 17, 16, 0.86);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.photo-lightbox__close:hover,
.photo-lightbox__close:focus-visible {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.photo-lightbox__text {
  align-self: center;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  padding-right: 0.75rem;
}

.photo-lightbox__kicker {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 4px 8px;
  border: 1px dashed rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.05);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.photo-lightbox__text h2 {
  margin-bottom: 1rem;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.035em;
}

.photo-lightbox__text p:last-child {
  color: var(--text-secondary);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.75;
}


/* ─── Keyframe Animations ────────────────────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

@keyframes scrollPulse {
  0%, 100% { transform: scaleY(1);   opacity: 1; }
  50%       { transform: scaleY(0.5); opacity: 0.4; }
}

@keyframes cityPulse {
  0%   { r: 4.5; opacity: 0.6; }
  70%  { r: 14;  opacity: 0; }
  100% { r: 4.5; opacity: 0; }
}


/* ─── Responsive, Tablet ────────────────────────────────── */

@media (max-width: 900px) {
  .hero__title {
    font-size: clamp(2.8rem, 8vw, 5rem);
  }

  .engine-cards { flex-direction: column; }

  .future-paths { grid-template-columns: 1fr; }

  .music-map { max-width: 260px; }

  .photo-lightbox__dialog {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .photo-lightbox__figure {
    height: min(58vh, 560px);
  }

  .photo-lightbox__text {
    max-height: none;
    padding-right: 0;
  }
}


/* ─── Responsive, Mobile ────────────────────────────────── */

@media (max-width: 600px) {
  .hero__title {
    font-size: clamp(2.4rem, 10vw, 3.5rem);
  }

  /* On mobile, show fewer memory fragments, handled by JS adding data-hidden attribute */
  .memory-fragment.mobile-hidden { display: none; }

  .pull-quote {
    padding: 1.5rem 1.5rem;
    border-radius: 0 4px 4px 0;
  }

  .pull-quote p {
    font-size: clamp(1.1rem, 4.5vw, 1.5rem);
  }

  .chapter__image-slot,
  .chapter__image-slot--small {
    max-width: 100%;
  }

  .chapter__image-gallery--pair {
    grid-template-columns: 1fr;
  }

  .world-builder { gap: 8px; }
  .world-block { font-size: 0.65rem; padding: 6px 12px; }

  .forcefield-panel { height: 80px; }
  .final-forcefield { height: 100px; }

  .essay-shell {
    padding-inline: 18px;
  }

  .essay-card {
    padding: 28px 22px;
    border-radius: 20px;
  }

  .essay-card::before {
    inset: 10px;
    border-radius: 14px;
  }

  .essay-content p {
    font-size: 1.16rem;
    line-height: 1.68;
  }

  .essay-actions {
    justify-content: stretch;
  }

  .essay-button {
    width: 100%;
  }

  .photos-shell {
    padding-inline: 18px;
  }

  .photos-card {
    padding: 28px 22px;
    border-radius: 20px;
  }

  .photos-card::before {
    inset: 10px;
    border-radius: 14px;
  }

  .photos-gallery {
    columns: 1;
  }

  .photo-card {
    transform: none;
  }

  .photo-lightbox {
    padding: 12px;
  }

  .photo-lightbox__dialog {
    max-height: 90vh;
    padding: 16px;
    border-radius: 18px;
  }

  .photo-lightbox__figure {
    height: 54vh;
  }

  .photo-lightbox__figure img {
    padding: 8px;
  }
}


/* ─── Reduced Motion ─────────────────────────────────────── */
/* Disables or simplifies all animations for users who prefer it.
   This is an important accessibility feature. */

@media (prefers-reduced-motion: reduce) {

  html { scroll-behavior: auto; }

  /* Remove all transitions and animations */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  /* Memory fragments: no parallax, just static opacity */
  .memory-fragment {
    animation: none !important;
    transform: rotate(var(--frag-rot-static, 0deg)) scale(var(--frag-scale-static, 1)) !important;
  }

  /* Reveal items appear immediately */
  .reveal-item {
    opacity: 1;
    transform: none;
  }

  /* No cursor blink */
  .typing-cursor { animation: none; opacity: 0; }

  /* Scroll hint: no animation */
  .scroll-hint__arrow { animation: none; }

  /* No city pulse */
  .city-pulse { animation: none; }

  /* Static hero labels */
  .hero__label,
  .hero__subtitle,
  .hero__scroll-hint { animation: none; opacity: 1; }

  /* Hero subtitle */
  .hero__subtitle { opacity: 1; }
  .hero__scroll-hint { opacity: 1; }
}
