/* ============================================================
   PeakRoutine — hero-fix.css
   Drop this AFTER sections.css in index.html
   Fixes: phone animations, stat badge entrance + float,
          iPhone frame overlay, glow, depth
   ============================================================ */

/* ══════════════════════════════════════
   HERO PHONES CONTAINER
══════════════════════════════════════ */
.hero-phones {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem 1rem 0;
  height: 480px;
  display: flex;
  align-items: flex-end;
  justify-content: center;

  /* Entrance: slide up + fade */
  opacity: 0;
  transform: translateY(48px);
  animation: heroIn 1s cubic-bezier(0.16, 1, 0.3, 1) 1.3s forwards;
}

/* ══════════════════════════════════════
   CENTER CARD — iPhone frame overlay
══════════════════════════════════════ */
.hero-center-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 200px;
  translate: -50% -50%;
  transform: none; /* Clear sections.css rotate/scale transform */
  z-index: 30;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1.5px rgba(255, 255, 255, 0.14);

  /* Clear sections.css glassmorphism styles that bleed through */
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;

  /* Continuous float - slight delay for stable mount */
  animation: phoneFloatCenter 6s ease-in-out 0.2s infinite;
}

/* Ambient glow behind center card */
.hero-center-card::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 200%;
  height: 200%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle,
    rgba(96, 165, 250, 0.32) 0%,
    rgba(52, 211, 153, 0.18) 40%,
    transparent 70%
  );
  filter: blur(32px);
  z-index: -1;
  pointer-events: none;
}

.hero-center-card-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: inherit;
  position: relative;
  z-index: 1;
}

/* ══════════════════════════════════════
   SIDE VISUALS
══════════════════════════════════════ */
.hero-visual {
  position: absolute;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.hero-visual-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 34px;
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.45),
    0 0 0 1.5px rgba(255, 255, 255, 0.12);
  background: rgba(10, 15, 30, 0.72);
}

/* Glow behind side phones */
.hero-visual::before {
  content: '';
  position: absolute;
  inset: -10% -12% auto;
  height: 130%;
  background:
    radial-gradient(circle at 50% 50%, rgba(28, 133, 232, 0.22) 0%, transparent 65%),
    radial-gradient(circle at 50% 65%, rgba(56, 193, 114, 0.14) 0%, transparent 60%);
  filter: blur(28px);
  z-index: -1;
  pointer-events: none;
}

.hero-visual-left {
  left: calc(50% - 238px);
  bottom: -24px;
  width: 215px;
  transform: rotate(-6deg) scale(0.88);
  opacity: 0.85;
  animation: phoneFloatLeft 7s ease-in-out 0.8s infinite;
}

.hero-visual-right {
  left: calc(50% + 24px);
  bottom: -20px;
  width: 215px;
  transform: rotate(6deg) scale(0.88);
  opacity: 0.85;
  animation: phoneFloatRight 7s ease-in-out 1.6s infinite;
}

/* ══════════════════════════════════════
   FLOAT KEYFRAMES
══════════════════════════════════════ */
@keyframes phoneFloatCenter {
  0%,  100% { transform: translateY(0px); }
  50%       { transform: translateY(-12px); }
}

@keyframes phoneFloatLeft {
  0%,  100% { transform: rotate(-6deg) scale(0.88) translateY(0px); }
  50%       { transform: rotate(-6deg) scale(0.88) translateY(-10px); }
}

@keyframes phoneFloatRight {
  0%,  100% { transform: rotate(6deg) scale(0.88) translateY(0px); }
  50%       { transform: rotate(6deg) scale(0.88) translateY(-10px); }
}

/* Bottom glow under center phone */
.hero-phones::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 40px;
  background: rgba(28, 133, 232, 0.45);
  filter: blur(32px);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}

/* ══════════════════════════════════════
   STAT BADGES — entrance + float
══════════════════════════════════════ */
.hero-stat-badge {
  position: absolute;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 162px;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.32),
    0 0 0 0.5px rgba(255, 255, 255, 0.06) inset;
  color: white;
  white-space: nowrap;

  /* Start invisible, slide in, then loop-float */
  opacity: 0;
  transform: translateY(16px) scale(0.9);
}

/* Each badge entrance fires after hero-phones appear (1.3s),
   then transitions into continuous float via animation-fill-mode */
.hero-float-delay-0 {
  animation:
    badgeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.7s forwards,
    statFloat 5s ease-in-out 2.4s infinite;
}
.hero-float-delay-1 {
  animation:
    badgeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.9s forwards,
    statFloat 5s ease-in-out 2.6s infinite;
}
.hero-float-delay-2 {
  animation:
    badgeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 2.1s forwards,
    statFloat 5s ease-in-out 2.8s infinite;
}
.hero-float-delay-3 {
  animation:
    badgeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 2.3s forwards,
    statFloat 5s ease-in-out 3.0s infinite;
}
.hero-float-delay-4 {
  animation:
    badgeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 2.5s forwards,
    statFloat 5s ease-in-out 3.2s infinite;
}

