/* =============================================================
   Cosmic Academic — Dr. Yosef Wolf / TASRI
   All design tokens sourced from DESIGN-cosmic-academic.md.
   ============================================================= */

/* ---------- Tokens ------------------------------------------ */
:root {
  /* Backgrounds */
  --bg-deep: #050A14;
  --bg-surface: #0B1224;
  --bg-card: #111B33;
  --bg-card-hover: #162040;

  /* Text */
  --text-primary: #EDE5D5;
  --text-secondary: rgba(237, 229, 213, 0.88);
  --text-muted: rgba(237, 229, 213, 0.65);

  /* Accents */
  --accent-cosmic: #7BA4D4;
  --accent-cosmic-glow: rgba(123, 164, 212, 0.15);
  --accent-gold: #D4A017;
  --accent-gold-glow: rgba(212, 160, 23, 0.12);

  /* Borders / selection */
  --border: rgba(237, 229, 213, 0.08);
  --border-hover: rgba(237, 229, 213, 0.15);
  --selection: rgba(123, 164, 212, 0.3);

  /* Star colors */
  --star-bright: #FFFFFF;
  --star-dim: rgba(237, 229, 213, 0.4);

  /* Radius */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 16px;
  --r-portal: 20px;

  /* Spacing scale */
  --s-xs: 0.5rem;
  --s-sm: 1rem;
  --s-md: 1.5rem;
  --s-lg: 2rem;
  --s-xl: 3rem;
  --s-2xl: 4rem;
  --s-3xl: 6rem;
  --s-4xl: 8rem;
  --section-gap: 8rem;

  /* Animation */
  --d-fast: 0.3s;
  --d-normal: 0.6s;
  --d-slow: 1.2s;
  --d-reveal: 1.8s;
  --e-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --e-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --e-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Font stacks */
  --ff-display: "Cormorant Garamond", Georgia, serif;
  --ff-body: "Crimson Pro", Georgia, serif;
  --ff-ui: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--ff-body);
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  /* Old-style figures throughout — reads as classical/scholarly */
  font-variant-numeric: oldstyle-nums;
  font-feature-settings: "onum", "kern", "liga";
}

em {
  font-style: italic;
  color: var(--text-primary);
}

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

