:root {
  --rose: #e9b9bb;
  --rose-light: #f9e1e0;
  --blush: #f8d7d8;
  --gold: #c9a244;
  --gold-light: #ecd98e;
  --ink: #725142;
  --paper-shadow: rgba(85, 54, 50, .25);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  min-width: 320px;
  color: var(--ink);
  background: radial-gradient(circle at 17% 17%, #fff 0 4%, transparent 28%), #e9ece7;
  font-family: "DM Sans", Arial, sans-serif;
  overflow-x: hidden;
  transition: background .6s ease;
}
body.is-card-active { background: radial-gradient(circle at 17% 17%, #fff6f4 0 4%, transparent 28%), #f2dada; }
button { font: inherit; }
.experience { min-height: 100svh; display: grid; place-items: center; padding: 24px; }

.language-screen { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #eef0eb, #e2e6df); transition: opacity .55s ease, visibility .55s ease; }
.language-screen::before, .language-screen::after { content: "✦"; position: absolute; color: rgba(151,130,80,.18); font: 14rem/1 Georgia, serif; }
.language-screen::before { left: -6rem; bottom: -4rem; }
.language-screen::after { right: -4rem; top: -5rem; transform: rotate(-13deg); }
.language-screen.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }
.language-panel { z-index: 1; width: min(430px, 100%); padding: clamp(42px, 8vw, 64px) 36px; text-align: center; border: 1px solid rgba(151,130,80,.35); border-radius: 28px; background: rgba(255,255,255,.5); box-shadow: 0 22px 55px rgba(68,79,69,.12); backdrop-filter: blur(8px); }
.gold-heart { color: var(--gold); font: 3.8rem/1 Georgia, serif; }
.eyebrow { margin: 18px 0 2px; letter-spacing: .13em; font-size: .76rem; text-transform: uppercase; }
.language-panel h1 { margin: 0; color: #685e4a; font: 600 clamp(3.2rem, 14vw, 4.3rem)/.9 "Cormorant Garamond", Georgia, serif; }
.language-prompt { margin: 34px 0 17px; font: 500 1.1rem "Cormorant Garamond", Georgia, serif; }
.language-buttons { display: grid; gap: 10px; }
.language-buttons button { cursor: pointer; padding: 13px 18px; border: 1px solid rgba(201,162,68,.6); border-radius: 999px; color: var(--ink); background: rgba(255,255,255,.52); transition: transform .2s, color .2s, background .2s; }
.language-buttons button:hover, .language-buttons button:focus-visible { outline: none; color: #fffaf2; background: var(--gold); transform: translateY(-2px); }

.card-stage { width: 100%; display: grid; justify-items: center; opacity: 1; transform: translateY(0); transition: opacity .45s ease .18s, transform .45s ease .18s; }
.card-stage.is-hidden { opacity: 0; transform: translateY(12px); pointer-events: none; }
.card-shell { width: min(82vw, 470px); aspect-ratio: 1 / 1; perspective: 1800px; transition: width .72s cubic-bezier(.22,.86,.28,1), aspect-ratio .72s cubic-bezier(.22,.86,.28,1); }
.card-shell.is-open { width: min(88vw, 960px); aspect-ratio: 2 / 1; }
.book { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; filter: drop-shadow(0 25px 25px rgba(93, 59, 58, .22)); }
.page { position: absolute; top: 0; width: 50%; height: 100%; overflow: hidden; border: 1px solid rgba(255,255,255,.5); background-color: var(--rose-light); border-radius: 16px 0 0 16px; backface-visibility: hidden; }
.page::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .65; background: repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 1px, transparent 1px 4px), linear-gradient(145deg, rgba(255,255,255,.32), transparent 52%); mix-blend-mode: overlay; }
.inside-page { z-index: 2; display: grid; place-items: stretch; opacity: 0; visibility: hidden; background: linear-gradient(180deg, #f8d9d9, #edc3c5); transition: opacity .25s ease .34s, visibility 0s linear .65s; }
.card-shell.is-open .inside-page { opacity: 1; visibility: visible; transition-delay: .29s, 0s; }
.inside-left { left: 0; box-shadow: inset -14px 0 25px rgba(113,74,78,.11); }
.inside-right { right: 0; border-radius: 0 16px 16px 0; box-shadow: inset 14px 0 25px rgba(113,74,78,.11); }
.inside-left::after, .inside-right::after, .cover-front::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 39%; pointer-events: none; opacity: .94; background: radial-gradient(ellipse at 7% 80%, #fff5e7 0 1.1%, transparent 1.4%), radial-gradient(ellipse at 15% 55%, #d2a342 0 1%, transparent 1.55%), radial-gradient(ellipse at 26% 78%, #fff2e9 0 .8%, transparent 1.2%), radial-gradient(ellipse at 38% 52%, #e1ba76 0 1.4%, transparent 2%), radial-gradient(ellipse at 52% 74%, #fff6e9 0 1.2%, transparent 1.6%), radial-gradient(ellipse at 68% 58%, #c89e3e 0 1%, transparent 1.6%), radial-gradient(ellipse at 81% 78%, #fff0e8 0 1.3%, transparent 1.8%), radial-gradient(ellipse at 93% 48%, #e4b75e 0 .9%, transparent 1.5%), linear-gradient(transparent, rgba(142, 99, 107, .35)); background-size: 165px 130px, 180px 110px, 142px 110px, 200px 125px, 155px 130px, 180px 105px, 210px 150px, 170px 135px, 100% 100%; }
.page-content { position: relative; z-index: 1; height: 100%; padding: clamp(18px, 3vw, 42px); text-align: center; }
.announcement-content { display: flex; flex-direction: column; align-items: center; }
.announcement { margin: 6% 0 0; font: 500 clamp(.82rem, 1.6vw, 1.55rem)/1.3 "Cormorant Garamond", Georgia, serif; }
.script-name { margin: 7% 0 0; color: #75543e; font: clamp(2.3rem, 5vw, 5.5rem)/.78 "Italianno", cursive; font-weight: 400; }
.script-name span { white-space: nowrap; }
.parents { z-index: 2; margin: 5% 0 1%; font: 500 clamp(.72rem, 1.4vw, 1.25rem)/1.35 "Cormorant Garamond", Georgia, serif; }
.parents strong { font-weight: 500; }
.photo-slot { position: relative; z-index: 2; display: grid; place-items: center; width: min(56%, 225px); aspect-ratio: 1.6 / 1; margin: 4% 0 0; border: 1.5px solid rgba(201,162,68,.75); border-radius: 16px; color: rgba(112,80,67,.7); background: rgba(255,249,246,.52); box-shadow: 0 7px 12px rgba(116,74,79,.12), inset 0 0 0 6px rgba(255,255,255,.23); font: clamp(.6rem, 1vw, .85rem) "Cormorant Garamond", Georgia, serif; }
.details-content { display: flex; flex-direction: column; align-items: center; }
.large-heart { position: absolute; top: 7%; font: clamp(8rem, 20vw, 16rem)/.7 Georgia, serif; color: rgba(255,252,249,.8); }
.detail-name { z-index: 1; margin: 28% 0 0; color: var(--gold); font: 600 clamp(3.8rem, 8vw, 7rem)/.8 "Cormorant Garamond", Georgia, serif; }
.leaf-divider { z-index: 1; display: flex; align-items: center; justify-content: center; gap: .22em; color: var(--gold); font-size: clamp(.85rem, 2vw, 1.8rem); letter-spacing: -.2em; }
.leaf-divider span:nth-child(3) { margin: 0 .28em; font: 1.15em Georgia, serif; letter-spacing: 0; }
.birth-date { z-index: 1; margin: 7% 0 0; font: 500 clamp(.8rem, 1.7vw, 1.55rem) "Cormorant Garamond", Georgia, serif; }
.facts { z-index: 2; display: flex; width: 100%; justify-content: center; gap: clamp(10px, 2vw, 28px); margin: auto 0 7%; }
.facts div { min-width: 23%; }
.facts dt { margin-bottom: 5px; color: rgba(99,72,62,.8); font: clamp(1.5rem, 3.8vw, 3rem)/1 Georgia, serif; }
.facts dd { margin: 0; white-space: nowrap; font: clamp(.58rem, 1.25vw, 1.1rem) "Cormorant Garamond", Georgia, serif; }
.placeholder-value { letter-spacing: .05em; }

.cover-page { z-index: 5; right: 0; width: 100%; transform-origin: left center; transform: rotateY(0deg); transform-style: preserve-3d; cursor: grab; transition: width .72s cubic-bezier(.22,.86,.28,1), transform .72s cubic-bezier(.22,.86,.28,1), filter .72s ease; border-radius: 16px; will-change: transform; }
.card-shell.is-open .cover-page { width: 50%; border-radius: 0 16px 16px 0; }
.cover-page:focus-visible { outline: 3px solid #fff6ca; outline-offset: 4px; }
.cover-page.is-dragging { cursor: grabbing; transition: none; }
.cover-page.is-open { transform: rotateY(-179.9deg); filter: brightness(.98); }
.cover-page.is-turning { animation: page-turn 1.08s cubic-bezier(.23,.82,.25,1) both; }
.cover-page.is-behind { z-index: 1; pointer-events: none; }
.cover-front, .cover-back { position: absolute; inset: 0; backface-visibility: hidden; overflow: hidden; }
.cover-front { border-radius: 16px; background: linear-gradient(145deg, #f5d2d4 0%, #edc4c7 62%, #dfadb1 100%); transition: border-radius .72s ease; }
.card-shell.is-open .cover-front { border-radius: 0 16px 16px 0; }
.cover-back { border: 1px solid rgba(255,255,255,.4); border-radius: 16px 0 0 16px; background: linear-gradient(145deg, #f8dada, #eac0c2); transform: rotateY(180deg); box-shadow: inset 12px 0 18px rgba(110,70,76,.12); }
.cover-name { position: relative; z-index: 2; margin: 20% 0 9%; color: var(--gold-light); text-shadow: 0 1px 0 #b98f38, 0 2px 18px rgba(157,114,37,.12); font: 600 clamp(4.1rem, 11vw, 9rem)/.8 "Cormorant Garamond", Georgia, serif; }
.cover-divider { position: relative; z-index: 2; }
.cover-hearts { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; height: 50%; background: radial-gradient(ellipse at 8% 78%, #e4b344 0 4%, transparent 4.8%), radial-gradient(ellipse at 18% 53%, #fff4e7 0 2.8%, transparent 3.5%), radial-gradient(ellipse at 30% 74%, #d6a23e 0 3.6%, transparent 4.3%), radial-gradient(ellipse at 47% 61%, #fff7ea 0 3.1%, transparent 3.8%), radial-gradient(ellipse at 62% 82%, #dfae42 0 4.4%, transparent 5.2%), radial-gradient(ellipse at 78% 50%, #fff1e7 0 2.6%, transparent 3.4%), radial-gradient(ellipse at 91% 73%, #c99b39 0 3.4%, transparent 4.1%), linear-gradient(transparent 5%, rgba(147,103,110,.35)); }
.cover-hearts::before { content: "♡  ♥  ♡  ♥  ♡  ♥  ♡"; position: absolute; left: -3%; right: -3%; top: 42%; color: rgba(255,247,239,.56); font: clamp(1rem, 2.5vw, 2.35rem)/1 Georgia, serif; letter-spacing: .45em; transform: rotate(-3deg); white-space: nowrap; }
.cover-hearts::after { content: "♥  ♡  ♥  ♡  ♥  ♡  ♥"; position: absolute; inset: auto -3% 9% -3%; color: rgba(255,245,235,.78); font-size: clamp(1.2rem, 3vw, 2.9rem); letter-spacing: .35em; transform: rotate(-4deg); white-space: nowrap; }
.cover-divider { transform: translateY(-15px); }
.open-hint { margin: 28px 0 0; color: rgba(98,69,61,.8); font: 500 1rem "Cormorant Garamond", Georgia, serif; letter-spacing: .03em; transition: opacity .2s; }
.language-switch { position: static; display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; min-height: 40px; padding: 0 13px; border: 1px solid rgba(201,162,68,.55); border-radius: 999px; cursor: pointer; color: #765e28; background: rgba(255,250,247,.82); box-shadow: 0 4px 15px rgba(97,59,56,.12); font: 500 .85rem "DM Sans", Arial, sans-serif; }
.language-switch:hover, .language-switch:focus-visible { outline: none; background: #fffdf8; transform: translateY(-1px); }
.globe { font-size: 1.05rem; }

.confetti { position: fixed; inset: 0; z-index: 15; overflow: hidden; pointer-events: none; }
.confetti-piece { position: absolute; top: -4vh; width: 10px; height: 16px; border-radius: 2px; animation: flutter 1.55s cubic-bezier(.22,.61,.36,1) forwards; }
.confetti-piece.heart { width: auto; height: auto; background: none !important; font-size: 18px; }
@keyframes flutter { to { transform: translate3d(var(--x), 108vh, 0) rotate(var(--r)); opacity: 0; } }
@keyframes page-turn {
  0% { transform: rotateY(0deg); filter: brightness(1); }
  42% { transform: rotateY(-92deg); filter: brightness(.93); }
  100% { transform: rotateY(-179.9deg); filter: brightness(.98); }
}

@media (max-width: 640px) {
  .experience { display: block; padding: 28px 12px 48px; }
  .card-shell { width: min(87vw, 430px); }
  .card-shell.is-open { width: min(94vw, 560px); aspect-ratio: 1.46 / 1; }
  .page { border-radius: 10px 0 0 10px; }
  .inside-right, .cover-page, .cover-front { border-radius: 0 10px 10px 0; }
  .cover-back { border-radius: 10px 0 0 10px; }
  .page-content { padding: 12px 8px; }
  .announcement { margin-top: 4%; font-size: .75rem; line-height: 1.25; }
  .script-name { margin-top: 5%; font-size: 1.65rem; white-space: nowrap; }
  .photo-slot { width: 62%; aspect-ratio: 1.35 / 1; margin-top: 4%; }
  .parents { margin: 6% 0 2%; font-size: .68rem; line-height: 1.28; }
  .detail-name { margin-top: 20%; }
  .birth-date { margin-top: 6%; }
  .language-switch { margin-top: 14px; }
  .facts { gap: 6px; margin-bottom: 3%; }
  .facts dt { margin-bottom: 2px; }
  .open-hint { margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; } }