@keyframes badgeIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Each badge floats at a slightly different amplitude/phase */
@keyframes statFloat {
  0%,  100% { transform: translateY(0px); }
  50%        { transform: translateY(-8px); }
}

/* Override per-badge for unique rhythms */
.hero-stat-recovery { animation-name: badgeIn, statFloatA !important; }
.hero-stat-active   { animation-name: badgeIn, statFloatB !important; }
.hero-stat-hrv      { animation-name: badgeIn, statFloatC !important; }
.hero-stat-energy   { animation-name: badgeIn, statFloatD !important; }
.hero-stat-streak   { animation-name: badgeIn, statFloatE !important; }

@keyframes statFloatA {
  0%,  100% { transform: translateY(0px) rotate(-1deg); }
  50%        { transform: translateY(-9px) rotate(-1deg); }
}
@keyframes statFloatB {
  0%,  100% { transform: translateY(0px); }
  50%        { transform: translateY(-6px); }
}
@keyframes statFloatC {
  0%,  100% { transform: translateY(0px) rotate(1deg); }
  50%        { transform: translateY(-11px) rotate(1deg); }
}
@keyframes statFloatD {
  0%,  100% { transform: translateY(0px); }
  50%        { transform: translateY(-7px); }
}
@keyframes statFloatE {
  0%,  100% { transform: translateY(0px) rotate(-0.5deg); }
  50%        { transform: translateY(-8px) rotate(-0.5deg); }
}

/* Badge icon */
.hero-stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.hero-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.2;
}

.hero-stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}

/* Badge positions */
.hero-stat-recovery { left: 6%;  top: 28%; }
.hero-stat-active   { left: 9%;  top: 52%; }
.hero-stat-streak   { left: 8%;  bottom: 14%; }
.hero-stat-hrv      { right: 6%; top: 32%; }
.hero-stat-energy   { right: 9%; top: 56%; }

/* ══════════════════════════════════════
   RESPONSIVE OVERRIDES
══════════════════════════════════════ */
@media (max-width: 991px) {
  .hero-phones       { height: 400px; }
  .hero-center-card  { width: 180px; }
  .hero-visual-left  { left: calc(50% - 210px); width: 190px; }
  .hero-visual-right { left: calc(50% + 22px);  width: 190px; }

  .hero-stat-recovery { left: 3%;  top: 18%; }
  .hero-stat-active   { left: 5%;  top: 44%; }
  .hero-stat-streak   { left: 4%;  bottom: 10%; }
  .hero-stat-hrv      { right: 3%; top: 22%; }
  .hero-stat-energy   { right: 5%; top: 48%; }
}

@media (max-width: 767px) {
  .hero-phones { height: 340px; }
  .hero-center-card  { width: 160px; }
  .hero-visual-left  { left: calc(50% - 185px); width: 165px; }
  .hero-visual-right { left: calc(50% + 18px);  width: 165px; }

  .hero-stat-badge { width: 148px; padding: 0.6rem 0.8rem; }
  .hero-stat-label { font-size: 0.68rem; }
  .hero-stat-value { font-size: 0.95rem; }
  .hero-stat-icon  { width: 26px; height: 26px; font-size: 0.8rem; border-radius: 7px; }

  /* Only show 2 badges on tablet */
  .hero-stat-active,
  .hero-stat-streak { display: none; }

  /* Badge positions for smaller layout */
  .hero-stat-recovery { left: 2%;  top: 12%; }
  .hero-stat-hrv      { right: 2%; top: 16%; }
  .hero-stat-energy   { display: none; }

  .hero-phones::after { display: none; }
}

@media (max-width: 576px) {
  /* Buttons: side-by-side, not full width */
  .hero-actions {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center;
    gap: 0.65rem;
    flex-wrap: wrap;
  }
  .hero-actions .btn-pr {
    width: auto !important;
    min-width: 130px;
    padding-inline: 1.25rem;
    font-size: 0.9rem;
  }

  /* Scale down 3-phone layout for small screens */
  .hero-phones {
    height: 280px;
    min-height: 280px;
    padding: 0;
    margin-top: 1.5rem;
    margin-bottom: 2.5rem;
  }

  .hero-center-card {
    top: auto;
    bottom: 0;
    width: 132px;
    translate: -50% 0;
    animation: phoneFloatCenterMobile 6s ease-in-out infinite;
  }

  .hero-visual-left {
    left: calc(50% - 138px);
    width: 106px;
    opacity: 0.78;
  }
  .hero-visual-right {
    left: calc(50% + 32px);
    width: 106px;
    opacity: 0.78;
  }

  /* Hide all badges on small mobile */
  .hero-stat-badge { display: none; }

  .hero-phones::after { display: none; }
}

@keyframes phoneFloatCenterMobile {
  0%,  100% { translate: -50% 0; }
  50%        { translate: -50% -10px; }
}

/* ══════════════════════════════════════
   PREFERS REDUCED MOTION
══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .hero-center-card,
  .hero-visual-left,
  .hero-visual-right,
  .hero-stat-badge {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .hero-visual-left  { transform: rotate(-6deg) scale(0.88) !important; }
  .hero-visual-right { transform: rotate(6deg)  scale(0.88) !important; }
}
