* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Google Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  height: 100%;
  background: #000000;
}

main {
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-snap-stop: always;
}

section {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  scroll-snap-align: start;
  padding: 6vw;
  position: relative;
  overflow: hidden;
}

.section-1 {
  background: #000000;
}

.section-2 {
  background: #000000;
  padding: 5vh 5vw;
}

.section-3 {
  background: #000000;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: 0.02em;
  position: relative;
  z-index: 1;
}

.section-2-text {
  margin: 0;
  max-width: none;
  width: 100%;
  font-size: clamp(1.8rem, 2.6vw + 1.6vh, 5rem);
  line-height: 1.5;
  font-weight: 600;
  color: #ffffff;
  position: relative;
  z-index: 1;
}

.section-3-text {
  margin: 0;
  font-size: clamp(2rem, 6vw, 5rem);
  font-weight: 600;
  color: #ffffff;
  position: relative;
  z-index: 1;
}

/* Highlights are drawn with background gradients (not borders or flat
   backgrounds) so their size can be animated in. */
.highlight-underline {
  --line: #f1b61b;
  display: inline-block;
  line-height: 0.9;
  padding-bottom: calc(0.08em + 10px);
  background: linear-gradient(var(--line), var(--line)) no-repeat left bottom /
    100% 10px;
}

.highlight-underline-green {
  --line: #00a76a;
}

.highlight-accent,
.highlight-blue,
.highlight-purple,
.highlight-orange {
  background: linear-gradient(var(--hl), var(--hl)) no-repeat left center /
    100% 100%;
  color: #000000;
  padding: 0 0.2em;
}

.highlight-accent {
  --hl: #00a76a;
}

.highlight-blue {
  --hl: #50b0fd;
}

.highlight-purple {
  --hl: #8774e2;
}

.highlight-orange {
  --hl: #de5b2f;
}

/* Reveal animation, enabled by the script adding .is-animated. Words rise
   in one after another, then each highlight sweeps in behind its words. */
.section-2-text.is-animated .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.4em);
  filter: blur(8px);
  transition: opacity 0.6s ease, filter 0.6s ease,
    transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--i) * 45ms);
}

.section-2-text.is-animated.is-visible .word {
  opacity: 1;
  transform: none;
  filter: none;
}

.section-2-text.is-animated :is(
    .highlight-accent,
    .highlight-blue,
    .highlight-purple,
    .highlight-orange
  ) {
  --delay: calc(var(--i) * 45ms + 300ms);
  background-size: 0% 100%;
  color: #ffffff;
  transition: background-size 0.7s cubic-bezier(0.65, 0, 0.35, 1) var(--delay),
    color 0.3s ease calc(var(--delay) + 0.3s), transform 0.3s ease;
}

.section-2-text.is-animated.is-visible :is(
    .highlight-accent,
    .highlight-blue,
    .highlight-purple,
    .highlight-orange
  ) {
  background-size: 100% 100%;
  color: #000000;
}

.section-2-text.is-animated .highlight-underline {
  --delay: calc(var(--i) * 45ms + 400ms);
  transition: background-size 0.8s cubic-bezier(0.65, 0, 0.35, 1) var(--delay);
}

.section-2-text.is-animated .highlight-underline {
  background-size: 0% 10px;
}

.section-2-text.is-animated.is-visible .highlight-underline {
  background-size: 100% 10px;
}

/* Reset instantly when the section leaves, so it replays on return. */
.section-2-text.is-animated:not(.is-visible),
.section-2-text.is-animated:not(.is-visible) * {
  transition: none;
}

.section-2-text.is-animated.is-visible :is(
    .highlight-accent,
    .highlight-blue,
    .highlight-purple,
    .highlight-orange
  ):hover {
  transform: rotate(-2deg) scale(1.04);
}

.section-2-text :is(
    .highlight-accent,
    .highlight-blue,
    .highlight-purple,
    .highlight-orange
  ) {
  display: inline-block;
  line-height: 1.2;
}

.section-logo {
  position: relative;
  z-index: 1;
  width: min(18vw, 120px);
  height: auto;
  transform-origin: center center;
  animation: logo-swing 4s ease-in-out infinite;
}

.corner-label {
  position: absolute;
  bottom: 24px;
  font-size: 20px;
  font-weight: 400;
  z-index: 1;
  color: #ffffff;
}

.corner-left {
  left: 24px;
}

.corner-right {
  right: 24px;
}

@keyframes logo-swing {
  0% {
    transform: rotate(-22.5deg);
  }
  50% {
    transform: rotate(22.5deg);
  }
  100% {
    transform: rotate(-22.5deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .section-logo {
    animation: none;
  }
}