button {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

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

ul {
  list-style: none;
}

::selection {
  background: var(--selection);
  color: var(--text-primary);
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  padding: 12px 16px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-hover);
  border-radius: var(--r-sm);
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Typography utilities ---------------------------- */
.display {
  font-family: var(--ff-display);
  font-size: clamp(3rem, 6vw, 5.5rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.h1 {
  font-family: var(--ff-display);
  font-size: clamp(3.1rem, 5.5vw, 4.85rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.h2 {
  font-family: var(--ff-display);
  font-size: clamp(2.1rem, 3.6vw, 2.7rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.h3 {
  font-family: var(--ff-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.body-lg {
  font-family: var(--ff-body);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.8;
  color: var(--text-primary);
}

.body-md {
  font-family: var(--ff-body);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--text-primary);
}

/* Card titles: 10% larger than the base h3 */
.video-card__title,
.topic-card__title,
.post-card__title {
  font-size: 1.65rem;
  line-height: 1.3;
}

.label-ui {
  font-family: var(--ff-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  font-variant-numeric: lining-nums;
}

.overline {
  font-family: var(--ff-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-cosmic);
  font-variant-numeric: lining-nums;
}

/* Body paragraphs spacing */
.body-lg + .body-lg,
.body-md + .body-md {
  margin-top: var(--s-md);
}

/* ---------- Container --------------------------------------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.container--narrow {
  max-width: 720px;
}

/* =============================================================
   LANDING ZONE — matches landing-preview.html exactly
   ============================================================= */

/* Star field canvas — fixed, full viewport, behind content
   (TASRI sections sit at z-index 1 and cover it once scrolled past) */
#star-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Center container */
.landing {
  /* Preview-tuned variable overrides — scoped so TASRI sections still
     use the DESIGN.md tokens. The preview uses slightly stronger
     border / glow values for the landing only. */
  --border-hover: rgba(237, 229, 213, 0.18);
  --accent-cosmic-glow: rgba(123, 164, 212, 0.2);
  --accent-gold-glow: rgba(212, 160, 23, 0.2);

  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* No justify-content — content sits at a consistent position via
     padding-top instead of vertically centering, which Chrome and
     Firefox render differently. */
  min-height: 100vh;
  min-height: 100dvh;
  padding: 12vh 2rem 2rem;
  /* Solid bg covers the scroll-movie below until the user scrolls past.
     The starfield canvas lives inside this section so it paints between
     the bg and the content (canvas z-index: 0 in landing's stacking
     context, content z-index: 2). */
  background: var(--bg-deep);
}

/* Landing overline — scoped so it doesn't override generic .overline elsewhere.
   The wrap stays at natural size; the inner span scales, and a pseudo-element
   glow expands and fades behind it. */
.landing > .overline {
  font-family: var(--ff-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  position: relative;
  display: inline-block;
  z-index: 2;
  /* Hidden until JS reveals it (FOUC fix — see .name comment) */
  visibility: hidden;
}

/* Landing content sits above the in-section star canvas (z-index: 0) */
.landing .name-container,
.landing .portals {
  position: relative;
  z-index: 2;
}

.landing > .overline::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(212, 160, 23, 0.25);
  filter: blur(30px);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.overline__text {
  display: inline-block;
  opacity: 0;
  transform: scale(0.4);
  transform-origin: center;
}

.landing > .overline.visible .overline__text {
  animation: overlineBurst 1.2s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.landing > .overline.visible::before {
  animation: overlineGlow 2.2s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes overlineBurst {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes overlineGlow {
  0% {
    width: 40px;
    height: 40px;
    opacity: 1;
  }
  /* End of expansion at 1.2s of total 2.2s = ~54.5% */
  54.5% {
    width: 400px;
    height: 400px;
    opacity: 1;
  }
  100% {
    width: 400px;
    height: 400px;
    opacity: 0;
  }
}

/* Name */
.name-container {
  text-align: center;
  margin-bottom: 0.5rem;
}
.name {
  font-family: var(--ff-display);
  font-weight: 300;
  font-size: clamp(3.5rem, 7vw, 6rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text-primary);
  /* Hide via visibility (not opacity) so the parent doesn't paint at
     all until JS reveals it — prevents FOUC of plain unstyled text.
     JS sets nameEl.style.visibility = 'visible' at entrance start. */
  visibility: hidden;
  /* Never break a word mid-letter on Chrome mobile — combined with the
     per-word inline-block + nowrap wrappers from runLandingEntrance(). */
  word-break: keep-all;
  overflow-wrap: normal;
}
/* Word containers — each word stays together as a unit */
.name .word {
  display: inline-block;
  white-space: nowrap;
}
.name .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(18px);
}
.name .char.animate {
  animation: charReveal 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Subtle line under name */
.name-line {
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-cosmic), transparent);
  margin: 1.25rem auto 0;
  opacity: 0;
  transition: none;
}
.name-line.visible {
  animation: lineExpand 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Portal cards */
.portals {
  display: flex;
  gap: 1.5rem;
  margin-top: 3rem;
  width: 100%;
  max-width: 780px;
}

.portal {
  flex: 1;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: translateY(30px);
  text-decoration: none;
  color: var(--text-primary);
  border: 1px solid var(--border);
  transition: border-color 0.5s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.portal.animate {
  animation: cardReveal 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.portal:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
}

/* Card glow on hover */
.portal::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 0;
  pointer-events: none;
}
.portal:hover::before {
  opacity: 1;
}
.portal--hla::before {
  box-shadow: 0 0 50px var(--accent-gold-glow), inset 0 0 50px rgba(212, 160, 23, 0.03);
}
.portal--tasri::before {
  box-shadow: 0 0 50px var(--accent-cosmic-glow), inset 0 0 50px rgba(123, 164, 212, 0.03);
}

/* Card visual area */
.portal-visual {
  position: relative;
  height: 260px;
  overflow: hidden;
  background: var(--bg-card);
}

/* HLA visual — gold mesh */
.portal--hla .portal-visual {
  background:
    radial-gradient(ellipse at 30% 50%, rgba(212, 160, 23, 0.08) 0%, transparent 70%),
    var(--bg-card);
}
.portal--hla .portal-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 25% 35%, rgba(212, 160, 23, 0.12) 1px, transparent 1px),
    radial-gradient(circle at 65% 55%, rgba(212, 160, 23, 0.10) 1px, transparent 1px),
    radial-gradient(circle at 45% 75%, rgba(212, 160, 23, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 80% 25%, rgba(212, 160, 23, 0.10) 1px, transparent 1px),
    radial-gradient(circle at 15% 65%, rgba(212, 160, 23, 0.06) 1px, transparent 1px);
  background-size: 100% 100%;
}

/* TASRI visual — star cluster */
.portal--tasri .portal-visual {
  background:
    radial-gradient(ellipse at 60% 40%, rgba(123, 164, 212, 0.08) 0%, transparent 70%),
    var(--bg-card);
}

/* Centered logo image — sits above the canvas animations */
.portal-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-height: 200px;
  max-width: 82%;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0.85;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
  /* Lighten blends the asset's white halo / reflection with the dark card,
     suppressing any baked-in glow that would clash on bg-card. */
  mix-blend-mode: lighten;
  filter: drop-shadow(0 0 0 transparent);
}
.portal:hover .portal-logo {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.03);
}

@media (max-width: 680px) {
  .portal-logo { max-height: 140px; }
}

/* Card content area */
.portal-content {
  position: relative;
  z-index: 1;
  padding: 1.75rem 1.75rem 1.5rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.portal-label {
  font-family: var(--ff-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.625rem;
}
.portal--hla .portal-label { color: var(--accent-gold); }
.portal--tasri .portal-label { color: var(--accent-cosmic); }

.portal-title {
  font-family: var(--ff-display);
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.portal-desc {
  font-family: var(--ff-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

/* Animated arrow */
.portal-arrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--ff-ui);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  transition: color 0.3s ease;
}
.portal:hover .portal-arrow {
  color: var(--text-primary);
}
.portal-arrow svg {
  width: 20px;
  height: 20px;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.portal:hover .portal-arrow svg {
  transform: translateX(5px);
}
.portal--hla .portal-arrow svg line,
.portal--hla .portal-arrow svg polyline {
  stroke: var(--accent-gold);
}
.portal--tasri .portal-arrow svg line,
.portal--tasri .portal-arrow svg polyline {
  stroke: var(--accent-cosmic);
}

/* TASRI mini star field in card */
.tasri-stars {
  position: absolute;
  inset: 0;
}

/* Keyframes */
@keyframes charReveal {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes lineExpand {
  0% { width: 0; opacity: 0; }
  30% { opacity: 1; }
  100% { width: min(200px, 40vw); opacity: 0.4; }
}
@keyframes cardReveal {
  to { opacity: 1; transform: translateY(0); }
}

/* Landing responsive — content scrolls naturally past 100vh if needed,
   so the name and overline are always reachable on small phones. */
@media (max-width: 768px) {
  .landing {
    padding: 6vh 1rem 1rem;
  }
  .portals {
    flex-direction: column;
    max-width: 400px;
    margin-top: 1.5rem;
    gap: 0.75rem;
  }
  .portal-visual { height: 80px; }
  .portal-logo  { max-height: 60px; }
  .portal-content { padding: 1rem; }
  .portal-title {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
  }
  .portal-title br { display: none; }
  .portal-desc {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    line-height: 1.5;
  }
  .portal-label {
    margin-bottom: 0.375rem;
  }
}

/* =============================================================
   NAV
   ============================================================= */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(5, 10, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--d-fast) var(--e-out-quart);
}

.nav.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.nav__inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem clamp(1.25rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-lg);
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
  line-height: 0;
}

.nav__logo {
  height: 32px;
  width: auto;
  display: block;
}

.nav__brand-text {
  font-family: var(--ff-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
  white-space: nowrap;
  line-height: 1;
}

@media (max-width: 768px) {
  .nav__brand-text { display: none; }
  .nav__inner {
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }
  .nav__logo { height: 28px; }
  .nav__links {
    gap: 0.75rem;
    flex-wrap: nowrap;
  }
  .nav__link {
    font-size: 0.6rem;
    letter-spacing: 0.04em;
    padding: 4px 0;
  }
}

.nav__links {
  display: flex;
  gap: clamp(0.75rem, 2vw, 1.75rem);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav__link {
  color: var(--text-secondary);
  text-transform: uppercase;
  transition: color var(--d-fast) var(--e-out-quart);
  position: relative;
  padding: 4px 0;
}

.nav__link:hover {
  color: var(--text-primary);
}

.nav__link.is-active {
  color: var(--text-primary);
}

.nav__link.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: var(--accent-cosmic);
}

/* Support nav link breathes a gold glow + soft color shift toward gold —
   bumped aggressive enough to be unmistakable on the dark nav. */
.nav__link--support {
  animation: supportGlow 5s ease-in-out infinite;
  will-change: text-shadow, color;
}

@keyframes supportGlow {
  0%, 100% {
    text-shadow: none;
    color: var(--text-secondary);
  }
  50% {
    text-shadow:
      0 0 10px rgba(212, 160, 23, 0.95),
      0 0 22px rgba(212, 160, 23, 0.55),
      0 0 36px rgba(212, 160, 23, 0.25);
    color: #E8C36C;
  }
}

/* Reduced-motion fallback — keep a static gold tint so the visual emphasis
   still reads, but no breathing animation. */
@media (prefers-reduced-motion: reduce) {
  .nav__link--support {
    animation: none;
    color: #E8C36C;
    text-shadow: 0 0 10px rgba(212, 160, 23, 0.4);
  }
}

/* =============================================================
   SCROLL MOVIE — 300vh, sticky canvas, scroll-driven frames
   ============================================================= */
.scroll-movie {
  position: relative;
  z-index: 1;
  height: 300vh;
  background: var(--bg-deep);
}

.scroll-movie__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

.scroll-movie__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--bg-deep);
}

.scroll-movie__loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  color: var(--text-muted);
  font-family: var(--ff-ui);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.scroll-movie__loading.is-hidden {
  opacity: 0;
}

.scroll-movie__sound {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(5, 10, 20, 0.7);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  font-size: 1.125rem;
  line-height: 1;
  color: var(--text-primary);
  cursor: pointer;
  transition:
    background-color var(--d-fast) var(--e-out-quart),
    border-color var(--d-fast) var(--e-out-quart),
    transform var(--d-fast) var(--e-out-quart);
}

.scroll-movie__sound:hover,
.scroll-movie__sound:focus-visible {
  background: rgba(5, 10, 20, 0.9);
  border-color: var(--border-hover);
  transform: scale(1.05);
}

.scroll-movie__sound svg {
  width: 22px;
  height: 22px;
}
.scroll-movie__sound .scroll-movie__sound-off { display: none; }
.scroll-movie__sound[aria-pressed="true"] .scroll-movie__sound-on { display: none; }
.scroll-movie__sound[aria-pressed="true"] .scroll-movie__sound-off { display: inline-block; }

/* =============================================================
   SECTIONS
   ============================================================= */
.section {
  padding: var(--section-gap) 0;
  position: relative;
  z-index: 1;
}


.section--surface { background: var(--bg-surface); }
.section--deep    { background: var(--bg-deep); }

/* Mobile: smaller section padding + smaller section headings */
@media (max-width: 768px) {
  .section {
    padding: 3rem 0;
  }
  .section__heading,
  .h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
  }
  /* Read heading uses an even smaller clamp; keep it consistent on mobile */
  #read .section__heading {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
  }
}

.section__head {
  margin-bottom: var(--s-2xl);
}

.section__head--center {
  text-align: center;
}

.section__head--center .section__overline,
.section__head--center .section__heading {
  margin-left: auto;
  margin-right: auto;
}

.section__overline {
  display: block;
  margin-bottom: var(--s-md);
}

.section__heading {
  color: var(--text-primary);
  max-width: 900px;
}

/* Read heading is long — force single line on tablet/desktop. The base
   .h1 clamp (max ~78px) is too big to fit "Highlights from Torah UMaddah"
   in the container, so this heading uses a slightly smaller clamp. */
#read .section__heading {
  max-width: none;
  white-space: nowrap !important;
  font-size: clamp(2.2rem, 4.2vw, 3.6rem);
}

@media (max-width: 600px) {
  #read .section__heading {
    white-space: normal !important;
    font-size: clamp(2rem, 7vw, 2.6rem);
  }
}

/* Animated hairline below each section heading. JS animates width from 0
   to 120px on scroll-into-view; concludes the section header like a
   chapter divider in a printed monograph. */
.section__rule {
  width: 0;
  height: 1px;
  background: var(--accent-cosmic);
  opacity: 0.5;
  margin-top: var(--s-md);
  will-change: width;
}

/* Reveal-on-scroll initial state */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  will-change: opacity, transform;
}

/* If JS doesn't run / reduced motion, ensure content is visible */
.no-anim .reveal,
.no-anim .portal,
.no-anim .landing__overline,
.no-anim .landing__name .char {
  opacity: 1 !important;
  transform: none !important;
}

/* =============================================================
   ABOUT
   ============================================================= */
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--s-2xl);
  align-items: start;
}

@media (max-width: 900px) {
  .about__grid {
    grid-template-columns: 1fr;
    gap: var(--s-xl);
  }
}

/* Headshot frame — gold border + overflow:hidden contains the hover zoom. */
.about__media {
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  border: 2px solid rgba(212, 160, 23, 0.6);
  background: var(--bg-card);
}

.about__photo {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  background: var(--bg-card);
  aspect-ratio: 4 / 5;
  object-fit: cover;
  /* Border + radius live on the parent so the scaled image stays clipped. */
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.about__media:hover .about__photo,
.about__media:focus-within .about__photo {
  transform: scale(1.06);
}

/* Inline links inside the bio — body weight, no UI uppercase styling
   bleeding in from .link--cosmic. Override display + transform + tracking. */
.about__text a {
  color: var(--accent-cosmic);
  display: inline;
  text-transform: none;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: 0;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  gap: 0;
  align-items: unset;
  transition: border-color var(--d-fast) var(--e-out-quart),
              color var(--d-fast) var(--e-out-quart);
}
.about__text a:hover,
.about__text a:focus-visible {
  border-bottom-color: currentColor;
}
.about__text a.link--gold {
  color: var(--accent-gold);
}

/* =============================================================
   RESEARCH
   ============================================================= */
.research__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-md);
}

@media (max-width: 980px) {
  .research__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .research__grid { grid-template-columns: 1fr; }
}

.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  /* All transitions live on the default state so leave-animation is
     symmetric with the hover-in animation. */
  transition:
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.4s ease,
    border-color 0.4s ease;
  display: flex;
  flex-direction: column;
}

.topic-card:hover {
  transform: translateY(-4px) scale(1.03);
  border-color: rgba(237, 229, 213, 0.2);
  box-shadow: var(--card-glow);
}

.topic-card:hover .topic-card__image {
  transform: scale(1.08);
}

/* 16:9 image area at the top of each card.
   No background here — the card's per-card radial-gradient tint shows
   through and blends with the image's mix-blend-mode: lighten. */
.topic-card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

/* Per-card radial-gradient tints + matching hover glows.
   The --card-glow custom property is consumed by .topic-card:hover. */
.topic-card:nth-child(1) {
  --card-glow: 0 0 25px rgba(212, 160, 23, 0.15), 0 0 50px rgba(212, 160, 23, 0.05);
  background:
    radial-gradient(ellipse at 30% 40%, rgba(212, 160, 23, 0.12), rgba(123, 164, 212, 0.06), transparent 70%),
    var(--bg-card);
}
.topic-card:nth-child(2) {
  --card-glow: 0 0 25px rgba(212, 160, 23, 0.12), 0 0 50px rgba(123, 164, 212, 0.08);
  background:
    radial-gradient(ellipse at 20% 50%, rgba(212, 160, 23, 0.10), transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(123, 164, 212, 0.10), transparent 50%),
    var(--bg-card);
}
.topic-card:nth-child(3) {
  --card-glow: 0 0 25px rgba(140, 100, 200, 0.15), 0 0 50px rgba(140, 100, 200, 0.05);
  background:
    radial-gradient(ellipse at 50% 50%, rgba(140, 100, 200, 0.10), rgba(27, 42, 78, 0.05), transparent 70%),
    var(--bg-card);
}
.topic-card:nth-child(4) {
  --card-glow: 0 0 25px rgba(80, 180, 160, 0.15), 0 0 50px rgba(80, 180, 160, 0.05);
  background:
    radial-gradient(ellipse at 50% 60%, rgba(80, 180, 160, 0.08), rgba(212, 160, 23, 0.06), transparent 70%),
    var(--bg-card);
}
.topic-card:nth-child(5) {
  --card-glow: 0 0 25px rgba(180, 140, 80, 0.15), 0 0 50px rgba(180, 140, 80, 0.05);
  background:
    radial-gradient(ellipse at 50% 50%, rgba(180, 140, 80, 0.10), rgba(60, 50, 40, 0.05), transparent 70%),
    var(--bg-card);
}
.topic-card:nth-child(6) {
  --card-glow: 0 0 25px rgba(123, 164, 212, 0.12), 0 0 50px rgba(212, 160, 23, 0.06);
  background:
    radial-gradient(ellipse at 40% 40%, rgba(123, 164, 212, 0.10), rgba(212, 160, 23, 0.06), transparent 70%),
    var(--bg-card);
}

.topic-card__image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: 1;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Short fade at the bottom edge only (last 20px) — smooth handoff into
   the text area without darkening the rest of the image. */
.topic-card__media::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 20px;
  background: linear-gradient(180deg, transparent, var(--bg-card));
  pointer-events: none;
}

.topic-card__content {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: var(--s-sm);
}

.topic-card__label { color: var(--accent-cosmic); }
.topic-card__title { color: var(--text-primary); }
.topic-card__body  { color: var(--text-secondary); }

/* =============================================================
   WATCH
   ============================================================= */
/* Editorial layout: featured tall on the left, two stacked on the right */
.watch__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-md);
}

