/* Scroll-driven iPhone mockups: vertical scroll → horizontal screen travel */

.iphone-showcase {
  margin: clamp(2rem, 6vw, 4rem) 0;
  scroll-margin-top: 5rem;
  --iphone-progress: 0;
  --iphone-local-progress: 0;
  --iphone-depth: 0;
  --iphone-drift: 0.5;
}

.iphone-showcase__intro {
  text-align: center;
  max-width: 36rem;
  margin: 0 auto clamp(1.5rem, 4vw, 2.5rem);
  padding: 0 0.5rem;
}

.iphone-showcase__intro[data-reveal] > h2 {
  position: relative;
  padding-bottom: 0.55rem;
}

.iphone-showcase__intro[data-reveal] > h2::after {
  left: 50%;
  right: auto;
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
}

.iphone-showcase__intro[data-reveal].is-revealed > h2::after {
  transform: translateX(-50%) scaleX(1);
}

.iphone-showcase__title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.65rem, 4.2vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.iphone-showcase__lead {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.iphone-showcase__hint {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 1rem 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--primary-border);
  background: var(--primary-soft);
}

.iphone-showcase__hint-arrow {
  font-size: 1rem;
  line-height: 1;
}

/*
 * Taller pin → more vertical scroll per mockup (avoids “one flick = next screen”).
 * ~7× viewport ≈ ~6× viewport of usable range for four slides.
 */
.iphone-showcase__pin {
  position: relative;
  min-height: calc(7 * 100dvh);
  min-height: calc(7 * 100svh);
}

.iphone-showcase__sticky {
  position: sticky;
  top: max(0.75rem, env(safe-area-inset-top));
  min-height: min(92vh, 800px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0 1.5rem;
  box-sizing: border-box;
}

/* ─── Stage: title above · one phone · caption below (all breakpoints) ─── */
.iphone-showcase__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.9rem, 2.8vw, 1.75rem);
  width: 100%;
  max-width: 50rem;
  margin: 0 auto;
  padding: 0 clamp(0.75rem, 3vw, 1.5rem);
  box-sizing: border-box;
}

.iphone-showcase__copy-col--start,
.iphone-showcase__copy-col--end {
  text-align: center;
  width: 100%;
  max-width: 38rem;
}

