/* ==========================================================
   The Rodia Edit — A Little Matcha, A Lot of Love
   ========================================================== */

@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-latin-full-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-latin-full-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("fonts/dm-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 100 1000; font-style: normal; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("fonts/caveat-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --choc: #3B251E;
  --choc-2: #6B4A3E;
  --cream: #F5EFE5;
  --paper: #FBF7F0;
  --kraft: #E8DCC8;
  --matcha: #87936A;
  --matcha-soft: #B4BD98;
  --olive: #465136;

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Caveat", "Bradley Hand", cursive;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1240px;
  --bar: 56px;
  --shadow: 0 1px 2px rgba(59, 37, 30, .08), 0 10px 30px -12px rgba(59, 37, 30, .35);
  --ease: cubic-bezier(.22, .8, .24, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--cream);
  color: var(--choc);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
em { font-style: italic; }
p { margin: 0; }

:focus-visible { outline: 3px solid var(--olive); outline-offset: 3px; border-radius: 4px; }
.letter :focus-visible, .lightbox :focus-visible { outline-color: var(--matcha-soft); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Type helpers ---------- */
.kicker {
  font-family: var(--sans);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--olive);
  margin-bottom: 1rem;
}
.kicker--light { color: var(--matcha-soft); }

.chapter__title, .hero__title, .spread__title, .finale__line, .paper__greeting {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 60, "WONK" 0;
  font-weight: 640;
  letter-spacing: -.02em;
  line-height: 1.02;
  margin: 0;
}
.chapter__title { font-size: clamp(2.3rem, 6vw, 4.6rem); max-width: 16ch; }
.chapter__title em, .hero__title em, .finale__line em { font-weight: 500; color: var(--olive); }
.chapter__sub { margin-top: 1.1rem; font-size: clamp(1.05rem, 1.6vw, 1.25rem); max-width: 40ch; color: var(--choc-2); font-weight: 500; }

.hand { font-family: var(--hand); font-weight: 600; color: var(--choc-2); font-size: 1.6rem; line-height: 1.1; }

.chapter { position: relative; padding-block: clamp(72px, 11vw, 150px); scroll-margin-top: var(--bar); }
.chapter__head { margin-bottom: clamp(40px, 6vw, 80px); }
.chapter__head--center { text-align: center; }
.chapter__head--center .chapter__title, .chapter__head--center .chapter__sub { margin-inline: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .6em;
  min-height: 52px; padding: .85em 1.6em;
  border-radius: 999px; border: 2px solid currentColor;
  font-family: var(--sans); font-weight: 700; font-size: 1rem; letter-spacing: .01em;
  text-decoration: none; cursor: pointer;
  transition: transform .25s var(--ease), background-color .25s, color .25s;
}
.btn span { transition: transform .25s var(--ease); }
.btn:hover span { transform: translateX(4px); }
.btn:active { transform: scale(.98); }
.btn--dark { background: var(--choc); color: var(--cream); border-color: var(--choc); }
.btn--dark:hover { background: var(--olive); border-color: var(--olive); }
.btn--cream { background: var(--cream); color: var(--choc); border-color: var(--cream); }
.btn--cream:hover { background: var(--matcha-soft); border-color: var(--matcha-soft); }
.btn--ghost { background: transparent; color: var(--cream); border-color: rgba(245, 239, 229, .55); min-height: 46px; font-size: .95rem; }
.btn--ghost:hover { background: var(--cream); color: var(--choc); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--bar);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-inline: var(--gutter);
  background: rgba(245, 239, 229, .94);
  border-bottom: 1px solid rgba(59, 37, 30, .14);
  backdrop-filter: saturate(1.2);
}
.topbar__brand {
  font-family: var(--serif); font-weight: 700; font-style: italic; font-size: 1.15rem;
  color: var(--choc); text-decoration: none; white-space: nowrap; letter-spacing: -.01em;
}
.topbar__nav ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.topbar__nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--choc); text-decoration: none; border-radius: 999px; white-space: nowrap;
  transition: background-color .2s, color .2s;
}
.topbar__nav a:hover { background: rgba(135, 147, 106, .22); }
.topbar__nav a[aria-current="true"] { background: var(--choc); color: var(--cream); }

@media (max-width: 720px) {
  .topbar__brand { display: none; }
  .topbar { justify-content: center; padding-inline: 8px; }
  .topbar__nav { width: 100%; }
  .topbar__nav ol { justify-content: space-between; gap: 0; }
  .topbar__nav a { padding: 0 9px; font-size: .7rem; letter-spacing: .07em; }
}
@media (max-width: 360px) {
  .topbar__nav a { padding: 0 6px; font-size: .66rem; letter-spacing: .04em; }
}

