:root {
  --paper: #f7f4ef;
  --ink: #171717;
  --muted: rgba(23, 23, 23, 0.66);
  --glass: rgba(255, 255, 255, 0.72);
  --line: rgba(23, 23, 23, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: #050505;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.is-locked {
  overflow: hidden;
}

body.video-mode {
  overflow: auto;
}

body.birthday-started .hero {
  display: none;
}

button {
  font: inherit;
}

.hero {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(14px, 3vw, 26px);
  min-height: 100svh;
  overflow: hidden;
  background: var(--paper);
  isolation: isolate;
}

.hero::after {
  content: none;
}

.hero__image {
  position: relative;
  grid-row: 1;
  align-self: stretch;
  justify-self: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  object-position: center;
}

.intro-text {
  position: absolute;
  top: clamp(14px, 4vw, 42px);
  right: clamp(14px, 5vw, 58px);
  z-index: 2;
  width: min(430px, calc(100% - 28px));
  min-height: 0;
  margin: 0;
  padding: clamp(14px, 2.4vw, 22px);
  color: var(--ink);
  text-align: right;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 20px;
  backdrop-filter: blur(14px);
}

.intro-text p {
  display: inline;
  margin: 0;
  font-size: clamp(1.08rem, 2.35vw, 2rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: 0;
}

.intro-text__line {
  min-height: 1.1em;
}

.typing-cursor {
  display: inline-block;
  width: 0.12em;
  height: 1.1em;
  margin-left: 0.08em;
  translate: 0 0.13em;
  background: var(--ink);
  animation: blink 0.8s steps(1) infinite;
}

.hero__actions {
  margin-top: 16px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 240ms ease, transform 240ms ease;
}

.hero__actions.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.main-button {
  min-height: 48px;
  padding: 0 22px;
  color: #f9f9f7;
  background: #111;
  border: 1px solid #111;
  border-radius: 999px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}

.main-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.main-button:not(:disabled):hover {
  transform: translateY(-2px);
  background: #000;
}

.main-button:not(:disabled):active {
  transform: translateY(0);
}

.stop-flash {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background: #000;
}

.stop-flash img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transform: scale(0.72);
  filter: saturate(1.1) contrast(1.04);
}

.stop-flash.is-active {
  visibility: visible;
  animation: flashFade 1400ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.stop-flash.is-active img {
  animation: imageFly 1400ms cubic-bezier(0.08, 0.82, 0.18, 1) forwards;
}

.passcode-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(22px, 5vw, 52px);
  overflow: auto;
  color: #fff;
  background:
    radial-gradient(circle at 18% 62%, rgba(142, 106, 187, 0.44), transparent 22%),
    radial-gradient(circle at 74% 18%, rgba(129, 89, 166, 0.42), transparent 24%),
    radial-gradient(circle at 54% 84%, rgba(122, 116, 111, 0.28), transparent 26%),
    #050505;
  opacity: 0;
  visibility: hidden;
  transition: opacity 520ms ease, visibility 520ms ease;
}

.passcode-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(22px);
}

.passcode-screen.is-visible {
  opacity: 1;
  visibility: visible;
}

.passcode-screen.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.passcode {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(560px, 100%);
  justify-items: center;
}

.passcode h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.1rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0;
  text-align: center;
}

.passcode__dots {
  display: grid;
  grid-template-columns: repeat(4, 20px);
  gap: clamp(18px, 5vw, 34px);
  margin: 30px 0 clamp(56px, 8vw, 82px);
}

.passcode__dots span {
  width: 20px;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  transition: background 120ms ease, transform 120ms ease;
}

.passcode__dots span.is-filled {
  background: #fff;
  transform: scale(0.88);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 116px));
  gap: clamp(20px, 4.5vw, 32px);
  justify-content: center;
}

.keypad button {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  align-content: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 120ms ease, background 120ms ease;
}

.keypad button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.keypad button:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.28);
}

.keypad span {
  font-size: clamp(2.8rem, 10vw, 4.6rem);
  font-weight: 400;
  line-height: 0.9;
}

