/* ========== SHARED LIGHT THEME ========== */
/* Include this in all pages: <link rel="stylesheet" href="/shared-theme.css"> */

/* Variable overrides — html[data-theme] beats :root specificity */
html[data-theme="light"] {
  --bg: #f8f9fc;
  --card: #ffffff;
  --card-hover: #f0f4f8;
  --text: #1a1a2e;
  --muted: rgba(0, 0, 0, 0.55);
  --border: rgba(0, 0, 0, 0.08);
  --accent: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.12);
  color-scheme: light;
}

/* ---- Inline color overrides: white text → dark text ---- */
/* Hex white */
html[data-theme="light"] [style*="color:#fff"],
html[data-theme="light"] [style*="color: #fff"],
html[data-theme="light"] [style*="color:#FFF"],
html[data-theme="light"] [style*="color: #FFF"],
html[data-theme="light"] [style*="color:white"],
html[data-theme="light"] [style*="color: white"] {
  color: #1a1a2e !important;
}
/* Catch-ALL white rgba — covers every opacity value (0.1 through 0.99) */
/* Matches both "rgba(255,255,255," (compact) and "rgba(255, 255, 255," (spaced) */
html[data-theme="light"] [style*="color:rgba(255,255,255,"],
html[data-theme="light"] [style*="color: rgba(255,255,255,"],
html[data-theme="light"] [style*="color:rgba(255, 255, 255,"],
html[data-theme="light"] [style*="color: rgba(255, 255, 255,"] {
  color: rgba(0, 0, 0, 0.55) !important;
}
/* High-opacity white text (0.6+) gets darker */
html[data-theme="light"] [style*="color:rgba(255,255,255,0.6"],
html[data-theme="light"] [style*="color: rgba(255,255,255,0.6"],
html[data-theme="light"] [style*="color:rgba(255, 255, 255, 0.6"],
html[data-theme="light"] [style*="color: rgba(255, 255, 255, 0.6"],
html[data-theme="light"] [style*="color:rgba(255,255,255,0.7"],
html[data-theme="light"] [style*="color: rgba(255,255,255,0.7"],
html[data-theme="light"] [style*="color:rgba(255, 255, 255, 0.7"],
html[data-theme="light"] [style*="color: rgba(255, 255, 255, 0.7"],
html[data-theme="light"] [style*="color:rgba(255,255,255,0.8"],
html[data-theme="light"] [style*="color: rgba(255,255,255,0.8"],
html[data-theme="light"] [style*="color:rgba(255, 255, 255, 0.8"],
html[data-theme="light"] [style*="color: rgba(255, 255, 255, 0.8"],
html[data-theme="light"] [style*="color:rgba(255,255,255,0.9"],
html[data-theme="light"] [style*="color: rgba(255,255,255,0.9"],
html[data-theme="light"] [style*="color:rgba(255, 255, 255, 0.9"],
html[data-theme="light"] [style*="color: rgba(255, 255, 255, 0.9"] {
  color: rgba(0, 0, 0, 0.7) !important;
}

