/* ===== Riverview Cemetery – City of Wilton, ND ===== */

@import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700;800&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap');

:root {
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  --bg: #eee5d7;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: #ffffff;
  --surface-tint: #f6f1e8;
  --surface-dark: #17313c;
  --surface-dark-2: #10262e;
  --text: #182127;
  --text-soft: #61707a;
  --text-inverse: rgba(255, 255, 255, 0.92);
  --accent: #8f3f32;
  --accent-strong: #733024;
  --accent-soft: rgba(159, 63, 49, 0.12);
  --border: rgba(33, 44, 42, 0.12);
  --border-strong: rgba(33, 44, 42, 0.22);
  --shadow-soft: 0 14px 36px rgba(34, 33, 29, 0.08);
  --shadow-strong: 0 24px 60px rgba(26, 24, 20, 0.16);

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-pill: 999px;

  --font-sans: 'Public Sans', 'Segoe UI', sans-serif;
  --font-serif: 'Fraunces', Georgia, serif;

  --max-width: 1240px;
  --max-width-narrow: 960px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(250, 247, 242, 0.82) 0%, rgba(236, 229, 218, 0.76) 100%),
    url("Images/TexturedBackground.jpg");
  background-size: auto, clamp(900px, 115vw, 1800px) auto;
  background-position: center, center;
  background-attachment: scroll;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.35);
}

::-webkit-scrollbar-thumb {
  background: rgba(20, 49, 58, 0.34);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(20, 49, 58, 0.52);
}

.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.03;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.anim-fade-up,
.anim-fade-in,
.anim-slide-left,
.anim-slide-right {
  transition-duration: 0.75s;
  transition-timing-function: ease;
}

.anim-fade-up {
  opacity: 0;
  transform: translateY(36px);
}

.anim-fade-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.anim-fade-in {
  opacity: 0;
}

.anim-fade-in.is-visible {
  opacity: 1;
}

.anim-slide-left {
  opacity: 0;
  transform: translateX(-48px);
}

.anim-slide-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.anim-slide-right {
  opacity: 0;
  transform: translateX(48px);
}

.anim-slide-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.anim-stagger > * {
  transition-delay: calc(var(--i, 0) * 0.08s);
}

.skip-link {
  position: fixed;
  top: -5rem;
  left: 1rem;
  z-index: 10001;
  padding: 0.75rem 1rem;
  color: #fff;
  background: var(--surface-dark);
  border-radius: var(--radius-sm);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
}

.skip-link:focus {
  top: 1rem;
  outline: 3px solid rgba(255, 255, 255, 0.85);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.14em;
}

a:hover {
  color: var(--accent-strong);
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.02em;
}

p {
  margin-top: 0;
}

.civic-bar {
  background: var(--surface-dark);
  color: var(--text-inverse);
}

.civic-bar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.6rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.77rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.civic-bar-text {
  color: rgba(255, 255, 255, 0.78);
}