.keypad small {
  margin-top: 8px;
  font-size: clamp(0.74rem, 2.5vw, 1.05rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.keypad__zero {
  grid-column: 2;
}

.video-screen {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
  background: #000;
}

.video-screen[hidden] {
  display: none;
}

.birthday-video {
  width: 100%;
  height: 100svh;
  object-fit: contain;
  background: #000;
}

.sound-start {
  position: absolute;
  left: 50%;
  top: 50%;
  min-height: 54px;
  padding: 0 24px;
  color: #111;
  background: rgba(255, 255, 255, 0.88);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
  backdrop-filter: blur(14px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.sound-start[hidden] {
  display: none;
}

.sound-start.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: clamp(20px, 5vw, 42px);
  display: grid;
  width: 54px;
  aspect-ratio: 1;
  place-items: center;
  padding: 0;
  color: #fff;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  backdrop-filter: blur(12px);
  transition: opacity 320ms ease, transform 320ms ease, background 180ms ease;
  animation: cueBounce 1100ms ease-in-out infinite;
}

.scroll-cue[hidden] {
  display: none;
}

.scroll-cue.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.scroll-cue:hover {
  background: rgba(0, 0, 0, 0.5);
}

.scroll-cue span {
  width: 16px;
  height: 16px;
  border-right: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
}

.after-video {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(18px, 5vw, 72px);
  color: #f8f8f8;
  background:
    linear-gradient(rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0.76)),
    url("assets/disco-party-bg.png") center top / cover fixed,
    #050505;
  overflow: hidden;
}

.after-video[hidden] {
  display: none;
}

.birthday-sections {
  position: relative;
  z-index: 1;
  display: grid;
  gap: clamp(64px, 12vw, 150px);
  width: min(1180px, 100%);
}

.birthday-land {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 70px);
  width: min(1180px, 100%);
  align-items: center;
}

.birthday-land--reverse .birthday-land__photo {
  grid-column: 2;
  grid-row: 1;
}

.birthday-land--reverse .birthday-land__copy {
  grid-column: 1;
  grid-row: 1;
}

.birthday-land__photo {
  margin: 0;
  min-width: 0;
}

.birthday-land__photo img {
  display: block;
  width: 100%;
  max-height: min(780px, 82svh);
  object-fit: contain;
  border-radius: 28px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
}

.birthday-land__copy {
  min-width: 0;
  max-width: 620px;
}

.birthday-land__kicker {
  margin: 0 0 18px;
  color: rgba(255, 255, 255, 0.58);
  font-size: clamp(0.86rem, 2vw, 1rem);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.birthday-land h1 {
  margin: 0;
  color: #fff;
  max-width: 100%;
  font-size: clamp(2.35rem, 6.2vw, 5.6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.birthday-land p:not(.birthday-land__kicker) {
  margin: 28px 0 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: clamp(1.08rem, 2.1vw, 1.6rem);
  font-weight: 500;
  line-height: 1.42;
}

.birthday-gallery {
  width: min(1180px, 100%);
  overflow: hidden;
  padding: clamp(24px, 5vw, 58px) 0 0;
}

.birthday-gallery h1 {
  margin: 0 0 clamp(26px, 5vw, 48px);
  color: #fff;
  font-size: clamp(3rem, 10vw, 8rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: 0;
  text-align: center;
}

.gallery-marquee {
  width: 100%;
  overflow: hidden;
}

.gallery-track {
  display: flex;
  width: max-content;
  gap: clamp(14px, 2vw, 24px);
  animation: galleryRun 34s linear infinite;
}

.gallery-track img {
  width: clamp(210px, 28vw, 360px);
  height: clamp(280px, 38vw, 480px);
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes galleryRun {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(calc(-50% - clamp(7px, 1vw, 12px)));
  }
}

@keyframes imageFly {
  0% {
    transform: scale(0.72);
  }

  18% {
    transform: scale(0.98);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes flashFade {
  0% {
    opacity: 0;
  }

  8%,
  54% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes cueBounce {
  0%,
  100% {
    translate: 0 0;
  }

  50% {
    translate: 0 8px;
  }
}

@media (max-width: 760px) {
  .hero {
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
  }

  .hero::after {
    content: none;
  }

  .hero__image {
    object-position: center;
  }

  .intro-text {
    top: 14px;
    right: 14px;
    width: min(270px, calc(100% - 28px));
    border-radius: 18px;
  }

  .hero__actions {
    margin-top: 14px;
  }

  .main-button {
    width: 100%;
  }

  .passcode-screen {
    align-items: start;
    padding-top: clamp(64px, 10svh, 92px);
  }

  .passcode__dots {
    grid-template-columns: repeat(4, 16px);
    gap: 22px;
    margin: 26px 0 54px;
  }

  .passcode__dots span {
    width: 16px;
  }

  .keypad {
    grid-template-columns: repeat(3, minmax(74px, 96px));
    gap: 24px;
  }

  .after-video {
    align-items: start;
    padding: 18px 16px 48px;
  }

  .birthday-land {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .birthday-land--reverse .birthday-land__photo,
  .birthday-land--reverse .birthday-land__copy {
    grid-column: auto;
    grid-row: auto;
  }

  .birthday-land__photo img {
    max-height: 58svh;
    border-radius: 20px;
  }

  .birthday-land h1 {
    font-size: clamp(2.5rem, 14vw, 4.4rem);
  }

  .birthday-land p:not(.birthday-land__kicker) {
    font-size: 1.08rem;
  }
}

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

  .typing-cursor {
    animation: none;
  }

  .main-button,
  .sound-start,
  .keypad button,
  .passcode-screen,
  .passcode__dots span,
  .hero__actions {
    transition: none;
  }

  .stop-flash.is-active,
  .stop-flash.is-active img,
  .scroll-cue {
    animation-duration: 1ms;
  }
}
