/*
Add this file after style.css.

It keeps the separate background full-size and centres the transparent PNG
turntable frames above it without affecting layout.
*/

.hero-stage {
  position: relative;
  overflow: hidden;
}

.hero-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.hero-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform:
    translate(-50%, -50%) scale(var(--whale-scale, 0.6));
  transform-origin: center;
  pointer-events: none;
  user-select: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
}

.hero-scroll-cue,
.tilt-hint {
  z-index: 2;
}

/* Prevent the browser from animating between frame changes. */
.hero-frame {
  transition: none;
}

/* Keep the desktop whale in the open right side of the composition so it
   never passes through the heading or introductory paragraph. */
@media (min-width: 901px) {
  .hero-stage .hero-frame {
    transform:
      translate(calc(-50% + 30vw - 150px), calc(-50% + 34px))
      scale(0.52);
  }
}

/* Compact laptop screens give the copy less horizontal room, so park the
   whale a little farther right while keeping the complete model visible. */
@media (min-width: 901px) and (max-width: 1100px) {
  .hero-stage .hero-frame {
    transform:
      translate(calc(-50% + 34vw - 150px), calc(-50% + 42px))
      scale(0.42);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-frame {
    transform:
      translate(-50%, -50%) scale(var(--whale-scale, 0.6));
  }
}

@media (max-width: 920px) {
  /* A top-down veil keeps the heading readable while revealing the whale and
     island through the lower half of the mobile hero. */
  .hero-stage::after {
    display: block;
    inset: 0;
    width: 100%;
    background: linear-gradient(
      180deg,
      rgba(247, 244, 233, 0.9) 0%,
      rgba(247, 244, 233, 0.74) 40%,
      rgba(247, 244, 233, 0.42) 60%,
      rgba(247, 244, 233, 0.12) 78%,
      rgba(247, 244, 233, 0) 90%
    );
  }

  .hero-copy {
    padding: 24px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .pill-cta {
    display: none;
  }

  .tilt-hint {
    position: absolute;
    right: max(24px, env(safe-area-inset-right)) !important;
    bottom: calc(56px + env(safe-area-inset-bottom));
    left: auto !important;
    z-index: 5;
    box-sizing: border-box;
    width: max-content;
    max-width: min(280px, calc(100% - 48px));
    white-space: normal;
  }

  .hero,
  .hero-stage,
  .hero-background {
    border-radius: 0;
  }
}

/* iPad landscape can be wider than the phone/tablet layout breakpoint. */
@media (max-width: 1366px) and (pointer: coarse) {
  .tilt-hint {
    position: absolute;
    right: max(24px, env(safe-area-inset-right)) !important;
    bottom: calc(56px + env(safe-area-inset-bottom));
    left: auto !important;
    z-index: 5;
    box-sizing: border-box;
    width: max-content;
    max-width: min(280px, calc(100% - 48px));
    white-space: normal;
  }
}

@media (max-width: 640px) {
  .hero-copy {
    padding: 0;
  }

  /* Keep the whale visible, but soften it where it passes behind mobile copy. */
  .hero-stage::after {
    background: linear-gradient(
      180deg,
      rgba(247, 244, 233, 0.94) 0%,
      rgba(247, 244, 233, 0.82) 40%,
      rgba(247, 244, 233, 0.58) 58%,
      rgba(247, 244, 233, 0.2) 72%,
      rgba(247, 244, 233, 0) 86%
    );
  }

  .tilt-hint {
    right: max(14px, env(safe-area-inset-right)) !important;
    bottom: calc(56px + env(safe-area-inset-bottom));
    max-width: calc(100% - 28px);
  }
}
@media (max-width: 900px) {
  .hero-stage .hero-frame {
    transform: translate(calc(-50% + clamp(0px, 14vw - 50px, 78px)), calc(-50% + 17vh)) scale(0.5) !important;
  }
}

@media (max-width: 640px) {
  .hero-stage .hero-frame {
    top: 80%;
    transform: translate(calc(-50% + clamp(12px, 11vw, 70px)), -50%) scale(0.68) !important;
  }
}


@media (max-width: 640px) and (max-height: 600px) {
  .hero-stage .hero-frame {
    top: 76%;
    transform: translate(calc(-50% + clamp(12px, 11vw, 70px)), -50%) scale(0.6) !important;
  }
}

@media (max-width: 640px) and (max-height: 380px) {
  .hero-stage .hero-frame {
    top: 72%;
    transform: translate(calc(-50% + clamp(12px, 11vw, 70px)), -50%) scale(0.5) !important;
  }
}