/* === Nara Setup Demo — Stylesheet === */

/* Palette + typography vars (matches /demo) */
:root {
  --indigo-deep: #1E1B4B;
  --indigo: #4F46E5;
  --sand: #FBBF77;
  --cream: #FEF3E2;
  --slate: #0F172A;
  --slate-soft: #475569;
  --line: rgba(30, 27, 75, 0.12);
  --line-strong: rgba(30, 27, 75, 0.25);

  --font-display: 'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Space Grotesk', ui-monospace, monospace;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
[hidden] { display: none !important; }
body {
  font-family: var(--font-body);
  background: var(--indigo-deep);
  color: var(--slate);
  min-height: 100vh;
  overflow: hidden;
}

/* Stage layout — fills viewport, no scroll */
.stage {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  background: var(--cream);
  color: var(--slate);
}

/* === Topbar === */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: var(--indigo-deep);
  color: #fff;
  border-bottom: 1px solid var(--line);
}

.brand-block { display: flex; flex-direction: column; gap: 2px; }
.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.wordmark .dot { color: var(--sand); }
.brand-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
}

.setup-time { display: flex; align-items: baseline; gap: 12px; }
.setup-time-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
}
.setup-time-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 36px;
  letter-spacing: -0.02em;
  color: var(--sand);
  font-variant-numeric: tabular-nums;
  min-width: 100px;
  text-align: right;
}
.setup-time-value.frozen { animation: flash-sand 600ms ease-out; }

@keyframes flash-sand {
  0%   { color: var(--sand); transform: scale(1); }
  40%  { color: #fff; transform: scale(1.08); }
  100% { color: var(--sand); transform: scale(1); }
}

/* === Stage grid (two panels) === */
.stage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 24px;
  min-height: 0;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  overflow: hidden;
}

.panel:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
.panel:last-child  { border-top-left-radius: 0;  border-bottom-left-radius: 0;  background: var(--indigo-deep); color: #fff; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate-soft);
}
.panel-spec .panel-label { color: var(--sand); }

.recording-state {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #DC2626;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.analyze-state {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--sand);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* === Narrative panel === */
.mic-area {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(251, 191, 119, 0.12);
  border-radius: var(--r-md);
  min-height: 64px;
}
.mic-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(251, 191, 119, 0.25);
  border-radius: 50%;
  flex-shrink: 0;
}
.waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  height: 32px;
}
.waveform span {
  display: block;
  width: 3px;
  height: 30%;
  background: var(--sand);
  border-radius: 2px;
  opacity: 0.4;
}

.transcript {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--slate);
  font-weight: 500;
  min-height: 120px;
  padding: 8px 0;
}

/* === Spec panel === */
.spec-rows { display: flex; flex-direction: column; gap: 12px; flex: 1; }