/* ---------- Photo frames ---------- */
.photo {
  position: relative; display: block; width: 100%;
  padding: 0; border: 0; background: var(--paper);
  cursor: zoom-in; box-shadow: var(--shadow);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.photo picture, .photo img { width: 100%; }
.photo img { height: auto; aspect-ratio: auto; }
.photo:hover { transform: translateY(-4px) rotate(-.4deg); }
.photo:focus-visible { outline-offset: 5px; }

/* Photo corners (scrapbook) */
.photo--corners::after {
  content: ""; position: absolute; inset: -6px; pointer-events: none;
  --k: var(--choc);
  background:
    linear-gradient(135deg, var(--k) 0 50%, transparent 50%) top left / 26px 26px no-repeat,
    linear-gradient(225deg, var(--k) 0 50%, transparent 50%) top right / 26px 26px no-repeat,
    linear-gradient(45deg,  var(--k) 0 50%, transparent 50%) bottom left / 26px 26px no-repeat,
    linear-gradient(315deg, var(--k) 0 50%, transparent 50%) bottom right / 26px 26px no-repeat;
}
/* Washi tape */
.photo--tape::before {
  content: ""; position: absolute; z-index: 2; top: -14px; left: 50%;
  width: 96px; height: 28px; transform: translateX(-50%) rotate(-4deg);
  background: rgba(180, 189, 152, .82);
  box-shadow: 0 1px 2px rgba(59, 37, 30, .12);
  clip-path: polygon(3% 0, 97% 4%, 100% 50%, 96% 100%, 2% 96%, 0 50%);
}

/* ==========================================================
   CHAPTER 1 · HERO
   ========================================================== */
.hero { padding-top: clamp(20px, 3vw, 36px); padding-bottom: clamp(64px, 8vw, 110px); overflow: hidden; }
.masthead {
  display: flex; align-items: center; gap: 16px;
  font-size: .72rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
  color: var(--choc);
  padding-bottom: 14px; border-bottom: 2px solid var(--choc);
}
.masthead__rule { flex: 1; height: 1px; background: rgba(59, 37, 30, .3); }
@media (max-width: 560px) {
  .masthead { font-size: .6rem; letter-spacing: .12em; gap: 10px; white-space: nowrap; padding-bottom: 10px; }
}

.hero__grid {
  display: grid; gap: clamp(28px, 5vw, 72px);
  grid-template-columns: 1.15fr .85fr; align-items: center;
  padding-top: clamp(32px, 5vw, 64px);
}
.hero__title { font-size: clamp(3.2rem, 9.2vw, 8.6rem); line-height: .92; letter-spacing: -.035em; font-weight: 680; }
.hero__title em { display: block; }
.hero__lede {
  margin: clamp(20px, 3vw, 32px) 0 clamp(26px, 3.5vw, 40px);
  font-family: var(--serif); font-style: italic; font-weight: 420;
  font-size: clamp(1.25rem, 2.1vw, 1.7rem); line-height: 1.3; max-width: 26ch; color: var(--choc-2);
}

.hero__photo { position: relative; margin: 0; justify-self: end; width: min(100%, 470px); }
.hero__photo .photo { transform: rotate(1.6deg); }
.hero__photo .photo:hover { transform: rotate(.6deg) translateY(-4px); }
.hero__photo .photo { padding: 12px 12px 14px; }
.hero__hand { position: absolute; left: -12px; bottom: -44px; transform: rotate(-5deg); font-size: 1.75rem; }
.hero__sprig { position: absolute; width: 74px; height: 74px; right: -22px; top: -30px; color: var(--matcha); transform: rotate(18deg); }

@media (prefers-reduced-motion: no-preference) {
  .hero__title, .hero__lede, .hero__text .btn, .hero__text .kicker { animation: rise .9s var(--ease) both; }
  .hero__text .kicker { animation-delay: .05s; }
  .hero__title { animation-delay: .12s; }
  .hero__lede { animation-delay: .3s; }
  .hero__text .btn { animation-delay: .42s; }
  .hero__photo { animation: photoIn 1.1s var(--ease) .15s both; }
  .hero__hand { animation: fadeIn .8s ease 1s both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes photoIn { from { opacity: 0; transform: translateY(26px) rotate(3deg); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 899px) {
  .hero__grid { grid-template-columns: 1fr; padding-top: 24px; }
  .hero__photo { order: -1; justify-self: center; width: min(82%, 380px); margin-bottom: 26px; }
  .hero__photo .photo { padding: 9px 9px 10px; }
  .hero__photo img { max-height: 40svh; object-fit: cover; object-position: 42% 24%; }
  .hero__hand { left: auto; right: -14px; bottom: -30px; font-size: 1.45rem; }
  .hero__sprig { width: 54px; height: 54px; right: auto; left: -24px; top: -18px; transform: rotate(-12deg); }
  .hero__title { font-size: clamp(2.9rem, 13vw, 5.4rem); }
  .hero__lede { margin: 16px 0 24px; }
}

/* ==========================================================
   CHAPTER 2 · THE EDIT
   ========================================================== */
.edit { border-top: 1px solid rgba(59, 37, 30, .12); }

.collage { display: grid; grid-template-columns: 1fr; gap: 64px; }
.ed { margin: 0; position: relative; }
.ed figcaption { margin-top: 18px; display: grid; gap: 4px; max-width: 30ch; }
.ed figcaption strong {
  font-family: var(--serif); font-weight: 650; font-size: 1.55rem; line-height: 1.12; letter-spacing: -.01em;
  font-variation-settings: "SOFT" 60;
}
.ed figcaption span:not(.ed__no):not(.swatches) { color: var(--choc-2); font-size: 1rem; }
.ed__no { font-size: .7rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--olive); }
.ed .photo { padding: 8px; }
.swatches { display: flex; gap: 6px; margin-top: 10px; }
.swatches i { width: 22px; height: 22px; border-radius: 50%; background: var(--c); border: 1.5px solid var(--paper); box-shadow: 0 0 0 1px rgba(59,37,30,.2); }
.ed__hand { position: absolute; font-size: 1.5rem; transform: rotate(-6deg); color: var(--olive); }

/* mobile: staggered single column */
.ed:nth-child(odd)  { width: 88%; }
.ed:nth-child(even) { width: 80%; margin-left: auto; }
.ed:nth-child(even) figcaption { margin-left: auto; text-align: right; justify-items: end; }
.ed--4 .ed__hand { top: -36px; left: 0; }
.ed--2 .photo { transform: rotate(1.2deg); }
.ed--4 .photo { transform: rotate(-1deg); }

@media (min-width: 640px) {
  .collage { grid-template-columns: 1fr 1fr; column-gap: 40px; row-gap: 72px; }
  .ed:nth-child(odd), .ed:nth-child(even) { width: auto; margin-left: 0; }
  .ed:nth-child(even) figcaption { margin-left: 0; text-align: left; justify-items: start; }
  .ed:nth-child(even) { margin-top: 90px; }
}

@media (min-width: 960px) {
  .collage { grid-template-columns: repeat(12, 1fr); column-gap: 24px; row-gap: 40px; }
  .ed:nth-child(even) { margin-top: 0; }
  .ed--1 { grid-column: 1 / 5; grid-row: 1; }
  .ed--2 { grid-column: 6 / 13; grid-row: 1; align-self: end; display: grid; grid-template-columns: 1fr 1.25fr; gap: 28px; align-items: end; }
  .ed--2 .photo { grid-column: 2; grid-row: 1; }
  .ed--2 figcaption { grid-column: 1; grid-row: 1; text-align: right; justify-items: end; margin: 0 0 24px auto; }
  .ed--3 { grid-column: 1 / 4; grid-row: 2; align-self: start; margin-top: 70px; }
  .ed--4 { grid-column: 5 / 9; grid-row: 2; margin-top: 120px; }
  .ed--5 { grid-column: 10 / 13; grid-row: 2; align-self: start; margin-top: 10px; }
  .ed--4 .ed__hand { top: -44px; left: 10px; }
}

/* Appreciation spread */
.spread {
  position: relative; margin-top: clamp(88px, 12vw, 160px);
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--paper); box-shadow: var(--shadow);
  border: 1px solid rgba(59, 37, 30, .08);
}
.spread::before { /* centre fold */
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px;
  background: rgba(59, 37, 30, .16); box-shadow: -6px 0 14px rgba(59,37,30,.06), 6px 0 14px rgba(59,37,30,.06);
}
.spread__page { padding: clamp(24px, 4vw, 56px); }
.spread__page--left { display: flex; align-items: center; }
.spread__page--left .photo { box-shadow: none; padding: 0; }
.spread__page--right { display: flex; flex-direction: column; justify-content: center; }
.spread__title { font-size: clamp(1.8rem, 3.2vw, 2.8rem); line-height: 1.08; max-width: 18ch; }
.spread__quote { margin: 26px 0 0; padding: 0; }
.spread__quote p { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(1.05rem, 1.4vw, 1.2rem); line-height: 1.6; color: var(--choc-2); max-width: 46ch; }
.spread__small { width: 52%; margin-top: 36px; align-self: flex-end; transform: rotate(2.4deg); padding: 7px; }

@media (max-width: 899px) {
  .spread { grid-template-columns: 1fr 1fr; }
  .spread::before { display: none; }
  .spread__page--right { display: contents; }
  .spread__page--right .kicker, .spread__title, .spread__quote { grid-column: 1 / -1; padding-inline: clamp(20px, 5vw, 40px); }
  .spread__page--right .kicker { order: -3; padding-top: 34px; margin-bottom: 12px; }
  .spread__title { order: -2; }
  .spread__quote { order: -1; margin-top: 18px; padding-bottom: 28px; }
  .spread__page--left { grid-column: 1; padding: 0 8px 22px 20px; align-items: flex-start; }
  .spread__small { grid-column: 2; width: auto; margin: 22px 20px 22px 8px; align-self: start; transform: rotate(2deg); }
}

/* ==========================================================
   CHAPTER 3 · MATCHA
   ========================================================== */
.matcha { background: var(--matcha-soft); color: var(--choc); overflow: hidden; }
.matcha .kicker { color: var(--choc); }
.matcha .chapter__title em { color: var(--choc); font-style: italic; }
.matcha__grid { display: grid; gap: 40px; grid-template-columns: 1fr; }
.matcha__instruction {
  margin-top: 20px; display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.1rem; color: var(--choc);
  padding: 10px 18px; background: rgba(251, 247, 240, .55); border-radius: 18px;
}
.matcha__stage { display: grid; grid-template-columns: 1fr; justify-items: center; gap: 12px; }

.cup {
  appearance: none; border: 0; background: none; padding: 8px; cursor: pointer;
  width: min(100%, 420px); border-radius: 32px; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.cup:focus-visible { outline: 3px solid var(--choc); outline-offset: 4px; }
.cup__art { width: 100%; height: auto; overflow: visible; display: block; }
.cup__body, .cup__art { transform-box: fill-box; }
.cup__body { transform-origin: 50% 100%; }
.cup:hover .cup__body { transform: translateY(-3px); transition: transform .3s var(--ease); }
.cup.is-tapped .cup__body { animation: wobble .6s var(--ease); }
@keyframes wobble {
  0% { transform: rotate(0); } 25% { transform: rotate(-5deg) translateY(-6px); }
  55% { transform: rotate(3.5deg) translateY(-2px); } 80% { transform: rotate(-1.2deg); } 100% { transform: rotate(0); }
}
.cup__steam path { opacity: .85; }
@media (prefers-reduced-motion: no-preference) {
  .cup__steam path { animation: steam 4.2s ease-in-out infinite; }
  .cup__steam .s2 { animation-delay: 1.3s; }
  .cup__steam .s3 { animation-delay: 2.5s; }
}
@keyframes steam {
  0% { transform: translateY(8px); opacity: 0; } 30% { opacity: .85; }
  70% { opacity: .6; } 100% { transform: translateY(-12px); opacity: 0; }
}

.note-area { position: relative; width: min(100%, 440px); min-height: 230px; display: grid; align-items: start; }
.hint-narrow { display: none; }
@media (max-width: 899px) { .hint-wide { display: none; } .hint-narrow { display: inline; } }
.note-area__hint { color: var(--choc); font-size: 1.55rem; transform: rotate(-3deg); padding: 24px 8px; text-align: center; }
.matcha-note {
  position: relative; background: var(--paper); color: var(--choc);
  padding: 30px 30px 22px; box-shadow: var(--shadow);
  transform: rotate(var(--tilt, -1.5deg));
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 26px), calc(100% - 26px) 100%, 0 100%);
}
.matcha-note::after { /* folded corner */
  content: ""; position: absolute; right: 0; bottom: 0; width: 26px; height: 26px;
  background: linear-gradient(315deg, transparent 50%, var(--kraft) 50%);
}
.matcha-note::before { /* tape */
  content: ""; position: absolute; top: -10px; left: 28px; width: 72px; height: 22px;
  background: rgba(135, 147, 106, .55); transform: rotate(-6deg);
}
.matcha-note__text { font-family: var(--serif); font-style: italic; font-weight: 450; font-size: clamp(1.4rem, 2.6vw, 1.85rem); line-height: 1.25; min-height: 3.75em; }
.matcha-note__count { margin-top: 18px; font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--olive); }
.matcha-note__dots { list-style: none; margin: 10px 0 0; padding: 0; display: flex; gap: 6px; }
.matcha-note__dots li { width: 22px; height: 4px; border-radius: 4px; background: rgba(70, 81, 54, .22); transition: background-color .3s; }
.matcha-note__dots li.on { background: var(--olive); }
.matcha-note.is-new { animation: noteIn .55s var(--ease); }
@keyframes noteIn { from { opacity: 0; transform: translateY(26px) rotate(calc(var(--tilt, -1.5deg) - 4deg)); } to { opacity: 1; transform: rotate(var(--tilt, -1.5deg)); } }

