/* ===== A1 CONNECT — How It Works Page =====
   Requires in <head>, in this order: base.css, header.css, how-it-works.css.
   Self-contained (does not require hero.css / product-hero.css / testimonials.css)
   — dark intro hero + light numbered step-by-step section below. */

:root {
  --hiw-black: #060606;
  --hiw-black-soft: #121212;
}

/* Intro hero */
.how-it-works-hero {
  position: relative;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(59,130,246,0.22), transparent 60%),
    radial-gradient(700px 400px at 5% 110%, rgba(59,130,246,0.1), transparent 60%),
    linear-gradient(180deg, var(--hiw-black) 0%, var(--hiw-black-soft) 100%);
  color: #ffffff;
  padding: 96px 0 80px;
  overflow: hidden;
  text-align: center;
}
.how-it-works-hero .eyebrow {
  color: var(--gold-light); background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.4);
}
.how-it-works-hero h1 {
  font-family: "Sora", "Inter", sans-serif;
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.1;
  font-size: clamp(2.2rem, 4.4vw, 3.4rem);
  margin: 0 auto 18px; max-width: 760px;
  background: linear-gradient(100deg, #ffffff 0%, #cfe0ff 22%, #8fb8ff 45%, #ffffff 65%, #cfe0ff 85%, #8fb8ff 100%);
  background-size: 250% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 42px rgba(59,130,246,0.28);
  animation: howItWorksGradientMove 7s ease-in-out infinite;
}
@keyframes howItWorksGradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.how-it-works-hero p.lead {
  color: rgba(255,255,255,0.68); font-size: 1.05rem; line-height: 1.7;
  max-width: 600px; margin: 0 auto;
}

/* Steps section */
.steps-section { background: #ffffff; }

.step-list {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}
.step-list::before {
  content: "";
  position: absolute;
  left: 27px;
  top: 28px;
  bottom: 28px;
  width: 2px;
  background: var(--gray-100);
  z-index: 0;
}

/* Animated progress line — a blue overlay on top of the grey base line that
   grows downward in sync with whichever step-number is currently lit up
   below, then resets and sweeps down again on a continuous loop. */
.step-list::after {
  content: "";
  position: absolute;
  left: 27px;
  top: 28px;
  bottom: 28px;
  width: 2px;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
  transform-origin: top;
  transform: scaleY(0);
  z-index: 0;
  animation: stepLineProgress 6s ease-in-out infinite;
}
@keyframes stepLineProgress {
  0%        { transform: scaleY(0); }
  9%, 20%   { transform: scaleY(0.05); }
  29%, 40%  { transform: scaleY(0.3); }
  49%, 60%  { transform: scaleY(0.55); }
  69%, 80%  { transform: scaleY(0.8); }
  89%, 98%  { transform: scaleY(1); }
  100%      { transform: scaleY(0); }
}

.step {
  display: flex;
  gap: 26px;
  position: relative;
  z-index: 1;
  padding-bottom: 44px;
}
.step:last-child { padding-bottom: 0; }

.step-number {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #eaf2ff, #d7e6ff);
  color: var(--gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Sora", "Inter", sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  box-shadow: 0 6px 16px rgba(59,130,246,0.18);
}

/* Step numbers light up one at a time, top to bottom, on a continuous loop
   — each on the same 6s cycle so the highlight travels down the timeline
   in step with the progress line above. */
.step:nth-child(1) .step-number { animation: stepActive1 6s ease-in-out infinite; }
.step:nth-child(2) .step-number { animation: stepActive2 6s ease-in-out infinite; }
.step:nth-child(3) .step-number { animation: stepActive3 6s ease-in-out infinite; }
.step:nth-child(4) .step-number { animation: stepActive4 6s ease-in-out infinite; }
.step:nth-child(5) .step-number { animation: stepActive5 6s ease-in-out infinite; }

@keyframes stepActive1 {
  0%, 20%, 100% {
    background: linear-gradient(135deg, #eaf2ff, #d7e6ff); color: var(--gold-dark);
    box-shadow: 0 6px 16px rgba(59,130,246,0.18); transform: scale(1);
  }
  4%, 14% {
    background: linear-gradient(135deg, #5b9dff, var(--gold-dark) 60%, #0b2560); color: #ffffff;
    box-shadow: 0 10px 28px rgba(29,78,216,0.45); transform: scale(1.1);
  }
}
@keyframes stepActive2 {
  0%, 20%, 40%, 100% {
    background: linear-gradient(135deg, #eaf2ff, #d7e6ff); color: var(--gold-dark);
    box-shadow: 0 6px 16px rgba(59,130,246,0.18); transform: scale(1);
  }
  24%, 34% {
    background: linear-gradient(135deg, #5b9dff, var(--gold-dark) 60%, #0b2560); color: #ffffff;
    box-shadow: 0 10px 28px rgba(29,78,216,0.45); transform: scale(1.1);
  }
}
@keyframes stepActive3 {
  0%, 40%, 60%, 100% {
    background: linear-gradient(135deg, #eaf2ff, #d7e6ff); color: var(--gold-dark);
    box-shadow: 0 6px 16px rgba(59,130,246,0.18); transform: scale(1);
  }
  44%, 54% {
    background: linear-gradient(135deg, #5b9dff, var(--gold-dark) 60%, #0b2560); color: #ffffff;
    box-shadow: 0 10px 28px rgba(29,78,216,0.45); transform: scale(1.1);
  }
}
@keyframes stepActive4 {
  0%, 60%, 80%, 100% {
    background: linear-gradient(135deg, #eaf2ff, #d7e6ff); color: var(--gold-dark);
    box-shadow: 0 6px 16px rgba(59,130,246,0.18); transform: scale(1);
  }
  64%, 74% {
    background: linear-gradient(135deg, #5b9dff, var(--gold-dark) 60%, #0b2560); color: #ffffff;
    box-shadow: 0 10px 28px rgba(29,78,216,0.45); transform: scale(1.1);
  }
}
@keyframes stepActive5 {
  0%, 80%, 100% {
    background: linear-gradient(135deg, #eaf2ff, #d7e6ff); color: var(--gold-dark);
    box-shadow: 0 6px 16px rgba(59,130,246,0.18); transform: scale(1);
  }
  84%, 94% {
    background: linear-gradient(135deg, #5b9dff, var(--gold-dark) 60%, #0b2560); color: #ffffff;
    box-shadow: 0 10px 28px rgba(29,78,216,0.45); transform: scale(1.1);
  }
}

.step-content { padding-top: 6px; }
.step-content h3 { margin: 0 0 8px; color: var(--gray-800); }
.step-content p { margin: 0; }

/* "Watch It Happen" — animated demo: phone + pulsing NFC tap rings +
   a "Review posted!" toast that fades in above, looping continuously. */
.demo-section { background: var(--gray-50); text-align: center; overflow: hidden; }
.demo-section h2 {
  background: linear-gradient(100deg, #0b2560 0%, #1d4ed8 45%, #3b82f6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.demo-section p.lead { max-width: 480px; margin: 0 auto; }

.demo-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 56px;
  margin: 76px auto 20px;
}

.phone-mockup {
  width: 150px;
  aspect-ratio: 9 / 18;
  position: relative;
  filter: drop-shadow(0 24px 40px rgba(0,0,0,0.22));
  animation: phoneTapMove 8s ease-in-out infinite;
}

/* Realistic front face (screen + notch), like a real iPhone mockup.
   The phone stays front-facing the whole time — it taps the ring with its
   flat front (screen) rather than flipping to show an edge or the back. */
.phone-face-front {
  position: absolute; inset: 0;
  background: #ffffff;
  border: 3px solid #1a1a1a;
  border-radius: 26px;
  overflow: hidden;
}
.phone-notch {
  position: absolute; top: 4%; left: 50%; transform: translateX(-50%);
  width: 26%; height: 4%;
  background: #0c0c0c; border-radius: 999px;
  z-index: 2;
}

/* Back face kept in the markup for potential reuse, but hidden — the tap
   animation below only ever shows the front face now. */
.phone-face-back { display: none; }

/* The Google-review-form screen — a full mini "flow": fades in blank (no
   stars picked yet) right as the phone taps the ring, the 5 stars fill in
   one by one, a Submit button appears and gets "pressed", then the whole
   form fades out as the "Review posted!" toast appears above the phone. */
.review-form-screen {
  position: absolute;
  top: 13%; left: 9%; right: 9%; bottom: 7%;
  display: flex;
  flex-direction: column;
  gap: 4%;
  text-align: left;
  opacity: 0;
  animation: reviewScreenShow 8s ease-in-out infinite;
}
@keyframes reviewScreenShow {
  0%, 20%   { opacity: 0; }
  25%, 70%  { opacity: 1; }
  76%, 100% { opacity: 0; }
}

.rf-header { display: flex; align-items: center; gap: 4px; }
.rf-avatar {
  width: 12px; height: 12px; border-radius: 50%;
  background: #dde1e8; flex-shrink: 0;
}
.rf-bar { flex: 1; height: 5px; border-radius: 3px; background: #2c2c2c; }
.rf-posting { font-size: 5px; color: #9aa0aa; margin-left: 16px; margin-top: -3px; }

/* Main 5-star rating — starts empty, fills in one star at a time as if the
   customer taps once and all 5 fill together, not one at a time. */
.rf-stars-big {
  display: flex;
  justify-content: center;
  gap: 3px;
  font-size: 13px;
}
.rf-star { color: #d3d6db; animation: starFillAll 8s steps(1) infinite; }
@keyframes starFillAll { 0%, 27%  { color: #d3d6db; } 28%, 100% { color: #f5b400; } }

.rf-row { display: flex; align-items: center; justify-content: space-between; }
.rf-row span:first-child { font-size: 6px; color: #1a1a1a; font-weight: 700; }
.rf-stars-sm { color: #d3d6db; font-size: 6.5px; letter-spacing: 1px; animation: starFillAll 8s steps(1) infinite; }

.rf-box {
  flex: 1;
  min-height: 14%;
  border: 1px solid #dde1e8;
  border-radius: 5px;
}

/* Submit button — hidden until all 5 stars are filled, fades in, then gets
   a quick "press" (scale dip + colour flash) right before the toast pops. */
.rf-submit {
  align-self: center;
  margin-top: 1px;
  padding: 4px 16px;
  border-radius: 999px;
  border: none;
  font-family: "Inter", sans-serif;
  font-size: 6.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #ffffff;
  background: linear-gradient(135deg, #5b9dff, var(--gold-dark));
  opacity: 0;
  transform: scale(0.9);
  animation: submitBtnAnim 8s ease-in-out infinite;
}
@keyframes submitBtnAnim {
  0%, 52%   { opacity: 0; transform: scale(0.9); }
  58%, 61%  { opacity: 1; transform: scale(1); }
  64%       { opacity: 1; transform: scale(0.88); background: linear-gradient(135deg, #3b7de0, #0b2560); }
  68%, 74%  { opacity: 1; transform: scale(1); background: linear-gradient(135deg, #5b9dff, var(--gold-dark)); }
  80%, 100% { opacity: 0; transform: scale(0.9); }
}

/* Phone drifts right (no rotation — front face stays flat, facing the
   rings), taps them, holds near the ring while the review form is filled
   out and submitted, then returns home — synced to the ring ripple, the
   star fills, the submit press, and the toast below (all share one 8s
   cycle). */
@keyframes phoneTapMove {
  0%, 8%    { transform: translateX(0); }
  17%       { transform: translateX(52px); }
  22%       { transform: translateX(58px); } /* contact */
  27%, 78%  { transform: translateX(52px); } /* held near the ring while the form is filled in */
  88%, 100% { transform: translateX(0); }
}

.tap-rings {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.tap-rings span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--gold-dark);
  opacity: 0;
  animation: tapRingPulse 8s ease-out infinite;
}
.tap-rings span:nth-child(2) { animation-delay: 0.15s; }
.tap-rings span:nth-child(3) { animation-delay: 0.3s; }
@keyframes tapRingPulse {
  0%, 21%   { transform: scale(0.4); opacity: 0; }
  24%       { transform: scale(0.5); opacity: 0.95; } /* ripple starts right as the phone taps */
  34%       { opacity: 0.2; }
  42%, 100% { transform: scale(1.7); opacity: 0; }
}

.review-toast {
  position: absolute;
  top: -54px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #ffffff;
  border-radius: 999px;
  padding: 14px 26px;
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--gray-800);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: toastFade 8s ease-in-out infinite;
}
.review-toast .toast-stars { color: #EDAB3B; letter-spacing: 1px; }
@keyframes toastFade {
  0%, 66%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
  72%, 92%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  98%, 100% { opacity: 0; transform: translateX(-50%) translateY(-6px); }
}

@media (max-width: 480px) {
  .demo-visual { gap: 30px; margin-top: 66px; }
  .tap-rings { width: 90px; height: 90px; }
  .review-toast { font-size: 0.82rem; padding: 11px 18px; top: -46px; }
}

/* "The Technology" — NFC explainer */
.tech-section {
  position: relative;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(59,130,246,0.22), transparent 60%),
    radial-gradient(700px 400px at 5% 110%, rgba(59,130,246,0.1), transparent 60%),
    linear-gradient(180deg, var(--hiw-black) 0%, var(--hiw-black-soft) 100%);
  color: #ffffff;
  overflow: hidden;
  text-align: center;
}
.tech-section .eyebrow {
  color: var(--gold-light); background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.4);
}
.tech-section h2 { color: #ffffff; background: none; -webkit-background-clip: initial; background-clip: initial; }
.tech-section p { color: rgba(255,255,255,0.68); }

/* "Compatibility" section */
.compat-section { background: var(--gray-50); }
.compat-section h2 {
  background: linear-gradient(100deg, #0b2560 0%, #1d4ed8 45%, #3b82f6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.compat-tags {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 8px;
}
.compat-tags span {
  display: inline-flex; align-items: center; gap: 8px;
  background: #eaf2ff; color: var(--gold-dark); font-weight: 700; font-size: 0.92rem;
  padding: 11px 22px; border-radius: 999px; border: 1px solid rgba(59, 130, 246, 0.18);
}
.compat-tags svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Closing CTA */
.how-it-works-cta {
  position: relative;
  background: linear-gradient(180deg, var(--hiw-black) 0%, var(--hiw-black-soft) 100%);
  color: #ffffff; text-align: center; overflow: hidden;
}
.how-it-works-cta h2 {
  color: #ffffff; max-width: 640px; margin: 0 auto 14px;
}
.how-it-works-cta p.lead { color: rgba(255,255,255,0.68); max-width: 480px; margin: 0 auto 32px; }

@media (max-width: 560px) {
  .how-it-works-hero { padding: 64px 0 56px; }
  .step-list::before { left: 23px; }
  .step { gap: 18px; }
  .step-number { width: 48px; height: 48px; font-size: 1.15rem; }
}
