/* Hero visual — logo + phone as one composition */

.hero-visual-compose {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: min(22rem, 88vw);
  min-height: min(28rem, 78vw);
}

/* Positioning shell — keeps CSS offset stable while GSAP animates .hero-logo */
.hero-logo-wrap {
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 42%;
  width: min(16rem, 72vw);
  transform: translate(-58%, -58%);
  pointer-events: none;
  user-select: none;
}

.hero-logo {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0.92;
  filter: drop-shadow(0 12px 36px rgba(254, 214, 39, 0.28))
    drop-shadow(0 0 28px rgba(254, 214, 39, 0.12));
  will-change: transform, opacity;
}

.hero-phone-scene {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: min(16.5rem, 68vw);
  margin: 0 auto;
  will-change: transform;
}

.hero-phone-glow {
  position: absolute;
  inset: -22% -18%;
  background:
    radial-gradient(
      ellipse 65% 50% at 50% 42%,
      rgba(254, 214, 39, 0.38) 0%,
      rgba(254, 214, 39, 0.1) 42%,
      transparent 72%
    ),
    radial-gradient(
      ellipse 40% 30% at 70% 70%,
      rgba(254, 214, 39, 0.12) 0%,
      transparent 70%
    );
  pointer-events: none;
  z-index: 0;
  will-change: opacity, transform;
}

.hero-phone {
  position: relative;
  z-index: 1;
  width: 100%;
  transform-style: preserve-3d;
  will-change: transform;
}

.hero-phone-frame {
  position: relative;
  background:
    linear-gradient(160deg, #3a3a40 0%, #1a1a1e 28%, #0a0a0c 58%, #1e1e22 100%);
  border-radius: 2.85rem;
  padding: 0.7rem;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 0 2.5px rgba(0, 0, 0, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04),
    0 0.5rem 1rem rgba(0, 0, 0, 0.35),
    0 1.75rem 3.5rem rgba(0, 0, 0, 0.55),
    0 2.5rem 5rem rgba(0, 0, 0, 0.35),
    0 0 3.5rem rgba(254, 214, 39, 0.16),
    0 0 6rem rgba(254, 214, 39, 0.06);
}

/* Soft specular reflection across bezel */
.hero-phone-shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 255, 255, 0.03) 22%,
    transparent 42%,
    transparent 68%,
    rgba(254, 214, 39, 0.04) 100%
  );
  mix-blend-mode: soft-light;
}

.hero-phone-frame::before {
  content: '';
  position: absolute;
  inset: 0.14rem;
  border-radius: 2.7rem;
  border: 1px solid rgba(254, 214, 39, 0.16);
  pointer-events: none;
  z-index: 2;
}

.hero-phone-frame::after {
  content: '';
  position: absolute;
  top: 18%;
  bottom: 18%;
  right: 0.2rem;
  width: 0.14rem;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent
  );
  pointer-events: none;
  z-index: 2;
}

.hero-phone-notch {
  position: absolute;
  top: 0.95rem;
  left: 50%;
  transform: translateX(-50%);
  width: 5.75rem;
  height: 1.4rem;
  background: #000;
  border-radius: 999px;
  z-index: 3;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.4);
}

.hero-phone-notch::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 1.15rem;
  transform: translateY(-50%);
  width: 2.1rem;
  height: 0.28rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.hero-phone-notch::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 0.85rem;
  transform: translateY(-50%);
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #2a3a5c, #06080f 68%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  opacity: 0.9;
}

.hero-phone-screen {
  /* Safe-area sizes mirrored by delivery `html.hero-preview` + static fallback.
     Delivery header pt uses --hero-safe-top (2.75rem) + row pt-2 ≈ 3.25rem total. */
  --hero-screen-safe-top: 3.25rem;
  --hero-screen-safe-bottom: 2.125rem;
  /* Match delivery shell: zinc-50 light / zinc-950 dark (#09090b) */
  --hero-screen-bg: #fafafa;
  --hero-screen-bg-dark: #09090b;
  position: relative;
  aspect-ratio: 9 / 19.2;
  border-radius: 2.2rem;
  overflow: hidden;
  background: var(--hero-screen-bg);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 0 2rem rgba(0, 0, 0, 0.25);
}

