@font-face {
  font-family: 'Kalam';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/kalam-regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Kalam';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/kalam-bold.woff2') format('woff2');
}

@font-face {
  font-family: 'Patrick Hand';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/patrick-hand.woff2') format('woff2');
}

/* ---------- Variables ---------- */
:root {
  --color-cream: #FDF3EC;
  --color-blush: #FADCE3;
  --color-pink: #F2A6B8;
  --color-rose-deep: #B75876;
  --color-gold: #E8C468;
  --color-gold-deep: #D9A84E;
  --color-lavender: #C9A7EB;
  --color-ink: #4A2E39;
  --color-ink-muted: #8A6470;

  --font-heading: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-note: 'Kalam', "Bradley Hand", cursive, var(--font-heading);
  --font-date: 'Patrick Hand', "Bradley Hand", cursive, var(--font-body);

  --card-max-width: 480px;
}

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

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-note);
  color: var(--color-ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 0%, #FFF8F3 0%, #FDF3EC 45%, #FBE1E8 100%);
}

h1, h2, h3, p { margin: 0; }
button { font: inherit; }

#app {
  position: relative;
  display: grid;
  width: 100%;
  max-width: var(--card-max-width);
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at 30% 0%, #FFFDFB 0%, #FDF3EC 55%, #FBE3E9 100%);
}

@media (min-width: 700px) {
  #app {
    height: min(860px, 92dvh);
    border-radius: 28px;
    box-shadow: 0 30px 60px -20px rgba(120, 60, 70, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
    overflow: hidden;
  }
}

.ambient-decor {
  grid-area: 1 / 1;
  z-index: 0;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.drift {
  position: absolute;
  color: var(--color-pink);
  opacity: 0.3;
  animation: drift-float 10s ease-in-out infinite;
}

@keyframes drift-float {
  0%, 100% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0.2; }
  50% { transform: translateY(-18px) translateX(8px) rotate(8deg); opacity: 0.45; }
}

.progress-dots {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(env(safe-area-inset-top) + 0.9rem);
  z-index: 6;
  display: flex;
  gap: 0.5rem;
  pointer-events: none;
}

.progress-dots__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-ink);
  opacity: 0.2;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
}

.progress-dots__dot.is-current {
  opacity: 0.9;
  background: var(--color-rose-deep);
  transform: scale(1.3);
}

.easter-egg-trigger {
  appearance: none;
  position: absolute;
  left: 12%;
  top: 10%;
  z-index: 6;
  background: none;
  border: none;
  padding: 0.5rem;
  font-size: 1.4rem;
  color: var(--color-pink);
  opacity: 0.3;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  animation: drift-float 9s ease-in-out infinite;
}

.easter-egg-trigger:focus-visible {
  outline: 3px solid var(--color-gold);
  outline-offset: 2px;
  border-radius: 50%;
}

.screen {
  grid-area: 1 / 1;
  z-index: 1;
  position: relative;
  height: 100vh;
  height: 100dvh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.screen.is-active {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 700px) {
  .screen { height: 100%; }
}

.screen:has(.bloom-anchor:not([hidden])) {
  overflow: hidden;
}

.screen__inner {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  text-align: center;
  padding: calc(env(safe-area-inset-top) + 2.5rem) calc(env(safe-area-inset-right) + 1.75rem)
           calc(env(safe-area-inset-bottom) + 2.5rem) calc(env(safe-area-inset-left) + 1.75rem);
}

@media (min-width: 700px) {
  .screen__inner { min-height: 0; height: 100%; }
}

.eyebrow {
  letter-spacing: 0.02em;
  font-size: 0.9rem;
  color: var(--color-ink-muted);
}

h1, h2, h3 {
  font-family: var(--font-note);
  font-weight: 700;
  color: var(--color-rose-deep);
  line-height: 1.15;
}

h1 { font-size: clamp(1.9rem, 5vw + 1rem, 2.9rem); }
h2 { font-size: clamp(1.6rem, 4vw + 1rem, 2.4rem); }
h3 { font-size: clamp(1.05rem, 2vw + 0.9rem, 1.35rem); margin-top: 0.75rem; }

p {
  font-size: clamp(1rem, 1.2vw + 0.85rem, 1.2rem);
  line-height: 1.5;
  max-width: 34ch;
}

.intro-text,
.timeline__caption,
.birthday-message,
.lightbox__caption {
  font-size: clamp(1.1rem, 1.8vw + 0.9rem, 1.35rem);
  line-height: 1.45;
}

.signature {
  margin-top: 1rem;
  font-size: clamp(1.15rem, 1.6vw + 0.9rem, 1.3rem);
  font-weight: 700;
  color: var(--color-ink-muted);
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 0.9rem 1.75rem;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 600;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn--primary {
  background: var(--color-rose-deep);
  color: #fff;
  box-shadow: 0 10px 20px -8px rgba(183, 88, 118, 0.55);
}

.btn--secondary {
  background: transparent;
  color: var(--color-rose-deep);
  box-shadow: inset 0 0 0 2px var(--color-pink);
}

.btn:active { transform: scale(0.97); }

.btn:focus-visible {
  outline: 3px solid var(--color-gold);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 26px -8px rgba(183, 88, 118, 0.6);
  }
  .btn--secondary:hover {
    background: rgba(242, 166, 184, 0.15);
  }
}

.reveal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

.reveal-content .btn { margin-top: 1rem; }

.timeline__list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  align-self: stretch;
  text-align: left;
}

