:root {
  --bg: #f4efe5;
  --bg-soft: #fbf7f0;
  --ink: #1f2a2c;
  --muted: #5f6d70;
  --line: rgba(31, 42, 44, 0.12);
  --accent: #a84f2d;
  --accent-dark: #7f3519;
  --panel: rgba(255, 252, 246, 0.78);
  --shadow: 0 24px 60px rgba(78, 53, 36, 0.12);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(168, 79, 45, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(91, 126, 111, 0.18), transparent 26%),
    linear-gradient(180deg, #f9f4ea 0%, #f4efe5 42%, #efe8db 100%);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

h1, h2, h3, .navbar-brand, .footer-title {
  font-family: Georgia, "Times New Roman", serif;
}

a {
  color: inherit;
}

.site-header {
    padding: 1.2rem 0 0;
    width: 99% ;
    margin-left: auto;
    margin-right: auto;
}

.navbar {
  padding: 0.85rem 0;
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: rgba(255, 250, 243, 0.82);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.brand-kicker {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-name {
  font-size: 1.6rem;
  line-height: 1.1;
}

.nav-link {
  color: var(--ink) !important;
  font-weight: 600;
}

.nav-button {
  border: 0;
  background: transparent;
}

.text-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.text-link:hover {
  color: var(--ink);
}

.page-shell {
  padding: 2rem 0 4rem;
}

.hero-shell {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 1.5rem;
  align-items: stretch;
  margin-bottom: 2rem;
}

.home-hero-shell {
  align-items: start;
}

.home-showcase-panel {
  display: grid;
  gap: 1rem;
}

.home-showcase-link {
  display: block;
  text-decoration: none;
}

.home-showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.home-shot {
  margin: 0;
  overflow: hidden;
  border-radius: 1.1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 16px 36px rgba(78, 53, 36, 0.12);
}

.home-shot-large {
  grid-column: span 3;
}

.home-shot img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 140px;
  object-fit: cover;
}

.home-shot-large img {
  min-height: 250px;
}

.hero-copy,
.hero-panel,
.feature-card,
.roadmap {
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 2.4rem;
}

.hero-copy h1 {
  /* Allow the heading to expand across the hero area on larger screens */
  max-width: 60ch;
  margin: 0;
  font-size: clamp(2.8rem, 6vw, 5rem);
  line-height: 0.94;
}

.hero-copy h1 span {
  color: var(--accent-dark);
}

/* Make hero section carousel images smaller at large sizes (half of available column width) */
@media (min-width: 768px) {
  .search-hero .carousel .hero-lazy-img,
  .search-hero .carousel .d-block.img-fluid {
    width: 60%;
    height: auto;
    display: inline-block;
    margin-left: auto; /* keep images right aligned in the column */
    margin-right: 0;
  }
}

/* Side image used in ChurchBMD hero — compact and right-aligned on md+ */
@media (min-width: 768px) {
  .hero-side-image {
    max-width: 400px; /* larger image */
    width: 100%;
    height: auto;
    display: block;
    margin-left: auto; /* align to the right side of the column */
    object-fit: cover;
    border: none; /* remove frame */
    background: transparent; /* remove white background */
    padding: 0; /* remove inner padding */
    border-radius: 1rem; /* stronger rounding */
    box-shadow: 0 12px 28px rgba(78, 53, 36, 0.06);
  }

  /* ensure the image itself honors the rounded corners */
  .hero-side-image {
    -webkit-border-radius: 1rem;
    -moz-border-radius: 1rem;
    border-radius: 1rem;
  }
}

.lead {
  max-width: 68ch;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 1.08rem;
}

/* Allow hero copy to use more horizontal space so sentences don't wrap too early */
.search-hero .lead {
  max-width: 80ch;
}

.eyebrow,
.feature-kicker,
.panel-title {
  margin-bottom: 0.9rem;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.5rem;
}

.btn-accent,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.58rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.94rem;
  line-height: 1.2;
  text-decoration: none;
}

.btn-sm.btn-accent,
.btn-sm.btn-ghost,
.btn.btn-sm {
  min-height: 34px;
  padding: 0.38rem 0.8rem;
  font-size: 0.84rem;
}

.btn-accent {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #c96b42 100%);
}

.btn-accent:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 100%);
}

