:root {
  --bg: #faf7f2;
  --bg-soft: #f1ece3;
  --ink: #2e2a26;
  --muted: #6f675e;
  --accent: #7a6a52;
  --accent-deep: #5b4d3a;
  --line: #e4ddd1;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(60, 50, 35, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Lora', Georgia, serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; letter-spacing: 0.01em; }

a { color: var(--accent-deep); }

/* ---------- HERO ---------- */
.hero {
  background: linear-gradient(180deg, #2e2a26 0%, #423a30 100%);
  color: #f6f1e9;
  text-align: center;
  padding: 4.5rem 1.25rem 0;
}
.hero-inner { max-width: 760px; margin: 0 auto; }
.hero-photo {
  width: 190px; height: 190px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  background: #d9cfc0 center/cover no-repeat;
  border: 4px solid rgba(255,255,255,0.85);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
.hero-tagline {
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.78rem;
  color: #cbbfa9;
  margin: 0 0 0.4rem;
}
.hero-name { font-size: clamp(2.6rem, 7vw, 4.4rem); margin: 0; line-height: 1.05; }
.hero-dates { color: #cbbfa9; font-style: italic; margin: 0.6rem 0 0; font-size: 1.15rem; }

.topnav {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 0.4rem;
  margin-top: 2.75rem; padding: 0.85rem 1rem;
  background: rgba(0,0,0,0.18);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(6px);
}
.topnav a {
  color: #e9e1d3; text-decoration: none; font-family: 'Cormorant Garamond', serif;
  font-size: 1.18rem; padding: 0.25rem 0.7rem; border-radius: 999px; transition: background 0.2s;
}
.topnav a:hover { background: rgba(255,255,255,0.12); }
.topnav a.cta { background: var(--accent); color: #fff; font-weight: 600; }
.topnav a.cta:hover { background: var(--accent-deep); }

/* ---------- SECTIONS ---------- */
.section { max-width: 900px; margin: 0 auto; padding: 4rem 1.25rem; }
.section-soft { background: var(--bg-soft); max-width: none; }
.section-soft > * { max-width: 900px; margin-left: auto; margin-right: auto; }
.section h2 {
  font-size: clamp(2rem, 4vw, 2.8rem); text-align: center; margin: 0 0 0.4rem;
  position: relative; padding-bottom: 0.8rem;
}
.section h2::after {
  content: ""; display: block; width: 64px; height: 2px; background: var(--accent);
  margin: 0.7rem auto 0; opacity: 0.6;
}
.section-lead { text-align: center; color: var(--muted); max-width: 640px; margin: 0 auto 2rem; }
.about-text { font-size: 1.15rem; white-space: pre-wrap; }
.about-text p { margin: 0 0 1rem; }

/* ---------- OBIT AUDIO ---------- */
.obit-audio { text-align: center; margin-bottom: 1.5rem; }
.obit-audio-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--accent); color: #fff; border: none;
  padding: 0.75rem 1.8rem; border-radius: 999px;
  font-family: 'Lora', serif; font-size: 1.05rem;
  cursor: pointer; transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(122,106,82,0.3);
}
.obit-audio-btn:hover { background: var(--accent-deep); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(122,106,82,0.4); }
.obit-audio-btn.playing { background: var(--accent-deep); }
.obit-audio audio { display: block; width: 100%; max-width: 500px; margin: 0.75rem auto 0; }

/* ---------- FUNERAL ---------- */
.funeral-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 2rem; margin-top: 1rem; border: 1px solid var(--line);
}
.funeral-card .fdetails { white-space: pre-wrap; font-size: 1.1rem; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.fgrid .fitem { padding: 1rem; background: var(--bg-soft); border-radius: 10px; }
.fgrid .flabel { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; color: var(--muted); margin: 0 0 0.3rem; }
.fgrid .fvalue { font-size: 1.1rem; margin: 0; }
.fstream { display: inline-block; margin-top: 1.25rem; background: var(--accent); color: #fff; padding: 0.6rem 1.3rem; border-radius: 999px; text-decoration: none; }
.fstream:hover { background: var(--accent-deep); }

/* ---------- TABS / FORMS ---------- */
.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-bottom: 1.75rem; }
.tab {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-family: 'Lora', serif; font-size: 0.98rem; padding: 0.55rem 1rem;
  border-radius: 999px; cursor: pointer; transition: all 0.2s;
}
.tab:hover { border-color: var(--accent); }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.form-wrap { max-width: 600px; margin: 0 auto; }
.cform { display: none; flex-direction: column; gap: 1rem; background: var(--card);
  padding: 1.75rem; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.cform.active { display: flex; }
.form-hint { color: var(--muted); margin: 0 0 0.25rem; font-style: italic; }
.cform label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.92rem; color: var(--accent-deep); font-weight: 500; }
.cform input, .cform textarea {
  font-family: 'Lora', serif; font-size: 1rem; padding: 0.65rem 0.8rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fdfcfa; color: var(--ink); width: 100%;
}
.cform input:focus, .cform textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(122,106,82,0.12); }
.cform textarea { resize: vertical; }
.req { color: #b04a3a; }
.cform button, .form-status { font-family: 'Lora', serif; }
.cform button[type=submit] {
  background: var(--accent); color: #fff; border: none; padding: 0.8rem; border-radius: 8px;
  font-size: 1.05rem; cursor: pointer; transition: background 0.2s; margin-top: 0.25rem;
}
.cform button[type=submit]:hover { background: var(--accent-deep); }
.cform button[disabled] { opacity: 0.6; cursor: default; }
.form-status { text-align: center; margin-top: 1rem; min-height: 1.4rem; }
.form-status.ok { color: #3f7a4b; }
.form-status.err { color: #b04a3a; }

/* ---------- DISPLAY: GALLERY ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.85rem; }
.gallery figure { margin: 0; background: var(--card); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); cursor: pointer; }
.gallery img { width: 100%; height: 170px; object-fit: cover; display: block; transition: transform 0.3s; }
.gallery figure:hover img { transform: scale(1.04); }
.gallery figcaption { padding: 0.6rem 0.7rem; font-size: 0.85rem; color: var(--muted); }
.gallery figcaption .by { display: block; font-style: italic; font-size: 0.78rem; margin-top: 0.2rem; }

/* ---------- DISPLAY: CARDS ---------- */
.cards { display: grid; gap: 1.25rem; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem 1.75rem; border: 1px solid var(--line); }
.card h3 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.card .body { white-space: pre-wrap; }
.card .by { margin: 0.9rem 0 0; color: var(--muted); font-style: italic; font-size: 0.9rem; }
.card audio { width: 100%; margin-top: 0.75rem; }
.card .music-link { display: inline-block; margin-top: 0.5rem; }
.card .artist { color: var(--muted); }

/* ---------- DISPLAY: SPECIAL MEMORIES ---------- */
.memory-list { display: grid; gap: 1.5rem; }
.memory { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.memory-photo { background: #d9cfc0; }
.memory-photo img { width: 100%; height: 100%; min-height: 200px; object-fit: cover; display: block; cursor: pointer; }
.memory-text { padding: 1.5rem 1.75rem; }
.memory-text h3 { margin: 0 0 0.5rem; font-size: 1.6rem; }
.memory-text .body { white-space: pre-wrap; }
.memory:not(:has(.memory-photo)) { grid-template-columns: 1fr; }

/* ---------- DISPLAY: VIDEOS ---------- */
.video-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.video-card video { width: 100%; border-radius: 8px; margin-top: 0.5rem; background: #000; }
.video-frame { position: relative; padding-top: 56.25%; margin-top: 0.5rem; border-radius: 8px; overflow: hidden; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- DISPLAY: VERSES ---------- */
.verse-list, .quote-list { display: grid; gap: 1.5rem; }
.verse, .quote {
  background: var(--card); border-left: 4px solid var(--accent); border-radius: 8px;
  padding: 1.5rem 1.75rem; box-shadow: var(--shadow); font-size: 1.15rem;
}
.verse .vtext, .quote .qtext { font-style: italic; }
.verse .vref { display: block; margin-top: 0.7rem; font-family: 'Cormorant Garamond', serif; font-size: 1.25rem; color: var(--accent-deep); }
.quote .qattr { display: block; margin-top: 0.6rem; color: var(--muted); font-size: 0.95rem; }
.quote .qdesc { display: block; margin-top: 0.4rem; color: var(--muted); font-size: 0.92rem; font-style: normal; }
.verse .by, .quote .by { color: var(--muted); font-style: normal; font-size: 0.85rem; margin-top: 0.5rem; display: block; }

.empty { text-align: center; color: var(--muted); font-style: italic; }

/* ---------- FOOTER ---------- */
.footer { background: #2e2a26; color: #e9e1d3; text-align: center; padding: 3rem 1.25rem; margin-top: 2rem; }
.footer p { margin: 0.3rem 0; font-family: 'Cormorant Garamond', serif; font-size: 1.4rem; }
.footer-sub { font-style: italic; color: #cbbfa9; font-size: 1.05rem !important; }
.admin-link { color: #998b73; font-size: 0.8rem !important; text-decoration: none; letter-spacing: 0.05em; }

/* ---------- SECTION HEADER (with slideshow button) ---------- */
.section-header { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.section-header h2 { margin-bottom: 0; }
.slideshow-btn {
  background: var(--accent); color: #fff; border: none; padding: 0.55rem 1.2rem;
  border-radius: 999px; font-family: 'Lora', serif; font-size: 0.95rem;
  cursor: pointer; transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
}
.slideshow-btn:hover { background: var(--accent-deep); transform: scale(1.03); }

/* ---------- LIGHTBOX / SLIDESHOW ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(20,16,12,0.95); display: flex; flex-direction: column;
  align-items: center; justify-content: center; z-index: 100; padding: 2rem; }
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 92vw; max-height: 72vh; border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transition: opacity 0.3s ease;
}
.lightbox-close {
  position: absolute; top: 1rem; right: 1.4rem;
  background: none; border: none; color: #fff; font-size: 2.5rem; cursor: pointer; line-height: 1;
  z-index: 110; opacity: 0.8; transition: opacity 0.2s;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-prev, .lightbox-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.12); border: none; color: #fff;
  font-size: 2rem; padding: 0.8rem 1rem; cursor: pointer;
  border-radius: 50%; transition: background 0.2s; z-index: 110;
  backdrop-filter: blur(4px);
}
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.25); }

.lightbox-bottom {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  margin-top: 1rem; width: 100%; max-width: 600px;
}
.lightbox-cap { color: #e9e1d3; text-align: center; margin: 0; font-size: 1rem; }
.lightbox-controls { display: flex; align-items: center; gap: 1rem; }
.lightbox-play {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25);
  color: #fff; padding: 0.45rem 1rem; border-radius: 999px;
  font-family: 'Lora', serif; font-size: 0.88rem; cursor: pointer;
  transition: background 0.2s;
}
.lightbox-play:hover { background: rgba(255,255,255,0.3); }
.lightbox-counter {
  color: rgba(255,255,255,0.6); font-size: 0.85rem; font-family: 'Lora', serif;
}

@media (max-width: 560px) {
  .hero { padding-top: 3rem; }
  .section { padding: 2.75rem 1rem; }
  .cform { padding: 1.25rem; }
  .memory { grid-template-columns: 1fr; }
  .memory-photo img { min-height: 220px; }
  .lightbox-prev, .lightbox-next { font-size: 1.4rem; padding: 0.6rem 0.8rem; }
  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
  .lightbox img { max-height: 65vh; }
  .section-header { flex-direction: column; gap: 0.5rem; }
}
