/* =========================================
   Lua Design System — style.css
   ========================================= */

/* --- Tokens --- */
:root {
  --canvas:       #0A0B0F;
  --surface:      #12141A;
  --surface-hi:   #1C1F2A;
  --border:       #2A2D3A;
  --border-hi:    #3D4155;
  --accent:       #6B7AFF;
  --accent-soft:  rgba(107, 122, 255, 0.15);
  --accent-glow:  rgba(107, 122, 255, 0.35);
  --violet:       #A78BFA;
  --violet-soft:  rgba(167, 139, 250, 0.12);
  --text-primary: #E8E9F0;
  --text-muted:   #8B8FA8;
  --text-faint:   #4E5268;
  --success:      #34D399;
  --success-soft: rgba(52, 211, 153, 0.12);

  --radius-sm:   8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  32px;
  --radius-full: 9999px;

  --font: 'Inter', system-ui, sans-serif;

  --orb-size: 160px;
  --orb-size-sm: 128px;
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- Base --- */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--canvas);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- Background blobs --- */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}
.bg-orb-1 {
  width: 600px; height: 600px;
  top: -200px; left: -150px;
  background: radial-gradient(circle, rgba(107,122,255,0.18) 0%, transparent 70%);
  animation: orbDrift1 18s ease-in-out infinite alternate;
}
.bg-orb-2 {
  width: 500px; height: 500px;
  bottom: -150px; right: -100px;
  background: radial-gradient(circle, rgba(167,139,250,0.14) 0%, transparent 70%);
  animation: orbDrift2 22s ease-in-out infinite alternate;
}
@keyframes orbDrift1 {
  from { transform: translate(0, 0); }
  to   { transform: translate(60px, 80px); }
}
@keyframes orbDrift2 {
  from { transform: translate(0, 0); }
  to   { transform: translate(-40px, -60px); }
}

/* --- Navbar --- */
.navbar {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 11, 15, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-logo-mark {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.navbar-logo-text {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary);
  text-decoration: none;
}

.navbar-badge {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-hi);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

/* --- Main layout --- */
.main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 1.5rem 3rem;
  gap: 3rem;
}

/* --- Hero --- */
.hero {
  text-align: center;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  animation: fadeUp 0.7s ease both;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(107, 122, 255, 0.25);
  padding: 5px 14px;
  border-radius: var(--radius-full);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
  animation: statusPulse 2.5s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.hero-headline {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.hero-sub {
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 440px;
}

.trust-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.trust-icon {
  font-size: 0.55rem;
  color: var(--accent);
}

.trust-divider {
  color: var(--border-hi);
}

/* --- Voice section --- */
.voice-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  animation: fadeUp 0.7s 0.15s ease both;
}

/* --- Orb --- */
.orb-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 280px; height: 280px;
}

.orb-rings {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid transparent;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
}

.ring-1 { width: 190px; height: 190px; }
.ring-2 { width: 230px; height: 230px; }
.ring-3 { width: 270px; height: 270px; }

/* Orb button */
.orb {
  position: relative;
  z-index: 2;
  width: var(--orb-size);
  height: var(--orb-size);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  outline: none;
  background: transparent;
  padding: 0;
  transition: transform 0.2s ease;
}

.orb:focus-visible .orb-inner {
  box-shadow: 0 0 0 3px var(--canvas), 0 0 0 5px var(--accent);
}

.orb:hover {
  transform: scale(1.04);
}
.orb:active {
  transform: scale(0.97);
}

.orb-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--surface-hi);
  border: 1px solid var(--border-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease, background 0.3s ease;
}

/* Default breathe animation */
.orb-inner::after {
  content: '';
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle at center, var(--accent-soft) 0%, transparent 60%);
  animation: breathe 3.5s ease-in-out infinite;
  border-radius: 50%;
}

@keyframes breathe {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50%       { transform: scale(1.1); opacity: 1; }
}

.orb-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(255,255,255,0.06) 0%, transparent 55%);
  pointer-events: none;
}

.orb-icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.icon-mic {
  width: 36px; height: 36px;
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

/* Wave bars (hidden by default) */
.wave-bars {
  display: none;
  align-items: flex-end;
  gap: 4px;
  height: 36px;
}

.wave-bars .bar {
  width: 4px;
  border-radius: 2px;
  background: var(--text-primary);
  height: 8px;
}

/* --- States --- */

/* idle state */
.orb.idle .orb-inner {
  background: var(--surface);
  border-color: var(--border);
}

/* user-speaking state */
.orb.user-speaking .orb-inner {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.4);
}
.orb.user-speaking .icon-mic { opacity: 0.6; }
.orb.user-speaking .ring { border-color: rgba(52, 211, 153, 0.25); }
.orb.user-speaking .ring-1 { animation: ringPulse 1.4s ease-out infinite; }
.orb.user-speaking .ring-2 { animation: ringPulse 1.4s 0.2s ease-out infinite; }
.orb.user-speaking .ring-3 { animation: ringPulse 1.4s 0.4s ease-out infinite; }
.orb.user-speaking .orb-inner::after {
  background: radial-gradient(circle at center, rgba(52,211,153,0.15) 0%, transparent 60%);
  animation: breathe 1.2s ease-in-out infinite;
}