.matcha__fallback { display: none; }
html:not(.js) .matcha__fallback { display: grid; gap: 10px; list-style: none; padding: 0; margin: 0; max-width: 440px; font-family: var(--serif); font-style: italic; font-size: 1.2rem; }
html:not(.js) .note-area, html:not(.js) .matcha__instruction { display: none; }

@media (min-width: 900px) {
  .matcha__grid { grid-template-columns: 1fr; }
  .matcha__stage { grid-template-columns: 1.05fr .95fr; align-items: center; justify-items: stretch; gap: 48px; }
  .cup { justify-self: center; }
  .note-area__hint { text-align: left; }
}

/* ==========================================================
   CHAPTER 4 · DUAS
   ========================================================== */
.duas { background: var(--kraft); }
.duas .chapter__sub { color: var(--choc-2); }
.dua-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
@media (min-width: 640px) { .dua-list { grid-template-columns: 1fr 1fr; gap: 26px; } }
@media (min-width: 1000px) { .dua-list { grid-template-columns: repeat(3, 1fr); gap: 30px 34px; } }

.dua { position: relative; background: var(--paper); box-shadow: var(--shadow); transform: rotate(var(--r, 0deg)); transition: transform .4s var(--ease); }
.dua:nth-child(1) { --r: -.8deg; } .dua:nth-child(2) { --r: .6deg; } .dua:nth-child(3) { --r: -.4deg; }
.dua:nth-child(4) { --r: .7deg; } .dua:nth-child(5) { --r: -.6deg; } .dua:nth-child(6) { --r: .5deg; }
.dua.is-open { --r: 0deg; }
.dua::after { /* dog-ear */
  content: ""; position: absolute; top: 0; right: 0; width: 30px; height: 30px;
  background: linear-gradient(225deg, var(--kraft) 50%, #DCCCB3 50%);
  transition: width .35s var(--ease), height .35s var(--ease);
}
.dua.is-open::after { width: 0; height: 0; }
.dua::before { /* fold crease */
  content: ""; position: absolute; left: 0; right: 30px; top: 50%; height: 1px;
  background: rgba(59, 37, 30, .07); box-shadow: 0 1px 0 rgba(255,255,255,.7); pointer-events: none;
}
.dua.is-open::before { display: none; }

.dua__toggle {
  width: 100%; min-height: 96px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  padding: 24px 26px; background: none; border: 0; text-align: left; cursor: pointer; color: var(--choc);
}
.dua__num { font-family: var(--serif); font-style: italic; font-weight: 500; color: var(--olive); font-size: 1.1rem; min-width: 1.8em; }
.dua__for { display: block; font-family: var(--sans); font-size: .66rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--olive); margin-bottom: 6px; }
.dua__label { font-family: var(--serif); font-weight: 650; font-size: 1.55rem; letter-spacing: -.01em; line-height: 1.1; font-variation-settings: "SOFT" 60; }
.dua__state {
  font-size: .7rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--olive);
  padding: 7px 12px; border: 1.5px solid currentColor; border-radius: 999px; white-space: nowrap;
}
.dua__toggle:hover .dua__label { color: var(--olive); }
.dua__body { padding: 0 26px 28px; }
.dua__body p {
  padding-top: 20px; border-top: 1px dashed rgba(59, 37, 30, .3);
  font-family: var(--serif); font-style: italic; font-weight: 420; font-size: 1.18rem; line-height: 1.55;
}
.dua__body[hidden] { display: none; }
.dua.is-open .dua__body { animation: unfold .45s var(--ease); transform-origin: top; }
@keyframes unfold { from { opacity: 0; transform: perspective(600px) rotateX(-28deg); } to { opacity: 1; transform: none; } }

