/* /ForGuides/invite: one statement at a time on a full-height "trail".
   Deck mode is the default; guide-invite-static.css (loaded in <noscript>) stacks
   every slide instead. js/guide-invite.js drives .is-active / .is-leaving and the
   --invite-* custom properties. Modal + .btn-cta styles come from forguides.css. */

.invite {
  --invite-h: calc(100svh - 76px);
  --invite-pad: max(24px, calc((100vw - 1180px) / 2));
  --invite-progress: 0;
  --invite-shift: 0;
  /* Room kept free on the right for the floating CTA; js/guide-invite.js sets its real width. */
  --invite-cta-w: 20rem;
  --invite-cta-room: calc(var(--invite-cta-w) + 24px + var(--space-4));
  position: relative;
  height: var(--invite-h);
  min-height: 600px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  isolation: isolate;
}

/* ----- Ambient map: contours drift a little with every step ----- */
.invite-atlas {
  position: absolute; inset: -12%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 55% at 72% 48%, rgba(0, 168, 107, 0.16), transparent 70%),
    radial-gradient(ellipse 40% 40% at 18% 80%, rgba(255, 213, 79, 0.06), transparent 70%),
    url("/img/contours.svg") center / 900px auto repeat;
  opacity: 0.55;
  transform: translate3d(calc(var(--invite-shift) * -1.4%), calc(var(--invite-shift) * 0.6%), 0) rotate(calc(var(--invite-shift) * 0.35deg));
  transition: transform 1400ms var(--ease);
}

/* ----- Top line: product name + step counter ----- */
.invite-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-4) var(--invite-pad) 0;
}
.invite-eyebrow {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--waypoint);
}
.invite-count {
  font-family: var(--font-display); font-variant-numeric: tabular-nums; color: var(--text-3);
  font-size: 0.95rem; letter-spacing: 0.04em;
}
.invite-count-now { color: var(--text-1); font-size: 1.35rem; margin-inline-end: 0.3em; }

/* ----- Stage + slides ----- */
.invite-stage { position: relative; min-height: 0; }
.invite-slide {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); grid-template-rows: minmax(0, 1fr);
  align-items: center; gap: clamp(32px, 6vw, 96px);
  padding: var(--space-4) var(--invite-pad);
  visibility: hidden; pointer-events: none;
}
.invite-slide.is-active, .invite-slide.is-leaving { visibility: visible; }
.invite-slide.is-active { pointer-events: auto; }

.invite-copy { min-width: 0; max-width: 40rem; }
.invite-step {
  display: block; font-family: var(--font-display); font-variant-numeric: tabular-nums;
  font-size: 0.95rem; color: var(--trail-400); letter-spacing: 0.08em; margin-bottom: var(--space-3);
}
.invite-step::after {
  content: ''; display: inline-block; vertical-align: middle; width: 48px; height: 1px;
  margin-inline-start: 12px; background: linear-gradient(90deg, var(--trail-500), transparent);
}
.invite-title {
  font-family: var(--font-display); font-weight: 560; letter-spacing: -0.02em;
  font-size: clamp(2rem, 4.1vw, 3.55rem); line-height: 1.06; text-wrap: balance;
  color: var(--text-1);
  margin-bottom: var(--space-4);
}
.invite-body, .invite-bullets {
  color: var(--text-2); font-size: clamp(1rem, 1.25vw, 1.15rem); line-height: 1.7; max-width: 34rem;
}
.invite-bullets { list-style: none; display: grid; gap: var(--space-3); }
.invite-bullets li {
  position: relative; padding-inline-start: 1.6rem;
}
.invite-bullets li::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 0.62em;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--waypoint); box-shadow: 0 0 0 4px rgba(255, 213, 79, 0.14);
}