.spec-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 2px solid var(--sand);
  border-radius: 6px;
}
.spec-row.accent-sand { background: rgba(251, 191, 119, 0.16); }
.spec-row-check {
  font-size: 14px;
  color: var(--sand);
  font-weight: 700;
  margin-top: 2px;
}
.spec-row-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.spec-row-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}
.spec-row-value {
  font-size: 14px;
  line-height: 1.4;
  color: #fff;
  font-weight: 500;
}
.spec-row-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--sand);
  color: var(--indigo-deep);
  white-space: nowrap;
  align-self: center;
}
.spec-row-badge.critical { background: #F87171; color: #fff; }
.spec-row-badge.dual-tone { background: #C4B5FD; color: var(--indigo-deep); }

.cta-button {
  display: inline-block;
  margin-top: auto;
  padding: 14px 22px;
  background: var(--sand);
  color: var(--indigo-deep);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  border-radius: var(--r-md);
  text-align: center;
  letter-spacing: -0.01em;
}

/* === Bottom bar === */
.bottombar {
  display: grid;
  grid-template-rows: 2px auto;
  background: #fff;
  border-top: 1px solid var(--line);
}
.progress-strip {
  height: 2px;
  background: var(--line);
  position: relative;
}
.progress-fill {
  height: 100%;
  background: var(--indigo);
  width: 0;
  transition: width 80ms linear;
}

.scenario-picker {
  display: flex;
  gap: 8px;
  padding: 12px 32px;
  align-items: center;
  flex-wrap: wrap;
}
.scenario-pill {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 14px;
  background: rgba(30, 27, 75, 0.06);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  font-family: var(--font-body);
  text-align: left;
  transition: all 120ms ease;
}
.scenario-pill:hover { background: rgba(30, 27, 75, 0.1); }
.scenario-pill.active {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
}
.scenario-pill-title { font-size: 13px; font-weight: 700; }
.scenario-pill-meta {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}

.controls {
  display: flex;
  gap: 8px;
  padding: 0 32px 12px;
  justify-content: flex-end;
}
.control-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(30, 27, 75, 0.06);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
}
.control-btn:hover { background: rgba(30, 27, 75, 0.1); }
.control-btn.flash { animation: btn-flash 220ms ease-out; }
@keyframes btn-flash {
  0%   { transform: scale(1); background: var(--sand); }
  100% { transform: scale(1); background: rgba(30, 27, 75, 0.06); }
}
.control-btn kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(30, 27, 75, 0.1);
  border-radius: 4px;
  font-weight: 600;
}

/* === Help overlay === */
.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.help-card {
  background: #fff;
  padding: 32px 40px;
  border-radius: var(--r-lg);
  max-width: 480px;
}
.help-card h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  margin: 0 0 16px;
}
.help-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; }
.help-list > div { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: center; }
.help-list dt { display: flex; gap: 4px; }
.help-list dt kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-weight: 600;
}
.help-list dd { margin: 0; font-size: 13px; }
.help-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--slate-soft);
  margin: 18px 0 0;
}

/* === No-JS fallback === */
.nojs-fallback {
  padding: 60px;
  font-family: var(--font-body);
  color: var(--slate);
  background: var(--cream);
}
.nojs-fallback h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  margin: 0 0 16px;
}

/* === Focus rings === */
:focus-visible {
  outline: 2px solid var(--sand);
  outline-offset: 2px;
}

/* ====================================================================== */
/* === Animations === */
/* ====================================================================== */

/* Mic pulse during recording */
.mic-icon.mic-pulse { animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 119, 0.4); }
  50%      { box-shadow: 0 0 0 10px rgba(251, 191, 119, 0); }
}

/* Waveform — idle vs active vs peak */
.waveform span { transition: height 200ms ease-out, opacity 200ms ease; }

.waveform-active span {
  animation: wave-pulse 720ms ease-in-out infinite;
  opacity: 1;
}
.waveform-active span:nth-child(1)  { animation-delay: 0ms; }
.waveform-active span:nth-child(2)  { animation-delay: 60ms; }
.waveform-active span:nth-child(3)  { animation-delay: 120ms; }
.waveform-active span:nth-child(4)  { animation-delay: 180ms; }
.waveform-active span:nth-child(5)  { animation-delay: 240ms; }
.waveform-active span:nth-child(6)  { animation-delay: 300ms; }
.waveform-active span:nth-child(7)  { animation-delay: 360ms; }
.waveform-active span:nth-child(8)  { animation-delay: 420ms; }
.waveform-active span:nth-child(9)  { animation-delay: 480ms; }
.waveform-active span:nth-child(10) { animation-delay: 540ms; }
.waveform-active span:nth-child(11) { animation-delay: 600ms; }
.waveform-active span:nth-child(12) { animation-delay: 660ms; }
.waveform-active span:nth-child(13) { animation-delay: 720ms; }
.waveform-active span:nth-child(14) { animation-delay: 780ms; }
.waveform-active span:nth-child(15) { animation-delay: 840ms; }

@keyframes wave-pulse {
  0%, 100% { height: 30%; }
  50%      { height: 80%; }
}

