.mango-intro {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  border: 0;
  background: radial-gradient(ellipse at 50% 36%, #ffe5b5 0%, #fcf5eb 58%, #f5e9d9 100%);
  color: #203e2b;
}

.mango-intro[open] { display: grid; }
.mango-intro::backdrop { background: transparent; }
body:has(.mango-intro[open]) { overflow: hidden; }

.mango-intro.is-leaving {
  opacity: 0;
  transition: opacity 420ms ease;
}

.intro-stage {
  display: grid;
  align-content: center;
  justify-items: center;
  width: 100%;
  padding: 4rem var(--gutter) 2.5rem;
  text-align: center;
}

.intro-mango {
  position: relative;
  width: min(100%, 34rem, 53dvh);
  aspect-ratio: 9 / 8;
  margin-top: -.6rem;
  overflow: clip;
}

.intro-mango img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Each mask isolates one part of the same transparent photograph. */
.intro-cheek {
  clip-path: polygon(0 32%, 31.4% 32%, 31.4% 26.1%, 66% 26.1%, 70.3% 28.7%, 100% 28.7%, 100% 100%, 0 100%);
}

.intro-cube {
  transform: translate(var(--rest-x), var(--rest-y));
}

.intro-cube--left {
  --rest-x: 12%;
  --rest-y: 19%;
  --open-x: -2.4%;
  --open-y: 1.7%;
  --turn: -7deg;
  --delay: 310ms;
  clip-path: inset(0 68% 68% 10.7%);
  transform-origin: 21% 18%;
}

.intro-cube--center {
  --rest-x: 2.2%;
  --rest-y: 18%;
  --open-x: 0%;
  --open-y: -1.2%;
  --turn: 4deg;
  --delay: 180ms;
  clip-path: inset(0 39.4% 74% 38.6%);
  transform-origin: 49% 14%;
}

.intro-cube--right {
  --rest-x: -4.4%;
  --rest-y: 20.2%;
  --open-x: 3.3%;
  --open-y: 1.2%;
  --turn: 7deg;
  --delay: 430ms;
  clip-path: polygon(64% 0, 88.6% 0, 88.6% 28.6%, 70.3% 28.6%, 66% 25.9%, 64% 25.9%);
  transform-origin: 76% 16%;
}

.intro-welcome {
  display: grid;
  justify-items: center;
  gap: clamp(.75rem, 1.8dvh, 1.25rem);
}

.intro-logo {
  width: clamp(10rem, min(23vw, 26dvh), 14rem);
  height: auto;
}

.intro-welcome p {
  margin: 0;
  font: 500 clamp(1.65rem, 3.1vw, 3.25rem)/1.08 var(--display);
  letter-spacing: -.04em;
  text-wrap: balance;
}

.intro-welcome em { color: #994817; }

.mango-intro.is-animated .intro-welcome {
  opacity: 0;
  transform: translateY(.7rem);
}

.mango-intro.is-playing .intro-cube {
  animation: intro-lift-cube 2.55s cubic-bezier(.4, .02, .2, 1) var(--delay) both;
}

.mango-intro.is-playing .intro-welcome {
  animation: intro-reveal-title 940ms ease 880ms both;
}

@keyframes intro-lift-cube {
  to {
    transform: translate(var(--open-x), var(--open-y)) rotate(var(--turn));
  }
}

@keyframes intro-reveal-title {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.intro-skip {
  position: absolute;
  z-index: 1;
  top: max(1.1rem, env(safe-area-inset-top));
  right: var(--gutter);
  min-height: 2.65rem;
  padding: .3rem 1rem;
  border: 1px solid #203e2b4d;
  border-radius: 99rem;
  background: #fcf5eb;
  color: #203e2b;
  font-weight: 650;
  cursor: pointer;
}

.intro-skip:hover { border-color: currentColor; }

.intro-replay:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: .46rem;
  min-height: 2.75rem;
  padding: .3rem 0;
  border: 0;
  background: transparent;
  color: #f7eddfcc;
  font-size: .91rem;
  cursor: pointer;
}

.intro-replay:hover { color: var(--gold); }

.intro-replay span {
  width: 0;
  height: 0;
  border-block: .32rem solid transparent;
  border-left: .49rem solid currentColor;
}

@media (orientation: landscape) and (max-height: 500px) {
  .intro-stage {
    grid-template-columns: minmax(0, 19rem) minmax(0, 21rem);
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding-block: 3.5rem 1rem;
  }
  .intro-mango { width: min(100%, 72dvh); margin: 0; }
  .intro-logo { width: clamp(8rem, 36dvh, 11rem); }
  .intro-welcome p { font-size: clamp(1.5rem, 3.4vw, 2rem); }
}

@media (max-width: 460px) {
  .footer-content {
    display: grid;
    grid-template-columns: 1fr auto;
    padding-block: 1rem;
    column-gap: .75rem;
    row-gap: 0;
  }

  .footer-content p { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .mango-intro.is-playing .intro-cube,
  .mango-intro.is-playing .intro-welcome { animation: none; }

  .mango-intro.is-animated .intro-welcome {
    opacity: 1;
    transform: none;
  }
}
