:root {
  color-scheme: light;
  --paper: #f7f2e9;
  --card: #fffcf6;
  --ink: #4c2e50;
  --muted: #796c77;
  --pink: #edbcc4;
  --rose: #b84d70;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; }
body:has(dialog[open]) { overflow: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--rose); outline-offset: 5px; }
button { cursor: pointer; }
.page { min-height: 100svh; display: flex; flex-direction: column; padding: 0 5vw; }
.birthday-corners { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px 0; color: var(--rose); font-family: Georgia, "Times New Roman", serif; font-size: clamp(22px, 3vw, 30px); font-style: italic; line-height: 1.2; }
.landing { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 0 70px; }
.eyebrow { font-size: 10px; font-weight: 600; letter-spacing: 2px; line-height: 1.6; margin: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
h1 { font-size: clamp(52px, 7.5vw, 96px); line-height: 1.02; letter-spacing: -4px; margin: 24px 0 10px; }
h1 em { color: var(--rose); font-weight: 400; }
.landing-message { font-size: 14px; color: var(--muted); line-height: 1.7; margin: 16px 0 30px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 28px; padding: 15px 23px; min-height: 48px; border: 1px solid var(--ink); border-radius: 7px; font-size: 13px; font-weight: 500; transition: background-color 160ms ease, transform 160ms ease; }
.button:hover { transform: translateY(-2px); background: #634166; }
.button:active { transform: translateY(0); }
.primary { background: var(--ink); color: var(--card); }
.button span { font-size: 20px; line-height: 1; }
.page-footer { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 24px 0; font-size: 9px; letter-spacing: 1.8px; color: var(--muted); }

.birthday-card {
  --swing-scale: 1.02;
  --photo-angle: 5deg;
  position: fixed;
  inset: 0;
  width: min(860px, calc(100% - 64px));
  max-width: none;
  max-height: calc(100svh - 48px);
  margin: auto;
  padding: 0;
  border: 1px solid #e6d8d2;
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  overflow: auto;
  box-shadow: 0 24px 80px #412b4220;
}
.birthday-card[open] { display: grid; grid-template-columns: 1fr 1fr; animation: card-arrive 1200ms cubic-bezier(.22, .8, .3, 1) both; transform-origin: center center; }
.birthday-card[open] h2 { animation: birthday-cheer 750ms 230ms cubic-bezier(.22, .8, .3, 1) both; }
.birthday-card[open] .polaroid { animation: photo-party 950ms 280ms cubic-bezier(.22, .8, .3, 1) both; }
.birthday-card::backdrop { background: #f0e8dfed; }
.close-button { position: absolute; top: 15px; right: 15px; z-index: 3; display: grid; place-items: center; width: 40px; height: 40px; padding: 10px; border: 1px solid #4c2e502b; border-radius: 50%; color: var(--ink); background: #fffcf680; transition: background-color 160ms ease; }
.close-button:hover { background: var(--card); }
.close-button svg { width: 18px; height: 18px; }
.card-copy { padding: 52px 34px 39px 48px; position: relative; }
.card-copy .eyebrow { display: flex; align-items: center; gap: 9px; font-size: 9px; letter-spacing: 1.7px; }
.tiny-star { font-size: 20px; color: var(--rose); font-weight: 400; }
h2 { position: relative; width: fit-content; margin: 28px 0 22px; font-size: clamp(44px, 5.7vw, 64px); line-height: 1.02; letter-spacing: -2.7px; }
h2 em { display: inline-block; color: var(--rose); font-size: 1.48em; line-height: 1.12; font-weight: 400; letter-spacing: -5px; }
.title-star { position: absolute; right: -39px; bottom: 11px; color: var(--rose); font-size: 44px; transform: rotate(10deg); }
.wish-button { min-width: 177px; }
.wish-note { margin: 12px 0 0; font-size: 11px; color: var(--muted); line-height: 1.6; }
.card-photo-panel { background: var(--pink); position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 76px 32px 52px; overflow: hidden; }
.polaroid { width: 100%; margin: 0; background: var(--card); padding: 11px 11px 0; transform: rotate(5deg); box-shadow: 0 7px 20px #6b3c5220; }
.polaroid img { display: block; width: 100%; height: auto; }
.polaroid figcaption { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 15px 0 18px; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 20px; font-style: italic; text-align: center; line-height: 1.3; }
.photo-note { font-size: 10px; letter-spacing: 1px; color: #714955; text-align: center; margin: 35px 0 0; }
.photo-star { position: absolute; color: var(--ink); z-index: 1; line-height: 1; }
.star-one { top: 44px; left: 25px; font-size: 48px; transform: rotate(-10deg); }
.star-two { right: 12px; bottom: 67px; font-size: 58px; }
.pink-sparkle { display: block; width: 1em; height: 1em; flex-shrink: 0; color: var(--rose); }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: inherit; z-index: 5; }
.confetti-piece { position: absolute; left: var(--x); top: 62%; width: 8px; height: 15px; background: var(--color); animation: confetti-burst var(--duration) var(--delay) linear both; }
.confetti-piece:nth-child(3n) { border-radius: 50%; width: 9px; height: 9px; }
.confetti-piece:nth-child(5n) { width: 6px; height: 23px; }
@keyframes card-arrive {
  0% { opacity: 0; transform: translateY(45vh) scale(.22, .3) rotate(-18deg); }
  30% { opacity: 1; transform: translateY(-24px) scale(.88, .96) rotate(8deg); }
  46% { opacity: 1; transform: translateY(10px) scale(var(--swing-scale), .94) rotate(-6deg); }
  62% { transform: translateY(-12px) scale(.95, 1.01) rotate(4deg); }
  76% { transform: translateY(5px) scale(.98) rotate(-2.5deg); }
  89% { transform: translateY(-3px) scale(1) rotate(1.2deg); }
  100% { opacity: 1; transform: translate(0, 0) scale(1) rotate(0deg); }
}
@keyframes birthday-cheer {
  0% { opacity: 0; transform: translateY(20px) scale(.65) rotate(-5deg); }
  60% { opacity: 1; transform: translateY(-4px) scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}
@keyframes photo-party {
  0% { opacity: 0; transform: translateY(45px) scale(.7) rotate(-16deg); }
  48% { opacity: 1; transform: translateY(-12px) scale(1.03) rotate(10deg); }
  72% { opacity: 1; transform: translateY(5px) scale(.98) rotate(-3deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(var(--photo-angle)); }
}
@keyframes confetti-burst {
  0% { opacity: 0; transform: translate(0, 0) scale(.2) rotate(var(--spin)); animation-timing-function: cubic-bezier(.12, .65, .35, 1); }
  8% { opacity: 1; }
  38% { opacity: 1; transform: translate(var(--burst-x), var(--burst-y)) scale(1) rotate(calc(var(--spin) + 240deg)); animation-timing-function: cubic-bezier(.55, .05, .9, .5); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(var(--burst-x) * 1.35), var(--fall)) scale(.8) rotate(calc(var(--spin) + 720deg)); }
}

@media (max-width: 650px) {
  .page { padding: 0 24px; }
  .birthday-corners { padding: 22px 0; }
  h1 { letter-spacing: -2.5px; }
  .landing-message { max-width: 240px; }
  .birthday-card { --swing-scale: .9; --photo-angle: 4deg; width: min(400px, calc(100% - 32px)); max-height: calc(100svh - 32px); border-radius: 13px; }
  .birthday-card[open] { grid-template-columns: 1fr; }
  .card-copy { padding: 44px 24px 23px; text-align: center; }
  .card-copy .eyebrow { justify-content: center; font-size: 8px; letter-spacing: 1.4px; }
  .tiny-star { font-size: 17px; }
  h2 { margin: 13px auto 10px; font-size: clamp(29px, 10.2vw, 40px); line-height: .98; letter-spacing: -1.8px; }
  h2 br:first-of-type { display: none; }
  h2 em { font-size: 1.5em; letter-spacing: -3px; line-height: 1.1; }
  .title-star { font-size: 30px; right: 12px; bottom: 6px; }
  .wish-button { min-height: 44px; padding: 11px 20px; font-size: 12px; }
  .wish-note { font-size: 10px; margin-top: 8px; }
  .card-photo-panel { padding: 28px 48px 23px; }
  .polaroid { max-width: 245px; padding: 8px 8px 0; transform: rotate(4deg); }
  .polaroid figcaption { font-size: 17px; padding: 10px 0 11px; }
  .photo-note { margin-top: 21px; font-size: 9px; }
  .star-one { left: 21px; top: 17px; font-size: 32px; }
  .star-two { right: 21px; bottom: 30px; font-size: 40px; }
  .close-button { top: 8px; right: 8px; width: 44px; height: 44px; padding: 12px; background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}
