/* ============================================
   PORTAL.CSS — Choose Your Path portal styles
   Used by: index.html (site root) — no other page
   ============================================ */

/* ===== BASE VARIABLES ===== */
:root {
  --bg-primary: #0a0a0c;
  --bg-secondary: #111116;
  --bg-tertiary: #18181f;
  --bg-card: #13131a;
  --text-primary: #e8e6e1;
  --text-secondary: #9e9a91;
  --text-tertiary: #6b6860;
  --accent-gold: #c9a84c;
  --accent-gold-dim: #8a7234;
  --accent-blue: #5b7fa6;
  --accent-blue-dim: #3a5470;
  --accent-violet: #8b6fa6;
  --accent-violet-dim: #5e4a73;
  --accent-teal: #5a9e8f;
  --accent-teal-dim: #3d6b60;
  --accent-red: #a65b5b;
  --accent-red-dim: #704040;
  --accent-silver: #94a8b8;
  --accent-silver-dim: #637585;
  --accent-periwinkle: #7B7DAD;
  --accent-periwinkle-dim: #535476;
  --accent-orange: #c9512f;
  --accent-orange-dim: #8a3520;
  --border-subtle: #222230;
  --border-faint: #1a1a24;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 300;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.cosmos-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.cosmos-bg::before {
  content: ''; position: absolute; top: -20%; left: -20%; width: 60%; height: 60%;
  background: radial-gradient(ellipse, rgba(139, 111, 166, 0.025) 0%, transparent 70%);
}
.cosmos-bg::after {
  content: ''; position: absolute; bottom: -15%; right: -15%; width: 55%; height: 55%;
  background: radial-gradient(ellipse, rgba(90, 158, 143, 0.02) 0%, transparent 70%);
}
.cosmos-bg-extra {
  position: fixed; top: -10%; right: 20%; width: 40%; height: 40%;
  background: radial-gradient(ellipse, rgba(201, 168, 76, 0.015) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

/* ===== PAGE SECTIONS ===== */
.page-section { display: none; }
.page-section.active { display: block; }

/* Portal gets centered layout */
#page-portal.active {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh;
}

/* Astro portal gets centered layout */
#page-astro-portal.active {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}

/* Psych portal gets centered layout */
#page-psych-portal.active {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}

/* ===== BACK NAV ===== */
.back-nav {
  position: relative; z-index: 2;
  max-width: 720px; margin: 0 auto;
  padding: 20px 24px 0;
}
.back-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem; font-weight: 400;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-gold-dim); text-decoration: none;
  transition: color 0.3s ease; cursor: pointer;
}
.back-link:hover { color: var(--accent-gold); }
.back-link:focus-visible { outline: 1px solid var(--accent-gold-dim); outline-offset: 3px; }
.back-link::before { content: '← '; }
.back-link-white { color: rgba(232,230,225,0.45); }
.back-link-white:hover { color: #e8e6e1; }
/* Equal specificity to the rule above, so source order is what puts the white
   ring on the portal sections. Same mechanism the colour already relies on. */
.back-link-white:focus-visible { outline: 1px solid rgba(232,230,225,0.45); outline-offset: 3px; }
#page-portal > .back-nav,
#page-astro-portal > .back-nav,
#page-psych-portal > .back-nav {
  position: absolute; top: 0; left: 50%; z-index: 10;
  transform: translateX(-50%);
  width: 100%; max-width: 720px;
}

/* ===== PORTAL STYLES ===== */
.portal-container {
  position: relative; z-index: 1;
  max-width: 800px; width: 100%;
  padding: 60px 24px 80px;
  display: flex; flex-direction: column; align-items: center;
}
.portal-header { text-align: center; margin-bottom: 12px; }
.portal-title {
  font-family: 'Cormorant Garamond', serif; font-size: 3.2rem;
  font-weight: 300; letter-spacing: 0.02em; color: var(--text-primary);
}
.portal-tagline {
  font-family: 'IBM Plex Sans', sans-serif; font-size: 0.88rem;
  font-weight: 300; color: var(--text-tertiary);
  letter-spacing: 0.04em; margin-top: 8px;
}
.triangle-container {
  width: 100%; max-width: 520px; margin: 48px 0 56px; position: relative;
}
.triangle-svg { width: 100%; height: auto; overflow: visible; }
.tri-line { stroke-dasharray: 1000; stroke-dashoffset: 1000; }
.animated .tri-line-left { animation: drawLine 1.4s ease 0.8s forwards; }
.animated .tri-line-right { animation: drawLine 1.4s ease 1.0s forwards; }
.animated .tri-line-bottom { animation: drawLine 1.2s ease 1.2s forwards; }
.animated .tri-line-bar { animation: drawLine 1s ease 1.6s forwards; }
.tri-inv-da, .tri-inv-fc { stroke-dasharray: 300; stroke-dashoffset: 300; }
.animated .tri-inv-da { animation: drawLine 1s ease 2.3s forwards; }
.animated .tri-inv-fc { animation: drawLine 1s ease 2.5s forwards; }
.node-glow { opacity: 0; }
.animated .node-glow-ac { animation: glowIn 0.8s ease 2.0s forwards; }
.animated .node-glow-da { animation: glowIn 0.8s ease 2.2s forwards; }
.animated .node-glow-fc { animation: glowIn 0.8s ease 2.4s forwards; }
.node-core { opacity: 0; }
.animated .node-core-ac { animation: nodeIn 0.6s ease 2.0s forwards; }
.animated .node-core-da { animation: nodeIn 0.6s ease 2.2s forwards; }
.animated .node-core-fc { animation: nodeIn 0.6s ease 2.4s forwards; }