.waveform-active.waveform-peak span { animation-duration: 360ms; }
.waveform-active.waveform-peak span {
  height: 100% !important;
  background: var(--sand);
}

.waveform-locked span {
  animation: none;
  height: 30%;
  opacity: 0.25;
}

/* Transcript chunk appear */
.transcript-chunk {
  opacity: 0;
  filter: blur(2px);
  transition: opacity 180ms ease-out, filter 180ms ease-out;
}
.transcript-chunk.appear {
  opacity: 1;
  filter: blur(0);
}
.transcript-locked .transcript-chunk { color: var(--slate); }

/* Panel shimmer (analyzing state) */
.panel-spec.panel-shimmer {
  background: linear-gradient(110deg,
    var(--indigo-deep) 0%,
    rgba(79, 70, 229, 0.3) 20%,
    var(--indigo-deep) 40%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Spec row slide-in */
.spec-row {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease-out, transform 220ms ease-out;
}
.spec-row.appear {
  opacity: 1;
  transform: translateY(0);
}

/* Panel locked (after specLock) */
.panel-spec.panel-locked {
  border-color: var(--sand);
  box-shadow: 0 0 0 2px rgba(251, 191, 119, 0.3);
  transition: border-color 320ms ease, box-shadow 320ms ease;
}

/* CTA pulse */
.cta-button { transition: transform 180ms ease; }
.cta-button.cta-pulse {
  animation: cta-pulse 800ms ease-out 2;
}
@keyframes cta-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(251, 191, 119, 0.5); }
  50%      { transform: scale(1.04); box-shadow: 0 0 0 12px rgba(251, 191, 119, 0); }
}

/* ====================================================================== */
/* === Reduced motion fallback === */
/* ====================================================================== */

@media (prefers-reduced-motion: reduce) {
  .mic-icon.mic-pulse { animation: none; }
  .waveform-active span { animation: none; height: 50%; }
  .waveform-active.waveform-peak span { background: var(--sand); }
  .panel-spec.panel-shimmer {
    background: var(--indigo-deep);
    animation: none;
  }
  .transcript-chunk {
    transition: none;
    opacity: 1;
    filter: none;
  }
  .spec-row {
    transition: none;
    opacity: 1;
    transform: none;
  }
  .cta-button.cta-pulse { animation: none; }
  .setup-time-value.frozen { animation: none; }
  .control-btn.flash { animation: none; }
  .progress-fill { transition: none; }
}

/* ====================================================================== */
/* === Mobile portrait (<768px) === */
/* ====================================================================== */

@media (max-width: 767px) {
  body { overflow-y: auto; }
  .stage { height: auto; min-height: 100vh; grid-template-rows: auto auto auto; }

  .topbar {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .wordmark { font-size: 22px; }
  .brand-tag { font-size: 9px; }
  .setup-time-value { font-size: 26px; min-width: 70px; }

  .stage-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 12px;
    gap: 0;
  }
  .panel {
    padding: 18px 20px;
    border-radius: var(--r-md);
  }
  .panel:first-child {
    border-radius: var(--r-md) var(--r-md) 0 0;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }
  .panel:last-child {
    border-radius: 0 0 var(--r-md) var(--r-md);
  }

  .transcript { font-size: 14px; min-height: 80px; }
  .mic-area { min-height: 48px; padding: 10px 14px; }
  .mic-icon { width: 32px; height: 32px; font-size: 20px; }

  .spec-row { padding: 8px 10px; }
  .spec-row-value { font-size: 13px; }

  .scenario-picker {
    padding: 10px 14px;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: thin;
  }
  .scenario-pill { flex-shrink: 0; }
  .scenario-pill-title { font-size: 12px; }
  .scenario-pill-meta { font-size: 8px; }

  .controls {
    padding: 0 14px 10px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .control-btn { font-size: 12px; padding: 6px 10px; }
  .control-btn kbd { display: none; }
}
