/* Cinematic homepage comp: hero + one pinned "brand glow-up" scene.
   Static by default (no JS, reduced motion): before and after sit side by side.
   js/cinematic.js adds .cn-live to #glowup and drives --wipe, --s2, --s3 (0 to 1). */

.cn-hero, .cn-scene {
  --cn-bg: #05070d;
  --cn-bg-2: #0a1020;
  --cn-ink: #f4f7fc;
  --cn-soft: #c3cde0;
  --cn-sky: #8fb8ff;
  --cn-blue: #2563eb;
  --cn-line: rgba(255, 255, 255, 0.14);
  color: var(--cn-ink);
  background: var(--cn-bg);
}
.cn-wrap {
  width: 100%;
  max-width: calc(var(--wrap, 1240px) + 2 * var(--gutter, 1.25rem));
  margin-inline: auto;
  padding-inline: var(--gutter, 1.25rem);
}
body.home-dark .cn-eyebrow {
  margin: 0 0 1.1rem;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--cn-sky);
}
.cn-btn {
  display: inline-flex; align-items: center; gap: 0.7rem;
  min-height: 3.2rem; padding: 0 1.4rem; border-radius: 999px;
  font-weight: 700; font-size: 1rem; text-decoration: none; line-height: 1;
  border: 1px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.cn-btn--primary { background: var(--cn-blue); color: #fff; box-shadow: 0 12px 40px -8px rgba(37, 99, 235, 0.7); }
.cn-btn--primary:hover { background: #1d4ed8; transform: translateY(-1px); }
.cn-btn--ghost { color: var(--cn-ink); border-color: rgba(255, 255, 255, 0.32); background: rgba(255, 255, 255, 0.04); }
.cn-btn--ghost:hover { border-color: #fff; background: rgba(255, 255, 255, 0.1); }
.cn-btn:focus-visible, .cn-hero a:focus-visible, .cn-scene a:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.cn-btn-dot { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.cn-btn-dot svg { width: 0.9rem; height: 0.9rem; }

/* ---------- Hero ---------- */
.cn-hero {
  position: relative; overflow: hidden; isolation: isolate;
  padding: clamp(3rem, 7vw, 6rem) 0 clamp(3.5rem, 8vw, 7rem);
  background:
    radial-gradient(60% 70% at 78% 40%, rgba(37, 99, 235, 0.34), transparent 70%),
    radial-gradient(40% 50% at 8% 100%, rgba(143, 184, 255, 0.16), transparent 70%),
    linear-gradient(180deg, #070b16 0%, var(--cn-bg) 100%);
}
.cn-hero-glow {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: conic-gradient(from 210deg at 80% 42%, transparent 0 28%, rgba(143, 184, 255, 0.12) 36%, transparent 46%);
  mix-blend-mode: screen;
}
.cn-hero-grid { display: grid; gap: clamp(2.5rem, 5vw, 4rem); align-items: center; }
body.home-dark .cn-hero h1 {
  margin: 0; color: var(--cn-ink); max-width: none;
  font-size: clamp(2.9rem, 7.6vw, 6.8rem); line-height: 0.96; letter-spacing: -0.055em; font-weight: 800;
}
body.home-dark .cn-hero h1 span { color: var(--cn-sky); font-style: italic; }
body.home-dark .cn-hero .cn-hero-sub { margin: 1.6rem 0 0; max-width: 30ch; font-size: clamp(1.1rem, 1.8vw, 1.45rem); line-height: 1.4; color: var(--cn-soft); }
.cn-ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
body.home-dark .cn-hero .cn-hero-note { margin: 1.4rem 0 0; color: var(--cn-soft); }
body.home-dark .cn-hero .cn-hero-note a { color: var(--cn-ink); text-decoration: underline; text-underline-offset: 3px; }

.cn-deck { position: relative; aspect-ratio: 5 / 4.6; width: 100%; max-width: 720px; justify-self: center; perspective: 1400px; }
.cn-deck figure {
  position: absolute; margin: 0; width: 72%;
  border-radius: 14px; overflow: hidden; background: #111;
  box-shadow: 0 50px 90px -30px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 80px -20px rgba(37, 99, 235, 0.55);
  transform: translate3d(0, calc(var(--hy, 0) * var(--k, 1) * 1px), 0) rotateY(var(--ry)) rotateZ(var(--rz));
  will-change: transform;
}
.cn-deck img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }
.cn-deck-a { --k: 0.5; --ry: -12deg; --rz: 2deg; right: 0; top: 0; z-index: 1; filter: brightness(0.78); }
.cn-deck-b { --k: 1; --ry: -9deg; --rz: -1.5deg; left: 6%; top: 28%; z-index: 2; }
.cn-deck-c { --k: 1.6; --ry: -6deg; --rz: 2.5deg; right: 2%; bottom: 0; z-index: 3; width: 62%; }

@media (min-width: 900px) {
  .cn-hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
}
@media (max-width: 899px) {
  .cn-deck { max-width: 480px; aspect-ratio: 5 / 4.4; }
}

/* ---------- Scene: static layout (default) ---------- */
.cn-scene { position: relative; padding: clamp(3.5rem, 8vw, 6rem) 0; overflow: hidden;
  background: radial-gradient(70% 60% at 70% 30%, rgba(37, 99, 235, 0.22), transparent 70%), linear-gradient(180deg, var(--cn-bg) 0%, var(--cn-bg-2) 100%); }
.cn-sticky { position: relative; }
.cn-light { display: none; }
.cn-scene-grid { display: grid; gap: 2.5rem; }
body.home-dark .cn-h { margin: 0 0 1.5rem; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1; letter-spacing: -0.045em; color: var(--cn-ink); max-width: 16ch; }
.cn-caps { display: grid; gap: 1.8rem; }
.cn-cap-h { margin: 0; font-size: clamp(1.6rem, 3.4vw, 2.6rem); line-height: 1.02; letter-spacing: -0.04em; font-weight: 800; }
.cn-cap-h span { color: var(--cn-sky); }
body.home-dark .cn-caps .cn-cap-p { margin: 1.1rem 0 0; max-width: 40ch; color: var(--cn-soft); font-size: 1.05rem; line-height: 1.5; }
body.home-dark .cn-caps .cn-cap-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.8rem 0 0; }
.cn-frames { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.cn-frame { position: relative; margin: 0; border-radius: 14px; overflow: hidden; background: #0d1322;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.12); }
.cn-frame img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; object-position: top; }
.cn-frame--after img { object-position: 50% 50%; }
.cn-chip { position: absolute; right: 0.8rem; bottom: 0.8rem; z-index: 2; padding: 0.35rem 0.7rem; border-radius: 999px;
  background: rgba(5, 7, 13, 0.82); color: #fff; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.22); }
.cn-chip--after { background: var(--cn-blue); border-color: transparent; }
.cn-divider { display: none; }
.cn-phone { margin: 0; width: calc(50% - 0.5rem); border-radius: 26px; overflow: hidden; background: #000;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.85), 0 0 0 6px #10151f, 0 0 0 7px rgba(255, 255, 255, 0.16); }
.cn-phone img { display: block; width: 100%; height: auto; }
.cn-stage { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1.5rem 1rem; }
.cn-win { flex: 1 1 100%; }

@media (min-width: 900px) {
  .cn-phone--a { margin-left: 4%; }
  .cn-phone--b { margin-left: 2%; }
  .cn-scene-grid { grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr); align-items: start; gap: clamp(2rem, 5vw, 4.5rem); }
  .cn-frames { grid-template-columns: 1fr 1fr; }
  .cn-phone { width: 24%; }
}

/* ---------- Scene: pinned, scroll-driven (only with .cn-live) ---------- */
.cn-live.cn-scene { height: 420vh; padding: 0; overflow: visible; }
.cn-live .cn-sticky {
  position: sticky; top: var(--hdr, 4.25rem);
  height: calc(100vh - var(--hdr, 4.25rem)); height: calc(100svh - var(--hdr, 4.25rem));
  overflow: hidden; display: flex; align-items: center;
  --wipe: 0; --s2: 0; --s3: 0; --in: 1;
}
.cn-live .cn-light {
  display: block; position: absolute; inset: -20%; pointer-events: none;
  background:
    radial-gradient(40% 45% at 55% 40%, rgba(143, 184, 255, 0.34), transparent 70%),
    conic-gradient(from 200deg at 75% 35%, transparent 0 30%, rgba(143, 184, 255, 0.10) 38%, transparent 48%);
  mix-blend-mode: screen;
  opacity: calc(0.55 + var(--wipe) * 0.45);
  transform: translate3d(calc(var(--wipe) * 25%), 0, 0);
  will-change: transform, opacity;
}
.cn-live .cn-scene-grid { position: relative; align-items: center; width: 100%; }
.cn-live .cn-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; }
.cn-live .cn-caps { display: grid; gap: 0; }
.cn-live .cn-cap { grid-area: 1 / 1; will-change: opacity, transform; }
.cn-live .cn-cap-h { font-size: clamp(2.2rem, 4.6vw, 4.4rem); line-height: 0.98; letter-spacing: -0.05em; }
.cn-live .cn-cap--1 { opacity: clamp(0, calc(1 - var(--s2) * 2.2), 1); transform: translateY(calc(var(--s2) * -34px)); }
.cn-live .cn-cap--2 { opacity: calc(clamp(0, (var(--s2) - 0.55) * 2.3, 1) * clamp(0, calc(1 - var(--s3) * 2.2), 1)); transform: translateY(calc((1 - var(--s2)) * 34px - var(--s3) * 34px)); }
.cn-live .cn-cap--3 { opacity: clamp(0, calc((var(--s3) - 0.55) * 2.3), 1); transform: translateY(calc((1 - var(--s3)) * 34px)); pointer-events: none; }
.cn-live[data-stage="3"] .cn-cap--3 { pointer-events: auto; }
.cn-live .cn-cap--1, .cn-live .cn-cap--2 { pointer-events: none; }
/* JS sets .cn-off on a caption once it is fully faded out, so its links cannot take focus unseen. */
.cn-live .cn-cap.cn-off { visibility: hidden; }

.cn-live .cn-stage { position: relative; display: block; aspect-ratio: 2 / 1; width: 100%; perspective: 1600px; }
.cn-live .cn-win {
  position: absolute; inset: 0;
  transform-origin: 50% 50%;
  transform:
    translate3d(calc(var(--s2) * -9%), calc(var(--s2) * -10% - var(--s3) * 4%), 0)
    rotateY(calc(-8deg + var(--wipe) * 6deg - var(--s2) * 4deg))
    scale(calc(0.9 + var(--wipe) * 0.1 - var(--s2) * 0.14 - var(--s3) * 0.05));
  filter: brightness(calc(1 - var(--s3) * 0.45));
  will-change: transform;
}
.cn-live .cn-frames { position: absolute; inset: 0; display: block; border-radius: 14px; overflow: hidden;
  box-shadow: 0 60px 100px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.14), 0 0 120px -20px rgba(37, 99, 235, 0.6); }
.cn-live .cn-frame { position: absolute; inset: 0; border-radius: 0; box-shadow: none; }
.cn-live .cn-frame img { width: 100%; height: 100%; aspect-ratio: auto; }
.cn-live .cn-frame--after { clip-path: inset(0 calc((1 - var(--wipe)) * 100%) 0 0); }
.cn-live .cn-chip--after { opacity: calc(var(--wipe) * 2 - 0.6); }
.cn-live .cn-chip:not(.cn-chip--after) { opacity: calc(1 - var(--wipe) * 1.4); }
.cn-live .cn-divider {
  display: block; position: absolute; top: 0; bottom: 0; left: calc(var(--wipe) * 100%); width: 3px; margin-left: -1.5px; z-index: 3;
  background: linear-gradient(180deg, transparent, #fff 15%, #fff 85%, transparent);
  box-shadow: 0 0 24px 6px rgba(143, 184, 255, 0.85);
  opacity: calc(min(var(--wipe) * 12, 1) * min((1 - var(--wipe)) * 12, 1));
}
.cn-live .cn-phone { position: absolute; z-index: 4; margin: 0; will-change: transform; }
.cn-live .cn-phone--a {
  width: 25%; right: 2%; bottom: -10%;
  transform: translate3d(0, calc((1 - var(--s2)) * 130%), 0) rotate(calc(5deg - var(--s2) * 2deg)) scale(calc(1 - var(--s3) * 0.06));
  opacity: calc(min(var(--s2) * 4, 1) * (1 - var(--s3) * 0.6));
}
.cn-live .cn-phone--b {
  width: 22%; right: 26%; bottom: -16%;
  transform: translate3d(0, calc((1 - var(--s2)) * 150%), 0) rotate(calc(-4deg + var(--s2) * 2deg)) scale(calc(1 - var(--s3) * 0.06));
  opacity: calc(min(var(--s2) * 4, 1) * (1 - var(--s3) * 0.6));
}

@media (max-width: 899px) {
  .cn-live.cn-scene { height: 380vh; }
  .cn-live .cn-scene-grid { display: grid; grid-template-rows: auto auto; align-content: center; gap: 1.4rem; }
  .cn-live .cn-cap-h { font-size: clamp(1.9rem, 8.4vw, 2.6rem); }
  .cn-live .cn-cap-p { font-size: 0.98rem; margin-top: 0.5rem; }
  .cn-live .cn-cap-cta .cn-btn--ghost { display: none; }
  .cn-live .cn-cap-cta { margin-top: 1.2rem; }
  body.home-dark .cn-live .cn-eyebrow { font-size: 0.68rem; letter-spacing: 0.12em; margin-bottom: 0.7rem; }
  .cn-live .cn-chip { font-size: 0.6rem; padding: 0.25rem 0.5rem; right: 0.5rem; bottom: 0.5rem; }
  .cn-live .cn-sticky { padding-bottom: 5.5rem; }
  .cn-live .cn-stage { aspect-ratio: 1 / 1.02; }
  .cn-live .cn-win { inset: 0 0 auto 0; aspect-ratio: 2 / 1; transform: translate3d(0, calc(var(--s2) * -4%), 0) scale(calc(0.94 + var(--wipe) * 0.06 - var(--s2) * 0.04 - var(--s3) * 0.05)); }
  .cn-live .cn-phone--a { width: 36%; right: 3%; bottom: 0; }
  .cn-live .cn-phone--b { width: 32%; right: 36%; bottom: -3%; }
}

/* Under 760px the fixed Call/Book bar (.tk-bar, measured 71px tall at 375, 390 and 430) overlays the
   bottom of the viewport. End the pinned stage above it so nothing is hidden underneath. */
@media (max-width: 760px) {
  html.tk-has-bar .cn-live .cn-sticky {
    height: calc(100vh - var(--hdr, 4.25rem) - var(--tk-bar-h, 76px) - env(safe-area-inset-bottom, 0px));
    height: calc(100svh - var(--hdr, 4.25rem) - var(--tk-bar-h, 76px) - env(safe-area-inset-bottom, 0px));
    padding-bottom: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cn-btn { transition: none; }
}
html[data-a11y-motion="reduced"] .cn-deck figure,
html.kw-pause-animations .cn-deck figure { transform: none !important; }
