/* ==========================================================================
   AI Receptionist page — "Follow one call" scroll story + live call panel.
   Only transform + opacity are animated. Reduced motion: transitions off,
   screens simply swap.
   ========================================================================== */

/* ---- Follow one call --------------------------------------------------- */

.story-grid {
  display: grid;
  gap: var(--s-8);
  margin-top: var(--s-8);
}

.story-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.story-step {
  display: grid;
  align-content: center;
  gap: var(--s-3);
  max-width: 460px;
  padding-block: var(--s-6);
}

.story-num {
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-label);
  color: var(--blue-ink);
}

.story-h {
  font-size: var(--fs-h3);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-snug);
  font-weight: 600;
}

.story-step p {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--graphite);
  text-wrap: pretty;
}

.story-foot {
  margin-top: var(--s-4);
  font-size: var(--fs-small);
  color: var(--mute);
  text-align: center;
}

/* The phone only exists when JavaScript can drive it. */
.story-stage-wrap { display: none; }
.js .story-stage-wrap { display: block; }

.story-stage {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--s-4);
  height: 100%;
  min-height: 420px;
  border-radius: var(--r-xl);
  background: var(--night);
  box-shadow: var(--shadow-product);
  overflow: hidden;
}

.story-glow {
  position: absolute;
  inset: auto -20% -35% -20%;
  height: 70%;
  background: radial-gradient(closest-side, rgba(221, 161, 140, 0.28), transparent);
  pointer-events: none;
}

.phone {
  position: relative;
  width: 290px;
  height: 560px;
  padding: 9px;
  border-radius: 46px;
  background: #15211b;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.12), 0 40px 80px -30px rgba(0, 0, 0, 0.6);
  flex: none;
}

.phone-notch {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 3;
  width: 84px;
  height: 22px;
  border-radius: 12px;
  background: #15211b;
  transform: translateX(-50%);
}

.phone-screen {
  position: relative;
  height: 100%;
  border-radius: 38px;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}

.story-dots {
  display: flex;
  gap: 8px;
}

.story-dots i {
  width: 22px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  transition: background-color var(--dur-md) var(--ease-standard);
}

.story-dots i.is-on { background: var(--blue-soft); }

/* Steps dim until they're the current one (JS only). */
.js .story-step {
  min-height: 46vh;
  opacity: 0.28;
  transition: opacity var(--dur-lg) var(--ease-standard);
}

.js .story-step.is-active { opacity: 1; }

/* ---- Screens ------------------------------------------------------------ */

.scr {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 52px 18px 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-md) var(--ease-standard), visibility 0s linear var(--dur-md);
}

.scr.is-active {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.scr > * {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--dur-lg) var(--ease-out), transform var(--dur-lg) var(--ease-out);
}

.scr.is-active > * { opacity: 1; transform: none; }
.scr.is-active > *:nth-child(1) { transition-delay: 60ms; }
.scr.is-active > *:nth-child(2) { transition-delay: 200ms; }
.scr.is-active > *:nth-child(3) { transition-delay: 380ms; }
.scr.is-active > *:nth-child(4) { transition-delay: 600ms; }

.scr:not(.is-active) * { animation-play-state: paused; }

.scr-title { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; text-align: center; }
.scr-title--sm { font-size: 0.8rem; font-weight: 500; font-family: var(--font-mono); letter-spacing: 0.02em; color: var(--mute); text-align: left; }
.scr-sub { text-align: center; font-size: 1rem; color: var(--graphite); }
.scr-note { text-align: center; font-size: 0.85rem; line-height: 1.5; color: var(--mute); }
.scr-note--center { margin-top: auto; }

.scr--ring { align-items: center; justify-content: center; padding-top: 70px; gap: 10px; }

.ring-pulse {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin-bottom: 14px;
}

.ring-pulse span {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--night);
  color: var(--paper);
}

.ring-pulse .icon { width: 26px; height: 26px; }

.ring-pulse i {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--night);
  opacity: 0;
  animation: story-ring 2.2s var(--ease-out) infinite;
}

.ring-pulse i:nth-child(2) { animation-delay: 0.9s; }

@keyframes story-ring {
  0% { transform: scale(0.7); opacity: 0.55; }
  100% { transform: scale(1.5); opacity: 0; }
}

.scr-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--r-pill);
  background: var(--night);
  color: var(--paper);
  font-size: 0.72rem;
}