.header {
  position: relative;
  border-bottom: 1px solid rgba(24, 33, 39, 0.08);
  background: rgba(255, 252, 247, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header--govuk {
  box-shadow: 0 6px 20px rgba(52, 42, 29, 0.05);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.site-logo {
  display: inline-flex;
  flex-direction: column;
  gap: 0.18rem;
  color: var(--text);
  text-decoration: none;
}

.site-logo-title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 2vw, 1.7rem);
  line-height: 1.1;
}

.site-logo-subtitle {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-logo:hover .site-logo-title {
  color: var(--accent-strong);
}

.header-menu-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  padding: 0.75rem 1rem;
  font: 700 0.9rem/1 var(--font-sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.header-menu-btn:hover {
  transform: translateY(-1px);
  background: var(--surface-strong);
  border-color: var(--border-strong);
}

.header-menu-btn:focus {
  outline: 3px solid rgba(159, 63, 49, 0.25);
  outline-offset: 2px;
}

.header-menu-btn .arrow {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform 0.2s ease;
}

.header-menu-btn[aria-expanded="true"] .arrow {
  transform: rotate(180deg);
}

.header-dropdown {
  border-top: 1px solid rgba(33, 44, 42, 0.08);
  border-bottom: 1px solid rgba(33, 44, 42, 0.10);
  background: rgba(255, 252, 247, 0.98);
}

.header-dropdown[hidden] {
  display: none !important;
}

.header-dropdown-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.header-dropdown-col {
  padding: 1.2rem 1.25rem;
  border: 1px solid rgba(33, 44, 42, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.65);
}

.header-dropdown-heading {
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.header-dropdown-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.header-dropdown-list li + li {
  margin-top: 0.45rem;
}

.header-dropdown-list a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.header-dropdown-list a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.hero-banner {
  position: relative;
  padding: 0;
}

.hero-banner-inner {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: clamp(210px, 34vh, 360px);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(26, 24, 20, 0.12);
  isolation: isolate;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 42%, rgba(0, 0, 0, 0.7) 62%, rgba(0, 0, 0, 0.2) 82%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 42%, rgba(0, 0, 0, 0.7) 62%, rgba(0, 0, 0, 0.2) 82%, transparent 100%);
}

.hero-banner-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(15, 29, 35, 0.7) 0%, rgba(15, 29, 35, 0.34) 48%, rgba(15, 29, 35, 0.16) 100%),
    linear-gradient(180deg, rgba(8, 14, 16, 0.02) 0%, rgba(8, 14, 16, 0.08) 50%, rgba(236, 229, 218, 0.2) 84%, rgba(236, 229, 218, 0) 100%);
  z-index: 1;
}

.hero-banner-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: clamp(210px, 34vh, 360px);
  object-fit: cover;
  object-position: center 62%;
  filter: saturate(0.8) contrast(0.96) brightness(0.82);
  cursor: zoom-in;
}

.hero-banner-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
}

.hero-banner-content {
  width: 100%;
  padding: clamp(0.9rem, 3vw, 1.75rem) clamp(1.25rem, 4vw, 2.5rem) clamp(1.25rem, 4vw, 2.25rem);
  display: block;
}

.hero-banner-text-group {
  max-width: 34rem;
}

.hero-eyebrow,
.section-kicker,
.panel-kicker {
  margin: 0 0 0.75rem;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-eyebrow {
  color: rgba(255, 255, 255, 0.8);
}

.page-title {
  margin-bottom: 0.55rem;
  font-size: clamp(2.15rem, 4.4vw, 3.5rem);
  line-height: 1.02;
}

.hero-title {
  color: #fff;
  max-width: 11ch;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.page-subtitle,
.lead,
.section-summary,
.map-panel-summary,
.results-count {
  color: var(--text-soft);
  line-height: 1.65;
}

.hero-subtitle {
  max-width: 28rem;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
}

.hero-info-card,
.search-shell,
.results-panel,
.panel-shell,
.map-container,
.detail-card,
.info-hero-card,
.gov-section--card,
.related-links--card {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
}

.hero-info-card {
  display: none;
}

.hero-info-title {
  margin-bottom: 0.8rem;
  font-size: 1.2rem;
  color: #fff;
}

.hero-info-list {
  margin: 0;
  padding-left: 1.1rem;
  color: rgba(255, 255, 255, 0.84);
}

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

.main {
  flex: 1;
  width: 100%;
}

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

.search-section {
  position: relative;
  margin-top: -22rem;
  margin-bottom: 1.25rem;
  z-index: 3;
}

.search-shell {
  border-radius: 1.5rem;
  padding: 1.25rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0.84) 18%, var(--surface) 100%);
}

