/* Citgentic motion layer (v2 preview).
   Only active when <html> has .cg-motion, which the head script sets unless the
   visitor prefers reduced motion. Without it the site is exactly the current one. */

/* ---- Smooth scroll (Lenis) ---- */
html.cg-motion { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---- Liquid hero ---- */
.cg-liquid {
  position: absolute; inset: 0; z-index: 0;
  display: block; width: 100%; height: 100%;
  opacity: 0; transition: opacity 0.8s ease-out;
}
.cg-liquid.is-on { opacity: 1; }
.cg-motion .hero.has-liquid .hero-bg { opacity: 0.35; }
.cg-motion .hero-content { will-change: transform, opacity; }

/* ---- Word-by-word headlines ---- */
.cg-w {
  display: inline-block; overflow: hidden; vertical-align: bottom;
  padding-bottom: 0.1em; margin-bottom: -0.1em;
}
.cg-wi { display: inline-block; will-change: transform; }
.cg-motion .hero h1.anim { opacity: 1; transform: none; transition: none; }

/* ---- Clara: a smooth drop of liquid gold inside the hero orb ---- */
.cg-clara-gl {
  position: absolute; left: 50%; top: 50%; z-index: 1;
  display: block; width: 240px; height: 240px;
  margin: -120px 0 0 -120px;
  pointer-events: none;
}
.cg-gl-clara .clara-orb-core { opacity: 0; }
.cg-gl-clara .clara-orb { background: transparent; border-color: transparent; box-shadow: none; }

/* ---- Liquid wipe between sections ---- */
.cg-wipe { position: relative; height: 0; z-index: 3; pointer-events: none; }
.cg-wipe svg {
  position: absolute; left: 0; top: -1px;
  display: block; width: 100%; height: 144px;
}
.cg-wipe path { fill: var(--c-ink); }

/* ---- Pinned call story: the card holds still, the three rows pass by ---- */
.cg-pin .missed-call-section .grid-2 { align-items: start; }
.cg-pin .missed-call-section .callcard-stage { align-items: flex-start; will-change: transform; }
.cg-pin .missed-call-section .callcard-viz { flex: 0 0 auto; height: 96px; }
.cg-pin .missed-call-section .missed-feature + .missed-feature { margin-top: 24vh; }
.cg-pin .missed-call-section .missed-features { padding-bottom: 16vh; }
.cg-pin .missed-call-section .missed-feature > * { opacity: 0.32; transition: opacity 0.4s ease-out; }
.cg-pin .missed-call-section .missed-feature.is-active > * { opacity: 1; }


/* =========================================================
   Homepage guide: step numbers, the Call Line, chapter rail
   ========================================================= */

/* ---- Step numbers on each chapter's eyebrow ---- */
.cg-step {
  display: inline-block; margin-right: 8px; padding: 0 8px;
  border: 1px solid currentColor; border-radius: 999px;
  font-variant-numeric: tabular-nums; line-height: 20px;
  opacity: 0.45;
  transition: opacity 0.3s ease-out, background-color 0.3s ease-out, color 0.3s ease-out, border-color 0.3s ease-out;
}
.cg-reached .cg-step { opacity: 1; background: var(--c-yellow); border-color: var(--c-yellow); color: var(--c-ink); }
.bg-yellow .cg-reached .cg-step { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-yellow); }