.scr-bar strong { font-weight: 500; flex: 1; }
.scr-bar .mono { color: var(--night-text-3); }

.scr-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  animation: live-ping 2s var(--ease-out) infinite;
}

.scr--answer .wave {
  height: 54px;
  padding: 0 10px;
  border-radius: var(--r-md);
  background: var(--night);
}

.bubble {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 0.86rem;
  line-height: 1.45;
}

.bubble--ai { align-self: flex-start; background: var(--night); color: var(--paper); border-bottom-left-radius: 5px; }
.bubble--caller { align-self: flex-end; background: var(--paper-3); color: var(--ink); border-bottom-right-radius: 5px; }
.bubble--sms { align-self: flex-start; background: #e4efe0; color: var(--ink); border-bottom-left-radius: 5px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: rgba(221, 161, 140, 0.28);
  color: #7a3f2b;
  font-size: 0.72rem;
  font-weight: 550;
}

.slots-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }

.slots-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: var(--paper-2);
  font-size: 0.8rem;
  color: var(--mute);
}

.slots-list em { font-style: normal; }
.slots-list .is-pick { background: var(--night); color: var(--paper); box-shadow: 0 0 0 3px rgba(221, 161, 140, 0.55); }
.slots-list .is-pick em { color: var(--blue-soft); }

.booked-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--r-md);
  background: var(--night);
  color: var(--paper);
}

.booked-card > div { display: grid; gap: 2px; }
.booked-card .mono { font-size: 0.78rem; color: var(--night-text-2); }

.booked-check {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--signal);
  color: #0e2a1b;
}

.booked-check .icon { width: 16px; height: 16px; stroke-width: 2.2; }

.scr--owner {
  padding-top: 64px;
  background: linear-gradient(180deg, var(--night) 0%, var(--night-2) 100%);
  color: var(--paper);
}

.lock-time { text-align: center; font-size: 3rem; font-weight: 300; letter-spacing: -0.04em; margin-bottom: 8px; }

.notif {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border-radius: var(--r-md);
  background: rgba(247, 244, 238, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.notif-head { display: flex; align-items: center; gap: 8px; font-size: 0.72rem; color: var(--night-text-2); }
.notif-head strong { flex: 1; font-weight: 500; }
.notif-app { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--paper); color: var(--night); }
.notif-app .icon { width: 13px; height: 13px; }
.notif-title { font-size: 0.92rem; font-weight: 600; }
.notif-body { font-size: 0.8rem; line-height: 1.45; color: var(--night-text-2); }
.scr--owner .scr-note { color: var(--night-text-3); }

/* ---- Desktop: steps left, phone pinned right --------------------------- */

@media (min-width: 900px) {
  .js .story-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: start;
  }

  /* The phone starts right under the heading, then pins itself to the
     vertical middle of the screen (below the nav) once you scroll past that
     point. --ph is the phone height; the stage adds 68px of padding/dots. */
  .story-grid { --ph: max(430px, min(560px, calc(100vh - var(--nav-h) - 210px))); }

  .js .story-stage-wrap {
    position: sticky;
    top: calc(var(--nav-h) + (100vh - var(--nav-h) - var(--ph) - 68px) / 2);
  }

  .story-stage {
    height: auto;
    min-height: 0;
    padding-block: 26px 22px;
  }

  /* The phone shrinks on short windows instead of being cropped. */
  .phone {
    width: auto;
    height: var(--ph);
    aspect-ratio: 290 / 560;
  }

  /* A little room after the last step so the phone stays centred while it plays. */
  .js .story-steps { padding-bottom: 14vh; }

  .story-step { padding-left: clamp(0rem, 3vw, 3rem); }
}

/* ---- Phones: phone pinned on top, steps scroll beneath ------------------ */

@media (max-width: 899px) {
  .js .story-stage-wrap {
    position: sticky;
    top: calc(var(--nav-h-compact) + 8px);
    z-index: 4;
    order: -1;
    height: 410px;
  }

  .story-stage { min-height: 0; padding-top: 10px; gap: 6px; }
  .phone { transform: scale(0.64); transform-origin: 50% 0; margin-bottom: -200px; }
  .js .story-step { min-height: 42vh; align-content: start; padding-top: var(--s-6); }
  .story-step p { font-size: var(--fs-body); }
}