.section-heading {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.section-kicker,
.panel-kicker {
  color: var(--accent);
}

.section-title {
  font-size: clamp(1.5rem, 2.5vw, 2.15rem);
  line-height: 1.1;
}

.section-title--panel {
  font-size: clamp(1.45rem, 2.2vw, 2rem);
}

.section-summary {
  margin-bottom: 0;
  max-width: 32rem;
  font-size: 0.96rem;
}

.search-box {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.admin-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.admin-tools-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.search-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(120px, 0.7fr) minmax(120px, 0.7fr) auto;
  gap: 1rem;
  align-items: end;
}

.field label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-label-invisible {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.field input,
.field select,
.results-sort select,
.edit-positions-controls select,
.edit-positions-quick-controls input[type="number"] {
  width: 100%;
  min-height: 3.35rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(33, 44, 42, 0.15);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  font: 500 1rem/1.2 var(--font-sans);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.field input::placeholder {
  color: rgba(95, 104, 95, 0.72);
}

.field input:focus,
.field select:focus,
.results-sort select:focus,
.edit-positions-controls select:focus,
.edit-positions-quick-controls input[type="number"]:focus {
  outline: none;
  border-color: rgba(159, 63, 49, 0.45);
  box-shadow: 0 0 0 4px rgba(159, 63, 49, 0.12);
}

.field input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3.35rem;
  padding: 0.9rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--surface-strong);
  color: var(--text);
  font: 700 0.95rem/1 var(--font-sans);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.btn--primary,
.btn--hero {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  box-shadow: 0 12px 28px rgba(127, 46, 34, 0.22);
}

.btn--primary:hover,
.btn--hero:hover {
  color: #fff;
  box-shadow: 0 16px 36px rgba(127, 46, 34, 0.28);
}

.btn--secondary,
.btn--hero-secondary {
  border-color: rgba(33, 44, 42, 0.14);
  background: rgba(255, 255, 255, 0.9);
}

.btn--small {
  min-height: 2.6rem;
  padding: 0.6rem 0.95rem;
  font-size: 0.82rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.results-panel,
.panel-shell,
.map-container,
.detail-card,
.info-hero-card,
.gov-section--card,
.related-links--card {
  border-radius: var(--radius-lg);
}

.results-panel {
  position: sticky;
  top: 1.5rem;
  padding: 0.9rem;
}

.panel-shell {
  padding: 0.85rem 1rem;
}

.panel-shell--map {
  margin-bottom: 1rem;
}

.results-header,
.map-panel-header {
  display: grid;
  gap: 0.35rem;
}

.results-header {
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(33, 44, 42, 0.08);
}

.results-title {
  font-size: 1.25rem;
}

.results-count {
  margin: 0;
  font-size: 0.92rem;
}

.results-sort {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

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

.results-sort select {
  min-height: 2.85rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  font-size: 0.92rem;
}

.results-list {
  min-height: 11rem;
}

.results-empty {
  padding-top: 0.75rem;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.results-empty.hidden,
.map-legend-icon[hidden],
.media-lightbox-map-wrap[hidden],
.media-lightbox-img[hidden],
.header-dropdown[hidden] {
  display: none !important;
}

.result-card {
  width: 100%;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 0.8rem;
  padding: 0.9rem;
  border-radius: 0.95rem;
  border: 1px solid rgba(33, 44, 42, 0.1);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  text-align: left;
  font: 500 0.95rem/1.5 var(--font-sans);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.result-card:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 49, 58, 0.22);
  box-shadow: 0 10px 25px rgba(39, 34, 25, 0.08);
}

.result-card.is-selected {
  border-color: rgba(159, 63, 49, 0.34);
  background: linear-gradient(180deg, rgba(159, 63, 49, 0.10), rgba(255, 255, 255, 0.94));
  box-shadow: 0 16px 32px rgba(127, 46, 34, 0.11);
}

.result-card::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  margin-top: 0.35rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(159, 63, 49, 0.94), rgba(127, 46, 34, 0.9));
  box-shadow: 0 0 0 5px rgba(159, 63, 49, 0.12);
}

.result-card-content {
  flex: 1;
  min-width: 0;
}

.result-card .result-name {
  display: block;
  color: var(--text);
  font-weight: 700;
}

.result-card .result-meta {
  display: block;
  margin-top: 0.22rem;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.map-panel {
  min-width: 0;
}

.map-container {
  overflow: hidden;
  background: linear-gradient(180deg, rgba(14, 30, 36, 0.98), rgba(20, 49, 58, 0.98));
  border-color: rgba(255, 255, 255, 0.18);
}

.map-wrapper {
  position: relative;
  min-height: clamp(420px, 64vh, 780px);
  max-height: 82vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
}

.map-wrapper.map-draggable {
  cursor: grab;
}

.map-wrapper.map-draggable.map-dragging {
  cursor: grabbing;
}

.map-wrapper.map-dragging {
  user-select: none;
}

.map-zoom-container {
  position: relative;
  width: 100%;
  transform-origin: center center;
}

.map-zoom-container--locator {
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: center;
}

.map-image {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
}

.map-image--locator {
  width: auto;
  max-width: 100%;
  max-height: min(70vh, 780px);
  margin: 0 auto;
}

.lot-hover-layer,
.pin-layer,
.media-lightbox-pin-layer {
  position: absolute;
  inset: 0;
}

.lot-hover-layer {
  pointer-events: none;
  z-index: 1;
}

.lot-hover-zone {
  position: absolute;
  width: 4%;
  height: 4%;
  min-width: 20px;
  min-height: 20px;
  z-index: 1;
  pointer-events: auto;
  transform: scale(calc(1 / var(--map-zoom, 1)));
  transform-origin: center center;
}

.lot-hover-popover,
.pin-tooltip {
  border-radius: 0.95rem;
  background: rgba(16, 38, 46, 0.96);
  color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
}

.lot-hover-popover {
  position: absolute;
  left: 50%;
  bottom: 100%;
  min-width: 12rem;
  max-width: 20rem;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.75rem 0.9rem;
  transform: translateX(-50%) translateY(-0.55rem);
  font-size: 0.82rem;
  line-height: 1.45;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.16s ease, visibility 0.16s ease;
  pointer-events: none;
}

.lot-hover-zone:hover .lot-hover-popover {
  opacity: 1;
  visibility: visible;
}

.lot-hover-popover strong {
  display: block;
  margin-bottom: 0.45rem;
}

.lot-hover-list {
  margin: 0;
  padding-left: 1.1rem;
}

.lot-hover-empty {
  margin: 0;
  opacity: 0.76;
}

.pin-layer,
.media-lightbox-pin-layer {
  pointer-events: none;
}

.pin {
  position: absolute;
  width: 40px;
  height: 48px;
  transform: translate(-50%, -100%) scale(calc(1 / var(--map-zoom, 1)));
  transform-origin: bottom center;
  z-index: 2;
  pointer-events: auto;
  cursor: pointer;
}

.pin svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.24));
}

