/* Layout for every event. Colours and fonts come from events/<slug>/brand/theme.css
   (loaded after this file); the values here are neutral fallbacks. */

:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font);
  --font-tagline: Georgia, serif;
  --bg: #101018;
  --bg-image: none;
  --surface: rgba(255, 255, 255, 0.07);
  --surface-strong: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.2);
  --text: #fff;
  --text-muted: #c9c9d6;
  --accent: #6b5cff;
  --accent-hover: #8577ff;
  --accent-contrast: #fff;
  --accent-2: #6b5cff;
  --tagline: #fff;
  --danger: #ff8a8a;
  --focus: #fff;
  --radius: 16px;
  --stage-glow: none;
  /* Both sides: a phone turned sideways has its notch on one of them. */
  --gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-image);
  background-attachment: fixed;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ---------------------------------------------------------------- header */
.top {
  position: relative;
  z-index: 11;  /* above the kiosk attract button, so the language switch stays usable */
  display: flex;
  align-items: center;
  gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 10px;
}
.logo { height: 34px; width: auto; }
.brandline { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.wordmark { height: 52px; width: auto; max-width: 100%; object-fit: contain; object-position: left; }
.tagline { font-family: var(--font-tagline); color: var(--tagline); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.lang button {
  border: 0; background: transparent; color: var(--text-muted); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 36px;
}
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-contrast); }

/* ------------------------------------------------------------------ main */
main { flex: 1; display: flex; padding: 8px var(--gutter) 12px; min-height: 0; }
.call {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr);
  gap: clamp(16px, 3vw, 40px);
  align-items: center;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* The stage: poster before the call, the avatar during it. */
.stage {
  position: relative;
  aspect-ratio: 4 / 5;
  max-height: calc(100dvh - 150px);
  width: 100%;
  margin: 0 auto;
  border-radius: calc(var(--radius) * 1.5);
  overflow: hidden;
  background: linear-gradient(160deg, var(--surface-strong), var(--surface));
  border: 1px solid var(--border);
  box-shadow: var(--stage-glow);
}
.poster { position: absolute; inset: 0; display: grid; place-items: center; }
.poster .monogram {
  width: 38%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  font: 600 clamp(48px, 10vw, 120px) var(--font-display); color: var(--accent-contrast);
  background: radial-gradient(circle at 30% 30%, var(--accent-hover), var(--accent) 55%, var(--accent-2));
}
.stage[data-avatar="live"] .poster { display: none; }
.avatar, .avatar video { position: absolute; inset: 0; width: 100%; height: 100%; }
.avatar video { object-fit: cover; }
body[data-screen="connecting"] .poster .monogram { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); opacity: 0.85; } }

.stage-status {
  position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 8px;
  background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 7px 12px; border-radius: 999px; font-size: 14px; font-weight: 600;
}
.stage-status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); }
.stage-status[data-state="listening"] .dot { background: #6ee7a8; }
.stage-status[data-state="thinking"] .dot { background: #ffd166; animation: breathe 1s infinite; }
.stage-status[data-state="speaking"] .dot { background: var(--accent-hover); }
.clock {
  position: absolute; top: 14px; right: 14px; background: rgba(0, 0, 0, 0.45);
  padding: 7px 12px; border-radius: 999px; font-size: 14px; font-variant-numeric: tabular-nums;
}
.sound {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--accent); color: var(--accent-contrast); border: 0; border-radius: 999px;
  padding: 14px 22px; font-weight: 700; font-size: 17px; cursor: pointer;
}
.captions {
  position: absolute; left: 12px; right: 12px; bottom: 12px; margin: 0;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 10px 14px; border-radius: 12px; font-size: clamp(15px, 1.6vw, 19px); line-height: 1.4;
  max-height: 40%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
}

/* ------------------------------------------------------------- side panel */
.side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.start h1 { font: 600 clamp(30px, 4vw, 48px)/1.08 var(--font-display); margin: 0 0 4px; letter-spacing: -0.01em; }
.start .role { margin: 0 0 12px; color: var(--accent-hover); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; font-size: 13px; }
.start .intro { margin: 0 0 20px; color: var(--text-muted); font-size: 17px; line-height: 1.5; max-width: 46ch; }
.gate { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-muted); }
.field input {
  min-height: 52px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-strong); color: var(--text); font-size: 17px;
}
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--text-muted); }
.consent input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.privacy { color: var(--text); font-size: 14px; }
.error { color: var(--danger); margin: 0; font-weight: 600; }
.note { color: var(--text-muted); margin: 12px 0 0; }
.hint { color: var(--text-muted); margin: 10px 0 0; font-size: 14px; }
body[data-mode="kiosk"] .hint { display: none; }

