/* Revive — Cognitive Ensemble Framework */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a25;
  --bg-card: #15151f;
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #7433e0;
  --accent-light: #ab84f9;
  --accent-glow: rgba(116, 51, 224, 0.3);
  --gold: #f5c542;          /* boldest emphasis: main section headings */
  --gold-halo: 0 0 18px rgba(245, 197, 66, 0.55), 0 0 44px rgba(245, 197, 66, 0.28);
  --success: #0fb489;
  --warning: #f2a112;
  --border: #2a2a3a;
  --code-bg: #1e1e2e;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 16px;
}

/* Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

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

/* Navigation */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  padding: 1rem 0;
}

nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-light);
  text-decoration: none;
}

.logo span {
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--accent-light);
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

.slideshow-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-right: 1rem;
  transition: all 0.2s;
}

.slideshow-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}

/* Slideshow Controls */
.slideshow-controls {
  display: none;
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 2rem;
  z-index: 1000;
  align-items: center;
  gap: 1.5rem;
}

body.slideshow-mode .slideshow-controls {
  display: flex;
}

.slide-nav {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-nav:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.slide-dots {
  display: flex;
  gap: 0.5rem;
}

.slide-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.slide-dot:hover {
  background: var(--text-muted);
}

.slide-dot.active {
  background: var(--accent);
  border-color: var(--accent);
}

.slide-counter {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 60px;
  text-align: center;
}

/* Slideshow Mode Styles */
body.slideshow-mode {
  overflow: hidden;
}

body.slideshow-mode nav {
  background: rgba(10, 10, 15, 0.98);
}

body.slideshow-mode .nav-links {
  display: none;
}

body.slideshow-mode section,
body.slideshow-mode .hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 5rem;
  transition: opacity 0.3s ease;
}

body.slideshow-mode .slide-hidden {
  display: none !important;
}

body.slideshow-mode .slide-active {
  display: flex !important;
}

body.slideshow-mode footer {
  display: none;
}

/* Hero Section */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 7rem 2rem 3.5rem;
  background: 
    radial-gradient(ellipse at 50% 0%, var(--accent-glow) 0%, transparent 50%),
    var(--bg-primary);
}

.hero-content {
  max-width: 800px;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  margin-bottom: 1.5rem;
  line-height: 1.1;
  color: var(--gold);
  text-shadow: var(--gold-halo);
}

.hero h1 .accent {
  color: var(--accent-light);
  text-shadow: none;   /* purple accents keep their own flat look */
}

.hero .subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero .tagline {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.hero .tagline:last-child {
  margin-bottom: 0;
}

/* Sections */
section {
  padding: 3rem 0;
  border-bottom: 1px solid var(--border);
}

/* Spacing rhythm: the few sections carrying the argument get room to breathe;
   dense reference material (long lists, spec tables, link grids) compresses.
   Without these two modifiers every section reads at the same volume. */
.section--wide {
  padding: 4.5rem 0;
}

.section--tight {
  padding: 2rem 0;
}

section:last-of-type {
  border-bottom: none;
}

.section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.section--wide .section-header {
  margin-bottom: 2.5rem;
}

.section--tight .section-header {
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--gold);
  text-shadow: var(--gold-halo);
}

.section-header h2 span {
  text-shadow: none;   /* inline purple accents inside headings stay flat */
}