.pin .pin-head,
.pin .pin-stem,
.map-legend-pin {
  fill: var(--accent);
  background: var(--accent);
}

.pin-tooltip {
  position: absolute;
  left: 50%;
  bottom: 100%;
  min-width: 5.5rem;
  max-width: 180px;
  padding: 0.45rem 0.7rem;
  transform: translateX(-50%) translateY(-0.55rem);
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
  word-wrap: break-word;
  opacity: 0;
  transition: opacity 0.16s ease;
  pointer-events: none;
}

.pin:hover .pin-tooltip {
  opacity: 1;
}

.pin--edit {
  cursor: grab;
}

.pin--edit:active {
  cursor: grabbing;
}

.map-circle-marker {
  position: absolute;
  width: 80px;
  height: 80px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 3px solid rgba(255, 239, 228, 0.92);
  background: rgba(159, 63, 49, 0.34);
  box-shadow: 0 0 0 14px rgba(159, 63, 49, 0.14);
  z-index: 4;
  pointer-events: none;
}

.map-toolbar {
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  color: rgba(255, 255, 255, 0.78);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.map-view-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
}

.map-view-btn,
.btn-zoom {
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.map-view-btn {
  min-height: 2.6rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-pill);
  font: 700 0.82rem/1 var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-view-btn:hover,
.map-view-btn.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.86rem;
  font-weight: 600;
}

.map-legend-pin {
  width: 12px;
  height: 16px;
  clip-path: polygon(50% 0%, 100% 100%, 50% 88%, 0% 100%);
}

.map-legend-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(159, 63, 49, 0.35);
  border: 2px solid rgba(255, 240, 229, 0.92);
}