/* ---- The Call Line ---- */
.cg-line {
  position: absolute; left: 0; top: 0; z-index: 4;
  width: 100%; overflow: hidden; pointer-events: none;
}
.cg-line svg { display: block; overflow: visible; }
.cg-line-path, .cg-line-ghost { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cg-line-path.on-dark { stroke: var(--c-yellow); filter: drop-shadow(0 0 6px rgba(255, 208, 44, 0.65)); }
.cg-line-path.on-light { stroke: var(--c-ink); }
.cg-line-ghost { stroke-dasharray: 2 8; opacity: 0.18; }
.cg-line-ghost.on-dark { stroke: var(--c-white); }
.cg-line-ghost.on-light { stroke: var(--c-ink); }

.cg-node { stroke-width: 2; transition: fill 0.3s ease-out; }
.cg-node.on-dark { fill: var(--c-ink); stroke: var(--c-yellow); }
.cg-node.on-light { fill: var(--c-white); stroke: var(--c-ink); }
.cg-node.on-dark.is-on { fill: var(--c-yellow); }
.cg-node.on-light.is-on { fill: var(--c-ink); }
.bg-yellow .cg-node.on-light { fill: var(--c-yellow); }

.cg-tick { stroke-width: 1.5; stroke-dasharray: 3 4; opacity: 0; transition: opacity 0.4s ease-out; }
.cg-tick.on-dark { stroke: var(--c-yellow); }
.cg-tick.on-light { stroke: var(--c-ink); }
.cg-tick.is-on { opacity: 0.55; }

.cg-spark { transition: opacity 0.3s ease-out; }
.cg-spark-glow { fill: var(--c-yellow); opacity: 0.35; filter: blur(6px); }
.cg-spark-core { fill: var(--c-yellow); stroke: var(--c-ink); stroke-width: 2; }

/* the journey ends in the Book a Call button */
.btn.cg-line-done { animation: cgBookGlow 2.4s ease-in-out infinite; }
@keyframes cgBookGlow {
  0%, 100% { box-shadow: 0 4px 14px rgba(255, 208, 44, 0.3); }
  50%      { box-shadow: 0 0 0 8px rgba(255, 208, 44, 0.18), 0 8px 32px rgba(255, 208, 44, 0.55); }
}

/* the chapter rail replaces the old right-edge scroll progress bar */
.cg-motion .scroll-progress { display: none; }

/* ---- Chapter rail (desktop) ---- */
.cg-rail {
  position: fixed; right: 24px; top: 50%; z-index: 60;
  transform: translateY(-50%);
  color: var(--c-ink);
}
.cg-rail.on-dark { color: var(--c-white); }
.cg-pill { display: none; }
.cg-rail-list {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  margin: 0; padding: 0; list-style: none;
}
.cg-rail-list li { display: flex; justify-content: flex-end; }
.cg-rail-item {
  display: flex; flex-direction: row-reverse; align-items: center; gap: 8px;
  padding: 4px 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; color: inherit;
}
.cg-rail-dot {
  flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; opacity: 0.3;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out, background-color 0.2s ease-out;
}
.cg-rail-item.is-past .cg-rail-dot { opacity: 0.6; }
.cg-rail-item.is-current .cg-rail-dot {
  opacity: 1; transform: scale(1.5); background: var(--c-yellow);
  box-shadow: 0 0 0 2px var(--c-ink);
}
.cg-rail-num { font-variant-numeric: tabular-nums; opacity: 0; transition: opacity 0.2s ease-out; }
.cg-rail-item.is-current .cg-rail-num { opacity: 0.8; }
.cg-rail-label {
  padding: 4px 8px; border-radius: 999px;
  background: rgba(254, 253, 251, 0.94); color: var(--c-ink);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  white-space: nowrap; opacity: 0; transform: translateX(8px); pointer-events: none;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
.cg-rail-list:hover .cg-rail-label,
.cg-rail-item:focus-visible .cg-rail-label { opacity: 1; transform: none; }
.cg-rail-item:hover .cg-rail-dot { opacity: 1; transform: scale(1.3); }
.cg-rail-item:focus-visible { outline: 2px solid var(--c-yellow); outline-offset: 4px; border-radius: 8px; }

/* ---- Chapter pill (smaller screens) ---- */
@media (max-width: 1199px) {
  .cg-rail { top: auto; right: auto; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; }
  .cg-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px; border: 0; border-radius: 999px; cursor: pointer;
    background: rgba(26, 26, 26, 0.92); color: var(--c-white);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap;
  }
  .cg-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c-yellow); }
  .cg-pill:focus-visible { outline: 2px solid var(--c-yellow); outline-offset: 4px; }
  .cg-rail-list { display: none; }
  .cg-rail.is-open .cg-rail-list {
    display: flex; position: absolute; left: 50%; bottom: calc(100% + 8px);
    transform: translateX(-50%); min-width: 220px; padding: 8px 16px;
    background: var(--c-white); color: var(--c-ink); border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  }
  .cg-rail.is-open .cg-rail-list { align-items: stretch; }
  .cg-rail.is-open .cg-rail-list li { justify-content: flex-start; }
  .cg-rail.is-open .cg-rail-item { flex-direction: row; }
  .cg-rail.is-open .cg-rail-label { opacity: 1; transform: none; background: none; box-shadow: none; padding: 0; }
  .cg-rail.is-open .cg-rail-num { opacity: 0.6; }
}

/* =========================================================
   Clara's voice: tour buttons, Ask Clara chips, caption card
   ========================================================= */
.clara-chips { max-width: 440px; }

