/* Homepage live scan + conversation card. Loaded as a file (CSP style-src 'self'); no inline styles. */

/* Sections whose own rules set display must still honor [hidden]. */
.home-page[data-redesign] #redesign-hero[hidden],
.home-page[data-redesign] #redesign-intro[hidden],
.home-page[data-redesign] #redesign-how[hidden],
.home-page[data-redesign] #scan-live[hidden],
.home-page[data-redesign] .scan-call [hidden] { display: none !important; }

/* Optional voice opt-in sits under the scan consent with the same look. */
.home-page[data-redesign] .redesign-voice-optin { margin-top: 6px; }

/* During a scan the orb launcher steps aside: the conversation card is the one live agent on screen. */
.home-page[data-redesign].scan-active #hubbly-voice-assistant { display: none !important; }

.scan-live {
  --scan-orange: var(--hubbly-orange, #ff7029);
  position: relative;
  z-index: 1;
  padding: 116px 16px calc(96px + env(safe-area-inset-bottom));
  color: #fff;
}
.scan-live-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto 16px;
}
.scan-live-title { margin: 0; font-size: 14px; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.78); overflow-wrap: anywhere; }
.scan-live-title strong { color: #fff; }
.scan-live-new {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background: transparent;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.scan-live-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; max-width: 1200px; margin: 0 auto; }
.scan-live-main { min-width: 0; }

/* Spotlight: the scanner's real stages in an orange frame. */
.scan-live .redesign-scan-progress { min-height: 0; padding: 0; margin: 0; border-top: 0; background: transparent; }
.scan-live .redesign-hero:not([hidden]) ~ .redesign-scan-progress { margin-top: 0; }
.scan-live .scan-spotlight .container,
.scan-live .redesign-results .container { width: auto; max-width: none; margin: 0; }
.scan-live .scan-spotlight .container {
  padding: 24px 20px;
  border: 1px solid rgba(255, 112, 41, 0.7);
  border-radius: 14px;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(255, 112, 41, 0.16), transparent 60%),
    rgba(12, 11, 10, 0.92);
  box-shadow: 0 0 0 1px rgba(255, 112, 41, 0.18), 0 18px 60px rgba(255, 112, 41, 0.14);
}
.scan-live .scan-spotlight h2 { margin: 0 0 6px; text-align: left; font-size: clamp(24px, 3.4vw, 34px); overflow-wrap: anywhere; }
.scan-live .redesign-scan-live { margin: 0 0 12px; text-align: left; color: var(--scan-orange); font-weight: 600; }
.scan-live .redesign-scan-status { margin: 0 0 8px; }
.scan-live .redesign-scan-status li { padding: 14px 0; font-size: 16px; }
.scan-live .redesign-scan-oneliner { margin-top: 12px; }
.scan-live .redesign-results { padding: 24px 0 0; }
.scan-live .redesign-results .container { padding: 0; }
.scan-live .redesign-results h2 { margin: 0 0 40px; }

