/* Schemancer Demo — Dramatic B/W Full-Viewport */

:root {
  --bg: #000;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-light: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.12);
  --border-bright: rgba(255, 255, 255, 0.25);
  --text: #fff;
  --text-muted: rgba(255, 255, 255, 0.5);
  --glow: 0 0 30px rgba(255, 255, 255, 0.04);
  --vermillion: #ff4433;
  --indigo: #4488ff;
  --pine: #44dd66;
  --murasaki: #aa66ff;
  --font-display: 'Courier New', Courier, monospace;
  --font-body: 'Courier New', Courier, monospace;
  --font-mono: 'Courier New', Courier, monospace;
  --radius: 12px;
  --t-fast: 0.15s ease;
  --t-medium: 0.3s ease;
  --t-slow: 0.6s ease;
}

body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  margin: 0;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--bg);
  opacity: 0.92;
  z-index: 0;
  pointer-events: none;
}

/* Gradient orbs — neon bright */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}
.orb--indigo { width: 500px; height: 500px; background: var(--indigo); top: -10%; left: -5%; }
.orb--murasaki { width: 400px; height: 400px; background: var(--murasaki); top: 40%; right: -8%; }
.orb--pine { width: 350px; height: 350px; background: var(--pine); bottom: -5%; left: 30%; }

/* Panel — unified glass surface */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--glow);
  overflow: auto;
  transition: backdrop-filter var(--t-medium), -webkit-backdrop-filter var(--t-medium);
}
.panel:hover {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Carousel — full viewport */
.carousel {
  position: relative;
  z-index: 1;
  height: 100vh;
}
.carousel-track { position: relative; height: 100vh; }

/* Slides — CSS grid filling viewport */
.carousel-slide {
  position: absolute;
  top: 0; left: 0; right: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow);
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 320px 1fr;
  height: 100vh;
  padding: 1.5rem 3rem;
  gap: 1rem;
  box-sizing: border-box;
  background-size: 60% auto;
  background-position: center;
  background-repeat: no-repeat;
}
.carousel-slide.active {
  position: relative;
  opacity: 1;
  pointer-events: auto;
}

/* Grid areas */
.slide-top {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.slide-viz {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.slide-code {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: auto;
}
.slide-bottom { grid-column: 1 / -1; }

/* Slide header */
.slide-title {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.slide-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Stats chips — accent left border */
.stats-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.stat-chip {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius);
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-left: 3px solid var(--indigo);
  color: var(--text-muted);
}
.stat-chip.ratio {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-weight: 600;
  border-left-color: var(--vermillion);
}

/* Carousel arrows — fixed on viewport edges */
.carousel-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border-bright);
  border-radius: 50%;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), box-shadow var(--t-fast);
  box-shadow: var(--glow);
}
.carousel-arrow:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.08);
}
.carousel-arrow--prev { left: 12px; }
.carousel-arrow--next { right: 12px; }

/* Dots — inside carousel, top-right */
.carousel-dots {
  position: absolute;
  top: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 5;
}
.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.carousel-dot.active {
  background: #fff;
  border-color: #fff;
}

/* Context text — paint stroke highlight */
.slide-context {
  font-size: 0.85rem;
  line-height: 2;
  color: #000;
  background: #fff;
  margin: 0;
  display: inline;
  padding: 0.15em 0.4em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  font-family: var(--font-display);
  font-weight: 700;
}

/* Viz area */
.slide-viz .scenario-hero-viz {
  width: 100%;
  flex-shrink: 0;
  border-radius: var(--radius);
}

/* Breakdown */
.breakdown {
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text-muted);
}
.bd-table { color: var(--text); font-size: 0.85rem; margin-top: 0.5rem; }
.bd-table:first-child { margin-top: 0; }
.bd-badge { font-size: 0.65rem; font-weight: 600; color: var(--murasaki); }
.bd-row { padding-left: 0.75rem; display: flex; align-items: center; gap: 0.375rem; }
.bd-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.bd-col { font-family: var(--font-mono); color: var(--text-muted); font-size: 0.75rem; }

