/* ============================================================
   RipRift — Nav + Hero (hero.css)
   Namespaced: .nav, .hero, .hp-* (hero pack animation)
   Relies on base.css tokens & components. No base redefinitions.
   ============================================================ */

/* ---------------- NAV ---------------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  transition: background 0.3s var(--ease), backdrop-filter 0.3s var(--ease),
              border-color 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(5, 9, 11, 0.75);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom-color: var(--border);
}
.nav-inner {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.4vw, 34px);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.2vw, 32px);
}
.nav-links a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color 0.2s var(--ease);
}
.nav-links a:hover { color: var(--text); }

@media (max-width: 640px) {
  .nav-links { display: none; }
}

/* ---------------- HERO ---------------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: calc(var(--nav-h) + 24px);
  padding-bottom: clamp(48px, 7vw, 96px);
  overflow: hidden;
}

/* Ambient backdrop (glow, rings, sparks) */
.hero-ambient { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero-glow-main {
  position: absolute;
  top: 42%; right: 6%;
  width: min(760px, 70vw); aspect-ratio: 1;
  transform: translateY(-50%);
  background: radial-gradient(circle, rgba(3, 54, 81, 0.75), transparent 60%);
  filter: blur(24px);
}
.hero-ring {
  position: absolute;
  top: 42%; right: 22%;
  transform: translate(50%, -50%);
  border: 1px solid rgba(63, 193, 232, 0.10);
  border-radius: 50%;
}
.hero-ring-1 { width: 420px; height: 420px; }
.hero-ring-2 { width: 620px; height: 620px; border-color: rgba(63, 193, 232, 0.06); }
.hero-spark {
  position: absolute;
  width: 3px; height: 3px; border-radius: 50%;
  background: rgba(127, 212, 234, 0.8);
  box-shadow: 0 0 8px rgba(127, 212, 234, 0.8);
  opacity: 0.5;
  animation: hp-spark 6s var(--ease) infinite;
}
.hero-spark.s1 { top: 30%; right: 40%; animation-delay: 0s; }
.hero-spark.s2 { top: 58%; right: 18%; animation-delay: 1.4s; }
.hero-spark.s3 { top: 24%; right: 14%; animation-delay: 2.7s; }
.hero-spark.s4 { top: 66%; right: 44%; animation-delay: 3.9s; }
@keyframes hp-spark {
  0%, 100% { opacity: 0; transform: translateY(0) scale(0.6); }
  50% { opacity: 0.7; transform: translateY(-10px) scale(1); }
}

/* Grid */
.hero-grid {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr);
  grid-template-rows: auto auto;
  grid-template-areas:
    "copy   visual"
    "badges visual";
  align-items: center;
  column-gap: clamp(32px, 5vw, 76px);
  row-gap: 26px;
}
.hero-copy { grid-area: copy; max-width: 560px; }
.hero-badges { grid-area: badges; align-self: start; }
.hero-visual { grid-area: visual; align-self: center; }

.hero h1 {
  font-size: clamp(44px, 6.2vw, 80px);
  font-weight: 650;
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 22px;
}
.hero-accent {
  background: linear-gradient(120deg, #5FD4E8 0%, #3FC1E8 40%, #075573 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 42px rgba(63, 193, 232, 0.35);
}
.hero .lead { max-width: 494px; }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 34px;
}
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.hero-badges .store-badge { min-width: 168px; }

/* ---- Visual stage ---- */
.hero-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 540px;
}
.hero-floor {
  position: absolute;
  bottom: 4%; left: 50%;
  width: 78%; height: 130px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(7, 85, 115, 0.5), transparent 68%);
  filter: blur(26px);
  pointer-events: none;
}
.hero-phone-wrap {
  position: relative;
  z-index: 2;
  will-change: transform;
}
.hero .phone {
  width: clamp(248px, 25vw, 320px);
  transform: perspective(1300px) rotateY(-9deg) rotateX(4deg);
  transition: transform 0.5s var(--ease);
}

/* Floating cards around the phone (wrapper=parallax, inner=float, card=tilt) */
.hero-float {
  position: absolute;
  z-index: 3;
  width: clamp(96px, 10.5vw, 140px);
  will-change: transform;
}
.hero-float-inner { animation: float-y var(--fdur, 7s) var(--ease) infinite; animation-delay: var(--fdelay, 0s); }
.hero-float .rc-card { width: 100%; }
.hero-float-1 { top: 2%; left: -6%; --fdur: 7.5s; --fdelay: 0s; transform: none; }
.hero-float-1 .rc-card { transform: rotate(-9deg); }
.hero-float-2 { top: 40%; right: -9%; --fdur: 8.5s; --fdelay: 0.8s; }
.hero-float-2 .rc-card { transform: rotate(7deg); }
.hero-float-3 { bottom: 4%; left: 0%; --fdur: 6.8s; --fdelay: 1.6s; }
.hero-float-3 .rc-card { transform: rotate(-5deg); }

