:root {
  --color-bg: #faf9f6;
  --color-surface: #ffffff;
  --color-surface-alt: #f3f1ec;
  --color-text: #1a1a1a;
  --color-text-light: #525252;
  --color-burgundy: #7a1f3d;
  --color-burgundy-dark: #5c172e;
  --color-orange: #b34700;
  --color-gold: #8c6b32;
  --color-sage: #5b7042;
  --color-border: #e5e2dc;
  --stage-bg: #070b14;
  --stage-panel: #0e1526;
  --stage-border: rgba(125, 162, 247, 0.22);
  --stage-accent: #63b3ed;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, monospace;
  --transition: all 0.22s ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  color: var(--color-orange);
}

p a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

code, pre {
  font-family: var(--font-mono);
}

p code, li code, td code {
  background: rgba(122, 31, 61, 0.07);
  color: #5a142b;
  padding: 0.14rem 0.38rem;
  border-radius: 4px;
  font-size: 0.88em;
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 2rem;
}

section {
  padding: 5.25rem 0;
}

.section-surface {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.eyebrow {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--color-orange);
  font-weight: 700;
  display: inline-block;
  margin-bottom: 0.75rem;
}

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.18;
  color: var(--color-text);
}

h1 {
  font-size: clamp(2.25rem, 4.4vw, 3.65rem);
  letter-spacing: -0.025em;
  margin-bottom: 1.15rem;
}

h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.55rem);
  letter-spacing: -0.018em;
  margin-bottom: 0.9rem;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.65rem;
}

.section-intro {
  max-width: 820px;
  margin-bottom: 2.75rem;
}

.section-intro p {
  font-size: 1.08rem;
  color: var(--color-text-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.78rem 1.45rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.96rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--color-burgundy);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--color-burgundy-dark);
  color: #ffffff;
}

.btn-secondary {
  background-color: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-burgundy);
  color: var(--color-burgundy);
}

.btn-sm {
  padding: 0.52rem 0.95rem;
  font-size: 0.86rem;
}

/* Header */
header {
  background-color: rgba(250, 249, 246, 0.95);
  backdrop-filter: blur(12px);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.logo {
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  letter-spacing: -0.01em;
}

.logo:hover {
  color: var(--color-burgundy);
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 7px;
}

.logo-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(122, 31, 61, 0.1);
  color: var(--color-burgundy);
  padding: 0.16rem 0.48rem;
  border-radius: 999px;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 1.65rem;
  align-items: center;
}

nav a {
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.94rem;
}

nav a:hover {
  color: var(--color-burgundy);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  font-size: 1.25rem;
  color: var(--color-text);
  cursor: pointer;
}

/* Hero */
.hero {
  padding-top: 8.75rem;
  padding-bottom: 3.5rem;
  background: radial-gradient(circle at 50% 0%, #ffffff 0%, var(--color-bg) 78%);
}

.hero-header {
  text-align: center;
  max-width: 920px;
  margin: 0 auto 2.5rem;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--color-text-light);
  max-width: 820px;
  margin: 0 auto 1.85rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.hero-meta {
  font-size: 0.86rem;
  color: var(--color-text-light);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  justify-content: center;
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* KPI Strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.15rem;
  margin-bottom: 2.25rem;
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.025);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: clamp(1.45rem, 2.3vw, 1.95rem);
  font-weight: 700;
  color: var(--color-burgundy);
  line-height: 1.15;
  margin-bottom: 0.25rem;
}

.kpi-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
}

.kpi-note {
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-top: 0.15rem;
}

/* Interactive 3D Hypergraph Showcase */
.showcase-shell {
  background: var(--stage-bg);
  border-radius: 14px;
  border: 1px solid #1e293b;
  box-shadow: 0 24px 54px rgba(7, 11, 20, 0.22);
  overflow: hidden;
  color: #e2e8f0;
}

.showcase-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.9rem 1.25rem;
  background: rgba(14, 21, 38, 0.96);
  border-bottom: 1px solid var(--stage-border);
}

.showcase-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #34d399;
  display: inline-block;
}

.showcase-rule-id {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  color: #f8fafc;
}

.showcase-badge {
  font-size: 0.75rem;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.3);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
}

.mode-pills, .stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.stage-btn {
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 6px;
  padding: 0.38rem 0.72rem;
  font-size: 0.79rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.stage-btn:hover {
  background: rgba(99, 179, 237, 0.2);
  color: #ffffff;
  border-color: rgba(99, 179, 237, 0.55);
}

.stage-btn.active {
  background: #7a1f3d;
  border-color: #f472b6;
  color: #ffffff;
}

.stage-btn.secondary-active {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  color: #f8fafc;
}

.showcase-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  min-height: 590px;
}