.iphone-showcase__phones {
  width: 100%;
  max-width: min(1300px, 90vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  position: relative;
}

.iphone-showcase__copy-title {
  margin: 0;
  font-size: clamp(1.45rem, 4.2vw, 1.95rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.18;
  color: var(--text);
  transform: translate3d(0, calc((0.5 - var(--iphone-drift)) * 10px), 0);
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.iphone-showcase__copy-body {
  margin: 0;
  font-size: clamp(1.08rem, 2.9vw, 1.28rem);
  line-height: 1.58;
  color: var(--text-muted);
  transform: translate3d(0, calc((0.5 - var(--iphone-drift)) * 14px), 0);
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Mobile: large centered phone — compact copy frees ~50% more vertical room for the mockup */
@media (max-width: 879px) {
  .iphone-showcase__sticky {
    top: 0;
    min-height: 100dvh;
    min-height: 100svh;
    max-height: 100dvh;
    max-height: 100svh;
    padding: max(0.25rem, env(safe-area-inset-top)) max(0.35rem, env(safe-area-inset-right))
      max(1.05rem, calc(env(safe-area-inset-bottom) + 0.78rem)) max(0.35rem, env(safe-area-inset-left));
    align-items: stretch;
  }

  .iphone-showcase__stage {
    flex: 1;
    min-height: 0;
    max-width: none;
    justify-content: space-between;
    align-items: center;
    gap: clamp(0.28rem, 1.8vw, 0.55rem);
    padding: 0 0.25rem;
  }

  .iphone-showcase__copy-col--start,
  .iphone-showcase__copy-col--end {
    flex: 0 0 auto;
    max-width: min(94vw, 28rem);
  }

  .iphone-showcase__copy-title {
    font-size: clamp(1.2rem, 5.2vw, 1.62rem);
    line-height: 1.14;
  }

  .iphone-showcase__copy-body {
    font-size: clamp(0.88rem, 3.65vw, 1.05rem);
    line-height: 1.42;
  }

  .iphone-showcase__phones {
    flex: 1 1 auto;
    min-height: 0;
    max-width: none;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .iphone-showcase__solo {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-height: 100%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .app-mock-solo {
    flex: 0 1 auto;
    min-height: 0;
    max-height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .app-mock-solo__clip {
    width: 100%;
    max-width: min(99vw, 1300px);
    margin: 0 auto;
    max-height: 100%;
    /* Extra room so the PNG frame clears dynamic mobile browser bottom bars. */
    padding-bottom: clamp(34px, 8.8vmin, 86px);
  }

  .iphone-showcase__pin .iphone-frame__slides {
    align-items: center;
    max-height: 100%;
  }

  .iphone-showcase__pin .iphone-frame__slide {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 100%;
  }
}

/* Hidden grid — JS still needs <figure> nodes for count + focus state */
.iphone-showcase__grid {
  display: none !important;
}

/* ─── Solo carousel: one full-width slide = full clip (this fixes “tiny double phone” bug) ─── */
.iphone-showcase__solo {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0;
}

.app-mock-solo {
  width: 100%;
}

.app-mock-solo__clip {
  overflow: hidden;
  width: 100%;
  max-width: min(1300px, 90vw);
  margin: 0 auto;
  line-height: 0;
  /* Room below so the frame + drop-shadow aren’t clipped by overflow:hidden */
  padding-bottom: clamp(12px, 2.2vmin, 32px);
  box-sizing: border-box;
  filter: drop-shadow(0 28px 56px rgba(15, 23, 42, 0.2));
  transform: translate3d(0, calc((0.5 - var(--iphone-drift)) * 14px), 0)
    scale(calc(0.985 + var(--iphone-depth) * 0.03));
  transition: transform 340ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.iphone-frame__slides {
  --iphone-slide-count: 4;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  width: calc(var(--iphone-slide-count) * 100%);
  will-change: transform;
  /* Discrete index from scroll; this eases between stops so each change reads as motion, not a snap. */
  transition: transform 0.62s cubic-bezier(0.25, 0.82, 0.12, 1);
}

.iphone-showcase__phones::before {
  content: "";
  position: absolute;
  width: min(62vw, 560px);
  height: min(32vw, 260px);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.14) 0%, transparent 72%);
  filter: blur(30px);
  transform: translate3d(0, calc((var(--iphone-drift) - 0.5) * 20px), 0)
    scale(calc(0.96 + var(--iphone-depth) * 0.08));
  pointer-events: none;
  z-index: 0;
}

.iphone-showcase__phones > * {
  position: relative;
  z-index: 1;
}

.iphone-frame__slide {
  flex: 0 0 calc(100% / var(--iphone-slide-count));
  min-width: 0;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Each image fills its slide (= full visible clip width), not ¼ of the strip */
.app-mock-solo__clip .iphone-frame__slide .app-mock-card__img {
  display: block;
  width: 100%;
  max-width: min(1300px, 90vw);
  height: auto;
  max-height: min(82vh, 1148px);
  object-fit: contain;
  object-position: center center;
  vertical-align: top;
}

@media (max-width: 879px) {
  .app-mock-solo__clip .iphone-frame__slide .app-mock-card__img {
    width: 100%;
    max-width: min(99vw, 1300px);
    height: auto;
    /* Reserve space for both copy blocks + safe areas + clip padding (90dvh was too tall for the flex band). */
    max-height: min(calc(100dvh - 13.5rem), calc(100svh - 13.5rem), calc(100svh - 34vw), calc(100vw * 1.68), 1480px);
    object-fit: contain;
    object-position: center center;
  }
}

/* Legacy card box (hidden grid only — not shown) */
.app-mock-card {
  width: min(365px, 78vw);
  flex-shrink: 0;
  line-height: 0;
}

.app-mock-card__img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
}

.iphone-float {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  position: relative;
  transition:
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.55s ease,
    filter 0.55s ease;
}

.iphone-float__bob {
  animation: iphone-bob 5.2s ease-in-out infinite;
}

.iphone-float--a .iphone-float__bob {
  animation-delay: -0.6s;
}

.iphone-float--b .iphone-float__bob {
  animation-delay: -2.1s;
}

.iphone-float--c .iphone-float__bob {
  animation-delay: -3.6s;
}

.iphone-float--d .iphone-float__bob {
  animation-delay: -5.1s;
}

@keyframes iphone-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.iphone-float__cap {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.iphone-float--a {
  transform: translateY(6px) rotate(-5deg);
}

.iphone-float--b {
  transform: translateY(-8px) rotate(0deg);
}

.iphone-float--c {
  transform: translateY(10px) rotate(5deg);
}

.iphone-float--d {
  transform: translateY(4px) rotate(4deg);
}

.iphone-showcase__grid .iphone-float--focus {
  transform: translateY(-6px) scale(1.05) rotate(0deg) !important;
  opacity: 1 !important;
  z-index: 2;
}

.iphone-showcase__grid .iphone-float:not(.iphone-float--focus) {
  opacity: 0.62;
  transform: translateY(12px) scale(0.92) !important;
}

@media (min-width: 880px) {
  .iphone-showcase__sticky {
    top: max(0.75rem, env(safe-area-inset-top));
    min-height: min(94vh, 1040px);
    max-height: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0.85rem 0 2rem;
  }

  /* Title at top · caption at bottom · phone centered in the flex band (no height:100% on strip — that broke scaling) */
  .iphone-showcase__sticky > .iphone-showcase__stage {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: min(92rem, 96vw);
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: clamp(0.5rem, 1.5vw, 1.1rem);
  }

  .iphone-showcase__copy-col--start,
  .iphone-showcase__copy-col--end {
    flex: 0 0 auto;
    max-width: 42rem;
    width: 100%;
  }

  .iphone-showcase__copy-title {
    font-size: clamp(1.65rem, 3.1vw, 2.1rem);
  }

  .iphone-showcase__copy-body {
    font-size: clamp(1.12rem, 2.2vw, 1.35rem);
  }

  .iphone-showcase__phones {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: min(1300px, 78vw);
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  /* Fill the flex band between title and caption; clip + img cap with 100% so nothing clips the frame */
  .iphone-showcase__solo {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .iphone-showcase__phones .app-mock-solo {
    flex: 0 1 auto;
    min-height: 0;
    max-height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .iphone-showcase__phones .app-mock-solo__clip {
    display: block;
    width: 100%;
    max-width: min(1300px, 78vw);
    max-height: 100%;
    height: auto;
    margin-inline: auto;
  }

  .iphone-showcase__phones .iphone-frame__slides {
    align-items: flex-start;
    height: auto;
    max-height: none;
  }

  .iphone-showcase__phones .iphone-frame__slide {
    display: block;
    height: auto;
    max-height: none;
  }
}

/* Narrow desktop / short laptop window only — full-width desktop (≥1200px) overrides the image cap below. */
@media (min-width: 880px) and (max-width: 1199px) {
  .iphone-showcase__sticky {
    padding: 1rem 0 1.25rem;
  }

  .iphone-showcase__sticky > .iphone-showcase__stage {
    gap: clamp(0.55rem, 1.85vw, 1rem);
  }

  .iphone-showcase__phones .app-mock-solo__clip .iphone-frame__slide .app-mock-card__img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: min(50vh, calc(100dvh - 18rem), 920px);
    object-fit: contain;
    object-position: center center;
    margin: 0 auto;
  }
}

/* Full-width desktop — unchanged “perfect” cap (do not alter for smaller breakpoints above). */
@media (min-width: 1200px) {
  .iphone-showcase__phones .app-mock-solo__clip .iphone-frame__slide .app-mock-card__img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: min(58vh, calc(100dvh - 15rem), 1040px);
    object-fit: contain;
    object-position: center center;
    margin: 0 auto;
  }
}

@media (prefers-color-scheme: dark) {
  .app-mock-solo__clip {
    filter: drop-shadow(0 30px 64px rgba(0, 0, 0, 0.52));
  }
}

@media (prefers-reduced-motion: reduce) {
  .iphone-float__bob {
    animation: none !important;
  }

  .iphone-frame__slides {
    transition: none !important;
  }

  .iphone-float {
    transition: none !important;
  }

  .iphone-showcase__copy-title,
  .iphone-showcase__copy-body,
  .app-mock-solo__clip,
  .iphone-showcase__phones::before {
    transform: none !important;
    transition: none !important;
  }
}

/* Flat style override: remove image glow/shadow treatment */
.app-mock-solo__clip {
  filter: none !important;
}