.section-header p {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

@media (min-width: 981px) {
  .card-grid--3col {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  transition: transform 0.2s, border-color 0.2s;
}

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

.card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.doc-link {
  color: var(--accent-light);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-glow);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.doc-link:hover {
  color: #c8b7fd;
  border-bottom-color: var(--accent-light);
}

.card .meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

/* Persona Cards */
.persona-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.persona-avatar svg {
  color: var(--text-muted);
}

.persona-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.persona-info h3,
.persona-info h4 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.persona-info .role {
  font-size: 0.85rem;
  color: var(--accent-light);
  margin-bottom: 0.5rem;
}

.persona-info .source {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Dialogue Example */
.dialogue-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0;
}

.dialogue-header {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.dialogue-turn {
  margin-bottom: 1.5rem;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
}

.dialogue-turn.franklin {
  border-color: var(--warning);
}

.dialogue-turn.leonardo {
  border-color: var(--success);
}

.dialogue-turn.gabi {
  border-color: #ea3f93;
}

.dialogue-turn.sagan {
  border-color: #3579f2;
}

.dialogue-speaker {
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dialogue-speaker .stance {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.dialogue-speaker .stance.disagree {
  background: rgba(236, 64, 64, 0.2);
  color: #f66d6d;
}

.dialogue-speaker .stance.partial {
  background: rgba(242, 161, 18, 0.2);
  color: #f7bb1c;
}

.dialogue-speaker .stance.agree {
  background: rgba(15, 180, 137, 0.2);
  color: #2ecf94;
}

.dialogue-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.dialogue-annotation {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.dialogue-annotation::before {
  content: "// ";
  color: var(--accent);
}

/* Code Blocks */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 1.5rem 0;
}

code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

pre code {
  background: none;
  padding: 0;
}

.code-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Architecture Diagram */
.architecture-flow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 0.6rem 0.4rem;
  margin: 2rem 0;
}

.flow-step {
  flex: 1 1 160px;
  min-width: 0;
  max-width: 230px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 0.9rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.3rem;
}

.flow-step.highlight {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.flow-step h3,
.flow-step h4 {
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.25;
}

.flow-step p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin: 0;
}

/* Optional mono line for the concrete tech behind a step */
.flow-step .flow-tech {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  line-height: 1.3;
  word-break: break-word;
}

.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 1.35rem;
}

/* Stack vertically on narrow screens — arrows turn to point down.
   flex-wrap + min-width:0 above already guarantees no horizontal scroll. */
@media (max-width: 640px) {
  .architecture-flow {
    flex-direction: column;
    align-items: stretch;
  }
  .flow-step {
    max-width: none;
  }
  .flow-arrow {
    transform: rotate(90deg);
    align-self: center;
  }
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
}

.stat-box .number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-light);
  font-family: var(--font-mono);
}

.stat-box .label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Two Column Layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

/* Grid children default to min-width:auto, which lets a wide <pre>
   stretch the column past the viewport instead of scrolling inside it. */
.two-col > * {
  min-width: 0;
}

.two-col.reverse {
  direction: rtl;
}

.two-col.reverse > * {
  direction: ltr;
}

/* Callout Box */
.callout {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 1.5rem;
  margin: 2rem 0;
}

.callout.insight {
  border-color: var(--success);
}

.callout h3,
.callout h4 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.callout p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.callout p + p {
  margin-top: 0.75rem;
}

/* Footer */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 3rem 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

footer a {
  color: var(--accent-light);
  text-decoration: none;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 2.5rem;
}

.footer-brand p {
  margin-top: 0.75rem;
  max-width: 300px;
  line-height: 1.55;
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-col li {
  margin-bottom: 0.55rem;
}

.footer-col a {
  color: var(--text-secondary);
}

.footer-col a:hover {
  color: var(--accent-light);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
}

.footer-bottom p {
  margin: 0;
}

/* Active nav link (multi-page) */
.nav-links a.active {
  color: var(--accent-light);
}

/* Sub-page hero (shorter than landing hero) */
.page-hero {
  padding: 7rem 2rem 2.5rem;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 0%, var(--accent-glow) 0%, transparent 50%),
    var(--bg-primary);
}

.page-hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.15;
  color: var(--gold);
  text-shadow: var(--gold-halo);
}

.page-hero h1 .accent {
  color: var(--accent-light);
  text-shadow: none;
}

.page-hero .subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto;
}

.page-hero .tagline {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

/* Persona avatar images */
.persona-avatar img,
img.persona-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* Persona profile (full-width row on personas page) */
.persona-profile {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  align-items: start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  margin: 2rem 0;
}

.persona-profile .portrait {
  text-align: center;
}

.persona-profile .portrait img {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
}

.persona-profile .portrait .persona-name {
  font-weight: 700;
  margin-top: 1rem;
}

.persona-profile .portrait .persona-role {
  font-size: 0.85rem;
  color: var(--accent-light);
}

.persona-profile h3 {
  margin-bottom: 0.75rem;
}

.persona-profile .corpus-line {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.persona-profile blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* Biological profile (the real person behind a persona) */
.bio-profile {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border);
}

.bio-profile-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: 0.4rem;
}

.bio-profile-intro {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}

.bio-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: stretch;
}

.bio-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.bio-card-quote {
  flex: 1 1 280px;
  padding: 1.1rem 1.25rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
  font-style: italic;
}

