/*
 * The hero ("stage"): the words on the left, a deck of four photo cards on
 * the right. The deck is the slideshow -- refresh.js moves `data-pos` and the
 * cards shuffle; the front card drifts slowly while it is shown. It all works
 * without motion.js: GSAP only adds the entrance and the word change.
 */

.stage {
  --stage-ink: #eef6f2;
  background:
    radial-gradient(60% 80% at 85% 20%, rgb(214 239 127 / 14%) 0%, transparent 70%),
    radial-gradient(50% 60% at 5% 100%, rgb(237 155 134 / 14%) 0%, transparent 70%),
    linear-gradient(150deg, var(--teal-deep) 0%, #0b4a43 55%, #0d564d 100%);
  color: var(--stage-ink);
  isolation: isolate;
  overflow: hidden;
  position: relative;
}

/* Two soft lights that drift, so the background is never a flat colour. */
.stage-glow::before,
.stage-glow::after {
  border-radius: 50%;
  content: "";
  filter: blur(70px);
  position: absolute;
  z-index: -1;
}

.stage-glow::before {
  animation: stage-drift 16s ease-in-out infinite alternate;
  background: rgb(210 237 136 / 22%);
  height: 420px;
  right: 8%;
  top: -120px;
  width: 420px;
}

.stage-glow::after {
  animation: stage-drift 20s ease-in-out infinite alternate-reverse;
  background: rgb(18 140 126 / 35%);
  bottom: -160px;
  height: 460px;
  left: -120px;
  width: 460px;
}

@keyframes stage-drift {
  to {
    transform: translate(60px, 40px) scale(1.12);
  }
}

.stage-inner {
  align-items: center;
  display: grid;
  gap: clamp(32px, 5vw, 80px);
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  margin: 0 auto;
  max-width: 1240px;
  min-height: min(720px, calc(100svh - 72px));
  padding: 56px max(5%, 20px) 88px;
}

.stage-eyebrow {
  align-items: center;
  backdrop-filter: blur(8px);
  background: rgb(255 255 255 / 10%);
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 999px;
  color: #edf6dd;
  display: inline-flex;
  gap: 8px;
  margin-bottom: 26px;
  padding: 7px 16px;
}

.stage-title {
  color: #fff;
  font-weight: 650;
}

.stage-name {
  display: block;
  font-size: clamp(56px, 7.2vw, 100px);
  letter-spacing: -0.02em;
  line-height: 0.95;
}

.stage-line {
  display: block;
  font-size: clamp(26px, 2.9vw, 40px);
  font-weight: 400;
  line-height: 1.12;
  margin-top: 18px;
}

/* The changing word sits in its own clipped box, so the next word can rise
   into place without the line around it moving. */
.stage-word-box {
  display: inline-block;
  overflow: hidden;
  padding-bottom: 0.08em;
  vertical-align: bottom;
}

.stage-word {
  color: var(--lime);
  display: inline-block;
  font-style: normal;
  white-space: nowrap;
}

.stage-lede {
  color: #d9e8e1;
  font-size: 17px;
  line-height: 1.6;
  margin-top: 22px;
  max-width: 520px;
}

.stage-note {
  color: #fff;
  font-weight: 600;
}

.stage-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 18px 26px;
  margin-top: 30px;
}

.stage .launch-note {
  color: #b9cdc5;
  margin-top: 20px;
}

/* --- the deck ------------------------------------------------------------ */

.stage-show {
  display: grid;
  justify-items: center;
}

.stage-deck {
  aspect-ratio: 4 / 5;
  max-width: 100%;
  position: relative;
  width: min(420px, 100%);
}

.stage-slide {
  border-radius: 28px;
  box-shadow:
    0 40px 70px -30px rgb(0 0 0 / 60%),
    0 0 0 1px rgb(255 255 255 / 10%);
  inset: 0;
  margin: 0;
  overflow: hidden;
  position: absolute;
  transform-origin: 50% 90%;
  transition:
    transform 900ms var(--ease),
    opacity 700ms var(--ease),
    filter 700ms var(--ease);
}

.stage-slide img {
  height: 100%;
  object-fit: cover;
  transform: scale(1.1);
  transition: transform 7s linear;
  width: 100%;
}

.stage-slide[data-pos="0"] {
  z-index: 4;
}

.stage-slide[data-pos="0"] img {
  transform: scale(1);
}

.stage-slide[data-pos="1"] {
  filter: brightness(0.72) saturate(0.9);
  transform: translateX(-16%) rotate(-7deg) scale(0.9);
  z-index: 3;
}

.stage-slide[data-pos="2"] {
  filter: brightness(0.58) saturate(0.85);
  transform: translateX(15%) rotate(6deg) scale(0.84);
  z-index: 2;
}

.stage-slide[data-pos="3"] {
  opacity: 0;
  transform: scale(0.76);
  z-index: 1;
}

/* The card that was in front is thrown aside and lands at the back. */
.stage-slide.is-leaving {
  animation: stage-leave 900ms var(--ease) both;
}

