/* ============================================================
   Base
   ============================================================ */

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

:root {
  --color-bg: #faf8f5;
  --color-text: #2c2c2c;
  --color-muted: #6b6b6b;
  --color-accent: #5a3e28;
  --color-border: #ddd;
  --color-link: #5a3e28;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: system-ui, sans-serif;
  --max-width: 760px;
}

html {
  font-size: 18px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  font-family: var(--font-serif);
}

a {
  color: var(--color-link);
}

a:hover {
  text-decoration: underline;
}

/* ============================================================
   Layout
   ============================================================ */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================================
   Header
   ============================================================ */

.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
  margin-bottom: 2.5rem;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-title {
  font-size: 1.2rem;
  font-weight: bold;
  text-decoration: none;
  color: var(--color-accent);
  letter-spacing: 0.02em;
}

.site-header nav {
  display: flex;
  gap: 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 4rem;
  padding: 1.5rem 0;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--color-muted);
  text-align: center;
}

/* ============================================================
   Homepage Hero
   ============================================================ */

.hero {
  text-align: center;
  padding: 3rem 0 2rem;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 2.4rem;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
}

.hero p {
  color: var(--color-muted);
  font-size: 1.05rem;
}

/* ============================================================
   Memorial List
   ============================================================ */

.memorial-list h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--color-accent);
}

.memorial-list ul {
  list-style: none;
}

.memorial-list li {
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 0;
}

.memorial-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  text-decoration: none;
  gap: 1rem;
}

.memorial-list a:hover strong {
  text-decoration: underline;
}

.dates {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.empty {
  color: var(--color-muted);
  font-style: italic;
}

/* ============================================================
   Memorial Page
   ============================================================ */

.memorial-header {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.memorial-photo {
  width: 160px;
  height: 200px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.memorial-identity h1 {
  font-size: 2rem;
  color: var(--color-accent);
  margin-bottom: 0.25rem;
}

.nickname {
  color: var(--color-muted);
  font-style: italic;
  margin-bottom: 0.25rem;
}

.memorial-header .dates {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

.epitaph {
  border-left: 3px solid var(--color-accent);
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  color: var(--color-muted);
  font-style: italic;
  font-size: 1.05rem;
}

.memorial-body {
  margin-top: 1.5rem;
}

.memorial-body p {
  margin-bottom: 1rem;
}

.back-link {
  display: inline-block;
  margin-top: 2.5rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

/* ============================================================
   Memorial Nav (profile + sub-pages)
   ============================================================ */

.memorial-nav {
  display: flex;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 2rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.memorial-nav a {
  flex: 1;
  text-align: center;
  padding: 0.6rem 1rem;
  text-decoration: none;
  border-right: 1px solid var(--color-border);
  color: var(--color-accent);
  background: #fff;
  transition: background 0.15s;
}

.memorial-nav a:last-child {
  border-right: none;
}

.memorial-nav a:hover,
.memorial-nav a.active {
  background: var(--color-accent);
  color: #fff;
}

/* ============================================================
   Memorial Sub-pages
   ============================================================ */

.memorial-name-link {
  display: block;
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--color-accent);
  text-decoration: none;
}

.memorial-name-link:hover {
  text-decoration: underline;
}

.subpage-title {
  font-size: 1.4rem;
  color: var(--color-accent);
  margin-bottom: 1.25rem;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 540px) {
  .memorial-header {
    flex-direction: column;
  }

  .memorial-photo {
    width: 100%;
    height: auto;
    max-height: 280px;
  }

  .memorial-list a {
    flex-direction: column;
    gap: 0.1rem;
  }
}

/* ============================================================
   Obituary Page
   ============================================================ */

.obit-photo-wrap {
  float: right;
  margin: 0 0 1.5rem 2rem;
  width: 220px;
}

.obit-photo-wrap img {
  width: 100%;
  border-radius: 4px;
  display: block;
}

.obit-lede {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.obit-services {
  clear: both;
  margin-top: 2.5rem;
  border-top: 1px solid var(--color-border);
  padding-top: 1.5rem;
}

.obit-services h3 {
  font-size: 1.2rem;
  color: var(--color-accent);
  margin-bottom: 1.25rem;
}

.obit-services h4 {
  font-size: 1rem;
  color: var(--color-accent);
  margin-bottom: 0.4rem;
}

.obit-services p {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0.25rem;
}

.obit-service {
  margin-bottom: 1.5rem;
  padding-left: 1rem;
  border-left: 3px solid var(--color-border);
}

.obit-video {
  clear: both;
  margin-top: 2.5rem;
  border-top: 1px solid var(--color-border);
  padding-top: 1.5rem;
}

.obit-video h3 {
  font-size: 1.2rem;
  color: var(--color-accent);
  margin-bottom: 1rem;
}

.obit-video-embed {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  border-radius: 4px;
  overflow: hidden;
}

.obit-video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.obit-source {
  margin-top: 2rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--color-muted);
}

@media (max-width: 540px) {
  .obit-photo-wrap {
    float: none;
    width: 100%;
    margin: 0 0 1.5rem 0;
  }
}

/* ============================================================
   Image Gallery
   ============================================================ */

.gallery-section {
  margin-bottom: 3rem;
}

.gallery-category {
  font-size: 1.2rem;
  color: var(--color-accent);
  margin-bottom: 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.gallery-item {
  margin: 0;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
  background: #f0ece6;
  transition: opacity 0.15s;
}

.gallery-item:hover {
  opacity: 0.85;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.gallery-item figcaption {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--color-muted);
  padding: 0.4rem 0.6rem 0.5rem;
  line-height: 1.4;
}

/* ============================================================
   Lightbox
   ============================================================ */

.lightbox {
  border: none;
  border-radius: 6px;
  background: #111;
  padding: 0;
  max-width: 90vw;
  max-height: 90vh;
  width: fit-content;
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.85);
}

.lightbox-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
}

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

.lightbox-img {
  display: block;
  max-width: 85vw;
  max-height: 80vh;
  object-fit: contain;
}

.lightbox-caption {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: #ccc;
  text-align: center;
  padding: 0.6rem 1rem 0.75rem;
  margin: 0;
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
