/* ==========================================================================
   Anubis — a black-envelope invitation on aged paper
   ========================================================================== */

:root {
  --night: #000;
  --envelope: #141214;
  --parchment: #e4cc98;
  --parchment-light: #ecd8ac;
  --card: #e9d5a8;
  --ink: #2b1a0f;
  --ink-soft: #654a31;
  --ink-red: #8b2a0e;
  --wax: #b8491b;
  --wax-deep: #7a2a0c;
  --bone: #d9cfbb;
  --eye: #9fdc4e;

  --fell: 'IM Fell English', 'Iowan Old Style', Georgia, serif;
  --fell-sc: 'IM Fell English SC', 'IM Fell English', Georgia, serif;
  --hand: 'Homemade Apple', 'Segoe Script', cursive;

  --ew: min(600px, calc(100vw - 48px));
  --eh: calc(var(--ew) / 1.5);
  --seal: clamp(90px, calc(var(--ew) * 0.28), 164px);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--night);
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--night);
  color: var(--ink);
  font-family: var(--fell);
  font-size: clamp(1.06rem, 0.98rem + 0.35vw, 1.2rem);
  line-height: 1.6;
  overflow-x: hidden;
}
body.is-intro { overflow: hidden; }

[hidden] { display: none !important; }
/* one page, two audiences: the open page (/) and the invitation (/invite) */
[data-mode="public"] .invite-only, [data-mode="invite"] .public-only { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--ink-red); }
:focus-visible { outline: 2px dashed var(--wax); outline-offset: 3px; }
.letter:focus { outline: none; }

/* ---------- candlelit room ---------- */
.ambient {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 50% 38%, rgba(255, 138, 52, 0.17), transparent 70%),
    radial-gradient(ellipse 120% 70% at 50% 115%, rgba(110, 48, 12, 0.28), transparent 60%);
  animation: ambientIn 2.2s ease-out both, flicker 7s 2.2s infinite;
}
.ambient::after {
  content: ''; position: absolute; inset: 0;
  background-image: var(--tex-dark);
  background-size: 900px;
  opacity: 0.35;
  mix-blend-mode: screen;
}
@keyframes ambientIn { from { opacity: 0; } }
@keyframes flicker {
  0%, 100% { opacity: 1; }
  12% { opacity: 0.9; }
  14% { opacity: 0.97; }
  38% { opacity: 0.86; }
  41% { opacity: 1; }
  66% { opacity: 0.93; }
  70% { opacity: 0.88; }
  74% { opacity: 0.98; }
}

#scene {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; display: block;
}
.has-3d .ambient, .has-3d #dust { display: none; }

#dust {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; mix-blend-mode: screen;
}

/* ---------- corner tags: sound and language ---------- */
.corner {
  position: fixed; top: max(14px, env(safe-area-inset-top)); right: 16px; z-index: 60;
  display: flex; align-items: flex-start; gap: 10px;
}
.tag-btn {
  position: relative;
  font: 1rem/1 var(--fell); font-style: italic; color: var(--ink);
  padding: 0.55em 0.95em 0.5em 1.25em;
  border: 0; cursor: pointer;
  background: #dcbb79 var(--tex-manila);
  background-blend-mode: multiply;
  clip-path: polygon(14% 0, 100% 0, 100% 100%, 14% 100%, 0 50%);
  transform: rotate(3deg);
  transition: transform 0.35s cubic-bezier(.3,1.6,.5,1), opacity 0.3s;
  animation: tagIn 0.8s 2.4s both;
}
.tag-btn::before {
  content: ''; position: absolute; left: 9%; top: 50%; width: 6px; height: 6px;
  border-radius: 50%; background: #000; transform: translate(-50%, -50%);
}
.tag-btn:hover { transform: rotate(-2deg) translateY(2px); }
.sound-toggle { transform: rotate(-4deg); animation-delay: 2.6s; }
.sound-toggle[aria-pressed="false"] { opacity: 0.72; }
@keyframes tagIn { from { opacity: 0; transform: translateY(-20px) rotate(10deg); } }

/* ==========================================================================
   Intro: the black envelope
   ========================================================================== */
