/* ============================================================
   retell.cameronobrien.dev  —  purple glassmorphism
   palette + glass spec lifted from cameronobrien.dev,
   typographic + compositional voice tuned for a voice-AI demo
   ============================================================ */

:root {
  --primary:        #5566d8;
  --primary-light:  #7788ff;
  --accent:         #8b5cf6;
  --accent-light:   #a78bfa;
  --accent-deep:    #6a3b92;

  --live:           #10b981;   /* emerald "live" dot */
  --warn:           #f59e0b;

  --glass-bg:             rgba(0, 0, 0, 0.15);
  --glass-bg-strong:      rgba(0, 0, 0, 0.28);
  --glass-bg-hover:       rgba(0, 0, 0, 0.25);
  --glass-border:         rgba(255, 255, 255, 0.30);
  --glass-border-hover:   rgba(255, 255, 255, 0.45);
  --glass-border-soft:    rgba(255, 255, 255, 0.15);
  --glass-shadow:         0 20px 60px rgba(0, 0, 0, 0.30);
  --glass-shadow-hover:   0 30px 80px rgba(0, 0, 0, 0.40), 0 0 40px rgba(255, 255, 255, 0.18);

  --text:         #ffffff;
  --text-soft:    rgba(255, 255, 255, 0.92);
  --text-muted:   rgba(255, 255, 255, 0.72);
  --text-quiet:   rgba(255, 255, 255, 0.52);

  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 10px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", "Helvetica Neue", system-ui, -apple-system, sans-serif;
  --display: "Fraunces", "Playfair Display", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------- ambient background: fixed gradient + drifting orbs + grain ---- */
body {
  background:
    radial-gradient(1200px 800px at 85% -10%, rgba(167, 139, 250, 0.55), transparent 60%),
    radial-gradient(900px 700px at -5% 110%, rgba(85, 102, 216, 0.55), transparent 55%),
    linear-gradient(135deg, #5566d8 0%, #6a3b92 100%);
  background-attachment: fixed;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  /* drifting orb one */
  content: "";
  position: fixed;
  top: -10%;
  right: -8%;
  width: 46vw;
  height: 46vw;
  max-width: 720px;
  max-height: 720px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(167, 139, 250, 0.55), transparent 60%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
  animation: drift-a 22s ease-in-out infinite alternate;
}
body::after {
  /* drifting orb two + grain */
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(600px 500px at 10% 90%, rgba(119, 136, 255, 0.35), transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: soft-light;
}
@keyframes drift-a {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-6vw, 8vh) scale(1.1); }
}

/* --------- layout ---- */
main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 28px 80px;
}

/* --------- hero ---- */
.hero { margin-bottom: 48px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(167, 139, 250, 0.45);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-soft);
  box-shadow: 0 6px 24px rgba(167, 139, 250, 0.2);
  margin-bottom: 22px;
}
.badge::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65);
  animation: live-pulse 1.8s ease-out infinite;
}

.hero h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(40px, 6.2vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0 0 22px;
  max-width: 20ch;
  color: var(--text);
  text-wrap: balance;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent-light);
  font-weight: 500;
}

.hero .sub {
  font-size: 17.5px;
  color: var(--text-muted);
  max-width: 66ch;
  line-height: 1.65;
}

/* --------- shared glass surface ---- */
.card,
.pane,
.status-bar,
.post,
.tool-call {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  position: relative;
  overflow: hidden;
}

/* signature shimmer sweep (inherited from cameronobrien.dev) */
.card::before,
.pane::before,
.tool-call::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  transform: translateX(-100%) rotate(45deg);
  transition: transform 0.85s var(--ease);
  pointer-events: none;
  z-index: 0;
}
.card:hover::before,
.pane:hover::before,
.tool-call:hover::before {
  transform: translateX(100%) rotate(45deg);
}
.card > *, .pane > *, .status-bar > *, .post > *, .tool-call > * {
  position: relative;
  z-index: 1;
}

/* --------- start card ---- */
.start-card {
  border-radius: var(--r-lg);
  padding: 28px;
  margin-bottom: 36px;
}

.start-card form label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

input[type="tel"] {
  flex: 1;
  font: inherit;
  font-size: 18px;
  font-family: var(--mono);
  padding: 16px 18px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
  letter-spacing: 0.02em;
}
input[type="tel"]::placeholder { color: var(--text-quiet); }
input[type="tel"]:focus {
  border-color: var(--accent-light);
  background: rgba(0, 0, 0, 0.32);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.18);
}

