/* ══════════════════════════════════════════════════════════════
   about.css — About page: tabs, story timeline
   Loaded AFTER the page's inline styles so its overrides win.

   Sections:
     1. Tab bar (in-flow, under hero)
     2. Floating tab dock (fixed, bottom-center)
     3. My Story — "The Descent" timeline (globe lives in about.html's
        inline <style>, appended after the timeline)
     4. Responsive
     5. Reduced motion
     6. xl/4K (kept last — source order decides)
   ══════════════════════════════════════════════════════════════ */

/* ── 1. TAB BAR ─────────────────────────────────────────────── */
.about-tabs {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: clamp(var(--space-8), 6vw, var(--space-16));
  padding: var(--space-8) var(--gutter) var(--space-10);
}

.about-tab {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--text-fluid-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-snug);
  color: var(--color-text-secondary);
  padding: var(--space-2) var(--space-1);
  transition: color var(--duration-base) var(--ease-out);
}

.about-tab:hover,
.about-tab:focus-visible { color: var(--color-text-primary); }
.about-tab:focus-visible {
  outline: 1px solid var(--color-accent);
  outline-offset: 6px;
  border-radius: var(--radius-sm);
}
.about-tab[aria-selected="true"],
.about-tab[aria-current="true"] { color: var(--color-text-primary); }

/* 44px underline under the active tab (both selected + current states) */
.about-tab::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(-1 * var(--space-2));
  width: 44px;
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  box-shadow: 0 0 12px rgba(var(--color-accent-rgb), 0.55);
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  transition: transform var(--duration-base) var(--ease-out);
}
.about-tab[aria-selected="true"]::after,
.about-tab[aria-current="true"]::after { transform: translateX(-50%) scaleX(1); }

/* ── 2. STICKY TOP TAB BAR ──────────────────────────────────── */
/* Full-width frosted bar that slides in once the in-flow tab bar
   scrolls off the top. It reacts to the shared nav's own class:
   while the nav is visible the bar sits just below it; when the nav
   auto-hides on scroll-down the bar rises to the very top. */
.tab-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: var(--space-3) var(--gutter);
  background: rgba(10, 10, 10, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s var(--ease-out), opacity 0.3s var(--ease-out), top 0.4s var(--ease-out);
}
.tab-topbar.is-stuck {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
/* Drop below the nav whenever the nav is on screen; --nav-h matches the
   nav's own height (space-6 block padding + label line). */
.nav:not(.is-scrolled) ~ .tab-topbar.is-stuck { top: var(--nav-h, 72px); }
.nav.is-scrolled ~ .tab-topbar.is-stuck { top: 0; }

.tab-topbar-inner {
  display: flex;
  justify-content: center;
  gap: clamp(var(--space-6), 5vw, var(--space-12));
}
.tab-topbar .about-tab { font-size: var(--text-fluid-base); }
.tab-topbar .about-tab::after { bottom: calc(-1 * var(--space-1)); }

/* ── 3. MY STORY — THE DESCENT ──────────────────────────────── */
.story {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-10) var(--gutter) var(--space-24);
  /* the water deepens as you scroll */
  background: linear-gradient(180deg,
    rgba(var(--color-bg-deep-rgb), 0) 0%,
    rgba(2, 12, 16, 0.55) 55%,
    rgba(var(--color-bg-deep-rgb), 0) 100%);
}

/* Personal statement — opens the tab above the descent timeline.
   Avatar blob on the left, statement on the right; spans the full
   timeline width with generous room above and below. */
.story-intro {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(var(--space-20), 13vh, var(--space-32)) 0;
  display: flex;
  align-items: center;
  gap: clamp(var(--space-8), 5vw, var(--space-16));
}
.story-intro-text { flex: 1 1 auto; min-width: 0; }
.story-intro-eyebrow {
  font-size: var(--text-fluid-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-6);
}
.story-intro-lead {
  font-size: var(--text-fluid-xl);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: 1.32;
  color: var(--color-text-primary);
  max-width: none;          /* fills the full component width */
  text-wrap: pretty;
}
.story-intro-lead p + p { margin-top: var(--space-6); }
/* Each word is wrapped by about.js so it can reveal independently */
.story-intro-lead .story-word {
  display: inline-block;
  will-change: filter;
}