.primary, .secondary, .danger {
  min-height: 54px; border-radius: 999px; border: 0; padding: 0 28px; font-size: 18px; font-weight: 700; cursor: pointer;
}
.primary { background: var(--accent); color: var(--accent-contrast); width: 100%; max-width: 420px; }
.primary:hover { background: var(--accent-hover); }
.primary:disabled { opacity: 0.6; cursor: progress; }
.secondary { background: var(--surface-strong); color: var(--text); border: 1px solid var(--border); }
.danger { background: #fff; color: #1a1033; }
.controls { display: flex; gap: 12px; flex-wrap: wrap; }
.controls button { flex: 1; min-width: 130px; }
.line p, .ended p { font-size: 18px; line-height: 1.5; color: var(--text-muted); margin: 0 0 16px; }
.ended h2 { font: 600 clamp(26px, 3vw, 36px) var(--font-display); margin: 0 0 8px; }
.disclosure { font-size: 13px; line-height: 1.45; color: var(--text-muted); margin: 0; max-width: 52ch; opacity: 0.85; }

/* ------------------------------------------------------------------ picker */
.panel { flex: 1; max-width: 960px; margin: 0 auto; width: 100%; }
.panel h1 { font: 600 clamp(28px, 4vw, 44px) var(--font-display); margin: 12px 0 24px; }
.agent-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.agent-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
  padding: 22px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; min-height: 160px;
}
.agent-card:hover { background: var(--surface-strong); }
.agent-card .monogram {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 24px;
  background: var(--accent); color: var(--accent-contrast);
}
.agent-card .name { font: 600 24px var(--font-display); }
.agent-card .role { color: var(--text-muted); }

/* ------------------------------------------------------------------ footer */
.foot { padding: 6px var(--gutter) max(10px, env(safe-area-inset-bottom)); font-size: 12px; color: var(--text-muted); opacity: 0.8; }

/* -------------------------------------------------------------- kiosk mode */
body[data-mode="kiosk"] { cursor: default; user-select: none; -webkit-user-select: none; }
body[data-mode="kiosk"] .primary, body[data-mode="kiosk"] .controls button { min-height: 68px; font-size: 22px; }
/* Attract screen: the start screen (title, intro, AI disclosure all visible) with a
   pulsing prompt where the button was, and the whole screen as the button. */
.attract { position: fixed; inset: 0; z-index: 10; border: 0; padding: 0; margin: 0; cursor: pointer; background: transparent; }
.attract-cta { display: none; }
body[data-screen="attract"] #call { display: grid !important; }
body[data-screen="attract"] #startBtn,
body[data-screen="attract"] #gate,
body[data-screen="attract"] #note { display: none !important; }
body[data-screen="attract"] .attract-cta {
  display: inline-flex; align-items: center; gap: 16px; margin: 4px 0 0;
  padding: 18px 30px; border-radius: 999px; background: var(--accent); color: var(--accent-contrast);
  font: 700 clamp(22px, 2.4vw, 30px) var(--font-display);
}
.attract-cta .pulse {
  flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent-contrast);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); animation: pulse 1.8s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 16px rgba(255, 255, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); } }
body[data-mode="kiosk"] .disclosure { font-size: 15px; }

/* ------------------------------------------------------------------- phone */
@media (max-width: 860px) {
  main { flex: 1 0 auto; }
  /* A column of flex items: grid rows sized an aspect-ratio stage at zero height. */
  .call { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
  body[data-screen="attract"] #call { display: flex !important; }
  .stage { flex: none; aspect-ratio: auto; width: min(100%, 480px); height: min(58dvh, 600px); max-height: none; }
  /* Only the call needs a big stage: before and after it, the words come first. */
  body[data-screen="start"] .stage, body[data-screen="attract"] .stage,
  body[data-screen="line"] .stage, body[data-screen="ended"] .stage { width: min(60vw, 240px); height: min(60vw, 240px, 30dvh); }
  .side { max-width: 520px; margin: 0 auto; width: 100%; }
  .start h1 { font-size: 30px; }
  .primary { max-width: none; }
}
@media (max-width: 420px) {
  .tagline { font-size: 13px; }
  .wordmark { height: 40px; }
  .logo { height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}