/* ============================================================
   HERO PACK-OPENING LOOP  (inside .phone-screen)
   10s master timeline; every element shares 10s duration so
   percentages stay in sync. 0% and 100% match (sealed pack).
   ============================================================ */
.hero-anim {
  position: absolute;
  inset: 0;
  overflow: hidden;
  perspective: 900px;
  background:
    radial-gradient(120% 80% at 50% 6%, rgba(10, 40, 56, 0.7), transparent 60%),
    radial-gradient(100% 60% at 50% 108%, rgba(7, 85, 115, 0.25), transparent 70%);
}
.hero-anim .rc-card { box-shadow: 0 10px 26px -10px rgba(0,0,0,.7); }
.hero-anim .rc-card::before { inset: 4px; }

/* App status bar */
.hp-status {
  position: absolute;
  top: 16px; left: 0; right: 0;
  z-index: 8;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  font-family: var(--font-display);
  font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(169, 184, 189, 0.55);
}
.hp-status .hp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal-bright); box-shadow: 0 0 8px var(--teal-bright); }

/* central anchor helpers — everything centers on 50%/54% */
.hp-pack, .hp-half, .hp-burst, .hp-card, .hp-rare, .hp-rare-glow {
  position: absolute;
  left: 50%; top: 54%;
}

/* Sealed pack */
.hero-anim .booster.hp-pack {
  width: 46%;
  margin: 0;
  transform: translate(-50%, -50%);
  animation: hp-pack 10s var(--ease) infinite;
  z-index: 4;
}
@keyframes hp-pack {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  8%   { opacity: 1; transform: translate(-50%, -54%) scale(1.02) rotate(-1.2deg); }
  16%  { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(1deg); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05) rotate(0deg); }
  27%  { opacity: 1; transform: translate(-50%, -50%) scale(1.02) rotate(0deg); }
  31%  { opacity: 0; transform: translate(-50%, -50%) scale(0.92) rotate(0deg); }
  90%  { opacity: 0; transform: translate(-50%, -50%) scale(0.92) rotate(0deg); }
  96%  { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

/* Tearing halves — each shows one half of the real pack artwork, so the two
   pieces read as the pack the animation just tore apart. */
.hp-half {
  width: 46%;
  aspect-ratio: var(--pack-ar-half);
  z-index: 5;
  background-image: var(--pack-src);
  background-repeat: no-repeat;
  background-size: 100% 200%;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.75));
  opacity: 0;
}
.hp-half-top { background-position: top center; animation: hp-half-top 10s var(--ease) infinite; }
.hp-half-bottom { background-position: bottom center; animation: hp-half-bottom 10s var(--ease) infinite; }

@keyframes hp-half-top {
  0%, 18% { opacity: 0; transform: translate(-50%, -100%) rotate(0deg); }
  22%     { opacity: 1; transform: translate(-50%, -102%) rotate(-3deg); }
  34%     { opacity: 1; transform: translate(-96%, -196%) rotate(-24deg); }
  44%     { opacity: 0; transform: translate(-118%, -244%) rotate(-30deg); }
  100%    { opacity: 0; transform: translate(-50%, -100%) rotate(0deg); }
}
@keyframes hp-half-bottom {
  0%, 18% { opacity: 0; transform: translate(-50%, 0%) rotate(0deg); }
  22%     { opacity: 1; transform: translate(-50%, 2%) rotate(3deg); }
  34%     { opacity: 1; transform: translate(-4%, 96%) rotate(22deg); }
  44%     { opacity: 0; transform: translate(18%, 140%) rotate(28deg); }
  100%    { opacity: 0; transform: translate(-50%, 0%) rotate(0deg); }
}