.intro {
  position: fixed; inset: 0; z-index: 50;
  perspective: 1600px;
  display: grid; place-items: center; align-content: center;
  gap: clamp(28px, 6vh, 56px);
  padding: 24px;
  transition: opacity 0.6s ease;
}
.intro.is-leaving { opacity: 0; pointer-events: none; }

.envelope {
  position: relative;
  width: var(--ew); height: var(--eh);
  /* tilts toward the cursor (JS sets `rotate`), independent of the float */
  transition: rotate 0.9s cubic-bezier(.2,.7,.2,1);
  will-change: transform, rotate;
  transform: rotate(-1.5deg);
  animation: envIn 1.5s 0.35s cubic-bezier(.2,.7,.2,1) both, envFloat 6s 1.85s ease-in-out infinite alternate;
}
@keyframes envIn {
  from { opacity: 0; transform: translateY(46px) rotate(-6deg) scale(0.96); filter: brightness(0.3); }
}
@keyframes envFloat {
  from { transform: rotate(-1.5deg); }
  to { transform: translateY(-7px) rotate(-0.8deg); }
}

.env-back, .env-front, .flap-face {
  background-color: var(--envelope);
  background-image: var(--tex-dark);
  background-size: 700px;
}
.env-back {
  position: absolute; inset: 0; z-index: 0; border-radius: 3px;
  background-color: #0b0a0b;
  background-image:
    repeating-linear-gradient(45deg, rgba(210, 110, 40, 0.22) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(-45deg, rgba(210, 110, 40, 0.22) 0 1px, transparent 1px 14px);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.env-front {
  position: absolute; inset: 0; z-index: 3;
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
  border-radius: 3px;
}
.env-front svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.env-front .side { fill: rgba(0, 0, 0, 0.18); }
.env-front .side--r { fill: rgba(0, 0, 0, 0.3); }
.env-front .bottom { fill: rgba(255, 245, 230, 0.035); }
.env-front .edge { fill: none; stroke: rgba(255, 240, 220, 0.12); stroke-width: 0.35; }
.env-front .edge--faint { stroke: rgba(0, 0, 0, 0.6); stroke-width: 0.6; }

.env-address {
  position: absolute; left: 0; right: 0; bottom: 9%;
  margin: 0; text-align: center;
  font-family: var(--hand); font-size: clamp(0.72rem, calc(var(--ew) * 0.028), 1.05rem);
  color: var(--bone); opacity: 0.78;
  transform: rotate(-2deg);
}

.env-flap {
  position: absolute; left: 0; top: 0; width: 100%; height: 58%;
  z-index: 4;
  transform-origin: 50% 0;
  transform-style: preserve-3d;
  transform: perspective(1000px) rotateX(0deg);
}
.flap-face {
  position: absolute; inset: 0;
  clip-path: polygon(0 0, 100% 0, 52% 99%, 50% 100%, 48% 99%);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.flap-out {
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.25)), var(--tex-dark);
}
.flap-in {
  transform: rotateX(180deg);
  /* this face is flipped twice (its own turn and the flap's), so its triangle is
     drawn point-up: once open, the wide edge stays on the hinge and the point rises */
  clip-path: polygon(48% 1%, 50% 0, 52% 1%, 100% 100%, 0 100%);
  background-color: #0b0a0b;
  background-image:
    repeating-linear-gradient(45deg, rgba(210, 110, 40, 0.24) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(-45deg, rgba(210, 110, 40, 0.24) 0 1px, transparent 1px 14px);
}
/* candlelight sliding over black paper */
.env-sheen {
  position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: 3px;
  mix-blend-mode: screen;
  background: radial-gradient(circle at var(--sx, 50%) var(--sy, 20%), rgba(255, 214, 170, 0.12), rgba(255, 196, 140, 0.035) 32%, transparent 62%);
  transition: opacity 0.4s;
}
.intro.is-opening .env-sheen { opacity: 0; }
/* soft shadow the closed flap throws onto the pocket */
.flap-shadow {
  position: absolute; left: 0; top: 0; width: 100%; height: 62%; z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse 30% 18% at 50% 92%, rgba(0, 0, 0, 0.55), transparent 70%);
  transition: opacity 0.4s;
}

/* the seal */
.seal {
  position: absolute; z-index: 5;
  left: 50%; top: 52%;
  width: var(--seal); height: var(--seal);
  margin: calc(var(--seal) / -2) 0 0 calc(var(--seal) / -2);
  padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 50%;
  transition: transform 0.4s cubic-bezier(.3,1.5,.5,1);
}
.seal { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.seal:hover:not(:disabled) { transform: scale(1.04) rotate(-2deg); }
/* pressed into the paper while held */
#seal.is-pressing { transform: scale(calc(1.01 - var(--press, 0) * 0.07)); transition: transform 0.15s ease-out; }
.seal:focus-visible { outline: 2px dashed var(--bone); outline-offset: 8px; }
.seal-whole, .seal-half, .seal-crack {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
}
/* hidden, not just transparent: the wax lighting filter is only computed for what's shown */
.seal-half { visibility: hidden; }
.seal.is-cracked .seal-half { visibility: visible; }
.seal.is-cracked .seal-whole { visibility: hidden; }
.seal-whole, .seal-half { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.9)) drop-shadow(0 5px 4px rgba(0, 0, 0, 0.6)) drop-shadow(0 12px 14px rgba(0, 0, 0, 0.45)); }
.seal-crack path {
  fill: none; stroke: #1c0500; stroke-width: 2.8; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
}
.seal-crack .branch { stroke-width: 1.6; }