.canvas-wrap {
  position: relative;
  min-height: 590px;
  background: radial-gradient(circle at 50% 48%, #10192e 0%, #060911 78%);
  overflow: hidden;
}

#hypergraph-canvas-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.canvas-overlay-bottom {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  pointer-events: none;
}

.canvas-pill {
  background: rgba(8, 13, 24, 0.84);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  color: #cbd5e1;
  pointer-events: auto;
}

.canvas-pill strong {
  color: #f8fafc;
  font-family: var(--font-mono);
}

.shell-slider-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.shell-slider-wrap input[type="range"] {
  width: 115px;
  accent-color: #ec4899;
  cursor: pointer;
}

.showcase-sidebar {
  background: var(--stage-panel);
  border-left: 1px solid var(--stage-border);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.sidebar-block-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #93c5fd;
  font-weight: 700;
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-box {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.81rem;
  color: #cbd5e1;
  line-height: 1.48;
}

.legend-bar {
  height: 8px;
  border-radius: 999px;
  margin: 0.5rem 0 0.35rem;
  background: linear-gradient(90deg, #2563eb, #10b981, #f59e0b, #ef4444);
}

.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.telemetry-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.48rem 0.6rem;
}

.telemetry-item .k {
  display: block;
  font-size: 0.69rem;
  color: #94a3b8;
  line-height: 1.25;
}

.telemetry-item .v {
  font-family: var(--font-mono);
  font-size: 0.83rem;
  font-weight: 600;
  color: #f8fafc;
}

/* Cards & Grids */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.75rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.75rem;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.045);
}

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

.code-panel {
  background: #111622;
  color: #e2e8f0;
  border-radius: 10px;
  border: 1px solid #232d42;
  padding: 1.25rem 1.4rem;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.6;
}

.code-panel .comment {
  color: #94a3b8;
}

.code-panel .hl {
  color: #f9a8d4;
  font-weight: 600;
}

.code-panel .acc {
  color: #7dd3fc;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.91rem;
}

th, td {
  padding: 0.78rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  background: var(--color-surface-alt);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text);
}

tr:last-child td {
  border-bottom: none;
}

tr.highlight-row {
  background: rgba(122, 31, 61, 0.05);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.87rem;
}

.pill-pass {
  display: inline-block;
  padding: 0.14rem 0.52rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(91, 112, 66, 0.15);
  color: #3d5227;
}

.pill-warn {
  display: inline-block;
  padding: 0.14rem 0.52rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(179, 71, 0, 0.13);
  color: #8f3900;
}

/* Figures */
.figure-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.35rem;
  margin-top: 1.75rem;
}

.figure-card img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid #eceae4;
}

.figure-caption {
  margin-top: 0.9rem;
  font-size: 0.88rem;
  color: var(--color-text-light);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

/* Predictions */
.pred-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
}

.pred-val {
  font-family: var(--font-mono);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--color-burgundy);
  background: rgba(122, 31, 61, 0.06);
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  border-left: 3px solid var(--color-burgundy);
}

.pred-meta {
  font-size: 0.82rem;
  color: var(--color-text-light);
  border-top: 1px solid var(--color-border);
  padding-top: 0.7rem;
}

/* Scope callout */
.scope-callout {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-gold);
  border-radius: 10px;
  padding: 1.75rem 2rem;
}

.scope-callout ul {
  margin-top: 0.85rem;
  padding-left: 1.25rem;
  color: var(--color-text-light);
}

.scope-callout li {
  margin-bottom: 0.55rem;
}

/* Downloads Grid */
.download-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.15rem;
}

.download-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.file-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-gold);
  background: rgba(140, 107, 50, 0.12);
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  white-space: nowrap;
}

/* Footer (Exact match to bako.co) */
footer {
  background-color: #1a1a1a;
  color: #fff;
  padding: 4rem 0 2rem;
}

footer a {
  color: #ccc;
}

footer a:hover {
  color: #fff;
}

footer .logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: normal;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 3rem;
}

.footer-col h2 {
  color: #fff;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1.5rem;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: #a3a3a3;
}

.footer-legal {
  display: flex;
  gap: 1.5rem;
}

.footer-legal a {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Responsive */
@media (max-width: 1024px) {
  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .showcase-grid {
    grid-template-columns: 1fr;
  }
  .canvas-wrap {
    min-height: 460px;
  }
  .showcase-sidebar {
    border-left: none;
    border-top: 1px solid var(--stage-border);
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 1.25rem;
  }
  section {
    padding: 3.75rem 0;
  }
  .mobile-menu-btn {
    display: inline-block;
  }
  nav {
    display: none;
    position: absolute;
    top: 76px;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1.25rem;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  }
  nav.open {
    display: block;
  }
  nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .kpi-strip, .grid-2, .grid-3, .footer-grid {
    grid-template-columns: 1fr;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  .footer-legal {
    flex-wrap: wrap;
    justify-content: center;
  }
  .canvas-wrap {
    min-height: 390px;
  }
}
