/* ============================================================
   NEXUS v2 — Sci-Fi Holographic Presentation
   Design tokens + glassmorphism + scroll-snap
   ============================================================ */

:root {
  /* Backgrounds */
  --bg-0: #02030A;
  --bg-1: #0A0E2A;
  --bg-2: #050813;

  /* Accent palette */
  --cyan:    #00E5FF;  /* orchestrator */
  --purple:  #B967FF;  /* agents */
  --gold:    #FFD166;  /* tools / data */
  --teal:    #06FFA5;  /* success / wiki */
  --magenta: #FF3CAC;  /* alerts / HITL */

  /* Text */
  --text:      #EAF2FF;
  --text-dim:  #9FB0D0;
  --text-faint:#6678A0;

  /* Glass */
  --glass-bg:     rgba(255,255,255,0.04);
  --glass-bg-2:   rgba(255,255,255,0.06);
  --glass-border: rgba(255,255,255,0.08);

  /* Fonts */
  --f-title: 'Space Grotesk', system-ui, sans-serif;
  --f-body:  'Inter', system-ui, sans-serif;
  --f-mono:  'JetBrains Mono', ui-monospace, monospace;

  /* Spacing */
  --pad-slide: clamp(2rem, 5vw, 5.5rem);
}

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

html, body { height: 100%; }

body {
  font-family: var(--f-body);
  color: var(--text);
  background: var(--bg-2);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Fixed background layers ---------- */
.bg-space {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(120% 90% at 50% 0%, #0A0E2A 0%, #050813 55%, #02030A 100%);
}
.bg-hex {
  position: fixed; inset: 0; z-index: 1;
  opacity: 0.06; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cpath d='M28 0L56 16v34L28 66 0 50V16z M28 66l28 16v18M28 66L0 82v18' fill='none' stroke='%2300E5FF' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 56px 100px;
}
#bg-stars {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
}

/* ---------- Scroll-snap container ---------- */
#deck {
  position: relative; z-index: 3;
  height: 100vh; width: 100vw;
  overflow-y: scroll; overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
#deck::-webkit-scrollbar { display: none; }

.slide {
  position: relative;
  height: 100vh; width: 100vw;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex; flex-direction: column;
  padding: var(--pad-slide);
  overflow: hidden;
}

/* Per-slide 3D canvas mount */
.scene {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
}
.slide-inner {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  height: 100%;
  width: 100%;
  pointer-events: none;
}
.slide-inner > * { pointer-events: auto; }

/* ---------- Typography ---------- */
.kicker {
  font-family: var(--f-mono);
  font-size: 0.72rem; letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.9rem;
}
h1.title {
  font-family: var(--f-title);
  font-weight: 700;
  font-size: clamp(1.9rem, 4.2vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  max-width: 18ch;
}
.subtitle {
  font-size: clamp(0.95rem, 1.5vw, 1.2rem);
  color: var(--text-dim);
  margin-top: 0.7rem;
  max-width: 60ch;
  line-height: 1.45;
}

/* ---------- HUD: slide number / dots ---------- */
.slide-num {
  position: absolute; top: var(--pad-slide); right: var(--pad-slide);
  font-family: var(--f-mono);
  font-size: 0.78rem; letter-spacing: 0.18em;
  color: var(--text-faint); z-index: 5;
}
.scroll-hint {
  position: absolute; bottom: 2rem; right: var(--pad-slide);
  font-family: var(--f-mono); font-size: 0.78rem;
  color: var(--cyan); letter-spacing: 0.1em;
  z-index: 5; animation: bob 1.8s ease-in-out infinite;
}
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(8px)} }

/* corner brackets */
.brackets::before, .brackets::after {
  content:""; position:absolute; width:26px; height:26px;
  border-color: rgba(0,229,255,0.35); border-style: solid; z-index:5;
}
.brackets::before { top: calc(var(--pad-slide) - 14px); left: calc(var(--pad-slide) - 14px); border-width: 1px 0 0 1px; }
.brackets::after  { bottom: calc(var(--pad-slide) - 14px); right: calc(var(--pad-slide) - 14px); border-width: 0 1px 1px 0; }