/* ---- Tour buttons ---- */
.cg-tour {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 700; white-space: nowrap;
  transition: background-color 0.2s ease-out, color 0.2s ease-out, transform 0.2s ease-out;
}
.cg-tour-dot {
  width: 8px; height: 8px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 0 rgba(255, 208, 44, 0.6);
}
.cg-tour[aria-pressed="true"] .cg-tour-dot { animation: cgTourPulse 1.4s ease-out infinite; }
@keyframes cgTourPulse { 0% { box-shadow: 0 0 0 0 rgba(255, 208, 44, 0.6); } 100% { box-shadow: 0 0 0 8px rgba(255, 208, 44, 0); } }
.cg-tour:focus-visible { outline: 2px solid var(--c-yellow); outline-offset: 4px; }

.cg-tour-hero {
  position: relative; z-index: 10; margin-top: 8px; padding: 8px 16px; pointer-events: auto;
  background: var(--c-yellow); color: var(--c-ink); font-size: 14px;
  box-shadow: 0 8px 24px rgba(255, 208, 44, 0.25);
}
.cg-tour-hero:hover { transform: translateY(-2px); }
.cg-tour-hero[aria-pressed="true"] { background: var(--c-white); }

.cg-tour-rail {
  margin: 0 0 16px auto; padding: 4px 8px 4px 12px; display: flex;
  background: var(--c-ink); color: var(--c-yellow); font-size: 14px;
}
.cg-rail.on-dark .cg-tour-rail { background: var(--c-yellow); color: var(--c-ink); }
.cg-tour-rail[aria-pressed="true"] { background: var(--c-yellow); color: var(--c-ink); }

/* ---- Ask Clara chips inside each section ---- */
.cg-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 24px; }
.cg-ask.is-center { justify-content: center; }
.cg-ask-label {
  display: inline-flex; align-items: center; gap: 8px; margin-right: 4px;
  font-size: 14px; font-weight: 700; opacity: 0.7;
}
.cg-ask-orb {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFF3C4, var(--c-yellow) 55%, #B98A00);
  box-shadow: 0 0 8px rgba(255, 208, 44, 0.6);
}
.cg-ask-chip {
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600;
  background: rgba(26, 26, 26, 0.05); color: inherit;
  border: 1px solid rgba(26, 26, 26, 0.16);
  transition: background-color 0.2s ease-out, border-color 0.2s ease-out, transform 0.2s ease-out;
}
.cg-ask-chip:hover { transform: translateY(-2px); border-color: currentColor; }
.cg-ask-chip:focus-visible { outline: 2px solid var(--c-yellow); outline-offset: 2px; }
.cg-ask-chip.is-playing { background: var(--c-yellow); border-color: var(--c-yellow); color: var(--c-ink); }
.bg-ink .cg-ask-chip, .bg-graphite .cg-ask-chip { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.18); }
.bg-yellow .cg-ask-chip { background: rgba(26, 26, 26, 0.06); border-color: rgba(26, 26, 26, 0.25); }
.bg-yellow .cg-ask-chip.is-playing { background: var(--c-ink); color: var(--c-yellow); border-color: var(--c-ink); }

