/* ===========================================================
   Consiliarius · Pitch demo (interactivo, 3D, anim, TTS)
   =========================================================== */

:root {
  --pitch-bg: #050a18;
  --pitch-mid: #0c1426;
  --pitch-accent: #e0a95f;
  --pitch-neon: #00d4b8;
  --pitch-text: #f0f3fb;
}

* { box-sizing: border-box; }

.pitch-body {
  margin: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--pitch-bg);
  color: var(--pitch-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  position: relative;
}

/* Animated particle background */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.cube-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* ==========================================================
   Scenes container — every scene is a full viewport panel
   ========================================================== */
.scenes {
  position: relative;
  z-index: 5;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96) translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scene.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}

.scene.exiting {
  opacity: 0;
  transform: scale(1.04) translateY(-8px);
}

.centered {
  text-align: center;
  max-width: 1100px;
  width: 100%;
}

/* ==========================================================
   Splash · animated 3D logo cube
   ========================================================== */
.splash { text-align: center; }

.logo-3d {
  width: 140px; height: 140px;
  margin: 0 auto 32px;
  position: relative;
  transform-style: preserve-3d;
  animation: spin-logo 14s linear infinite;
}

.logo-3d .face {
  position: absolute;
  width: 140px; height: 140px;
  display: grid; place-items: center;
  font-size: 84px; font-weight: 800;
  color: var(--pitch-accent);
  background: linear-gradient(135deg, rgba(31, 42, 68, 0.85), rgba(12, 20, 38, 0.85));
  border: 1px solid rgba(224, 169, 95, 0.3);
  box-shadow: inset 0 0 30px rgba(224, 169, 95, 0.15), 0 0 30px rgba(224, 169, 95, 0.18);
  backdrop-filter: blur(6px);
}

.logo-3d .f-front  { transform: translateZ(70px); }
.logo-3d .f-back   { transform: rotateY(180deg) translateZ(70px); }
.logo-3d .f-right  { transform: rotateY(90deg)  translateZ(70px); }
.logo-3d .f-left   { transform: rotateY(-90deg) translateZ(70px); }
.logo-3d .f-top    { transform: rotateX(90deg)  translateZ(70px); }
.logo-3d .f-bottom { transform: rotateX(-90deg) translateZ(70px); }

@keyframes spin-logo {
  0%   { transform: rotateX(0)    rotateY(0); }
  100% { transform: rotateX(360deg) rotateY(360deg); }
}

.hero-title {
  margin: 0 0 14px;
  font-size: 56px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.1;
}

.hero-title .line-1 {
  display: block;
  background: linear-gradient(90deg, #f5d8a7, #e0a95f, #d59750);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 40px rgba(224, 169, 95, 0.3);
}

.hero-title .line-2 {
  display: block;
  font-size: 22px;
  font-weight: 400;
  color: #c8cdda;
  margin-top: 8px;
  letter-spacing: 0.5px;
}

.hero-title.huge .line-1 { font-size: 72px; }

.hero-sub {
  font-size: 17px;
  color: rgba(240, 243, 251, 0.65);
  margin: 0 0 36px;
}

.btn-cta {
  background: linear-gradient(135deg, #e0a95f, #d59750);
  color: #1f2a44;
  border: none;
  padding: 14px 32px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 0 30px rgba(224, 169, 95, 0.3);
}

.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(224, 169, 95, 0.5);
}

.btn-cta.primary { background: linear-gradient(135deg, var(--pitch-neon), #00b899); color: #052e16; }
.btn-cta.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--pitch-text);
  box-shadow: none;
}
.btn-cta.ghost:hover { background: rgba(255, 255, 255, 0.06); }

.hint {
  margin-top: 24px;
  font-size: 12px;
  color: rgba(240, 243, 251, 0.5);
}

.hint kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
}

/* ==========================================================
   Scene titles
   ========================================================== */