/* ── Avatar blob — mirrors the hero avatar in index.html ─────
   about.js drives the wrapper transform (entrance + cursor tilt/float)
   and the inner blob's morphing border-radius each frame. */
.story-avatar-wrap {
  flex: 0 0 auto;
  position: relative;      /* badge anchor */
  opacity: 0;              /* JS entrance drives this */
  will-change: transform, opacity;
}
.story-avatar {
  width: clamp(220px, 24vw, 340px);
  height: clamp(264px, 29vw, 408px);
  border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  overflow: hidden;
  will-change: border-radius;
  background: var(--color-surface);
}
.story-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;   /* keep faces in frame */
  display: block;
  pointer-events: none;
  user-select: none;
}

/* Intro-video badge — teal play circle at the blob's bottom edge */
.avatar-badge {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  z-index: 10;
  opacity: 0;
  scale: 0;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(10, 10, 10, 0.8);
  transition: box-shadow 0.2s ease;
}
/* pop + float once the avatar scrolls into view (class set by about.js) */
.story-avatar-wrap.is-revealed .avatar-badge {
  animation:
    badge-pop   0.6s var(--ease-spring-bounce) 0.15s forwards,
    badge-float 4s   ease-in-out               0.75s infinite;
}
.avatar-badge:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(10, 10, 10, 0.8),
              0 0 20px rgba(var(--color-accent-rgb), 0.3);
}
.avatar-badge:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}
.badge-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  /* play triangle is optically left-heavy — nudge right to true-center */
  padding-left: 2px;
  animation: play-nudge 3s ease-in-out 4s infinite;
}
.badge-icon svg { width: 22px; height: 22px; fill: var(--color-bg); }
.badge-label {
  font-size: 9px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-bg);
  line-height: 1;
}

@keyframes badge-pop {
  to { opacity: 1; scale: 1; }
}
@keyframes badge-float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(-7px); }
}
@keyframes play-nudge {
  0%, 100% { transform: scale(1); }
  5%       { transform: scale(1.18); }
  9%       { transform: scale(0.94); }
  12%      { transform: scale(1.08); }
  15%      { transform: scale(0.98); }
  18%      { transform: scale(1); }
}

/* ── Intro video modal — ported from index.html ─────────────── */
.video-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.video-modal-overlay.is-open { opacity: 1; visibility: visible; }
.video-modal {
  position: relative;
  width: min(90vw, 960px);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: #000;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  transform: scale(0.92) translateY(24px);
  transition: transform 0.4s var(--ease-spring-bounce);
}
.video-modal-overlay.is-open .video-modal { transform: scale(1) translateY(0); }
.video-modal video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-modal-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.video-modal-placeholder svg { width: 56px; height: 56px; fill: rgba(255, 255, 255, 0.15); }
.video-modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  /* 44px: opening the modal freezes page scroll, so the only way out on touch
     must clear the minimum touch target */
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 2;
  backdrop-filter: blur(8px);
}
.video-modal-close:hover { background: rgba(255, 255, 255, 0.2); }

.story-flow {
  --rail-x: 12px; /* mobile: rail hugs the left edge; desktop centers it */
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
}

/* Depth rail: a white helix (two crossing strands) drawn on scroll, with
   a traveling node at the drawn tip. The rail is wider than a line so the
   sine sway has room; --rail-amp is the horizontal amplitude. */
.story-rail {
  --rail-amp: 11px;
  position: absolute;
  top: var(--space-2);
  bottom: var(--space-2);
  left: var(--rail-x);
  width: calc(var(--rail-amp) * 2 + 12px);
  transform: translateX(-50%);
  pointer-events: none;
}
/* Inner wrapper holds the strands + traveling node. The helix shape is
   the sine geometry itself (no ambient drift) so the chapter anchors,
   which about.js positions onto the exact curve, always sit on the line. */
.story-rail-inner {
  position: absolute;
  inset: 0;
}
.story-rail-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
}
.story-rail-svg .rail-track {
  stroke: rgba(255, 255, 255, 0.09);
  stroke-width: 2;
  stroke-linecap: round;
}
/* Subtle dark-gray second strand, phase-offset so it braids the primary */
.story-rail-svg .rail-ghost {
  stroke: rgba(150, 150, 150, 0.38);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.story-rail-svg .rail-fill {
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linecap: round;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.45));
}
.story-rail-node {
  position: absolute;
  top: 0;
  left: 0;
  width: 7.5px;   /* 75% of the former 10px tip */
  height: 7.5px;
  margin: -3.75px 0 0 -3.75px;
  border-radius: var(--radius-full);
  background: #ffffff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.85),
              0 0 30px rgba(255, 255, 255, 0.35);
}