.intro-hint {
  margin: 0;
  transition: opacity 0.3s;
  font-style: italic; font-size: clamp(1.1rem, 1rem + 0.6vw, 1.45rem);
  color: var(--bone); letter-spacing: 0.02em;
  animation: fadeIn 1.2s 2.4s both, breathe 3.6s 3.6s ease-in-out infinite;
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes breathe { 50% { opacity: 0.55; } }

.intro-skip {
  position: absolute; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%);
  background: none; border: 0; cursor: pointer;
  font: italic 0.95rem var(--fell); color: var(--bone); opacity: 0.5;
  text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 1px;
  animation: fadeIn 1s 3s both;
}
.intro-skip:hover { opacity: 0.9; }
.intro.is-opening .intro-hint,
.intro.is-opening .intro-skip { opacity: 0; transition: opacity 0.4s; animation: none; }

/* ---------- the folding letter (built in JS) ---------- */
.fold {
  position: absolute; left: 0; top: 0; z-index: 2;
  transform-origin: 0 0;
  transform-style: preserve-3d;
  perspective: 2200px;
  pointer-events: none;
}
.fold.is-free { position: fixed; z-index: 20; }
.fold .panel {
  position: absolute; left: 0; width: 100%;
  transform-style: preserve-3d;
}
.fold .p-top { transform-origin: 50% 100%; transform: translateZ(2px) rotateX(-180deg); }
.fold .p-bot { transform-origin: 50% 0; transform: translateZ(1px) rotateX(180deg); }
.fold .face {
  position: absolute; inset: 0; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.fold .face.back { transform: rotateX(180deg); }
.fold .shade {
  position: absolute; inset: 0; background: #1a0d04; opacity: 0; pointer-events: none;
}
.fold .clone { position: absolute; left: 0; margin: 0; }
.paper-plain {
  background-color: var(--parchment);
  background-image: var(--tex-1);
  background-size: 900px;
  background-blend-mode: multiply;
  box-shadow: inset 0 0 50px rgba(120, 70, 25, 0.45), inset 0 0 5px rgba(80, 40, 10, 0.5);
  display: grid; place-items: center; align-content: center; gap: 0.2em;
  color: var(--ink);
}
.paper-plain .to {
  font-family: var(--hand); font-size: 2.4rem; transform: rotate(-4deg);
}
.paper-plain svg { width: 64px; height: 64px; fill: var(--wax-deep); opacity: 0.8; }

.crumb {
  position: fixed; z-index: 30; pointer-events: none;
  border-radius: 40% 60% 50% 45%;
  background: radial-gradient(circle at 35% 30%, #e0773a, #7a2a0c 70%);
}

/* ==========================================================================
   Paper (layers built by paper.js: pale torn rim, surface, printed frame, candle glare)
   ========================================================================== */
.paper {
  position: relative;
  isolation: isolate;
  color: var(--ink);
}
.paper-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.paper-bg > span { position: absolute; inset: 0; }
/* shadows: a blurred copy of the torn outline, one soft and one close. Static, so
   they're blurred once instead of on every mouse move (a filter on the sheet would be) */
.pb-shadow { filter: blur(11px); transform: translateY(20px); opacity: 0.6; }
.pb-shadow--near { filter: blur(1.5px); transform: translateY(2px); opacity: 0.55; }
.pb-shadow > i { position: absolute; inset: 0; background: #000; }
.pb-rim { background-image: var(--tex-1); background-size: 900px; background-blend-mode: multiply; }
.pb-frame { inset: 14px !important; border: 3px double rgba(105, 58, 22, 0.42); border-radius: 2px; }
.pb-glare {
  mix-blend-mode: soft-light;
  background: radial-gradient(circle 720px at var(--gx, 50%) var(--gy, -30%),
    rgba(255, 238, 205, 0.62), rgba(255, 222, 170, 0.18) 38%, rgba(30, 14, 4, 0.2) 100%);
  /* its own layer: moving the light repaints only this gradient, not the whole sheet */
  will-change: transform;
}
.paper[data-paper="kraft"] { --ink-soft: #4a321d; }

/* lifts toward the cursor, as if picked up to the candle */
.paper[data-tilt] {
  transform: perspective(1500px) translateZ(calc(var(--lift, 0) * 1px))
    rotateX(calc(var(--rx, 0) * 1deg)) rotateY(calc(var(--ry, 0) * 1deg)) rotate(var(--rot, 0deg));
  transition: transform 0.7s cubic-bezier(.2,.75,.25,1);
  will-change: transform;
}

/* ==========================================================================
   The table
   ========================================================================== */
.table {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(72px, 12vw, 150px);
  padding: clamp(44px, 9vh, 96px) 16px 0;
}
body.is-intro .table { visibility: hidden; }
body.is-skipping .table { animation: fadeIn 0.9s both; }

h2 {
  margin: 0 0 0.35em;
  font-weight: 400;
  font-size: clamp(2rem, 1.5rem + 2vw, 2.7rem);
  line-height: 1.1;
  letter-spacing: -0.005em;
}
.lede { margin: 0 0 1.6em; color: var(--ink-soft); font-style: italic; max-width: 34em; }

/* ---------- the letter ---------- */
.letter {
  width: min(640px, 100%);
  padding: clamp(40px, 8vw, 76px) clamp(26px, 7vw, 68px) clamp(40px, 7vw, 64px);
}
.letter-inner { position: relative; }
.letter-mark { display: block; width: 58px; height: 58px; margin: 0 auto 0.6rem; fill: var(--ink); opacity: 0.85; }
.letter-eve {
  margin: 0; text-align: center; font-style: italic; color: var(--ink-soft);
  font-size: 1.15em;
}
.letter-title { margin: 0.1em 0 0; text-align: center; font-weight: 400; }
.letter-name {
  display: block;
  font-size: clamp(4.2rem, 17vw, 8rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-shadow: 0 0 1px rgba(43, 26, 15, 0.55);
}
.letter-turns {
  display: block; margin-top: 0.15em;
  font-style: italic; color: var(--ink-soft);
  font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.3rem);
}
.letter-body { margin: 1.7em 0 1.8em; hyphens: auto; }
.letter-body::first-letter {
  float: left; font-size: 3.4em; line-height: 0.82; padding: 0.06em 0.08em 0 0;
  color: var(--wax-deep);
}
.letter-details { margin: 0; border-top: 1px solid rgba(43, 26, 15, 0.28); }
.letter-details > div {
  display: grid; grid-template-columns: 8.5em 1fr; gap: 0 1em;
  padding: 0.7em 0;
  border-bottom: 1px solid rgba(43, 26, 15, 0.28);
}
.letter-details dt { font-style: italic; color: var(--ink-soft); }
.letter-details dd { margin: 0; white-space: pre-line; }
@media (max-width: 480px) {
  .letter-details > div { grid-template-columns: 1fr; }
}
.letter-links { display: flex; flex-wrap: wrap; gap: 0.4em 1.6em; margin: 1.5em 0 0; }
.letter-sign { position: relative; margin-top: 2.2em; text-align: right; }
.letter-sign p { margin: 0; font-style: italic; }
.letter-sign .signature {
  font-family: var(--hand); font-style: normal; font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem);
  line-height: 1.6; margin-top: 0.1em; margin-right: 2.2em;
  transform: rotate(-4deg); transform-origin: right;
}
.letter-sign .signature { display: inline-block; }
.letter.is-unsigned .signature { clip-path: inset(-30% 100% -30% 0); }
.letter.is-unsigned .sign-paw { opacity: 0; }
.sign-paw {
  position: absolute; right: -0.4em; bottom: -0.6em; width: 64px; height: 64px;
  fill: var(--wax); opacity: 0.55; mix-blend-mode: multiply; transform: rotate(18deg);
}
.crease {
  position: absolute; left: 0; right: 0; height: 26px; margin-top: -13px;
  pointer-events: none; mix-blend-mode: multiply;
  background: linear-gradient(to bottom,
    transparent, rgba(110, 70, 30, 0.10) 46%, rgba(70, 40, 12, 0.24) 50%, rgba(255, 250, 235, 0.0) 51%, transparent);
}
.crease::after {
  content: ''; position: absolute; left: 0; right: 0; top: 51%; height: 1px;
  background: rgba(255, 248, 230, 0.55); mix-blend-mode: screen;
}
.crease--1 { top: 33.333%; }
.crease--2 { top: 66.666%; }

/* ---------- album ---------- */
.album { width: min(1120px, 100%); text-align: center; }
/* section headings float in the dark, letters drifting slightly out of step */
.float-title {
  margin: 0 auto; max-width: 16em;
  font-weight: 400; text-align: center;
  font-size: clamp(2.3rem, 1.6rem + 2.6vw, 3.6rem);
  line-height: 1.1; letter-spacing: 0.01em;
  color: #e6dcc6;
  text-shadow: 0 0 22px rgba(255, 168, 90, 0.2), 0 2px 14px rgba(0, 0, 0, 0.85);
  transform: translate3d(var(--fx, 0px), var(--fy, 0px), 0);
  transition: transform 1.2s cubic-bezier(.2,.7,.2,1);
}
.float-title .ch {
  display: inline-block;
  animation: drift 7s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.41s);
}
@keyframes drift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33% { transform: translateY(-4px) rotate(0.7deg); }
  66% { transform: translateY(2px) rotate(-0.5deg); }
}
.photos {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start;
  gap: clamp(8px, 2vw, 18px);
  margin-top: clamp(28px, 5vw, 48px);
}
.photo {
  --r: 0deg; --y: 0px;
  position: relative; margin: 0;
  width: clamp(150px, 21vw, 250px);
  transform: translateY(var(--y)) rotate(var(--r));
  transition: transform 0.5s cubic-bezier(.3,1.4,.5,1);
}
.photo:hover { transform: translateY(calc(var(--y) - 8px)) rotate(calc(var(--r) * 0.4)); z-index: 2; }
.photo button {
  display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in;
}
.photo .print {
  display: block; position: relative;
  padding: 7% 7% 26%;
  --paper-c: #eee3c9;
}
.photo img {
  display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
  background: #2a1d12;
  filter: sepia(0.3) contrast(1.06) brightness(0.96) saturate(0.85);
}
/* the print "develops": a pale chemical wash fades off the image */
.photo .shot { display: block; position: relative; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); }
.photo .shot::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 45%, #f6ecd4, #e2cfa6);
  opacity: 0;
  transition: opacity 3.4s cubic-bezier(.3,.1,.3,1);
}
.photo.is-undeveloped .shot::after { opacity: 0.94; }
.photo figcaption {
  position: absolute; left: 6%; right: 6%; bottom: 5.5%;
  font-family: var(--hand); font-size: clamp(0.72rem, 0.6rem + 0.5vw, 0.95rem); line-height: 1.5;
  color: var(--ink-soft); pointer-events: none;
}
.photo::before {
  /* a strip of old tape */
  content: ''; position: absolute; z-index: 3; top: -12px; left: 50%;
  width: 42%; height: 26px; margin-left: -21%;
  background: rgba(214, 190, 138, 0.55);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  clip-path: polygon(2% 10%, 8% 0, 14% 12%, 20% 2%, 80% 4%, 86% 0, 92% 10%, 100% 4%, 97% 50%, 100% 94%, 92% 100%, 86% 90%, 78% 100%, 22% 96%, 14% 100%, 8% 88%, 0 96%, 3% 50%);
  transform: rotate(var(--tape, -3deg));
  mix-blend-mode: multiply;
}

