/* Звонилка — "Тёплый сигнал" (warm signal instrument)
   Premium dark voice-demo identity: deep warm ink, bone text, one amber signal accent.
   Single family (Golos Text) with weight contrast. The orb is a precise audio-reactive
   instrument, not a gradient blob. Re-hue the brand by changing --accent only. */

:root {
  /* warm dark surface ramp (OKLCH, barely-brown charcoal — not pure black) */
  --bg: oklch(0.17 0.012 70);
  --bg-2: oklch(0.21 0.014 72);
  --surface: oklch(0.255 0.014 74);
  --surface-hi: oklch(0.30 0.016 74);

  /* warm bone ink + accessible muted steps (all ≥4.5:1 on --bg) */
  --ink: oklch(0.97 0.012 82);
  --muted: oklch(0.76 0.02 80);
  --muted-2: oklch(0.66 0.02 78);

  /* the one accent: a live amber filament + an ember depth tone */
  --accent: oklch(0.80 0.135 74);
  --accent-ink: oklch(0.205 0.02 70); /* dark text that sits ON the accent */
  --ember: oklch(0.66 0.15 58);

  --danger: oklch(0.63 0.18 28); /* warm terracotta red — destructive only */

  /* warm hairlines derived from ink */
  --line: color-mix(in oklab, var(--ink) 9%, transparent);
  --line-strong: color-mix(in oklab, var(--ink) 16%, transparent);

  --shadow: 0 30px 80px -34px rgb(0 0 0 / 0.85);
  --ease: cubic-bezier(0.16, 1, 0.3, 1); /* ease-out-expo-ish */

  /* semantic z-scale */
  --z-orb-halo: 0;
  --z-orb-ring: 1;
  --z-orb-lens: 2;
  --z-orb-wave: 3;
  --z-topbar: 10;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Golos Text", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
#root { height: 100dvh; }
::selection { background: color-mix(in oklab, var(--accent) 32%, transparent); }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.app { height: 100%; position: relative; }
.app[data-screen="start"] .screen.call { display: none; }
.app[data-screen="call"] .screen.start { display: none; }
.screen { height: 100dvh; display: flex; flex-direction: column; position: relative; isolation: isolate; }

/* one calm ambient warmth from above; no neon halos */
.screen::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(110% 80% at 50% -15%, color-mix(in oklab, var(--accent) 9%, transparent), transparent 60%),
    radial-gradient(90% 60% at 50% 118%, color-mix(in oklab, var(--ember) 7%, transparent), transparent 62%),
    var(--bg);
}

/* ───────── topbar ───────── */
.topbar {
  position: relative; z-index: var(--z-topbar);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: clamp(20px, 3vw, 32px) clamp(20px, 4vw, 44px);
}
.topbar-right { width: 132px; }
.wordmark { display: inline-flex; align-items: center; gap: 12px; font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
.wordmark.sm { font-size: 16px; }
.wm-mark {
  position: relative; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid color-mix(in oklab, var(--accent) 42%, transparent);
  background: radial-gradient(circle at 50% 38%, color-mix(in oklab, var(--accent) 20%, var(--bg-2)), var(--bg) 80%);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 6%, transparent),
    0 8px 20px -10px color-mix(in oklab, var(--accent) 55%, transparent);
}
.wordmark.sm .wm-mark { width: 27px; height: 27px; }
.wm-mark::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 10px color-mix(in oklab, var(--accent) 75%, transparent);
}
.wm-text { color: var(--ink); }
.wordmark.sm .wm-text { color: var(--muted); font-weight: 500; }

