/* ─── EASINGS ───────────────────────────────────────────────────── */
:root {
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.2, 0.64, 1);
}

/* ─── RESET & TOKENS ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #f0ede8;
  --bg-dark:      #0c0b09;
  --ink:          #1a1714;
  --ink-muted:    #5a5550;
  --ink-faint:    #9a9590;
  --cream:        #f7f4ef;
  --accent:       #3d6b5a;
  --accent-warm:  #c8784a;
  --font-display: 'DM Serif Display', serif;
  --font-body:    'DM Sans', sans-serif;
}

html { scroll-behavior: auto; max-width: 100%; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  max-width: 100%;
}

/* ─── LOADER ────────────────────────────────────────────────────── */
#loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-dark);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 24px;
  transition: opacity 0.6s var(--ease-out), visibility 0.6s var(--ease-out);
}
#loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loader-brand {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 6rem);
  color: #fff;
  letter-spacing: 0.3em;
}
.loader-track {
  width: 200px; height: 1px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
}
#loader-bar {
  height: 100%; width: 0%;
  background: rgba(255,255,255,0.5);
  transition: width 0.1s linear;
}
#loader-percent {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.2em;
  font-variant-numeric: tabular-nums;
}

/* ─── HEADER ────────────────────────────────────────────────────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100; padding: 22px 40px;
}
nav {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 1.15rem; letter-spacing: 0.28em;
  color: var(--ink);
}
.nav-links { list-style: none; display: flex; gap: 28px; align-items: center; }
.nav-links a {
  text-decoration: none; color: var(--ink-muted);
  font-size: 0.82rem; letter-spacing: 0.06em;
  transition: color 150ms var(--ease-out);
}
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  background: var(--ink) !important; color: var(--cream) !important;
  padding: 8px 22px; border-radius: 100px; font-weight: 500;
  transition: background 150ms var(--ease-out), transform 160ms var(--ease-out) !important;
}
.nav-cta:hover { background: var(--accent) !important; }
@media (hover: hover) and (pointer: fine) {
  .nav-cta:active { transform: scale(0.97) !important; }
}

/* ─── HERO ──────────────────────────────────────────────────────── */
.hero-standalone {
  position: relative; height: 100vh; min-height: 100dvh;
  background: var(--bg);
  display: flex; align-items: center;
  padding: 0 8vw; z-index: 10; overflow: hidden;
}
.hero-inner { max-width: 58vw; position: relative; z-index: 2; }

.section-label {
  display: block; font-size: 0.68rem; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 22px;
}
.hero-heading {
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 11vw, 13rem);
  line-height: 0.95; color: var(--ink); margin-bottom: 36px;
}
.hero-heading .word { display: inline-block; overflow: hidden; }
.hero-tagline {
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  color: var(--ink-muted); max-width: 440px; line-height: 1.7;
}

/* Scroll hint */
.scroll-hint {
  position: absolute; bottom: 36px; left: 8vw;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  z-index: 2;
}
.scroll-hint-line {
  width: 1px; height: 48px;
  background: linear-gradient(to bottom, transparent, var(--ink-faint));
  animation: scroll-line 2s var(--ease-out) infinite;
  transform-origin: top;
}
@keyframes scroll-line {
  0%   { transform: scaleY(0); opacity: 0; }
  40%  { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; transform-origin: bottom; }
}
.scroll-hint-label {
  font-size: 0.62rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--ink-faint);
}
.hero-badge {
  position: absolute; bottom: 40px; right: 8vw;
  font-size: 0.62rem; color: var(--ink-faint);
  letter-spacing: 0.16em; text-transform: uppercase;
}

/* ─── CANVAS ────────────────────────────────────────────────────── */
.canvas-wrap {
  position: fixed; inset: 0;
  z-index: 5;
  clip-path: circle(0% at 50% 50%);
  pointer-events: none;
}
canvas#canvas { width: 100%; height: 100%; display: block; }

