/*
Theme Name: Everlasting Memory
Theme URI: https://example.com/
Author: Everlasting Memory
Description: A dignified, fully editable WordPress memorial and obituary theme with a photo gallery, video memories, achievements timeline, moderated guestbook, PDF document library, blog support, and visitor counting.
Version: 6.0.0
Requires at least: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: everlasting-memory
Tags: one-column, custom-menu, sticky-post, translation-ready
*/

:root {
  --memorial-bg: #f2f0e7;
  --memorial-paper: #fbfaf4;
  --memorial-ink: #334139;
  --memorial-muted: #6f746c;
  --memorial-accent: #b59a55;
  --memorial-line: rgba(65, 79, 66, .16);
  --memorial-shadow: 0 18px 50px rgba(69, 78, 65, .12);
  --memorial-radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.skip-link {
  left: 12px; top: 12px;
  z-index: 100001;
  background: #26332b;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
}
.skip-link:focus {
  position: fixed !important;
  width: auto; height: auto;
  margin: 0;
  clip: auto;
  clip-path: none;
  white-space: normal;
  outline: 3px solid var(--memorial-accent);
}
section[id], div[id].section-anchor { scroll-margin-top: 92px; }
body {
  margin: 0;
  background: var(--memorial-bg);
  color: var(--memorial-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}
a { color: inherit; }
a:focus-visible, button:focus-visible, .btn:focus-visible { outline: 3px solid var(--memorial-accent); outline-offset: 2px; }
img { max-width: 100%; display: block; }
button, input, textarea { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #26332b;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.admin-bar .site-header { top: 32px; }
.header-inner {
  width: min(1180px, calc(100% - 32px));
  min-height: 72px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: .02em;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid #d8c9a4;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #d8c9a4;
}
.site-nav { display: flex; gap: 22px; }
.site-nav a { text-decoration: none; font-size: .94rem; font-weight: 650; }
.site-nav a:hover { color: #d8c9a4; }
.nav-toggle { display: none; border: 0; background: transparent; color: #d8c9a4; font-size: 1.4rem; }

.hero.hero-classic {
  min-height: 540px;
  position: relative;
  overflow: hidden;
  display: grid;
  align-items: center;
  color: var(--memorial-ink);
  width: min(1400px, calc(100% - 32px));
  margin: 24px auto 0;
  border-radius: 22px;
  background: #f7f4ec url('assets/images/hero-classic-exact-background.jpg') center/cover no-repeat;
  border: 1px solid rgba(178, 157, 116, .28);
  box-shadow: 0 22px 54px rgba(68, 74, 65, .08);
}
.hero.hero-classic::before,
.hero.hero-classic::after { display: none; }
.hero-floral {
  display: none;
  position: absolute;
  background: url('assets/images/lily-flower-public-domain.jpg') center/contain no-repeat;
}
.hero-classic-inner {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 58px 0;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(260px,330px);
  align-items: center;
  gap: clamp(34px,5vw,70px);
}
.hero.hero-classic .hero-content {
  width: auto;
  margin: 0;
  padding: 0 0 0 clamp(150px,16vw,230px);
  text-align: center;
  position: relative;
  z-index: 4;
}
.hero.hero-classic .eyebrow {
  color: #b18a43;
  font-size: .88rem;
  letter-spacing: .25em;
}
.hero.hero-classic h1 {
  margin: 14px 0 12px;
  max-width: none;
  color: #172b49;
  font: 700 clamp(3rem,5.6vw,5.6rem)/.98 Georgia,"Times New Roman",serif;
  letter-spacing: -.04em;
  text-wrap: balance;
}
.hero.hero-classic .hero-dates {
  color: #5f6870;
  font-family: Georgia,"Times New Roman",serif;
  font-size: clamp(1rem,1.35vw,1.18rem);
  letter-spacing: .075em;
}
.hero-ornament {
  margin: 20px auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #b18a43;
}
.hero-ornament span { width: 74px; height: 1px; background: rgba(177,138,67,.5); }
.hero-ornament b { font-size: .9rem; font-weight: 400; }
.hero.hero-classic .hero-quote {
  max-width: 650px;
  margin: 0 auto;
  color: #747474;
  font: italic clamp(1.03rem,1.45vw,1.25rem)/1.65 Georgia,"Times New Roman",serif;
}
.hero-portrait-frame {
  justify-self: center;
  width: min(29vw, 340px);
  min-width: 250px;
  aspect-ratio: 4 / 5;
  padding: 10px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(244,239,231,.95));
  box-shadow: 0 18px 38px rgba(107,86,57,.16), 0 0 0 1px rgba(176,154,113,.26);
  position: relative;
  overflow: hidden;
}
.hero-portrait-frame::before {
  content:"";
  position:absolute;
  inset:10px;
  border:1px solid rgba(187,164,118,.68);
  border-radius: 4px;
  pointer-events:none;
  z-index:3;
}
.hero-portrait-frame::after {
  content:"";
  position:absolute;
  inset:0;
  border-radius: 8px;
  box-shadow: inset 0 0 28px rgba(255,255,255,.82), inset 0 0 70px rgba(255,255,255,.18);
  pointer-events:none;
  z-index:2;
}
.hero-portrait-ring {
  width:100%; height:100%;
  overflow:hidden;
  border-radius: 4px;
  background:#efe9de;
  border:1px solid rgba(255,253,247,.95);
  position: relative;
}
.hero-portrait-ring img {
  width:100%; height:100%;
  object-fit:cover;
  object-position:center 18%;
}
.hero-portrait-ring::after {
  content:"";
  position:absolute;
  inset:0;
  background: radial-gradient(circle at center, transparent 58%, rgba(255,255,255,.55) 100%);
  pointer-events:none;
}

.hero-actions { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 800;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--memorial-accent); color: #26332b; }
.btn-secondary { border-color: rgba(255,255,255,.48); color: #fff; background: rgba(255,255,255,.05); }

.section { padding: 96px 0; }
.section.alt { background: var(--memorial-paper); }
.container { width: min(1180px, calc(100% - 32px)); margin: auto; }
.section-heading { max-width: 740px; margin-bottom: 44px; }
.section-heading h2 {
  margin: 8px 0 12px;
  font: 700 clamp(2.2rem, 5vw, 4.2rem)/1.08 Georgia, serif;
  letter-spacing: -.035em;
}
.section-heading p { color: var(--memorial-muted); margin: 0; font-size: 1.06rem; }

.story-grid { display: grid; grid-template-columns: .82fr 1.18fr; gap: 64px; align-items: start; }
.portrait-card { position: sticky; top: 110px; }
.portrait-card img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: var(--memorial-radius); box-shadow: var(--memorial-shadow); }
.portrait-caption { margin-top: 14px; color: var(--memorial-muted); font-size: .93rem; }
.story-copy { font-size: 1.08rem; }
.story-copy p:first-child::first-letter { float: left; font: 700 4.3rem/.8 Georgia, serif; margin: 11px 10px 0 0; color: var(--memorial-accent); }

.timeline { display: grid; gap: 18px; }
.timeline-item {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 26px;
  padding: 26px;
  border: 1px solid var(--memorial-line);
  border-radius: 18px;
  background: rgba(255,255,255,.55);
}
.timeline-year { color: var(--memorial-accent); font: 700 1.25rem Georgia, serif; }
.timeline-item h3 { margin: 0 0 6px; font: 700 1.35rem Georgia, serif; }
.timeline-item p { margin: 0; color: var(--memorial-muted); }

.values-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.value-card { padding: 28px; background: #5f6f5d; color: #fff; border-radius: 20px; }
.value-card h3 { margin: 0 0 8px; font: 700 1.45rem Georgia, serif; color: #d8c9a4; }
.value-card p { margin: 0; color: rgba(255,255,255,.76); }

.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; }
.gallery figure { margin: 0; overflow: hidden; border-radius: 18px; position: relative; background: #eee9df; border: 1px solid var(--memorial-line); box-shadow: 0 12px 32px rgba(23,35,56,.08); }
.gallery figure a { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; padding: 14px; background: #f6f4ec; }
.gallery img { width: 100%; height: 100%; object-fit: contain; object-position: center; transition: transform .35s ease; }
.gallery figure:hover img { transform: scale(1.015); }
.gallery figcaption { padding: 12px 16px 15px; color: var(--memorial-ink); background: #fff; font-size: .9rem; }

.video-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 22px; }
.video-card { background: var(--memorial-paper); border: 1px solid var(--memorial-line); border-radius: 20px; overflow: hidden; }
.video-frame { aspect-ratio: 16/9; background: #2b382f; }
.video-frame iframe { width: 100%; height: 100%; border: 0; }
.video-body { padding: 22px; }
.video-body h3 { margin: 0 0 8px; font: 700 1.35rem Georgia, serif; }
.video-body p { margin: 0; color: var(--memorial-muted); }

.pdf-card { display: grid; grid-template-columns: .9fr 1.1fr; background: #5f6f5d; color: #fff; border-radius: 28px; overflow: hidden; box-shadow: var(--memorial-shadow); }
.pdf-copy { padding: 48px; align-self: center; }
.pdf-copy h2 { margin: 8px 0 14px; font: 700 clamp(2rem,4vw,3.4rem)/1.1 Georgia, serif; }
.pdf-copy p { color: rgba(255,255,255,.76); }
.pdf-preview { min-height: 520px; background: #fff; position: relative; }
.pdf-preview object,
.pdf-preview iframe { width: 100%; height: 100%; min-height: 520px; border: 0; display: block; }
.pdf-mobile-open { display: none; }

.site-footer { background: #26332b; color: rgba(255,255,255,.74); padding: 52px 0 30px; }
.footer-grid { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.footer-title { color: #fff; font: 700 1.6rem Georgia, serif; }
.visitor-count {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 10px 16px;
  color: #fff;
}
.visitor-count strong { color: #d8c9a4; font-size: 1.12rem; }
.footer-note { border-top: 1px solid rgba(255,255,255,.12); padding-top: 22px; margin-top: 34px; font-size: .86rem; }

.empty-notice { padding: 28px; border: 1px dashed var(--memorial-line); border-radius: 18px; color: var(--memorial-muted); }

@media (max-width: 900px) {
  .admin-bar .site-header { top: 46px; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 72px; background: #26332b; color: #fff; padding: 18px 24px; border-radius: 0; box-shadow: var(--memorial-shadow); flex-direction: column; border-top: 1px solid rgba(255,255,255,.12); }
  .site-nav.is-open { display: flex; }
  .nav-toggle { display: block; }
  .hero.hero-classic { min-height: auto; width: 100%; margin-top: 0; border-radius: 0; background-position: center; background-size: cover; }
  .hero-classic-inner { grid-template-columns: 1fr; padding: 34px 0 48px; }
  .hero.hero-classic .hero-content { padding: 0; order: 2; }
  .hero-floral {
    display: block;
    left: -64px;
    top: 105px;
    bottom: auto;
    width: 255px;
    height: 360px;
    opacity: .95;
    filter: brightness(1.1) contrast(.9) saturate(.9);
    mix-blend-mode: multiply;
    z-index: 1;
    pointer-events: none;
  }
  .hero.hero-classic::before {
    display: block;
    content: "";
    position: absolute;
    inset: 0;
    background:
      linear-gradient(180deg, rgba(250,248,241,.06), rgba(250,248,241,.30)),
      linear-gradient(90deg, rgba(255,255,255,.12), rgba(255,255,255,.34));
    z-index: 1;
    pointer-events: none;
  }
  .hero.hero-classic::after {
    display: block;
    content: "";
    position: absolute;
    right: -95px;
    top: 235px;
    width: 260px;
    height: 390px;
    background: url('assets/images/lily-flower-public-domain.jpg') center/contain no-repeat;
    transform: scaleX(-1);
    opacity: .28;
    filter: blur(5px) brightness(1.3) saturate(.65);
    mix-blend-mode: multiply;
    z-index: 1;
    pointer-events: none;
  }

  .hero-portrait-frame { order: 1; width: min(58vw,280px); min-width: 220px; }
  
  .story-grid, .pdf-card { grid-template-columns: 1fr; }
  .portrait-card { position: static; max-width: 560px; }
  .values-grid { grid-template-columns: 1fr; }
  .pdf-preview {
    min-height: 0;
    height: 72vh;
    max-height: 720px;
    overflow: hidden;
    background: #fff;
    border-top: 1px solid rgba(65,79,66,.14);
  }
  .pdf-preview object,
  .pdf-preview iframe {
    display: block;
    width: 100%;
    height: 72vh !important;
    min-height: 0 !important;
    max-height: 720px;
    border: 0;
  }
  .pdf-mobile-open {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 18px;
    background: #f5f1e7;
    border-top: 1px solid rgba(65,79,66,.14);
  }
  .pdf-mobile-open a {
    width: 100%;
    text-align: center;
    text-decoration: none;
    font-weight: 800;
    color: #26332b;
    border: 1px solid rgba(181,154,85,.6);
    border-radius: 999px;
    padding: 12px 16px;
    background: #fffaf0;
  }
}

@media (max-width: 640px) {
  .section { padding: 72px 0; }
  .hero.hero-classic h1 { font-size: clamp(2.8rem,13vw,4.7rem); }
  .hero-classic-inner { width: min(100% - 28px, 1280px); padding: 28px 0 38px; }
  .hero-portrait-frame { width: min(70vw,270px); min-width: 0; }
  
  .timeline-item { grid-template-columns: 1fr; gap: 7px; }
  .gallery { grid-template-columns: 1fr; }
  .gallery figure a { aspect-ratio: auto; min-height: 240px; max-height: 72vh; }
  .video-grid { grid-template-columns: 1fr; }
  .pdf-copy { padding: 30px 24px; }
  .pdf-card { border-radius: 20px; }
  .pdf-preview { height: 70vh; }
  .pdf-preview object, .pdf-preview iframe { height: 70vh !important; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* Memorial guestbook */
.guestbook-section { background: #f4f2e9; }
.guestbook-layout { display: grid; grid-template-columns: .82fr 1.18fr; gap: 28px; align-items: start; }
.tribute-form, .tribute-list-wrap { background: #fff; border: 1px solid var(--memorial-line); border-radius: 22px; padding: 28px; box-shadow: 0 18px 50px rgba(15,23,42,.07); }
.tribute-form { display: grid; gap: 17px; }
.tribute-form label { display: grid; gap: 7px; font-weight: 750; color: #3c4b40; }
.tribute-form input, .tribute-form select, .tribute-form textarea { width: 100%; border: 1px solid #d0d5cd; border-radius: 12px; padding: 12px 13px; font: inherit; background: #fff; color: #3c4b40; }
.tribute-form textarea { resize: vertical; min-height: 150px; }
.tribute-form input:focus, .tribute-form select:focus, .tribute-form textarea:focus { outline: 3px solid color-mix(in srgb, var(--memorial-accent) 25%, transparent); border-color: var(--memorial-accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.privacy-note { margin: -4px 0 0; color: var(--memorial-muted); font-size: .88rem; }
.honeypot { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.form-notice { margin: 0 0 22px; padding: 14px 16px; border-radius: 12px; font-weight: 700; }
.form-notice.success { background: #edf8f0; border: 1px solid #a9d5b3; color: #205b30; }
.form-notice.error { background: #fff1f0; border: 1px solid #e0aaa7; color: #8c2621; }
.tribute-list-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--memorial-line); }
.tribute-list-heading h3 { margin: 0; font: 700 1.45rem Georgia, serif; }
.tribute-list-heading span { color: var(--memorial-muted); font-size: .88rem; white-space: nowrap; }
.tribute-list { max-height: 620px; overflow-y: auto; padding-right: 8px; margin-top: 10px; scroll-behavior: smooth; }
.tribute-card { padding: 22px 4px; border-bottom: 1px solid var(--memorial-line); }
.tribute-card:last-child { border-bottom: 0; }
.tribute-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.tribute-type { display: inline-flex; padding: 5px 10px; border-radius: 999px; background: #5f6f5d; color: #fff; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.tribute-card time { color: var(--memorial-muted); font-size: .84rem; }
.tribute-message { color: #5b665e; }
.tribute-message p { margin: 0 0 10px; }
.tribute-name { color: var(--memorial-accent); font: italic 700 1.04rem Georgia, serif; }

@media (max-width: 900px) {
  .guestbook-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .tribute-form, .tribute-list-wrap { padding: 21px; }
  .tribute-list { max-height: 560px; }
}

/* Memorial document library */
.document-library-section { background: #efede4; }
.document-toolbar { display: grid; gap: 18px; margin-bottom: 30px; }
.document-search input { width: 100%; min-height: 54px; border: 1px solid var(--memorial-line); border-radius: 999px; padding: 12px 22px; font: inherit; background: #fff; box-shadow: 0 10px 35px rgba(15,23,42,.05); }
.document-search input:focus { outline: 3px solid color-mix(in srgb, var(--memorial-accent) 24%, transparent); border-color: var(--memorial-accent); }
.document-filters { display: flex; flex-wrap: wrap; gap: 9px; }
.document-filter { border: 1px solid #c9c7bc; background: rgba(255,255,255,.72); color: #59675b; border-radius: 999px; padding: 9px 15px; font: inherit; font-weight: 750; cursor: pointer; }
.document-filter:hover, .document-filter.is-active { background: #5f6f5d; color: #fff; border-color: #5f6f5d; }
.document-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 22px; }
.document-card { min-width: 0; background: #fff; border: 1px solid var(--memorial-line); border-radius: 21px; overflow: hidden; box-shadow: 0 16px 42px rgba(15,23,42,.07); display: flex; flex-direction: column; }
.document-card[hidden] { display: none !important; }
.document-cover { aspect-ratio: 4/3; overflow: hidden; background: #d8d5ca; }
.document-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.document-card:hover .document-cover img { transform: scale(1.025); }
.document-cover-placeholder { height: 100%; display: grid; place-content: center; text-align: center; background: linear-gradient(145deg,#5f6f5d,#61705f); color: #fff; }
.document-cover-placeholder span { font: 800 3.2rem/1 Georgia,serif; letter-spacing: .08em; color: #d8c9a4; }
.document-cover-placeholder small { margin-top: 12px; text-transform: uppercase; letter-spacing: .12em; opacity: .78; }
.document-card-body { padding: 23px; display: flex; flex: 1; flex-direction: column; }
.document-meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--memorial-muted); font-size: .79rem; text-transform: uppercase; letter-spacing: .08em; }
.document-meta span + span::before { content: "•"; margin-right: 8px; }
.document-card h3 { margin: 9px 0 7px; font: 700 1.35rem/1.2 Georgia,serif; }
.document-category-label { color: var(--memorial-accent); font-size: .86rem; font-weight: 800; }
.document-card p { color: var(--memorial-muted); margin: 12px 0 20px; }
.document-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 9px; }
.document-actions .btn { min-height: 43px; padding: 9px 15px; }
.document-download-button { border-color: #bfc7bc; color: #3c4b40; background: #fff; }
.document-library-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 26px; }
.document-library-footer p { margin: 0; color: var(--memorial-muted); }
.document-load-more { color: #fff; background: #5f6f5d; }

.pdf-modal[hidden] { display: none; }
.pdf-modal { position: fixed; inset: 0; z-index: 100000; display: grid; place-items: center; padding: 20px; }
.pdf-modal-backdrop { position: absolute; inset: 0; background: rgba(5,11,21,.86); backdrop-filter: blur(5px); }
.pdf-modal-dialog { position: relative; width: min(1180px,100%); height: min(88vh,920px); border-radius: 18px; overflow: hidden; background: #fff; display: grid; grid-template-rows: auto 1fr auto; box-shadow: 0 25px 90px rgba(0,0,0,.45); }
.pdf-modal-header { min-height: 64px; padding: 12px 18px 12px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #5f6f5d; color: #fff; }
.pdf-modal-header h2 { margin: 0; font: 700 1.2rem Georgia,serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-modal-close { width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; background: transparent; color: #fff; font-size: 1.8rem; line-height: 1; cursor: pointer; }
.pdf-modal iframe { width: 100%; height: 100%; border: 0; background: #e3e6df; }
.pdf-modal-actions { padding: 11px 18px; display: flex; justify-content: flex-end; border-top: 1px solid var(--memorial-line); background: #fff; }
body.pdf-modal-open { overflow: hidden; }

@media (max-width: 900px) {
  .document-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .pdf-modal { padding: 8px; }
  .pdf-modal-dialog { height: 94vh; }
}
@media (max-width: 640px) {
  .document-grid { grid-template-columns: 1fr; }
  .document-library-footer { align-items: stretch; flex-direction: column; }
  .document-load-more { width: 100%; }
  .pdf-modal { padding: 0; }
  .pdf-modal-dialog { width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .pdf-modal-actions .btn { width: 100%; }
}

/* Version 5: favourite photographs and blog */
.featured-photo-strip { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:4px; background:#fff; padding:4px; }
.featured-photo-strip figure { margin:0; aspect-ratio:4/3; overflow:hidden; }
.featured-photo-strip img { width:100%; height:100%; object-fit:cover; display:block; transition:transform .4s ease; }
.featured-photo-strip figure:hover img { transform:scale(1.035); }
.latest-stories-section { background:#fff; }
.post-card-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:24px; }
.post-card { background:#fff; border:1px solid var(--memorial-line); border-radius:20px; overflow:hidden; box-shadow:0 15px 40px rgba(15,23,42,.07); }
.post-card-image { display:block; aspect-ratio:16/10; overflow:hidden; background:#405047; }
.post-card-image img { width:100%; height:100%; object-fit:cover; transition:transform .4s ease; }
.post-card:hover .post-card-image img { transform:scale(1.035); }
.post-image-placeholder { height:100%; display:grid; place-items:center; color:#d5c49d; font:700 2rem Georgia,serif; background:linear-gradient(140deg,#35443a,#71806d); }
.post-card-body { padding:24px; }
.post-card-meta,.article-meta { color:var(--memorial-muted); font-size:.82rem; letter-spacing:.04em; }
.post-card-meta a { color:inherit; }
.post-card h2,.post-card h3 { margin:10px 0; font:700 1.45rem/1.22 Georgia,serif; }
.post-card h2 a,.post-card h3 a { color:#3c4b40; text-decoration:none; }
.post-card p { color:var(--memorial-muted); }
.text-link { color:var(--memorial-accent); font-weight:800; text-decoration:none; }
.section-actions { margin-top:30px; text-align:center; }
.page-hero { background:linear-gradient(135deg,#2f3d34,#687764); color:#fff; }
.compact-hero { padding:90px 0 64px; }
.page-hero h1 { max-width:900px; margin:8px 0 12px; font:700 clamp(2.5rem,6vw,5rem)/1.02 Georgia,serif; }
.page-hero p,.archive-description { max-width:760px; color:rgba(255,255,255,.78); }
.content-with-sidebar,.article-layout { display:grid; grid-template-columns:minmax(0,1fr) 310px; gap:46px; align-items:start; }
.content-with-sidebar .post-card-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.blog-sidebar { display:grid; gap:18px; position:sticky; top:90px; }
.sidebar-card { padding:24px; border:1px solid var(--memorial-line); border-radius:18px; background:#f4f2e9; }
.sidebar-card h2 { margin-top:0; font:700 1.25rem Georgia,serif; }
.sidebar-card ul { margin:0; padding-left:20px; }
.sidebar-card li { margin:9px 0; }
.sidebar-card a { color:#59675b; }
.sidebar-card input[type=search] { width:100%; min-height:46px; border:1px solid var(--memorial-line); border-radius:10px; padding:10px 12px; }
.article-hero { padding:92px 0 70px; }
.article-heading { max-width:940px; }
.article-featured { margin-top:-35px; position:relative; }
.article-featured img,.page-featured-image { width:100%; height:auto; max-height:650px; object-fit:cover; border-radius:22px; box-shadow:0 20px 55px rgba(15,23,42,.18); }
.article-layout { padding-top:55px; padding-bottom:80px; }
.article-content,.narrow-content { font-size:1.08rem; line-height:1.8; }
.article-content { max-width:780px; }
.article-content img { max-width:100%; height:auto; border-radius:14px; }
.narrow-content { max-width:900px; }
.pagination { margin-top:34px; }
.nav-links { display:flex; gap:8px; flex-wrap:wrap; }
.page-numbers { padding:9px 13px; border:1px solid var(--memorial-line); border-radius:9px; text-decoration:none; }
.page-numbers.current { background:#5f6f5d; color:#fff; }
.post-navigation { margin-top:45px; padding-top:24px; border-top:1px solid var(--memorial-line); }
@media(max-width:900px){.featured-photo-strip{grid-template-columns:repeat(3,1fr)}.featured-photo-strip figure:nth-child(n+4){display:none}.post-card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.content-with-sidebar,.article-layout{grid-template-columns:1fr}.blog-sidebar{position:static}}
@media(max-width:640px){.post-card-grid,.content-with-sidebar .post-card-grid{grid-template-columns:1fr}.compact-hero,.article-hero{padding:70px 0 46px}.featured-photo-strip{grid-template-columns:repeat(2,1fr)}.featured-photo-strip figure:nth-child(n+3){display:none}}
.site-nav .primary-menu { display: flex; align-items: center; gap: 24px; margin: 0; padding: 0; list-style: none; }
.site-nav .primary-menu li { margin: 0; position: relative; }
.site-nav .primary-menu a { display: block; }
.site-nav .sub-menu { position: absolute; z-index: 20; min-width: 190px; left: 0; top: 100%; margin: 0; padding: 8px; list-style: none; background: var(--memorial-dark, #36433a); border-radius: 8px; opacity: 0; visibility: hidden; transform: translateY(8px); transition: .2s ease; }
.site-nav li:hover > .sub-menu, .site-nav li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.section-anchor { position: relative; top: -88px; visibility: hidden; }
@media (max-width: 900px) {
  .site-nav .primary-menu { display: block; }
  .site-nav .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; background: transparent; padding-left: 16px; }
}

/* Version 5.2 bug fixes */
.featured-photo-strip { display: none !important; }
@media (max-width: 980px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .gallery { grid-template-columns: 1fr; } .gallery figure a { min-height: 220px; } }