@media (prefers-reduced-motion: reduce) {
  .scr, .scr > *, .story-step, .story-dots i { transition: none; }
  .ring-pulse i, .scr-live { animation: none; }
}

/* ---- Try it live --------------------------------------------------------- */

.tryit-grid {
  display: grid;
  gap: var(--s-10);
  align-items: center;
}

@media (min-width: 900px) {
  .tryit-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 5rem); }
}

.tryit-copy { display: grid; gap: var(--s-5); align-content: start; }

.tryit-form { display: grid; gap: var(--s-5); max-width: 520px; margin-top: var(--s-2); }
.tryit-personal { display: grid; gap: var(--s-5); }
.tryit-personal[hidden] { display: none; }

.tryit-field { display: grid; gap: 8px; }

.tryit-field label,
.tryit-types legend {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--night-text-2);
}

.tryit-field input {
  height: 54px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px var(--night-line-strong);
  color: var(--night-text);
  font-size: 1.0625rem;
  transition: box-shadow var(--dur-sm) var(--ease-standard), background-color var(--dur-sm) var(--ease-standard);
}

.tryit-field input::placeholder { color: var(--night-text-3); }

.tryit-field input:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1.5px var(--blue-soft), 0 0 0 4px rgba(184, 201, 181, 0.18);
}

.tryit-types { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.tryit-types legend { width: 100%; padding: 0; margin-bottom: 8px; }
.tryit-types label { position: relative; }
.tryit-types input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }

.tryit-types span {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  font-size: var(--fs-small);
  color: var(--night-text-2);
  box-shadow: inset 0 0 0 1px var(--night-line-strong);
  transition: background-color var(--dur-sm) var(--ease-standard), color var(--dur-sm) var(--ease-standard);
}

.tryit-types input:checked + span { background: var(--night-text); color: var(--ink); box-shadow: none; }
.tryit-types input:focus-visible + span { outline: 2px solid var(--blue-soft); outline-offset: 2px; }

.tryit-preview {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px var(--night-line);
}

.tryit-preview .mono { font-size: var(--fs-micro); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--night-text-3); }
.tryit-preview em { font-style: normal; font-size: 1.0625rem; line-height: 1.45; overflow-wrap: anywhere; }

.tryit-start { width: 100%; min-height: 56px; }
.tryit-start[aria-busy="true"] { opacity: 0.7; pointer-events: none; }
.tryit-consent { font-size: var(--fs-xs); line-height: 1.5; color: var(--night-text-3); }
.tryit-consent a { color: var(--night-text-2); }

.tryit--solo .tryit-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; }
.tryit--solo .tryit-copy { justify-items: center; }

/* Call panel */

.tryit-panel {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 1rem + 1.5vw, 28px);
  border-radius: var(--r-xl);
  background: var(--night-2);
  box-shadow: inset 0 0 0 1px var(--night-line-strong), var(--shadow-product);
}

.tryit-panel[hidden] { display: none; }

.tp-head { display: flex; align-items: center; gap: 12px; }
.tp-head-text { display: grid; gap: 2px; min-width: 0; }
.tp-head-text strong { font-size: 15px; font-weight: 550; }
.tp-head-text span { font-size: 12px; color: var(--night-text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-head .call-timer { margin-left: auto; }
.tp-head .biz-mark .icon { width: 18px; height: 18px; }

.tp-transcript {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 300px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--night);
  box-shadow: inset 0 0 0 1px var(--night-line);
  overflow-y: auto;
}

.tp-empty { margin: auto; max-width: 30ch; text-align: center; font-size: 14px; color: var(--night-text-3); }
.tp-empty[hidden] { display: none; }

.tp-line { font-size: 0.95rem; line-height: 1.5; color: var(--night-text); }
.tp-line--you { color: var(--night-text-2); }

.tp-who {
  display: block;
  margin-bottom: 2px;
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--blue-soft);
}

.tp-line--you .tp-who { color: var(--violet-soft); }

.tp-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 40px; }
.tp-foot .btn { min-height: 42px; }
.tp-foot [hidden] { display: none; }
.tp-note { font-size: var(--fs-small); color: var(--night-text-2); }
.tp-note .text-link { color: var(--night-text); }

.tryit-panel[data-state="live"] .call-timer { color: var(--signal-soft); }
.tryit-panel[data-state="error"] .tp-head-text strong { color: var(--violet-soft); }
