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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-family-base);
  background-color: var(--color-bg);
  background-image: var(--bg-gradient);
  color: var(--color-text-primary);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("assets/noise.svg");
  background-repeat: repeat;
  background-size: 120px 120px;
  opacity: var(--noise-opacity);
  pointer-events: none;
  mix-blend-mode: soft-light;
  z-index: 0;
}

h1,
p {
  margin: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.page-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  width: 100%;
}

.page {
  position: absolute;
  inset: 0;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: max(var(--gutter-mobile), env(safe-area-inset-left));
  padding-right: max(var(--gutter-mobile), env(safe-area-inset-right));
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  text-decoration: none;
  color: inherit;
  border: 0;
  background: transparent;
  font: inherit;
  transition: opacity var(--transition-fade) ease-out;
}

.page-trigger {
  cursor: pointer;
  appearance: none;
  text-align: inherit;
}

.page-trigger:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--color-focus);
}

.page-clarity {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: none;
}

body.is-leaving .page-confusion {
  opacity: 0;
  pointer-events: none;
}

body.is-clarity .page-confusion {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.is-clarity .page-clarity {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.is-pressed .hero--confusion {
  transform: translateY(var(--hero-shift)) scale(1.01);
}

.hero {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transform: translateY(var(--hero-shift));
  transition: transform 120ms ease;
}

.hero--confusion .hero__title {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: clamp(18px, 2.4vw, 28px);
  color: var(--color-text-primary);
  opacity: 0;
  transform: translateY(var(--rise-offset));
  animation: fadeUp var(--transition-entrance-short) ease forwards;
  animation-delay: 120ms;
}

.hero__graphic {
  width: clamp(240px, 38vw, 420px);
  margin-top: var(--gap-title-graphic-mobile);
}

.scribble {
  width: 100%;
  height: auto;
  object-fit: contain;
  background: transparent;
  border: 0;
  shape-rendering: geometricPrecision;
}

.hero__cta {
  margin-top: var(--gap-graphic-cta-mobile);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 13px;
  color: var(--color-text-secondary);
  opacity: 0;
  animation-name: fadeIn, pulseOpacity;
  animation-duration: var(--transition-entrance-short), 2.4s;
  animation-timing-function: ease, ease-in-out;
  animation-delay: 900ms, 1200ms;
  animation-iteration-count: 1, infinite;
  animation-fill-mode: forwards, none;
}

.hero__handle {
  margin-top: 10px;
  font-size: 11px;
  color: var(--color-text-secondary);
  opacity: 0;
  animation: handleFade var(--transition-entrance-short) ease forwards;
  animation-delay: 1080ms;
}

.hero--clarity .hero__headline {
  font-size: clamp(22px, 6vw, 56px);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.05;
  opacity: 0;
  transform: translateY(var(--rise-offset));
}

.hero__headline-text {
  display: inline-block;
}

.hero--clarity .hero__subtitle {
  margin-top: var(--gap-headline-subtitle);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  opacity: 0;
  transform: translateY(var(--rise-offset));
}

.hero--clarity .cta-group {
  margin-top: var(--gap-subtitle-cta);
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 28px;
  background: var(--color-text-primary);
  color: var(--color-bg);
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 600;
  font-size: 16px;
  border-radius: var(--radius-pill);
  border: 0;
  transition: transform var(--transition-fast) ease, box-shadow var(--transition-fast) ease;
}

.cta:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 4px;
}

@media (hover: hover) and (pointer: fine) {
  .cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px var(--shadow-strong);
  }
}

@media (hover: none) {
  .cta:active {
    transform: scale(0.98);
    transition-duration: 120ms;
  }
}

body.is-clarity .hero__headline {
  animation: riseIn var(--transition-entrance) ease forwards;
  animation-delay: 0ms;
}

body.is-clarity .hero__subtitle {
  animation: riseIn var(--transition-entrance) ease forwards;
  animation-delay: 90ms;
}

body.is-clarity .cta {
  opacity: 0;
  transform: translateY(var(--rise-offset));
  animation: riseIn var(--transition-entrance) ease forwards;
  animation-delay: 180ms;
}

.type-cursor {
  display: inline-block;
  width: 1px;
  height: 1em;
  margin-left: 4px;
  background: var(--color-text-primary);
  vertical-align: -0.08em;
  animation: blink 600ms steps(1, end) infinite;
}

.type-cursor--done {
  opacity: 0;
  animation: none;
}

@media (min-width: 768px) {
  .page {
    padding-left: max(var(--gutter-desktop), env(safe-area-inset-left));
    padding-right: max(var(--gutter-desktop), env(safe-area-inset-right));
  }

  .hero__graphic {
    margin-top: var(--gap-title-graphic-desktop);
  }

  .hero__cta {
    margin-top: var(--gap-graphic-cta-desktop);
    font-size: 14px;
  }

  .hero--clarity .hero__subtitle {
    font-size: 14px;
  }

  .cta {
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page {
    transition: none;
  }

  .hero--confusion .hero__title,
  body.is-clarity .hero__headline,
  body.is-clarity .hero__subtitle,
  body.is-clarity .cta {
    opacity: 1;
    transform: none;
    animation: none;
  }

  body.is-pressed .hero--confusion {
    transform: translateY(var(--hero-shift));
  }

  .hero__cta {
    opacity: 0.75;
    animation: none;
  }

  .hero__handle {
    opacity: 0.5;
    animation: none;
  }

  .type-cursor {
    animation: none;
    opacity: 0;
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(var(--rise-offset));
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(var(--rise-offset));
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.75;
  }
}

@keyframes pulseOpacity {
  0%,
  100% {
    opacity: 0.75;
  }
  50% {
    opacity: 1;
  }
}

@keyframes handleFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.5;
  }
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}