/* ai-speaking state */
.orb.ai-speaking .orb-inner {
  background: var(--accent-soft);
  border-color: rgba(107, 122, 255, 0.5);
}
.orb.ai-speaking .icon-mic { display: none; }
.orb.ai-speaking .wave-bars { display: flex; }
.orb.ai-speaking .wave-bars .bar:nth-child(1) { animation: waveBar 0.9s 0.0s ease-in-out infinite; }
.orb.ai-speaking .wave-bars .bar:nth-child(2) { animation: waveBar 0.9s 0.1s ease-in-out infinite; }
.orb.ai-speaking .wave-bars .bar:nth-child(3) { animation: waveBar 0.9s 0.2s ease-in-out infinite; }
.orb.ai-speaking .wave-bars .bar:nth-child(4) { animation: waveBar 0.9s 0.1s ease-in-out infinite; }
.orb.ai-speaking .wave-bars .bar:nth-child(5) { animation: waveBar 0.9s 0.0s ease-in-out infinite; }
.orb.ai-speaking .ring { border-color: var(--accent-glow); }
.orb.ai-speaking .ring-1 { animation: ringPulse 1.8s ease-out infinite; }
.orb.ai-speaking .ring-2 { animation: ringPulse 1.8s 0.3s ease-out infinite; }
.orb.ai-speaking .ring-3 { animation: ringPulse 1.8s 0.6s ease-out infinite; }
.orb.ai-speaking .orb-inner::after {
  animation: breathe 1.8s ease-in-out infinite;
}

@keyframes ringPulse {
  0%   { transform: translate(-50%, -50%) scale(0.92); opacity: 0.7; }
  60%  { transform: translate(-50%, -50%) scale(1.04); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1.04); opacity: 0; }
}

@keyframes waveBar {
  0%, 100% { height: 6px; }
  50%       { height: 28px; }
}

/* --- Status area --- */
.status-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-height: 52px;
}

.status {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  transition: color 0.3s ease;
}

/* Status loading dots (visible only during connecting) */
.status-dots {
  display: none;
  gap: 5px;
}

.status-dots .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--text-faint);
}

.connecting .status-dots { display: flex; }
.connecting .status-dots .dot:nth-child(1) { animation: dotBounce 1.2s 0.0s ease-in-out infinite; }
.connecting .status-dots .dot:nth-child(2) { animation: dotBounce 1.2s 0.2s ease-in-out infinite; }
.connecting .status-dots .dot:nth-child(3) { animation: dotBounce 1.2s 0.4s ease-in-out infinite; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%            { transform: translateY(-6px); opacity: 1; }
}

/* Status color per state */
.orb.user-speaking ~ .status-area .status { color: var(--success); }
.orb.ai-speaking  ~ .status-area .status { color: var(--accent); }

/* --- Lead progress toast --- */
.lead-progress {
  background: var(--success-soft);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: var(--radius-full);
  padding: 8px 18px;
}

.lead-progress[hidden] { display: none; }

.lead-progress-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--success);
}

/* --- Hint chips --- */
.hints {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  animation: fadeUp 0.7s 0.3s ease both;
}

.hint-chip {
  font-family: var(--font);
  font-size: 0.83rem;
  font-weight: 400;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.hint-chip:hover {
  color: var(--text-primary);
  border-color: var(--border-hi);
  background: var(--surface-hi);
}

.hint-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--accent);
}

/* --- Footer --- */
.footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 1.5rem 2rem;
  font-size: 0.8rem;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}

.footer-brand {
  font-weight: 600;
  color: var(--text-muted);
}

.footer-sep { color: var(--border-hi); }

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.language-select {
  background: var(--canvas);
  border: 1px solid var(--border);
  color: inherit;
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.language-select:focus {
  outline: none;
}

.language-select option {
  color: var(--canvas);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* --- Entrance animation --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Mobile --- */
@media (max-width: 640px) {
  .navbar { padding: 1rem 1.25rem; }
  .main { padding: 2.5rem 1.25rem 2rem; gap: 2.25rem; }
  :root { --orb-size: var(--orb-size-sm); }
  .orb-container { width: 240px; height: 240px; }
  .ring-1 { width: 158px; height: 158px; }
  .ring-2 { width: 194px; height: 194px; }
  .ring-3 { width: 230px; height: 230px; }
  .hero-sub { font-size: 0.95rem; }
  .trust-row { gap: 8px; }
}