:root {
  --parchment: #faf6ee;
  --parchment-mid: #f0e9da;
  --parchment-deep: #e4d9c4;
  --ink: #1c1914;
  --ink-soft: #4a4238;
  --ink-faint: #8a7d6e;
  --gold: #b8935a;
  --gold-light: #d4b07a;
  --gold-pale: #e8d4a8;
  --dark-bg: #1c1914;
  --dark-mid: #2d2820;
  --title-font: 'Great Vibes', cursive;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--parchment);
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 20px;
  line-height: 1.75;
  overflow-x: hidden;
}

/* ─── HERO ─── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  padding: 60px 32px 6vh;
  background: var(--dark-bg);
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.5s;
}

.hero-bg.has-photo {
  opacity: 1;
}

.hero-bg-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(
    45deg,
    #252018 0px, #252018 2px,
    #1c1914 2px, #1c1914 20px
  );
  z-index: 0;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(18,15,10,0.55) 0%,
    rgba(18,15,10,0.45) 40%,
    rgba(18,15,10,0.7) 100%
  );
  z-index: 1;
}

.hero-content { position: relative; z-index: 2; }

.hero-ornament {
  display: block;
  margin: 0 auto 28px;
  opacity: 0.45;
}

.hero-name {
  font-family: var(--title-font);
  font-size: clamp(52px, 7vw, 100px);
  font-weight: 400;
  color: var(--gold-light);
  letter-spacing: 0.02em;
  line-height: 1.1;
  margin-bottom: 12px;
  white-space: nowrap;
}

.hero-dates {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(15px, 1.8vw, 20px);
  font-weight: 300;
  color: var(--gold-pale);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 32px;
  opacity: 0.8;
}

.hero-rule {
  width: 120px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
  margin: 0 auto 28px;
}

.hero-funeral {
  display: inline-block;
  border: 1px solid rgba(184,147,90,0.5);
  background: rgba(28,25,20,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 24px 48px 28px;
  font-size: 17px;
  color: var(--parchment-deep);
  letter-spacing: 0.05em;
  line-height: 2;
  font-weight: 300;
  font-style: italic;
  position: relative;
  white-space: nowrap;
}

.hero-funeral::before, .hero-funeral::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(184,147,90,0.2);
  pointer-events: none;
}
.hero-funeral::after {
  inset: 8px;
  border-color: rgba(184,147,90,0.1);
}

.hero-funeral strong {
  font-style: normal;
  font-weight: 500;
  color: var(--gold-light);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 11px;
  display: block;
  margin-bottom: 10px;
  font-family: 'Cormorant Garamond', serif;
}

.scroll-hint {
  position: absolute;
  bottom: 40px;
  z-index: 2;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--ink-faint);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  animation: nudge 2.5s ease-in-out infinite;
  z-index: 1;
}

.scroll-hint svg { opacity: 0.4; }

@keyframes nudge {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* ─── TIMELINE NAV ─── */
.timeline-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--parchment);
  border-bottom: 1px solid var(--parchment-deep);
  padding: 18px 40px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.timeline-nav.nav-dark .timeline-item { color: rgba(184,147,90,0.4); }
.timeline-nav.nav-dark .timeline-item.active,
.timeline-nav.nav-dark .timeline-item:hover { color: var(--gold); }
.timeline-nav.nav-dark .timeline-dot { background: var(--dark-mid); border-color: rgba(184,147,90,0.35); }
.timeline-nav.nav-dark .timeline-item:hover .timeline-dot,
.timeline-nav.nav-dark .timeline-item.active .timeline-dot { background: var(--gold); border-color: var(--gold); }
.timeline-nav.nav-dark .timeline-line { background: rgba(184,147,90,0.2); }

.timeline-track {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 900px;
}

.timeline-line {
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: var(--parchment-deep);
  transform: translateY(-50%);
}

.timeline-item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: color 0.3s;
  color: var(--ink-faint);
}

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--parchment-deep);
  border: 1.5px solid var(--ink-faint);
  margin-bottom: 6px;
  transition: all 0.3s;
  position: relative;
  z-index: 1;
}

.timeline-year {
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.08em;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.timeline-item:hover .timeline-dot,
.timeline-item.active .timeline-dot {
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.4);
}

.timeline-item:hover,
.timeline-item.active {
  color: var(--gold);
}

/* ─── REVEAL ANIMATION ─── */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── SECTIONS ─── */
.chapter {
  padding: 100px 40px;
  max-width: 800px;
  margin: 0 auto;
}

.chapter-full {
  max-width: 100%;
  padding: 0;
}

.section-wrap {
  position: relative;
}

.section-wrap.bg-parchment { background: var(--parchment); }
.section-wrap.bg-mid { background: var(--parchment-mid); }
.section-wrap.bg-deep { background: var(--parchment-deep); }
.section-wrap.bg-dark { background: var(--dark-bg); }
.section-wrap.bg-dark2 { background: var(--dark-mid); }

/* ─── CHAPTER HEADERS ─── */
.chapter-year {
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  font-weight: 300;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
  display: block;
}

.chapter-title {
  font-family: var(--title-font);
  font-size: clamp(44px, 6vw, 72px);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 32px;
  color: var(--ink);
}

.chapter-title.light { color: var(--gold-pale); }

.chapter-body {
  font-size: 19px;
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.85;
  font-style: italic;
}

.chapter-body.light { color: var(--parchment-deep); }

/* ─── PHOTO FRAMES ─── */
.photo-grid {
  display: grid;
  gap: 32px;
  margin: 48px 0;
}

.photo-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.photo-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.photo-grid.cols-1 { grid-template-columns: 1fr; max-width: 420px; }

