/* ---------- tokens ---------- */
:root {
  --bg: #0b0a09;
  --bg-2: #15130f;
  --ink: #f4efe6;
  --ink-2: #b9b0a2;
  --ink-3: #7d7569;
  --gold: #d9b779;
  --gold-2: #f0d9a8;
  --line: rgba(244, 239, 230, 0.12);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
img { display: block; max-width: 100%; }

/* ---------- chrome ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: linear-gradient(to bottom, rgba(11,10,9,.85), rgba(11,10,9,0));
  backdrop-filter: blur(6px);
}
.brand { font-family: var(--serif); font-size: 1.35rem; letter-spacing: .04em; text-decoration: none; }
.pill {
  font-size: .82rem; font-weight: 500; text-decoration: none; letter-spacing: .02em;
  padding: 9px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  transition: transform .3s var(--ease), background .3s;
}
.pill:hover { transform: translateY(-1px); background: var(--gold-2); }
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; }
.progress span { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(var(--page, 0)); background: var(--gold); }

.years {
  position: fixed; right: clamp(10px, 2vw, 28px); top: 50%; transform: translateY(-50%);
  z-index: 40; display: flex; flex-direction: column; gap: 14px;
  opacity: 0; transition: opacity .5s;
}
.years.show { opacity: 1; }
.years a {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  font-size: .72rem; letter-spacing: .08em; color: var(--ink-3); text-decoration: none;
  transition: color .3s;
}
.years a::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; transition: transform .3s; }
.years a span { opacity: 0; transform: translateX(6px); transition: all .3s var(--ease); }
.years a:hover span, .years a.active span { opacity: 1; transform: none; }
.years a.active { color: var(--gold); }
.years a.active::after { transform: scale(1.6); }
@media (max-width: 700px) { .years { display: none; } }

/* ---------- scroll scenes ---------- */
.scene { position: relative; --p: 0; }
.sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }

/* hero */
.hero { height: 190vh; }
.hero .sticky { display: grid; place-items: center; text-align: center; }
.hero-photo {
  position: absolute; inset: 0;
  background-size: cover; background-position: center 30%;
  transform: scale(calc(1.15 - var(--p) * .15));
  opacity: calc(.55 - var(--p) * .35);
  filter: grayscale(.25);
}
.hero-photo.empty { background: radial-gradient(ellipse at 50% 40%, #2a2219 0%, var(--bg) 70%); opacity: 1; }
.hero-photo::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 30%, var(--bg) 85%); }
.hero-inner {
  position: relative; padding: 0 16px;
  transform: translateY(calc(var(--p) * -12vh)) scale(calc(1 - var(--p) * .12));
  opacity: calc(1 - var(--p) * 1.8);
}
.eyebrow { font-size: .78rem; letter-spacing: .32em; text-transform: uppercase; color: var(--gold); margin: 0 0 22px; }
.hero h1 {
  font-family: var(--serif); font-weight: 400; margin: 0;
  font-size: clamp(3.2rem, 11vw, 9.5rem); line-height: .92; letter-spacing: -.01em;
}
.hero h1 em { font-style: italic; color: var(--gold-2); }
.dates { margin-top: 26px; font-size: clamp(.9rem, 1.6vw, 1.1rem); color: var(--ink-2); letter-spacing: .12em; }
.dates i { display: inline-block; width: 40px; height: 1px; background: var(--ink-3); vertical-align: middle; margin: 0 14px; }
.scroll-cue {
  position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
  font-size: .7rem; letter-spacing: .3em; text-transform: uppercase; color: var(--ink-3);
  opacity: calc(1 - var(--p) * 6);
}
.scroll-cue::after {
  content: ""; display: block; width: 1px; height: 46px; margin: 12px auto 0;
  background: linear-gradient(var(--ink-3), transparent);
  animation: cue 2.2s infinite var(--ease);
}
@keyframes cue { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* word-by-word lighting text */
.words { height: 260vh; }
.words .sticky { display: grid; place-items: center; padding: 0 clamp(16px, 8vw, 120px); }
.words p {
  font-family: var(--serif); font-size: clamp(1.9rem, 4.6vw, 4rem); line-height: 1.18;
  max-width: 1100px; margin: 0; text-align: center;
}
.words p span { color: rgba(244,239,230,.14); transition: color .35s; }
.words p span.lit { color: var(--ink); }
.words.quote p span.lit { color: var(--gold-2); }
.words cite { display: block; margin-top: 28px; text-align: center; font-family: var(--sans); font-style: normal; font-size: .85rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); }