/* ---------- the 3D album (photos float in the scene behind the page) ---------- */
.album-stage { display: none; }
.has-3d .photos { display: none; }
.has-3d .album-stage {
  display: block; position: relative;
  width: 100vw; margin-left: calc(50% - 50vw);
  height: var(--stage-h, 320vh);
  margin-top: 18vh;
}
.album-hint {
  position: sticky; top: calc(100vh - 4.2rem);
  margin: 0; padding: 0 16px; text-align: center;
  font-style: italic; color: var(--bone); opacity: 0.7; font-size: 0.95rem;
  pointer-events: none;
}
.album-hint .hint-focus, .album-stage.is-focused .hint-browse { display: none; }
.album-stage.is-focused .hint-focus { display: inline; }
.album-list {
  position: sticky; top: calc(100vh - 7.5rem);
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px;
  margin: 0; padding: 0 16px; list-style: none;
  opacity: 0; pointer-events: none;
}
.album-list:focus-within { opacity: 1; pointer-events: auto; }
.album-list button {
  font: italic 0.95rem var(--fell); color: var(--ink); cursor: pointer;
  background: #dcbb79 var(--tex-manila); border: 0; padding: 0.35em 0.8em;
}

/* ---------- wish list + reply card ---------- */
.spread {
  width: min(1120px, 100%);
  display: grid; gap: clamp(72px, 12vw, 120px);
  justify-items: center;
}
@media (min-width: 1080px) {
  .spread { grid-template-columns: 1.08fr 0.92fr; gap: 0 clamp(32px, 4vw, 56px); align-items: start; }
}
.sheet {
  width: min(560px, 100%);
  padding: clamp(32px, 6vw, 56px) clamp(24px, 5.5vw, 52px);
}
#wishlist { --rot: -1.1deg; }
#wishlist .lede, #wishlist .wishlist { padding-left: 14px; }
.wish-item { border-bottom: 0 !important; }
#rsvp { --rot: 1.2deg; }
@media (min-width: 1080px) {
  #rsvp { margin-top: 96px; }
}

