/*
 * The "hear it live" demo phone, used on /hear and on the AI receptionist page.
 * Three screens: enter the Website ID, ready to call, the call. Tokens from site.css only (black, white, greys).
 * Everything is scoped to .hear-device so it can sit on any page without touching that page's styles.
 */

/* Page layout around the phone: heading, phone, steps (phone first under the heading on small screens). */
.hear-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 24px clamp(32px, 6vw, 96px); align-items: start;
  grid-template-areas: "head phone" "how phone";
}
.hear-head { grid-area: head; }
.hear-how { grid-area: how; }
.hear-phone { grid-area: phone; }
@media (max-width: 900px) {
  .hear-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "phone" "how"; }
}
.hear-steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; max-width: 520px; border-top: 1px solid var(--border); }
.hear-steps li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 16px; }
.hear-steps .n { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); padding-top: 2px; }
.hear-note { margin-top: 20px; font-size: 15px; line-height: 1.55; color: var(--text-secondary); max-width: 520px; }
.hear-note a { color: var(--text-primary); text-underline-offset: 4px; text-decoration-color: var(--border-strong); }
.hear-note + .hear-note { margin-top: 10px; }
.hear-caption { text-align: center; margin-top: 14px; font-size: 13px; color: var(--text-dim); }

/* The phone */
.hear-device {
  width: min(340px, 100%); margin: 0 auto; height: 640px; border-radius: 44px; padding: 10px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-device);
}
@media (max-width: 640px) { .hear-device { height: 600px; } }
.hear-device .screen { position: relative; height: 100%; border-radius: 34px; overflow: hidden; background: var(--bg); border: 1px solid var(--border); display: flex; flex-direction: column; }
.hear-device .screen > [data-view] { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.hear-device .screen > [data-view][hidden] { display: none; }
.hear-device .notch { flex: 0 0 auto; height: 30px; display: grid; place-items: center; }
.hear-device .notch::before { content: ''; width: 70px; height: 18px; border-radius: 999px; background: #000000; box-shadow: 0 0 0 1px var(--border-strong); }
.hear-device .pad { padding: 8px 22px 22px; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* 1. Enter the ID */
.hear-device .id-view .pad { justify-content: center; gap: 14px; text-align: center; }
.hear-device .hd-title { font-family: var(--font-display); font-size: 40px; line-height: 0.92; letter-spacing: 0.01em; color: var(--text-primary); }
.hear-device .id-view .input { font-family: var(--font-mono); font-size: 22px; letter-spacing: 0.08em; text-align: center; }
.hear-device .id-view .muted { font-size: 14px; line-height: 1.5; }
.hear-device .err { font-size: 14px; font-weight: 500; color: var(--text-primary); line-height: 1.45; text-align: left; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.hear-device .err[hidden] { display: none; }

/* 2. Ready to call */
.hear-device .who { text-align: center; padding-top: 18px; }
.hear-device .avatar {
  width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 999px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border-strong);
  font-family: var(--font-display); font-size: 34px; letter-spacing: 0.04em; padding-top: 4px; color: var(--text-primary);
}
.hear-device .co { font-size: 21px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hear-device .co-sub { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.hear-device .hd-try { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; }
.hear-device .hd-try p { font-size: 13px; color: var(--text-dim); }
.hear-device .hd-try ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; font-size: 14.5px; line-height: 1.35; }
.hear-device .hd-try li::before { content: '\201C'; color: var(--text-faint); }
.hear-device .hd-try li::after { content: '\201D'; color: var(--text-faint); }
.hear-device .call-actions { display: grid; gap: 4px; margin-top: 16px; }
.hear-device .call-actions .btn-primary { white-space: normal; height: auto; min-height: 52px; padding: 12px 18px; line-height: 1.25; text-align: center; }
.hear-device .mic { font-size: 12.5px; color: var(--text-dim); text-align: center; margin-top: 8px; }
.hear-device .change { font-size: 13px; color: var(--text-secondary); padding: 8px; }

/* 3. The call */
.hear-device .call-bar { flex: 0 0 auto; padding: 4px 18px 12px; text-align: center; border-bottom: 1px solid var(--border); }
.hear-device .call-bar .co { font-size: 17px; }
.hear-device .call-meta { display: flex; justify-content: center; gap: 8px; margin-top: 3px; font-size: 12.5px; color: var(--text-dim); }
.hear-device .call-meta .mono { color: var(--text-secondary); }
.hear-device .log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; }
.hear-device .log:empty::before { content: attr(data-empty); margin: auto; text-align: center; font-size: 13px; color: var(--text-dim); max-width: 24ch; }
.hear-device .line { max-width: 86%; padding: 8px 11px; border-radius: 15px; font-size: 13.5px; line-height: 1.4; }
.hear-device .line[data-who="ai"] { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.hear-device .line[data-who="me"] { align-self: flex-end; background: var(--ink); color: var(--ink-contrast); border-bottom-right-radius: 5px; }
.hear-device .line.partial .t::after { content: ' \2026'; opacity: 0.5; }
.hear-device .call-foot { flex: 0 0 auto; padding: 10px 18px 18px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.hear-device .call-note { font-size: 13px; line-height: 1.45; color: var(--text-secondary); text-align: center; }
.hear-device .call-note[hidden] { display: none; }

/* The receptionist's voice level */
.hear-device .wave { display: flex; align-items: center; justify-content: center; gap: 4px; height: 30px; --v: 0; }
.hear-device .wave i { width: 4px; border-radius: 4px; background: var(--text-faint); height: calc(4px + var(--v) * var(--h) * 26px); transition: height 90ms linear, background var(--ease); }
.hear-device[data-speaking="true"] .wave i { background: var(--text-primary); }
.hear-device .wave i:nth-child(1), .hear-device .wave i:nth-child(9) { --h: 0.35; }
.hear-device .wave i:nth-child(2), .hear-device .wave i:nth-child(8) { --h: 0.6; }
.hear-device .wave i:nth-child(3), .hear-device .wave i:nth-child(7) { --h: 0.8; }
.hear-device .wave i:nth-child(4), .hear-device .wave i:nth-child(6) { --h: 0.95; }
.hear-device .wave i:nth-child(5) { --h: 1; }
.hear-device[data-state="connecting"] .wave i { animation: hear-wait 1.2s ease-in-out infinite; animation-delay: calc(var(--h) * -1s); }
.hear-device[data-state="ended"] .wave, .hear-device[data-state="failed"] .wave { display: none; }
@keyframes hear-wait { 0%, 100% { height: 4px; } 50% { height: 12px; } }

@media (prefers-reduced-motion: reduce) {
  .hear-device .log { scroll-behavior: auto; }
  .hear-device .wave i { transition: none; }
  .hear-device[data-state="connecting"] .wave i { animation: none; }
}