.bio-card-quote .bio-quote-attr {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
}

.bio-card-media {
  flex: 0 0 150px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-decoration: none;
  transition: border-color 0.2s;
}

.bio-card-media:hover {
  border-color: var(--accent);
}

.bio-card-media img {
  width: 100%;
  min-height: 150px;
  flex: 1;
  object-fit: cover;
  display: block;
}

.bio-card-media .bio-caption {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0.5rem 0.6rem;
  text-align: center;
}

.bio-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.bio-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-tertiary);
  transition: border-color 0.2s, color 0.2s;
}

.bio-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.bio-link:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.tag.accent {
  border-color: var(--accent);
  color: var(--accent-light);
}

/* Chat replay widget */
.chat-replay {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0;
}

.cr-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

/* Recorded-replay marker. Deliberately not a pulsing green "live" dot: these
   transcripts are captured exemplars replayed from a static file, and the
   chrome should not imply a stream that isn't open. */
.cr-replay-dot {
  width: 0;
  height: 0;
  border-left: 7px solid var(--text-muted);
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  flex-shrink: 0;
}

.cr-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.cr-tab {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.cr-tab:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}

.cr-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.cr-topic {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.cr-messages {
  max-height: 480px;
  overflow-y: auto;
  /* Always reserve the scrollbar gutter so the track appearing/disappearing
     as messages drip in never reflows the content width (the "bounce"). */
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-right: 0.5rem;
  scroll-behavior: smooth;
}

.cr-msg {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  animation: cr-slide-in 0.3s ease;
}

@keyframes cr-slide-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Bulk-revealed messages ("Show full conversation") fade in gently
   instead of all slide-animating at once, which read as a shake. */
.cr-msg.cr-instant {
  animation: cr-fade-in 0.4s ease;
}

@keyframes cr-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cr-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--speaker-color, var(--border));
}

.cr-body {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--speaker-color, var(--border));
  border-radius: 0 8px 8px 8px;
  padding: 0.6rem 0.9rem;
  max-width: 85%;
}

.cr-meta {
  margin-bottom: 0.2rem;
}

.cr-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.cr-text {
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.cr-text .cr-verse {
  display: block;
  border-left: 2px solid var(--speaker-color, var(--accent));
  padding-left: 0.75rem;
  margin: 0.5rem 0;
  font-style: italic;
  color: var(--text-primary);
  opacity: 0.9;
}

.cr-typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: cr-bounce 1.2s infinite;
}

.cr-typing span:nth-child(2) { animation-delay: 0.15s; }
.cr-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes cr-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

.cr-controls {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.cr-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.cr-btn:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}

/* Prev/next pager at bottom of each page */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.5rem auto 2rem;
  max-width: 1000px;
  padding: 0 2rem;
}

.pager a {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.2s, transform 0.2s;
}

.pager a:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.pager .pager-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pager .pager-title {
  font-weight: 600;
  margin-top: 0.25rem;
}

.pager a.next {
  text-align: right;
}

/* Collapsible details (recreation prompts, long specs) */
details.spec {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 1.5rem 0;
  overflow: hidden;
}

details.spec summary {
  cursor: pointer;
  padding: 1.25rem 1.5rem;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: background 0.2s;
}

details.spec summary:hover {
  background: var(--bg-tertiary);
}

details.spec summary::before {
  content: "▸";
  color: var(--accent);
  transition: transform 0.2s;
}

details.spec[open] summary::before {
  transform: rotate(90deg);
}

details.spec summary .meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: auto;
}

details.spec .spec-body {
  padding: 0 1.5rem 1.5rem;
  border-top: 1px solid var(--border);
}

details.spec .spec-body > :first-child {
  margin-top: 1.5rem;
}

/* Spec part/step headings sit one level under the section h2, so they are h3s.
   Pinned to their original weight so promoting the level changed nothing visually. */
details.spec .spec-body h3 {
  font-size: 1rem;
  margin: 1.35rem 0 0.5rem;
}

/* Table styling */
table.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

table.spec-table th {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--border);
}

table.spec-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}

table.spec-table td:first-child {
  color: var(--text-primary);
  font-weight: 500;
}

/* On narrow screens a multi-column table can't shrink below its content and
   would push the whole page sideways. Instead of a horizontal scroll, each
   row becomes a self-contained card: the header row is hidden and every cell
   is labelled from its data-label attribute. */
