/* ================================================================
   Demo page — public simulated call experience
   Three stages: picker → call stage (phone + transcript + decisions) → recap
   ================================================================ */

/* ------------ Shared page scaffold ------------ */
.demo-page { min-height: calc(100vh - 72px); background: var(--bg); color: var(--fg); }

/* ============================================================
   STAGE 1: PICKER
   ============================================================ */
.demo-picker {
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 24px 96px;
}
.demo-hero { text-align: center; margin-bottom: 56px; }
.demo-title {
  font-family: var(--font-display);
  font-size: clamp(48px, 7vw, 88px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 20px 0 24px;
  color: var(--fg);
}
.demo-title em {
  font-style: italic;
  background: linear-gradient(90deg, var(--mk-orange), #C85A1F);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.demo-sub {
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg-muted);
  max-width: 580px;
  margin: 0 auto;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.scenario-card {
  --sc-color: var(--mk-orange);
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  transition: all .2s var(--ease);
  color: var(--fg);
}
.scenario-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--border-strong); }
.scenario-card.on {
  border-color: var(--sc-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc-color) 18%, transparent), var(--sh-md);
  background: var(--bg-elev);
}
.scenario-emoji {
  font-size: 32px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--sc-color) 12%, transparent);
  border-radius: 14px;
  flex-shrink: 0;
}
.scenario-meta { flex: 1; min-width: 0; }
.scenario-biz { font-size: 15px; font-weight: 500; color: var(--fg); margin-bottom: 2px; }
.scenario-tag { font-size: 12.5px; color: var(--fg-muted); }
.scenario-num { font-size: 11px; color: var(--fg-faint); font-family: var(--font-mono); }
.scenario-check {
  position: absolute;
  top: 12px; right: 12px;
  width: 22px; height: 22px;
  background: var(--sc-color);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.demo-cta-row {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 72px;
}

.demo-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}
.demo-feat {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.demo-feat svg { margin-top: 4px; flex-shrink: 0; }

/* ============================================================
   STAGE 2: CALL STAGE (3-column: phone | transcript | decisions)
   ============================================================ */
.call-stage {
  display: grid;
  grid-template-columns: 360px 1fr 340px;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  min-height: calc(100vh - 72px);
}
@media (max-width: 1180px) {
  .call-stage { grid-template-columns: 320px 1fr; }
  .call-decisions-col { grid-column: 1 / -1; max-height: 320px; }
}
@media (max-width: 860px) {
  .call-stage { grid-template-columns: 1fr; padding: 16px; }
  .call-phone-col { order: -1; }
}

/* ----- Phone column ----- */
.call-phone-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 88px;
  align-self: flex-start;
}

.phone-device {
  width: 280px;
  height: 580px;
  background: #0A0A0A;
  border-radius: 48px;
  padding: 10px;
  box-shadow:
    0 30px 60px rgba(0,0,0,.3),
    0 0 0 1px rgba(255,255,255,.05) inset,
    0 0 0 3px #1a1a1a;
  position: relative;
  overflow: hidden;
}
.phone-notch {
  position: absolute;
  top: 18px; left: 50%;
  transform: translateX(-50%);
  width: 100px; height: 28px;
  background: #000;
  border-radius: 16px;
  z-index: 2;
}
.phone-screen-inner {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #1a1a1f, #0d0d12);
  border-radius: 38px;
  overflow: hidden;
  position: relative;
  padding: 52px 20px 20px;
  display: flex;
  flex-direction: column;
}

/* Dialing state */
.phone-dialing {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}
.phone-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.phone-avatar.big { width: 96px; height: 96px; font-size: 42px; }
.dialing-dots span {
  display: inline-block;
  animation: dd 1.4s infinite;
  opacity: 0;
}
.dialing-dots span:nth-child(2) { animation-delay: .2s; }
.dialing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dd { 0%, 20% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }

.ring-ripple {
  position: absolute;
  top: 50%; left: 50%;
  width: 96px; height: 96px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.ring-ripple span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--mk-orange);
  opacity: 0;
  animation: ripple 2s infinite;
}
.ring-ripple span:nth-child(2) { animation-delay: .66s; }
.ring-ripple span:nth-child(3) { animation-delay: 1.33s; }
@keyframes ripple {
  0% { transform: scale(1); opacity: .7; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* Active call state */
.phone-active {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 12px;
}
.phone-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(255,255,255,.05);
  border-radius: 14px;
}
.call-timer {
  font-size: 12px;
  color: #4ade80;
  font-weight: 500;
}
.phone-middle {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 0;
}
.speaker-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255,255,255,.5);
  font-weight: 600;
}
.demo-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5px;
  height: 56px;
  width: 100%;
}
.demo-wave span {
  display: block;
  width: 3px;
  min-height: 4px;
  border-radius: 2px;
  transition: height .12s ease, opacity .2s ease;
}

.caller-you {
  width: 100%;
  padding: 12px;
  background: rgba(255,255,255,.04);
  border-radius: 12px;
  text-align: center;
}
.mini-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--mk-orange), var(--mk-purple));
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