.cards { width: 100%; max-width: 680px; display: grid; grid-template-columns: 1fr; gap: 0; }
.card-row-top { display: flex; justify-content: center; margin-bottom: 16px; }
.card-row-bottom { display: flex; gap: 16px; justify-content: center; }
.card {
  padding: 22px 26px; background: var(--bg-card); border-radius: 4px;
  border: 1px solid var(--border-faint);
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.2s ease;
  cursor: pointer; text-decoration: none; display: block; color: inherit;
}
.card:hover { background: var(--bg-tertiary); transform: translateY(-2px); }
.card-ac { border-top: 2px solid var(--accent-gold-dim); max-width: 420px; width: 100%; }
.card-ac:hover { border-top-color: var(--accent-gold); border-color: var(--accent-gold-dim); }
.card-da { border-top: 2px solid var(--accent-violet-dim); flex: 1; max-width: 326px; }
.card-da:hover { border-top-color: var(--accent-violet); border-color: var(--accent-violet-dim); }
.card-fc { border-top: 2px solid var(--accent-teal-dim); flex: 1; max-width: 326px; }
.card-fc:hover { border-top-color: var(--accent-teal); border-color: var(--accent-teal-dim); }
.card-term {
  font-family: 'Cormorant Garamond', serif; font-size: 1.25rem;
  font-weight: 500; color: var(--text-primary); margin-bottom: 2px; letter-spacing: 0.01em;
}
.card-phonetic {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.7rem;
  font-weight: 300; color: var(--text-tertiary); letter-spacing: 0.03em; margin-bottom: 4px;
}
.card-domain {
  font-size: 0.68rem; font-weight: 400; color: var(--text-tertiary);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 12px;
}
.card-domain .dot { color: var(--accent-gold-dim); }
.card-desc { font-size: 0.84rem; color: var(--text-secondary); line-height: 1.7; font-weight: 300; }