.map-actions,
.map-zoom-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.btn-zoom {
  width: 2.45rem;
  height: 2.45rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.2rem;
}

.btn-zoom:hover {
  background: rgba(255, 255, 255, 0.24);
}

.btn-zoom:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.map-zoom-level {
  min-width: 3.5rem;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
}

.detail-card {
  margin-top: 0.9rem;
  overflow: hidden;
}

.detail-card-header {
  padding: 1.15rem 1.25rem 0.95rem;
  background: rgba(246, 241, 232, 0.85);
  border-bottom: 1px solid rgba(33, 44, 42, 0.08);
}

.detail-card-name {
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.04;
}

.detail-card-years {
  margin: 0.4rem 0 0;
  color: var(--text-soft);
  font-weight: 700;
}

.detail-card-body {
  display: flex;
  gap: 1.4rem;
  padding: 1.15rem 1.25rem;
  align-items: flex-start;
}

.detail-card-photo {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
  border-radius: 1.1rem;
  overflow: hidden;
  border: 1px solid rgba(33, 44, 42, 0.08);
  background: rgba(255, 255, 255, 0.78);
}

.detail-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-card-photo:empty {
  display: none;
}

.detail-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-list {
  margin: 0;
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 0.8rem 1.15rem;
  align-items: baseline;
}

.detail-list dt {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
}

.detail-obituary:empty {
  display: none;
}

.detail-obituary a {
  font-weight: 700;
  text-decoration: none;
}

.detail-obituary a:hover {
  text-decoration: underline;
}

.detail-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem 1.1rem;
  border-top: 1px solid rgba(33, 44, 42, 0.08);
  background: rgba(255, 255, 255, 0.38);
  cursor: default;
}

.btn--detail {
  min-height: 2.95rem;
  padding: 0.8rem 1rem;
  border-color: rgba(33, 44, 42, 0.12);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  font-size: 0.86rem;
}

.btn--detail:hover {
  background: #fff;
  color: var(--text);
}

.btn--detail svg {
  flex-shrink: 0;
  opacity: 0.75;
}

.btn--danger {
  color: #8b1e1e;
  border-color: rgba(139, 30, 30, 0.18);
  background: rgba(255, 240, 240, 0.82);
}

.btn--danger:hover {
  color: #701313;
  background: rgba(255, 231, 231, 0.96);
}

.edit-positions-panel {
  padding: 1rem 1.2rem 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.84);
}

.edit-positions-intro,
.edit-positions-hint,
.edit-positions-label {
  color: inherit;
}

