/**
 * ResiHubAI Investor Pitch — dual theme
 * Default: parchment (day) — the storybook
 * Optional: night swamp — platform dark mode
 * Brand: gold #eeae47, teal #18b090 / #3c8c9a, cream #f5e6d3
 */

:root {
  --gold: #eeae47;
  --teal: #18b090;
  --teal-deep: #3c8c9a;
  --emerald: #10b981;
  --copper: #b87333;
  --indigo: #6366f1;
  --coral: #ef4444;
  --pink: #f472b6;
  --sidebar-w: 280px;
  --radius: 10px;
  --font-display: 'Cinzel', Georgia, serif;
  --font-body: 'Poppins', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-hand: 'Caveat', cursive;
}

/* ========== PARCHMENT (default) ========== */
body.pitch-page,
body.pitch-page.day-mode {
  --bg: #f4ecd8;
  --bg2: #fff8e7;
  --bg3: #fffef5;
  --bg-gradient: linear-gradient(165deg, #fff8e1 0%, #f4ecd8 40%, #ebe0c8 100%);
  --card-bg: rgba(255, 254, 245, 0.92);
  --border: rgba(184, 115, 51, 0.28);
  --text: #2a2420;
  --text-bright: #1a1512;
  --muted: #6b5e52;
  --sidebar-bg: rgba(255, 248, 225, 0.95);
  --topbar-bg: rgba(255, 254, 245, 0.88);
  --shadow: 0 8px 28px rgba(184, 115, 51, 0.12);
  --glow: rgba(24, 176, 144, 0.15);
  --placeholder-bg: rgba(238, 174, 71, 0.08);
  --badge-ok-bg: rgba(16, 185, 129, 0.12);
  --badge-avoid-bg: rgba(239, 68, 68, 0.1);
  --narrator-bg: linear-gradient(135deg, rgba(24, 176, 144, 0.08), rgba(255, 254, 245, 0.9));
}

/* ========== NIGHT SWAMP ========== */
body.pitch-page.night-mode {
  --bg: #060e0b;
  --bg2: #0a1612;
  --bg3: #0f1f18;
  --bg-gradient: linear-gradient(165deg, #0a1612 0%, #060e0b 50%, #0d1f1a 100%);
  --card-bg: rgba(15, 31, 24, 0.9);
  --border: #1a2e26;
  --text: #e8f0ec;
  --text-bright: #f5f9f7;
  --muted: #8fb3a0;
  --sidebar-bg: rgba(0, 0, 0, 0.88);
  --topbar-bg: rgba(0, 0, 0, 0.65);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --glow: rgba(16, 185, 129, 0.2);
  --placeholder-bg: rgba(60, 140, 154, 0.12);
  --badge-ok-bg: rgba(16, 185, 129, 0.15);
  --badge-avoid-bg: rgba(239, 68, 68, 0.15);
  --narrator-bg: linear-gradient(135deg, rgba(60, 140, 154, 0.12), rgba(0, 0, 0, 0.4));
}

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

body.pitch-page {
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  transition: background 0.5s ease, color 0.3s ease;
}

/* Partner briefs — in-page iframes (no leave-the-storybook) */
.pitch-iframe-shell {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--card-bg);
  min-height: 70vh;
}
.pitch-iframe {
  display: block;
  width: 100%;
  height: min(78vh, 900px);
  min-height: 560px;
  border: 0;
  background: #0d1b2a;
}
body.pitch-page.day-mode .pitch-iframe {
  background: #fffef5;
}
@media (max-width: 720px) {
  .pitch-iframe {
    height: 72vh;
    min-height: 420px;
  }
}

/* Layout */
.menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--teal);
  font-size: 1.2em;
  cursor: pointer;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99;
}
.sidebar-backdrop.open { display: block; }