@media (min-width: 760px) {
  .watch__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .watch__grid .video-card--featured {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  .watch__grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    grid-template-rows: 1fr 1fr;
    gap: var(--s-md);
  }
  .watch__grid .video-card--featured {
    grid-column: 1;
    grid-row: 1 / span 2;
  }
  .watch__grid .video-card--featured .video-card__title {
    font-size: clamp(1.75rem, 2.4vw, 2.125rem);
  }
}

.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    border-color var(--d-fast) var(--e-out-quart),
    transform var(--d-fast) var(--e-out-quart);
}

.video-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.video-card__media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--bg-card);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  display: block;
}

/* Subtle scrim — keeps the play triangle readable against bright thumbnails */
.video-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(5, 10, 20, 0.15) 0%,
    rgba(5, 10, 20, 0.45) 100%
  );
  transition: background var(--d-fast) var(--e-out-quart);
  pointer-events: none;
}
.video-card__media:hover::after {
  background: linear-gradient(
    180deg,
    rgba(5, 10, 20, 0.05) 0%,
    rgba(5, 10, 20, 0.2) 100%
  );
}

.video-card__play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(5, 10, 20, 0.6);
  border: 1px solid var(--accent-cosmic);
  display: grid;
  place-items: center;
  transition: background-color var(--d-fast) var(--e-out-quart),
              box-shadow var(--d-fast) var(--e-out-quart);
}