.story-chapters {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: clamp(var(--space-20), 12vh, var(--space-32));
}

.story-chapter { position: relative; }

/* Chapter node: dim ring that lights up as the descent reaches it.
   about.js sets `top` (centered on the header's first line) and
   `--node-dx` (the horizontal offset that lands it on the helix curve),
   so the white line always runs through the dot. */
.chapter-node {
  position: absolute;
  top: 6px;
  left: var(--rail-x);
  width: 14px;
  height: 14px;
  transform: translate(calc(-50% + var(--node-dx, 0px)), -50%);
  border-radius: var(--radius-full);
  background: var(--color-bg-deep, #010608);
  border: 2px solid rgba(255, 255, 255, 0.18);
  transition: background 0.5s var(--ease-out),
              border-color 0.5s var(--ease-out),
              box-shadow 0.5s var(--ease-out);
}
.story-chapter.is-lit .chapter-node {
  background: #ffffff;
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.7),
              0 0 36px rgba(255, 255, 255, 0.25);
}

.chapter-era {
  font-size: var(--text-fluid-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-3);
}

.chapter-title {
  font-size: var(--text-fluid-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  line-height: 1.05;
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
  text-wrap: balance;
}

.chapter-copy {
  font-size: var(--text-fluid-base);
  line-height: var(--leading-relaxed);
  letter-spacing: var(--tracking-snug);
  color: var(--color-text-mid);
  max-width: 46ch;
}

/* Inline links in chapter copy — same treatment as .statement-sub a on
   index.html: brighter than the surrounding text, underlined, accent on
   hover. Kept identical so a link reads the same wherever it appears. */
.chapter-copy a {
  color: var(--color-text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--duration-fast) var(--ease-out);
}

.chapter-copy a:hover { color: var(--color-accent); }

/* Perspective on the figure so its .chapter-figure child can tilt in 3D
   toward the cursor. about.js drives the tilt on .chapter-figure and the
   lift on .chapter-text; both get will-change while the pointer is near. */
.chapter-media figure { perspective: 1100px; }
.chapter-figure {
  position: relative;
  /* slides fill this now — the figure, not the img, sets the height */
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--color-surface);
  transform-style: preserve-3d;
}
.story-chapter.is-near .chapter-figure,
.story-chapter.is-near .chapter-text { will-change: transform; }

/* ── Chapter carousel — stacked, crossfaded image tiles ─────── */
/* Slides sit on top of each other; only .is-active is opaque. */
.carousel-slide {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* slight overscale gives the scrub parallax room to move */
  scale: 1.12;
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-out);
}
.carousel-slide.is-active { opacity: 1; }
/* Inactive slides sit in the same box (position:absolute; inset:0) and,
   opacity aside, still paint in front of the active one — so without this
   they silently swallow clicks/taps meant for the visible slide (e.g. the
   live content editor always hitting the first slide instead of the one
   actually shown). */
.carousel-slide:not(.is-active) { pointer-events: none; }

/* Prev / next arrows — subtle; float above the tile in its 3D space.
   Hidden until the card is hovered or focused (always shown on touch). */
.carousel-arrow {
  position: absolute;
  top: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(6, 12, 14, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--color-text-primary);
  cursor: pointer;
  /* translateZ lifts them clear of the images within preserve-3d */
  transform: translateY(-50%) translateZ(30px);
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-out),
              background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}