.ameen { text-align: center; margin-top: clamp(48px, 7vw, 80px); font-family: var(--serif); font-style: italic; font-weight: 550; font-size: clamp(1.8rem, 3.6vw, 2.6rem); }

/* ==========================================================
   CHAPTER 5 · LETTER
   ========================================================== */
.letter { background: var(--choc); color: var(--cream); padding-bottom: clamp(56px, 8vw, 100px); }
.letter .chapter__title { color: var(--cream); }
.letter .chapter__title em { color: var(--matcha-soft); }

.envelope-stage { display: grid; justify-items: center; gap: 34px; padding-top: 44px; }
.envelope-stage[hidden] { display: none; }
.envelope {
  position: relative; width: min(460px, 100%); aspect-ratio: 1.6; perspective: 1200px;
  filter: drop-shadow(0 22px 30px rgba(0, 0, 0, .35));
}
.envelope__back { position: absolute; inset: 0; background: #E9DFCE; border-radius: 6px; }
.envelope__sheet {
  position: absolute; left: 7%; right: 7%; top: 8%; bottom: 6%;
  background: var(--paper); border-radius: 3px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 22px, rgba(59,37,30,.08) 22px 23px);
  transition: transform .6s var(--ease) .25s;
}
.envelope__pocket {
  position: absolute; inset: 0; border-radius: 6px; background: var(--cream);
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
}
.envelope__flap {
  position: absolute; left: 0; right: 0; top: 0; height: 62%;
  background: #EFE6D7; transform-origin: top center;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transition: transform .6s var(--ease); z-index: 2;
  backface-visibility: hidden;
}
.envelope__seal {
  position: absolute; z-index: 3; left: 50%; top: 52%; transform: translate(-50%, -50%);
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--matcha); color: var(--paper);
  font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 1.5rem;
  box-shadow: inset 0 0 0 4px rgba(70, 81, 54, .45), 0 2px 4px rgba(0,0,0,.2);
  transition: opacity .3s, transform .4s var(--ease);
}
.envelope__stamp {
  position: absolute; z-index: 1; right: 6%; bottom: 10%; width: 42px; height: 52px;
  border: 2px dashed rgba(59, 37, 30, .35); display: grid; place-items: center; color: var(--olive);
}
.envelope__stamp svg { width: 22px; height: 30px; }
.envelope__address {
  position: absolute; z-index: 1; left: 0; right: 0; bottom: 13%; text-align: center;
  font-family: var(--serif); font-weight: 600; font-size: clamp(1.25rem, 3.4vw, 1.6rem); color: var(--choc);
}
.envelope__address em { font-family: var(--hand); font-style: normal; font-weight: 600; font-size: 1.25em; color: var(--olive); }