.video-card__media:hover .video-card__play {
  background: rgba(5, 10, 20, 0.8);
  box-shadow: 0 0 30px var(--accent-cosmic-glow);
}

.video-card__play-icon {
  width: 0;
  height: 0;
  border-left: 16px solid var(--accent-cosmic);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  margin-left: 4px; /* optical centering for triangle */
}

.video-card__meta {
  padding: var(--s-md) var(--s-md) var(--s-lg);
  display: flex;
  flex-direction: column;
  gap: var(--s-sm);
  flex: 1;
}

.video-card__title { color: var(--text-primary); }

.watch__more {
  margin-top: var(--s-xl);
  text-align: right;
}

/* Inline iframe replacement (when user clicks play) */
.video-card__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* =============================================================
   READ
   ============================================================= */
.read__list {
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: grid;
  grid-template-columns: 40% 1fr;
  align-items: stretch;
  transition:
    border-color var(--d-fast) var(--e-out-quart),
    background-color var(--d-fast) var(--e-out-quart),
    transform var(--d-fast) var(--e-out-quart);
  /* Cards are anchors — strip default link styling. */
  text-decoration: none;
  color: inherit;
}

.post-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.post-card__media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-deep);
}

.post-card__image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-card:hover .post-card__image {
  transform: scale(1.05);
}