.wishlist { list-style: none; margin: 0; padding: 0; }
.wish-item {
  display: grid; grid-template-columns: 30px 1fr; gap: 0 0.9em;
  padding: 1em 0;
  border-bottom: 1px dashed rgba(43, 26, 15, 0.3);
}
.wish-item:last-child { border-bottom: 0; }
.wish-item .box { width: 26px; height: 26px; margin-top: 0.15em; overflow: visible; }
.wish-item .box path { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.wish-item .box .tick {
  stroke: var(--ink-red); stroke-width: 2.6;
  stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0;
  transition: stroke-dashoffset 0.45s 0.35s ease-out;
}
.wi-title { position: relative; display: inline-block; margin: 0; font-size: 1.12em; line-height: 1.35; }
.wi-title .strike {
  position: absolute; left: -2%; top: 50%; width: 104%; height: 0.5em; margin-top: -0.2em; overflow: visible;
}
.wi-title .strike path {
  fill: none; stroke: var(--ink-red); stroke-width: 2.2; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0;
  transition: stroke-dashoffset 0.55s cubic-bezier(.6,.1,.3,1), opacity 0s 0.55s;
}
.wish-item.is-reserved .strike path,
.wish-item.is-reserved .box .tick { stroke-dashoffset: 0; opacity: 1; transition-property: stroke-dashoffset; }
.wish-item.is-reserved .wi-title > span { color: var(--ink-soft); }
.wi-note { margin: 0.15em 0 0; font-style: italic; color: var(--ink-soft); font-size: 0.95em; }
.wi-actions { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3em 1.2em; margin-top: 0.45em; font-size: 0.95em; }
.wi-status { font-style: italic; color: var(--ink-red); }
.wi-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6em 1em; margin-top: 0.6em; width: 100%; }
.wi-form input { flex: 1 1 10em; }
.wi-form .ink-btn { padding: 0.45em 1.1em; font-size: 1rem; }
.wi-error { width: 100%; margin: 0; color: var(--ink-red); font-style: italic; font-size: 0.95em; }

