/* Memoria grave search — brand styling pulled from memoria.jakub.best.
   Palette: ink #1D1D1D, page #FAFAFA, near-white #FCFCFC, muted #6E6E6E.
   Headings: Headland One (serif). UI/body: Gotu. Square corners throughout. */
@font-face {
  font-family: 'Headland One';
  src: url('/static/fonts/HeadlandOne-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Gotu';
  src: url('/static/fonts/Gotu-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
*, *::before, *::after { box-sizing: border-box; }
:root {
  --ink: #1D1D1D; --muted: #6E6E6E; --page: #FAFAFA; --paper: #FCFCFC;
  --line: #E4E2DE; --line-dark: #3A3A3A;
  --serif: 'Headland One', Georgia, 'Times New Roman', serif;
  --sans: 'Gotu', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
html { overflow-x: clip; }
body {
  margin: 0; min-height: 100dvh;
  display: flex; flex-direction: column;
  font-family: var(--sans);
  font-size: 16px; line-height: 1.6;
  color: var(--ink); background: var(--page);
}
h1, h2, h3 { font-family: var(--serif); font-weight: 400; }
a { color: var(--ink); }
img { max-width: 100%; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* header / footer */
.site-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.85rem clamp(0.9rem, 4vw, 2.5rem);
  background: var(--ink); color: var(--paper);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 0.8rem; text-decoration: none; color: inherit; }
.brand img { display: block; width: 91px; height: 40px; }
.brand-sub {
  color: #BDBDBD; font-size: 0.8rem; letter-spacing: 0.04em;
  border-left: 1px solid var(--line-dark); padding-left: 0.8rem;
}
.site-nav a {
  color: var(--paper); text-decoration: none; font-size: 0.9rem; letter-spacing: 0.02em;
}
.site-nav a:hover { text-decoration: underline; text-underline-offset: 0.25em; }
.site-footer {
  margin-top: auto; padding: 2rem clamp(0.9rem, 4vw, 2.5rem);
  background: var(--ink); color: #BDBDBD; font-size: 0.85rem;
}
.site-footer img { width: 68px; height: 30px; display: block; margin-bottom: 0.8rem; }
.site-footer p { margin: 0; max-width: 40rem; }
.site-footer a { color: var(--paper); }
main {
  flex: 1 0 auto; width: 100%; max-width: 74rem;
  margin: 0 auto 3rem; padding: 0 clamp(0.9rem, 4vw, 2.5rem);
}

/* hero — dark band continuing from the header, full-bleed */
.hero {
  background: var(--ink); color: var(--paper);
  width: 100vw; margin-left: calc(50% - 50vw);
  padding: clamp(1.6rem, 5vw, 3.2rem) clamp(0.9rem, 4vw, 2.5rem) clamp(1.8rem, 5vw, 3rem);
}
.hero-inner { max-width: 69rem; margin: 0 auto; }
.hero h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.7rem, 5.5vw, 2.6rem); line-height: 1.2;
}
.hero-sub { margin: 0 0 1.4rem; color: #CFCFCF; max-width: 46rem; font-size: 0.95rem; }
.search-form input[type="search"] {
  width: 100%; padding: 0.95rem 1.1rem; font-size: 1.02rem;
  font-family: var(--sans);
  border: 1px solid var(--paper); border-radius: 0;
  background: var(--paper); color: var(--ink);
  appearance: none;
}
.search-filters { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.7rem; }
.search-filters select {
  flex: 1 1 12rem; min-width: 0; padding: 0.7rem 0.8rem; font-size: 0.9rem;
  font-family: var(--sans);
  border-radius: 0; border: 1px solid var(--line-dark);
  background: transparent; color: var(--paper);
}
.search-filters select option { color: var(--ink); background: var(--paper); }
.search-filters button {
  flex: 1 0 100%; padding: 0.8rem 2rem; font-size: 0.95rem;
  font-family: var(--sans); letter-spacing: 0.02em;
  background: var(--paper); color: var(--ink); border: 1px solid var(--paper);
  border-radius: 0; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.search-filters button:hover { background: transparent; color: var(--paper); }
@media (min-width: 40rem) {
  .search-filters button { flex: 0 0 auto; }
}

/* results */
.results { margin-top: 1.6rem; }
.results-label { color: var(--muted); margin: 0 0 1rem; font-size: 0.9rem; }
.grid {
  display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}
.card {
  background: #fff;
  border: 1px solid var(--line); border-radius: 0;
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { border-color: var(--ink); box-shadow: 0 8px 24px rgba(29, 29, 29, 0.10); }
.card-media {
  position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden;
  background: #ECEAE6; color: #A9A69F;
}
.card-media img, .card-media .placeholder { position: absolute; inset: 0; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-media .placeholder { display: grid; place-items: center; }
.card-media .chip {
  position: absolute; top: 0.55rem; left: 0.55rem;
  background: rgba(29, 29, 29, 0.72); color: var(--paper);
  font-size: 0.74rem; padding: 0.14rem 0.55rem; border-radius: 0; letter-spacing: 0.03em;
}
.card-media .badge { position: absolute; top: 0.55rem; right: 0.55rem; }
.card-body { padding: 0.95rem 1rem 1.05rem; display: flex; flex-direction: column; gap: 0.2rem; }
.card-person {
  margin: 0; font-size: 1.08rem; line-height: 1.35;
}
.card-person.empty { color: var(--muted); font-style: italic; }
.card-dates { margin: 0; color: var(--muted); font-size: 0.84rem; }
.card-loc { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.8rem; }
.sp { font-family: var(--serif); color: var(--muted); font-size: 0.8em; }
.card-link {
  margin-top: 0.6rem; font-size: 0.85rem; color: var(--ink);
  text-decoration: underline; text-underline-offset: 0.25em; text-decoration-color: var(--line);
  transition: text-decoration-color 0.15s ease;
}
.card-link:hover { text-decoration-color: var(--ink); }

/* badges */
.badge {
  font-size: 0.72rem; letter-spacing: 0.05em; padding: 0.16rem 0.6rem;
  border-radius: 0; white-space: nowrap; font-family: var(--sans);
}
.badge-free { background: var(--paper); color: var(--ink); border: 1px solid var(--ink); }
.badge-reserved { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); }
.badge-type { background: #EFEDE9; color: var(--ink); border: 1px solid var(--line); }

/* pagination */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 1.2rem;
  margin: 2rem 0 0.6rem; color: var(--muted); white-space: nowrap; font-size: 0.92rem;
}
.pagination a {
  text-decoration: none; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 0;
  padding: 0.5rem 1rem;
  transition: border-color 0.15s ease;
}
.pagination a:hover { border-color: var(--ink); }
@media (max-width: 28rem) {
  .pagination { justify-content: space-between; gap: 0.45rem; font-size: 0.82rem; }
  .pagination a { padding: 0.42rem 0.6rem; }
}

/* no results */
.no-results {
  background: #fff; border: 1px solid var(--line); border-radius: 0; padding: 1.8rem;
}
.no-results h2, .no-results h1 { margin-top: 0; }
.no-results.standalone { margin-top: 2rem; }
.button {
  display: inline-block; background: var(--ink); color: var(--paper); text-decoration: none;
  padding: 0.75rem 1.8rem; border-radius: 0; border: 1px solid var(--ink);
  font-size: 0.95rem; transition: background 0.15s ease, color 0.15s ease;
}
.button:hover { background: transparent; color: var(--ink); }

/* grave detail */
.breadcrumb { margin: 1.3rem 0 0.7rem; font-size: 0.9rem; }
.breadcrumb a { text-decoration: none; color: var(--muted); }
.breadcrumb a:hover { color: var(--ink); }
.grave-header {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.7rem; margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--line); padding-bottom: 1.1rem;
}
.grave-header h1 {
  margin: 0; font-size: clamp(1.4rem, 5vw, 2rem); line-height: 1.25;
}
.grave-sub { margin: 0.2rem 0 0; color: var(--muted); overflow-wrap: anywhere; font-size: 0.92rem; }
.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.grave-layout { display: grid; gap: 1.1rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 46rem) { .grave-layout { grid-template-columns: 2fr 1fr; } }
.panel {
  background: #fff; border: 1px solid var(--line);
  border-radius: 0; padding: 1.2rem 1.3rem; margin-bottom: 1.1rem;
}
.panel h2 { margin: 0 0 0.8rem; font-size: 1.08rem; }
.occupant-list { list-style: none; margin: 0; padding: 0; }
.occupant-list li {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.15rem 0.8rem;
  padding: 0.6rem 0; border-top: 1px solid #EFEDE9;
}
.occupant-list li:first-child { border-top: 0; }
.occ-name { font-weight: 400; }
.occ-dates { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.main-flag {
  font-size: 0.68rem; letter-spacing: 0.05em; color: var(--ink); background: #EFEDE9;
  border: 1px solid var(--line); border-radius: 0; padding: 0.08rem 0.5rem; vertical-align: middle;
}
.photo-grid { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr)); }
.photo-thumb { border: 0; padding: 0; background: none; cursor: zoom-in; display: block; }
.photo-grid img {
  width: 100%; height: 8.5rem; object-fit: cover; border-radius: 0;
  border: 1px solid var(--line); transition: opacity 0.15s ease;
}
.photo-grid img:hover { opacity: 0.85; }

/* photo lightbox */
.lightbox {
  border: 0; padding: 0; background: transparent;
  width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh;
  display: none; place-items: center; overflow: hidden;
}
.lightbox[open] { display: grid; }
.lightbox::backdrop { background: rgba(15, 15, 15, 0.9); }
.lightbox img {
  max-width: min(94vw, 70rem); max-height: 86dvh; border-radius: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6); object-fit: contain;
}
.lb-close, .lb-nav {
  position: fixed; z-index: 2; border: 1px solid rgba(252, 252, 252, 0.4); cursor: pointer;
  background: rgba(29, 29, 29, 0.6); color: var(--paper);
  border-radius: 0; width: 2.6rem; height: 2.6rem;
  font-size: 1.5rem; line-height: 1; display: grid; place-items: center;
  transition: background 0.15s ease;
}
.lb-close:hover, .lb-nav:hover { background: rgba(252, 252, 252, 0.25); }
.lb-close { top: 0.9rem; right: 0.9rem; }
.lb-nav { top: 50%; transform: translateY(-50%); font-size: 1.9rem; padding-bottom: 0.2rem; }
.lb-prev { left: 0.7rem; }
.lb-next { right: 0.7rem; }
.lb-counter {
  position: fixed; left: 50%; bottom: 0.8rem; transform: translateX(-50%);
  margin: 0; color: var(--paper); font-size: 0.85rem;
  background: rgba(29, 29, 29, 0.7); border-radius: 0; padding: 0.2rem 0.75rem;
}
.lb-counter:empty { display: none; }
.hint { color: var(--muted); font-size: 0.8rem; margin: 0.6rem 0 0; }
.empty { color: var(--muted); font-style: italic; }
.loc-table { margin: 0; }
.loc-table > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-top: 1px solid #EFEDE9; }
.loc-table > div:first-child { border-top: 0; }
.loc-table dt { color: var(--muted); }
.loc-table dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.plan { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid #EFEDE9; font-size: 0.9rem; }
.plan a { color: var(--ink); }
.hist-list { list-style: none; margin: 0; padding: 0; font-variant-numeric: tabular-nums; }
.hist-list li { padding: 0.25rem 0; }
.epitaph { font-family: var(--serif); font-style: italic; color: #4A4A4A; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
