/* Spring Letter Pop — letters spring up from their baseline inside clipped words */

:root {
  --grape: #2b1055;
  --cream: #fff1dc;
  --mango: #ffb01f;

  --display: "Bagel Fat One", "Arial Black", sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(16px, 4vw, 56px);

  /* A damped spring sampled for CSS: overshoots to 1.38, settles by the end */
  --spring: linear(
    0, 0.284, 0.68, 1.047, 1.292, 1.385, 1.346, 1.223, 1.076, 0.951, 0.877, 0.858,
    0.884, 0.933, 0.987, 1.028, 1.049, 1.051, 1.038, 1.019, 1, 0.987, 0.981, 0.982,
    0.988, 0.995, 1.002, 1.006, 1.007, 1.006, 1.004, 1.001, 0.999, 0.998, 0.997,
    0.998, 0.999, 1, 1.001, 1.001, 1
  );
}

*,
*::before,
*::after { box-sizing: border-box; }

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  margin: 0;
  background: var(--grape);
  color: var(--cream);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }

/* ─────────── Header ─────────── */

.bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  justify-content: center;
  padding: 18px var(--gutter);
  pointer-events: none;
}
.logo {
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: -0.01em;
  color: var(--mango);
  pointer-events: auto;
}

/* ─────────── Slides: each line holds the centre for a stretch of scroll ─────────── */

.slide { height: 190svh; }
.slide--hero { height: 150svh; }
.slide--end { height: 100svh; }

/* The next line reaches the band just as the last one leaves it: no empty scroll */
.slide + .slide { margin-top: -45svh; }

.stick {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2.4vw, 32px);
  padding: 76px var(--gutter) 96px;
  text-align: center;
}

.line {
  display: block;
  max-width: 13em;
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.5rem, 8vw, 8rem);
  line-height: 1;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  text-wrap: balance;
}
.line strong { font-weight: 400; color: var(--mango); }

.line--giant {
  max-width: none;
  font-size: clamp(3.4rem, 17vw, 17rem);
  line-height: 0.95;
}
.slide--hero .line:not(.line--giant) { font-size: clamp(1.7rem, 4.6vw, 4.6rem); }

.kicker,
.sub {
  margin: 0;
  font-size: clamp(14px, 1.3vw, 18px);
  line-height: 1.45;
}
.kicker { letter-spacing: 0.04em; text-transform: uppercase; color: var(--mango); }
.sub { max-width: 34em; text-wrap: balance; }

/* ─────────── The pop ─────────── */

/* A word is a window: the overshoot is clipped by it, which gives the punch */
.word {
  display: inline-block;
  overflow: hidden;
  padding: 0.07em 0.03em 0.1em;
  margin: -0.07em -0.03em -0.1em;
  white-space: nowrap;
  vertical-align: top;
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

.ch {
  display: inline-block;
  transform: scale(0);
  transform-origin: 50% 100%;
  transition: transform 0.1s ease-in;
  transition-delay: calc(var(--d) * 0.25);
  will-change: transform;
}

.in .word {
  opacity: 1;
  transition: opacity 0.1s linear;
}

.in .ch {
  transform: scale(1);
  transition: transform 0.5s ease-out;
  transition-timing-function: var(--spring);
  transition-delay: var(--d);
}

/* ─────────── Controls ─────────── */

.poke {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.poke:focus-visible {
  outline: 2px solid var(--mango);
  outline-offset: 12px;
  border-radius: 12px;
}

.next {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 10;
  width: 52px;
  height: 52px;
  margin-left: -26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--mango);
  color: var(--grape);
  cursor: pointer;
  transition: transform 0.5s var(--spring), opacity 0.3s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.next:hover { transform: scale(1.12); }
.next:focus-visible { outline: 2px solid var(--cream); outline-offset: 3px; }
.next.is-hidden { opacity: 0; transform: scale(0); pointer-events: none; }

/* ─────────── Small screens ─────────── */

@media (max-width: 767px) {
  .line { font-size: 12.4vw; max-width: 100%; }
  .line--giant { font-size: 17vw; }
  .slide--hero .line:not(.line--giant) { font-size: 7.4vw; }
}

/* ─────────── Reduced motion: a plain fade, nothing bounces ─────────── */

@media (prefers-reduced-motion: reduce) {
  .ch,
  .in .ch {
    transform: none;
    transition: none;
  }
  .next { transition: opacity 0.3s linear; }
  .next:hover { transform: none; }
}