/* ===== BIDIRECTIONAL HOVER LINKING ===== */
.node-glow { transition: opacity 0.3s ease; }
.node-core { transition: r 0.3s ease, filter 0.3s ease; }
.node-glow.node-highlight-ac { opacity: 0.7 !important; }
.node-glow.node-highlight-da { opacity: 0.7 !important; }
.node-glow.node-highlight-fc { opacity: 0.7 !important; }
.node-core.node-highlight-ac { r: 6; filter: drop-shadow(0 0 6px #c9a84c); }
.node-core.node-highlight-da { r: 6; filter: drop-shadow(0 0 6px #8b6fa6); }
.node-core.node-highlight-fc { r: 6; filter: drop-shadow(0 0 6px #5a9e8f); }
.card.card-highlight { transform: translateY(-2px); }
.card-ac.card-highlight { border-top-color: var(--accent-gold); border-color: var(--accent-gold-dim); background: var(--bg-tertiary); }
.card-da.card-highlight { border-top-color: var(--accent-violet); border-color: var(--accent-violet-dim); background: var(--bg-tertiary); }
.card-fc.card-highlight { border-top-color: var(--accent-teal); border-color: var(--accent-teal-dim); background: var(--bg-tertiary); }

/* Triangle line glow on hover */
.tri-line-left, .tri-line-right, .tri-line-bottom { transition: stroke 0.4s ease, filter 0.4s ease, stroke-width 0.4s ease; }
.tri-line-left.tri-glow-ac, .tri-line-right.tri-glow-ac, .tri-line-bottom.tri-glow-ac {
  stroke: #c9a84c; stroke-width: 1.4; filter: drop-shadow(0 0 6px rgba(201, 168, 76, 0.7)) drop-shadow(0 0 14px rgba(201, 168, 76, 0.35));
}
.tri-inv-da, .tri-inv-fc { transition: stroke 0.4s ease, filter 0.4s ease, stroke-width 0.4s ease; }
.tri-inv-da.tri-glow-da { stroke: #8b6fa6; stroke-width: 1.4; filter: drop-shadow(0 0 6px rgba(139, 111, 166, 0.7)) drop-shadow(0 0 14px rgba(139, 111, 166, 0.35)); }
.tri-inv-fc.tri-glow-fc { stroke: #5a9e8f; stroke-width: 1.4; filter: drop-shadow(0 0 6px rgba(90, 158, 143, 0.7)) drop-shadow(0 0 14px rgba(90, 158, 143, 0.35)); }

/* ===== STARFIELD ===== */
.starfield-region {
  position: relative;
  overflow: hidden;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.starfield-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}
.starfield-region .portal-header,
.starfield-region .triangle-container,
.starfield-region .cards {
  position: relative;
  z-index: 1;
}

/* ===== ORIGIN SEPARATOR ===== */
.origin-separator {
  width: 100%; max-width: 680px;
  display: flex; align-items: center;
  margin: 48px 0 36px;
  gap: 0;
}
.origin-separator-line {
  flex: 1; height: 1px;
  background: var(--border-faint);
}
.origin-separator-symbol {
  flex-shrink: 0; padding: 0 16px;
  display: flex; align-items: center; justify-content: center;
}
.origin-separator-symbol svg {
  width: 68px; height: auto;
  overflow: visible;
}

/* ===== TWO APERTURES CARD ===== */
.card-ta {
  border-top: 2px solid var(--accent-blue-dim);
  max-width: 420px; width: 100%;
}
.card-ta:hover {
  border-top-color: var(--accent-blue);
  border-color: var(--accent-blue-dim);
}
.card-ta .card-domain .dot { color: var(--accent-blue-dim); }

/* ===== APERTURE PARTITION CARD ===== */
.card-ap {
  border-top: 2px solid var(--accent-red-dim);
  flex: 1; max-width: 326px;
}
.card-ap:hover {
  border-top-color: var(--accent-red);
  border-color: var(--accent-red-dim);
}
.card-ap .card-domain .dot { color: var(--accent-red-dim); }

/* Calabi-Yau glyph on AP card */
.card-ap .card-term-row,
.card-sse .card-term-row,
.card-lfg .card-term-row,
.card-dial .card-term-row,
.card-gf .card-term-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2px;
}
.card-ap .card-term-row .card-term,
.card-sse .card-term-row .card-term,
.card-lfg .card-term-row .card-term,
.card-dial .card-term-row .card-term-psych,
.card-gf .card-term-row .card-term-psych { margin-bottom: 0; }
.calabi-glyph {
  flex-shrink: 0; width: 24px; height: 24px; opacity: 0.5;
  transition: opacity 0.3s ease;
}
.calabi-glyph ellipse { transition: stroke 0.3s ease; }
.card-ap:hover .calabi-glyph { opacity: 0.85; }
.card-ap:hover .calabi-glyph ellipse { stroke: var(--accent-red); }

/* ===== LUCID KNOWLEDGE CARD ===== */
.card-lk {
  border-top: 2px solid var(--accent-silver-dim);
  flex: 1; max-width: 326px;
}
.card-lk:hover {
  border-top-color: var(--accent-silver);
  border-color: var(--accent-silver-dim);
}
.card-lk .card-domain .dot { color: var(--accent-silver-dim); }

/* ===== ASTRO-PORTAL CARDS ===== */
.astro-portal-container {
  position: relative; z-index: 1;
  max-width: 720px; width: 100%;
  padding: 60px 24px;
  display: flex;
  justify-content: center;
}
.astro-cards {
  width: 100%;
  display: flex;
  gap: 16px;
  justify-content: center;
}
.card-sse {
  border-top: 2px solid var(--accent-red-dim);
  flex: 1; max-width: 340px;
}
.card-sse:hover {
  border-top-color: var(--accent-red);
  border-color: var(--accent-red-dim);
}
.card-sse .card-domain .dot { color: var(--accent-red-dim); }

.card-lfg {
  border-top: 2px solid var(--accent-violet-dim);
  flex: 1; max-width: 340px;
}
.card-lfg:hover {
  border-top-color: var(--accent-violet);
  border-color: var(--accent-violet-dim);
}
.card-lfg .card-domain .dot { color: var(--accent-violet-dim); }

/* Astro-portal card titles use Fraunces */
.card-term-astro {
  font-family: 'Fraunces', serif;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

/* SSE glyph */
.glyph-sse {
  flex-shrink: 0;
  width: 26px; height: 26px;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}
.glyph-sse circle, .glyph-sse path { transition: stroke 0.3s ease; }
.card-sse:hover .glyph-sse { opacity: 0.85; }
.card-sse:hover .glyph-sse circle,
.card-sse:hover .glyph-sse path { stroke: var(--accent-red); }

/* LFG glyph */
.glyph-lfg {
  flex-shrink: 0;
  width: 24px; height: 24px;
  opacity: 0.45;
  transition: opacity 0.3s ease;
}
.glyph-lfg path { transition: fill 0.3s ease; }
.card-lfg:hover .glyph-lfg { opacity: 0.8; }
.card-lfg:hover .glyph-lfg path { fill: var(--accent-violet); }

/* ===== PSYCH-PORTAL CARDS ===== */
.psych-portal-container {
  position: relative; z-index: 1;
  max-width: 720px; width: 100%;
  padding: 60px 24px;
  display: flex;
  justify-content: center;
}
.psych-cards {
  width: 100%;
  display: flex;
  gap: 16px;
  justify-content: center;
}
.card-term-psych {
  font-family: 'Syncopate', sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
}

/* Aperture Dial card — Chromatic Border */
.card-dial {
  position: relative;
  flex: 1; max-width: 340px;
  border-top: 2px solid transparent;
  overflow: hidden;
  border-radius: 4px;
}
.card-dial::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #a855c8, #5b8def, #4ecdc4, #e8d040, #e87040);
  z-index: 1;
}
.card-dial:hover {
  border-color: rgba(168, 85, 200, 0.3);
}
.card-dial:hover::before {
  height: 2px;
  filter: brightness(1.2);
}
.card-dial .card-domain .dot { color: #7b5daa; }

/* Ganzflicker card — Orange Accent */
.card-gf {
  border-top: 2px solid var(--accent-orange-dim);
  flex: 1; max-width: 340px;
}
.card-gf:hover {
  border-top-color: var(--accent-orange);
  border-color: var(--accent-orange-dim);
}
.card-gf .card-domain .dot { color: var(--accent-orange-dim); }

/* Eye glyph */
.glyph-gf {
  flex-shrink: 0;
  width: 26px; height: 20px;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}
.glyph-gf path, .glyph-gf circle { transition: stroke 0.3s ease; }
.card-gf:hover .glyph-gf { opacity: 0.85; }
.card-gf:hover .glyph-gf path,
.card-gf:hover .glyph-gf circle { stroke: var(--accent-orange); }

/* ===== VIDEO EMBED ===== */
:root {
  --accent-green: #4a8a65;
  --accent-green-dim: #356b4a;
}
.video-section {
  width: 100%; max-width: 680px;
  margin-top: 20px;
}
.video-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem; font-weight: 400;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-green-dim);
  margin-bottom: 12px;
  text-align: center;
}
.video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  background: var(--bg-card);
  border: 1px solid var(--border-faint);
  border-top: 2px solid var(--accent-green-dim);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.3s ease;
}
.video-wrapper:hover {
  border-top-color: var(--accent-green);
  border-color: var(--accent-green-dim);
}
.video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* ===== PODCAST SECTION ===== */
.podcast-section {
  width: 100%; max-width: 420px;
  margin-top: 20px; margin-bottom: 8px;
}
.podcast-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem; font-weight: 400;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-blue-dim);
  margin-bottom: 12px;
  text-align: center;
  transition: color 0.4s ease;
}
.podcast-tabs {
  display: flex; gap: 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; -ms-overflow-style: none;
}
.podcast-tabs::-webkit-scrollbar { display: none; }
.podcast-ep-tab {
  display: inline-block;
  flex-shrink: 0;
  padding: 5px 14px 4px;
  border-radius: 4px 4px 0 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem; font-weight: 400;
  letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease;
}
.podcast-ep-tab.active {
  color: var(--text-primary);
}
.podcast-ep-tab:not(.active) {
  background: transparent;
  color: var(--text-tertiary);
  opacity: 0.6;
}
.podcast-ep-tab:not(.active):hover {
  opacity: 0.9;
}

/* Desktop tab scrolling */
.podcast-tab-arrow { display: none; }
@media (min-width: 601px) {
  .podcast-tabs-row { position: relative; }
  .podcast-tabs { cursor: grab; }
  .podcast-tabs.is-dragging { cursor: grabbing; user-select: none; }
  .podcast-tab-arrow {
    display: flex;
    position: absolute;
    top: 0; bottom: 0;
    width: 20px;
    align-items: center;
    justify-content: center;
    z-index: 2;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .podcast-tab-arrow.visible {
    opacity: 1;
    pointer-events: auto;
  }
  .podcast-tab-arrow-left {
    right: 100%;
    margin-right: 4px;
  }
  .podcast-tab-arrow-right {
    left: 100%;
    margin-left: 4px;
  }
  .podcast-tab-arrow::after {
    content: '';
    display: block;
    width: 0; height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
  }
  .podcast-tab-arrow-left::after {
    border-right: 5px solid var(--text-tertiary);
  }
  .podcast-tab-arrow-right::after {
    border-left: 5px solid var(--text-tertiary);
  }
  .podcast-tab-arrow-left:hover::after {
    border-right-color: var(--text-secondary);
  }
  .podcast-tab-arrow-right:hover::after {
    border-left-color: var(--text-secondary);
  }
}

.podcast-body {
  background: linear-gradient(135deg, rgba(58, 84, 112, 0.06) 0%, rgba(91, 127, 166, 0.03) 100%);
  border: 1px solid var(--border-subtle);
  border-top: 2px solid #12253a;
  border-radius: 0 4px 4px 4px;
  padding: 16px 20px 14px;
  transition: border-color 0.4s ease;
}
.podcast-ep-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%;
  background: rgba(58, 84, 112, 0.08); border: 1px solid rgba(58, 84, 112, 0.2);
  border-radius: 4px; padding: 8px 14px;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.52rem;
  font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-blue-dim); margin-bottom: 14px;
  transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}
.podcast-ep-number { flex-shrink: 0; letter-spacing: normal; }
.podcast-ep-content { margin-bottom: 14px; }
.podcast-ep-domain {
  font-size: 0.66rem; font-weight: 400; color: var(--text-tertiary);
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 8px;
}
.podcast-ep-domain .dot { color: var(--accent-blue-dim); }
.podcast-ep-desc {
  font-size: 0.84rem; font-weight: 300; font-style: italic;
  color: var(--text-secondary); line-height: 1.7;
  padding: 0 2px;
}
.podcast-ep-actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px;
}
.podcast-ac-glyph {
  opacity: 0.5;
  transition: color 0.3s ease;
}
.podcast-share-btn,
.podcast-comment-btn {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
  border-radius: 4px; padding: 6px 12px;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.48rem;
  font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}
.podcast-ep-btns { display: flex; align-items: center; gap: 8px; }
/* Phones: tighten the title pill so long titles keep to one line */
@media (max-width: 420px) {
  .podcast-ep-title { padding: 8px 10px; }
}
/* Narrow phones: reclaim ~26px so both buttons clear 320px without wrapping */
@media (max-width: 380px) {
  .podcast-share-btn,
  .podcast-comment-btn { padding: 6px 8px; letter-spacing: 0.06em; }
  .podcast-ep-btns { gap: 6px; }
}
.podcast-player {
  width: 100%;
}
.podcast-player audio {
  width: 100%;
  height: 36px;
  border-radius: 4px;
  filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9);
}

