/* Live presenter page (/pitch/{slug}). Tokens follow skill
   teamshared.presentation-design (the deck register, not the console
   brand) so the panel sits beside the deck. Scoped to this page. */
body.pitch {
  --stage-bg: #07080e;
  --slide-bg: #0b0c14;
  --panel: #14162a;
  --panel-2: #1a1d33;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f2f2fa;
  --muted: #a7aac6;
  --faint: #6a6d8e;
  --green: #8fdc3a;
  --blue: #4f8ef7;
  --violet: #a86cf5;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --panel-w: 400px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body.pitch {
  background: var(--stage-bg);
  color: var(--text);
  font-family: var(--font-body);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.pitch-deck { min-width: 0; min-height: 0; }
.pitch-deck iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--stage-bg); }
/* pitch.js shrinks the frame by 1px for two frames to make the deck re-measure. */
.pitch-deck iframe.is-nudged { width: calc(100% - 1px); }

.pitch-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--slide-bg);
  border-left: 1px solid var(--line);
}

.pitch-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
}

/* The circle is where the streamed video replica will sit. */
.pitch-face {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel);
  box-shadow: 0 0 0 2px var(--line-strong);
  transition: box-shadow 0.3s var(--ease);
}
.pitch-face img { width: 40px; height: 40px; border-radius: 10px; }
.pitch-face.is-speaking { animation: pitch-ring 1.4s ease-in-out infinite; }
.pitch-face.is-thinking { box-shadow: 0 0 0 2px var(--violet); }
.pitch-face.is-listening { box-shadow: 0 0 0 2px var(--green); }

/* Cartoon presenter: four stacked frames, one shown at a time. pitch.js
   sets data-frame while the voice speaks (mouth) and now and then (blink). */
.pitch-face.has-avatar {
  position: relative;
  overflow: hidden;
  background: var(--panel);
}
.pitch-face.has-avatar .pitch-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  visibility: hidden;
}
.pitch-face[data-frame="rest"] .pitch-frame[data-frame="rest"],
.pitch-face[data-frame="talk"] .pitch-frame[data-frame="talk"],
.pitch-face[data-frame="wide"] .pitch-frame[data-frame="wide"],
.pitch-face[data-frame="blink"] .pitch-frame[data-frame="blink"] { visibility: visible; }

@keyframes pitch-ring {
  0%, 100% { box-shadow: 0 0 0 2px var(--blue), 0 0 0 6px rgba(79, 142, 247, 0.12); }
  50% { box-shadow: 0 0 0 2px var(--blue), 0 0 0 12px rgba(79, 142, 247, 0.22); }
}

.pitch-kicker {
  margin: 0 0 2px;
  font: 500 11px/1.4 var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue);
}
.pitch-name { margin: 0; font: 400 22px/1.15 var(--font-display); }
.pitch-note { margin: 4px 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.pitch-status { margin: 4px 0 0; min-height: 1.4em; font: 500 12px/1.4 var(--font-mono); color: var(--green); }

.pitch-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.pitch-controls { display: flex; gap: 8px; padding: 14px 18px; }

.pitch-log {
  list-style: none;
  margin: 0;
  padding: 4px 18px 18px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pitch-log li { font-size: 15px; line-height: 1.5; max-width: 92%; }
.pitch-log .from-visitor {
  align-self: flex-end;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px 14px 4px 14px;
  padding: 8px 12px;
}
.pitch-log .from-presenter { align-self: flex-start; color: var(--muted); }
.pitch-log .from-presenter strong {
  display: block;
  font: 500 12px/1.4 var(--font-body);
  color: var(--blue);
  margin-bottom: 2px;
}
.pitch-log .is-error { color: var(--muted); font-style: italic; }
.pitch-log .from-system { align-self: center; font-size: 13px; color: var(--muted); text-align: center; }

.pitch-ask {
  display: flex;
  gap: 8px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
}
.pitch-ask input {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font: 15px var(--font-body);
}
.pitch-ask input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.pitch-primary,
.pitch-ghost,
.pitch-collapse {
  font: 500 14px var(--font-body);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: transparent;
}
.pitch-primary { background: var(--blue); border-color: var(--blue); color: var(--slide-bg); }
.pitch-primary:disabled { opacity: 0.5; cursor: progress; }
.pitch-start { border-color: var(--blue); color: var(--blue); }
.pitch-start[aria-disabled="true"] { opacity: 0.5; cursor: progress; }
.pitch-ghost[aria-pressed="true"] { border-color: var(--green); color: var(--green); }
.pitch-mic[aria-pressed="true"] { background: rgba(143, 220, 58, 0.14); }
.pitch-collapse { padding: 6px 10px; font-size: 12px; color: var(--muted); }
.pitch-primary:focus-visible,
.pitch-ghost:focus-visible,
.pitch-collapse:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.pitch-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Collapsed: the deck takes the room, the presenter stays as a header. */
body.pitch.is-collapsed { --panel-w: 300px; }
body.pitch.is-collapsed .pitch-body { display: none; }
body.pitch.is-collapsed .pitch-panel { justify-content: flex-start; }

/* Phones: deck on top at 16:9, the panel below. */
@media (max-width: 1024px) {
  body.pitch {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .pitch-deck { aspect-ratio: 16 / 9; }
  .pitch-panel { border-left: 0; border-top: 1px solid var(--line); }
  body.pitch.is-collapsed { grid-template-rows: auto auto; }
}

@media (prefers-reduced-motion: reduce) {
  .pitch-face.is-speaking { animation: none; box-shadow: 0 0 0 2px var(--blue); }
}