@media (max-width: 768px) {
  table.spec-table,
  table.spec-table tbody,
  table.spec-table tr,
  table.spec-table td {
    display: block;
    width: auto;
  }

  table.spec-table thead {
    display: none;
  }

  table.spec-table tr {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
  }

  table.spec-table td {
    border: none;
    padding: 0.5rem 0;
  }

  /* Label above value, from the column header captured in data-label. */
  table.spec-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.15rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
  }

  /* First cell is the card's heading — no label, sits above a divider. */
  table.spec-table td:first-child {
    padding: 0 0 0.65rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
  }

  table.spec-table td:first-child::before {
    display: none;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 1.25rem;
  }

  .hero {
    padding: 6rem 1.5rem 2rem;
  }

  .page-hero {
    padding: 6rem 1.5rem 2rem;
  }

  section {
    padding: 2rem 0;
  }

  .section--wide {
    padding: 2.5rem 0;
  }

  .section--tight {
    padding: 1.5rem 0;
  }

  .section-header {
    margin-bottom: 1.5rem;
  }

  .section--wide .section-header {
    margin-bottom: 1.5rem;
  }

  .section--tight .section-header {
    margin-bottom: 1.25rem;
  }

  .persona-profile {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }

  .pager {
    flex-direction: column;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  /* Code blocks: wrap instead of forcing horizontal scroll */
  pre {
    white-space: pre-wrap;
    word-break: break-word;
    padding: 1rem;
    font-size: 0.8rem;
  }

  /* Chat replay: reclaim width so bubbles read naturally */
  .chat-replay {
    padding: 1rem 0.75rem;
  }

  .cr-msg {
    gap: 0.5rem;
  }

  .cr-avatar {
    width: 30px;
    height: 30px;
  }

  .cr-body {
    max-width: 100%;
    flex: 1;
    padding: 0.5rem 0.7rem;
  }

  .cr-messages {
    padding-right: 0;
    /* Bounded growth: start small instead of reserving a huge empty box
       while messages drip in, but cap the height so the page stops being
       shoved once a few messages have arrived (then they scroll inside). */
    min-height: 220px;
    max-height: 420px;
  }

  .cr-text {
    font-size: 0.88rem;
  }

  .cr-tab {
    font-size: 0.7rem;
    padding: 0.35rem 0.65rem;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    padding: 1.25rem 1.25rem;
    gap: 1.25rem;
  }

  .nav-links a {
    font-size: 1.25rem;
  }

  .nav-links.active {
    display: flex;
  }
  
  .mobile-toggle {
    display: block;
  }
  
  .two-col {
    grid-template-columns: 1fr;
  }
  
  .hero h1 {
    font-size: 2rem;
  }

  .section-header h2 {
    font-size: 1.75rem;
  }
  
  .slideshow-controls {
    padding: 0.75rem 1rem;
    gap: 1rem;
    bottom: 1rem;
  }
  
  .slide-nav {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }
  
  .slide-dot {
    width: 10px;
    height: 10px;
  }

  .form-row { grid-template-columns: 1fr; }
}

/* Buttons */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85rem 1.7rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, box-shadow 0.2s, transform 0.12s;
}
.btn:hover { background: #8746ed; box-shadow: 0 0 24px var(--accent-glow); }
.btn:active { transform: translateY(1px); }
.btn.gold { background: var(--gold); color: #1c1405; }
.btn.gold:hover { background: #ffd45e; box-shadow: 0 0 24px rgba(245, 197, 66, 0.4); }
.btn.ghost { background: transparent; border: 1px solid var(--accent); color: var(--accent-light); }
.btn.ghost:hover { background: rgba(116, 51, 224, 0.12); box-shadow: none; }

/* Forms */
.form { max-width: 640px; margin: 0 auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-field { margin-bottom: 1.25rem; }
.form-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}
.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-field textarea { resize: vertical; min-height: 140px; }
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-field .hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.35rem; }
/* Honeypot: kept in the DOM but off-screen; real users never fill it */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-actions { display: flex; align-items: center; gap: 1.25rem; margin-top: 0.5rem; flex-wrap: wrap; }
.form-status { font-size: 0.92rem; }
.form-status.ok { color: var(--success); }
.form-status.err { color: #f66d6d; }
.form-note { color: var(--text-muted); font-size: 0.85rem; margin-top: 1.75rem; text-align: center; }
