/* ============================================================
   Our Brick Walls — Main Stylesheet
   Clean, modern, readable. Built on the existing sidebar layout.
   ============================================================ */

/* ---- Tokens ---- */
:root {
  --green-dark:    #1e5c3a;
  --green-mid:     #2C6D51;
  --green-light:   #3d8a68;
  --green-tint:    #e8f5ee;
  --cream:         #faf9f7;
  --border:        #e0ddd8;
  --text:          #1a1a1a;
  --text-muted:    #4a4a4a;
  --text-light:    #767676;
  --nav-width:     240px;
  --header-height: 64px;
  --radius:        6px;
  --font-body:     "Inter", "Segoe UI", system-ui, sans-serif;
  --font-serif:    "Georgia", "Times New Roman", serif;
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  background: var(--green-dark);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  text-decoration: none;
  font-weight: 600;
  transition: top 0.1s;
}

.skip-link:focus {
  top: 0.5rem;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }

/* Prevent white flash on page load — match body background */
html { background: #faf9f7; }

/* ---- Body ---- */
body {
  background: var(--cream);
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  padding-left: var(--nav-width);
  padding-top: var(--header-height);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Header — fixed full width across top ---- */
#site-header {
  background: var(--green-mid);
  color: #fff;
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

#site-header h1,
#site-header h2,
#site-header p {
  margin: 0;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}



/* ---- Sidebar nav — fixed left ---- */
.menu {
  background: var(--green-mid);
  width: var(--nav-width);
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  z-index: 20;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.menu::-webkit-scrollbar { width: 4px; }
.menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

/* Nav list */
.menu ul {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0 2rem;
}

.menu ul li {
  margin: 0;
}

.menu ul li span,
.menu ul li a {
  display: block;
  padding: 0.45rem 1rem 0.45rem 1.25rem;
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.4;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
}

.menu ul li a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.menu ul li.active > span,
.menu ul li.active > a {
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-weight: 600;
  border-left: 3px solid rgba(255,255,255,0.6);
  padding-left: calc(1.25rem - 3px);
}

/* Section dividers in nav */
.menu ul li.nav-section {
  padding: 1.1rem 1.25rem 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  cursor: default;
  pointer-events: none;
}

.menu ul li.nav-section:hover {
  background: none;
}

/* ---- Footer — full width, bottom of page ---- */
#site-footer {
  background: var(--green-mid);
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
  text-align: center;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-left: calc(-1 * var(--nav-width));
  padding-left: calc(var(--nav-width) + 1.5rem);
}

#site-footer a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
}

#site-footer a:hover { color: #fff; }

/* ---- Main content area ---- */


main {
  max-width: 900px;
  padding: 2rem 2rem 3rem;
  color: var(--text);
  flex: 1;
}

/* ---- Typography ---- */
h1 { font-size: 1.6rem; font-weight: 600; margin: 0 0 1rem; color: var(--green-dark); line-height: 1.3; }
h2 { font-size: 1.25rem; font-weight: 600; margin: 1.5rem 0 0.5rem; color: var(--green-dark); }
h3 { font-size: 1.05rem; font-weight: 600; margin: 1.2rem 0 0.4rem; }
p  { margin: 0 0 1rem; }