.btn-ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.hero-panel {
  padding: 2rem 1.6rem;
}

.panel-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.panel-list li + li {
  margin-top: 0.8rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.feature-card {
  padding: 1.5rem;
}

.feature-card h2 {
  margin-bottom: 0.85rem;
  font-size: 1.6rem;
}

.feature-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.roadmap {
  padding: 1.7rem;
}

.roadmap-list {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
}

.roadmap-list li + li {
  margin-top: 0.7rem;
}

.search-hero {
  margin-bottom: 1.5rem;
  padding: 2rem 2.25rem;
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.private-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.private-hero-copy,
.private-hero-panel,
.private-metric-card {
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.private-hero-copy,
.private-hero-panel {
  padding: 1.8rem;
}

.private-metric-grid,
.private-workspace-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.private-metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.private-workspace-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.private-insight-grid {
  margin-bottom: 1.5rem;
}

.private-insight-list {
  display: grid;
  gap: 0.8rem;
}

.private-insight-item {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.58);
}

.private-insight-item strong,
.private-insight-item .text-link {
  line-height: 1.3;
}

.private-log-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin-top: 0.9rem;
}

.register-section-pager {
  margin-top: 1rem;
}

.register-section-pager .btn,
.register-section-pager .btn-ghost,
.register-section-pager .btn-accent {
  min-height: 34px;
  padding: 0.38rem 0.75rem;
  font-size: 0.82rem;
  white-space: nowrap;
}

.register-section-pager .muted-copy {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
}

.admin-filter-card {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-filter-form {
  display: grid;
  gap: 1rem;
}

.admin-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.9rem;
}

.admin-filter-form .form-group {
  display: grid;
  gap: 0.35rem;
}

.admin-filter-form label {
  font-weight: 700;
}

.private-metric-card {
  padding: 1.35rem 1.4rem;
}

.private-metric-card h2 {
  margin: 0 0 0.35rem;
  font-size: clamp(2rem, 3vw, 2.6rem);
}

.private-metric-card p:last-child,
.private-workspace-card p:last-of-type {
  margin-bottom: 0;
  color: var(--muted);
}

.private-workspace-card {
  display: grid;
  align-content: start;
  gap: 0.35rem;
}

.search-shell {
  display: grid;
  gap: 1.5rem;
}

.search-form {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.search-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
}

.search-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.search-stat {
  margin: 0;
  color: var(--muted);
}

.parish-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.parish-pill,
.register-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(168, 79, 45, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 700;
}

.parish-link {
  text-decoration: none;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.parish-link:hover {
  color: var(--ink);
  background: rgba(255, 248, 239, 0.96);
  transform: translateY(-1px);
}

.parish-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.parish-summary-card {
  text-align: center;
}

.parish-summary-card h2 {
  margin-bottom: 0.35rem;
}

.parish-summary-years {
  margin: 0;
  color: var(--accent-dark);
  font-size: 1.35rem;
  font-weight: 700;
}

.login-callout {
  display: grid;
  gap: 0.8rem;
}

.results-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.results-header h2 {
  margin-bottom: 0.25rem;
}

.results-header p {
  margin: 0;
  color: var(--muted);
}

.tegneby-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.tegneby-navigation {
  display: grid;
  gap: 0.9rem;
}

.tegneby-garden-list {
  gap: 0.7rem;
}

.tegneby-garden-link {
  gap: 0.55rem;
  text-decoration: none;
}

.tegneby-garden-link-active {
  border-color: rgba(168, 79, 45, 0.34);
  background: rgba(255, 244, 236, 0.96);
  box-shadow: 0 8px 20px rgba(168, 79, 45, 0.12);
}

.tegneby-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  min-height: 1.45rem;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: rgba(168, 79, 45, 0.12);
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 700;
}

.result-table-wrap {
  overflow-x: auto;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  background: var(--panel);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

.result-table {
  margin: 0;
  vertical-align: middle;
}

.result-table thead th {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-table td,
.result-table th {
  padding: 0.8rem 0.75rem;
  background: transparent;
  vertical-align: top;
  line-height: 1.35;
}

.table-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 0.28rem 0.55rem;
  border: 1px solid rgba(168, 79, 45, 0.2);
  border-radius: 999px;
  color: var(--accent-dark);
  background: rgba(255, 248, 239, 0.9);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.name-cell {
  font-weight: 700;
}

.tegneby-garden-cell,
.tegneby-name-stack {
  display: grid;
  gap: 0.35rem;
}

.tegneby-table-copy {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.tegneby-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tegneby-row-actions .table-badge {
  text-decoration: none;
}

.register-name-stack {
  display: grid;
  gap: 0.22rem;
}

.register-related-person {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(31, 42, 44, 0.14);
}

.register-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.register-row-actions .table-badge {
  text-decoration: none;
}

.table-date,
.table-short {
  display: inline-block;
  white-space: nowrap;
}

.table-date {
  min-width: 5.5rem;
}

.result-table .muted-copy {
  line-height: 1.25;
  font-size: 0.84rem;
}

.church-col-name,
.church-col-parent,
.church-col-place,
.church-col-note,
.church-col-cause,
.church-col-compact {
  overflow-wrap: anywhere;
}

.church-note-preview {
  color: var(--ink);
  line-height: 1.35;
}

.mobile-short-label {
  display: none;
}

.church-note-preview-truncated {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.note-more-button {
  margin-top: 0.45rem;
  text-decoration: none;
}

@media (min-width: 992px) {
  .church-table {
    table-layout: fixed;
    width: 100%;
  }

  .church-table-births th:nth-child(1),
  .church-table-births th:nth-child(2),
  .church-table-births td:nth-child(1),
  .church-table-births td:nth-child(2) {
    width: 5.7rem;
  }

  .church-table-births .church-col-name {
    width: 11rem;
  }

  .church-table-births .church-col-place {
    width: 6.4rem;
  }

  .church-table-births .church-col-parent {
    width: 13.5rem;
  }

  .church-table-marriages th:nth-child(1),
  .church-table-marriages td:nth-child(1) {
    width: 6rem;
  }

  .church-table-marriages .church-col-name {
    width: 11rem;
  }

  .church-table-marriages .church-col-place {
    width: 7rem;
  }

  .church-table-marriages .church-col-compact {
    width: 6.4rem;
  }

  .church-table-ockero-marriages th:nth-child(1),
  .church-table-ockero-marriages td:nth-child(1) {
    width: 4.4rem;
  }

  .church-table-ockero-marriages th:nth-child(2),
  .church-table-ockero-marriages td:nth-child(2),
  .church-table-ockero-marriages th:nth-child(5),
  .church-table-ockero-marriages td:nth-child(5),
  .church-table-ockero-marriages th:nth-child(6),
  .church-table-ockero-marriages td:nth-child(6) {
    width: 6rem;
  }

  .church-table-ockero-marriages .church-col-name {
    width: 12rem;
  }

  .church-table-ockero-marriages .church-col-place {
    width: 7rem;
  }

  .church-table-ockero-marriages .church-col-compact {
    width: 6rem;
  }

  .church-table-deaths th:nth-child(1),
  .church-table-deaths td:nth-child(1),
  .church-table-deaths th:nth-child(2),
  .church-table-deaths td:nth-child(2) {
    width: 6rem;
  }

  .church-table-deaths .church-col-name {
    width: 12rem;
  }

  .church-table-deaths .church-col-place {
    width: 7rem;
  }

  .church-table-deaths .church-col-compact {
    width: 5.8rem;
  }

  .church-col-note,
  .church-col-cause {
    min-width: 14rem;
  }
}

.table-subline {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.table-badge.active {
  border-color: rgba(91, 126, 111, 0.26);
  background: rgba(225, 241, 233, 0.9);
  color: #225a40;
}

.table-badge.inactive {
  border-color: rgba(31, 42, 44, 0.16);
  background: rgba(236, 238, 238, 0.95);
  color: #485659;
}

.table-badge.pending {
  border-color: rgba(168, 79, 45, 0.2);
  background: rgba(255, 248, 239, 0.9);
  color: var(--accent-dark);
}

.table-badge.neutral {
  border-color: rgba(31, 42, 44, 0.12);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.grave-carousel {
  position: relative;
  margin-top: 0.35rem;
}

.grave-carousel-frame {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background:
    radial-gradient(circle at top, rgba(168, 79, 45, 0.12), transparent 40%),
    rgba(255, 248, 239, 0.8);
}

.grave-carousel-link {
  display: block;
  padding: 0.7rem;
  text-decoration: none;
}

.grave-carousel-image {
  display: block;
  width: 100%;
  max-height: 42vh;
  object-fit: contain;
  border-radius: 0.9rem;
  background: transparent;
}

.grave-carousel-caption {
  display: flex;
  justify-content: center;
  padding: 0 0.8rem 0.55rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.grave-gallery-modal-content {
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  background: rgba(255, 252, 246, 0.97);
  box-shadow: 0 28px 80px rgba(31, 42, 44, 0.22);
}

.grave-gallery-modal-header {
  align-items: start;
  padding: 1rem 1rem 0.35rem;
  border-bottom: 0;
}

.grave-gallery-modal-header .feature-kicker {
  margin-bottom: 0.35rem;
}

.grave-gallery-modal-header h2 {
  margin: 0;
  font-size: 1.45rem;
}

.grave-gallery-modal-body {
  padding: 0 1rem 1rem;
}

.grave-carousel-control {
  width: 3.2rem;
}

.grave-carousel-control .carousel-control-prev-icon,
.grave-carousel-control .carousel-control-next-icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  background-color: rgba(31, 42, 44, 0.55);
  background-size: 55%;
}

.grave-carousel-indicators {
  position: static;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(52px, 64px));
  justify-content: start;
  gap: 0.45rem;
  margin: 0.7rem 0 0;
}

.grave-carousel-indicators [data-bs-target] {
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  overflow: hidden;
  text-indent: 0;
  border: 2px solid transparent;
  border-radius: 0.7rem;
  background: transparent;
  opacity: 1;
}

.grave-carousel-indicators [data-bs-target].active {
  border-color: rgba(168, 79, 45, 0.65);
  box-shadow: 0 0 0 3px rgba(168, 79, 45, 0.12);
}

.grave-carousel-indicators img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: transparent;
}

.empty-state {
  text-align: center;
}

.register-section {
  display: grid;
  gap: 0.8rem;
}

.register-section-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}

.register-section-header h2 {
  margin: 0;
}

.account-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.85fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.account-editor-card,
.account-admin-sidecard {
  display: grid;
  gap: 1rem;
}

.account-editor-intro {
  margin: 0;
  color: var(--muted);
}

.account-editor-form {
  display: grid;
  gap: 1rem;
}

.account-editor-fields,
.account-editor-passwords {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.account-editor-form .form-group {
  display: grid;
  gap: 0.35rem;
}

.account-editor-form label {
  font-weight: 700;
}

.account-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-weight: 600;
}

.account-toggle input {
  width: 1rem;
  height: 1rem;
}

.person-hero {
  margin-bottom: 1.5rem;
  padding: 2rem 2.25rem;
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  grid-template-areas:
    "portrait copy badges"
    "portrait copy .";
  gap: 1.5rem;
  align-items: start;
}

.person-subtitle {
  margin: 0.08rem 0 0;
  color: var(--muted);
  font-size: 1.00rem;
}

.person-hero-topline {
  display: block;
  margin-bottom: 0.75rem;
}

.person-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.person-hero-badges {
  grid-area: badges;
  justify-self: end;
  align-self: start;
}

.person-portrait {
  grid-area: portrait;
}

.person-hero-copy {
  grid-area: copy;
}

.person-portrait img {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1.15;
  object-fit: cover;
  border-radius: 1.25rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.person-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.5fr);
  gap: 1.2rem;
}

.person-facts,
.relation-list,
.family-stack,
.children-list {
  display: grid;
  gap: 0.85rem;
}

.person-facts-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
}

.fact-item-wide {
  grid-column: 1 / -1;
}

.person-note-actions,
.family-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.contact-card {
  padding: 1.6rem;
}

.contact-hero-image {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  object-fit: contain !important;
}

.contact-form {
  display: grid;
  gap: 1rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.contact-body {
  display: grid;
  gap: 0.4rem;
}

.contact-textarea {
  min-height: 14rem;
  resize: vertical;
}

.contact-status {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  font-weight: 600;
}

.contact-status.success {
  border: 1px solid rgba(91, 126, 111, 0.28);
  background: rgba(225, 241, 233, 0.9);
  color: #225a40;
}

.contact-status.error {
  border: 1px solid rgba(168, 79, 45, 0.22);
  background: rgba(255, 242, 236, 0.95);
  color: var(--accent-dark);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
  gap: 1.2rem;
  align-items: start;
}

.login-intro,
.login-panel {
  padding: 1.8rem;
}

.login-intro h1,
.login-panel h2 {
  margin-top: 0;
}

.login-benefits {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.4rem;
}

.login-form {
  display: grid;
  gap: 1rem;
}

.login-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.fact-item,
.relation-item {
  display: grid;
  gap: 0.2rem;
}

.fact-label {
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.family-group {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.55);
}

.family-group h3 {
  margin: 0;
  font-size: 1.35rem;
}

.family-group-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 0.7rem;
}

.family-meta {
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
  text-align: right;
}

.note-modal {
  border: 1px solid var(--line);
  border-radius: 1.3rem;
  background: var(--bg-soft);
}

.note-modal .modal-header {
  border-bottom: 1px solid var(--line);
}

.note-modal .modal-body {
  display: grid;
  gap: 1rem;
}

.note-group-stack {
  display: grid;
  gap: 1rem;
}

.note-group {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.68);
}

.note-modal-title {
  margin: 0;
  font-weight: 700;
}

.note-modal-meta {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.note-modal-text {
  color: var(--ink);
  line-height: 1.55;
}

.note-modal-text-pre {
  white-space: pre-line;
}

.child-card {
  display: grid;
  gap: 0.15rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  text-decoration: none;
  background: rgba(255, 248, 239, 0.72);
}

.child-card strong {
  color: var(--ink);
}

.child-card span,
.muted-copy {
  color: var(--muted);
}

.media-panel {
  margin-top: 1.2rem;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 180px));
  gap: 1rem;
  justify-content: start;
}