/* Frame style 1: double border */
.frame-double {
  background: var(--parchment);
  padding: 14px;
  box-shadow: 0 4px 24px rgba(28,25,20,0.15), inset 0 0 0 1px var(--gold-pale);
  outline: 1px solid var(--gold-light);
  outline-offset: -7px;
  position: relative;
}

/* Frame style 2: thick ornate */
.frame-thick {
  background: var(--parchment);
  padding: 18px;
  box-shadow: 0 8px 32px rgba(28,25,20,0.2), 0 2px 8px rgba(28,25,20,0.1);
  border: 3px solid var(--gold-light);
  position: relative;
}

.frame-thick::before {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid var(--gold-pale);
  pointer-events: none;
}

/* Frame style 3: thin elegant */
.frame-thin {
  background: var(--parchment);
  padding: 10px;
  box-shadow: 0 6px 20px rgba(28,25,20,0.18);
  border: 1px solid var(--gold);
  position: relative;
}

/* Frame style 4: dark / dark bg */
.frame-dark {
  background: var(--dark-mid);
  padding: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(184,147,90,0.3);
  border: 2px solid rgba(184,147,90,0.4);
}

.photo-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: repeating-linear-gradient(
    45deg,
    var(--parchment-mid) 0px,
    var(--parchment-mid) 2px,
    var(--parchment-deep) 2px,
    var(--parchment-deep) 14px
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink-faint);
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 16px;
  font-style: italic;
}

.photo-placeholder.portrait { aspect-ratio: 3/4; }
.photo-placeholder.square { aspect-ratio: 1/1; }

.photo-placeholder.dark-ph {
  background: repeating-linear-gradient(
    45deg,
    #252018 0px,
    #252018 2px,
    #1c1914 2px,
    #1c1914 14px
  );
  color: rgba(184,147,90,0.4);
}

.photo-placeholder svg {
  opacity: 0.3;
  margin-bottom: 4px;
}

.photo-caption {
  font-family: 'Caveat', cursive;
  font-size: 16px;
  color: var(--ink-faint);
  text-align: center;
  margin-top: 10px;
  font-style: italic;
}

.photo-caption.light { color: rgba(184,147,90,0.5); }

/* ─── ORNAMENTAL DIVIDERS ─── */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 40px;
  position: relative;
}

.ornament svg {
  width: 100%;
  max-width: 500px;
  height: auto;
  opacity: 0.35;
}

/* ─── PULL QUOTE ─── */
.pull-quote {
  border-left: 2px solid var(--gold);
  padding: 16px 32px;
  margin: 40px 0;
  font-size: 22px;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.6;
}

.pull-quote.light {
  border-color: rgba(184,147,90,0.5);
  color: var(--parchment-deep);
}

/* ─── FULL BLEED BAND ─── */
.full-bleed-photo {
  width: 100%;
  max-height: 540px;
  overflow: hidden;
  position: relative;
}

.full-bleed-photo .photo-placeholder {
  max-height: 540px;
  aspect-ratio: unset;
  height: 400px;
  font-size: 15px;
}

/* ─── FINAL SECTION ─── */
.final-section {
  text-align: center;
  padding: 120px 40px;
  background: var(--dark-bg);
  color: var(--gold-pale);
}

.final-section .hero-name {
  font-size: clamp(40px, 6vw, 80px);
  margin-bottom: 24px;
}

.final-rule {
  width: 80px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
  margin: 32px auto;
}

.final-verse {
  font-size: 18px;
  font-style: italic;
  font-weight: 300;
  color: rgba(228,217,196,0.65);
  max-width: 480px;
  margin: 0 auto;
  line-height: 2;
}

/* ─── PHOTO HOVER ─── */
.frame-double img, .frame-thick img, .frame-thin img, .frame-dark img {
  cursor: pointer;
  transition: filter 0.25s ease;
  display: block;
  width: 100%;
}

.frame-double img:hover, .frame-thick img:hover,
.frame-thin img:hover, .frame-dark img:hover {
  filter: brightness(1.15);
}

/* ─── LIGHTBOX ─── */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

#lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 15, 10, 0.88);
  cursor: pointer;
}

#lightbox-img-wrap {
  position: relative;
  z-index: 1;
  max-width: min(90vw, 1200px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
  transition: opacity 0.18s ease;
}

#lightbox-caption {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  color: var(--parchment-deep);
  text-align: center;
  margin-top: 14px;
  opacity: 0.75;
  line-height: 1.4;
  transition: opacity 0.18s ease;
  min-height: 1.4em;
}

#lightbox-close {
  position: fixed;
  top: 24px;
  right: 32px;
  z-index: 2;
  background: none;
  border: none;
  color: var(--gold-pale);
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  padding: 4px 8px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
}

#lightbox-close:hover { opacity: 1; }

#lightbox-prev, #lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: none;
  border: none;
  color: var(--gold-pale);
  font-size: 64px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.2s;
  padding: 16px 20px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
}

#lightbox-prev { left: 8px; }
#lightbox-next { right: 8px; }

#lightbox-prev:hover, #lightbox-next:hover { opacity: 1; }

#lightbox-prev[hidden], #lightbox-next[hidden] { display: none; }

/* ─── RESPONSIVE ─── */
@media (max-width: 640px) {
  .photo-grid.cols-2, .photo-grid.cols-3 { grid-template-columns: 1fr; }
  .timeline-year { font-size: 11px; }
  .chapter { padding: 70px 24px; }
  .hero { padding: 60px 24px; }
  .timeline-nav { padding: 14px 16px 10px; }
}