.timeline__list::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--color-blush);
}

.timeline__item {
  position: relative;
  padding-left: 1.75rem;
  padding-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline__item:last-child { padding-bottom: 0; }

.timeline__item.is-visible {
  opacity: 1;
  transform: none;
}

.timeline__dot {
  position: absolute;
  left: 0;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-rose-deep);
  box-shadow: 0 0 0 4px var(--color-cream), 0 0 0 5px var(--color-blush);
}

.timeline__date {
  font-family: var(--font-date);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--color-ink-muted);
  margin-bottom: 0.15rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.lightbox[hidden] { display: none; }

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(74, 46, 57, 0.72);
}

.lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(340px, 86vw);
  background: var(--color-cream);
  border-radius: 20px;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.4);
  animation: lightbox-in 0.25s ease;
  text-align: center;
}

.lightbox__panel .eyebrow { margin-bottom: 0.5rem; }

@keyframes lightbox-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.lightbox__caption {
  margin: 0;
  text-align: center;
  color: var(--color-ink);
  max-width: none;
}

.lightbox__close {
  appearance: none;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(74, 46, 57, 0.08);
  color: var(--color-ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.lightbox__close:focus-visible {
  outline: 3px solid var(--color-gold);
  outline-offset: 2px;
}

.stat-strip {
  align-self: stretch;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  max-width: 280px;
  margin-inline: auto;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.9rem 0.4rem;
  border-radius: 14px;
  background: var(--color-blush);
}

.stat-tile__value {
  font-size: clamp(1.5rem, 4vw + 0.5rem, 1.9rem);
  font-weight: 700;
  color: var(--color-rose-deep);
  line-height: 1.1;
  max-width: none;
}

.stat-tile__label {
  font-size: 0.75rem;
  color: var(--color-ink-muted);
  text-align: center;
  line-height: 1.25;
  max-width: none;
}

.reveal-content--pop-in {
  opacity: 0;
  transform: scale(0.8) translateY(10px);
}

.reveal-content--pop-in.is-revealed {
  animation: content-pop-in 0.6s cubic-bezier(.2, .9, .3, 1.2) forwards;
}

@keyframes content-pop-in {
  0% { opacity: 0; transform: scale(0.8) translateY(10px); }
  60% { opacity: 1; transform: scale(1.03) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.bloom-anchor {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.bloom-anchor[hidden] {
  display: none;
}

.bloom-anchor__glyph {
  font-size: clamp(3rem, 16vw, 4.5rem);
  color: var(--color-rose-deep);
  line-height: 1;
}

@keyframes bloom-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.15); opacity: 1; }
}

.bloom-anchor--pulse .bloom-anchor__glyph {
  animation: bloom-pulse 0.6s ease-in-out 2;
}

@keyframes bloom-pop {
  0% { transform: scale(1); opacity: 1; }
  40% { transform: scale(1.6); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

.bloom-anchor--pop .bloom-anchor__glyph {
  animation: bloom-pop 0.4s ease-out forwards;
}

.bloom-piece {
  position: absolute;
  top: 0;
  left: 0;
  font-size: var(--size, 18px);
  color: var(--color, var(--color-pink));
  line-height: 1;
  transform: translate(-50%, -50%);
  animation: bloom-burst var(--duration, 1300ms) ease-out var(--delay, 0ms) forwards;
  will-change: transform, opacity;
}

@keyframes bloom-burst {
  0%   { opacity: 0; transform: translate(-50%, -50%) translate(0, 0) rotate(0) scale(0.4); }
  12%  { opacity: 1; transform: translate(-50%, -50%) translate(calc(var(--dx) * 0.3), calc(var(--dy) * 0.3)) rotate(calc(var(--rot) * 0.2)) scale(1.1); }
  60%  { opacity: 1; transform: translate(-50%, -50%) translate(calc(var(--dx) * 0.85), calc(var(--dy) * 0.85)) rotate(calc(var(--rot) * 0.7)) scale(0.95); }
  100% { opacity: 0; transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.75); }
}

#confetti-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 9999;
}

.confetti-piece {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--size, 8px);
  height: calc(var(--size, 8px) * 0.4);
  background: var(--color, #F2A6B8);
  border-radius: 2px;
  transform: translate(-50%, -50%);
  animation: confetti-burst var(--duration, 1200ms) ease-out var(--delay, 0ms) forwards;
  will-change: transform, opacity;
}

@keyframes confetti-burst {
  0%   { opacity: 1; transform: translate(-50%, -50%) translate(0, 0) rotate(0); }
  30%  { opacity: 1; transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) rotate(calc(var(--rot) * 0.4)); }
  100% { opacity: 0; transform: translate(-50%, -50%) translate(calc(var(--dx) * 1.15), calc(var(--dy) + var(--fall))) rotate(var(--rot)); }
}