/* ===== EPISODE COMMENT MODAL ===== */
/* Scroll-lock lives on a class, never an inline style: navigateTo() owns
   document.body.style.overflow and two writers on one property fight. */
body.modal-open { overflow: hidden; }
body.modal-open .return-top { opacity: 0; pointer-events: none; }

.comment-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10, 10, 12, 0.86);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s ease;
}
.comment-overlay.active { opacity: 1; pointer-events: auto; }

.comment-modal {
  width: 100%; max-width: 520px; max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-top: 2px solid #12253a;
  border-radius: 4px;
  overflow: hidden;
  transform: translateY(10px);
  transition: transform 0.28s ease, border-color 0.4s ease;
}
.comment-overlay.active .comment-modal { transform: translateY(0); }

.comment-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border-faint);
  flex-shrink: 0;
}
.comment-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-blue-dim); margin-bottom: 6px;
  transition: color 0.4s ease;
}
.comment-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem; font-weight: 400; line-height: 1.3;
  color: var(--text-primary);
}
.comment-close {
  background: none; border: none; cursor: pointer; padding: 2px 4px;
  font-size: 1.1rem; line-height: 1; color: var(--text-tertiary);
  transition: color 0.25s ease; flex-shrink: 0;
}
.comment-close:hover { color: var(--text-primary); }