.edit-positions-controls,
.edit-positions-quick-controls,
.edit-calibrate-step,
.edit-positions-values,
.edit-positions-step {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.edit-positions-controls .field,
.edit-positions-quick-controls .field {
  margin: 0;
}

.edit-calibrate-steps {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.edit-calibrate-label {
  min-width: 12rem;
  font-weight: 700;
}

.edit-positions-calibrate,
.edit-positions-quick-grid {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.edit-positions-subtitle {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

#editPositionDisplay {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.main--info-page {
  max-width: var(--max-width-narrow);
  padding-top: 1rem;
}

.info-hero {
  display: block;
  margin-bottom: 1.25rem;
}

.info-hero-main {
  padding: 0.8rem 0 0;
}

.main--info-page .page-title,
.main--info-page .lead {
  text-align: left;
}

.main--info-page .page-title {
  max-width: 10ch;
  margin-bottom: 0.7rem;
  font-size: clamp(2.3rem, 5vw, 4rem);
}

.breadcrumb {
  margin-bottom: 1rem;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.breadcrumb a {
  color: var(--accent);
}

.breadcrumb-sep {
  margin: 0 0.28rem;
}

.lead {
  margin-bottom: 0;
  font-size: 1.06rem;
}

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

.gov-section {
  margin: 0;
}

.gov-section--card {
  padding: 1.15rem;
}

.gov-section--wide {
  grid-column: 1 / -1;
}

.gov-heading {
  margin-bottom: 0.75rem;
  font-size: 1.45rem;
}

.gov-section p,
.gov-list {
  margin: 0;
  line-height: 1.7;
}

.gov-section p + p {
  margin-top: 0.65rem;
}

.gov-list {
  padding-left: 1.25rem;
}

.gov-list li + li {
  margin-top: 0.65rem;
}

.gov-list--links {
  list-style: none;
  padding-left: 0;
}

.related-links {
  margin-top: 0.9rem;
}

.related-links--card {
  padding: 1.15rem;
}

.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.media-lightbox[hidden] {
  display: none !important;
}

.media-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(7, 14, 17, 0.9);
  cursor: pointer;
}

.media-lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(calc(100vw - 2rem), 1120px);
  max-height: min(calc(100vh - 2rem), calc(100dvh - 2rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: rgba(255, 251, 246, 0.97);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}

.media-lightbox-dialog--person {
  width: min(calc(100vw - 1.5rem), 760px);
}

.media-lightbox-scroll {
  overflow: auto;
  max-height: calc(100vh - 2rem);
  padding: 2.8rem 1.5rem 1.5rem;
}

.media-lightbox--person .media-lightbox-scroll {
  padding-top: 2.6rem;
}

.media-lightbox-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: rgba(16, 38, 46, 0.9);
  color: #fff;
  font-size: 1.65rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.media-lightbox-close:hover {
  background: #0d2128;
}

.media-lightbox-img,
.media-lightbox-map-wrap .media-lightbox-map-img {
  display: block;
  max-width: 100%;
  max-height: min(78vh, 900px);
  margin: 0 auto 1.15rem;
  border-radius: 1rem;
}

.media-lightbox-map-wrap {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 1.15rem;
}

.media-lightbox-meta {
  color: var(--text);
  text-align: center;
}

.media-lightbox-title {
  margin-bottom: 0.4rem;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
}

.media-lightbox-subtitle {
  margin-bottom: 0.85rem;
  color: var(--text-soft);
}

.media-lightbox-details {
  max-width: 28rem;
  margin: 0 auto 1rem;
  text-align: left;
}

.media-lightbox-extra,
.media-lightbox-links {
  margin-top: 0.75rem;
  font-size: 0.94rem;
}

.media-lightbox--person .media-lightbox-meta {
  display: flex;
  flex-direction: column;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 10010;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.admin-modal[hidden] {
  display: none !important;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(7, 14, 17, 0.82);
  cursor: pointer;
}

.admin-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(calc(100vw - 2rem), 860px);
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: rgba(255, 251, 246, 0.98);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
}

.admin-modal-content {
  overflow: auto;
  max-height: calc(100vh - 2rem);
  padding: 1.5rem;
}

.admin-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: rgba(16, 38, 46, 0.9);
  color: #fff;
  font-size: 1.65rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.admin-modal-header {
  margin-bottom: 1rem;
}

.admin-modal-kicker {
  color: var(--accent);
}

.admin-modal-title {
  margin-bottom: 0.4rem;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.admin-modal-summary {
  margin: 0;
  color: var(--text-soft);
}

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

.admin-form-field-wide {
  grid-column: 1 / -1;
}

.admin-checkbox {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
  color: var(--text);
}

.admin-checkbox input {
  width: 1rem;
  height: 1rem;
}

.admin-form-status {
  min-height: 1.5rem;
  margin: 1rem 0 0;
  font-size: 0.92rem;
}

.admin-form-status.is-pending {
  color: var(--text-soft);
}

.admin-form-status.is-success {
  color: #1d6b39;
}

.admin-form-status.is-error {
  color: #9b2f2f;
}

.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.detail-card--in-lightbox {
  margin: 0;
  overflow: hidden;
}

.detail-card--in-lightbox .detail-card-header {
  padding: 1.15rem 1.2rem 0.95rem;
}

.detail-card--in-lightbox .detail-card-name {
  font-size: clamp(1.2rem, 3vw, 1.85rem);
}

.detail-card--in-lightbox .detail-card-years {
  font-size: 0.96rem;
}

.detail-card--in-lightbox .detail-card-body {
  gap: 1rem;
  padding: 1.2rem;
}

.detail-card--in-lightbox .detail-card-photo {
  width: clamp(92px, 20vw, 170px);
  height: clamp(92px, 20vw, 170px);
}

.detail-card--in-lightbox .detail-card-content {
  gap: 0.8rem;
}

.detail-card--in-lightbox .detail-list {
  gap: 0.55rem 0.9rem;
}

.detail-card--in-lightbox .detail-obituary {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.detail-card--in-lightbox .detail-card-footer {
  padding: 0.95rem 1.2rem 1.2rem;
}

.detail-card:not([hidden]) .detail-card-header,
.detail-card:not([hidden]) .detail-card-body {
  cursor: zoom-in;
}

.footer {
  margin-top: auto;
  background: linear-gradient(180deg, #132e37, #0f242b);
  color: rgba(255, 255, 255, 0.78);
}

.footer--govuk {
  padding: 1.8rem 1.5rem 2rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-support {
  margin-bottom: 1rem;
}

.footer-support-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0;
}

.footer-support-list li {
  display: inline;
}

.footer-support-list li:not(:last-child)::after {
  content: " · ";
  margin: 0 0.45rem;
  color: rgba(255, 255, 255, 0.28);
}

.footer-support-list a {
  color: rgba(255, 255, 255, 0.74);
  text-decoration: none;
}

.footer-support-list a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-licence {
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.58);
}

.hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .results-panel {
    position: static;
  }

  .hero-banner-inner,
  .hero-banner-image {
    min-height: 200px;
  }

  .search-section {
    margin-top: -5.8rem;
  }
}

@media (max-width: 900px) {
  .search-grid,
  .search-notes,
  .info-grid,
  .header-dropdown-inner {
    grid-template-columns: 1fr 1fr;
  }

  .search-grid .field--submit {
    grid-column: 1 / -1;
  }

  .map-wrapper {
    min-height: 56vh;
  }
}

@media (max-width: 680px) {
  .civic-bar-inner,
  .header-inner,
  .main--govuk,
  .footer--govuk,
  .hero-banner,
  .hero-banner-content,
  .search-shell,
  .results-panel,
  .panel-shell,
  .detail-card-header,
  .detail-card-body,
  .detail-card-footer,
  .gov-section--card,
  .related-links--card,
  .info-hero-card,
  .map-toolbar {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .search-grid,
  .admin-form-grid,
  .info-grid,
  .header-dropdown-inner {
    grid-template-columns: 1fr;
  }

  .hero-banner-inner,
  .search-shell,
  .results-panel,
  .panel-shell,
  .map-container,
  .detail-card,
  .info-hero-card,
  .gov-section--card,
  .related-links--card,
  .media-lightbox-dialog {
    border-radius: 1.25rem;
  }

  .hero-banner-inner,
  .hero-banner-image {
    min-height: 190px;
  }

  .search-section {
    margin-top: -4.5rem;
  }

  .page-title {
    font-size: clamp(2.15rem, 11vw, 3.1rem);
  }

  .detail-card-body,
  .detail-card--in-lightbox .detail-card-body {
    flex-direction: column;
  }

  .detail-card-photo {
    width: 132px;
    height: 132px;
  }

  .detail-list,
  .detail-card--in-lightbox .detail-list {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .detail-list dt,
  .detail-card--in-lightbox .detail-list dt {
    margin-top: 0.45rem;
  }

  .map-toolbar,
  .map-actions {
    align-items: stretch;
  }

  .map-legend-item,
  .map-actions {
    width: 100%;
  }

  .map-actions {
    justify-content: space-between;
  }
}

@media print {
  .media-lightbox,
  .search-section,
  .results-panel,
  .map-toolbar .map-actions,
  .footer,
  .btn,
  .pin-layer,
  .grain-overlay,
  .hero-actions,
  .hero-info-card,
  .panel-shell--map,
  .civic-bar,
  .header-menu {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .header,
  .map-container,
  .detail-card {
    box-shadow: none;
    border: 1px solid #ccc;
    backdrop-filter: none;
  }

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

  .detail-card {
    break-inside: avoid;
  }
}
