:root {
  --cream: #faf8f1;
  --paper: #fffef9;
  --blue-light: #e2edf2;
  --blue: #bdd2df;
  --ink: #294b60;
  --muted: #567080;
  --pink: #f2e3e1;
  --line: #cedce2;
  --shadow: 0 3px 9px #294b6012;
  --radius: 3px;
  --space: 1.25rem;
  --font: 'Trebuchet MS', 'Segoe UI', sans-serif;
  --hand: 'Segoe Print', 'Bradley Hand', 'Chalkboard SE', 'Comic Sans MS', cursive;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.65; overflow-wrap: anywhere; }
body::before { content: ''; position: fixed; inset: 0; pointer-events: none; opacity: .22; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Ccircle cx='1' cy='1' r='.5' fill='%2396a8ac'/%3E%3C/svg%3E"); z-index: -1; }
button { font: inherit; cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--ink); outline-offset: 5px; }
button:disabled { cursor: default; }
h1,h2,h3,p,figure { margin: 0; }
.handwritten { font-family: var(--hand); font-weight: 400; }
.date { font-size: .8rem; letter-spacing: .16em; color: var(--muted); }
.button { min-height: 48px; padding: .75rem 1.8rem; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--ink); color: var(--paper); transition: transform 200ms, background 200ms; box-shadow: 3px 3px 0 var(--blue); }
.button:hover { background: #39667d; transform: translateY(-2px); }
.button:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--blue); }
.intro { min-height: 100svh; display: grid; place-items: center; text-align: center; padding: 2rem; background: var(--blue-light); transition: opacity 400ms, transform 400ms; }
.intro.leaving { opacity: 0; transform: translateY(-8px); }
.intro-inner { max-width: 100%; }
.little-star { display: block; color: var(--muted); font-size: 2rem; margin-bottom: 1.5rem; }
.intro h1 { font-family: var(--hand); font-weight: 400; font-size: clamp(1.65rem, 5vw, 2.5rem); }
.intro .date { margin: 1rem 0 2.5rem; }
.intro-note { display: block; font-size: .9rem; margin-top: 2.3rem; transform: rotate(-3deg); color: var(--muted); }
main { width: min(100%, 980px); margin: auto; padding: 0 clamp(1.5rem, 5vw, 4rem); animation: open-page 650ms ease both; }
.page-top { display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .75rem; letter-spacing: .07em; }
.hero { padding: 3rem 0 2.5rem; position: relative; }
.eyebrow { font-size: .8rem; letter-spacing: .08em; margin-bottom: .8rem; }
.hero h2 { font-family: Georgia, serif; font-size: clamp(2.5rem, 8vw, 4rem); font-weight: 400; line-height: 1.12; }
.birthday-number { font-style: italic; }
.her-name { margin-top: .7rem; font-size: 1.8rem; text-decoration: underline; text-decoration-color: var(--blue); text-underline-offset: 8px; text-decoration-thickness: 3px; }
.hero-footnote { font-size: .8rem; color: var(--muted); margin: 1rem 0 2rem; }
.photo { position: relative; background: var(--paper); padding: .6rem .6rem .35rem; border: 1px solid #e4e6e0; box-shadow: var(--shadow); transform: rotate(var(--rotation, 0deg)); transition: transform 250ms; min-width: 0; }
.photo::before { content: ''; position: absolute; top: -.65rem; left: 34%; width: 31%; height: 1.4rem; background: #c6d9e5aa; transform: rotate(-6deg); z-index: 1; }
.photo:hover, .photo:active { transform: rotate(0deg) translateY(-3px); }
.photo-window { position: relative; aspect-ratio: 4 / 5; background: var(--blue-light); overflow: hidden; }
.photo-window img { display: block; width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 1; }
.photo-window img.missing { visibility: hidden; }
.photo-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .5rem; text-align: center; color: var(--muted); font-family: var(--hand); font-size: 1rem; border: 1px solid #c4d6df; margin: .7rem; }
.photo-placeholder span { font-size: .85rem; margin-top: .4rem; }
.photo figcaption { padding: .6rem .15rem .35rem; text-align: center; font-size: .95rem; }
.hero-photo { width: min(80%, 290px); margin: 2rem auto 0; }
.hero-doodle { display: block; text-align: right; margin: 1.5rem .2rem 0 0; font-size: .85rem; }
.short-message { position: relative; max-width: 520px; margin: 3rem auto 5rem; padding: 1.7rem 1.25rem 1.2rem; border-left: 2px solid var(--blue); }
.margin-note { display: block; margin-bottom: 1.25rem; color: var(--muted); transform: rotate(-2deg); }
.short-message p + p { margin-top: 1rem; }
.small-heart { display: block; text-align: right; font-size: 1.6rem; }
.section-heading { display: flex; align-items: baseline; gap: .75rem; margin-bottom: 2rem; }
.section-number { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.section-heading h2 { font-size: clamp(1.4rem, 4vw, 1.9rem); line-height: 1.4; }
.photo-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.3rem 1rem; padding: .6rem .3rem; }
.photo-gallery .photo:nth-child(even) { margin-top: 1.5rem; }
.photo-gallery .photo:nth-child(3n) .photo-window { aspect-ratio: 1 / 1; }
.photo-gallery .photo figcaption { font-size: .85rem; }
.gallery-note { margin: 1.8rem 0 0; text-align: right; font-size: .95rem; }
.appreciation { margin-top: 5rem; }
.notes { list-style: none; margin: 0; padding: .3rem; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1.1rem; }
.notes li { background: var(--blue-light); padding: 1.4rem .9rem; min-height: 110px; font-size: .95rem; box-shadow: 1px 2px 0 #294b600d; transform: rotate(-2deg); border-radius: 1px; }
.notes li:nth-child(even) { background: #f0eee3; transform: rotate(2deg); }
.notes li:nth-child(3) { background: var(--pink); }
.letter-note { display: block; margin: 5.5rem 0 1.2rem .5rem; color: var(--muted); font-size: .95rem; }
.letter-paper { position: relative; background: var(--paper); padding: 1.8rem 1.35rem 2rem; border: 1px solid #e3e3da; box-shadow: var(--shadow); }
.letter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.letter-top h2 { font-size: 2rem; }
.letter-top .date { font-size: .7rem; }
.letter-body { min-height: 150px; padding-top: 1.75rem; line-height: 1.9; }
.letter-body p + p { margin-top: 1.2rem; }
.signature { margin-top: 2rem; font-size: 1.3rem; line-height: 1.8; }
.letter-heart { position: absolute; right: 1.7rem; bottom: 1.7rem; color: var(--muted); font-size: 1.6rem; transform: rotate(10deg); }
.music-section { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; margin: 3rem 0; padding: 1.5rem 0; border-block: 1px solid var(--line); }
.music-symbol { font-size: 2rem; }
.music-section > div { flex: 1; min-width: 150px; }
.music-section .handwritten { font-size: 1rem; }
.music-status { font-size: .8rem; color: var(--muted); }
.music-button { min-height: 44px; padding: .5rem .9rem; border: 1px solid var(--ink); background: transparent; color: var(--ink); border-radius: var(--radius); }
.music-button:disabled { opacity: .65; }
.surprise-section { text-align: center; padding: 2rem 0 3rem; }
.surprise-section > h2 { margin-bottom: 1.3rem; font-size: 1.8rem; }
.final-surprise { margin-top: 3rem; padding-top: 2rem; animation: open-page 600ms ease both; }
.final-surprise h3 { font-family: Georgia, serif; font-weight: 400; font-size: clamp(1.4rem, 4vw, 2rem); line-height: 1.5; max-width: 480px; margin: auto; }
.final-photo { width: min(85%, 270px); margin: 2.5rem auto; }
.final-greeting { font-size: 1.4rem; margin-bottom: 1rem; }
footer { text-align: center; color: var(--muted); padding: 1.5rem 0 2rem; font-size: .75rem; border-top: 1px solid var(--line); }
footer .date { margin-top: .65rem; font-size: .7rem; }
.skip-link { position: absolute; top: -100px; padding: .75rem; background: var(--paper); color: var(--ink); z-index: 3; }
.skip-link:focus { top: 10px; }
.noscript-note { padding: 1rem; }
/* Only hide sections when JavaScript has successfully set up the observer. */
.motion-ready .reveal { opacity: 0; transform: translateY(14px); transition: opacity 600ms ease, transform 600ms ease; }
.motion-ready .reveal.visible { opacity: 1; transform: none; }
@keyframes open-page { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (min-width: 650px) {
  .hero { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: center; padding: 4rem 0; }
  .hero-photo { width: min(100%, 290px); margin: 0 auto; }
  .hero-doodle { position: absolute; right: 1.5rem; bottom: 1rem; }
  .short-message { margin-top: 2rem; margin-left: 2rem; padding-left: 2rem; }
  .photo-gallery { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 2.5rem 1.5rem; }
  .photo-gallery .photo:nth-child(even) { margin-top: 1rem; }
  .notes { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1.6rem; }
  .notes li { padding: 1.7rem 1.2rem; }
  .letter-paper { padding: 2.5rem 3rem; }
  .letter-section { max-width: 720px; margin: auto; }
  .music-section { max-width: 600px; margin: 3rem auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .motion-ready .reveal { opacity: 1; transform: none; }
}