.media-card {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  text-decoration: none;
  background: rgba(255, 248, 239, 0.72);
}

.media-card-button {
  width: 180px;
  border: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
}

.media-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.82);
}

.media-modal .modal-body {
  padding: 1rem;
}

.media-modal-image {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  margin: 0 auto;
  border-radius: 1rem;
}

.media-copy {
  display: grid;
  gap: 0.2rem;
}

.media-copy span,
.document-link span {
  color: var(--muted);
}

.media-badge {
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.document-list {
  display: grid;
  gap: 0.8rem;
}

.document-link {
  display: grid;
  gap: 0.15rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.55);
}

.tree-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.ancestor-shell {
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.ancestor-scroll {
  overflow-x: auto;
  padding: 0.75rem;
}

.ancestor-canvas {
  position: relative;
}

.ancestor-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.ancestor-lines line {
  stroke: rgba(31, 42, 44, 0.45);
  stroke-width: 2;
  stroke-linecap: round;
}

.generation-label {
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.generation-label-floating {
  position: absolute;
  text-align: center;
}

.ancestor-card {
  position: absolute;
  min-width: 0;
  z-index: 1;
}

.ancestor-card-inner {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 0.28rem;
  align-items: center;
  height: 100%;
  padding: 0.16rem 0.24rem;
  border: 1px solid rgba(31, 42, 44, 0.1);
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 6px 14px rgba(31, 42, 44, 0.12);
  overflow: hidden;
}

.ancestor-card-male .ancestor-card-inner {
  background: linear-gradient(180deg, rgba(229, 239, 251, 0.95), rgba(214, 231, 248, 0.92));
}

.ancestor-card-female .ancestor-card-inner {
  background: linear-gradient(180deg, rgba(251, 235, 241, 0.95), rgba(247, 220, 230, 0.92));
}

.ancestor-card-unknown .ancestor-card-inner {
  background: linear-gradient(180deg, rgba(243, 243, 243, 0.95), rgba(231, 231, 231, 0.92));
}

.ancestor-card-placeholder .ancestor-card-inner {
  color: var(--muted);
  background: linear-gradient(180deg, rgba(242, 242, 242, 0.95), rgba(232, 232, 232, 0.92));
}

.ancestor-card-root .ancestor-card-inner {
  border-color: rgba(168, 79, 45, 0.28);
  box-shadow: 0 8px 18px rgba(168, 79, 45, 0.18);
}

.ancestor-avatar {
  width: 30px;
  height: 30px;
  margin: 0;
  overflow: hidden;
  border-radius: 0.18rem;
  border: 0;
  background: transparent;
  flex-shrink: 0;
}

.ancestor-avatar-photo {
  width: 28px;
  height: 32px;
  border-radius: 0.22rem;
}

.ancestor-avatar-icon {
  width: 34px;
  height: 34px;
}

.ancestor-avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: center center;
}

.ancestor-avatar-image-photo {
  object-fit: cover;
  object-position: center top;
  transform: scale(1.08);
}

.ancestor-avatar-image-icon {
  object-fit: contain;
  object-position: center center;
  transform: scale(1.04);
}

.ancestor-copy {
  min-width: 0;
  display: grid;
  gap: 0.02rem;
}

.ancestor-name {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.63rem;
  font-weight: 700;
  line-height: 0.96;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ancestor-name:hover {
  color: var(--accent-dark);
}

.ancestor-placeholder-text {
  display: inline-block;
  width: 100%;
  min-height: 1.2rem;
}

.ancestor-meta {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.5rem;
  line-height: 0.9;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ancestor-expand-link {
  position: absolute;
  z-index: 2;
  width: 18px;
  height: 18px;
  color: #2d75b7;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 700;
  text-decoration: none;
}

.site-footer {
  padding: 0 0 2rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem 1.5rem;
  padding: 1.15rem 0 0;
  border-top: 1px solid var(--line);
}

.footer-title {
  margin-bottom: 0.25rem;
  font-size: 1.2rem;
}

.footer-block {
  min-width: 0;
}

.footer-copy,
.footer-meta {
  margin: 0;
  color: var(--muted);
}

.footer-meta {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 1rem;
  text-align: right;
}

.footer-copy,
.footer-meta span {
  overflow-wrap: anywhere;
}

.footer-block-meta span {
  display: inline-block;
  max-width: 100%;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus,
.nav-link:focus {
  box-shadow: 0 0 0 0.15rem rgba(168, 79, 45, 0.18), 0 0 0 0.3rem rgba(168, 79, 45, 0.3);
}

@media (max-width: 991.98px) {
  .hero-shell,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .private-hero,
  .private-metric-grid,
  .private-workspace-grid {
    grid-template-columns: 1fr;
  }

  .account-admin-grid,
  .account-editor-fields,
  .account-editor-passwords {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .hero-panel {
    padding: 1.6rem;
  }

  .home-showcase-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-shot-large {
    grid-column: span 2;
  }

  .hero-copy h1 {
    max-width: none;
  }

  .person-grid {
    grid-template-columns: 1fr;
  }

  .person-hero {
    padding: 1.4rem;
    grid-template-columns: 1fr;
    grid-template-areas:
      "portrait"
      "badges"
      "copy";
  }

  .person-badges {
    justify-content: flex-start;
  }

  .person-hero-badges {
    justify-self: start;
    margin-top: 0.15rem;
  }

  .person-facts-compact {
    grid-template-columns: 1fr;
  }

  .table-date,
  .table-short {
    white-space: normal;
    min-width: 0;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .search-hero,
  .search-form {
    padding: 1.4rem;
  }

  .parish-summary-grid {
    grid-template-columns: 1fr;
  }

  .search-input-row {
    grid-template-columns: 1fr;
  }

  .grave-gallery-modal-header,
  .grave-gallery-modal-body {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }

  .tree-header {
    flex-direction: column;
    align-items: start;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 0.6rem;
    text-align: center;
  }

  .footer-meta {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 575.98px) and (orientation: portrait) {
  .result-table-wrap {
    padding: 0.25rem;
  }

  .church-table {
    min-width: 760px;
  }

  .result-table {
    font-size: 0.9rem;
  }

  .result-table thead th {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
  }

  .result-table td,
  .result-table th {
    padding: 0.65rem 0.55rem;
  }

  .result-table .muted-copy,
  .table-subline {
    font-size: 0.76rem;
  }

  .table-badge {
    min-width: 48px;
    padding: 0.22rem 0.45rem;
    font-size: 0.69rem;
  }

  .register-row-actions {
    gap: 0.25rem;
  }

  .table-date {
    min-width: 5rem;
  }
}

@media (max-width: 767.98px) {
  .church-table .mobile-short-label {
    display: inline;
  }

  .church-table .mobile-full-label {
    display: none;
  }

  .church-table .church-col-parent,
  .church-table .church-col-place,
  .church-table .church-col-note,
  .church-table .church-col-cause {
    overflow-wrap: normal;
    word-break: keep-all;
  }

  .church-table .church-col-name,
  .church-table .name-cell {
    min-width: 8.5rem;
  }

  .church-table .church-col-name .text-link,
  .church-table .church-col-name > .register-name-stack > span,
  .church-table .church-col-name .register-related-person .text-link,
  .church-table .church-col-name .register-related-person > span {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .register-row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, max-content));
    align-items: start;
  }

  .register-row-actions .table-badge {
    min-width: 42px;
    min-height: 24px;
    padding: 0.14rem 0.34rem;
    font-size: 0.62rem;
    line-height: 1.1;
    letter-spacing: 0.02em;
  }
}

@media (max-width: 767.98px) and (orientation: landscape) {
  .result-table-wrap {
    padding: 0.25rem;
  }

  .church-table {
    min-width: 860px;
  }

  .church-table-births .church-col-name {
    width: 9rem;
  }

  .church-table-marriages .church-col-name,
  .church-table-ockero-marriages .church-col-name,
  .church-table-deaths .church-col-name {
    width: 9.5rem;
  }

  .result-table {
    font-size: 0.88rem;
  }

  .result-table thead th {
    font-size: 0.7rem;
    letter-spacing: 0.05em;
  }

  .result-table td,
  .result-table th {
    padding: 0.58rem 0.5rem;
  }

  .result-table .muted-copy,
  .table-subline {
    font-size: 0.74rem;
  }

  .table-badge {
    min-width: 46px;
    padding: 0.2rem 0.4rem;
    font-size: 0.67rem;
  }

  .table-date {
    min-width: 4.8rem;
  }
}

@media (max-width: 575.98px) and (orientation: portrait) {
  .church-table-births .church-col-name {
    width: 8.6rem;
  }

  .church-table-marriages .church-col-name,
  .church-table-ockero-marriages .church-col-name,
  .church-table-deaths .church-col-name {
    width: 9rem;
  }
}

@media (max-width: 991.98px) {
  .admin-filter-grid {
    grid-template-columns: 1fr;
  }

  .private-log-pager {
    display: grid;
    justify-items: stretch;
    text-align: center;
  }

  .register-section-pager {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    flex-wrap: nowrap;
  }

  .register-section-pager .btn,
  .register-section-pager .btn-ghost,
  .register-section-pager .btn-accent {
    min-height: 31px;
    padding: 0.3rem 0.58rem;
    font-size: 0.74rem;
    letter-spacing: 0;
  }

  .register-section-pager .muted-copy {
    font-size: 0.74rem;
    line-height: 1.2;
  }
}

/* Rounded corners for homepage showcase carousel */
.home-showcase-carousel {
  border-radius: 1.1rem;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(78,53,36,0.06);
}

.home-showcase-carousel .carousel-item img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.site-logo {
    height: 75px;
    width: auto;
    display: block;
}

.maintenance-modal {
  border: 0;
  border-radius: 1.35rem;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(62, 47, 35, 0.18);
}

.maintenance-modal-header {
  border-bottom: 1px solid rgba(188, 115, 64, 0.18);
  padding: 1rem 1.15rem;
}

.maintenance-modal-header .modal-title {
  color: var(--accent-strong);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.maintenance-modal-body {
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: 1.2rem 1.15rem 1.4rem;
  text-align: center;
}

.maintenance-modal-image {
  width: min(100%, 480px);
  height: auto;
  display: block;
}

.maintenance-modal-message {
  margin: 0;
  max-width: 28rem;
  color: var(--ink-strong);
  font-size: 1.45rem;
  line-height: 1.25;
  font-weight: 600;
}

@media (max-width: 575.98px) {
  .maintenance-modal-message {
    font-size: 1.1rem;
  }
}