button {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 16px 26px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: var(--text);
  cursor: pointer;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), opacity 180ms var(--ease);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.38);
}
button::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  transform: translateX(-100%) rotate(45deg);
  transition: transform 0.7s var(--ease);
  pointer-events: none;
}
button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.5);
}
button:hover::before { transform: translateX(100%) rotate(45deg); }
button:active { transform: translateY(0) scale(0.98); }
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.fineprint {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.error {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: rgba(244, 63, 94, 0.16);
  border: 1px solid rgba(244, 63, 94, 0.36);
  color: #fecdd3;
  font-size: 14px;
  font-weight: 500;
}

/* --------- call card (post-reserve: number + word) ---- */
.call-card {
  border-radius: var(--r-lg);
  padding: 28px;
  margin-bottom: 24px;
}

.call-card-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.call-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.call-number {
  font-family: var(--display);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-size: clamp(34px, 5.5vw, 58px);
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.3);
  padding-bottom: 6px;
  transition: color 200ms var(--ease), border-color 200ms var(--ease);
}
.call-number:hover {
  color: var(--accent-light);
  border-bottom-color: var(--accent-light);
}

.call-word-wrap {
  text-align: right;
  padding: 16px 24px 18px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(85, 102, 216, 0.32), rgba(139, 92, 246, 0.32));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 40px rgba(139, 92, 246, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.call-word-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.call-word {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.01em;
  text-shadow: 0 2px 18px rgba(167, 139, 250, 0.35);
}

@media (max-width: 640px) {
  .call-row { flex-direction: column; align-items: flex-start; }
  .call-word-wrap { text-align: left; width: 100%; }
}

/* --------- live session ---- */
.live { }

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-radius: var(--r-md);
  margin-bottom: 18px;
  font-size: 14px;
  background: var(--glass-bg-strong);
}

.status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  color: var(--text-soft);
}
.status .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: live-pulse 1.6s ease-out infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70%  { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.meta {
  display: flex;
  gap: 22px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
}
#timer {
  color: var(--text);
  padding: 2px 10px;
  border: 1px solid var(--glass-border-soft);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
}

/* --------- panes ---- */
.panes {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
}
@media (max-width: 1000px) {
  .panes { grid-template-columns: 1fr; }
}

.pane {
  border-radius: var(--r-lg);
  padding: 22px 22px 14px;
  display: flex;
  flex-direction: column;
  min-height: 380px;
  max-height: 620px;
}

.pane h3 {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.pane-idx {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: 32px;
  letter-spacing: 0;
  color: var(--accent-light);
  line-height: 1;
  -webkit-text-stroke: 0;
  opacity: 0.95;
  text-shadow: 0 2px 18px rgba(167, 139, 250, 0.35);
}

.pane-sub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.pane-body {
  flex: 1;
  overflow-y: auto;
  font-size: 14px;
  padding: 14px 4px 4px;
  border-top: 1px solid var(--glass-border-soft);
  scroll-behavior: smooth;
}
.pane-body::-webkit-scrollbar { width: 8px; }
.pane-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 99px;
}
.pane-body::-webkit-scrollbar-track { background: transparent; }

.placeholder {
  color: var(--text-quiet);
  font-style: italic;
  font-size: 13px;
  padding: 8px 0;
}

/* --------- transcript turns ---- */
.turn {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}
.turn:last-child { border-bottom: 0; }
.turn .who {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
  backdrop-filter: blur(10px);
}
.turn.agent .who {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.55), rgba(85, 102, 216, 0.55));
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.turn.user .who {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
  border: 1px solid var(--glass-border-soft);
}
.turn .content {
  color: var(--text-soft);
  line-height: 1.5;
}

/* --------- reasoning entries ---- */
.reason {
  margin-bottom: 12px;
  padding: 10px 14px 10px 16px;
  border-left: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.reason.tool-trigger {
  border-left-color: var(--accent-light);
  background: rgba(139, 92, 246, 0.14);
}
.reason .label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.reason .body {
  font-size: 13.5px;
  color: var(--text-soft);
  word-break: break-word;
}

/* --------- tool calls ---- */
.tool-call {
  margin-bottom: 14px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.22);
}
.tool-call .head {
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(85, 102, 216, 0.55), rgba(139, 92, 246, 0.55));
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.tool-call .status-pill {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.25);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.5);
  text-transform: uppercase;
}
.tool-call.done .status-pill {
  background: rgba(16, 185, 129, 0.22);
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.5);
}
.tool-call .kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-soft);
  word-break: break-word;
}
.tool-call .kv .k { color: var(--text-quiet); }
.tool-call .kv .v { color: var(--text); }

/* --------- post / end-of-call summary ---- */
.post {
  margin-top: 20px;
  padding: 24px;
  border-radius: var(--r-lg);
}
.post h3 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.01em;
}
.post p {
  color: var(--text-soft);
  margin: 0 0 10px;
  line-height: 1.6;
}
.post p:last-of-type { color: var(--text-muted); }
#reset-btn { margin-top: 12px; }

/* --------- footer ---- */
.footer {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--glass-border-soft);
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer a {
  color: var(--text-soft);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 180ms var(--ease), text-decoration-color 180ms var(--ease);
}
.footer a:hover {
  color: var(--accent-light);
  text-decoration-color: var(--accent-light);
}

/* --------- small responsive tidy ---- */
@media (max-width: 640px) {
  main { padding: 40px 18px 64px; }
  .row { flex-direction: column; }
  button { width: 100%; }
}