/* chapters */
.chapter { height: 320vh; }
.chapter .sticky { display: grid; align-items: center; }
.big-year {
  position: absolute; top: 50%; left: 0; white-space: nowrap; pointer-events: none;
  font-family: var(--serif); font-weight: 500; line-height: 1;
  font-size: clamp(10rem, 34vw, 32rem);
  color: transparent; -webkit-text-stroke: 1px rgba(217,183,121,.22);
  transform: translate(calc(60vw - var(--p) * 120vw), -50%);
}
.chapter-inner {
  position: relative; width: 100%; max-width: 1280px; margin: 0 auto;
  padding: 0 clamp(16px, 5vw, 64px);
  display: grid; grid-template-columns: 1fr 1.15fr; gap: clamp(24px, 5vw, 80px); align-items: center;
}
.chapter.flip .chapter-inner { grid-template-columns: 1.15fr 1fr; }
.chapter.flip .chapter-text { order: 2; }

.chapter-text {
  --in: clamp(0, (var(--p) - .06) * 7, 1);
  --out: clamp(0, (1 - var(--p) - .04) * 7, 1);
  opacity: min(var(--in), var(--out));
  transform: translateY(calc((1 - var(--in)) * 60px - (1 - var(--out)) * 60px));
}
.chapter-num { font-size: .75rem; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); margin-bottom: 18px; }
.chapter h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.6rem, 6vw, 5.4rem); line-height: .98; margin: 0 0 24px; }
.chapter-year { font-family: var(--serif); font-style: italic; font-size: 1.4rem; color: var(--ink-2); margin-bottom: 8px; }
.chapter p.body { font-size: clamp(1rem, 1.35vw, 1.18rem); line-height: 1.75; color: var(--ink-2); max-width: 36ch; margin: 0; }