/* ─── DARK OVERLAY ──────────────────────────────────────────────── */
#dark-overlay {
  position: fixed; inset: 0; z-index: 6;
  background: rgba(12, 11, 9, 0.92);
  opacity: 0; pointer-events: none;
}

/* ─── MARQUEE ───────────────────────────────────────────────────── */
.marquee-wrap {
  position: fixed; bottom: 10vh; left: 0; right: 0;
  z-index: 15; overflow: hidden; opacity: 0;
  pointer-events: none; white-space: nowrap;
}
.marquee-text {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(7rem, 13vw, 15rem);
  font-style: italic;
  color: rgba(255,255,255,0.052);
  white-space: nowrap; will-change: transform;
}

/* ─── SCROLL CONTAINER ──────────────────────────────────────────── */
#scroll-container { position: relative; height: 500vh; z-index: 10; }

/* ─── SCROLL SECTIONS ───────────────────────────────────────────── */
.scroll-section {
  position: absolute; left: 0; right: 0;
  display: flex; align-items: center;
  padding: 60px 0; opacity: 0; pointer-events: none; z-index: 20;
}
.scroll-section.visible { opacity: 1; pointer-events: auto; }

.align-left  { padding-left: 5vw;  padding-right: 55vw; }
.align-right { padding-left: 55vw; padding-right: 5vw; }
.align-left  .section-inner,
.align-right .section-inner { max-width: 38vw; }

.section-inner { display: flex; flex-direction: column; gap: 16px; }
.section-heading {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.2vw, 4.8rem);
  line-height: 1.1; color: var(--cream);
}
.section-body {
  font-size: clamp(0.88rem, 1.15vw, 1rem);
  color: rgba(240,237,232,0.68); line-height: 1.75;
}
.section-note {
  font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); margin-top: 6px;
}

/* ─── STATS ─────────────────────────────────────────────────────── */
.section-stats {
  justify-content: center;
  padding-left: 8vw !important; padding-right: 8vw !important;
}
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 48px; width: 100%; max-width: 1100px; margin: 0 auto;
}
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat-row { display: flex; align-items: flex-end; gap: 3px; }
.stat-number {
  font-family: var(--font-display);
  font-size: clamp(3rem, 6.5vw, 7.5rem);
  line-height: 1; color: var(--cream);
  font-variant-numeric: tabular-nums;
}
.stat-suffix {
  font-size: clamp(1rem, 2vw, 2rem);
  color: var(--accent); font-weight: 300; padding-bottom: 0.14em;
}
.stat-label {
  font-size: 0.72rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: rgba(240,237,232,0.35);
}

/* ─── CTA ───────────────────────────────────────────────────────── */
.section-cta {
  justify-content: center;
  padding-left: 8vw !important; padding-right: 8vw !important;
}
.cta-inner {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  gap: 20px; max-width: 720px; margin: 0 auto;
}
.cta-heading {
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 8.5vw, 10.5rem);
  line-height: 0.95; color: var(--cream);
}
.cta-body {
  font-size: clamp(1rem, 1.35vw, 1.15rem);
  color: rgba(240,237,232,0.6); line-height: 1.7;
}
.cta-button {
  margin-top: 8px; padding: 18px 52px;
  background: var(--cream); color: var(--bg-dark);
  border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 1rem; font-weight: 500;
  letter-spacing: 0.08em; border-radius: 100px;
  transition: background 150ms var(--ease-out), transform 160ms var(--ease-out);
}
.cta-button:hover { background: #fff; }
@media (hover: hover) and (pointer: fine) {
  .cta-button:active { transform: scale(0.97); }
}
.cta-note {
  font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(240,237,232,0.2); margin-top: 10px;
}

/* ─── AGENT TAB (pull-tab on right edge) ─────────────────────────── */
.agent-tab {
  position: fixed;
  top: 50%; right: 0;
  transform: translateY(-50%);
  z-index: 200;
  background: var(--ink);
  border: none; cursor: pointer;
  border-radius: 10px 0 0 10px;
  padding: 18px 11px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  box-shadow: -3px 0 20px rgba(12,11,9,0.18);
  transition: transform 160ms var(--ease-out), background 150ms var(--ease-out);
  /* Tab slides slightly out on hover */
}
@media (hover: hover) and (pointer: fine) {
  .agent-tab:hover {
    transform: translateY(-50%) translateX(-3px);
    background: var(--accent);
  }
  .agent-tab:active { transform: translateY(-50%) translateX(-1px) scale(0.98); }
}
.tab-live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: tab-pulse 2.4s ease-in-out infinite;
}
@keyframes tab-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}
.agent-tab:hover .tab-live-dot { background: rgba(247,244,239,0.7); }
.tab-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-body);
  font-size: 0.58rem; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(247,244,239,0.55);
}
.tab-mic { color: rgba(247,244,239,0.4); }