.phone-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding-bottom: 8px;
}
.phone-ctrl {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.phone-ctrl:hover { background: rgba(255,255,255,.2); }
.phone-hangup {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  border: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(220, 38, 38, .4);
  transition: transform .2s;
}
.phone-hangup:hover { transform: scale(1.05); }

.phone-caption {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-muted);
}

/* ----- Dialpad (unused right now but included for future starts) ----- */
.dialpad {
  padding: 8px;
  color: #fff;
}
.dialpad-display {
  font-family: var(--font-mono);
  font-size: 22px;
  text-align: center;
  padding: 16px 0;
  color: #fff;
  letter-spacing: 0.05em;
}
.dialpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.dialpad-key {
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: 0;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.dp-num { font-size: 24px; font-weight: 400; }
.dp-sub { font-size: 9px; letter-spacing: .15em; color: rgba(255,255,255,.5); }
.dialpad-call {
  width: 56px; height: 56px; border-radius: 50%;
  background: #10b981;
  border: 0;
  color: #fff;
  display: block;
  margin: 20px auto 0;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(16,185,129,.4);
}

/* ============================================================
   Transcript column
   ============================================================ */
.call-transcript-col {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  min-height: 560px;
  max-height: calc(100vh - 120px);
  position: relative;
}
.transcript-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.transcript-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.transcript-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--fg-muted);
  padding: 40px;
}

.transcript-line {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  animation: line-in .3s var(--ease) both;
}
@keyframes line-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.transcript-line.is-mk {
  align-self: flex-start;
  background: color-mix(in srgb, var(--mk-orange) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--mk-orange) 25%, transparent);
  color: var(--fg);
}
.transcript-line.is-caller {
  align-self: flex-end;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--fg);
}
.transcript-who {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--fg-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.transcript-time { font-size: 10px; color: var(--fg-faint); font-weight: 400; letter-spacing: .05em; }
.transcript-text { color: var(--fg); }

.cursor-blink {
  display: inline-block;
  width: 6px;
  height: 14px;
  background: var(--mk-orange);
  margin-left: 4px;
  vertical-align: middle;
  animation: cur 1s steps(2) infinite;
}
@keyframes cur { 50% { opacity: 0; } }

.typing-dots {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}
.typing-dots span {
  width: 6px; height: 6px;
  background: var(--fg-muted);
  border-radius: 50%;
  animation: td 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes td { 0%, 60%, 100% { opacity: .3; transform: scale(.8); } 30% { opacity: 1; transform: scale(1); } }

/* Action toasts stacked bottom-right of transcript */
.action-stack {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
  z-index: 5;
  pointer-events: none;
}
.action-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 4px solid var(--mk-orange);
  border-radius: 10px;
  box-shadow: var(--sh-lg);
  animation: toast-in .4s var(--ease-spring) both;
  backdrop-filter: blur(20px);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px) scale(.9); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
.action-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.action-title { font-size: 13px; font-weight: 500; color: var(--fg); }
.action-sub { font-size: 11.5px; color: var(--fg-muted); }

/* ============================================================
   Decisions column (right)
   ============================================================ */
.call-decisions-col {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  max-height: calc(100vh - 120px);
}
.decisions-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.decisions-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.decision-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.decision-icon {
  width: 24px; height: 24px;
  background: color-mix(in srgb, var(--mk-orange) 14%, transparent);
  color: var(--mk-orange);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.decision-signal {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg);
  font-weight: 500;
  word-break: break-all;
}
.decision-action {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--mk-orange);
  margin-top: 2px;
}
.decision-time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-faint);
}

/* ============================================================
   STAGE 3: RECAP
   ============================================================ */
.recap-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 24px 96px;
}
.recap-hero { text-align: center; margin-bottom: 48px; }
.recap-badge {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--mk-success);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  animation: check-pop .6s var(--ease-spring) both;
}
@keyframes check-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.recap-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}
.recap-sub {
  font-size: 16px;
  color: var(--fg-muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.5;
}

.recap-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}
@media (max-width: 700px) { .recap-stats { grid-template-columns: repeat(2, 1fr); } }
.recap-stat {
  padding: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.recap-stat-k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--fg-faint);
  font-weight: 600;
  margin-bottom: 8px;
}
.recap-stat-v {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.recap-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}
@media (max-width: 860px) { .recap-grid { grid-template-columns: 1fr; } }

.recap-transcript {
  margin-bottom: 40px;
}
.recap-line {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.recap-line:last-child { border-bottom: 0; }
.recap-line-who {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.recap-line-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.recap-cta {
  padding: 40px;
  background: linear-gradient(135deg, var(--bg-sunken), var(--bg-elev));
  border: 1px solid var(--border);
  border-radius: 20px;
}

/* Dark mode tweaks */
html[data-theme="dark"] .phone-device {
  box-shadow:
    0 30px 60px rgba(0,0,0,.6),
    0 0 0 1px rgba(255,255,255,.08) inset,
    0 0 0 3px #222;
}