/* ---------- Side nav dots ---------- */
#nav-dots {
  position: fixed; top: 50%; right: 18px; transform: translateY(-50%);
  z-index: 50; display: flex; flex-direction: column; gap: 9px;
}
.nav-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: none; cursor: pointer; padding: 0;
  transition: all .3s ease; position: relative;
}
.nav-dot:hover { background: rgba(255,255,255,0.4); }
.nav-dot.active {
  background: var(--cyan); height: 22px; border-radius: 5px;
  box-shadow: 0 0 12px var(--cyan);
}

/* progress bar top */
#progress {
  position: fixed; top: 0; left: 0; height: 2px; z-index: 60;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  width: 0%; transition: width .2s ease;
  box-shadow: 0 0 10px var(--cyan);
}

/* ---------- Glass cards ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  transition: border-color .3s, box-shadow .3s, transform .3s;
  align-items: start; align-self: start;
}
.glass:hover {
  border-color: rgba(0,229,255,0.3);
  box-shadow: inset 0 0 30px rgba(0,229,255,0.06), 0 8px 40px rgba(0,0,0,0.4);
}

/* ---------- Headline number cards ---------- */
.hn-row {
  display: flex; flex-wrap: wrap; gap: 1rem; margin-top: auto;
}
.hn-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 1.1rem 1.3rem;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  min-width: 150px; flex: 1 1 150px; max-width: 260px;
  align-self: start;
  position: relative; overflow: hidden;
}
.hn-card::before {
  content:""; position:absolute; left:0; top:0; bottom:0; width:3px;
  background: var(--cyan); box-shadow: 0 0 10px var(--cyan);
}
.hn-value {
  font-family: var(--f-mono); font-weight: 700;
  font-size: clamp(1.6rem, 3.4vw, 2.8rem);
  line-height: 1; color: var(--text);
  letter-spacing: -0.02em;
}
.hn-label {
  font-size: 0.78rem; color: var(--text-dim);
  margin-top: 0.5rem; line-height: 1.35;
}

/* ---------- Generic content panel ---------- */
.panel {
  padding: clamp(1.1rem, 2vw, 1.8rem);
  display: flex; flex-direction: column; gap: 0.9rem;
  max-height: 100%; overflow-y: auto;
  background: rgba(8,12,32,0.5);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: rgba(0,229,255,0.3); border-radius: 3px; }

.body-block { }
.body-block h3 {
  font-family: var(--f-title); font-size: 0.98rem; font-weight: 600;
  color: var(--cyan); margin-bottom: 0.3rem;
}
.body-block p {
  font-size: 0.86rem; color: var(--text-dim); line-height: 1.55;
}

/* ---------- Two-column agent layout ---------- */
.split {
  display: grid; grid-template-columns: 1fr minmax(380px, 0.85fr);
  gap: 2rem; flex: 1; min-height: 0; align-items: stretch;
  margin-top: 1.2rem;
}
.split .scene-col { position: relative; min-height: 0; }
.split .info-col { min-height: 0; display: flex; }

/* agent meta rows */
.meta-row { margin-bottom: 0.2rem; }
.meta-label {
  font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--purple); margin-bottom: 0.25rem;
}
.meta-text { font-size: 0.83rem; color: var(--text-dim); line-height: 1.5; }

/* KPI mini grid */
.kpi-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem;
}
.kpi-cell {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  border-radius: 10px; padding: 0.6rem 0.7rem; align-self: start;
}
.kpi-cell .v { font-family: var(--f-mono); font-weight:700; font-size: 1.05rem; color: var(--teal); white-space: nowrap; }
.kpi-cell .l { font-size: 0.66rem; color: var(--text-faint); margin-top: 0.25rem; line-height: 1.3; }