/* ---- Caption card ---- */
.cg-say {
  position: fixed; right: 24px; bottom: 24px; z-index: 70;
  display: flex; align-items: flex-start; gap: 16px;
  width: min(440px, calc(100vw - 48px)); padding: 16px;
  background: rgba(26, 26, 26, 0.94); color: var(--c-white);
  border: 1px solid rgba(255, 208, 44, 0.25); border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  opacity: 0; transform: translateY(16px); pointer-events: none;
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}
.cg-say.is-on { opacity: 1; transform: none; pointer-events: auto; }
.cg-say-orb {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; margin-top: 4px;
  background: radial-gradient(circle at 35% 30%, #FFF3C4, var(--c-yellow) 55%, #B98A00);
  box-shadow: 0 0 16px rgba(255, 208, 44, 0.55);
  animation: cgSayBreath 1.6s ease-in-out infinite;
}
@keyframes cgSayBreath { 0%, 100% { transform: scale(0.92); } 50% { transform: scale(1.06); } }
.cg-say-body { flex: 1 1 auto; min-width: 0; }
.cg-say-name { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 700; color: var(--c-yellow); }
.cg-say-text { margin: 0; font-size: 16px; line-height: 1.5; color: rgba(255, 255, 255, 0.92); }
.cg-say-ctrl { display: flex; flex-direction: column; gap: 4px; }
.cg-say-btn {
  padding: 4px 8px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 8px;
  background: none; color: rgba(255, 255, 255, 0.75); cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600;
}
.cg-say-btn:hover { color: var(--c-white); border-color: rgba(255, 255, 255, 0.5); }
.cg-say-btn:focus-visible { outline: 2px solid var(--c-yellow); outline-offset: 2px; }

@media (max-width: 1199px) {
  .cg-say { left: 16px; right: 16px; bottom: 72px; width: auto; }
  .cg-tour-rail { margin: 0; display: inline-flex; padding: 8px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .cg-say-orb, .cg-tour[aria-pressed="true"] .cg-tour-dot { animation: none; }
}

/* the hero's decorative rings and glow must never swallow clicks meant for Clara's buttons */
.hero-visual .ae-ring, .hero-visual .ae-glow { pointer-events: none; }

/* ---- While Clara introduces a section: its rail dot pulses and its step number glows ---- */
.cg-rail-item.cg-talking .cg-rail-dot { animation: cgTalkDot 1.2s ease-out infinite; }
@keyframes cgTalkDot {
  0%   { box-shadow: 0 0 0 2px var(--c-ink), 0 0 0 2px rgba(255, 208, 44, 0.7); }
  100% { box-shadow: 0 0 0 2px var(--c-ink), 0 0 0 12px rgba(255, 208, 44, 0); }
}
.cg-talking .cg-step { animation: cgTalkStep 1.6s ease-in-out infinite; }
@keyframes cgTalkStep {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 208, 44, 0); }
  50%      { box-shadow: 0 0 0 6px rgba(255, 208, 44, 0.35); }
}
@media (prefers-reduced-motion: reduce) {
  .cg-rail-item.cg-talking .cg-rail-dot, .cg-talking .cg-step { animation: none; }
}

/* =========================================================
   "Poke me": Clara's speech bubble and attention boing
   ========================================================= */
.cg-poke {
  position: absolute; z-index: 12; left: 0; top: 0;
  max-width: 280px; padding: 8px 16px;
  border: 1px solid rgba(255, 208, 44, 0.55); border-radius: 16px;
  background: var(--c-ink); color: var(--c-yellow);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(255, 208, 44, 0.08);
  font: inherit; font-size: 14px; font-weight: 700; line-height: 1.4; text-align: center;
  cursor: pointer; pointer-events: auto;
  opacity: 0; transform: translateY(8px) scale(0.9); transform-origin: 50% 100%;
  transition: opacity 0.4s ease-out, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cg-poke.is-in { opacity: 1; transform: none; animation: cgPokeFloat 3.2s ease-in-out 0.6s infinite; }
.cg-poke::after {
  content: ''; position: absolute; left: 50%; bottom: -7px;
  width: 12px; height: 12px; margin-left: -6px;
  background: var(--c-ink);
  border-right: 1px solid rgba(255, 208, 44, 0.55); border-bottom: 1px solid rgba(255, 208, 44, 0.55);
  transform: rotate(45deg);
}
.cg-poke:hover { border-color: var(--c-yellow); }
.cg-poke:focus-visible { outline: 2px solid var(--c-yellow); outline-offset: 4px; }
.cg-poke-text { display: inline-block; transition: opacity 0.2s ease-out, transform 0.2s ease-out; }
.cg-poke-text.is-swapping { opacity: 0; transform: translateY(4px); }
@keyframes cgPokeFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* the orb's little "boing" (transform only) plus one ripple ring */
.clara-orb.cg-boing { animation: cgBoing 0.8s ease-out; }
@keyframes cgBoing {
  0%   { transform: scale(1, 1); }
  20%  { transform: scale(1.1, 0.9); }
  40%  { transform: scale(0.94, 1.07); }
  60%  { transform: scale(1.04, 0.97); }
  80%  { transform: scale(0.99, 1.01); }
  100% { transform: scale(1, 1); }
}
.clara-orb.cg-boing .clara-ripple:first-child { animation: claraRipple 1.2s ease-out 1; }

@media (max-width: 1199px) {
  .cg-poke { max-width: calc(100vw - 48px); }
}
@media (prefers-reduced-motion: reduce) {
  .cg-poke.is-in { animation: none; }
  .clara-orb.cg-boing, .clara-orb.cg-boing .clara-ripple:first-child { animation: none; }
}

/* ---- Live captions: words light up as Clara says them ---- */
.cg-say-text { position: relative; }
.cg-cw { opacity: 0; transition: opacity 0.18s ease-out; }
.cg-cw.on { opacity: 1; }