a { color: var(--green-mid); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible {
  outline: 2px solid var(--green-mid);
  outline-offset: 2px;
  border-radius: 2px;
}
button:focus-visible {
  outline: 2px solid var(--green-mid);
  outline-offset: 2px;
}
.menu ul li a:focus-visible {
  outline: 2px solid rgba(255,255,255,0.8);
  outline-offset: -2px;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ---- Page title bar ---- */
.page-title {
  border-bottom: 2px solid var(--green-tint);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

.page-title h1 { margin: 0; }

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* ---- Cards ---- */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

/* ---- Obituaries ---- */
article {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0 0.75rem;
}

article:last-child { border-bottom: none; }

/* Offset anchor scroll within scrollable content area */
article,
.letter-group,
/* Offset anchor scroll to clear the fixed header */
main,
article,
.letter-group,
.decade-group { scroll-margin-top: calc(var(--header-height) + 1rem); }

.obituary h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
  color: var(--text);
  font-family: var(--font-body);
}

.obituary p {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  line-height: 1.65;
}

.source,
.contributor,
.posted {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
}

.source:first-of-type {
  margin-top: 0.6rem;
}

.source      { font-style: italic; }
.contributor { }
.posted      { color: var(--text-light); font-size: 0.75rem; }

.obit-duplicates {
  padding: 0.5rem 0.75rem;
  background: var(--green-tint);
  border-left: 3px solid var(--green-mid);
  border-radius: 0;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.obit-note {
  margin-top: 0.5rem;
  padding: 0.35rem 0.7rem;
  background: #fff8e1;
  border-left: 3px solid #e6a817;
  border-radius: 0;
  font-size: 0.8rem;
  color: #7a5a00;
  font-style: normal;
}

/* WikiTree link */
.wikitree-link,
.findagrave-link,
.newspapers-link {
  font-size: 0.8em;
  margin-left: 0.35rem;
  text-decoration: none;
  opacity: 0.75;
}
.wikitree-link:hover,
.findagrave-link:hover,
.newspapers-link:hover { opacity: 1; }

/* Obit controls bar (search + notes filter) */
.obit-controls {
  margin-bottom: 1.25rem;
}

#obit-search {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  width: 220px;
  background: #fff;
  color: var(--text);
}

#obit-search:focus {
  outline: 2px solid var(--green-mid);
  outline-offset: 1px;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(44,109,81,0.25);
}

.obit-controls-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.obit-controls-row--spaced {
  justify-content: space-between;
}

/* Toggle switch — A-Z / Decade */
.obit-toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.obit-toggle-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.obit-toggle-track {
  position: relative;
  display: inline-block;
  width: 2.6rem;
  height: 1.4rem;
}

.obit-toggle-track input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.obit-toggle-thumb {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 1rem;
  transition: background 0.2s;
}

.obit-toggle-thumb::after {
  content: "";
  position: absolute;
  width: 1rem;
  height: 1rem;
  left: 0.2rem;
  top: 0.2rem;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.obit-toggle-track input:checked + .obit-toggle-thumb {
  background: var(--green-mid);
}

.obit-toggle-track input:checked + .obit-toggle-thumb::after {
  transform: translateX(1.2rem);
}

.obit-toggle-track input:focus-visible + .obit-toggle-thumb {
  box-shadow: 0 0 0 2px rgba(44,109,81,0.3);
}

/* Active label highlight */
.obit-toggle-switch:has(input:not(:checked)) .obit-toggle-label:first-of-type,
.obit-toggle-switch:has(input:checked) .obit-toggle-label:last-of-type {
  color: var(--green-dark);
  font-weight: 600;
}

.obit-year-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.obit-year-filter label {
  white-space: nowrap;
}

.obit-year-filter input[type="number"] {
  width: 4.5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: #fff;
  color: var(--text);
}

.obit-year-filter input[type="number"]:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: var(--border);
}

.obit-year-filter input[type="number"]:focus {
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 2px rgba(44,109,81,0.15);
}

.obit-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.obit-filter-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--green-mid);
  cursor: pointer;
}

.obit-filter-check:has(input:checked) {
  color: var(--green-dark);
  font-weight: 600;
}

#obit-notes-filter {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
}

#obit-notes-filter:hover { border-color: var(--green-mid); color: var(--text); }

#obit-notes-filter.active {
  background: #fff3cd;
  border-color: #e6a817;
  color: #7a5a00;
}

/* ---- Obit letter page heading ---- */
#obit-list h1 {
  border-bottom: 2px solid var(--green-tint);
  padding-bottom: 0.5rem;
  margin-bottom: 0;
}

/* ---- New obits list ---- */
.new-obits-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

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

.new-obits-list li:last-child { border-bottom: none; }

.show-more-btn {
  display: block;
  margin: 1.5rem auto;
  padding: 0.5rem 1.75rem;
  background: #fff;
  border: 1px solid var(--green-mid);
  border-radius: var(--radius);
  color: var(--green-mid);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.12s;
}

.show-more-btn:hover {
  background: var(--green-tint);
}

/* ---- Obituary index ---- */
.letter-group { margin-bottom: 2rem; }

.decade-group {
  margin-bottom: 2.5rem;
}

.decade-group h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--green-dark);
  margin: 0 0 0.75rem;
  padding-bottom: 0;
  border-bottom: none;
}

.obit-year-count {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.letter-group h2 {
  font-size: 1.3rem;
  color: var(--green-dark);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
  margin-bottom: 0.75rem;
}

.letter-group h2 a {
  color: inherit;
  text-decoration: none;
}

.letter-group h2 a:hover { text-decoration: underline; }

.name-list {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2;
  column-gap: 1.5rem;
}

@media (min-width: 600px) { .name-list { columns: 3; } }
@media (min-width: 800px) { .name-list { columns: 4; } }

.name-list li {
  padding: 0.15rem 0;
  break-inside: avoid;
  font-size: 0.875rem;
}

.name-list a { color: var(--text); }
.name-list a:hover { color: var(--green-mid); text-decoration: none; }

.obit-maiden { font-style: italic; color: var(--text-muted); font-size: 0.85em; }

/* Letter jump nav */
#letter-nav {
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

#letter-nav a {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--green-dark);
  text-decoration: none;
  transition: all 0.1s;
}