.envelope-stage.is-opening .envelope__flap { transform: rotateX(180deg); }
.envelope-stage.is-opening .envelope__seal { opacity: 0; transform: translate(-50%, -80%) scale(.8); }
.envelope-stage.is-opening .envelope__sheet { transform: translateY(-38%); }
.envelope-stage.is-opening { animation: stageOut .35s ease .95s forwards; }
@keyframes stageOut { to { opacity: 0; transform: translateY(-10px); } }

.letter-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; max-width: 1080px; margin-inline: auto; }
.letter-wrap[hidden] { display: none; }
.letter-wrap.is-revealed { animation: letterIn .7s var(--ease) both; }
@keyframes letterIn { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
.letter__photo { margin: 0; }
.letter__photo .photo { padding: 8px; }
.letter__photo--a .photo { transform: rotate(-2.4deg); }
.letter__photo--b .photo { transform: rotate(2deg); margin-top: 28px; }
.letter__photo--a img { aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 30%; }

.paper {
  grid-column: 1 / -1; grid-row: 2;
  background: var(--paper); color: var(--choc);
  padding: clamp(28px, 6vw, 72px) clamp(22px, 6vw, 76px) clamp(36px, 6vw, 72px);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5);
  position: relative;
}
.paper::before { /* deckled top edge */
  content: ""; position: absolute; left: 0; right: 0; top: -9px; height: 10px; background: var(--paper);
  clip-path: polygon(0 100%, 0 40%, 3% 70%, 6% 30%, 9% 65%, 13% 35%, 17% 70%, 21% 40%, 25% 75%, 29% 30%, 33% 60%, 37% 35%, 41% 70%, 45% 45%, 49% 75%, 53% 30%, 57% 65%, 61% 40%, 65% 70%, 69% 35%, 73% 60%, 77% 30%, 81% 70%, 85% 40%, 89% 65%, 93% 30%, 97% 60%, 100% 40%, 100% 100%);
}
.paper__date { font-size: .72rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--olive); margin-bottom: 18px; }
.paper__greeting { font-size: clamp(2rem, 4.6vw, 3.1rem); margin-bottom: 28px; outline: none; }
.paper p:not(.paper__date) {
  font-family: var(--serif); font-weight: 400; font-size: clamp(1.08rem, 1.5vw, 1.2rem); line-height: 1.75;
  font-variation-settings: "SOFT" 40; max-width: 62ch;
}
.paper p + p { margin-top: 1.05em; }
.paper__sign { margin-top: 2em !important; display: grid; gap: 2px; }
.paper__name { font-family: var(--hand); font-weight: 600; font-size: 2.6rem; line-height: 1; color: var(--olive); margin-top: 6px; }
.paper__ps { font-size: .98rem; color: var(--choc-2); font-style: italic; }

