/**
 * Homepage signature experience (Phase 3).
 * Additive polish only — preserves existing cyclers, counters, video, typewriter.
 */

/* —— Hero cinematic entrance —— */
html.js body[data-page="home"] .hero {
  --hero-sig-ease: var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1));
}

html.js body[data-page="home"] .hero__fade {
  opacity: 0;
  animation: hero-sig-fade-in 700ms var(--hero-sig-ease) 120ms forwards;
}

html.js body[data-page="home"] .hero__badge {
  opacity: 0;
  transform: translateY(10px);
  animation: hero-sig-rise 560ms var(--hero-sig-ease) 280ms forwards;
}

html.js body[data-page="home"] .hero .kicker--light {
  opacity: 0;
  transform: translateY(10px);
  animation: hero-sig-rise 560ms var(--hero-sig-ease) 380ms forwards;
}

html.js body[data-page="home"] .hero__actions .btn--primary {
  transition:
    transform var(--motion-duration-fast, 200ms) var(--hero-sig-ease),
    box-shadow var(--motion-duration-normal, 420ms) var(--hero-sig-ease),
    background-color var(--motion-duration-fast, 200ms) ease;
}

html.js body[data-page="home"] .hero__actions .btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -12px rgba(255, 92, 0, 0.55);
}

html.js body[data-page="home"] .hero__actions .btn--primary:active {
  transform: translateY(1px);
}

html.js body[data-page="home"] .hero__how {
  transition: opacity 200ms ease, transform 200ms var(--hero-sig-ease);
}

html.js body[data-page="home"] .hero__how:hover .hero__how-play {
  transform: translateX(3px);
}

html.js body[data-page="home"] .hero__how-play {
  display: inline-grid;
  place-items: center;
  transition: transform 200ms var(--hero-sig-ease);
}

/* Scroll cue */
.hero__scroll-cue {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 4;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
}

.hero.is-copy-done .hero__scroll-cue {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 500ms var(--hero-sig-ease) 200ms;
}

.hero__scroll-cue-track {
  position: relative;
  width: 1px;
  height: 36px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.hero__scroll-cue-dot {
  position: absolute;
  left: 50%;
  top: 0;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: #ff5c00;
  animation: hero-sig-scroll-dot 1.6s var(--hero-sig-ease) infinite;
}

/* Hero exit continuity */
html.js body[data-page="home"] .hero.is-hero-leaving .hero__shell {
  opacity: 0.82;
  transform: translateY(-12px);
  transition:
    opacity 420ms var(--hero-sig-ease),
    transform 420ms var(--hero-sig-ease);
}

html.js body[data-page="home"] .hero.is-hero-leaving .hero__media {
  /* parallax JS still owns transform; soften via filter only */
  filter: brightness(0.92);
  transition: filter 420ms ease;
}

@keyframes hero-sig-fade-in {
  to { opacity: 1; }
}

@keyframes hero-sig-rise {
  to { opacity: 1; transform: none; }
}

@keyframes hero-sig-scroll-dot {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(28px); opacity: 0; }
}

/* —— Stats: label delay + orange accent —— */
html.js body[data-page="home"] #credibility .glance__stat .cred-stat__label,
html.js body[data-page="home"] #credibility .credibility__stat-card .cred-stat__label {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 480ms var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1)) 180ms,
    transform 480ms var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1)) 180ms;
}

html.js body[data-page="home"] #credibility .glance__stat.is-home-revealed .cred-stat__label,
html.js body[data-page="home"] #credibility .credibility__stat-card.is-home-revealed .cred-stat__label,
html.js body[data-page="home"] #credibility .glance.is-inview .glance__stat .cred-stat__label {
  opacity: 1;
  transform: none;
}

/* Unified metrics band — no per-card orange rail (keeps institutional calm) */
html.js body[data-page="home"] #credibility .glance__stat::before,
html.js body[data-page="home"] #credibility .credibility__stat-card::before {
  content: none;
}

/* —— Partners / logos: quiet stagger feel —— */
html.js body[data-page="home"] #credibility .credibility__logo-chip {
  transition: transform 280ms var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1)), opacity 280ms ease;
}

/* —— Why: smoother active panel —— */
html.js body[data-page="home"] #why .why__panel {
  transition: max-height 0.42s var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1)), opacity 0.34s ease 0.04s;
}

html.js body[data-page="home"] #why .why__item.is-active .why__title {
  transition: color 280ms ease;
}

/* —— Protection caps —— */
html.js body[data-page="home"] #protection .caps__tabs [role="tab"] {
  transition:
    border-color 240ms ease,
    background-color 240ms ease,
    transform 240ms var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1));
}