#letter-nav a:hover {
  background: var(--green-tint);
  border-color: var(--green-mid);
}

/* Search on index page */
#obit-search-wrapper,
.obit-search-wrapper {
  margin-bottom: 1.25rem;
}

/* ---- Images & figures ---- */
figure {
  margin: 1rem 0;
  text-align: center;
}

figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

figcaption {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-style: italic;
}

/* ---- Details / Summary disclosure ---- */
details {
  margin-bottom: 1.5rem;
  border-left: 3px solid var(--green-tint);
  padding-left: 1rem;
}

summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--green-dark);
  padding: 0.4rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

/* Replace default triangle with a custom arrow */
summary::before {
  content: "▶";
  font-size: 0.65rem;
  color: var(--green-mid);
  transition: transform 0.15s;
  flex-shrink: 0;
}

details[open] > summary::before {
  transform: rotate(90deg);
}

/* Hide the default marker in all browsers */
summary::-webkit-details-marker { display: none; }

summary:focus-visible {
  outline: 2px solid var(--green-mid);
  outline-offset: 2px;
  border-radius: 2px;
}

details[open] > summary {
  margin-bottom: 0.75rem;
}

details p {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

details p:last-child {
  margin-bottom: 0;
}

/* ---- Screen reader only (visually hidden but accessible) ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---- Special collections list ---- */
.special-collections {
  list-style: none;
  padding: 0;
  margin: 0;
}

.special-collections li {
  padding: 0.3rem 0;
}

.special-collections a {
  font-weight: 600;
}

.collection-note {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* ---- Filter fieldset ---- */
.obit-filter-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1rem;
}

.obit-filter-legend {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  padding: 0;
}

/* ---- People index ---- */
.people-entries {
  list-style: none;
  padding: 0;
  margin: 0;
}

.people-entry {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.6;
}

.people-entry:last-child { border-bottom: none; }

.people-name {
  font-weight: 600;
  color: var(--text);
}

.people-location {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.people-page-link {
  color: var(--green-mid);
  font-size: 0.85rem;
}

.people-page-link:hover { text-decoration: underline; }

.people-dir {
  font-size: 0.75rem;
  color: var(--text-light);
  background: var(--green-tint);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.25rem;
}

.people-photo-badge {
  font-size: 0.8em;
  margin-left: 0.3rem;
  opacity: 0.7;
}

/* ---- Utility ---- */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.strike      { text-decoration: line-through; }

.helper {
  background: rgba(0,0,0,0.15);
  color: var(--text);
  padding: 1.2em 2em;
  text-align: center;
  border-radius: 12px;
  font-size: 1.5em;
  font-weight: 600;
}

.helper span {
  font-size: 0.4em;
  color: var(--text-muted);
  display: block;
}

/* ---- Obituary list page index links ---- */
.obituarylist p {
  text-align: center;
}

.obituarylist p a {
  padding-right: 10px;
  font-weight: 600;
}

/* ---- Tables (vitals entries) ---- */
.obit-vitals,
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

.obit-vitals th,
.obit-vitals td,
table th,
table td {
  text-align: left;
  padding: 0.3rem 0.5rem 0.3rem 0;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.obit-vitals th,
table th {
  font-weight: 600;
  width: 10rem;
  color: var(--text-muted);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  :root { --nav-width: 90px; }

  .menu ul li span,
  .menu ul li a {
    padding: 0.6rem 0;
    font-size: 0.7rem;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  main { padding: 1.5rem 1.25rem 2.5rem; }
}

@media (max-width: 480px) {
  :root { --nav-width: 0px; }

  .menu {
    position: absolute;
    top: var(--header-height);
    left: 0;
    bottom: var(--footer-height, 36px);
    transform: translateX(-240px);
    width: 240px;
    transition: transform 0.25s ease;
    z-index: 100;
  }

  .menu:focus-within {
    transform: translateX(0);
  }

  .smartphone-menu-trigger {
    position: fixed;
    top: calc((var(--header-height) - 40px) / 2);
    left: 0.75rem;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
  }

  .smartphone-menu-trigger::before,
  .smartphone-menu-trigger::after {
    content: '';
    display: block;
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
  }

  /* Add a middle bar via box-shadow */
  .smartphone-menu-trigger::before {
    box-shadow: 0 5px 0 #fff;
  }

  main { padding: 1rem 1rem 2rem; }

  /* Push header content right of the menu trigger */
  #site-header {
    padding-left: calc(0.75rem + 40px + 0.75rem);
  }

  /* Hide tagline on mobile — not enough room */
  #site-header > span {
    display: none;
  }
}