.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  padding: 24px 18px;
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.sidebar-logo { margin-bottom: 20px; }
.sidebar-logo-title {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 0.95em;
  letter-spacing: 2px;
  line-height: 1.35;
}
.sidebar-logo-sub {
  font-size: 0.72em;
  color: var(--muted);
  letter-spacing: 1px;
  margin-top: 4px;
}
.nav-label {
  font-size: 0.68em;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 18px 0 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.84em;
  color: var(--muted);
  transition: all 0.2s;
  margin-bottom: 2px;
  text-decoration: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.nav-item:hover {
  background: var(--glow);
  color: var(--text-bright);
}
.nav-item.active {
  background: rgba(24, 176, 144, 0.15);
  color: var(--teal);
  border-left: 3px solid var(--teal);
}
.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
}
.nav-item.active .nav-dot { background: var(--teal); }

.agents-section {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.agents-label {
  font-size: 0.68em;
  color: var(--muted);
  letter-spacing: 2px;
  margin-bottom: 10px;
}
.agents-row { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  object-fit: cover;
  transition: transform 0.2s, box-shadow 0.2s;
  pointer-events: auto;
}
.agent-icon:hover { transform: scale(1.12); box-shadow: 0 0 0 3px rgba(24, 176, 144, 0.35); }

/* Live connection chrome */
.talk-resi-btn {
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.88em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
  white-space: nowrap;
}
.talk-resi-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.live-connect-banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 16px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(13, 148, 136, 0.45);
  background: rgba(13, 148, 136, 0.1);
  color: var(--text);
}
.live-connect-banner strong { color: var(--teal); font-size: 1rem; }
.live-connect-banner span { font-size: 0.88em; color: var(--muted); }
.story-hero-art-only { opacity: 0.95; }
.story-hero-art-only .story-hero-caption { font-style: italic; }

/* Resi phone must sit above pitch chrome */
body.pitch-page #resi-floating-widget,
body.pitch-page #resi-nuclear-phone {
  z-index: 1000500 !important;
  pointer-events: auto !important;
}
body.pitch-page #resi-floating-widget {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  width: calc(100vw - var(--sidebar-w));
}
.top-bar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
}
.top-bar-title {
  font-family: var(--font-display);
  font-size: 0.95em;
  color: var(--gold);
  letter-spacing: 1px;
}
.top-bar-sub { font-size: 0.78em; color: var(--muted); margin-top: 2px; }
.top-bar-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--text);
  box-shadow: var(--shadow);
}
.theme-toggle:hover { border-color: var(--gold); }
.live-badge {
  background: var(--badge-ok-bg);
  border: 1px solid var(--emerald);
  color: var(--emerald);
  font-size: 0.72em;
  letter-spacing: 1.5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 600;
}
.truth-badge {
  font-size: 0.65em;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 6px;
}
.truth-badge.verified {
  background: var(--badge-ok-bg);
  color: var(--emerald);
  border: 1px solid var(--emerald);
}
.truth-badge.model {
  background: rgba(238, 174, 71, 0.15);
  color: var(--gold);
  border: 1px solid var(--gold);
}
.truth-badge.projected {
  background: rgba(99, 102, 241, 0.12);
  color: var(--indigo);
  border: 1px solid var(--indigo);
}
.truth-badge.pilot {
  background: rgba(24, 176, 144, 0.12);
  color: var(--teal-deep);
  border: 1px solid var(--teal-deep);
}

.content {
  padding: 36px 44px 64px;
  width: 100%;
  max-width: 1100px;
}
.tab-section { display: none; }
.tab-section.active { display: block; animation: fadeIn 0.35s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.sec-header { margin-bottom: 28px; }
.sec-title {
  font-family: var(--font-display);
  font-size: 1.45em;
  color: var(--gold);
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.sec-sub { font-size: 0.9em; color: var(--muted); }
.divider {
  height: 1px;
  background: var(--border);
  margin: 28px 0;
}

/* Cards */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}
.kpi-val {
  font-family: var(--font-display);
  font-size: 1.55em;
  color: var(--gold);
  margin-bottom: 4px;
}
.kpi-label {
  font-size: 0.72em;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text);
}
.kpi-sub { font-size: 0.72em; color: var(--muted); margin-top: 4px; }