/* Code sections */
.code-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.code-panel-label {
  font-size: 0.7rem;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

/* Manifest code — true black bg */
.manifest-code {
  margin: 0;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
  border-left: 2px solid var(--vermillion);
  font-size: 11px;
  line-height: 1.55;
  font-family: var(--font-mono);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  flex: 1;
  min-height: 0;
  border-radius: 4px;
}
.py-comment { color: var(--text-muted); font-style: italic; }
.py-string { color: #7dd3fc; }
.py-keyword { color: #f87171; }

/* SQL code — true black bg */
.sql-code {
  margin: 0;
  padding: 0.75rem 0;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
  font-size: 11px;
  line-height: 1.5;
  font-family: var(--font-mono);
  counter-reset: line;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
  min-height: 0;
  color: var(--text-muted);
  border-radius: 4px;
}
.sql-code .sql-line {
  display: block;
  padding: 0 10px 0 40px;
  position: relative;
  border-left: 3px solid transparent;
}
.sql-code .sql-line::before {
  counter-increment: line;
  content: counter(line);
  position: absolute;
  left: 0;
  width: 30px;
  text-align: right;
  color: rgba(255, 255, 255, 0.2);
  font-size: 10px;
  user-select: none;
}

/* Syntax highlight colors */
.hl-key { color: var(--vermillion); }
.hl-add { color: #60a5fa; }
.hl-array { color: #4ade80; }
.hl-json { color: #c084fc; }
.hl-replace { color: var(--vermillion); }
.hl-keyword { color: var(--text); font-weight: 600; }
.hl-comment { color: var(--text-muted); font-style: italic; }

.sql-line.border-key { border-left-color: var(--vermillion); }
.sql-line.border-add { border-left-color: #60a5fa; }
.sql-line.border-array { border-left-color: #4ade80; }
.sql-line.border-json { border-left-color: #c084fc; }
.sql-line.border-replace { border-left-color: var(--vermillion); }

/* D3 table cards */
.table-card { fill: rgba(255, 255, 255, 0.08); stroke: rgba(255, 255, 255, 0.12); stroke-width: 1; rx: 8; }
.table-card-header { fill: rgba(255, 255, 255, 0.06); rx: 8; }
.table-name { fill: var(--text); font-size: 10px; font-weight: 600; font-family: var(--font-display); }
.col-text { fill: rgba(255, 255, 255, 0.85); font-size: 9px; font-family: var(--font-mono); }
.col-type { fill: rgba(255, 255, 255, 0.4); font-size: 9px; font-family: var(--font-mono); }

@keyframes cardAppear {
  from { opacity: 0; }
  to { opacity: 1; }
}
.table-group { animation: cardAppear 0.3s ease-out both; }
.table-group:nth-child(2) { animation-delay: 0.05s; }
.table-group:nth-child(3) { animation-delay: 0.1s; }
.table-group:nth-child(4) { animation-delay: 0.15s; }
.table-group:nth-child(5) { animation-delay: 0.2s; }

/* Stream output */
.stream-item { display: inline-block; margin-right: 12px; }
.stream-ok { color: #4ade80; }
.stream-err { color: #f87171; }
.stream-time { color: var(--text-muted); }

.stream-progress {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  min-width: 100px;
}
.progress-bar {
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 0.75rem;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--text);
  transition: width 0.2s ease;
}

/* Apply button — white on black, pulse hover */
.btn-apply {
  padding: 0.5rem 1.25rem;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.8rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.btn-apply:hover {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
}
.btn-apply:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* Stream output area */
.stream-output {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  overflow-x: auto;
  white-space: nowrap;
  min-height: 1.25rem;
}

/* Apply row */
.apply-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: var(--radius); }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

/* Mobile — single column, scroll enabled */
@media (max-width: 768px) {
  .carousel-slide {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    padding: 1rem;
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }
  .slide-top { flex-direction: column; }
  .slide-viz, .slide-code, .slide-bottom { grid-column: 1; }
  .carousel-dots { top: 1rem; right: 1rem; }
  .carousel-arrow { width: 36px; height: 36px; font-size: 1rem; }
}