/* Native iPhone logical viewport — scaled to fit screen area via JS */
.hero-phone-iframe-host {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--hero-screen-bg);
}

.hero-phone-screen iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 390px;
  height: 844px;
  border: none;
  display: block;
  pointer-events: none;
  background: var(--hero-screen-bg);
  color-scheme: light;
  transform-origin: 0 0;
  will-change: transform;
}

/* Home indicator overlays the screen (real iPhone), not the bezel below it */
.hero-phone-home-indicator {
  position: absolute;
  left: 50%;
  bottom: 0.42rem;
  z-index: 3;
  width: 34%;
  height: 0.28rem;
  margin: 0;
  transform: translateX(-50%);
  background: rgba(24, 24, 27, 0.55);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}

/* OS dark — avoids white flash before/without JS */
@media (prefers-color-scheme: dark) {
  .hero-phone:not(.hero-phone--light) .hero-phone-screen {
    --hero-screen-bg: var(--hero-screen-bg-dark);
  }

  .hero-phone:not(.hero-phone--light) .hero-phone-screen iframe {
    color-scheme: dark;
  }

  .hero-phone:not(.hero-phone--light) .hero-phone-home-indicator {
    background: rgba(244, 244, 245, 0.45);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }
}

/* Explicit sync from JS (prefers-color-scheme, iframe html.dark, or postMessage) */
.hero-phone--dark .hero-phone-screen {
  --hero-screen-bg: var(--hero-screen-bg-dark);
}

.hero-phone--dark .hero-phone-screen iframe {
  color-scheme: dark;
}

.hero-phone--dark .hero-phone-home-indicator {
  background: rgba(244, 244, 245, 0.45);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.hero-phone--light .hero-phone-screen {
  --hero-screen-bg: #fafafa;
}

.hero-phone--light .hero-phone-screen iframe {
  color-scheme: light;
}

.hero-phone--light .hero-phone-home-indicator {
  background: rgba(24, 24, 27, 0.55);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* Desktop: logo drifts left/behind; phone stays primary */
@media (min-width: 768px) {
  .hero-visual-compose {
    width: min(26rem, 46vw);
    min-height: 30rem;
  }

  .hero-logo-wrap {
    width: min(17.5rem, 38vw);
    left: 8%;
    top: 38%;
    transform: translate(-12%, -52%);
  }

  .hero-logo {
    opacity: 0.95;
  }

  .hero-phone-scene {
    width: min(17.75rem, 36vw);
    margin-left: auto;
    margin-right: 4%;
  }
}

@media (min-width: 1024px) {
  .hero-visual-compose {
    width: min(28rem, 42vw);
  }

  .hero-logo-wrap {
    width: 18.5rem;
    left: 0;
    transform: translate(-8%, -54%);
  }

  .hero-phone-scene {
    width: min(18.5rem, 32vw);
  }
}

/* Small screens: phone primary; logo as soft watermark behind */
@media (max-width: 479px) {
  .hero-visual-compose {
    width: min(18rem, 90vw);
    min-height: min(24rem, 85vw);
  }

  .hero-logo-wrap {
    width: min(12.5rem, 58vw);
    transform: translate(-52%, -62%);
  }

  .hero-logo {
    opacity: 0.55;
    filter: drop-shadow(0 8px 24px rgba(254, 214, 39, 0.18));
  }

  .hero-phone-scene {
    width: min(14.75rem, 70vw);
  }

  .hero-phone-frame {
    border-radius: 2.35rem;
    padding: 0.55rem;
  }

  .hero-phone-notch {
    width: 4.85rem;
    height: 1.25rem;
    top: 0.8rem;
  }

  .hero-phone-screen {
    --hero-screen-safe-top: 2.85rem;
    --hero-screen-safe-bottom: 1.85rem;
    border-radius: 1.85rem;
  }

  .hero-phone-home-indicator {
    bottom: 0.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-logo,
  .hero-phone,
  .hero-phone-glow {
    will-change: auto;
  }
}