/* ---------- forms ---------- */
.field { display: block; margin: 0 0 1.4em; }
.field > span, .choices legend {
  display: block; margin-bottom: 0.2em;
  font-style: italic; color: var(--ink-soft); font-size: 0.95em;
}
input:not([type=radio]), textarea {
  width: 100%;
  font: inherit; font-size: 1.12em; color: var(--ink);
  background: transparent;
  border: 0; border-bottom: 1.5px solid rgba(43, 26, 15, 0.5);
  border-radius: 0;
  padding: 0.25em 0.1em;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea {
  resize: vertical; min-height: 4.8em; line-height: 1.6em;
  border-bottom: 0;
  background: repeating-linear-gradient(to bottom, transparent 0 calc(1.6em - 1.5px), rgba(43, 26, 15, 0.32) calc(1.6em - 1.5px) 1.6em);
  background-attachment: local;
  padding-top: 0; padding-bottom: 0;
}
input:not([type=radio]):focus, textarea:focus {
  outline: none;
  border-bottom-color: var(--wax);
  box-shadow: 0 1.5px 0 var(--wax);
}
textarea:focus { box-shadow: 0 0 0 1.5px rgba(184, 73, 27, 0.55); }

.choices { border: 0; margin: 0 0 1.2em; padding: 0; min-width: 0; }
.choices legend { padding: 0; }
.choice {
  position: relative; display: inline-block;
  margin: 0.1em 0.2em 0.1em 0; padding: 0.35em 0.9em;
  font-size: 1.25em; cursor: pointer;
}
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice svg {
  position: absolute; left: -6%; top: -8%; width: 112%; height: 116%;
  overflow: visible; pointer-events: none;
}
.choice svg path {
  fill: none; stroke: var(--ink-red); stroke-width: 2.4; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0;
  transition: stroke-dashoffset 0.12s ease-in, opacity 0s 0.12s;
}
.choice input:checked ~ svg path { stroke-dashoffset: 0; opacity: 1; transition: stroke-dashoffset 0.6s cubic-bezier(.5,.1,.3,1); }
.choice input:focus-visible + span { outline: 2px dashed var(--wax); outline-offset: 4px; }

.stepper { display: flex; align-items: center; gap: 0.8em; margin-top: 0.2em; }
.stepper button {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  font: 1.35rem/1 var(--fell); cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.stepper button:hover { background: var(--ink); color: var(--parchment-light); }
.stepper output { min-width: 2ch; text-align: center; font-size: 1.5em; }
.rsvp-form[data-att="no"] .field--guests { display: none; }

.ink-btn {
  display: inline-block;
  font: 1.12rem/1.2 var(--fell); letter-spacing: 0.02em;
  color: var(--parchment-light);
  background: var(--ink);
  border: 0; border-radius: 2px;
  padding: 0.72em 1.7em 0.66em;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 240, 210, 0.08), inset 0 -3px 0 rgba(0, 0, 0, 0.3), 0 2px 3px rgba(0, 0, 0, 0.25);
  transition: background 0.2s, transform 0.1s;
}
.ink-btn:hover { background: #45291a; }
.ink-btn:active { transform: translateY(1px); }
.ink-btn:disabled { opacity: 0.6; cursor: progress; }

.text-btn {
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: var(--ink);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em;
}
.text-btn:hover { color: var(--ink-red); }

.form-error { min-height: 1.5em; margin: -0.4em 0 0.8em; color: var(--ink-red); font-style: italic; }

/* reply received */
.rsvp-done { padding: 0.5em 0 1em; }
.done-title { margin: 0; font-size: 1.6em; }
.done-summary { margin: 0.3em 0 1.2em; font-style: italic; color: var(--ink-soft); max-width: 22em; }
.stamp {
  position: absolute; right: 9%; bottom: 8%;
  width: clamp(110px, 27%, 150px); height: clamp(110px, 27%, 150px);
  fill: var(--wax); mix-blend-mode: multiply; pointer-events: none;
  filter: url(#stampInk);
  opacity: 0; transform: rotate(-16deg);
}
#rsvp.is-stamped .stamp { opacity: 0.72; }
#rsvp.is-stamping .stamp { animation: stampIn 0.5s cubic-bezier(.3,.6,.3,1.25) both; }
#rsvp.is-stamping { animation: thud 0.35s 0.28s ease-out; }
@keyframes stampIn {
  0% { opacity: 0; transform: translate(-30px, -40px) scale(2.6) rotate(-40deg); }
  55% { opacity: 0.9; transform: scale(0.9) rotate(-14deg); }
  100% { opacity: 0.72; transform: scale(1) rotate(-16deg); }
}
@keyframes thud {
  30% { transform: rotate(1.2deg) scale(0.985); }
  60% { transform: rotate(1.2deg) scale(1.004); }
}

/* ---------- wishes ---------- */
.wishes { width: min(1120px, 100%); }
.wishes-head { display: grid; justify-items: center; gap: clamp(28px, 5vw, 44px); margin-bottom: clamp(48px, 8vw, 80px); }
.slip--form {
  width: min(470px, 100%);
  padding: clamp(26px, 5vw, 38px) clamp(22px, 5vw, 38px);
  --rot: -0.8deg;
}
.wish-sent p { margin: 0 0 1em; font-style: italic; }

/* grid, not CSS columns: Chromium drops the whole page when filtered papers sit in multicol */
.wall {
  display: grid; align-items: start; justify-content: center;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 310px));
  gap: clamp(26px, 4vw, 40px) clamp(20px, 3vw, 36px);
}
.wall > .wish-slip:nth-child(3n + 2) { margin-top: 34px; }
.wall > .wish-slip:nth-child(3n) { margin-top: 12px; }
.wish-slip {
  margin: 0;
  padding: 30px 24px 20px;
}
.paper.wish-slip:not(.is-settled) {
  transition: transform 0.9s cubic-bezier(.2,.9,.25,1.12), opacity 0.6s;
  transition-delay: var(--d, 0s);
}
.paper.wish-slip.is-waiting { opacity: 0; transform: translateY(-70px) rotate(calc(var(--rot) * -5)) scale(1.06); }
.wish-slip p { margin: 0; }
.wish-slip .msg {
  font-family: var(--hand); font-size: 1.04rem; line-height: 2.05; word-spacing: 0.2em;
  color: #21130a;
  white-space: pre-line; overflow-wrap: anywhere;
}
.wish-slip .from { margin-top: 0.8em; text-align: right; font-style: italic; color: var(--ink-soft); }
.wish-slip::after {
  /* pin */
  content: ''; position: absolute; top: 9px; left: 50%; width: 13px; height: 13px; margin-left: -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f3a061, var(--wax) 45%, #4a1605);
  box-shadow: 2px 4px 4px rgba(0, 0, 0, 0.45);
}
.wall-empty {
  grid-column: 1 / -1; text-align: center; font-style: italic; color: var(--bone); opacity: 0.8;
}

/* ---------- footer ---------- */
.footer {
  display: grid; justify-items: center; gap: 1.2rem;
  padding: clamp(40px, 8vw, 80px) 0 clamp(70px, 12vh, 120px);
  color: var(--bone); font-style: italic; font-size: 1.25em; text-align: center;
}
.footer p { margin: 0; opacity: 0.85; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0, 0, 0, 0.86);
  cursor: zoom-out;
  animation: fadeIn 0.35s both;
}
.lightbox.is-closing { opacity: 0; transition: opacity 0.35s 0.1s; }
.lightbox img {
  position: fixed; left: 0; top: 0; transform-origin: 0 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
  border: 10px solid #eee3c9;
  filter: sepia(0.3) contrast(1.06) brightness(0.96) saturate(0.85);
}
.lightbox-close {
  position: fixed; top: 14px; left: 16px; z-index: 2;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: none; color: var(--bone); font: 2rem/1 var(--fell); cursor: pointer;
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; transition-delay: 0s !important;
  }
  .photo.is-undeveloped .shot::after { opacity: 0; }
  .paper.wish-slip.is-waiting { opacity: 1; transform: rotate(var(--rot)); }
}