.post-card__content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s-sm);
}

/* Per-post gradient washes behind the text — image area is never tinted. */
.read__list li:nth-child(1) .post-card__content {
  background: linear-gradient(
    135deg,
    rgba(139, 69, 19, 0.25) 0%,
    rgba(0, 100, 0, 0.2) 50%,
    rgba(20, 60, 80, 0.25) 100%
  );
}
.read__list li:nth-child(2) .post-card__content {
  background: linear-gradient(
    135deg,
    rgba(0, 80, 100, 0.3) 0%,
    rgba(60, 20, 80, 0.25) 50%,
    rgba(0, 60, 90, 0.2) 100%
  );
}
.read__list li:nth-child(3) .post-card__content {
  background: linear-gradient(
    135deg,
    rgba(120, 100, 0, 0.2) 0%,
    rgba(0, 40, 100, 0.25) 50%,
    rgba(20, 60, 100, 0.3) 100%
  );
}

@media (max-width: 700px) {
  .post-card {
    grid-template-columns: 1fr;
  }
  .post-card__media {
    aspect-ratio: 16 / 9;
    width: 100%;
  }
}

.post-card__date  { color: var(--text-muted); }
.post-card__title { color: var(--text-primary); }
.post-card__excerpt { color: var(--text-secondary); }