/* ─── DRAWER ────────────────────────────────────────────────────── */
#agent-drawer {
  position: fixed; inset: 0; z-index: 300;
  pointer-events: none; visibility: hidden;
}
#agent-drawer.open { pointer-events: auto; visibility: visible; }

.drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(12,11,9,0.45);
  opacity: 0;
  transition: opacity 320ms var(--ease-out);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#agent-drawer.open .drawer-backdrop { opacity: 1; }

.drawer-panel {
  position: absolute; top: 50%; right: 0;
  transform: translate(100%, -50%);
  width: 400px; height: 88vh; max-height: 780px;
  background:
    linear-gradient(to bottom,
      rgba(10,10,8,0.48) 0%,
      rgba(10,10,8,0.62) 42%,
      rgba(10,10,8,0.88) 68%,
      rgba(10,10,8,0.97) 100%),
    url('../6.jpg') center top / cover no-repeat;
  border-left: 1px solid rgba(255,255,255,0.1);
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px 0 0 14px;
  display: flex; flex-direction: column;
  transition: transform 480ms var(--ease-drawer);
  overflow: hidden;
}
#agent-drawer.open .drawer-panel { transform: translate(0, -50%); }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  background: linear-gradient(to bottom, rgba(10,10,8,0.35) 0%, transparent 100%);
}
.drawer-logo {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-display);
  font-size: 0.92rem; letter-spacing: 0.24em; color: var(--cream);
}
.drawer-live-dot {
  width: 7px; height: 7px; background: var(--accent); border-radius: 50%;
  animation: tab-pulse 2.4s ease-in-out infinite;
}
.drawer-mode-toggle {
  display: flex; gap: 3px;
  background: rgba(255,255,255,0.05);
  border-radius: 100px; padding: 3px;
}
.mode-btn {
  padding: 5px 14px; border: none; cursor: pointer; border-radius: 100px;
  font-family: var(--font-body); font-size: 0.74rem; font-weight: 500; letter-spacing: 0.04em;
  color: rgba(240,237,232,0.35); background: transparent;
  transition: background 150ms var(--ease-out), color 150ms var(--ease-out), transform 160ms var(--ease-out);
}
.mode-btn.active { background: rgba(247,244,239,0.1); color: var(--cream); }
@media (hover: hover) and (pointer: fine) {
  .mode-btn:active { transform: scale(0.96); }
}
.drawer-close {
  background: none; border: none; cursor: pointer;
  color: rgba(240,237,232,0.3); padding: 6px;
  transition: color 150ms var(--ease-out), transform 160ms var(--ease-out);
  display: flex; align-items: center; justify-content: center;
}
.drawer-close:hover { color: var(--cream); }
@media (hover: hover) and (pointer: fine) {
  .drawer-close:active { transform: scale(0.9); }
}

/* ─── AGENT VIEWS ────────────────────────────────────────────────── */
.agent-view {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; position: relative;
}
.agent-view.hidden { display: none; }