@media (min-width: 1100px) {
  .letter-wrap { grid-template-columns: 220px minmax(0, 1fr) 220px; gap: 40px; }
  .paper { grid-column: 2; grid-row: 1; }
  .letter__photo--a { grid-column: 1; grid-row: 1; margin-top: 60px; }
  .letter__photo--b { grid-column: 3; grid-row: 1; align-self: end; margin-bottom: 120px; }
  .letter__photo--b .photo { margin-top: 0; }
}
@media (max-width: 639px) {
  .letter-wrap { gap: 14px; }
  .letter__photo--b .photo { margin-top: 18px; }
}

.finale { margin-top: clamp(80px, 10vw, 130px); text-align: center; display: grid; justify-items: center; gap: 26px; }
.finale__sprig { width: 58px; height: 58px; color: var(--matcha); }
.finale__line { font-size: clamp(2.2rem, 6vw, 4.4rem); max-width: 16ch; color: var(--cream); }
.finale__line em { color: var(--matcha-soft); }
.finale__credit { margin-top: 30px; font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: rgba(245, 239, 229, .72); }

/* ==========================================================
   LIGHTBOX
   ========================================================== */
.lightbox { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 64px 16px 88px; }
.lightbox[hidden] { display: none; }
.lightbox__backdrop { position: absolute; inset: 0; background: rgba(32, 20, 16, .97); }
.lightbox__figure { position: relative; margin: 0; max-width: min(92vw, 720px); display: grid; justify-items: center; gap: 14px; touch-action: pan-y; }
.lightbox__figure img { width: auto; max-width: 100%; max-height: calc(100svh - 190px); object-fit: contain; box-shadow: 0 20px 50px rgba(0,0,0,.5); background: #2a1c17; }
.lightbox__figure figcaption { color: var(--cream); font-family: var(--serif); font-style: italic; font-size: 1.1rem; text-align: center; max-width: 46ch; }
.lightbox.is-anim .lightbox__figure img { animation: lbIn .35s var(--ease); }
@keyframes lbIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.lightbox__count { position: absolute; top: 20px; left: 20px; color: rgba(245,239,229,.8); font-size: .8rem; font-weight: 700; letter-spacing: .16em; }
.lightbox__btn {
  position: absolute; width: 52px; height: 52px; border-radius: 50%;
  border: 1.5px solid rgba(245, 239, 229, .5); background: rgba(59, 37, 30, .7); color: var(--cream);
  font-size: 1.3rem; cursor: pointer; display: grid; place-items: center; transition: background-color .2s;
}
.lightbox__btn:hover { background: var(--olive); }
.lightbox__close { top: 12px; right: 12px; }
.lightbox__prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 16px; top: 50%; transform: translateY(-50%); }
@media (max-width: 760px) {
  .lightbox__prev, .lightbox__next { top: auto; bottom: 18px; transform: none; }
  .lightbox__prev { left: calc(50% - 64px); }
  .lightbox__next { right: calc(50% - 64px); }
}
body.lb-open { overflow: hidden; }

