/*
Required Notice: © 2026 Songming.org
SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
*/

:root { color-scheme: dark; --ink: #f1e6d3; --gold: #c7a56a; --paper: #eee6d6; }
    *, *::before, *::after { box-sizing: border-box; }
    html { background: #000; scrollbar-color: #514536 #000; scroll-behavior: smooth; }
    body { margin: 0; background: #000; color: var(--ink); overflow-x: clip; }
    button, a { -webkit-tap-highlight-color: transparent; }
    ::selection { color: #17120f; background: #d6b87c; }
    .story { position: relative; isolation: isolate; }
    .hero { height: 100vh; height: 100svh; min-height: 580px; position: sticky; top: 0; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; overflow: hidden; z-index: 1; }
    .composition { min-width: 0; width: min(790px, 84vw); display: flex; align-items: center; flex-direction: column; transform-origin: 50% 50%; will-change: transform; }
    .cake { width: min(720px, 78vh, 78svh); aspect-ratio: 1; position: relative; margin-top: -64px; opacity: 0; animation: cake-arrives 2.4s .1s both; }
    canvas { width: 100%; height: 100%; display: block; }
    .candle-touch { position: absolute; left: 45%; top: 19%; width: 10%; height: 23%; border: 0; background: transparent; cursor: pointer; border-radius: 50%; }
    .candle-touch:focus-visible { outline: 1px solid #ddbf85; outline-offset: 5px; box-shadow: 0 0 30px #edc78622; }
    .wishes { width: 100%; position: relative; margin-top: -52px; text-align: center; }
    h1 { margin: 0; font-weight: 400; }
    .handwriting { display: block; width: 100%; height: auto; overflow: visible; }
    .handwriting path { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
    .greeting { color: #f7e8cf; width: min(720px, 100%); margin: 0 auto; filter: drop-shadow(0 0 9px #f6d79b24); }
    .from { width: 205px; max-width: 45%; margin: 13px auto 0; color: #c7b08b; }
    .extra-wishes { font: italic 17px/1.7 Georgia, "Songti SC", serif; color: #c7b08b; }
    .extra-wishes p { margin: 14px 0 0; }
    .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
    .scroll-cue { position: absolute; bottom: max(22px, env(safe-area-inset-bottom)); left: calc(50% - 22px); width: 44px; height: 44px; display: grid; place-items: center; color: #baa17b; opacity: 0; animation: cue-arrives 1.5s 6s forwards; transition: visibility .3s; }
    .scroll-cue svg { width: 17px; height: 25px; animation: breathe-down 3s ease-in-out infinite; }
    .scroll-cue:focus-visible { outline: 1px solid #c7a56a; border-radius: 50%; }
    .letter-section { width: 44%; max-width: 610px; margin: 0 max(5vw, calc((100vw - 1500px) / 2)) 0 auto; padding: 5vh 0 12vh; position: relative; z-index: 2; scroll-margin-top: 5vh; }
    .paper { position: relative; padding: 60px clamp(32px, 4vw, 64px) 46px; color: #51473c; background-color: var(--paper); background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.11' filter='url(%23n)'/%3E%3C/svg%3E"), linear-gradient(112deg,#f6f0e5 0%,#eee5d4 73%,#e7ddcb 100%); border-radius: 2px 3px 3px 2px; box-shadow: 0 0 0 1px #f8eed621, 0 30px 90px #000b; transform: translateY(45px) rotate(1.5deg); opacity: 0; transition: opacity 1.1s ease, transform 1.5s cubic-bezier(.2,.7,.2,1); transform-origin: 50% 15%; }
    .paper::before { content: ""; position: absolute; inset: 15px; border: 1px solid #a38a5b3b; pointer-events: none; }
    .paper::after { content: ""; width: 56px; height: 56px; position: absolute; right: 0; bottom: 0; background: linear-gradient(135deg,transparent 49%,#d1c3a66b 50%,#ede3d0 72%); opacity: .75; pointer-events: none; }
    .paper.is-visible { opacity: 1; transform: translateY(0) rotate(-.7deg); }
    .letter-salutation { width: 225px; max-width: 85%; color: #6c5437; margin: 0 0 26px; }
    .letter-body { font: 15px/2.15 "Songti SC", "Noto Serif CJK SC", "STSong", "SimSun", Georgia, serif; letter-spacing: .035em; overflow-wrap: anywhere; }
    .letter-body p { margin: 0 0 20px; }
    .letter-body p:first-child { color: #735b3d; margin-bottom: 23px; }
    .letter-body p:last-child { margin-bottom: 0; }
    .reveal-line { opacity: 0; transform: translateY(12px); filter: blur(3px); transition: opacity 1.1s ease, transform 1.2s ease, filter 1.2s ease; }
    .reveal-line.is-visible { opacity: 1; transform: translateY(0); filter: blur(0); }
    .letter-footer { margin-top: 32px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
    .closing { margin: 0 0 10px; font: italic 15px/1.5 Georgia, "Songti SC", serif; color: #837056; }
    .signature { width: 156px; max-width: 100%; color: #725437; }
    .seal { width: 43px; height: 43px; flex: none; border-radius: 48% 52% 47% 53%; display: grid; place-items: center; background: radial-gradient(circle at 32% 27%,#b48b55,#946c3c 65%,#78512e); box-shadow: 1px 3px 6px #52371026,inset 0 0 0 3px #b68b574d,inset 0 0 0 5px #6c481c36; transform: rotate(-12deg); }
    .seal svg { width: 19px; height: 19px; fill: none; stroke: #e2c291; stroke-width: 1.05; filter: drop-shadow(0 1px 0 #5e401b); }
    @keyframes cake-arrives { from { opacity: 0; transform: translateY(20px) scale(.96); filter: blur(8px); } to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); } }
    @keyframes cue-arrives { to { opacity: .6; } }
    @keyframes breathe-down { 0%,100% { transform: translateY(-3px); opacity: .4; } 50% { transform: translateY(4px); opacity: .9; } }
    @media (min-width: 801px) and (max-height: 730px) { .hero { min-height: 480px; } .cake { width: min(570px, 75svh); margin-top: -20px; } .composition { width: min(660px, 80vw); } .wishes { margin-top: -42px; } .from { margin-top: 5px; width: 165px; } }
    @media (min-width: 1600px) { .composition { width: 860px; } .cake { width: min(740px, 75svh); } .greeting { width: 790px; } }
    @media (max-width: 800px) {
      .hero { position: relative; min-height: 520px; }
      .composition { width: calc(100% - 28px); max-width: 660px; transform: none !important; padding-bottom: 35px; }
      .cake { width: min(122vw, 69svh, 690px); max-width: none; margin-top: -35px; }
      .wishes { margin-top: -22px; }
      .greeting { width: 100%; }
      .from { width: 165px; margin-top: 17px; }
      .scroll-cue { bottom: max(24px, env(safe-area-inset-bottom)); }
      .letter-section { width: 100%; max-width: none; margin: 0; padding: 35px 20px max(60px, env(safe-area-inset-bottom)); min-height: 100svh; display: flex; align-items: center; justify-content: center; scroll-margin-top: 0; }
      .paper { width: 100%; max-width: 540px; padding: 48px 31px 38px; }
      .paper::before { inset: 11px; }
      .paper.is-visible { transform: translateY(0) rotate(-.45deg); }
      .letter-salutation { width: 195px; margin-bottom: 25px; }
      .letter-body { font-size: 15px; line-height: 2.05; letter-spacing: .025em; }
      .letter-body p { margin-bottom: 21px; }
      .letter-footer { margin-top: 30px; }
      .extra-wishes { font-size: 14px; }
    }
    @media (max-width: 360px) { .letter-section { padding-left: 14px; padding-right: 14px; } .paper { padding-left: 26px; padding-right: 26px; } .letter-body { font-size: 14px; } }
    @media (max-width: 800px) and (orientation: landscape) { .hero { min-height: 520px; } .cake { width: 390px; margin-top: -35px; } .composition { max-width: 510px; } .wishes { margin-top: -40px; } }
    @media (prefers-reduced-motion: reduce) {
      html { scroll-behavior: auto; }
      *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
      .cake, .scroll-cue, .paper, .reveal-line { opacity: 1; filter: none; }
      .paper, .reveal-line { transform: none; }
      .handwriting path { stroke-dashoffset: 0 !important; }
    }