/* ---- Inline background overrides ---- */
html[data-theme="light"] [style*="background:#0a0a0a"],
html[data-theme="light"] [style*="background: #0a0a0a"],
html[data-theme="light"] [style*="background:#0d0d0d"],
html[data-theme="light"] [style*="background: #0d0d0d"],
html[data-theme="light"] [style*="background:#080c10"],
html[data-theme="light"] [style*="background: #080c10"] {
  background: #f0f4f8 !important;
}
html[data-theme="light"] [style*="background:#1a1a1a"],
html[data-theme="light"] [style*="background: #1a1a1a"],
html[data-theme="light"] [style*="background:#141414"],
html[data-theme="light"] [style*="background: #141414"],
html[data-theme="light"] [style*="background:#111"],
html[data-theme="light"] [style*="background: #111"],
html[data-theme="light"] [style*="background:#0c1629"],
html[data-theme="light"] [style*="background: #0c1629"] {
  background: #ffffff !important;
}
/* Catch-ALL white rgba backgrounds */
html[data-theme="light"] [style*="background:rgba(255,255,255,"],
html[data-theme="light"] [style*="background: rgba(255,255,255,"],
html[data-theme="light"] [style*="background:rgba(255, 255, 255,"],
html[data-theme="light"] [style*="background: rgba(255, 255, 255,"] {
  background: rgba(0, 0, 0, 0.04) !important;
}
html[data-theme="light"] [style*="background:rgba(10,10,10,0.85)"],
html[data-theme="light"] [style*="background:rgba(10, 10, 10, 0.85)"],
html[data-theme="light"] [style*="background:rgba(10,10,10,0.9)"],
html[data-theme="light"] [style*="background: rgba(10,10,10,0.9)"],
html[data-theme="light"] [style*="background:rgba(10, 10, 10, 0.9)"],
html[data-theme="light"] [style*="background: rgba(10, 10, 10, 0.9)"] {
  background: rgba(255, 255, 255, 0.92) !important;
}
html[data-theme="light"] [style*="background:rgba(0,0,0,0.3)"] {
  background: rgba(0, 0, 0, 0.06) !important;
}