/* ==========================================================
   REVEALS & CONFETTI
   ========================================================== */
.reveal-ready .reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal-ready .reveal.in { opacity: 1; transform: none; }
.reveal-ready .dua.reveal.in { transform: rotate(var(--r, 0deg)); }

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal-ready .reveal { opacity: 1; transform: none; }
  .photo:hover { transform: none; }
}

/* ==========================================================
   MUSIC TOGGLE
   ========================================================== */
.music {
  position: fixed; z-index: 80; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 18px 0 16px; border-radius: 999px;
  border: 2px solid var(--cream); background: var(--choc); color: var(--cream);
  font-family: var(--sans); font-weight: 700; font-size: .85rem; letter-spacing: .02em;
  cursor: pointer; box-shadow: 0 8px 24px -8px rgba(59, 37, 30, .6);
  transition: background-color .25s, transform .25s var(--ease);
}
.music:hover { background: var(--olive); }
.music:active { transform: scale(.97); }
.music:focus-visible { outline: 3px solid var(--olive); outline-offset: 3px; }
.music__bars { display: inline-flex; align-items: flex-end; gap: 3px; height: 16px; }
.music__bars i { width: 3px; height: 5px; border-radius: 2px; background: var(--matcha-soft); }
.music[aria-pressed="true"] .music__bars i { height: 14px; }
@media (prefers-reduced-motion: no-preference) {
  .music[aria-pressed="true"] .music__bars i { animation: eq 1s ease-in-out infinite; }
  .music[aria-pressed="true"] .music__bars i:nth-child(2) { animation-delay: .25s; }
  .music[aria-pressed="true"] .music__bars i:nth-child(3) { animation-delay: .5s; }
  .music.is-waiting { animation: nudge 2.4s ease-in-out infinite; }
}
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 15px; } }
@keyframes nudge { 0%, 80%, 100% { transform: none; } 88% { transform: translateY(-4px); } 94% { transform: translateY(0); } }
@media (max-width: 560px) {
  .music { min-height: 44px; padding: 0 14px 0 13px; font-size: .78rem; }
  .music[aria-pressed="true"] .music__label { display: none; }
  .music[aria-pressed="true"] { padding: 0 13px; }
}

