/* ============================================================
   ANIMATED EXPLAINERS — cinematic dark studio site
   Three switchable directions via [data-dir] on <html>:
   noir · spectrum · editorial
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

:root {
  /* defaults (NOIR) — overridden per direction below */
  --bg:        #07070b;
  --bg-soft:   #0d0d14;
  --surface:   #13131d;
  --surface-2: #1b1b27;
  --line:      rgba(255,255,255,0.09);
  --line-2:    rgba(255,255,255,0.16);
  --text:      #f3f3f7;
  --muted:     #9a9aab;
  --faint:     #62626f;
  --accent:    oklch(0.64 0.23 280);
  --accent-soft: oklch(0.64 0.23 280 / 0.16);
  --accent-ink: #ffffff;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Manrope', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --display-weight: 700;
  --display-tracking: -0.03em;
  --display-style: normal;
  --radius: 14px;
  --maxw: 1280px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
@media (min-width: 1500px){ :root { --maxw: 1440px; } }
@media (min-width: 1920px){ :root { --maxw: 1640px; } }

/* ---------- NOIR ---------- */
html[data-dir="noir"] {
  --bg:#07070b; --bg-soft:#0d0d14; --surface:#13131d; --surface-2:#1b1b27;
  --text:#f3f3f7; --muted:#9a9aab; --faint:#5e5e6b;
  --accent: #00E5FF;
  --accent-soft: rgba(0,229,255,0.16);
  --accent-ink: #04141a;
  --font-display:'Space Grotesk', sans-serif; --display-weight:700; --display-tracking:-0.035em; --display-style:normal;
}

/* ---------- SPECTRUM ---------- */
html[data-dir="spectrum"] {
  --bg:#06060a; --bg-soft:#0c0c13; --surface:#121220; --surface-2:#1a1a2b;
  --text:#f4f4f8; --muted:#9da0b4; --faint:#5c5f74;
  --accent: oklch(0.78 0.15 200);
  --accent-soft: oklch(0.78 0.15 200 / 0.16);
  --line: rgba(255,255,255,0.10);
  --font-display:'Sora', sans-serif; --display-weight:800; --display-tracking:-0.03em; --display-style:normal;
}

/* ---------- EDITORIAL ---------- */
html[data-dir="editorial"] {
  --bg:#0a0907; --bg-soft:#100e0b; --surface:#16130f; --surface-2:#1f1b15;
  --text:#f6f1e9; --muted:#b0a796; --faint:#6f6757;
  --line: rgba(255,240,220,0.10);
  --line-2: rgba(255,240,220,0.18);
  --accent: oklch(0.80 0.13 76);
  --accent-soft: oklch(0.80 0.13 76 / 0.15);
  --accent-ink:#0a0907;
  --font-display:'Instrument Serif', serif; --display-weight:400; --display-tracking:-0.01em; --display-style:normal;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

::selection { background: var(--accent); color: var(--accent-ink); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img, video { display: block; max-width: 100%; }

/* ---------- shared helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }
.display {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  font-style: var(--display-style);
  line-height: 0.98;
  margin: 0;
}
html[data-dir="editorial"] .display { line-height: 0.94; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--accent);
  display: inline-block;
}
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"]{ transition-delay: 0.08s;}
.reveal[data-d="2"]{ transition-delay: 0.16s;}
.reveal[data-d="3"]{ transition-delay: 0.24s;}
.reveal[data-d="4"]{ transition-delay: 0.32s;}
.reveal[data-d="5"]{ transition-delay: 0.40s;}
@media (prefers-reduced-motion: reduce){
  .reveal { opacity:1 !important; transform:none !important; }
  html { scroll-behavior: auto; }
}

/* buttons */
.btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 15px 26px;
  border-radius: 100px;
  font-weight: 600; font-size: 15px;
  border: 1px solid transparent;
  transition: transform .4s var(--ease), background .3s, color .3s, border-color .3s;
  font-family: var(--font-body);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); border-color: var(--text); }
html[data-dir="editorial"] .btn { border-radius: 4px; }

/* play glyph */
.playdot {
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  flex: none;
}
.playdot svg { width: 18px; height: 18px; margin-left: 2px; }

/* loading splash shown until main.js initialises */
#boot {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--bg); z-index: 9999;
  font-family: var(--font-mono); color: var(--faint); font-size: 12px; letter-spacing: 0.3em;
}