.resi-narrator {
  background: var(--narrator-bg);
  border: 1px solid var(--teal);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.resi-narrator-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.resi-narrator-header img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--teal);
  object-fit: cover;
}
.resi-narrator-name {
  font-family: var(--font-display);
  font-size: 0.95em;
  color: var(--teal-deep);
}
body.night-mode .resi-narrator-name { color: var(--teal); }
.resi-narrator-role { font-size: 0.78em; color: var(--muted); }
.resi-narrator-dialogue {
  font-size: 1.02em;
  color: var(--text-bright);
  line-height: 1.85;
}
.resi-narrator-dialogue em {
  color: var(--gold);
  font-style: normal;
  font-weight: 600;
}

.agent-quote {
  background: var(--card-bg);
  border-left: 4px solid var(--border);
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
  margin: 20px 0;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: var(--shadow);
}
.agent-quote img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.agent-quote-name {
  font-family: var(--font-display);
  font-size: 0.85em;
  color: var(--gold);
  margin-bottom: 4px;
}
.agent-quote-text { font-size: 0.92em; color: var(--text); line-height: 1.7; }
.agent-quote-text em { color: var(--teal-deep); font-style: normal; font-weight: 600; }
body.night-mode .agent-quote-text em { color: var(--teal); }

.highlight-box {
  background: var(--card-bg);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 22px 0;
  box-shadow: var(--shadow);
}
.highlight-label {
  font-family: var(--font-display);
  font-size: 0.8em;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 8px;
}

.pain-grid,
.revenue-grid,
.claim-grid,
.phase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.pain-card,
.revenue-card,
.claim-card,
.phase-card,
.info-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.pain-card.before { border-top: 3px solid var(--coral); }
.pain-card.after { border-top: 3px solid var(--emerald); }
.pain-icon { font-size: 1.6em; margin-bottom: 8px; }
.pain-role {
  font-size: 0.7em;
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
}
.pain-title {
  font-family: var(--font-display);
  color: var(--gold);
  margin: 6px 0;
  font-size: 1em;
}
.pain-desc { font-size: 0.88em; color: var(--text); }

.revenue-arm {
  font-family: var(--font-mono);
  font-size: 0.7em;
  color: var(--teal);
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.revenue-name {
  font-family: var(--font-display);
  color: var(--gold);
  margin-bottom: 6px;
}
.revenue-desc { font-size: 0.85em; color: var(--text); }
.arm-status {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.65em;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.arm-status.core { color: var(--emerald); border-color: var(--emerald); }
.arm-status.attach { color: var(--gold); border-color: var(--gold); }
.arm-status.gtm { color: var(--teal-deep); border-color: var(--teal); }
.arm-status.option { color: var(--indigo); border-color: var(--indigo); }

.screenshot-frame {
  background: var(--placeholder-bg);
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 28px 22px;
  margin: 22px 0;
  text-align: center;
}
.screenshot-frame.has-img {
  border-style: solid;
  padding: 0;
  overflow: hidden;
}
.screenshot-frame img {
  width: 100%;
  display: block;
  border-radius: 10px;
}
.frame-icon { font-size: 2em; color: var(--gold); margin-bottom: 8px; }
.frame-title {
  font-family: var(--font-display);
  color: var(--gold);
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.frame-desc { font-size: 0.88em; color: var(--muted); max-width: 520px; margin: 0 auto; }
.frame-caption {
  font-family: var(--font-hand);
  font-size: 1.25em;
  color: var(--copper);
  margin-top: 10px;
}
body.night-mode .frame-caption { color: var(--gold); }

.workflow-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 18px 0;
  font-family: var(--font-mono);
  font-size: 0.82em;
  line-height: 1.9;
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.workflow-title {
  font-family: var(--font-display);
  color: var(--gold);
  margin-bottom: 12px;
  font-size: 1.05em;
}
.workflow-box .agent { color: var(--teal-deep); font-weight: 600; }
body.night-mode .workflow-box .agent { color: var(--teal); }
.workflow-box .user { color: var(--gold); }
.workflow-box .action { color: var(--muted); }
.workflow-box .arrow { color: var(--muted); }

.phase-id {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--teal);
  font-size: 0.9em;
}
.phase-name {
  font-family: var(--font-display);
  color: var(--gold);
  margin: 4px 0 8px;
}
.phase-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.phase-node {
  font-size: 0.72em;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--glow);
  border: 1px solid var(--border);
  color: var(--text);
}

.claim-card.ok { border-top: 3px solid var(--emerald); }
.claim-card.avoid { border-top: 3px solid var(--coral); }
.claim-card h3 {
  font-family: var(--font-display);
  font-size: 0.95em;
  margin-bottom: 10px;
}
.claim-card.ok h3 { color: var(--emerald); }
.claim-card.avoid h3 { color: var(--coral); }
.claim-card ul {
  list-style: none;
  font-size: 0.85em;
}
.claim-card li {
  padding: 5px 0 5px 18px;
  position: relative;
  color: var(--text);
}
.claim-card.ok li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--emerald);
}
.claim-card.avoid li::before {
  content: '×';
  position: absolute;
  left: 0;
  color: var(--coral);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
  margin: 16px 0;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
}
.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  background: rgba(238, 174, 71, 0.12);
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.5px;
}
.data-table tr:last-child td { border-bottom: none; }