.comment-scroll { overflow-y: auto; padding: 18px 20px 20px; }

.comment-field { margin-bottom: 10px; }
.comment-field label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.52rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-tertiary); margin-bottom: 5px;
}
.comment-field input,
.comment-field textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  padding: 9px 11px;
  color: var(--text-primary);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.85rem; font-weight: 300; line-height: 1.6;
  transition: border-color 0.25s ease;
  resize: vertical;
}
.comment-field textarea { min-height: 84px; }
.comment-field input:focus,
.comment-field textarea:focus { outline: none; }
.comment-field input::placeholder,
.comment-field textarea::placeholder { color: #4a4842; }

/* Honeypot — bots fill it, humans never see it */
.comment-hp { position: absolute; left: -9999px; opacity: 0; height: 0; }

.comment-turnstile { margin-top: 10px; }
.comment-note {
  display: none;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem; letter-spacing: 0.06em; line-height: 1.6;
  color: var(--accent-red); margin-top: 10px;
}
.comment-note.visible { display: block; }
.comment-chars.near-limit { color: var(--accent-red); }

.comment-form-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 12px;
}
.comment-chars {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.52rem; letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.comment-submit {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; border-radius: 4px; padding: 8px 16px;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.52rem;
  font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase;
  transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}
.comment-submit[disabled] { cursor: default; opacity: 0.5; }

.comment-list-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.52rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-tertiary); margin: 20px 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.comment-list-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border-faint);
}