/* ============================================================
   Gradient accents + CTA pairs + glass modal + chat widget
   ============================================================ */
:root { --grad: linear-gradient(135deg, #8a5cff 0%, #4f7bff 100%); --grad-glow: rgba(122,92,255,0.45); }
html[data-dir="noir"]      { --grad: linear-gradient(135deg, #00E5FF 0%, #2563EB 100%); --grad-glow: rgba(0,229,255,0.5); }
html[data-dir="spectrum"]  { --grad: linear-gradient(135deg, #22d3ee 0%, #8b5cf6 100%); --grad-glow: rgba(60,180,230,0.5); }
html[data-dir="editorial"] { --grad: linear-gradient(135deg, #e5b65f 0%, #c98f3f 100%); --grad-glow: rgba(210,160,80,0.45); }

/* CTA band placed after each section */
.sec-cta {
  display: flex; gap: 16px; justify-content: center; align-items: center;
  flex-wrap: wrap; padding: clamp(34px, 5vw, 56px) 32px;
}
.sec-cta--tight { padding: 0 32px clamp(30px,4vw,48px); }

/* gradient primary CTA */
.cta-grad {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 30px; border: 0; border-radius: 100px;
  font-family: var(--font-body); font-weight: 700; font-size: 15.5px; color: #fff;
  background: var(--grad); background-size: 160% 160%; background-position: 0% 50%;
  cursor: pointer; isolation: isolate;
  white-space: nowrap;
  box-shadow: 0 8px 30px -8px var(--grad-glow);
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), background-position .6s var(--ease);
}
.cta-grad::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0;
  background: linear-gradient(120deg, transparent 20%, rgba(255,255,255,0.35) 50%, transparent 80%);
  transform: translateX(-120%); transition: opacity .3s;
}
.cta-grad:hover { transform: translateY(-3px) scale(1.025); box-shadow: 0 16px 44px -8px var(--grad-glow); background-position: 100% 50%; }
.cta-grad:hover::after { opacity: 1; animation: cta-sheen 1.1s var(--ease); }
.cta-grad:active { transform: translateY(-1px) scale(0.99); }
@keyframes cta-sheen { from { transform: translateX(-120%);} to { transform: translateX(120%);} }

/* glass secondary CTA */
.cta-glass {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 15px 28px; border-radius: 100px;
  font-family: var(--font-body); font-weight: 600; font-size: 15.5px; color: var(--text);
  background: rgba(255,255,255,0.05); border: 1px solid var(--line-2);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  white-space: nowrap;
  transition: transform .45s var(--ease), background .35s, border-color .35s, box-shadow .35s;
}
.cta-glass:hover { transform: translateY(-3px); background: rgba(255,255,255,0.1); border-color: var(--text); box-shadow: 0 12px 34px -12px rgba(0,0,0,0.6); }
.cta-glass:active { transform: translateY(-1px); }
html[data-dir="editorial"] .cta-grad, html[data-dir="editorial"] .cta-glass { border-radius: 6px; }
html[data-dir="editorial"] .cta-grad { color: #1a1407; }

/* gradient text accent */
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* glass modal card */
.glass-card {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2);
  box-shadow: 0 40px 120px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.08);
}
.glass-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--grad); border-radius: var(--radius) var(--radius) 0 0;
}

/* native select styled for dark theme */
.ae-select {
  width: 100%; padding: 13px 15px; padding-right: 40px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 10px; font-family: var(--font-body); font-size: 15.5px;
  outline: none; transition: border-color .25s; cursor: pointer; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%239a9aab' stroke-width='2' stroke-linecap='round'><path d='M3 5l4 4 4-4'/></svg>");
  background-repeat: no-repeat; background-position: right 15px center;
}
.ae-select:focus { border-color: var(--accent); }
.ae-select option { background: var(--surface); color: var(--text); }

/* typewriter caret */
.ae-caret {
  display: inline-block; width: 0.5ch; min-width: 3px; height: 0.9em;
  background: var(--accent); margin-left: 0.04em; vertical-align: -0.08em;
  box-shadow: 0 0 12px var(--grad-glow);
  animation: ae-blink 1.05s steps(1) infinite;
}
@keyframes ae-blink { 50% { opacity: 0; } }

/* count-up number finish: spring bounce + glow pulse */
.ae-count { display: inline-block; will-change: transform; }
.ae-count.done { animation: ae-count-pop .62s var(--ease) both; }
@keyframes ae-count-pop {
  0%   { transform: scale(1); text-shadow: 0 0 0 transparent; }
  40%  { transform: scale(1.15); text-shadow: 0 0 34px var(--grad-glow); }
  70%  { transform: scale(0.97); }
  100% { transform: scale(1); text-shadow: 0 0 22px var(--grad-glow); }
}

/* dial-code chip beside phone input */
.ae-dial {
  display: flex; align-items: center; gap: 6px; flex: none;
  padding: 0 14px; min-width: 86px; justify-content: center;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 10px;
  font-family: var(--font-mono); font-size: 15px; white-space: nowrap;
}

/* overlay fade + card pop */
.ae-overlay { animation: ae-fade .3s var(--ease) both; }
.ae-pop-in { animation: ae-pop-in .5s var(--ease) both; }
@keyframes ae-pop-in { from { opacity: 0; transform: translateY(26px) scale(0.97);} to { opacity: 1; transform: none;} }

/* floating chat widget */
.chat-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 900;
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--grad); color: #fff; display: grid; place-items: center;
  box-shadow: 0 12px 36px -6px var(--grad-glow);
  animation: chat-float 4s ease-in-out infinite;
  transition: transform .4s var(--ease);
}
.chat-launcher:hover { transform: scale(1.08) translateY(-2px); }
@keyframes chat-float { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-7px);} }
.chat-launcher .pulse { position: absolute; inset: 0; border-radius: 50%; background: var(--grad); opacity: .5; animation: chat-pulse 2.4s ease-out infinite; z-index: -1; }
@keyframes chat-pulse { 0%{ transform: scale(1); opacity:.5;} 100%{ transform: scale(1.7); opacity: 0;} }