@media (hover: hover) and (pointer: fine) {
  html.js body[data-page="home"] #protection .caps__tabs [role="tab"]:hover {
    transform: translateX(3px);
  }

  html.js body[data-page="home"] #protection .cap__media:hover img {
    transform: scale(1.04);
  }
}

@media (max-width: 1099px) {
  html.js body[data-page="home"] #protection .caps__tabs [role="tab"]:hover {
    transform: none;
  }
}

/* —— Rescue journey fill —— */
html.js body[data-page="home"] #rescue-journey .journey-stepper__fill {
  transition: height 0.55s var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1)),
    width 0.55s var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1));
}

html.js body[data-page="home"] #rescue-journey .journey__content {
  transition: opacity 0.35s ease, transform 0.4s var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1));
}

/* —— Field stories —— */
html.js body[data-page="home"] #field-stories .field-stories__media {
  overflow: hidden;
}

html.js body[data-page="home"] #field-stories .field-stories__media img {
  transition: transform 700ms var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1));
}

html.js body[data-page="home"] #field-stories .field-stories__panel.is-switching .field-stories__media img {
  transform: scale(1.03);
}

/* —— Stories —— */
@media (hover: hover) and (pointer: fine) {
  html.js body[data-page="home"] .stories__grid .story-feature:hover .story-feature__img img,
  html.js body[data-page="home"] .stories__grid .story-list li:hover img {
    transform: scale(1.035);
  }
}

/* —— Final CTA —— */
html.js body[data-page="home"] .final__copy.reveal:not(.is-visible),
html.js body[data-page="home"] .final__copy[data-home-reveal]:not(.is-home-revealed) {
  opacity: 0;
  transform: translateY(24px);
}

html.js body[data-page="home"] .final__img img {
  transition: transform 900ms var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1));
}

html.js body[data-page="home"] .final__img.is-home-revealed img {
  transform: scale(1);
}

html.js body[data-page="home"] .final__img:not(.is-home-revealed) img {
  transform: scale(1.06);
}

@media (hover: hover) and (pointer: fine) {
  html.js body[data-page="home"] .final .btn--primary:hover {
    transform: translateY(-2px);
  }

  html.js body[data-page="home"] .final .link-arrow:hover::after {
    width: 30px;
  }
}

/* —— Signature: Adventure Journey Progress —— */
.asc-journey-rail {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  top: 50%;
  z-index: 40;
  transform: translateY(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 10px 8px;
  border-radius: 999px;
  background: rgba(11, 27, 46, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

@media (min-width: 1100px) {
  body[data-page="home"] .asc-journey-rail.is-active {
    display: flex;
    pointer-events: auto;
  }
}

.asc-journey-rail__track {
  position: relative;
  width: 2px;
  height: 140px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  overflow: hidden;
}

.asc-journey-rail__fill {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, #ff8a3d, #ff5c00);
  border-radius: inherit;
  transition: height 380ms var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1));
}

.asc-journey-rail__dots {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.asc-journey-rail__dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: transparent;
  cursor: pointer;
}

.asc-journey-rail__dots button.is-active {
  background: #ff5c00;
  border-color: #ff5c00;
  box-shadow: 0 0 0 3px rgba(255, 92, 0, 0.25);
}

.asc-journey-rail__label {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.asc-journey-rail:hover .asc-journey-rail__label,
.asc-journey-rail:focus-within .asc-journey-rail__label {
  opacity: 1;
}

/* Mobile refinements */
html.js body[data-page="home"] .final__copy {
  transition:
    opacity var(--motion-duration-reveal, 820ms) var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1)),
    transform var(--motion-duration-reveal, 820ms) var(--motion-ease-standard, cubic-bezier(0.22, 1, 0.36, 1));
}

@media (max-width: 899px) {
  .hero__scroll-cue { display: none; }

  html.js body[data-page="home"] .hero.is-hero-leaving .hero__shell {
    transform: none;
    opacity: 1;
  }

  html.js body[data-page="home"] #credibility .glance__stat::before,
  html.js body[data-page="home"] #credibility .credibility__stat-card::before {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.js body[data-page="home"] .hero__fade,
  html.js body[data-page="home"] .hero__badge,
  html.js body[data-page="home"] .hero .kicker--light {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .hero__scroll-cue-dot { animation: none !important; top: 14px; opacity: 0.85; }

  html.js body[data-page="home"] .hero.is-hero-leaving .hero__shell {
    opacity: 1 !important;
    transform: none !important;
  }

  .asc-journey-rail { display: none !important; }
}

html[data-asc-motion="full"] body[data-page="home"] .hero__fade {
  /* keep cinematic entrance when QA forces full motion even if OS prefers reduce */
}