/* ───────── status pill ───────── */
.status { flex: 1; display: flex; justify-content: center; }
.status-pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 15px 7px 13px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; letter-spacing: 0.01em;
  background: color-mix(in oklab, var(--surface) 80%, transparent);
  border: 1px solid var(--line); backdrop-filter: blur(8px);
}
.status-pill.live { color: var(--ink); }
.status-pill.live .num { font-variant-numeric: tabular-nums; color: var(--muted); }
.status-pill.connecting { color: var(--muted); }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 60%, transparent);
  animation: pulseDot 1.8s var(--ease) infinite;
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 55%, transparent); }
  70% { box-shadow: 0 0 0 7px color-mix(in oklab, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 0%, transparent); }
}
.spin {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── start screen ───────── */
.start-main {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 24px; gap: 0; margin-top: -2vh;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 30px;
  color: var(--muted); font-size: 13px; font-weight: 500;
}
.eyebrow::before {
  content: ""; width: 18px; height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--accent) 70%, transparent));
}
.eyebrow::after {
  content: ""; width: 18px; height: 1px;
  background: linear-gradient(90deg, color-mix(in oklab, var(--accent) 70%, transparent), transparent);
}
.headline {
  font-size: clamp(2.3rem, 5.2vw, 4rem); line-height: 1.04; font-weight: 700;
  letter-spacing: -0.035em; margin-top: 38px; max-width: 16ch; text-wrap: balance;
}
.headline .accent { color: var(--accent); }
.sub {
  color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.16rem); line-height: 1.6;
  margin-top: 22px; max-width: 46ch; text-wrap: pretty;
}
.cta {
  display: inline-flex; align-items: center; gap: 12px; margin-top: 40px;
  padding: 16px 28px 16px 20px; border-radius: 14px;
  font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--accent-ink); background: var(--accent);
  box-shadow: 0 1px 0 color-mix(in oklab, #fff 22%, transparent) inset,
    0 18px 40px -18px color-mix(in oklab, var(--accent) 80%, transparent);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.cta:hover {
  transform: translateY(-2px); background: color-mix(in oklab, var(--accent) 92%, #fff 8%);
  box-shadow: 0 1px 0 color-mix(in oklab, #fff 28%, transparent) inset,
    0 26px 54px -18px color-mix(in oklab, var(--accent) 90%, transparent);
}
.cta:active { transform: translateY(0); }
.cta-ic {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: color-mix(in oklab, var(--accent-ink) 14%, transparent);
}
.hint { color: var(--muted-2); font-size: 13px; margin-top: 16px; }
.foot {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 24px; color: var(--muted-2); font-size: 12.5px; letter-spacing: 0.01em;
}
.foot .pip { width: 5px; height: 5px; border-radius: 50%; background: color-mix(in oklab, var(--accent) 70%, transparent); }

/* ───────── call screen ───────── */
.call-main {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(22px, 3.5vh, 36px); padding: 0 24px; margin-top: -1vh;
}
.persona { text-align: center; }
.persona h2 { font-size: clamp(1.5rem, 2.4vw, 1.75rem); font-weight: 700; letter-spacing: -0.02em; }
.persona p { color: var(--muted); font-size: 14.5px; margin-top: 6px; letter-spacing: 0.01em; }
.caption-box { min-height: 56px; max-width: 60ch; display: flex; align-items: center; justify-content: center; }
.caption { font-size: clamp(1.05rem, 1.6vw, 1.2rem); line-height: 1.5; text-align: center; text-wrap: balance; color: var(--ink); }
.caption.listening { color: var(--accent); display: inline-flex; align-items: center; gap: 11px; font-size: 1.05rem; }
.caption.muted-cap { color: var(--muted); }

.mini-bars { display: inline-flex; align-items: center; gap: 3px; height: 16px; }
.mini-bars span {
  width: 3px; height: 100%; border-radius: 2px; background: currentColor; transform-origin: center;
  animation: barJump 0.95s var(--ease) infinite;
}
@keyframes barJump { 0%, 100% { transform: scaleY(0.32); } 50% { transform: scaleY(1); } }

/* ───────── controls ───────── */
.controls { display: flex; align-items: flex-start; justify-content: center; gap: clamp(22px, 4vw, 32px); padding: clamp(22px, 3vh, 34px) 24px clamp(34px, 5vh, 48px); }
.ctrl { display: flex; flex-direction: column; align-items: center; gap: 11px; color: var(--muted); font-size: 12.5px; font-weight: 500; transition: color 0.16s var(--ease); }
.ctrl > svg {
  width: 62px; height: 62px; padding: 20px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink);
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), transform 0.16s var(--ease);
}
.ctrl:hover { color: var(--ink); }
.ctrl:hover > svg { background: var(--surface-hi); transform: translateY(-2px); }
.ctrl.active { color: var(--ink); }
.ctrl.active > svg { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ctrl.end > svg { background: var(--danger); border-color: transparent; color: oklch(0.99 0 0); box-shadow: 0 18px 40px -16px color-mix(in oklab, var(--danger) 70%, transparent); }
.ctrl.end:hover > svg { background: color-mix(in oklab, var(--danger) 88%, #fff 12%); }
.ctrl-label { white-space: nowrap; }

/* ───────── orb: warm signal instrument ───────── */
.orb { --size: 150px; --level: 0.12; position: relative; width: var(--size); height: var(--size); display: grid; place-items: center; }
.orb-halo {
  position: absolute; inset: -24%; border-radius: 50%; z-index: var(--z-orb-halo);
  background: radial-gradient(circle at 50% 50%, color-mix(in oklab, var(--accent) 62%, transparent), color-mix(in oklab, var(--ember) 30%, transparent) 44%, transparent 70%);
  filter: blur(22px); opacity: calc(0.22 + var(--level) * 0.5); transition: opacity 0.28s var(--ease);
}
.orb-ring { position: absolute; inset: 0; border-radius: 50%; z-index: var(--z-orb-ring); border: 1px solid color-mix(in oklab, var(--accent) 42%, transparent); opacity: 0; }
.orb.speaking .orb-ring.r1 { animation: ring 2.4s var(--ease) infinite; }
.orb.speaking .orb-ring.r2 { animation: ring 2.4s var(--ease) infinite 1.2s; }
@keyframes ring { 0% { transform: scale(1); opacity: 0.4; } 100% { transform: scale(1.55); opacity: 0; } }
.orb-lens {
  position: relative; z-index: var(--z-orb-lens); width: 100%; height: 100%; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, color-mix(in oklab, var(--accent) 20%, var(--bg-2)), var(--bg) 74%);
  border: 1px solid color-mix(in oklab, var(--accent) 34%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in oklab, #fff 8%, transparent),
    inset 0 -16px 42px rgb(0 0 0 / 0.5),
    0 30px 72px -28px color-mix(in oklab, var(--accent) 55%, transparent);
  display: grid; place-items: center; overflow: hidden;
}
.orb-lens::before { /* ember core — brightens with the voice (--level) */
  content: ""; position: absolute; inset: 0; border-radius: 50%; z-index: 0;
  background: radial-gradient(circle at 50% 50%, color-mix(in oklab, var(--accent) 50%, transparent), color-mix(in oklab, var(--ember) 20%, transparent) 44%, transparent 68%);
  opacity: calc(0.10 + var(--level) * 0.34); transition: opacity 0.26s var(--ease);
}
.orb-rim { position: absolute; inset: 7%; border-radius: 50%; z-index: 1; border: 1px solid color-mix(in oklab, var(--accent) 24%, transparent); }
.orb-wave { position: relative; display: flex; align-items: center; gap: 6px; height: 40%; z-index: var(--z-orb-wave); }
.orb-wave span {
  width: 6px; flex: none; height: 100%; border-radius: 99px; transform: scaleY(0.2); transform-origin: center;
  background: linear-gradient(180deg, #ffe6c2, var(--accent));
  box-shadow: 0 0 7px color-mix(in oklab, var(--accent) 45%, transparent);
}
/* idle (start screen): calm breathing presence, static signal profile */
.orb.idle .orb-halo { animation: breathe 4.5s var(--ease) infinite; }
@keyframes breathe { 0%, 100% { opacity: 0.26; } 50% { opacity: 0.46; } }

/* ───────── entrance choreography (enhances an already-readable default) ───────── */
/* Entrance enhances an always-visible default: translateY only, never opacity —
   so a throttled/headless renderer that freezes the animation still shows everything. */
.reveal { animation: riseIn 0.6s var(--ease) both; }
.r1 { animation-delay: 0.04s; } .r2 { animation-delay: 0.12s; } .r3 { animation-delay: 0.2s; }
.r4 { animation-delay: 0.28s; } .r5 { animation-delay: 0.36s; } .r6 { animation-delay: 0.44s; }
@keyframes riseIn { from { transform: translateY(12px); } to { transform: none; } }

@media (max-width: 560px) {
  .topbar-right { display: none; }
  .controls { gap: 16px; }
}

/* ───────── reduced motion ───────── */
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
  .orb.idle .orb-halo { animation: none; opacity: 0.4; }
  .orb.speaking .orb-ring { animation: none; }
  .live-dot { animation: none; }
  .spin { animation: none; border-top-color: var(--accent); }
  .mini-bars span { animation: none; transform: scaleY(0.7); }
  .cta { transition: none; }
}