/* ----- Media column ----- */
.invite-media {
  min-width: 0; min-height: 0; height: 100%; align-self: stretch;
  display: flex; align-items: center; justify-content: center;
  perspective: 1400px;
}
.invite-device {
  height: min(100%, 640px); width: auto; aspect-ratio: 640 / 1300; max-width: 100%;
  border-radius: 38px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 80px rgba(0, 168, 107, 0.12);
}
/* Screenshots in img/guide-invite/ are cropped below the status bar, so no top offset here. */
.invite-device img { width: 100%; height: 100%; margin-top: 0; object-fit: cover; object-position: top center; }
.invite-picture {
  margin: 0; width: 100%; max-height: 100%; border-radius: var(--radius-2); overflow: hidden;
  border: 1px solid var(--hairline); box-shadow: 0 40px 90px rgba(0, 0, 0, 0.5);
}
.invite-picture img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Badge / emblem (image kind "badge"): free-standing, with a soft halo and a slow sway. */
.invite-badge {
  position: relative; height: min(100%, 420px); aspect-ratio: 1; max-width: 100%;
  display: grid; place-items: center;
}
.invite-badge::before {
  content: ''; position: absolute; inset: -8%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 213, 79, 0.22), rgba(0, 168, 107, 0.12) 45%, transparent 70%);
}
.invite-badge img {
  position: relative; width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 24px 50px rgba(0, 0, 0, 0.55));
}
.invite-slide.is-active .invite-badge img { animation: invite-sway 6s ease-in-out 1.3s infinite; }
@keyframes invite-sway { 0%, 100% { transform: rotate(-3deg) translateY(0); } 50% { transform: rotate(3deg) translateY(-8px); } }

/* Placeholder art (no image yet) and headline figures */
.invite-art {
  position: relative; height: min(100%, 460px); width: auto; aspect-ratio: 1; max-width: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(0, 168, 107, 0.14), rgba(12, 12, 20, 0.2) 62%, transparent 72%);
  display: grid; place-items: center;
}
.invite-art::before {
  content: ''; position: absolute; inset: 6%; border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.08);
}
.invite-trail-art { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.invite-art-path {
  fill: none; stroke: var(--trail-500); stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 900; stroke-dashoffset: 0;
  filter: drop-shadow(0 0 8px rgba(0, 168, 107, 0.6));
}
.invite-art-dot { fill: var(--ink-950); stroke: var(--trail-400); stroke-width: 2.5; }
.invite-art-pin { fill: var(--waypoint); filter: drop-shadow(0 0 12px rgba(255, 213, 79, 0.8)); }
.invite-art-number {
  position: relative; font-family: var(--font-display); font-weight: 400; font-variant-numeric: tabular-nums;
  font-size: clamp(6rem, 13vw, 11rem); line-height: 1; letter-spacing: -0.04em;
  color: transparent; -webkit-text-stroke: 1px rgba(242, 242, 247, 0.22);
}
.invite-art:has(.invite-stat) .invite-trail-art { opacity: 0.45; }
.invite-stat { position: relative; display: grid; justify-items: center; text-align: center; gap: var(--space-2); padding: 0 12%; }
.invite-stat-value {
  font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums;
  font-size: clamp(5.5rem, 12vw, 10rem); line-height: 0.95; letter-spacing: -0.04em;
  color: var(--waypoint); text-shadow: 0 0 60px rgba(255, 213, 79, 0.35);
}
.invite-stat-label {
  color: var(--text-1); font-size: clamp(0.95rem, 1.3vw, 1.1rem); font-weight: 600; max-width: 16rem; text-wrap: balance;
}

/* ----- Tap to enlarge -----
   Screenshots open in .invite-zoom; the script animates a copy from the tapped frame
   to a centred, fully visible picture (FLIP: transform + clip-path), and back. */
[data-invite-zoomable] { position: relative; cursor: zoom-in; -webkit-tap-highlight-color: transparent; }
[data-invite-zoomable]:focus-visible { outline: 2px solid var(--trail-400); outline-offset: 4px; }
.invite-zoom-badge {
  position: absolute; z-index: 2; top: 10px; inset-inline-end: 10px;
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(7, 7, 12, 0.72); border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-1); pointer-events: none;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: transform var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.invite-zoom-badge svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
[data-invite-zoomable]:hover .invite-zoom-badge { transform: scale(1.08); background: rgba(0, 107, 64, 0.85); }

.invite-zoom {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(7, 7, 12, 0); transition: background 380ms var(--ease);
  cursor: zoom-out; touch-action: pinch-zoom;
}
.invite-zoom[hidden] { display: none; }
.invite-zoom.is-open { background: rgba(7, 7, 12, 0.9); }
.invite-zoom-img {
  position: fixed; left: 0; top: 0; display: block; max-width: none;
  transform-origin: 0 0; border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  will-change: transform, clip-path;
  transition: transform 460ms var(--ease), clip-path 460ms var(--ease);
}
.invite-zoom-close {
  position: fixed; z-index: 1;
  top: calc(16px + env(safe-area-inset-top, 0px)); inset-inline-end: 16px;
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(19, 19, 29, 0.85); border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-1); cursor: pointer; opacity: 0; transition: opacity 300ms var(--ease) 120ms;
}
.invite-zoom-close svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.invite-zoom.is-open .invite-zoom-close { opacity: 1; }
html.invite-zoom-lock, html.invite-zoom-lock body { overflow: hidden; }