.read__more {
  margin-top: var(--s-xl);
  text-align: right;
}

/* Generic links */
.link--cosmic {
  color: var(--accent-cosmic);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color var(--d-fast) var(--e-out-quart),
              color var(--d-fast) var(--e-out-quart);
}

.link--cosmic:hover {
  border-bottom-color: var(--accent-cosmic);
}

/* =============================================================
   SUPPORT
   ============================================================= */
/* Support + Contact merged section: 60/40 grid on desktop, stacked mobile */
.support__grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--s-2xl);
  align-items: start;
}

@media (max-width: 900px) {
  .support__grid {
    grid-template-columns: 1fr;
    gap: var(--s-xl);
  }
}

/* Left column — fully centered vertical stack with explicit 1.5rem rhythm */
.support__main {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.support__main .section__overline {
  /* Override the global section__overline left-anchor so the wrapper's
     text-align: center actually centers it. */
  margin-bottom: 1.5rem;
}

.support__logo {
  height: 270px;
  width: auto;
  display: block;
  margin: 0 auto 1.5rem;
}

.support__body {
  margin: 0 auto;
  max-width: 480px;
  color: var(--text-primary);
}

.support__main .cta-gold {
  margin-top: 1.5rem;
}

.support__form-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}

.cta-gold {
  display: inline-block;
  background: var(--accent-gold);
  color: var(--bg-deep);
  border-radius: var(--r-sm);
  padding: 14px 32px;
  font-family: var(--ff-ui);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    transform var(--d-fast) var(--e-out-quart),
    box-shadow var(--d-fast) var(--e-out-quart),
    background-color var(--d-fast) var(--e-out-quart);
}