/* Energy burst from inside pack */
.hp-burst {
  width: 62%; aspect-ratio: 1;
  z-index: 3;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(127, 212, 234, 0.9) 0%, rgba(7, 85, 115, 0.5) 34%, transparent 66%);
  filter: blur(2px);
  opacity: 0;
  animation: hp-burst 10s var(--ease) infinite;
}
@keyframes hp-burst {
  0%, 17% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  24%     { opacity: 0.95; transform: translate(-50%, -50%) scale(1); }
  33%     { opacity: 0; transform: translate(-50%, -50%) scale(1.7); }
  100%    { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
}

/* Rising common cards */
.hero-anim .rc-card.hp-card { width: 32%; z-index: 6; opacity: 0; }
.hp-c1 { animation: hp-c1 10s var(--ease) infinite; }
.hp-c2 { animation: hp-c2 10s var(--ease) infinite; }
.hp-c3 { animation: hp-c3 10s var(--ease) infinite; }
@keyframes hp-c1 {
  0%, 30% { opacity: 0; transform: translate(-50%, -40%) scale(0.6) rotate(0deg); }
  38%     { opacity: 1; transform: translate(-118%, -112%) scale(0.92) rotate(-9deg); }
  52%     { opacity: 1; transform: translate(-118%, -116%) scale(0.92) rotate(-9deg); }
  60%     { opacity: 0; transform: translate(-124%, -138%) scale(0.88) rotate(-11deg); }
  100%    { opacity: 0; transform: translate(-50%, -40%) scale(0.6) rotate(0deg); }
}
@keyframes hp-c2 {
  0%, 33% { opacity: 0; transform: translate(-50%, -40%) scale(0.6) rotate(0deg); }
  41%     { opacity: 1; transform: translate(-50%, -128%) scale(0.98) rotate(0deg); }
  54%     { opacity: 1; transform: translate(-50%, -132%) scale(0.98) rotate(0deg); }
  61%     { opacity: 0; transform: translate(-50%, -154%) scale(0.94) rotate(0deg); }
  100%    { opacity: 0; transform: translate(-50%, -40%) scale(0.6) rotate(0deg); }
}
@keyframes hp-c3 {
  0%, 36% { opacity: 0; transform: translate(-50%, -40%) scale(0.6) rotate(0deg); }
  44%     { opacity: 1; transform: translate(18%, -112%) scale(0.92) rotate(9deg); }
  56%     { opacity: 1; transform: translate(18%, -116%) scale(0.92) rotate(9deg); }
  63%     { opacity: 0; transform: translate(24%, -138%) scale(0.88) rotate(11deg); }
  100%    { opacity: 0; transform: translate(-50%, -40%) scale(0.6) rotate(0deg); }
}

/* Rare card — slow, dramatic flip */
.hp-rare-glow {
  width: 58%; aspect-ratio: 1; z-index: 6;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(63, 193, 232, 0.85), rgba(7, 85, 115, 0.4) 40%, transparent 68%);
  filter: blur(6px);
  opacity: 0;
  animation: hp-rare-glow 10s var(--ease) infinite;
}
@keyframes hp-rare-glow {
  0%, 55% { opacity: 0; transform: translate(-50%, -78%) scale(0.6); }
  70%     { opacity: 0.65; transform: translate(-50%, -78%) scale(1.05); }
  83%     { opacity: 1; transform: translate(-50%, -78%) scale(1.4); }
  90%     { opacity: 0; transform: translate(-50%, -78%) scale(1.55); }
  100%    { opacity: 0; transform: translate(-50%, -78%) scale(0.6); }
}
.hp-rare {
  width: 40%;
  z-index: 7;
  opacity: 0;
  transform-style: preserve-3d;
  animation: hp-rare-pos 10s var(--ease) infinite;
}
@keyframes hp-rare-pos {
  0%, 52% { opacity: 0; transform: translate(-50%, -20%) scale(0.5); }
  60%     { opacity: 1; transform: translate(-50%, -118%) scale(1); }
  86%     { opacity: 1; transform: translate(-50%, -122%) scale(1.05); }
  92%     { opacity: 0; transform: translate(-50%, -124%) scale(1.05); }
  100%    { opacity: 0; transform: translate(-50%, -20%) scale(0.5); }
}
.hp-rare-inner {
  position: relative;
  width: 100%;
  aspect-ratio: 63 / 88;
  transform-style: preserve-3d;
  animation: hp-rare-flip 10s var(--ease) infinite;
}
@keyframes hp-rare-flip {
  0%, 74% { transform: rotateY(0deg); }
  85%     { transform: rotateY(180deg); }
  100%    { transform: rotateY(180deg); }
}
.hp-face {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.hp-face-front { transform: rotateY(180deg); }

/* Reveal light burst */
.hp-flash {
  position: absolute; inset: 0; z-index: 9;
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.9), rgba(127, 212, 234, 0.5) 30%, transparent 62%);
  opacity: 0;
  pointer-events: none;
  animation: hp-flash 10s var(--ease) infinite;
}
@keyframes hp-flash {
  0%, 80% { opacity: 0; }
  85%     { opacity: 0.85; }
  91%     { opacity: 0; }
  100%    { opacity: 0; }
}

/* Pause loop when tab hidden (set by hero-loop.js) */
.hero-anim.is-paused * { animation-play-state: paused !important; }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 980px) {
  .hero-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "copy" "visual" "badges";
    row-gap: 30px;
    justify-items: center;
    text-align: center;
  }
  .hero-copy { max-width: 620px; }
  .hero .lead { margin-inline: auto; }
  .hero-cta { justify-content: center; }
  .hero-badges { justify-content: center; align-self: center; }
  .hero-visual { min-height: 480px; width: 100%; }
  .hero-glow-main { right: 50%; transform: translate(50%, -50%); top: 46%; }
  .hero-ring { right: 50%; }
}
@media (max-width: 560px) {
  .hero .phone { width: min(300px, 78vw); transform: perspective(1300px) rotateY(-6deg) rotateX(3deg); }
  .hero-visual { min-height: 430px; }
  .hero-float { display: none; }
  .hero-badges .store-badge { min-width: 156px; }
}