.comment-item {
  display: flex; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--border-faint);
}
.comment-item:last-child { border-bottom: none; }
.comment-avatar {
  width: 30px; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.comment-main { min-width: 0; }
.comment-meta {
  display: flex; align-items: baseline; gap: 9px;
  margin-bottom: 4px; flex-wrap: wrap;
}
.comment-name {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase;
}
.comment-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem; letter-spacing: 0.06em;
  color: var(--text-tertiary);
}
.comment-body {
  font-size: 0.87rem; font-weight: 300; line-height: 1.72;
  color: var(--text-secondary);
  white-space: pre-wrap; word-break: break-word;
}
.comment-empty,
.comment-status {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem; font-style: italic;
  color: var(--text-tertiary);
  text-align: center; padding: 26px 10px 22px;
}
.comment-status.is-error { padding-bottom: 10px; }
.comment-retry-row { text-align: center; padding-bottom: 20px; }
.comment-retry {
  background: none; border: none; padding: 2px 0; cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem; letter-spacing: 0.1em; text-transform: uppercase;
  border-bottom: 1px solid currentColor;
  transition: color 0.25s ease;
}

/* Narrow phones: buy back ~24px so the Turnstile widget has room */
@media (max-width: 400px) {
  .comment-overlay { padding: 16px 10px; }
  .comment-head { padding: 14px 14px 12px; }
  .comment-scroll { padding: 16px 14px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .comment-overlay, .comment-modal { transition: none; }
  .comment-modal { transform: none; }
}

/* ===== ANIMATIONS ===== */
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes glowIn { from { opacity: 0; } to { opacity: 0.4; } }
@keyframes nodeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pageIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.page-entering { animation: pageIn 0.5s ease both; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .portal-title { font-size: 2.2rem; }
  .triangle-container { max-width: 340px; margin: 36px 0 40px; }
  .card-row-bottom { flex-direction: column; align-items: center; }
  .card-da, .card-fc { max-width: 420px; width: 100%; }
  .card { padding: 18px 20px; }
  .card-ta { max-width: 420px; }
  .card-ap, .card-lk { max-width: 420px; width: 100%; }
  .astro-cards { flex-direction: column; align-items: center; }
  .card-sse, .card-lfg { max-width: 420px; width: 100%; }
  .psych-cards { flex-direction: column; align-items: center; }
  .card-dial, .card-gf { max-width: 420px; width: 100%; }
  .card-term-psych { font-size: 0.85rem; }
  .video-section { max-width: 100%; }
  .podcast-section { max-width: 100%; }
  .origin-separator { margin: 36px 0 28px; }
}

/* ===== PENROSE PORTAL ===== */
#page-penrose.active { overflow: hidden; }
.penrose-view {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; position: relative; z-index: 1;
}
.penrose-ctr { position: relative; width: 90vmin; max-width: 720px; aspect-ratio: 1; }
#page-penrose canvas { width: 100%; height: 100%; display: block; }
.penrose-lbl {
  position: absolute; font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem; font-weight: 400; letter-spacing: 0.18em;
  text-transform: uppercase; opacity: 0; pointer-events: none;
  transition: opacity 0.8s ease, letter-spacing 0.3s ease, color 0.3s ease, text-shadow 0.3s ease;
  white-space: nowrap;
}
#penrose-lbl-meta { color: #3a6a9e; top: 2%; left: 50%; transform: translateX(-50%); }
#penrose-lbl-meta.on { opacity: 1; }
#penrose-lbl-meta.hv { color: #82c0f0; letter-spacing: 0.25em; text-shadow: 0 0 14px rgba(80,150,220,0.6); }
#penrose-lbl-astro { color: #9e3a3a; right: 0.5%; top: 50%; transform: translateY(-50%); writing-mode: vertical-rl; text-orientation: mixed; }
#penrose-lbl-astro.on { opacity: 1; }
#penrose-lbl-astro.hv { color: #f08282; letter-spacing: 0.25em; text-shadow: 0 0 14px rgba(220,80,80,0.6); }
#penrose-lbl-psych { color: #7a3a9e; bottom: 2%; left: 50%; transform: translateX(-50%); }
#penrose-lbl-psych.on { opacity: 1; }
#penrose-lbl-psych.hv { color: #c882f0; letter-spacing: 0.25em; text-shadow: 0 0 14px rgba(168,85,200,0.6); }
#penrose-lbl-null { color: #9e6a3a; left: 0.5%; top: 50%; transform: translateY(-50%) rotate(180deg); writing-mode: vertical-rl; text-orientation: mixed; }
#penrose-lbl-null.on { opacity: 1; }
@media (max-width: 600px) { .penrose-ctr { width: 96vmin; } .penrose-lbl { font-size: 0.58rem; } }

/* ===== NEON "CHOOSE YOUR PATH" ===== */
.neon-title {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Tilt Neon', sans-serif;
  font-size: clamp(1.4rem, 4.5vmin, 2.6rem);
  color: #fff;
  white-space: nowrap;
  margin-bottom: 2.5vmin;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 5px rgba(255,255,255,0.9),
    0 0 10px rgba(255,255,255,0.6),
    0 0 22px rgba(255,255,255,0.35),
    0 0 40px rgba(200,220,255,0.15),
    0 0 60px rgba(200,220,255,0.07);
  animation: neon-breathe 7s ease-in-out infinite;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.neon-title.on { opacity: 1; }
@keyframes neon-breathe {
  0%, 100% {
    text-shadow:
      0 0 5px rgba(255,255,255,0.9),
      0 0 10px rgba(255,255,255,0.6),
      0 0 22px rgba(255,255,255,0.35),
      0 0 40px rgba(200,220,255,0.15),
      0 0 60px rgba(200,220,255,0.07);
  }
  50% {
    text-shadow:
      0 0 3px rgba(255,255,255,0.7),
      0 0 7px rgba(255,255,255,0.4),
      0 0 15px rgba(255,255,255,0.2),
      0 0 30px rgba(200,220,255,0.08),
      0 0 45px rgba(200,220,255,0.03);
  }
}
@media (max-width: 600px) {
  .neon-title { margin-bottom: calc((100vh - 96vmin) / 4); }
}

/* Neon flicker effect for individual letters */
.neon-title span { display: inline-block; }
.neon-title span.neon-flicker {
  animation: neon-letter-flicker 2s infinite;
}
@keyframes neon-letter-flicker {
  0%, 100% { opacity: 1; }
  4% { opacity: 0.15; }
  6% { opacity: 0.9; }
  8% { opacity: 0.2; }
  9% { opacity: 1; }
  30% { opacity: 1; }
  32% { opacity: 0.1; }
  33% { opacity: 0.8; }
  35% { opacity: 0.12; }
  36% { opacity: 1; }
  62% { opacity: 1; }
  63% { opacity: 0.2; }
  64% { opacity: 0.9; }
  65% { opacity: 1; }
  83% { opacity: 1; }
  84% { opacity: 0.15; }
  86% { opacity: 1; }
}

/* ===== CONTACT LINE ===== */
.contact-line {
  --contact-gap: 32px;
  position: fixed;
  bottom: var(--contact-gap);
  left: 0; right: 0;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: #6b6860;
  white-space: nowrap;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
@supports (height: 100dvh) {
  .contact-line {
    top: 100dvh; bottom: auto;
    transform: translateY(calc(-100% - var(--contact-gap)));
  }
}
.contact-line.on { opacity: 1; }
.contact-line.on a { pointer-events: auto; }
.contact-line a {
  display: inline-block;
  padding: 12px 0;
  color: inherit;
  letter-spacing: inherit;
  text-decoration: none;
  transition: color 0.3s ease, letter-spacing 0.3s ease;
}
@media (hover: hover) and (pointer: fine) {
  .contact-line a:hover { color: #9e9a91; letter-spacing: 0.2em; }
}
.contact-line a:active { color: #9e9a91; }
.contact-line a:focus-visible {
  color: #9e9a91;
  outline: 1px solid #6b6860; outline-offset: 2px;
}
@media (max-width: 600px) {
  .contact-line {
    --contact-gap: calc(10px + env(safe-area-inset-bottom, 0px));
    letter-spacing: 0.08em;
    font-size: clamp(0.55rem, 3vw, 0.72rem);
  }
}
@media (prefers-reduced-motion: reduce) {
  .contact-line { transition: opacity 0.01ms linear; }
  .contact-line a { transition: color 0.3s ease; }
  .contact-line a:hover { letter-spacing: inherit; }
}

/* ===== RETURN TO TOP ===== */
.return-top {
  position: fixed; bottom: 28px; left: 28px; z-index: 900;
  width: 44px; height: 44px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(19, 19, 26, 0.92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid #2f2f3a;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s ease,
              color 0.3s ease, border-color 0.3s ease;
}
.return-top.visible {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateY(0);
}
.return-top:hover {
  color: var(--text-primary);
  border-color: var(--text-tertiary);
}
.return-top:focus-visible {
  outline: 1px solid var(--text-secondary); outline-offset: 3px;
}
.return-top svg { display: block; }
@media (max-width: 600px) {
  .return-top { bottom: 20px; left: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .return-top, .return-top.visible { transform: none; }
  .return-top {
    transition: opacity 0.01ms linear, visibility 0.01ms linear,
                color 0.3s ease, border-color 0.3s ease;
  }
}

/* ===== APERTURE MARK ===== */
.ap-mark { display: none; }

@media (min-width: 601px) and (hover: hover) and (pointer: fine) {
  .ap-mark {
    position: fixed; bottom: 28px; right: 28px; z-index: 900;
    width: 44px; height: 44px; border-radius: 2px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    background: none;
    border: 1px solid #1a1a24;
    color: #403e3a;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 1.2s ease, visibility 1.2s ease,
                color 0.3s ease, border-color 0.3s ease;
  }
  .ap-mark.visible {
    opacity: 1; visibility: visible; pointer-events: auto; cursor: pointer;
  }
  .ap-mark:hover { color: #6b6860; border-color: #222230; }
  .ap-mark svg { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .ap-mark {
    transition: opacity 0.01ms linear, visibility 0.01ms linear,
                color 0.3s ease, border-color 0.3s ease;
  }
}


/* ===== YOUTUBE RESPONSES ===== */
.yt-section { width: 100%; max-width: 420px; margin: 22px auto 0; }

.yt-body {
  background: linear-gradient(135deg, rgba(53, 107, 74, 0.06) 0%, rgba(74, 138, 101, 0.03) 100%);
  border: 1px solid #222E25;
  border-radius: 4px;
  padding: 16px 20px 14px;
}

.yt-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.52rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0 0 6px;
  display: flex; align-items: center; gap: 10px;
}
.yt-label::after { content: ''; flex: 1; height: 1px; background: var(--border-faint); }

.yt-item {
  display: flex; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--border-faint);
}
.yt-item:first-child { padding-top: 0; }
.yt-item:last-child { border-bottom: none; padding-bottom: 0; }

.yt-avatar {
  width: 30px; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.yt-main { min-width: 0; }
.yt-meta {
  display: flex; align-items: baseline; gap: 9px;
  margin-bottom: 4px; flex-wrap: wrap;
}
.yt-name {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase;
  /* `anywhere`, not `break-word`: only this value lowers the flex item's
     min-content width, which is what stops a long name widening the page. */
  overflow-wrap: anywhere;
}
.yt-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.52rem; letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.yt-text {
  font-size: 0.85rem; line-height: 1.65;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.yt-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.46rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-green-dim);
  border: 1px solid rgba(53, 107, 74, 0.3);
  border-radius: 2px; padding: 2px 5px;
  text-decoration: none;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.yt-badge:hover { color: var(--accent-green); border-color: rgba(74, 138, 101, 0.55); }

.yt-empty {
  font-size: 0.8rem; font-style: italic; line-height: 1.7;
  color: var(--text-tertiary);
  padding-top: 8px;
}
.yt-unavailable {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem; letter-spacing: 0.06em; line-height: 1.8;
  color: var(--accent-red);
  padding-top: 8px;
}

@media (max-width: 600px) {
  .yt-section { max-width: 100%; }
}

@media (max-width: 380px) {
  .yt-body { padding: 14px 14px 12px; }
  .yt-meta { gap: 7px; }
}
