:root {
  --page-bg: linear-gradient(182deg, #8a0005 0%, #ff9ebb 100%);
  --ink: #FFEDD9;
  --dark-grey: #423E38;
  --card: #fff7fb;
  --red: #8a0005;
  --wine: #5c0a14;
  --glow: rgba(255, 158, 187, 0.45);
}

/* makes the "hidden" attribute always win, whatever display an element has */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: "Petit Formal Script",cursive;
  font-weight: 400;
  font-size: 20px;
}

h2 {
  font-family: "Petit Formal Script", cursive;
  font-size: clamp(60px, 7vw, 48px);
  color: var(--ink);
  letter-spacing: 0.04em;
  line-height: 1.2;
}

img, video {
  display: block;
  max-width: 100%;
  width: 320px;
}

/* ---------- Each full-screen page ---------- */

#cover, .step {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding: 40px 20px;
  text-align: center;
  box-sizing: border-box;
}

/* The page gradient ends in pink, where cream text is hard to read,
   so the last page uses dark text instead. */
.step:last-of-type {
  color: var(--wine);
}

/* ---------- 1. Home ---------- */

#cover {
  background: radial-gradient(circle, #000000 0%, #8a0005 100%);
}

#start-btn {
  font: inherit;
  font-size: 24px;
  letter-spacing: 0.1em;
  color: var(--red);
  background: var(--ink);
  border: none;
  border-radius: 16px;
  padding: 14px 48px;
  box-shadow: 0 0 30px var(--glow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

#start-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 44px rgba(255, 158, 187, 0.7);
}

#start-btn:active {
  transform: translateY(1px);
  box-shadow: 0 0 18px rgba(255, 158, 187, 0.5);
}

/* the password bar that replaces the start button */
#gate {
  display: flex;
  gap: 8px;
  width: min(100%, 360px);
  padding: 8px;
  border-radius: 16px;
  box-sizing: border-box;
  background: var(--ink);
  box-shadow: 0 0 30px var(--glow);
  animation: open 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes open {
  from { transform: scaleX(0.4); opacity: 0; }
}

#gate input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 8px 14px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--dark-grey);
}

#gate input::placeholder { color: rgba(66, 62, 56, 0.55); }

#gate button {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 12px;
  background: var(--red);
  cursor: pointer;
  transition: transform 0.15s;
}

#gate button:hover { transform: translateX(3px); }

#gate button svg {
  width: 22px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* the "Not quite" message takes no space until it has text */
#message { margin: 0; }
#message:empty { display: none; }

/* the scroll prompt that appears after the right password */
#scroll-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: open 0.6s ease-out;
}

#scroll-hint {
  margin: 0;
  font-size: clamp(36px, 9vw, 64px);
  letter-spacing: 0.1em;
}

.arrow {
  width: 44px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linejoin: miter;
  animation: nudge 1.4s ease-in-out infinite;
}

@keyframes nudge {
  50% { transform: translateY(14px); }
}

/* ---------- 2. Intro: one word at a time, then the baby photo ---------- */

#intro-page {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.word {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Petit Formal Script", cursive;
  font-size: clamp(64px, 22vw, 200px);
  color: var(--ink);
  text-shadow: 4px 4px 0 #ff9ebb, 8px 8px 0 #5c0a14;
  opacity: 0;
}

#baby {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(70vw, 320px);
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.45));
  opacity: 0;
}

@keyframes turn {
  from { rotate: 0deg; }
  to   { rotate: 360deg; }
}

/* confetti sits beside the photo, behind the words, and spins the whole time */
.confet, .confet2 {
  position: absolute;
  z-index: 0;
  top: 50%;
  translate: 0 -50%;
  width: 110px;
  animation: turn 16s linear infinite;
}

.confet  { left:  calc(50% + min(35vw, 160px) + 20px); animation-direction: reverse; }
.confet2 { right: calc(50% + min(35vw, 160px) + 20px); }

/* words and photo stay in front of the confetti */
.word, #baby { z-index: 1; }

/* ---------- 3. Happy birthday page, with spinning sparkles ---------- */

#birthday {
  position: relative;
  overflow: hidden;
}

.spinner {
  position: absolute;
  width: 70px;
  fill: var(--ink);
  opacity: 0.85;
  animation: spin 10s linear infinite;
}

.sp1 { top: 6%; left: 8%; }
.sp2 { top: 4%; right: 8%; width: 110px; animation-duration: 16s; animation-direction: reverse; }
.sp3 { bottom: 12%; left: 14%; width: 50px; animation-duration: 6s; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Letters ---------- */

.paper {
  background: var(--card);
  color: var(--dark-grey);
  font-family: "Petit Formal Script", cursive;
  font-size: 26px;
  line-height: 1.5;
  max-width: 600px;
  padding: 36px;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(35, 25, 66, 0.25);
  text-align: left;
  transform: rotate(-1deg);
}

.paper h2 {
  margin-top: 0;
  color: var(--red);
}

/* the final letter: smaller text, and a list set in from the edge */
#next-year .paper {
  font-size: 20px;
}

#next-year ul {
  margin: 12px 0;
  padding-left: 1.8em;
}

#next-year li {
  margin-bottom: 6px;
}

/* ---------- Polaroid photos (they bring their own frame) ---------- */

.step img {
  width: min(86vw, 420px);
  filter: drop-shadow(0 12px 18px rgba(35, 25, 66, 0.3));
}
.step:nth-of-type(even) img { transform: rotate(2deg); }
.step:nth-of-type(odd) img { transform: rotate(-2deg); }

.step video {
  border-radius: 20px;
  width: min(92vw, 520px);
}

.caption {
  font-size: 28px;
  margin: 0;
}

/* ---------- Pop-in animation for anything with class "rv" ---------- */

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.5) translateY(30px);
  }
}

.rv {
  opacity: 0;
}

.rv.seen {
  opacity: 1;
  animation: pop 1s;
}

/* ---------- Phones ---------- */

@media (max-width: 520px) {
  body {
    font-size: 18px;
  }

  .paper {
    padding: 22px;
    font-size: 24px;
  }

  #next-year .paper {
    font-size: 18px;
  }

  .spinner { width: 46px; }
  .sp2 { width: 70px; }
  .sp3 { width: 34px; }
}
@media (max-width: 700px) {
  .confet, .confet2 { width: 80px; translate: none; }
  .confet  { left: auto; right: 8%; top: 10%; }
  .confet2 { right: auto; left: 8%; top: auto; bottom: 10%; }
}
