@font-face { font-family: "Birthday Brush"; src: url("fonts/cover-handwriting.ttf") format("truetype"); font-style: normal; font-weight: 400; font-display: swap; }
:root { --viewport-height: 100vh; --cover-height: calc(var(--viewport-height) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); color-scheme: light; background: #f4e9e7; color: #54252a; font-family: "Songti SC", "SimSun", serif; }
* { box-sizing: border-box; }
html { height: 100%; overflow: hidden; }
body { margin: 0; width: 100%; height: var(--viewport-height); padding: 0; overflow: hidden; background: #f4e9e7; }
.cover { position: relative; isolation: isolate; width: 100%; height: 100%; overflow: hidden; background: radial-gradient(ellipse at 0 22%, #e2deee88, transparent 40%), radial-gradient(ellipse at 100% 90%, #f7d9de88, transparent 40%), #fff3ec; }
.cover::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: .065; mix-blend-mode: multiply; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23000' filter='url(%23paper)' d='M0 0h180v180H0z'/%3E%3C/svg%3E"); }
.cover-content { position: relative; width: 100%; height: 100%; padding: max(8px, env(safe-area-inset-top, 0px)) 0 max(10px, env(safe-area-inset-bottom, 0px)); display: grid; grid-template-rows: minmax(0, 9fr) minmax(0, 22fr) minmax(0, 57fr) minmax(54px, 12fr); justify-items: center; }
/* Each original-art region scales uniformly inside its own responsive row. */
.art-region { display: block; width: 100%; height: 100%; min-height: 0; overflow: hidden; pointer-events: none; mix-blend-mode: multiply; filter: contrast(1.08) brightness(1.035); }
.cover-eyebrow { display: flex; align-items: center; justify-content: center; align-self: end; gap: .6em; margin: 0 0 .35em; color: #a14d50; font-family: "Birthday Brush", "KaiTi", serif; font-size: clamp(19px, 5.3vw, 29px); font-weight: 400; letter-spacing: .13em; }
.cover-eyebrow svg { width: 1.45em; height: 1.15em; flex: none; transform: rotate(-9deg); }
.cover-title { position: relative; isolation: isolate; width: 96%; margin: 0; padding: .08em 0 .35em; align-self: center; color: #652b33; font-family: "Birthday Brush", "KaiTi", serif; font-size: min(8.4vw, calc(var(--viewport-height) * .048)); font-weight: 400; line-height: 1.38; letter-spacing: -.025em; text-align: center; }
.cover-title span { display: block; white-space: nowrap; }
.cover-title .title-first { position: relative; padding-right: .15em; margin: 0; transform: rotate(-3deg); }
.cover-title .title-second { position: relative; padding-left: .6em; margin-top: .02em; transform: rotate(-2deg); }
.cover-title em { position: relative; display: inline-block; margin: 0 .02em 0 .03em; color: #b64c56; font-size: 1.4em; font-weight: 400; font-style: normal; letter-spacing: -.06em; }
.cover-title em::after { content: ""; position: absolute; z-index: -1; left: -4%; right: -7%; bottom: .09em; height: .24em; border-radius: 45% 25% 55% 30%; background: linear-gradient(100deg, #e9a8af00, #edb4bd66 25%, #edb4bd55 75%, #e9a8af00); transform: rotate(-4deg); }
.cover-title .punctuation { display: inline; color: #80424a; font-size: .8em; letter-spacing: -.2em; }
.title-swash { position: absolute; right: 10%; bottom: -.04em; width: 42%; height: .62em; overflow: visible; fill: none; stroke: #d78289; stroke-width: 1.4; stroke-linecap: round; pointer-events: none; transform: rotate(-2deg); }
.corner { position: absolute; z-index: -1; pointer-events: none; overflow: hidden; mix-blend-mode: multiply; filter: contrast(1.08) brightness(1.035); }
.corner-top { top: 0; right: 0; width: 38%; height: 16%; }
.corner-bottom { bottom: 0; left: 0; width: 29%; height: 12%; }
.open-letter { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; align-self: center; gap: .65em; width: min(76%, 440px); height: min(58px, calc(var(--viewport-height) * .078)); min-height: 48px; margin: 0; padding: 0 22px; border: 1px solid #a94b5c; border-radius: 999px; background: radial-gradient(ellipse at 22% 0, #d3889380, transparent 75%), linear-gradient(110deg, #b65c6c, #a7475b); color: #fff5eb; box-shadow: 0 5px 15px #8c435322, inset 0 1px 0 #ffffff38; font-family: "Songti SC", "STSong", "SimSun", serif; font-size: clamp(20px, 5.7vw, 30px); font-weight: 500; letter-spacing: .1em; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: transform .18s ease, box-shadow .18s ease; }
.open-letter::before { content: ""; position: absolute; inset: 4px; border: 1px solid #ffe9df48; border-radius: inherit; pointer-events: none; }
.button-envelope { width: 1.15em; height: 1em; flex: none; opacity: .88; }
.open-letter:hover { box-shadow: 0 6px 20px #8c435333, inset 0 1px 0 #ffffff38; }
.open-letter:active { transform: translateY(1px) scale(.985); }
.open-letter:focus-visible { outline: 2px solid #813d51; outline-offset: 5px; }
.petal { position: absolute; z-index: 2; left: var(--x); top: 77%; pointer-events: none; color: #b95265; font-size: var(--size); animation: rise 1.5s ease-out forwards; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@keyframes rise { from { opacity: 0; transform: translate(0, 0) rotate(-15deg) scale(.7); } 20% { opacity: .8; } to { opacity: 0; transform: translate(var(--drift), -130px) rotate(30deg) scale(1.15); } }
@supports (height: 100dvh) { :root { --viewport-height: 100dvh; } }
[hidden] { display: none !important; }
html.letter-open { height: auto; overflow-x: hidden; overflow-y: auto; }
body.letter-open { height: auto; min-height: var(--viewport-height); overflow: visible; background: #fff3ec; }
.letter-page { position: relative; isolation: isolate; width: min(100%, 837px); margin: 0 auto; overflow: hidden; color: #713038; font-family: "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", "SimSun", serif; background: radial-gradient(ellipse at -12% 35%, #f4cdd94d, transparent 30%), radial-gradient(ellipse at 110% 61%, #ddd9ed66, transparent 28%), radial-gradient(ellipse at 3% 95%, #f5cfcd66, transparent 26%), #fff8f3; }
.letter-page::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .085; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath d='M0 0h160v160H0z' filter='url(%23n)' opacity='.65'/%3E%3C/svg%3E"); }
.letter-kicker { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0; padding: 14px 20px 5px; color: #a3464b; font-size: clamp(14px, 3.5vw, 20px); letter-spacing: .07em; text-align: center; }
.letter-kicker::before, .letter-kicker::after { content: ""; width: 28px; height: 1px; background: #d49a9c99; }
.letter-art { display: block; width: 100%; height: auto; overflow: hidden; mix-blend-mode: multiply; filter: contrast(1.06) brightness(1.025); }
.letter-section { position: relative; padding: 17px clamp(22px, 6vw, 54px) 9px; }
.letter-section h2 { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 18px; color: #952d39; font-size: clamp(23px, 5.8vw, 37px); font-weight: 700; line-height: 1.35; letter-spacing: .03em; text-align: center; }
.letter-section h2::before, .letter-section h2::after { content: ""; flex: 1 1 20px; max-width: 70px; min-width: 12px; height: 1px; background: linear-gradient(90deg, transparent, #c77b83aa); }
.letter-section h2::after { transform: rotate(180deg); }
.letter-section p { margin: 0 0 12px; font-size: clamp(17px, 4.25vw, 25px); line-height: 1.8; letter-spacing: .025em; }
.letter-quote { position: relative; isolation: isolate; margin: 4px -7px 20px -13px; padding: 18px 15px 20px; color: #a53344; font-size: clamp(26px, 6.7vw, 43px); font-weight: 700; font-style: italic; line-height: 1.4; letter-spacing: .04em; text-align: center; transform: rotate(-2deg); }
.quote-ribbon { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; overflow: visible; opacity: .83; }
.quote-mark { font-size: 1.3em; line-height: 0; color: #b95765; }
.gift-body { position: relative; padding-top: 2px; }
.gift-art { float: right; width: 45%; margin: -8px -17px 0 5px; transform: rotate(3deg); }
.gift-body::after, .letter-section::after { content: ""; display: block; clear: both; }
.little-wishes { margin: -5px 0 0; padding: 0; list-style: none; }
.little-wishes li { display: grid; grid-template-columns: 25% 1fr; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #dc9c9b38; }
.little-wishes li:last-child { border: 0; }
.little-wishes li:nth-child(2) { padding-left: 8px; }
.little-wishes p { margin: 0; line-height: 1.65; }
.letter-together { margin: -6px 0 8px; }
.letter-ending { padding-top: 22px; padding-bottom: max(30px, env(safe-area-inset-bottom, 0px)); }
.cake-art { float: left; width: 32%; margin: 4px 12px 0 -10px; }
.letter-ending h2 { display: block; text-align: left; font-size: clamp(26px, 6.3vw, 40px); line-height: 1.4; }
.letter-ending h2::before, .letter-ending h2::after { display: none; }
.letter-ending .signature { clear: both; position: relative; padding-top: 20px; color: #9d3546; text-align: center; font-size: clamp(21px, 5.3vw, 30px); }
.letter-ending .signature::before { content: ""; position: absolute; top: 8px; left: 27%; width: 46%; height: 12px; border-top: 1px solid #d18b92; border-radius: 50%; transform: rotate(-4deg); }
.letter-page .letter-salutation { justify-content: flex-start; padding-left: clamp(24px, 6vw, 54px); font-size: clamp(20px, 4.8vw, 28px); }
.letter-salutation::before, .letter-salutation::after { display: none; }
.letter-banner { position: relative; background: #fff8f3; }
.letter-section .letter-salutation { display: block; margin: 0 0 5px; padding: 0; color: #963942; font-size: clamp(20px, 4.8vw, 28px); line-height: 1.4; text-align: left; }
.personal-quote { margin-top: 18px; font-size: clamp(22px, 5.5vw, 34px); line-height: 1.65; }
.personal-wishes { padding-top: 0; }
.personal-ending { min-height: 130px; display: flex; align-items: center; justify-content: center; gap: 14px; }
.personal-ending .cake-art { float: none; flex: 0 0 31%; width: 31%; margin: 0; }
.personal-ending .signature { margin: 0; padding-top: 0; font-size: clamp(29px, 7vw, 45px); text-align: center; white-space: nowrap; }
.personal-ending .signature::before { top: auto; bottom: -12px; left: 5%; width: 90%; }
.open-letter:disabled { cursor: default; }
.cake-rain { position: fixed; inset: 0; z-index: 20; overflow: hidden; pointer-events: none; user-select: none; contain: strict; }
.falling-cake { position: absolute; top: -72px; left: var(--cake-left); display: block; width: var(--cake-size); height: var(--cake-size); object-fit: contain; filter: contrast(1.22) saturate(1.2) drop-shadow(0 1px 1px #9b5c6b55); opacity: 0; animation: cake-fall var(--cake-duration) var(--cake-delay) linear infinite; will-change: transform; }
.cake-rain.is-paused .falling-cake { animation-play-state: paused; }
@keyframes cake-fall {
  0% { transform: translate3d(0, 0, 0) rotate(-16deg); opacity: 0; }
  8% { opacity: var(--cake-opacity); }
  50% { transform: translate3d(var(--cake-drift), calc(var(--viewport-height) * .5), 0) rotate(12deg); }
  88% { opacity: var(--cake-opacity); }
  100% { transform: translate3d(calc(var(--cake-drift) * -.5), calc(var(--viewport-height) + 140px), 0) rotate(-10deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .cake-rain { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