/* ─── VOICE VIEW ─────────────────────────────────────────────────── */
.orb-area {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 0 0 auto; padding: 36px 0 24px;
  gap: 20px;
}
.orb-wrap {
  position: relative; width: 110px; height: 110px;
  display: flex; align-items: center; justify-content: center;
}
.orb-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(61, 107, 90, 0.25);
  transform: scale(1); opacity: 1;
}
.orb-ring.r2 { inset: -12px; border-color: rgba(61,107,90,0.12); }
.orb-ring.r3 { inset: -26px; border-color: rgba(61,107,90,0.06); }
.orb-wrap.listening .orb-ring {
  animation: orb-pulse 1.8s ease-in-out infinite;
}
.orb-wrap.listening .orb-ring.r2 { animation-delay: 0.2s; }
.orb-wrap.listening .orb-ring.r3 { animation-delay: 0.4s; }
@keyframes orb-pulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.06); opacity: 0.5; }
}
.orb-wrap.speaking .orb-ring {
  animation: orb-speak 0.9s ease-in-out infinite alternate;
}
.orb-wrap.speaking .orb-ring.r2 { animation-delay: 0.1s; animation-duration: 1.1s; }
.orb-wrap.speaking .orb-ring.r3 { animation-delay: 0.2s; animation-duration: 1.3s; }
@keyframes orb-speak {
  from { transform: scale(1);    border-color: rgba(61,107,90,0.25); }
  to   { transform: scale(1.1); border-color: rgba(61,107,90,0.7); }
}
.orb-core {
  width: 72px; height: 72px; border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, rgba(61,107,90,0.25) 0%, rgba(12,11,9,0.8) 70%);
  border: 1px solid rgba(61,107,90,0.3);
  transition: background 400ms var(--ease-out), border-color 400ms var(--ease-out);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.orb-wrap.listening .orb-core {
  background: radial-gradient(circle at 38% 36%, rgba(61,107,90,0.5) 0%, rgba(12,11,9,0.7) 70%);
  border-color: rgba(61,107,90,0.6);
}
.orb-wrap.speaking .orb-core {
  background: radial-gradient(circle at 38% 36%, rgba(61,107,90,0.7) 0%, rgba(12,11,9,0.5) 70%);
  border-color: rgba(61,107,90,0.9);
}
.orb-status {
  font-size: 0.75rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(240,237,232,0.35);
  transition: color 300ms var(--ease-out);
  font-family: var(--font-body);
}
.orb-wrap.listening ~ .orb-status { color: rgba(240,237,232,0.7); }
.orb-wrap.speaking  ~ .orb-status { color: var(--accent); }

.voice-messages {
  flex: 1; overflow-y: auto; padding: 0 20px 8px;
  display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: none;
}
.voice-messages::-webkit-scrollbar { display: none; }

.voice-msg {
  opacity: 0; transform: translateY(8px);
  animation: msg-in 300ms var(--ease-out) forwards;
}
@keyframes msg-in {
  to { opacity: 1; transform: translateY(0); }
}
.voice-msg.mira .msg-text {
  font-size: 0.88rem; line-height: 1.6;
  color: rgba(240,237,232,0.8);
}
.voice-msg.user .msg-text {
  font-size: 0.84rem; line-height: 1.6;
  color: rgba(240,237,232,0.4);
  text-align: right;
}
.voice-msg .msg-sender {
  display: block; font-size: 0.62rem; letter-spacing: 0.16em;
  text-transform: uppercase; margin-bottom: 4px;
  color: rgba(240,237,232,0.25);
}
.voice-msg.mira .msg-sender { color: rgba(61,107,90,0.7); }