.carousel-arrow--prev { left: var(--space-3); }
.carousel-arrow--next { right: var(--space-3); }
.carousel-arrow svg { width: 18px; height: 18px; }
.carousel-arrow:hover {
  background: rgba(14, 22, 24, 0.85);
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.chapter-carousel:hover .carousel-arrow,
.carousel-arrow:focus-visible { opacity: 1; }
.carousel-arrow:focus-visible {
  outline: 1px solid var(--color-accent);
  outline-offset: 3px;
}
/* Touch devices have no hover — keep the arrows softly visible */
@media (hover: none) {
  .carousel-arrow { opacity: 0.9; }
}
/* A carousel down to one surviving slide (e.g. after removing photos in
   the live editor) has nothing left to page through — hide the arrows
   rather than leave dead controls on screen. */
.chapter-carousel.is-single .carousel-arrow { display: none; }

/* Pagination dots — centered below the card. The active image is an
   elongated teal pill; the rest are small translucent dots. */
.carousel-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.carousel-seg {
  width: 6.3px;
  height: 6.3px;
  padding: 0;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: width var(--duration-base) var(--ease-out),
              background var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}
.carousel-seg:hover { background: rgba(255, 255, 255, 0.85); }
.carousel-seg.is-active {
  width: 19.8px;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}
.carousel-seg:focus-visible {
  outline: 1px solid var(--color-accent);
  outline-offset: 3px;
}
/* Matching hide for the pagination dots when only one slide remains. */
.carousel-bar.is-single { display: none; }

/* Finale: a normal rail chapter (so the line reaches its anchor), just
   with a permanently breathing white terminus node and extra room below
   it before the globe closes out the story. */
.story-chapter--now { padding-bottom: var(--space-16); }
.story-chapter--now .chapter-node {
  background: #ffffff;
  border-color: transparent;
  animation: node-breathe 4s var(--ease-in-out) infinite;
}

@keyframes node-breathe {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 255, 255, 0.5), 0 0 28px rgba(255, 255, 255, 0.18); }
  50%      { box-shadow: 0 0 20px rgba(255, 255, 255, 0.9), 0 0 52px rgba(255, 255, 255, 0.4); }
}

/* ── 4. RESPONSIVE ──────────────────────────────────────────── */

/* Mobile: single column, rail on the left, media under text */
.story-chapter .chapter-text,
.story-chapter .chapter-media { padding-left: calc(var(--space-10) + 4px); }
.story-chapter .chapter-media { margin-top: var(--space-6); }

/* Desktop: text left, media right — same orientation for every chapter, so
   the eye keeps one reading line down the descent instead of zig-zagging */
@media (min-width: 768px) {
  .story-flow { --rail-x: 50%; }

  .story-chapter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(64px, 9vw, 128px) minmax(0, 1fr);
    align-items: center;
  }
  .story-chapter .chapter-text,
  .story-chapter .chapter-media {
    padding-left: 0;
    margin-top: 0;
  }
  /* node `top` is set by about.js (header first-line center); the
     transform (with --node-dx) is inherited from the base rule */

  .story-chapter .chapter-text {
    grid-column: 1;
    grid-row: 1;
    text-align: right;      /* copy hugs the rail rather than drifting off it */
  }
  .story-chapter .chapter-text .chapter-copy { margin-left: auto; }
  .story-chapter .chapter-media { grid-column: 3; grid-row: 1; }
}

@media (max-width: 767px) {
  /* Stack the avatar above the statement */
  .story-intro {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-12);
  }
  .story-avatar-wrap { align-self: center; }
}

/* ── 5. REDUCED MOTION ──────────────────────────────────────── */
/* buildRail() still draws the static white helix (no scroll scrub); here
   we kill the ambient sway, hide the traveling node, and light every
   chapter node so the whole rail reads as complete and calm. */
@media (prefers-reduced-motion: reduce) {
  .story-rail-inner { animation: none; transform: none; }
  .story-rail-node { display: none; }
  .story-chapter .chapter-node {
    background: #ffffff;
    border-color: transparent;
  }
  .story-chapter--now .chapter-node { animation: none; }
  .tab-topbar { transition: none; }

  /* Avatar: visible and still — no morph, tilt, float, or badge motion */
  .story-avatar-wrap { opacity: 1; transform: none; }
  .story-avatar { border-radius: var(--radius-2xl); }
  .story-avatar-wrap .avatar-badge {
    opacity: 1;
    scale: 1;
    animation: none;
  }
  .badge-icon { animation: none; }
  .video-modal-overlay,
  .video-modal { transition: none; }
}

/* ── 6. XL / 4K ─────────────────────────────────────────────── */
@media (min-width: 2000px) {
  .story-flow { max-width: 1280px; }
}