.cta-gold:hover,
.cta-gold:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 0 40px var(--accent-gold-glow);
}

.support__legal {
  margin: 1.5rem auto 0;
  color: var(--text-muted);
  max-width: 480px;
  text-align: center;
}

/* =============================================================
   CONTACT FORM (used inside the merged Support section)
   ============================================================= */
.contact__form {
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-md);
}

@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  color: var(--text-muted);
  font-family: var(--ff-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.form-group input,
.form-group textarea {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 4px;
  padding: 12px;
  font-family: var(--ff-body);
  font-size: 1rem;
  width: 100%;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent-cosmic);
  outline: none;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.cta-cosmic {
  background: var(--accent-cosmic);
  color: var(--bg-deep);
  font-family: var(--ff-ui);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 0.9375rem;
  padding: 14px 32px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  align-self: flex-start;
  transition: filter 0.2s ease, transform 0.3s ease;
}

.cta-cosmic:hover,
.cta-cosmic:focus-visible {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

/* =============================================================
   FOOTER
   ============================================================= */
.footer {
  position: relative;
  z-index: 1;
  background: var(--bg-deep);
  border-top: 1px solid var(--border);
  padding: var(--s-3xl) 0 var(--s-xl);
  color: var(--text-secondary);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 3rem;
  align-items: start;
  width: 100%;
  margin-bottom: var(--s-2xl);
}

@media (max-width: 768px) {
  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--s-xl);
  }
}