@keyframes stage-leave {
  0% {
    opacity: 1;
    transform: none;
    z-index: 5;
  }
  45% {
    opacity: 0;
    transform: translate(-62%, -3%) rotate(-16deg) scale(0.92);
    z-index: 5;
  }
  100% {
    opacity: 0;
    transform: scale(0.76);
    z-index: 1;
  }
}

.stage[data-paused="true"] .stage-slide img {
  transition-duration: 600ms;
}

.stage-tag {
  backdrop-filter: blur(10px);
  background: rgb(6 52 47 / 62%);
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 999px;
  bottom: 16px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  left: 16px;
  padding: 7px 14px;
  position: absolute;
  transition: opacity 400ms var(--ease);
}

/* Only the front card names its category. */
.stage-slide:not([data-pos="0"]) .stage-tag {
  opacity: 0;
}

.stage-chip {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 40px -18px rgb(0 0 0 / 55%);
  color: var(--teal-deep);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  pointer-events: none;
  position: absolute;
  white-space: nowrap;
  z-index: 6;
}

.stage-chip::before {
  background: var(--lime);
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: 8px;
  margin-right: 8px;
  vertical-align: 1px;
  width: 8px;
}

.stage-chip-a {
  right: -8%;
  top: 12%;
}

.stage-chip-b {
  bottom: 20%;
  left: -12%;
}

.stage-chip-b::before {
  background: var(--coral);
}

/* --- controls ------------------------------------------------------------ */

.stage-controls {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 30px;
}

.stage-arrow {
  align-items: center;
  background: rgb(255 255 255 / 10%);
  border: 1px solid rgb(255 255 255 / 30%);
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  font-size: 19px;
  height: 40px;
  justify-content: center;
  line-height: 1;
  transition:
    background 200ms var(--ease),
    transform 200ms var(--ease);
  width: 40px;
}

.stage-arrow:hover {
  background: rgb(255 255 255 / 24%);
  transform: translateY(-2px);
}

.stage-play {
  font-size: 14px;
  margin-left: 6px;
}

.stage-dots {
  display: flex;
  gap: 8px;
}

.stage-dots button {
  background: rgb(255 255 255 / 36%);
  border: 0;
  border-radius: 999px;
  height: 8px;
  padding: 0;
  transition:
    width 300ms var(--ease),
    background 300ms var(--ease);
  width: 8px;
}

.stage-dots button[aria-current="true"] {
  background: var(--lime);
  width: 30px;
}

.stage-footer {
  border-top: 1px solid rgb(255 255 255 / 18%);
  bottom: 0;
  color: #c9dad3;
  display: flex;
  font-size: 11px;
  gap: 20px;
  justify-content: space-between;
  left: max(5%, calc((100% - 1240px) / 2));
  padding: 16px 0;
  position: absolute;
  right: max(5%, calc((100% - 1240px) / 2));
}

/* --- narrower screens ---------------------------------------------------- */

@media (max-width: 980px) {
  .stage-inner {
    gap: 40px;
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    padding: 40px 22px 76px;
    text-align: center;
  }

  .stage-lede {
    margin-inline: auto;
  }

  .stage-actions {
    justify-content: center;
  }

  .stage-deck {
    width: min(340px, 74vw);
  }

  .stage-chip-a {
    right: -14%;
  }

  .stage-chip-b {
    left: -14%;
  }
}

@media (max-width: 680px) {
  .stage-inner {
    gap: 34px;
    padding: 26px 20px 64px;
  }

  .stage-eyebrow {
    font-size: 9px;
    margin-bottom: 18px;
  }

  .stage-name {
    font-size: 44px;
  }

  .stage-line {
    font-size: 27px;
    margin-top: 12px;
  }

  .stage-lede {
    font-size: 14px;
    margin-top: 16px;
    max-width: 340px;
  }

  .stage-actions {
    flex-direction: column;
    gap: 14px;
    margin-top: 20px;
  }

  .stage .launch-note {
    margin-top: 14px;
  }

  .stage-chip {
    font-size: 11px;
    padding: 8px 11px;
  }

  .stage-chip-a {
    right: -10%;
  }

  .stage-chip-b {
    left: -10%;
  }

  .stage-footer {
    justify-content: center;
    left: 22px;
    right: 22px;
    padding: 12px 0;
  }

  .stage-footer > span:first-child {
    display: none;
  }
}

/* A short phone: the words and the way down fit on the first screen. */
@media (max-width: 760px) and (max-height: 700px) {
  .stage-inner {
    padding-top: 16px;
  }

  .stage-name {
    font-size: 36px;
  }

  .stage-line {
    font-size: 23px;
    margin-top: 8px;
  }

  .stage-eyebrow {
    margin-bottom: 12px;
  }

  .stage-lede {
    font-size: 12px;
    margin-top: 12px;
  }

  .stage-actions {
    flex-direction: row;
    justify-content: center;
    gap: 14px;
    margin-top: 16px;
  }

  .stage-actions .button {
    font-size: 12px;
    gap: 12px;
    padding: 10px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage-glow::before,
  .stage-glow::after,
  .stage-slide.is-leaving {
    animation: none;
  }

  .stage-slide,
  .stage-slide img {
    transition: none;
  }

  .stage-slide img {
    transform: none;
  }
}