/* ----- Trail navigation ----- */
.invite-bar {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: var(--space-3); padding: var(--space-2) var(--invite-pad) 0;
  padding-inline-end: max(var(--invite-pad), var(--invite-cta-room));
}
.invite-arrow {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(19, 19, 29, 0.7);
  color: var(--text-1); cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), opacity var(--dur-1) var(--ease);
}
.invite-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.invite-arrow:hover { border-color: var(--trail-500); background: rgba(0, 168, 107, 0.14); }
.invite-arrow:active { transform: scale(0.94); }
.invite-arrow[disabled] { opacity: 0.3; cursor: default; border-color: rgba(255, 255, 255, 0.14); background: transparent; }
.invite-arrow--next:not([disabled]) { border-color: rgba(0, 168, 107, 0.5); animation: invite-nudge 2.6s var(--ease) 1.2s infinite; }
[dir="rtl"] .invite-arrow svg { transform: scaleX(-1); }

.invite-trail { position: relative; min-width: 0; height: 32px; }
.invite-trail-line {
  position: absolute; inset-inline: 7px; top: 50%; height: 2px; margin-top: -1px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 6px, transparent 6px 12px);
  border-radius: 2px; overflow: hidden;
}
.invite-trail-fill {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--trail-700), var(--trail-400));
  box-shadow: 0 0 12px var(--trail-glow);
  transform-origin: left center; transform: scaleX(var(--invite-progress));
  transition: transform 700ms var(--ease);
}
[dir="rtl"] .invite-trail-fill { transform-origin: right center; }
.invite-trail-stops {
  position: relative; list-style: none; height: 100%;
  display: flex; justify-content: space-between; align-items: center;
}
.invite-trail-stops li { display: flex; }
.invite-stop {
  position: relative; width: 14px; height: 14px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.28); background: var(--ink-950);
  transition: transform var(--dur-2) var(--ease), background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.invite-stop::before { content: ''; position: absolute; inset: -9px; border-radius: 50%; }
.invite-stop:hover { border-color: var(--trail-400); transform: scale(1.25); }
.invite-stop.is-visited { border-color: var(--trail-500); background: var(--trail-500); }
.invite-stop.is-current {
  border-color: var(--waypoint); background: var(--waypoint); transform: scale(1.3);
  box-shadow: 0 0 0 0 rgba(255, 213, 79, 0.5); animation: invite-pulse 2s ease-out infinite;
}
.invite-hint {
  text-align: center; color: var(--text-3); font-size: 0.8rem; letter-spacing: 0.04em;
  padding: var(--space-2) var(--invite-pad) var(--space-4);
  padding-inline-end: max(var(--invite-pad), var(--invite-cta-room));
  transition: opacity var(--dur-3) var(--ease);
}
.invite.has-moved .invite-hint { opacity: 0; }