.scene-title {
  font-size: 38px;
  font-weight: 800;
  margin: 0 0 12px;
  background: linear-gradient(90deg, #fff 0%, #e0a95f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.scene-sub {
  font-size: 18px;
  color: rgba(240, 243, 251, 0.7);
  margin: 0 0 36px;
}

.scene-foot {
  font-size: 15px;
  color: rgba(240, 243, 251, 0.6);
  margin-top: 28px;
}

/* ==========================================================
   Scene 2 · Animated bars
   ========================================================== */
.bars {
  max-width: 720px;
  margin: 32px auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bar {
  display: grid;
  grid-template-columns: 220px 1fr 60px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  text-align: left;
}

.bar span { color: #c8cdda; }

.bar .fill {
  height: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 7px;
  overflow: hidden;
  position: relative;
}

.bar .fill::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 0;
  background: linear-gradient(90deg, #b91c1c, #e0a95f, var(--pitch-neon));
  border-radius: 7px;
  animation: fill-bar 1.4s ease-out 0.3s forwards;
}

@keyframes fill-bar {
  to { width: var(--w); }
}

.bar b {
  font-weight: 700;
  color: var(--pitch-accent);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ==========================================================
   Scene 3 · Voices grid
   ========================================================== */
.voices-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  max-width: 1000px;
  margin: 36px auto;
}

.voice-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 22px 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
  border-left: 4px solid var(--c, var(--pitch-accent));
}

.voice-card:hover {
  transform: translateY(-4px);
  border-color: var(--c);
  box-shadow: 0 8px 30px var(--c);
}

.voice-card .voice-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 22px;
  margin: 0 auto 12px;
}

.voice-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--pitch-text);
}

.voice-card p {
  margin: 0;
  font-size: 13px;
  color: rgba(240, 243, 251, 0.65);
  line-height: 1.4;
}

@media (max-width: 900px) {
  .voices-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================
   Scene 4 · Cube stage
   ========================================================== */
.cube-stage {
  text-align: center;
  width: 100%;
  max-width: 1100px;
}

.cube-host {
  width: 100%;
  height: 360px;
  margin: 24px 0;
  position: relative;
  border-radius: 16px;
  background: radial-gradient(ellipse at center, rgba(0, 212, 184, 0.08) 0%, transparent 70%);
}

.cube-legend {
  max-width: 720px;
  margin: 0 auto;
}

.cube-legend ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 14px;
  padding: 0;
  margin: 0;
  list-style: none;
  text-align: left;
}

.cube-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(240, 243, 251, 0.75);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: 8px;
}

.cube-legend .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 8px var(--c);
}

.cube-legend b { color: var(--pitch-accent); margin-right: 4px; }

/* ==========================================================
   Scene 5 · Live demo
   ========================================================== */
.brand-fc {
  background: linear-gradient(90deg, #34d399, #00d4b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.live-stage { max-width: 920px; }

.loader-wrap {
  margin: 36px auto;
  max-width: 600px;
}

.loader-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.loader-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--pitch-accent), var(--pitch-neon));
  transition: width 0.4s ease;
  border-radius: 4px;
  box-shadow: 0 0 12px var(--pitch-neon);
}

.loader-text {
  font-size: 14px;
  color: rgba(240, 243, 251, 0.65);
  font-family: 'Courier New', monospace;
  margin: 0;
}

.live-checks {
  list-style: none;
  margin: 18px auto;
  padding: 0;
  max-width: 480px;
  text-align: left;
  font-size: 13px;
  font-family: 'Courier New', monospace;
}

.live-checks li {
  padding: 6px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  color: rgba(240, 243, 251, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-checks li.ok {
  color: #34d399;
  border-left: 3px solid #34d399;
}

.live-checks li.ok::before { content: "✓"; }
.live-checks li::before { content: "○"; opacity: 0.5; }

.live-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 20px auto;
  max-width: 700px;
}

.live-kpi {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.live-kpi .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--pitch-accent);
}

.live-kpi .value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--pitch-text);
  font-variant-numeric: tabular-nums;
}

#live-next:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* ==========================================================
   Scene 6 · Capabilities grid
   ========================================================== */
.cap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 1000px;
  margin: 32px auto;
}

.cap-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 18px 16px;
  text-align: center;
  transition: all 0.3s;
}

.cap-card:hover {
  transform: translateY(-3px);
  border-color: var(--pitch-neon);
  background: rgba(0, 212, 184, 0.06);
}

.cap-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
}

.cap-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--pitch-accent);
}

.cap-card p {
  margin: 0;
  font-size: 12px;
  color: rgba(240, 243, 251, 0.6);
  line-height: 1.4;
}