/* All three column headings render identically — explicit values lock
   font-size, weight and bottom margin against any cascade surprise. */
.footer__heading {
  font-family: var(--ff-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text-primary);
  margin: 0 0 1rem;
}

.footer__body { color: var(--text-secondary); }
.footer__muted { color: var(--text-muted); margin-top: var(--s-xs); font-size: 0.875rem; }

/* Center the middle footer column (Connect) and its list items */
.footer__col:nth-child(2) {
  text-align: center;
}

.footer__links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-sm);
}

.footer__link {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--text-secondary);
  font-family: var(--ff-ui);
  font-size: 0.9375rem;
  letter-spacing: 0.04em;
  transition: color var(--d-fast) var(--e-out-quart);
}

.footer__link:hover {
  color: var(--accent-cosmic);
}

.footer__icon {
  width: 18px;
  height: 18px;
}

.footer__brand {
  display: flex;
  justify-content: center;
  margin-bottom: var(--s-xl);
}

.footer__logo {
  height: 280px;
  width: auto;
  display: block;
}

.footer__tagline {
  text-align: center;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: var(--s-lg);
  margin-top: var(--s-lg);
}


/* =============================================================
   VIDEO MODAL — full-viewport overlay with embedded iframe
   ============================================================= */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-modal iframe {
  width: 90vw;
  max-width: 1000px;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 8px;
  display: block;
}

.video-modal__close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 8px 16px;
  transition: opacity var(--d-fast) ease;
}

.video-modal__close:hover,
.video-modal__close:focus-visible {
  opacity: 0.7;
}

/* =============================================================
   Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal,
  .portal,
  .name,
  .name .char,
  .landing > .overline,
  .overline__text,
  .name-line {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    visibility: visible !important;
  }
  .name-line {
    width: min(200px, 40vw);
    opacity: 0.4 !important;
  }
}