/* Conversation card. */
.scan-call {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(14, 13, 12, 0.97);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.scan-call-sheet-toggle { display: none; }
.scan-call-body { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.scan-call-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.scan-call-title { margin: 0; font-size: 17px; letter-spacing: 0.02em; }
.scan-call-state { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.7); text-transform: uppercase; }
.scan-call[data-state="connected"] .scan-call-state,
.scan-call[data-state="listening"] .scan-call-state,
.scan-call[data-state="thinking"] .scan-call-state,
.scan-call[data-state="speaking"] .scan-call-state { color: var(--hubbly-orange, #ff7029); }
.scan-call-lead { margin: 0; font-size: 14px; line-height: 1.45; color: rgba(255, 255, 255, 0.82); }
.scan-call-label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: rgba(255, 255, 255, 0.62); }
.scan-call-optin { display: flex; flex-direction: column; gap: 10px; }
.scan-call-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; color: rgba(255, 255, 255, 0.82); cursor: pointer; }
.scan-call-check input { flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--hubbly-orange, #ff7029); }
.scan-call-check a, .scan-call-note a { color: inherit; text-decoration: underline; }
.scan-call-start, .scan-call-pick, .scan-call-end, .scan-call-mute {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  cursor: pointer;
}
.scan-call-start, .scan-call-pick { border: 1px solid var(--hubbly-orange, #ff7029); background: var(--hubbly-orange, #ff7029); color: #0a0a09; }
.scan-call-start:disabled { opacity: 0.45; cursor: not-allowed; }
.scan-call-controls { display: flex; gap: 8px; }
.scan-call-mute, .scan-call-end { flex: 1 1 0; border: 1px solid rgba(255, 255, 255, 0.3); background: transparent; color: #fff; }
.scan-call-mute[aria-pressed="true"] { border-color: var(--hubbly-orange, #ff7029); color: var(--hubbly-orange, #ff7029); }
.scan-call-error { margin: 0; padding: 10px 12px; border-left: 2px solid #ffb08a; color: #ffd9c7; font-size: 13px; line-height: 1.45; }
.scan-call-transcript {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  overscroll-behavior: contain;
}
.scan-call-transcript:empty { display: none; }
.scan-call-transcript li { display: flex; flex-direction: column; gap: 2px; }
.scan-call-transcript p { margin: 0; font-size: 14px; line-height: 1.45; color: rgba(255, 255, 255, 0.9); overflow-wrap: anywhere; }
.scan-call-who { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); }
.scan-call-transcript li[data-role="assistant"] .scan-call-who { color: var(--hubbly-orange, #ff7029); }
.scan-call-transcript li[data-role="update"] p { color: rgba(255, 255, 255, 0.65); font-size: 13px; }
.scan-call-next { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.scan-call-request { color: rgba(255, 255, 255, 0.8); font-size: 13px; text-decoration: underline; }
.scan-call-note { margin: 0; font-size: 12px; line-height: 1.4; color: rgba(255, 255, 255, 0.55); }
.scan-call-turnstile:empty { display: none; }
.scan-call :focus-visible, .scan-live-new:focus-visible { outline: 2px solid var(--hubbly-orange, #ff7029); outline-offset: 2px; }

/* Wide screens: the card docks to the right of the stages and results and stays in view. */
@media (min-width: 960px) {
  .scan-live { padding: 132px 32px 64px; }
  .scan-live-grid { grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
  .scan-call { position: sticky; top: 112px; max-height: calc(100vh - 132px); display: flex; flex-direction: column; }
  .scan-call-body { overflow-y: auto; }
  .scan-call-transcript { max-height: none; flex: 1 1 auto; min-height: 120px; }
  .scan-live .scan-spotlight .container { padding: 32px 32px 24px; }
}

/* Narrow screens: an accessible bottom sheet. Collapsed it is one bar; open it is a scrollable panel. */
@media (max-width: 959px) {
  .scan-call {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    border-radius: 14px 14px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .scan-call-sheet-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 56px;
    padding: 0 18px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
  }
  .scan-call-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); flex: 0 0 auto; }
  .scan-call:is([data-state="connected"], [data-state="listening"], [data-state="thinking"], [data-state="speaking"]) .scan-call-dot { background: var(--hubbly-orange, #ff7029); }
  .scan-call-chevron { margin-left: auto; width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-135deg); }
  .scan-call[data-sheet="open"] .scan-call-chevron { transform: rotate(45deg); }
  .scan-call[data-sheet="collapsed"] .scan-call-body { display: none; }
  .scan-call[data-sheet="open"] .scan-call-body { max-height: min(48vh, 440px); overflow-y: auto; padding-top: 0; }
  /* The sheet bar already shows the state; keep the approved title, drop the duplicate state line. */
  .scan-call-head .scan-call-state { display: none; }
  /* Reserve room so the sheet never covers the last findings: one bar collapsed, the panel when open. */
  .scan-active.scan-sheet-open .scan-live { padding-bottom: calc(min(48vh, 440px) + 72px + env(safe-area-inset-bottom)); }
  .scan-call-transcript { max-height: 24vh; }
}

@media (prefers-reduced-motion: reduce) {
  .scan-live *, .scan-call * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* The orb's open panel is a bottom sheet on narrow screens and would sit on top of the orb's label.
   While it is open the label steps aside (the panel names itself); it returns when the panel closes. */
@media (max-width: 959px) {
  .home-page[data-redesign]:has(#hubbly-voice-assistant[data-expanded="true"]) .redesign-voice-label { visibility: hidden; }
}