@media (max-width: 800px) {
  .cap-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================
   CTA row
   ========================================================== */
.cta-row {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 32px 0 24px;
}

/* ==========================================================
   Side controls
   ========================================================== */
.pitch-controls {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  gap: 8px;
  z-index: 50;
  background: rgba(12, 20, 38, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 6px;
  backdrop-filter: blur(8px);
}

.pitch-controls button {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--pitch-text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.pitch-controls button:hover {
  background: rgba(0, 212, 184, 0.15);
  color: var(--pitch-neon);
}

.pitch-controls button.active {
  background: rgba(224, 169, 95, 0.25);
  color: var(--pitch-accent);
}

.scene-indicator {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 50;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: rgba(240, 243, 251, 0.5);
  background: rgba(12, 20, 38, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 6px 14px;
  backdrop-filter: blur(8px);
}

/* Voice selector inline en pitch-controls */
.voice-select {
  background: rgba(255, 255, 255, 0.06);
  color: var(--pitch-text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  max-width: 220px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.voice-select:hover { border-color: var(--pitch-neon); }
.voice-select:focus { border-color: var(--pitch-accent); }
.voice-select option {
  background: var(--pitch-mid);
  color: var(--pitch-text);
}
.voice-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Audio status pill */
.audio-status {
  position: fixed;
  left: 24px;
  bottom: 60px;
  z-index: 50;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  color: rgba(240, 243, 251, 0.7);
  background: rgba(12, 20, 38, 0.85);
  border: 1px solid rgba(0, 212, 184, 0.25);
  border-radius: 999px;
  padding: 5px 12px;
  backdrop-filter: blur(8px);
  letter-spacing: 0.3px;
  transition: all 0.3s;
}

/* ===========================================================
   Scene · Template -> Cockpit -> Shark Tank flow
   =========================================================== */
.flow-stage {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 32px 0 24px;
  max-width: 1100px;
  width: 100%;
}
.flow-card {
  flex: 1 1 280px;
  max-width: 320px;
  background: rgba(12, 20, 38, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  backdrop-filter: blur(8px);
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.flow-card:hover {
  transform: translateY(-4px);
}
.flow-templates { border-color: rgba(126, 217, 192, 0.35); }
.flow-templates:hover { box-shadow: 0 8px 32px rgba(126, 217, 192, 0.2); }
.flow-cockpit { border-color: rgba(224, 169, 95, 0.35); }
.flow-cockpit:hover { box-shadow: 0 8px 32px rgba(224, 169, 95, 0.2); }
.flow-shark { border-color: rgba(255, 180, 84, 0.4); }
.flow-shark:hover { box-shadow: 0 8px 32px rgba(255, 180, 84, 0.25); }
.flow-card .flow-emoji {
  font-size: 44px;
  display: block;
  margin-bottom: 12px;
}
.flow-card h3 {
  margin: 0 0 10px;
  font-size: 20px;
  color: #fff;
}
.flow-card p {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(240, 243, 251, 0.78);
}
.flow-card .flow-action {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 212, 184, 0.12);
  color: var(--pitch-neon);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.flow-arrow {
  font-size: 32px;
  align-self: center;
  color: var(--pitch-neon);
  text-shadow: 0 0 16px rgba(0, 212, 184, 0.6);
  animation: flow-pulse 2.5s ease-in-out infinite;
}
@keyframes flow-pulse {
  0%, 100% { opacity: 0.55; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(4px); }
}
@media (max-width: 800px) {
  .flow-arrow {
    transform: rotate(90deg);
    margin: 4px 0;
  }
  @keyframes flow-pulse {
    0%, 100% { opacity: 0.55; transform: rotate(90deg) translateX(0); }
    50% { opacity: 1; transform: rotate(90deg) translateX(4px); }
  }
}

/* ==========================================================
   Mobile · viewport-friendly scroll
   No cambia forma ni contenido · solo permite que cada
   escena haga scroll interno cuando el contenido supera el
   alto del viewport.
   ========================================================== */
@media (max-width: 720px) {
  /* iOS Safari: 100vh buggy con URL bar dinamica + absolute-positioned
     scenes con overflow:auto interno = scroll que no funciona.
     Cambiamos a flow normal: cada scene es bloque que toma min-height
     del viewport, la pagina scrollea naturalmente, solo .active se
     muestra. Sacrificamos animacion fade pero ganamos scroll en iPhone. */
  html { overflow-x: hidden; height: auto; }
  .pitch-body {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }
  .scenes {
    position: relative;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
    width: 100%;
  }
  .scene {
    position: relative !important;
    inset: auto !important;
    display: none;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    padding: 70px 16px calc(96px + env(safe-area-inset-bottom)) !important;
    align-items: flex-start;
    overflow: visible;
  }
  .scene.active {
    display: flex !important;
    pointer-events: auto !important;
  }
  .scene.exiting {
    display: none !important;
  }
  .centered, .splash, .cube-stage, .live-stage {
    max-width: 100%;
    width: 100%;
  }
  .scene-title { font-size: 22px; line-height: 1.2; margin: 0 0 10px; }
  .scene-sub { font-size: 14px; line-height: 1.45; }
  .scene-foot { font-size: 13px; }
  .hero-title { font-size: 32px; line-height: 1.1; }
  .hero-title.huge { font-size: 36px; }
  .hero-title .line-2 { font-size: 16px; }
  .hero-sub { font-size: 14px; }
  .btn-cta { padding: 12px 22px; font-size: 14px; }

  /* Splash logo · scale down */
  .logo-3d { width: 110px; height: 110px; margin: 0 auto 18px; }

  /* Voices grid · 1 column on phones */
  .voices-grid { grid-template-columns: 1fr; gap: 10px; }
  .voice-card { padding: 14px 16px; }
  .voice-avatar { width: 42px; height: 42px; font-size: 16px; }

  /* Cube · smaller host so the legend fits */
  .cube-host { width: 240px; height: 240px; }
  .cube-legend ol { font-size: 12px; gap: 4px; }

  /* Capabilities grid · 1 col on phones */
  .cap-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cap-card { padding: 12px 10px; }
  .cap-icon { font-size: 24px; }
  .cap-card h3 { font-size: 14px; }
  .cap-card p { font-size: 11px; }

  /* Flow · already stacks @ 800px · ensure tight padding */
  .flow-stage { gap: 8px; padding: 0; }
  .flow-card { padding: 14px 16px; min-width: 0; }
  .flow-card h3 { font-size: 16px; }
  .flow-card p { font-size: 13px; }

  /* Pain bars · larger touch targets */
  .bars { gap: 10px; }
  .bar { font-size: 13px; }
  .bar b { font-size: 14px; }

  /* Live demo · loader + checks compact */
  .loader-bar { height: 6px; }
  .loader-text { font-size: 12px; }
  .live-checks li { font-size: 12px; padding: 6px 10px; }
  .live-kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .live-kpis .kpi-value { font-size: 18px; }
  .live-kpis .kpi-label { font-size: 10px; }

  /* CTA row · stack */
  .cta-row { flex-direction: column; gap: 10px; align-items: stretch; }
  .cta-row .btn-cta { width: 100%; text-align: center; }

  /* Controls: compact, anchored bottom with iOS safe-area */
  .pitch-controls {
    position: fixed !important;
    bottom: calc(12px + env(safe-area-inset-bottom));
    right: 12px;
    left: 12px;
    top: auto;
    transform: none;
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    padding: 6px 8px;
    flex-wrap: wrap;
    background: rgba(10, 14, 26, 0.88);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    z-index: 100;
  }
  .pitch-controls button {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }
  .pitch-controls .voice-select {
    flex: 1 1 auto;
    min-width: 120px;
    max-width: 180px;
    font-size: 11px;
  }
  .scene-indicator {
    position: fixed !important;
    top: calc(10px + env(safe-area-inset-top));
    right: 10px;
    bottom: auto;
    left: auto;
    font-size: 11px;
    padding: 4px 9px;
    z-index: 101;
  }
  .audio-status {
    position: fixed !important;
    bottom: calc(64px + env(safe-area-inset-bottom));
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    padding: 4px 9px;
    max-width: calc(100vw - 24px);
    z-index: 99;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  .hero-title { font-size: 26px; }
  .hero-title.huge { font-size: 30px; }
  .scene-title { font-size: 19px; }
  .cap-grid { grid-template-columns: 1fr; }
  .live-kpis { grid-template-columns: 1fr; }
}