/* ----- Sticky CTA ----- */
.invite-cta {
  position: fixed; z-index: 60;
  inset-inline-end: max(24px, env(safe-area-inset-right, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  padding: 16px 28px; border-radius: 999px; font-size: 1.02rem; font-weight: 700;
}
.invite-cta-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--waypoint);
  box-shadow: 0 0 0 0 rgba(255, 213, 79, 0.6); animation: invite-pulse 2s ease-out infinite;
}
.invite-cta.is-final { animation: invite-glow 1.8s ease-in-out infinite; }

/* ----- Choreography (deck mode) -----
   Entering: step label, then the title word by word, then body, then media.
   Leaving: a short fade toward the opposite side. --invite-dir is 1 (next) or -1 (back). */
.invite { --invite-dir: 1; }
.invite-slide .d0, .invite-slide .d2, .invite-slide .d3 {
  opacity: 0; transform: translate3d(0, 26px, 0);
}
.invite-slide.is-active .d0, .invite-slide.is-active .d2, .invite-slide.is-active .d3 {
  opacity: 1; transform: none;
  transition: opacity 700ms var(--ease), transform 900ms var(--ease);
}
.invite-slide.is-active .d0 { transition-delay: 60ms; }
.invite-slide.is-active .d2 { transition-delay: 420ms; }
.invite-slide.is-active .d3 { transition-delay: 520ms; }

/* Title: split into words by the script; each rises out of its own mask. */
.invite-word { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.invite-word > span {
  display: inline-block; transform: translate3d(0, 105%, 0);
}
.invite-slide.is-active .invite-word > span {
  transform: none;
  transition: transform 820ms var(--ease);
  transition-delay: calc(140ms + var(--w, 0) * 38ms);
}
/* Before the script splits the title (and in static mode) it is simply visible. */
.invite-title:not(.is-split) { opacity: 1; }

.invite-slide .invite-media > * {
  opacity: 0;
  transform: translate3d(calc(var(--invite-dir) * 60px), 40px, 0) rotateY(calc(var(--invite-dir) * -14deg)) rotateX(8deg) scale(0.94);
}
.invite-slide.is-active .invite-media > * {
  opacity: 1; transform: none;
  transition: opacity 800ms var(--ease) 180ms, transform 1100ms var(--ease) 180ms;
}
.invite-slide.is-active .invite-device { animation: invite-float 7s ease-in-out 1.4s infinite; }
.invite-slide.is-active .invite-art-path { animation: invite-draw 1600ms var(--ease) 300ms both; }
.invite-slide.is-active .invite-art-pin { animation: invite-pin 1600ms var(--ease) both; }

.invite-slide.is-leaving { z-index: 0; }
.invite-slide.is-active { z-index: 1; }
.invite-slide.is-leaving .invite-copy,
.invite-slide.is-leaving .invite-media {
  opacity: 0; transform: translate3d(calc(var(--invite-dir) * -48px), 0, 0);
  transition: opacity 320ms ease, transform 420ms var(--ease);
}
/* Keep the leaving slide's children in their resting pose while the wrapper fades. */
.invite-slide.is-leaving .d0, .invite-slide.is-leaving .d2, .invite-slide.is-leaving .d3,
.invite-slide.is-leaving .invite-media > *, .invite-slide.is-leaving .invite-word > span {
  opacity: 1; transform: none; transition: none;
}

@keyframes invite-draw { from { stroke-dashoffset: 900; } to { stroke-dashoffset: 0; } }
@keyframes invite-pin { 0%, 70% { opacity: 0; transform: scale(0.4); transform-origin: center; transform-box: fill-box; } 100% { opacity: 1; transform: scale(1); transform-box: fill-box; transform-origin: center; } }
@keyframes invite-float { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -10px, 0); } }
@keyframes invite-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 213, 79, 0.55); } 100% { box-shadow: 0 0 0 12px rgba(255, 213, 79, 0); } }
@keyframes invite-nudge { 0%, 80%, 100% { transform: none; } 88% { transform: translateX(5px); } 94% { transform: translateX(-2px); } }
@keyframes invite-glow {
  0%, 100% { box-shadow: 0 0 30px var(--trail-glow), 0 4px 15px rgba(0, 0, 0, 0.3); }
  50% { box-shadow: 0 0 70px rgba(0, 168, 107, 0.7), 0 4px 15px rgba(0, 0, 0, 0.3); }
}