.photos { position: relative; height: min(72vh, 680px); }
.ph {
  position: absolute; overflow: hidden; border-radius: 6px;
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
  --in: clamp(0, (var(--p) - var(--d, .1)) * 5, 1);
  --out: clamp(0, (1 - var(--p) - .03) * 6, 1);
  opacity: min(var(--in), var(--out));
  transform:
    translateY(calc((.5 - var(--p)) * var(--s, 1) * 40vh))
    scale(calc(.86 + var(--in) * .14))
    rotate(var(--r, 0deg));
}
.ph img { width: 100%; height: 100%; object-fit: cover; transform: scale(calc(1.18 - var(--p) * .18)); }
.ph:nth-child(1) { width: 66%; height: 74%; left: 0; top: 6%; --s: .5; --d: .08; --r: -1.5deg; z-index: 2; }
.ph:nth-child(2) { width: 46%; height: 50%; right: 0; top: 0; --s: 1.2; --d: .16; --r: 2deg; z-index: 1; }
.ph:nth-child(3) { width: 44%; height: 44%; right: 6%; bottom: 0; --s: 1.8; --d: .24; --r: -1deg; z-index: 3; }
.ph:only-child { width: 88%; height: 88%; left: 6%; top: 6%; --r: 0deg; }
.ph.placeholder {
  background:
    radial-gradient(circle at 30% 25%, rgba(217,183,121,.18), transparent 60%),
    linear-gradient(135deg, #221d16, #12100c);
  border: 1px solid var(--line);
  display: grid; place-items: center;
}
.ph.placeholder span { font-family: var(--serif); font-style: italic; color: var(--ink-3); font-size: 1.1rem; }

@media (max-width: 820px) {
  .chapter { height: 260vh; }
  .chapter-inner, .chapter.flip .chapter-inner { grid-template-columns: 1fr; gap: 26px; align-content: center; height: 100%; padding-top: 70px; }
  .chapter.flip .chapter-text { order: 0; }
  .photos { height: 44vh; }
  .chapter h2 { margin-bottom: 14px; }
}

/* photo river (horizontal scroll driven by vertical scroll) */
.river { height: 420vh; }
.river .sticky { display: flex; flex-direction: column; justify-content: center; }
.river h3 {
  font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 5vw, 4rem);
  margin: 0 0 4vh; padding: 0 clamp(16px, 5vw, 64px);
  opacity: clamp(0, var(--p) * 8, 1);
}
.river-track {
  display: flex; gap: 2vw; padding: 0 clamp(16px, 5vw, 64px); width: max-content;
  transform: translateX(calc(var(--p) * var(--dist, 0px) * -1));
  will-change: transform;
}
.river-track figure {
  margin: 0; height: 56vh; aspect-ratio: 4 / 5; border-radius: 6px; overflow: hidden; flex: none;
  background: linear-gradient(135deg, #221d16, #12100c); border: 1px solid var(--line);
}
.river-track figure:nth-child(3n+2) { aspect-ratio: 3 / 2; margin-top: 6vh; }
.river-track figure:nth-child(3n) { height: 44vh; margin-top: -4vh; }
.river-track img { width: 100%; height: 100%; object-fit: cover; }

/* closing */
.closing { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 120px 16px 80px; }
.closing .candle { width: 2px; height: 70px; margin: 0 auto 40px; background: linear-gradient(var(--gold), transparent); box-shadow: 0 0 30px 6px rgba(217,183,121,.35); border-radius: 2px; }
.closing h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.6rem, 7vw, 5.6rem); margin: 0 0 16px; line-height: 1; }
.closing .sub { color: var(--ink-2); font-size: 1.05rem; max-width: 46ch; margin: 0 auto 50px; line-height: 1.7; }
.service-card {
  max-width: 520px; margin: 0 auto 50px; padding: 34px 28px; border: 1px solid var(--line); border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent);
}
.service-card h3 { font-family: var(--serif); font-weight: 500; font-size: 1.8rem; margin: 0 0 18px; color: var(--gold-2); }
.service-card p { margin: 6px 0; color: var(--ink-2); line-height: 1.6; }
.service-card .when { color: var(--ink); font-size: 1.1rem; }
.btn {
  display: inline-block; padding: 16px 30px; border-radius: 999px; text-decoration: none;
  background: var(--gold); color: #1a1408; font-weight: 500; letter-spacing: .02em;
  transition: transform .3s var(--ease), box-shadow .3s; border: 0; cursor: pointer; font: inherit; font-weight: 500;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(217,183,121,.25); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
footer.foot { text-align: center; color: var(--ink-3); font-size: .78rem; padding: 30px 16px 40px; letter-spacing: .08em; }

/* reveal-on-enter */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 1.1s var(--ease), transform 1.1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .hero, .words, .chapter, .river { height: auto; }
  .sticky { position: relative; height: auto; min-height: 100vh; padding: 80px 0; }
  .scene { --p: .5 !important; }
  .chapter-text, .ph, .hero-inner, .words p span { opacity: 1 !important; transform: none !important; color: var(--ink) !important; }
  .big-year { display: none; }
  .river-track { width: auto; flex-wrap: wrap; transform: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- form pages (share / admin) ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 120px clamp(16px, 4vw, 32px) 60px; }
.page h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.6rem, 6vw, 4.2rem); margin: 0 0 14px; line-height: 1; }
.page .lead { color: var(--ink-2); line-height: 1.7; font-size: 1.05rem; margin: 0 0 40px; }
label.field { display: block; margin-bottom: 18px; }
label.field span { display: block; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
input[type=text], input[type=password], textarea {
  width: 100%; padding: 14px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--ink); font: inherit; font-weight: 400; font-size: 1rem;
}
input:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 90px; resize: vertical; }
.drop {
  border: 1.5px dashed rgba(217,183,121,.45); border-radius: 12px; padding: 48px 20px; text-align: center;
  background: rgba(217,183,121,.04); cursor: pointer; transition: background .3s, border-color .3s; margin: 8px 0 22px;
}
.drop.over { background: rgba(217,183,121,.12); border-color: var(--gold); }
.drop strong { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.6rem; margin-bottom: 6px; }
.drop small { color: var(--ink-3); }
.files { list-style: none; padding: 0; margin: 0 0 26px; display: grid; gap: 10px; }
.files li { display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); }
.files .thumb { width: 52px; height: 52px; border-radius: 6px; object-fit: cover; background: #221d16; display: grid; place-items: center; font-size: .65rem; color: var(--ink-3); overflow: hidden; }
.files .thumb img, .files .thumb video { width: 100%; height: 100%; object-fit: cover; }
.files .meta { min-width: 0; }
.files .fname { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.files .fsize { font-size: .75rem; color: var(--ink-3); margin-top: 3px; }
.bar { height: 4px; background: var(--line); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .25s; }
.files .status { font-size: .78rem; color: var(--ink-3); white-space: nowrap; }
.files .status.ok { color: #9fd49a; }
.files .status.err { color: #f08f7f; }
.files button.x { background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: 1.2rem; }
.notice { padding: 16px 18px; border-radius: 10px; border: 1px solid rgba(159,212,154,.35); background: rgba(159,212,154,.07); color: #cfe8cc; margin-top: 22px; line-height: 1.6; display: none; }
.notice.show { display: block; }
.notice.err { border-color: rgba(240,143,127,.35); background: rgba(240,143,127,.07); color: #f6c9c1; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* admin grid */
.admin-wrap { max-width: 1200px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 24px; }
.toolbar .count { color: var(--ink-2); margin-right: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg-2); display: flex; flex-direction: column; }
.card .media { aspect-ratio: 4 / 3; background: #1b1712; display: grid; place-items: center; color: var(--ink-3); font-size: .8rem; }
.card .media img, .card .media video { width: 100%; height: 100%; object-fit: cover; }
.card .info { padding: 12px 14px; font-size: .82rem; color: var(--ink-2); line-height: 1.5; flex: 1; }
.card .info b { color: var(--ink); font-weight: 500; }
.card .info .note { font-style: italic; margin-top: 4px; }
.card .actions { display: flex; border-top: 1px solid var(--line); }
.card .actions a, .card .actions button { flex: 1; text-align: center; padding: 10px; font: inherit; font-size: .8rem; background: none; border: 0; color: var(--ink); text-decoration: none; cursor: pointer; }
.card .actions button { color: #f08f7f; border-left: 1px solid var(--line); }
.small-btn { padding: 10px 16px; font-size: .85rem; }
