:root {
  --paper: #faf6ee;
  --paper-2: #f3ecdf;
  --card: #fffdf8;
  --ink: #2c2622;
  --ink-soft: #5c534a;
  --muted: #8a7f72;
  --accent: #8a5a3c;       /* warm sepia-brown */
  --accent-2: #b07a4f;
  --rule: #e4d9c6;
  --shadow: 0 2px 10px rgba(70, 50, 30, .10);
  --shadow-lg: 0 8px 30px rgba(70, 50, 30, .15);
  --maxw: 50rem;
  --serif-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --serif-body: "Source Serif 4", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { font-size: 19px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--serif-body);
  color: var(--ink);
  line-height: 1.7;
  background-color: #f6efe2;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.6), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(220,200,170,.25), transparent 45%);
  background-attachment: fixed;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-2); }

img { max-width: 100%; height: auto; display: block; }

.muted { color: var(--muted); }

.skip {
  position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff;
  padding: .6rem 1rem; z-index: 100;
}
.skip:focus { left: .5rem; top: .5rem; }

/* ---------- header / nav ---------- */
.site-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--rule);
  background: rgba(255,253,248,.85);
  backdrop-filter: blur(6px);
}
.brand { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-family: var(--serif-display); font-size: 1.5rem; font-weight: 600; letter-spacing: .01em; }
.brand-sub { font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.site-nav { display: flex; align-items: center; gap: clamp(.7rem, 2vw, 1.6rem); flex-wrap: wrap; }
.site-nav a { text-decoration: none; color: var(--ink-soft); font-size: 1rem; }
.site-nav a:hover { color: var(--accent); }
.site-nav a.cta {
  background: var(--accent); color: #fff; padding: .45rem .95rem; border-radius: 999px;
}
.site-nav a.cta:hover { background: var(--accent-2); color: #fff; }
.admin-link .badge {
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 0 .45rem; font-size: .8rem;
}

/* ---------- layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2rem) 4rem; }

.page-head { margin-bottom: 2rem; }
.page-head h1, h1 { font-family: var(--serif-display); font-weight: 600; line-height: 1.1; }
.page-head h1 { font-size: clamp(2rem, 6vw, 3rem); margin: 0 0 .4rem; }

.eyebrow { font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; color: var(--accent-2); margin: 0 0 .4rem; }

/* ---------- flashes ---------- */
.flashes { max-width: var(--maxw); margin: 1rem auto 0; padding: 0 1rem; }
.flash { padding: .8rem 1.1rem; border-radius: 10px; margin-bottom: .6rem; }
.flash.error { background: #fbe9e4; color: #8a2f1c; border: 1px solid #f0c8bd; }
.flash.success { background: #e9f3e6; color: #2f5a26; border: 1px solid #c8e0bd; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(1.5rem, 5vw, 3rem); align-items: center; margin-bottom: 3rem;
}
.hero-portrait img {
  width: 100%; border-radius: 8px; box-shadow: var(--shadow-lg);
  border: 7px solid #fff; outline: 1px solid var(--rule);
}
.hero-text h1 { font-size: clamp(2.6rem, 8vw, 4.5rem); margin: .2rem 0 1rem; }
.lede { font-size: 1.2rem; color: var(--ink-soft); }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; text-decoration: none; cursor: pointer;
  font-family: var(--serif-body); font-size: 1.02rem;
  padding: .6rem 1.3rem; border-radius: 999px;
  border: 1.5px solid var(--accent); color: var(--accent); background: transparent;
}
.btn:hover { background: var(--accent); color: #fff; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.small { font-size: .9rem; padding: .4rem .9rem; }
.btn.ghost { border-color: var(--rule); color: var(--ink-soft); }
.btn.ghost:hover { background: var(--paper-2); color: var(--ink); }
.btn.danger { border-color: #b3573f; color: #b3573f; }
.btn.danger:hover { background: #b3573f; color: #fff; }

/* ---------- opening quote ---------- */
.opening {
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 2rem 0; margin: 2rem 0 3rem; text-align: center;
}
.opening-q { font-family: var(--serif-display); font-size: 1.6rem; color: var(--accent); margin: 0 0 1rem; }
.opening-a p { font-size: 1.25rem; max-width: 40rem; margin: .6rem auto; }

/* ---------- welcome grid ---------- */
.welcome-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.2rem; }
.wcard {
  text-decoration: none; color: var(--ink); background: var(--card);
  border: 1px solid var(--rule); border-radius: 12px; padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow); transition: transform .12s ease, box-shadow .12s ease;
}
.wcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: var(--ink); }
.wcard h3 { font-family: var(--serif-display); font-size: 1.5rem; margin: 0 0 .4rem; color: var(--accent); }
.wcard p { margin: 0; color: var(--ink-soft); font-size: 1rem; }

.closing { margin-top: 3rem; text-align: center; }
.closing img { max-width: 320px; margin: 0 auto; border-radius: 8px; border: 7px solid #fff; box-shadow: var(--shadow-lg); outline: 1px solid var(--rule); }
.closing figcaption { color: var(--muted); margin-top: .7rem; font-style: italic; }

/* ---------- table of contents ---------- */
.toc { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.toc li { border-bottom: 1px solid var(--rule); }
.toc a {
  display: flex; align-items: baseline; gap: 1rem; padding: 1rem .4rem;
  text-decoration: none; color: var(--ink);
}
.toc a:hover { background: var(--paper-2); color: var(--accent); }
.toc-num { font-family: var(--serif-display); font-size: 1.3rem; color: var(--accent-2); min-width: 2.2rem; }
.toc-q { font-size: 1.2rem; flex: 1; }
.toc-mem { font-size: .8rem; color: var(--muted); white-space: nowrap; background: var(--paper-2); padding: .15rem .6rem; border-radius: 999px; }

/* ---------- chapter ---------- */
.chapter-q { font-size: clamp(1.8rem, 5vw, 2.7rem); margin: .2rem 0 1.5rem; }
.chapter-a p { font-size: 1.22rem; margin: 0 0 1.2rem; }
.chapter-a .subhead { font-family: var(--serif-display); font-size: 1.6rem; color: var(--accent); margin: 2rem 0 .6rem; }
.answer-list { font-size: 1.22rem; padding-left: 1.4rem; }
.answer-list li { margin: .5rem 0; }

.chapter-photos { display: grid; gap: 1.5rem; margin: 2.5rem 0; }
.chapter-photos figure { margin: 0; text-align: center; }
.chapter-photos img {
  margin: 0 auto; max-height: 75vh; width: auto; border-radius: 6px;
  border: 8px solid #fff; box-shadow: var(--shadow-lg); outline: 1px solid var(--rule);
}
.chapter-photos figcaption { margin-top: .8rem; font-style: italic; color: var(--ink-soft); font-size: 1.05rem; }

/* ---------- memories on a chapter ---------- */
.memories-block { margin: 3rem 0 1rem; border-top: 2px solid var(--rule); padding-top: 1.5rem; }
.memories-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.memories-head h2 { font-family: var(--serif-display); font-size: 1.7rem; margin: 0; }
.memory-list { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 1.2rem; }
.memory-list.wide { gap: 1.6rem; }
.memory {
  background: var(--card); border: 1px solid var(--rule); border-left: 4px solid var(--accent-2);
  border-radius: 10px; padding: 1.2rem 1.4rem; box-shadow: var(--shadow);
}
.memory-photo { margin: 0 0 1rem; }
.memory-photo img { border-radius: 6px; border: 5px solid #fff; outline: 1px solid var(--rule); }
.memory-body p { font-size: 1.1rem; margin: 0 0 .6rem; }
.memory-by { color: var(--accent); font-style: italic; margin: .6rem 0 0; }
.memory-by .rel { color: var(--muted); font-style: normal; }
.empty { font-size: 1.1rem; }

/* ---------- chapter nav ---------- */
.chapter-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); font-size: .95rem; }
.chapter-nav .prev { text-align: left; }
.chapter-nav .next { text-align: right; }
.chapter-nav .all { color: var(--muted); white-space: nowrap; }
.chapter-nav a { text-decoration: none; }
.chapter-nav a:hover { text-decoration: underline; }

/* ---------- gallery ---------- */
.gallery { columns: 3 14rem; column-gap: 1rem; }
.gtile { display: inline-block; width: 100%; margin: 0 0 1rem; text-decoration: none; position: relative; break-inside: avoid; }
.gtile img { border-radius: 6px; border: 6px solid #fff; box-shadow: var(--shadow); outline: 1px solid var(--rule); transition: transform .12s ease, box-shadow .12s ease; }
.gtile:hover img { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.gcap { display: block; text-align: center; color: var(--ink-soft); font-style: italic; font-size: .95rem; margin-top: .5rem; }

/* ---------- forms ---------- */
.share-form { max-width: 38rem; }
.share-form.narrow { max-width: 24rem; }
.field { display: block; margin-bottom: 1.3rem; }
.field > span { display: block; font-size: 1.05rem; margin-bottom: .4rem; color: var(--ink); }
.field em { color: var(--accent); font-style: normal; }
input[type=text], input[type=password], select, textarea {
  width: 100%; font-family: var(--serif-body); font-size: 1.05rem;
  padding: .7rem .8rem; border: 1.5px solid var(--rule); border-radius: 8px;
  background: #fffdf9; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); border-color: var(--accent-2); }
input[type=file] { font-size: 1rem; }
.hint { display: block; color: var(--muted); font-size: .85rem; margin-top: .3rem; }
.form-actions { display: flex; gap: .8rem; align-items: center; margin-top: 1.5rem; flex-wrap: wrap; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.cf-turnstile { margin: 1rem 0; }

.thanks { text-align: center; padding: 2rem 0; }
.thanks h1 { font-size: clamp(2.4rem, 7vw, 3.5rem); }

/* ---------- admin ---------- */
.status-tabs { display: flex; gap: .4rem; margin-top: 1rem; }
.status-tabs a { text-decoration: none; padding: .4rem 1rem; border-radius: 999px; color: var(--ink-soft); border: 1px solid var(--rule); }
.status-tabs a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.mod-list { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 1.2rem; }
.mod-item { background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 1.2rem 1.4rem; box-shadow: var(--shadow); }
.mod-meta { margin-bottom: .8rem; }
.mod-photo { margin: 0 0 1rem; }
.mod-photo img { max-width: 360px; border-radius: 6px; border: 5px solid #fff; outline: 1px solid var(--rule); }
.mod-body { font-size: 1.1rem; margin-bottom: 1rem; }
.mod-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.mod-actions form { margin: 0; }

/* ---------- footer ---------- */
.site-foot { text-align: center; padding: 2.5rem 1rem 3rem; border-top: 1px solid var(--rule); color: var(--ink-soft); margin-top: 2rem; }
.site-foot p { margin: .3rem 0; }
.site-foot .muted { font-size: .9rem; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  html { font-size: 18px; }
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-portrait { max-width: 320px; margin: 0 auto; }
  .hero-actions, .memories-head { justify-content: center; }
  .chapter-nav { grid-template-columns: 1fr; text-align: center; }
  .chapter-nav .prev, .chapter-nav .next { text-align: center; }
}