/* ----- Phone and narrow tablets: media on top, copy below ----- */
@media (max-width: 860px) {
  /* Slides share one grid cell, so the stage is as tall as the longest statement and the
     page scrolls normally; the trail stays pinned just above the CTA. */
  .invite { --invite-pad: 16px; height: auto; min-height: calc(100svh - 64px); padding-bottom: 76px; overflow: clip; }
  .invite-top { padding-top: var(--space-3); }
  .invite-stage { display: grid; }
  .invite-slide {
    position: relative; inset: auto; grid-area: 1 / 1;
    grid-template-columns: minmax(0, 1fr); grid-template-rows: clamp(150px, 25svh, 240px) auto;
    align-items: start; align-content: start; gap: var(--space-4);
    padding-block: var(--space-3);
  }
  .invite-bar {
    position: sticky; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 5;
    padding-block: var(--space-2); padding-inline-end: var(--invite-pad);
    background: linear-gradient(180deg, transparent, var(--ink-950) 35%);
  }
  .invite-media { order: -1; height: 100%; }
  /* The phone peeks out of the bottom edge: top of the screen only, fading out. */
  .invite-device { height: 100%; width: min(64vw, 250px); aspect-ratio: auto; border-width: 7px; border-bottom: 0; border-radius: 28px 28px 0 0; }
  .invite-media--phone { align-items: flex-start; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent); mask-image: linear-gradient(180deg, #000 78%, transparent); }
  .invite-art { height: 100%; width: auto; }
  .invite-badge { height: 100%; width: auto; }
  .invite-stat-value { font-size: clamp(4rem, 19vw, 6rem); }
  .invite-art-number { font-size: clamp(4.5rem, 22vw, 7rem); }
  .invite-title { font-size: clamp(1.65rem, 7vw, 2.3rem); margin-bottom: var(--space-3); }
  .invite-body, .invite-bullets { font-size: 1rem; line-height: 1.6; }
  .invite-step { margin-bottom: var(--space-2); }
  .invite-arrow { width: 40px; height: 40px; }
  .invite-stop { width: 10px; height: 10px; border-width: 2px; }
  .invite-cta {
    inset-inline: 16px; bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    justify-content: center; padding: 15px 20px;
  }
  .invite-hint { display: none; }
  body:has(.invite) footer { padding-bottom: 96px; }
}
@media (max-width: 860px) and (max-height: 700px) {
  .invite-slide { grid-template-rows: clamp(140px, 24svh, 200px) auto; }
}

@media (prefers-reduced-motion: reduce) {
  .invite-atlas, .invite-trail-fill { transition: none; }
  .invite-slide .d0, .invite-slide .d2, .invite-slide .d3,
  .invite-slide .invite-media > *, .invite-word > span { transform: none !important; }
  .invite-slide.is-active .d0, .invite-slide.is-active .d2, .invite-slide.is-active .d3,
  .invite-slide.is-active .invite-media > * { transition: opacity 300ms linear; transition-delay: 0ms; }
  .invite-slide.is-leaving .invite-copy, .invite-slide.is-leaving .invite-media { transform: none; transition: opacity 200ms linear; }
  .invite-slide.is-active .invite-device, .invite-slide.is-active .invite-art-path, .invite-slide.is-active .invite-art-pin,
  .invite-slide.is-active .invite-badge img,
  .invite-arrow--next:not([disabled]), .invite-stop.is-current, .invite-cta-dot, .invite-cta.is-final { animation: none; }
  .invite-zoom-img { transition: opacity 200ms linear; }
}
