:root {
  color-scheme: light;
  --cream: #fff9eb;
  --paper: #f6e9c8;
  --yellow: #e8c65b;
  --gold: #c69a42;
  --brown: #463a2c;
  --muted: #716351;
  --line: #dfd1af;
  --rose: #cf7662;
  --green: #69775b;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 6rem; background: var(--cream); }
body { margin: 0; color: var(--brown); background: var(--cream); line-height: 1.6; }
button, input { font: inherit; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
:focus-visible { outline: 3px solid #6f4f14; outline-offset: 4px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h1, h2 { letter-spacing: -0.045em; line-height: 1.08; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  transform: translateY(-160%);
  border-radius: 0.3rem;
  background: var(--brown);
  color: white;
}
.skip-link:focus { transform: translateY(0); }
.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 4.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.3rem;
  padding: 0.7rem clamp(1.25rem, 5vw, 5rem);
  border-bottom: 1px solid rgb(198 154 66 / 25%);
  background: rgb(255 249 235 / 95%);
  backdrop-filter: blur(12px);
}
.wordmark { flex: 0 0 auto; font-size: 0.85rem; font-weight: 900; letter-spacing: 0.11em; text-decoration: none; }
.wordmark span { color: #b08a28; }
.site-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem 1.15rem; }
.site-nav a, .site-footer a { color: var(--muted); font-size: 0.72rem; font-weight: 700; text-decoration: none; }
.site-nav a:hover, .site-footer a:hover { color: var(--brown); text-decoration: underline; text-underline-offset: 0.22em; }

.chapter { position: relative; padding-inline: clamp(1.25rem, 8vw, 8.5rem); }
.opening {
  display: grid;
  min-height: min(760px, 88vh);
  place-items: center;
  overflow: hidden;
  padding-block: 4rem;
  background:
    radial-gradient(circle at 50% 50%, rgb(232 198 91 / 22%), transparent 25rem),
    var(--cream);
}
.opening-paper {
  position: relative;
  z-index: 1;
  width: min(100%, 56rem);
  padding: clamp(2.2rem, 6vw, 5rem);
  border: 1px solid #d6c291;
  background:
    repeating-linear-gradient(0deg, transparent 0 2.1rem, rgb(198 154 66 / 5%) 2.12rem 2.16rem),
    #fffdf6;
  box-shadow: 0 18px 45px rgb(70 58 44 / 12%), 0 3px 0 #e8dbbd;
  text-align: center;
}
.eyebrow {
  margin-bottom: 0.75rem;
  color: #8d6a25;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.opening h1 { max-width: 13ch; margin: 0 auto 1.25rem; font-size: clamp(2.7rem, 7vw, 6.3rem); }
.opening h1 span { color: var(--gold); font-size: 0.75em; vertical-align: 0.08em; }
.opening-subtitle { max-width: 39rem; margin: 0 auto 2rem; color: var(--muted); font-family: Georgia, serif; font-size: clamp(1.05rem, 2.1vw, 1.45rem); font-style: italic; }
.button {
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.7rem 1.2rem;
  border: 0;
  border-radius: 99px;
  cursor: pointer;
  font-size: 0.79rem;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease;
}
.button:hover { transform: translateY(-2px); }
.button-dark { background: var(--brown); color: var(--cream); }
.button-dark:hover { background: #665340; }
.opening-flower { position: absolute; top: 12%; right: 12%; color: #b28a29; font-size: clamp(2rem, 4vw, 4rem); }
.opening-note { position: absolute; right: 1.2rem; bottom: 1.4rem; color: #87795f; font-size: 0.65rem; letter-spacing: 0.12em; }

.welcome { display: grid; min-height: 34rem; place-items: center; padding-block: 5rem; background: #f1e4c5; }
.paper-card { border: 1px solid var(--line); background: #fffdf6; box-shadow: 0 10px 24px rgb(70 58 44 / 8%); }
.welcome-card { width: min(100%, 45rem); padding: clamp(1.6rem, 5vw, 3.5rem); }
.welcome-card h2 { margin-bottom: 1rem; font-size: clamp(2.4rem, 5vw, 4rem); }
.welcome-copy { max-width: 36rem; margin-bottom: 1.6rem; color: var(--muted); }
.welcome-flower { position: absolute; right: 12%; bottom: 13%; color: var(--gold); font-size: 2rem; }

.story-chapter, .gallery-chapter, .timeline-chapter, .little-things-chapter { padding-block: 6rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.section-heading h2 { max-width: 17ch; margin: 0; font-size: clamp(2.4rem, 5vw, 4.3rem); }
.section-note { margin: 0 0 0.3rem; color: var(--muted); font-size: 0.78rem; text-align: right; }
.chapter-nav { display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 0 0 1.5rem; }
.chapter-nav a, .filter-button {
  min-height: 2.45rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
}
.chapter-nav a:hover, .filter-button:hover { border-color: var(--gold); color: var(--brown); }
.chapter-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.chapter-card { scroll-margin-top: 6rem; min-height: 14rem; padding: 1.5rem; }
.chapter-card:nth-child(odd) { transform: rotate(-0.25deg); }
.chapter-card:nth-child(even) { transform: rotate(0.25deg); }
.chapter-card-title { margin-bottom: 1rem; font-size: clamp(1.5rem, 3vw, 2rem); }
.empty-copy { color: var(--muted); font-size: 0.82rem; }

.gallery-chapter { background: #f1e4c5; }
.filter-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.45rem; }
.filter-button.is-active { border-color: var(--brown); background: var(--brown); color: var(--cream); }
.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; gap: 1.2rem; }
.photo-card { min-width: 0; padding: 0.55rem; border: 1px solid #dccba6; background: #fffdf8; box-shadow: 0 7px 17px rgb(70 58 44 / 8%); }
.photo-card-0 { transform: rotate(-0.8deg); }
.photo-card-2 { transform: rotate(0.65deg); }
.photo-open { display: block; width: 100%; padding: 0; border: 0; background: #eee3c9; cursor: zoom-in; }
.photo-open img { display: block; width: 100%; height: auto; object-fit: contain; transition: filter 180ms ease; }
.media-unavailable { display: block; padding: 1.5rem; color: var(--muted); font-size: 0.85rem; text-align: center; }
.photo-open:hover img { filter: brightness(1.04); }
.photo-meta { padding: 0.65rem 0.3rem 0.2rem; }
.file-label { color: var(--brown); font-size: 0.68rem; font-weight: 800; }
.photo-caption { min-height: 1.5em; margin: 0.25rem 0 0; color: var(--muted); font-size: 0.73rem; }
.photo-recording { margin: 0.65rem 0.25rem 0; padding-top: 0.6rem; border-top: 1px dashed var(--line); color: #7d6324; font-size: 0.67rem; }

.audio-chapter { padding-block: 6rem; background: #463f32; color: var(--cream); }
.section-heading-light .eyebrow, .video-section .eyebrow { color: var(--yellow); }
.section-heading-light .section-note { color: #d7cebc; }
.audio-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.audio-card { padding: 1.25rem; border: 1px solid rgb(255 249 235 / 24%); background: rgb(255 255 255 / 5%); }
.audio-card h3 { margin-bottom: 0.8rem; color: var(--cream); font-size: 1.1rem; }
.audio-player { display: flex; min-width: 0; align-items: center; gap: 0.6rem; color: inherit; }
.play-button, .icon-button {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.play-button { font-size: 0.7rem; }
.play-button:hover, .play-button:focus-visible { background: var(--yellow); color: var(--brown); }
.audio-seek { width: 100%; min-width: 2rem; accent-color: var(--yellow); cursor: pointer; }
.audio-time { flex: 0 0 auto; color: inherit; font-size: 0.66rem; font-variant-numeric: tabular-nums; }
.waveform { display: flex; height: 1.2rem; flex: 0 0 3.2rem; align-items: center; justify-content: center; gap: 2px; }
.waveform i { display: block; width: 2px; height: var(--bar-height); border-radius: 2px; background: currentColor; opacity: 0.55; }
.audio-player.is-playing .waveform i { animation: waveform 650ms ease-in-out var(--bar-delay) infinite alternate; opacity: 1; }
.photo-recording .audio-player { margin-top: 0.45rem; color: var(--brown); }
.photo-recording .play-button { width: 1.7rem; height: 1.7rem; }
.photo-recording .waveform { display: none; }
.photo-recording .audio-time { color: var(--muted); }
.video-section { margin-top: 4.5rem; }
.video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.video-card { min-width: 0; margin: 0; }
.video-card video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #1e1c18; object-fit: contain; }
.video-card video[hidden] { display: none; }
.video-card figcaption { margin-top: 0.5rem; color: #ded4c0; font-size: 0.72rem; }

.timeline-chapter { background: #fffdf6; }
.timeline-track { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.timeline-entry { min-height: 10rem; padding: 1.25rem; }
.timeline-date { margin-bottom: 0.55rem; color: #947127; font-size: 0.67rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.timeline-entry h3 { margin-bottom: 0; font-size: 1.3rem; }
.timeline-media { margin: 0.75rem 0 0; padding-left: 1rem; font-size: 0.72rem; }
.timeline-media a { overflow-wrap: anywhere; }

.little-things-chapter { background: #f1e4c5; }
.memory-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.memory-card { min-width: 0; padding: 1.1rem; }
.memory-card-toggle { width: 100%; padding: 0; border: 0; background: transparent; color: var(--brown); cursor: pointer; font-family: Georgia, serif; font-size: 1.12rem; text-align: left; }
.memory-card-toggle::after { float: right; color: var(--gold); content: "+"; font-family: sans-serif; }
.memory-card-toggle[aria-expanded="true"]::after { content: "−"; }
.memory-card .empty-copy { margin: 0.9rem 0 0; }
.memory-card [hidden] { display: none; }

.terms-chapter { padding-block: 6rem; background: #e8ddc4; }
.terms-document { width: min(100%, 55rem); margin-inline: auto; padding: clamp(1.5rem, 5vw, 3.5rem); border: 1px solid #cab88c; background: #fffdf6; box-shadow: 0 10px 28px rgb(70 58 44 / 9%); }
.terms-document h2 { margin-bottom: 1rem; font-size: clamp(2.5rem, 5vw, 4rem); }
.terms-intro { color: var(--muted); font-size: 0.85rem; }
.terms-list { display: grid; gap: 0.75rem; margin: 1.5rem 0; padding-left: 1.5rem; }
.terms-list li { padding: 0.5rem 0 0.5rem 0.4rem; border-bottom: 1px dashed var(--line); }
.terms-list h3 { margin-bottom: 0.25rem; font-size: 1rem; }
.terms-list .empty-copy { margin: 0; font-size: 0.75rem; }
.terms-signature { margin: 2rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-family: Georgia, serif; font-style: italic; }

.surprise-chapter { display: flex; min-height: 43rem; flex-direction: column; align-items: center; justify-content: center; padding-block: 6rem; overflow: hidden; background: var(--cream); text-align: center; }
.surprise-chapter h2 { margin-bottom: 0.5rem; font-size: clamp(2.7rem, 5vw, 4.5rem); }
.surprise-intro { color: var(--muted); }
.envelope { position: relative; width: min(18rem, 72vw); height: 11.5rem; margin-top: 1.1rem; overflow: hidden; border: 1px solid #c8a951; border-radius: 0.25rem; background: #e8d16f; box-shadow: 0 14px 28px rgb(70 58 44 / 14%); cursor: pointer; transition: transform 180ms ease; }
.envelope:hover { transform: translateY(-4px) rotate(-1deg); }
.envelope::before, .envelope::after { position: absolute; z-index: 1; bottom: -3.2rem; width: 0; height: 0; border-top: 7.5rem solid transparent; content: ""; }
.envelope::before { left: 0; border-right: 9rem solid #f4e8ac; }
.envelope::after { right: 0; border-left: 9rem solid #f4e8ac; }
.envelope-flap { position: absolute; z-index: 2; top: 0; left: 0; width: 0; height: 0; border-top: 6.5rem solid #dfc45d; border-right: 9rem solid transparent; border-left: 9rem solid transparent; transform-origin: top; transition: transform 200ms ease; }
.envelope[aria-expanded="true"] .envelope-flap { transform: rotateX(180deg); }
.envelope-label { position: relative; z-index: 3; display: inline-block; margin-top: 7rem; color: var(--brown); font-size: 0.78rem; font-weight: 800; }
.birthday-letter { width: min(100%, 43rem); margin-top: 2rem; padding: clamp(1.5rem, 5vw, 3.25rem); text-align: left; }
.birthday-letter[hidden] { display: none; }
.letter-copy { color: var(--muted); font-family: Georgia, serif; font-size: 1.1rem; }
.letter-closing { margin-top: 1.5rem; color: var(--brown); font-family: Georgia, serif; font-size: clamp(1.5rem, 4vw, 2.3rem); }
.letter-signature { margin: 1.25rem 0 0; font-family: Georgia, serif; font-style: italic; }
.letter-postscript { display: flex; align-items: center; gap: 0.5rem; margin: 2rem 0 0; color: #866718; font-size: 0.85rem; }
.closing-flower { color: var(--gold); font-size: 1.35rem; }
.site-footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.4rem clamp(1.25rem, 8vw, 8.5rem); background: var(--brown); color: var(--cream); font-size: 0.73rem; }
.site-footer a { color: #e6d9bb; }
.load-error { margin: 1rem; padding: 1rem; border: 1px solid #9a332b; background: #fff2ef; color: #6b1f18; }

.lightbox { width: min(94vw, 1000px); max-width: none; max-height: 94vh; padding: 1rem; border: 1px solid var(--line); background: var(--cream); color: var(--brown); box-shadow: 0 24px 80px rgb(0 0 0 / 28%); }
.lightbox::backdrop { background: rgb(31 28 23 / 80%); backdrop-filter: blur(3px); }
.lightbox-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.lightbox-top p { margin: 0; color: var(--muted); font-size: 0.75rem; }
.lightbox-close { width: 2.35rem; height: 2.35rem; font-size: 1.3rem; }
.lightbox-image-wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 0.5rem; }
.lightbox-image-wrap img { display: block; width: auto; max-width: min(75vw, 800px); height: auto; max-height: 70vh; object-fit: contain; }
.lightbox-image-wrap .icon-button { background: #fffdf6; }
.lightbox-caption { margin: 0.8rem 3rem 0; color: var(--muted); font-size: 0.8rem; text-align: center; }
.lightbox-audio { width: min(35rem, 100%); margin: 1rem auto 0; color: var(--brown); }
.lightbox-audio-label { margin-bottom: 0.45rem; font-size: 0.75rem; }
.lightbox-audio .waveform { color: var(--gold); }