/* Inline gradient overrides — both "background:" and "background: " variants */
html[data-theme="light"] [style*="background:linear-gradient(160deg, #1a1a1a"],
html[data-theme="light"] [style*="background: linear-gradient(160deg, #1a1a1a"] {
  background: linear-gradient(160deg, #ffffff, #edf1f7) !important;
}
html[data-theme="light"] [style*="background:linear-gradient(135deg, #101828"],
html[data-theme="light"] [style*="background: linear-gradient(135deg, #101828"],
html[data-theme="light"] [style*="background:linear-gradient(160deg, #101828"],
html[data-theme="light"] [style*="background: linear-gradient(160deg, #101828"] {
  background: linear-gradient(135deg, #edf1f7, #e0e7f1) !important;
}
html[data-theme="light"] [style*="background:linear-gradient(135deg, #141414"],
html[data-theme="light"] [style*="background: linear-gradient(135deg, #141414"] {
  background: linear-gradient(135deg, #f0f4f8, #edf1f7) !important;
}
html[data-theme="light"] [style*="background:linear-gradient(180deg, var(--bg)"],
html[data-theme="light"] [style*="background: linear-gradient(180deg, var(--bg)"] {
  background: linear-gradient(180deg, #f8f9fc 0%, #edf1f7 100%) !important;
}
html[data-theme="light"] [style*="background:linear-gradient(135deg, var(--card)"],
html[data-theme="light"] [style*="background: linear-gradient(135deg, var(--card)"] {
  background: linear-gradient(135deg, #ffffff, #f0f4f8) !important;
}

/* ---- Inline border overrides ---- */
/* Catch-ALL white rgba borders */
html[data-theme="light"] [style*="border:1px solid rgba(255,255,255,"],
html[data-theme="light"] [style*="border: 1px solid rgba(255,255,255,"],
html[data-theme="light"] [style*="border:1px solid rgba(255, 255, 255,"],
html[data-theme="light"] [style*="border: 1px solid rgba(255, 255, 255,"] {
  border-color: rgba(0, 0, 0, 0.1) !important;
}
html[data-theme="light"] [style*="border-bottom:1px solid rgba(255,255,255,"],
html[data-theme="light"] [style*="border-bottom: 1px solid rgba(255,255,255,"],
html[data-theme="light"] [style*="border-bottom:1px solid rgba(255, 255, 255,"],
html[data-theme="light"] [style*="border-bottom: 1px solid rgba(255, 255, 255,"] {
  border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}

/* ---- Common class overrides ---- */

/* Nav (all variants) */
html[data-theme="light"] .nav,
html[data-theme="light"] .fm-nav,
html[data-theme="light"] .top-nav {
  background: rgba(255, 255, 255, 0.92) !important;
  border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}
html[data-theme="light"] .nav a,
html[data-theme="light"] .fm-nav a,
html[data-theme="light"] .top-nav a {
  color: rgba(0, 0, 0, 0.55) !important;
}
html[data-theme="light"] .nav a:hover,
html[data-theme="light"] .fm-nav a:hover,
html[data-theme="light"] .top-nav a:hover {
  color: #1a1a2e !important;
}
html[data-theme="light"] .nav-brand,
html[data-theme="light"] .nav-brand:hover {
  color: #1a1a2e !important;
}
html[data-theme="light"] .nav-cta,
html[data-theme="light"] .nav-cta:hover {
  color: #fff !important;
}

/* Body background */
html[data-theme="light"] body {
  background: #f8f9fc !important;
  color: #1a1a2e !important;
}

/* Common section/header text */
html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] h4 {
  color: #1a1a2e;
}

/* Card backgrounds (various class names across pages) */
html[data-theme="light"] .chart-card,
html[data-theme="light"] .big-stat,
html[data-theme="light"] .geo-card,
html[data-theme="light"] .mix-card,
html[data-theme="light"] .unit-card,
html[data-theme="light"] .runway-card,
html[data-theme="light"] .stat-box,
html[data-theme="light"] .col-card,
html[data-theme="light"] .prod-card,
html[data-theme="light"] .team-card,
html[data-theme="light"] .win-card,
html[data-theme="light"] .moat-card,
html[data-theme="light"] .matrix-quad,
html[data-theme="light"] .corp-note,
html[data-theme="light"] .ask-section,
html[data-theme="light"] .position-box,
html[data-theme="light"] .tl-row,
html[data-theme="light"] .fm-card,
html[data-theme="light"] .deal-card,
html[data-theme="light"] .terms-card,
html[data-theme="light"] .calc-card,
html[data-theme="light"] .scenario-card {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Stat values */
html[data-theme="light"] .big-stat .val,
html[data-theme="light"] .big-stat .label,
html[data-theme="light"] .big-stat .sub {
  color: #1a1a2e;
}
html[data-theme="light"] .big-stat .val.green { color: #16a34a; }
html[data-theme="light"] .big-stat .val.amber { color: #d97706; }

/* Desc / muted text */
html[data-theme="light"] .desc,
html[data-theme="light"] .section .desc,
html[data-theme="light"] .dash-header p {
  color: rgba(0, 0, 0, 0.55);
}
html[data-theme="light"] .eyebrow,
html[data-theme="light"] .dash-header .eyebrow {
  color: var(--accent);
}

/* Tables */
html[data-theme="light"] .comp-table {
  background: #ffffff;
}
html[data-theme="light"] .comp-table th {
  background: rgba(0, 0, 0, 0.03) !important;
  color: #1a1a2e !important;
}
html[data-theme="light"] .comp-table td {
  border-bottom-color: rgba(0, 0, 0, 0.06) !important;
  color: #1a1a2e;
}
html[data-theme="light"] .comp-table .us {
  background: rgba(37, 99, 235, 0.04) !important;
}
html[data-theme="light"] .comp-table .us td {
  color: #1a1a2e !important;
}

/* Financial model specific */
html[data-theme="light"] .fm-table th,
html[data-theme="light"] .assume-card,
html[data-theme="light"] .metric-card {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}
html[data-theme="light"] .fm-table td {
  border-bottom-color: rgba(0, 0, 0, 0.06) !important;
  color: #1a1a2e;
}
html[data-theme="light"] .fm-table .total-row {
  background: rgba(37, 99, 235, 0.04) !important;
}

/* Timeline / bars */
html[data-theme="light"] .tl-bar-wrap {
  background: rgba(0, 0, 0, 0.06) !important;
}

/* Footer */
html[data-theme="light"] footer,
html[data-theme="light"] .footer,
html[data-theme="light"] .dash-footer {
  border-top-color: rgba(0, 0, 0, 0.08) !important;
  color: rgba(0, 0, 0, 0.3) !important;
}
html[data-theme="light"] footer p,
html[data-theme="light"] .footer p,
html[data-theme="light"] .dash-footer p {
  color: rgba(0, 0, 0, 0.3) !important;
}

/* Links */
html[data-theme="light"] a.link-secondary {
  color: rgba(0, 0, 0, 0.5) !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
}
html[data-theme="light"] a.link-secondary:hover {
  color: #1a1a2e !important;
}

/* Competitive matrix */
html[data-theme="light"] .matrix-container {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}
html[data-theme="light"] .matrix-label-x,
html[data-theme="light"] .matrix-label-y {
  color: rgba(0, 0, 0, 0.4) !important;
}
html[data-theme="light"] .m-name {
  color: #1a1a2e;
}

/* Founder page */
html[data-theme="light"] .photo-frame {
  background: linear-gradient(135deg, #ffffff, #edf1f7) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}
html[data-theme="light"] .timeline-item {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}
html[data-theme="light"] .belief-card {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

/* Gate / password pages */
html[data-theme="light"] .gate-card {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}
html[data-theme="light"] .gate-card input {
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: #1a1a2e !important;
}
html[data-theme="light"] .gate-card input::placeholder {
  color: rgba(0, 0, 0, 0.3) !important;
}

/* Deal terms calculator */
html[data-theme="light"] .calc-input {
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: #1a1a2e !important;
}
html[data-theme="light"] .calc-label {
  color: rgba(0, 0, 0, 0.55) !important;
}
html[data-theme="light"] .calc-result {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

/* Stacked chart light */
html[data-theme="light"] .stack-label,
html[data-theme="light"] .stack-total,
html[data-theme="light"] .bar-label,
html[data-theme="light"] .bar-val,
html[data-theme="light"] .tl-period,
html[data-theme="light"] .tl-metric {
  color: #1a1a2e;
}
html[data-theme="light"] .tl-metric .delta {
  color: var(--accent);
}

/* Legend */
html[data-theme="light"] .chart-legend,
html[data-theme="light"] .legend-item {
  color: rgba(0, 0, 0, 0.55);
}

/* Tech deep dive */
html[data-theme="light"] pre,
html[data-theme="light"] code {
  background: rgba(0, 0, 0, 0.04) !important;
  color: #1a1a2e;
}
html[data-theme="light"] .diagram {
  background: rgba(0, 0, 0, 0.02) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

/* ========== THEME TOGGLE BUTTON ========== */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10002;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}
.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.theme-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}
.theme-toggle:hover svg {
  transform: rotate(15deg);
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
html[data-theme="light"] .theme-toggle .icon-sun { display: block; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }
html[data-theme="light"] .theme-toggle {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* ========== MOBILE NAV FIX ========== */
@media (max-width: 600px) {
  .nav, .fm-nav, .top-nav {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  .nav-brand span,
  .nav-brand .page-label {
    display: none !important;
  }
  .nav > div, .fm-nav > div, .top-nav > div {
    gap: 10px !important;
    font-size: 12px !important;
  }
  .nav a, .fm-nav a, .top-nav a {
    font-size: 12px !important;
  }
  .nav-cta {
    font-size: 11px !important;
    padding: 5px 10px !important;
  }
}

/* ========== COMPETITIVE TABLE MOBILE SCROLL ========== */
@media (max-width: 600px) {
  .comp-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -20px;
    padding: 0 20px;
  }
  .comp-table {
    min-width: 700px;
  }
}

/* ========== COMPREHENSIVE MOBILE FIX (≤480px) ========== */
@media (max-width: 480px) {
  /* --- Padding reduction --- */
  .container { padding-left: 16px !important; padding-right: 16px !important; }
  .dash-header { padding-top: 80px !important; padding-bottom: 24px !important; }
  .section { padding-left: 16px !important; padding-right: 16px !important; }
  .demo-hero { padding: 80px 16px 32px !important; }
  .demo-container { padding: 16px !important; }
  .founder-hero { padding: 80px 16px 40px !important; }

  /* --- All known grid classes → single column --- */
  .big-stats, .geo-grid, .mix-grid, .unit-grid,
  .deal-grid, .metric-row, .stat-strip, .product-row,
  .win-grid, .moat-grid, .flash-grid, .stats-bar,
  .assume-grid, .two-col, .calc-input-row,
  .beliefs-grid, .qa-grid, .do-dont {
    grid-template-columns: 1fr !important;
  }

  /* --- Inline grids with 3+ columns → single column --- */
  [style*="grid-template-columns:repeat(3"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns:repeat(4"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns:repeat(5"],
  [style*="grid-template-columns: repeat(5"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Tables → horizontally scrollable --- */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  /* --- Hero stats flex → stack vertically --- */
  .hero-stats {
    flex-direction: column !important;
    gap: 16px !important;
    align-items: center !important;
  }

  /* --- Timeline rows compact --- */
  .tl-row {
    grid-template-columns: 60px 1fr 60px !important;
    gap: 8px !important;
    font-size: 13px !important;
  }

  /* --- Founder photo smaller --- */
  .hero-right { width: 150px !important; }
  .photo-frame { width: 150px !important; height: 150px !important; }

  /* --- Links bar stack --- */
  .links-bar {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .links-bar a {
    text-align: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* --- Dataroom sidebar gone, full width --- */
  .dr-layout { grid-template-columns: 1fr !important; }
  .dr-sidebar { display: none !important; }
  .dr-header h1 { font-size: 28px !important; }
  .dr-nav { padding: 12px 16px !important; }

  /* --- BD tracker table compact --- */
  td.firm-cell { min-width: 120px !important; }
  td.contact-cell { min-width: 100px !important; }

  /* --- Reduce large headings --- */
  .dash-header h1 { font-size: 28px !important; }

  /* --- Matrix positioning fix --- */
  .matrix-wrap { margin-left: 0 !important; max-width: 100% !important; }
  .matrix-label-y { display: none !important; }
  .matrix-label-x { font-size: 11px !important; }

  /* --- Mobile nav: stack logo + scrollable link strip --- */
  nav, nav.nav, nav.fm-nav, nav.top-nav, nav.dr-nav {
    flex-wrap: wrap !important;
    padding: 8px 16px !important;
    gap: 4px !important;
  }
  /* Logo/brand: full width, left-aligned */
  nav > a:first-child, .nav-brand {
    width: 100% !important;
    font-size: 13px !important;
    padding-bottom: 4px !important;
  }
  .nav-brand span { display: none !important; }
  /* Link container: horizontal scroll strip */
  nav > div, .nav > div, .fm-nav > div, .top-nav > div, .dr-nav > div {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;
    padding: 2px 0 !important;
    scrollbar-width: none !important;
  }
  nav > div::-webkit-scrollbar,
  .nav > div::-webkit-scrollbar { display: none !important; }
  /* All nav links: smaller, no-wrap */
  nav a, .nav a, .fm-nav a, .top-nav a, .dr-nav a {
    font-size: 12px !important;
    white-space: nowrap !important;
  }
  /* CTA button compact */
  .nav-cta {
    padding: 5px 10px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }
  /* Index nav dropdown: hide on mobile, show direct links only */
  .nav-dropdown-menu { display: none !important; }

  /* --- TOC hide on mobile --- */
  .toc { display: none !important; }

  /* --- Scenario boxes compact --- */
  .scenario { padding: 12px !important; }
  .scenario-card { padding: 16px !important; }

  /* --- CTA section compact --- */
  .cta-box { padding: 40px 16px !important; }

  /* --- Deal grid: 1 column on mobile --- */
  .deal-grid { grid-template-columns: 1fr !important; }

  /* --- 2-column grids that still need stacking --- */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:repeat(2"],
  [style*="grid-template-columns: repeat(2"] {
    grid-template-columns: 1fr !important;
  }
}