.chat-window {
  position: fixed; right: 24px; bottom: 96px; z-index: 901;
  width: min(360px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 130px));
  display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  animation: chat-in .42s var(--ease) both;
}
@keyframes chat-in { from { opacity: 0; transform: translateY(24px) scale(0.96);} to { opacity:1; transform: none;} }
.chat-head { background: var(--grad); padding: 18px 18px; color: #fff; display: flex; align-items: center; gap: 12px; }
.chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-bubble { max-width: 82%; padding: 11px 15px; border-radius: 16px; font-size: 14.5px; line-height: 1.45; animation: ae-pop-in .4s var(--ease) both; }
.chat-bubble.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.chat-bubble.me { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 5px; }
.chat-foot { padding: 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.chat-foot input { flex: 1; background: var(--bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 100px; padding: 11px 16px; font-family: var(--font-body); font-size: 14.5px; outline: none; }
.chat-foot input:focus { border-color: var(--accent); }
.chat-send { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; cursor: pointer; display: grid; place-items: center; transition: transform .3s; }
.chat-send:hover { transform: scale(1.08); }
@media (prefers-reduced-motion: reduce){ .chat-launcher, .chat-launcher .pulse { animation: none !important; } }

/* ============================================================
   Shared mobile nav (hamburger + dropdown) + mobile CTA sizing
   ============================================================ */
.ae-burger { display:none; flex-direction:column; gap:5px; width:44px; height:44px; border:1px solid var(--line-2); border-radius:11px; background:transparent; cursor:pointer; align-items:center; justify-content:center; }
.ae-burger span { width:19px; height:2px; background:var(--text); border-radius:2px; transition: transform .3s var(--ease), opacity .3s; }
.ae-burger.open span:nth-child(1){ transform: translateY(7px) rotate(45deg); }
.ae-burger.open span:nth-child(2){ opacity:0; }
.ae-burger.open span:nth-child(3){ transform: translateY(-7px) rotate(-45deg); }
.ae-mobilemenu { display:flex; flex-direction:column; padding:8px 32px 24px; border-top:1px solid var(--line); background:color-mix(in srgb, var(--bg) 95%, transparent); backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px); animation: ae-fade .3s var(--ease) both; }
.ae-mobilemenu a { padding:15px 4px; font-size:18px; border-bottom:1px solid var(--line); color:var(--text); }
.ae-mobilemenu .cta-grad { margin-top:18px; justify-content:center; width:100%; }

/* mobile: full-width, easy-to-tap CTA pairs */
@media (max-width: 560px){
  .sec-cta { flex-direction:column; gap:12px; }
  .sec-cta .cta-grad, .sec-cta .cta-glass { width:100%; justify-content:center; }
}