.voice-actions {
  padding: 16px 20px 20px;
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.call-btn {
  width: 100%; padding: 14px;
  background: rgba(255,255,255,0.06); color: var(--cream);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 100px; cursor: pointer;
  font-family: var(--font-body); font-size: 0.84rem; font-weight: 500;
  letter-spacing: 0.06em;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out), transform 160ms var(--ease-out);
}
.call-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
@media (hover: hover) and (pointer: fine) {
  .call-btn:active { transform: scale(0.97); }
}
.call-btn[data-state="active"] {
  background: rgba(200,40,40,0.12);
  border-color: rgba(200,40,40,0.3);
  color: rgba(240,120,100,0.9);
}
.call-btn[data-state="connecting"] {
  opacity: 0.6; pointer-events: none;
}
.call-btn-icon { display: flex; align-items: center; }

/* ─── CHAT VIEW ──────────────────────────────────────────────────── */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: none;
}
.chat-messages::-webkit-scrollbar { display: none; }
.chat-msg .msg-sender {
  display: block; font-size: 0.62rem; letter-spacing: 0.14em;
  text-transform: uppercase; margin-bottom: 5px;
  color: rgba(240,237,232,0.25);
}
.chat-msg.mira .msg-sender { color: rgba(61,107,90,0.7); }
.chat-msg .msg-text {
  font-size: 0.88rem; line-height: 1.65;
  color: rgba(240,237,232,0.75);
}
.chat-msg.user .msg-text { color: rgba(240,237,232,0.45); text-align: right; }

.chat-input-area {
  display: flex; gap: 10px; padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.chat-input {
  flex: 1; background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08); border-radius: 100px;
  padding: 10px 16px; color: var(--cream);
  font-family: var(--font-body); font-size: 0.84rem;
  outline: none;
  transition: border-color 150ms var(--ease-out), background 150ms var(--ease-out);
}
.chat-input::placeholder { color: rgba(240,237,232,0.2); }
.chat-input:focus { border-color: rgba(61,107,90,0.5); background: rgba(255,255,255,0.07); }
.chat-send-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1); cursor: pointer;
  color: rgba(240,237,232,0.5);
  display: flex; align-items: center; justify-content: center;
  transition: background 150ms var(--ease-out), color 150ms var(--ease-out), transform 160ms var(--ease-out);
  align-self: flex-end;
}
.chat-send-btn:hover { background: var(--accent); color: var(--cream); border-color: transparent; }
@media (hover: hover) and (pointer: fine) {
  .chat-send-btn:active { transform: scale(0.9); }
}

/* ─── DRAWER FOOTER ─────────────────────────────────────────────── */
.drawer-footer {
  padding: 10px 20px;
  border-top: 1px solid rgba(255,255,255,0.04);
  text-align: center;
  font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(240,237,232,0.15); flex-shrink: 0;
}

/* ─── REDUCED MOTION ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .scroll-hint-line,
  .tab-live-dot, .drawer-live-dot,
  .orb-ring, .orb-core { animation: none !important; }
  .drawer-panel { transition: none; }
}

/* ─── MOBILE ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #scroll-container { height: 450vh; }
  .align-left, .align-right {
    padding-left: 0 !important; padding-right: 0 !important;
    justify-content: center;
  }
  .align-left .section-inner, .align-right .section-inner {
    max-width: 88vw;
    background: rgba(12,11,9,0.78);
    padding: 26px 20px; border-radius: 12px;
  }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 28px; }
  .hero-heading { font-size: clamp(3rem, 17vw, 6rem); }
  .hero-inner { max-width: 92vw; padding-bottom: 80px; }
  .hero-badge { display: none; }
  .scroll-hint {
    left: 50%;
    transform: translateX(-50%);
    bottom: 24px;
  }


  .drawer-panel {
    width: 100%; height: 92vh;
    top: auto; right: 0; bottom: 0;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  #agent-drawer.open .drawer-panel { transform: translateY(0); }

  .agent-tab {
    top: auto; bottom: 100px; right: 0;
    transform: none;
    border-radius: 10px 0 0 10px;
  }
  @media (hover: hover) and (pointer: fine) {
    .agent-tab:hover { transform: translateX(-3px); }
    .agent-tab:active { transform: translateX(-1px) scale(0.98); }
  }

  .site-header { padding: 16px 20px; }
}