/* proven badge */
.proof {
  margin-top: 0.4rem;
  border: 1px solid rgba(6,255,165,0.3);
  background: rgba(6,255,165,0.05);
  border-radius: 12px; padding: 0.7rem 0.9rem;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.proof .badge {
  font-family: var(--f-mono); font-size: 0.62rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--teal);
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.proof .badge::before { content:"●"; color: var(--teal); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
.proof .company { font-weight: 600; font-size: 0.86rem; color: var(--text); }
.proof .metric { font-size: 0.76rem; color: var(--text-dim); line-height: 1.4; }
.proof a {
  font-size: 0.72rem; color: var(--cyan); text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.3rem; word-break: break-all;
}
.proof a:hover { text-decoration: underline; }

/* ---------- body grid (multi-block slides) ---------- */
.body-grid {
  display: grid; gap: 1rem; flex: 1; min-height: 0; margin-top: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-content: start; overflow-y: auto;
}
.body-grid .glass, .cover-inner .body-grid .glass {
  padding: 1.1rem 1.2rem;
  background: rgba(8,12,32,0.55);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.body-grid.dense { grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
@media (max-width: 980px) { .body-grid.dense { grid-template-columns: 1fr; } }
.body-grid.dense .glass { padding: 0.85rem 0.95rem; }
.body-grid.dense .body-block h3 { font-size: 0.86rem; }
.body-grid.dense .body-block p { font-size: 0.78rem; line-height: 1.45; }
.body-grid .proof { margin-top: 0; height: 100%; justify-content: center; }

/* compact (dense content) slides: smaller title + hn cards to fit grid */
.slide.compact h1.title { font-size: clamp(1.6rem, 3.2vw, 2.5rem); max-width: 26ch; }
.slide.compact .subtitle { margin-top: 0.4rem; font-size: clamp(0.85rem,1.2vw,1rem); }
.slide.compact .hn-row { margin-top: 0.9rem; }
.slide.compact .hn-card { padding: 0.7rem 0.95rem; }
.slide.compact .hn-value { font-size: clamp(1.3rem, 2.6vw, 2rem); }
.slide.compact .body-grid { margin-top: 0.9rem; }

/* code-ish text */
.mono { font-family: var(--f-mono); white-space: pre-wrap; word-break: break-word; }

/* sources line */
.sources {
  font-family: var(--f-mono); font-size: 0.62rem; color: var(--text-faint);
  margin-top: 0.8rem; line-height: 1.5; word-break: break-all;
}
.sources a { color: var(--text-faint); text-decoration: none; }
.sources a:hover { color: var(--cyan); }

/* cover headline cards full width row */
.cover-inner { justify-content: flex-end; }
.cover-inner .title { font-size: clamp(2.6rem, 8vw, 6rem); }

/* CTA */
.cta-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.4rem; }
.btn {
  font-family: var(--f-mono); font-size: 0.85rem; letter-spacing: 0.06em;
  padding: 0.85rem 1.6rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--cyan); background: rgba(0,229,255,0.1);
  color: var(--cyan); text-decoration: none; transition: all .25s;
}
.btn:hover { background: var(--cyan); color: var(--bg-2); box-shadow: 0 0 24px rgba(0,229,255,0.5); }
.btn.ghost { border-color: var(--glass-border); background: transparent; color: var(--text-dim); }
.btn.ghost:hover { border-color: var(--text); color: var(--text); box-shadow: none; }

/* entrance animation helper */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1); }
.slide.in-view .reveal { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; grid-template-rows: minmax(200px, 38%) 1fr; }
}
@media (max-width: 720px) {
  :root { --pad-slide: 1.5rem; }
  .slide { padding-top: 3.4rem; }
  #nav-dots { display: none; }
  .split { gap: 1rem; grid-template-rows: minmax(160px, 32%) 1fr; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-cell .v { font-size: 0.82rem; }
  .hn-card { min-width: 120px; flex-basis: 120px; padding: 0.8rem 0.9rem; }
  .body-grid { grid-template-columns: 1fr; }
  h1.title { font-size: clamp(1.5rem, 7vw, 2.2rem); }
  .subtitle { font-size: 0.92rem; }
}
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* loading splash */
#splash {
  position: fixed; inset: 0; z-index: 100; display: flex;
  align-items: center; justify-content: center; flex-direction: column; gap: 1rem;
  background: var(--bg-2); transition: opacity .6s; font-family: var(--f-mono);
}
#splash.hide { opacity: 0; pointer-events: none; }
#splash .ring {
  width: 54px; height: 54px; border-radius: 50%;
  border: 2px solid rgba(0,229,255,0.2); border-top-color: var(--cyan);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#splash .t { color: var(--cyan); letter-spacing: 0.3em; font-size: 0.8rem; }