.agent-roster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.agent-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s;
}
.agent-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--teal);
}
.agent-card img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}
.agent-card-name {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 0.9em;
}
.agent-card-role { font-size: 0.78em; color: var(--muted); }

.story-chapter {
  border-left: 3px solid var(--gold);
  padding: 4px 0 4px 16px;
  margin: 18px 0;
}
.story-chapter h3 {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 1.05em;
  margin-bottom: 6px;
}
.story-chapter p { color: var(--text); font-size: 0.95em; }

.hand-note {
  font-family: var(--font-hand);
  font-size: 1.35em;
  color: var(--copper);
  text-align: center;
  margin: 24px 0;
}
body.night-mode .hand-note { color: var(--gold); }

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: block; }
  .main { margin-left: 0; width: 100%; }
  .content { padding: 24px 18px 48px; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .top-bar { padding: 14px 18px 14px 56px; }
}

/* ========== Story walk · infographic chapters (2026-07-22) ========== */
.story-hero {
  margin: 0 0 18px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--card-bg);
}
.story-hero img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(72vh, 820px);
  object-fit: contain;
  background: var(--bg2);
}
.story-hero-caption {
  font-size: 0.78em;
  color: var(--muted);
  padding: 8px 14px 12px;
  border-top: 1px solid var(--border);
}
.pitch-tour-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--narrator-bg);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
}
.pitch-tour-bar .tour-meta {
  flex: 1 1 160px;
  min-width: 140px;
}
.pitch-tour-bar .tour-meta strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95em;
  color: var(--text-bright);
}
.pitch-tour-bar .tour-meta span {
  font-size: 0.75em;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.pitch-tour-bar .tour-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pitch-tour-bar button {
  font-family: var(--font-body);
  font-size: 0.8em;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 8px 14px;
  cursor: pointer;
  background: var(--card-bg);
  color: var(--text-bright);
  transition: border-color 0.15s, transform 0.15s;
}
.pitch-tour-bar button:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}
.pitch-tour-bar button.primary {
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  color: #fff;
  border-color: transparent;
}
.pitch-tour-bar button[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--gold);
}
.nav-item .nav-num {
  font-size: 0.7em;
  font-weight: 700;
  color: var(--gold);
  min-width: 1.4em;
}
.tab-section .sec-title .walk-badge {
  display: inline-block;
  font-size: 0.55em;
  vertical-align: middle;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(24, 176, 144, 0.12);
  color: var(--teal);
  letter-spacing: 0.06em;
}