/* ==========================================================
   INTRO · countdown → heart → tap to enter
   ========================================================== */
.intro { display: none; }
html.intro-active .intro {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  background: var(--choc); color: var(--cream);
  padding: 24px 16px; overflow: hidden;
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
html.intro-active body { overflow: hidden; }
html.intro-active .music { display: none; }
html.intro-active .hero, html.intro-active .hero * { animation-play-state: paused !important; }
html.intro-leaving .intro { opacity: 0; transform: scale(1.04); pointer-events: none; }

.intro__canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.intro__brand {
  position: absolute; top: max(22px, env(safe-area-inset-top)); left: 0; right: 0; text-align: center;
  font-size: .7rem; font-weight: 700; letter-spacing: .24em; text-transform: uppercase; color: var(--matcha-soft);
}

/* countdown */
.intro__count { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(58vw, 260px); aspect-ratio: 1; display: grid; place-items: center; transition: opacity .4s ease; }
.intro__ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.intro__ring circle { fill: none; stroke-width: 2.5; }
.intro__ring-track { stroke: rgba(245, 239, 229, .14); }
.intro__ring-bar { stroke: var(--matcha-soft); stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: 0; }
.intro__ring-bar.is-ticking { animation: ringTick .9s linear forwards; }
@keyframes ringTick { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 339.3; } }
.intro__num {
  font-family: var(--serif); font-weight: 600; font-style: italic;
  font-size: clamp(6rem, 30vw, 10rem); line-height: 1; color: var(--cream);
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.intro__num.is-pop { animation: numPop .9s var(--ease); }
@keyframes numPop { 0% { opacity: 0; transform: scale(.6); } 25% { opacity: 1; transform: scale(1.04); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: .15; transform: scale(.94); } }

/* heart stage */
.intro__stage { position: relative; display: grid; justify-items: center; text-align: center; gap: 14px; width: 100%; }
.intro[data-stage="count"] .intro__stage { visibility: hidden; }
.intro[data-stage="heart"] .intro__count { opacity: 0; pointer-events: none; }
.intro__heart { position: relative; width: min(82vw, 46svh, 430px); aspect-ratio: 1; }
.intro__photo {
  position: absolute; left: 50%; top: 45%; width: 42%; aspect-ratio: 1; height: auto;
  object-fit: cover; object-position: 40% 24%; border-radius: 50%;
  border: 5px solid var(--cream); box-shadow: 0 0 0 1.5px rgba(180, 189, 152, .6), 0 18px 40px rgba(0, 0, 0, .4);
  transform: translate(-50%, -50%) scale(.7); opacity: 0;
  transition: opacity .9s var(--ease) .9s, transform 1.1s var(--ease) .9s;
}
.intro[data-stage="heart"] .intro__photo { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.intro__title {
  font-family: var(--serif); font-weight: 640; font-size: clamp(2rem, 7vw, 3.4rem); line-height: 1; letter-spacing: -.02em; margin: 0;
  font-variation-settings: "SOFT" 60;
}
.intro__title em { color: var(--matcha-soft); font-weight: 500; }
.intro__enter { margin-top: 10px; min-height: 54px; padding-inline: 2em; font-size: 1.05rem; }
.intro__sound { font-size: .85rem; color: rgba(245, 239, 229, .78); }
.intro__title, .intro__enter, .intro__sound { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.intro[data-stage="heart"] .intro__title { opacity: 1; transform: none; transition-delay: 1.5s; }
.intro[data-stage="heart"] .intro__enter { opacity: 1; transform: none; transition-delay: 1.8s; }
.intro[data-stage="heart"] .intro__sound { opacity: 1; transform: none; transition-delay: 2s; }
@media (prefers-reduced-motion: no-preference) {
  .intro[data-stage="heart"] .intro__enter { animation: enterGlow 2.2s ease-in-out 2.8s infinite; }
}
@keyframes enterGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(180, 189, 152, .55); } 50% { box-shadow: 0 0 0 10px rgba(180, 189, 152, 0); } }
@media (max-height: 640px) { .intro__heart { width: min(70vw, 40svh); } .intro__stage { gap: 8px; } }
#hero-title:focus, .paper__greeting:focus { outline: none; }
