:root {
  --ink: #18383b;
  --ink-soft: #385558;
  --cream: #f6f0e3;
  --paper: #fffaf0;
  --red: #ae4038;
  --red-dark: #7e2b28;
  --gold: #d6a64f;
  --green: #607962;
  --purple: #6b5a7c;
  --line: #d9cdb8;
  --white: #fffdf8;
  --shadow: 0 24px 60px rgba(20, 43, 42, .15);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, a { -webkit-tap-highlight-color: transparent; }

button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

.hero {
  position: relative;
  min-height: 590px;
  overflow: hidden;
  color: var(--white);
  background:
    radial-gradient(circle at 78% 24%, rgba(214, 166, 79, .16), transparent 22%),
    linear-gradient(124deg, #102f32 0%, #183f41 55%, #244e49 100%);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .18;
  background-image:
    linear-gradient(115deg, transparent 0 54%, rgba(255,255,255,.08) 54.2%, transparent 54.6%),
    repeating-linear-gradient(0deg, transparent 0 34px, rgba(255,255,255,.045) 35px);
}

.topbar, .hero-copy, .section-heading, .explorer-grid, .place-list, .sources, footer {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 94px;
  height: 94px;
  object-fit: cover;
  object-position: center;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
}

.brand strong, .brand small { display: block; }
.brand strong { font: 700 17px/1.2 Georgia, serif; letter-spacing: .02em; }
.brand small { margin-top: 3px; color: #d8e0dc; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }

.preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 999px;
  color: #e8efec;
  background: rgba(255,255,255,.07);
  font-size: 12px;
}

.preview-pill span { width: 7px; height: 7px; border-radius: 50%; background: #9fd19f; box-shadow: 0 0 0 4px rgba(159,209,159,.12); }

.hero-copy {
  position: relative;
  z-index: 2;
  padding-top: 92px;
  padding-bottom: 150px;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .17em;
  text-transform: uppercase;
}

h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; }

h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(48px, 7vw, 86px);
  font-weight: 500;
  line-height: .96;
  letter-spacing: -.035em;
}

h1 em { color: #efd494; font-weight: 400; }

.lede {
  max-width: 680px;
  margin: 30px 0;
  color: #dce7e3;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 2.2vw, 23px);
  line-height: 1.52;
}

.primary {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 15px 20px;
  border: 0;
  border-radius: 4px;
  color: #203837;
  background: var(--gold);
  box-shadow: 0 8px 22px rgba(0,0,0,.16);
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}

.primary:hover { transform: translateY(-2px); background: #e2b65f; }

.hero-ridge { position: absolute; z-index: 1; right: 0; bottom: -2px; left: 0; height: 180px; }
.hero-ridge svg { width: 100%; height: 100%; }
.hero-ridge path { fill: var(--cream); }
.hero-ridge .ridge-line { fill: none; stroke: var(--gold); stroke-width: 2; opacity: .45; }

.explorer { padding: 68px 0 82px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

h2 { margin: 0; color: var(--ink); font-size: clamp(33px, 4vw, 51px); font-weight: 500; line-height: 1.04; letter-spacing: -.025em; }

.filters { display: inline-flex; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.55); }
.filter { padding: 9px 14px; border: 0; border-radius: 999px; color: var(--ink-soft); background: transparent; font-weight: 700; cursor: pointer; }
.filter.active { color: var(--white); background: var(--ink); }

.explorer-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr); gap: 22px; align-items: stretch; }
.map-card, .story-card { border: 1px solid rgba(121,101,72,.2); background: var(--white); box-shadow: var(--shadow); }
.map-card { min-width: 0; border-radius: 18px; overflow: hidden; }
.map-topline { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; color: #5a615c; font-size: 12px; font-weight: 700; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { display: inline-block; width: 17px; height: 10px; }
.legend-boundary { border: 2px solid var(--red); background: rgba(214,166,79,.3); }
.legend-nearby { border: 2px dashed var(--purple); border-radius: 50%; background: white; }
.map-note { flex: 0 0 auto; color: #7c766c; font-size: 11px; }
.map-wrap { padding: 14px; }
#historyMap { display: block; width: 100%; height: auto; max-height: 630px; touch-action: manipulation; }
.map-ground { fill: #efe6d4; }
.contours path { fill: none; stroke: #917b59; stroke-width: 2; opacity: .13; }
.boundary-fill { fill: rgba(214,166,79,.27); stroke: var(--red); stroke-width: 5; stroke-dasharray: 12 7; stroke-linejoin: round; filter: url(#mapShadow); }
.road-base { fill: none; stroke: #fffaf0; stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.road-base.minor { stroke-width: 7; }
.feature-road { fill: none; stroke: var(--red); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; cursor: pointer; transition: stroke-width .16s ease, stroke .16s ease, opacity .16s ease; }
.feature-hit { fill: none; stroke: transparent; stroke-width: 28; cursor: pointer; }
.feature-road:hover, .street-feature.selected .feature-road { stroke: var(--red-dark); stroke-width: 10; }
.street-feature.dimmed, .landmark.dimmed { opacity: .12; pointer-events: none; }
.street-label { fill: var(--ink); font: 800 11px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: .05em; paint-order: stroke; stroke: #f5eddc; stroke-width: 5; stroke-linejoin: round; pointer-events: none; }
.landmark { cursor: pointer; transition: opacity .16s ease, transform .16s ease; transform-box: fill-box; transform-origin: center; }
.landmark:hover, .landmark.selected { transform: scale(1.14); }
.landmark circle { fill: var(--ink); stroke: var(--white); stroke-width: 4; filter: url(#mapShadow); }
.landmark.nearby circle { fill: var(--white); stroke: var(--purple); stroke-width: 5; stroke-dasharray: 4 3; }
.landmark text { fill: white; font: 800 14px/1 ui-sans-serif, system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.landmark.nearby text { fill: var(--purple); }
.landmark-photo { pointer-events: none; }
.landmark.photo-landmark .photo-outline { fill: none; stroke: var(--purple); stroke-width: 5; stroke-dasharray: 4 3; }
.cemetery-shape { fill: rgba(96,121,98,.22); stroke: var(--green); stroke-width: 2; stroke-dasharray: 6 5; }
.cemetery-label { fill: #486049; font: 700 11px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: .05em; }
.map-labels text { fill: #786b58; font: 800 10px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: .11em; }
.north-arrow path { fill: var(--red); }
.north-arrow text { fill: var(--ink); font: 800 11px/1 ui-sans-serif, system-ui, sans-serif; }
.map-instruction { margin: 4px 8px 8px; color: #716d64; font-size: 12px; text-align: center; }

.story-card { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 510px; padding: clamp(28px, 4vw, 46px); border-radius: 18px; overflow: hidden; }
.story-card::after { content: ""; position: absolute; right: -82px; bottom: -74px; width: 210px; height: 210px; border: 1px solid rgba(174,64,56,.13); border-radius: 50%; box-shadow: 0 0 0 28px rgba(174,64,56,.04), 0 0 0 56px rgba(174,64,56,.03); }
.story-status { align-self: flex-start; position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; margin-bottom: 30px; padding: 7px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.story-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.story-status.inside { color: #6c3b18; background: #f5e3b8; }
.story-status.boundary { color: #3f6548; background: #dce8dc; }
.story-status.nearby { color: #5c496e; background: #e8e0ed; }
.story-kicker { margin: 0 0 8px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.story-card h3 { position: relative; z-index: 1; margin: 0 0 18px; font-size: clamp(34px, 4vw, 49px); font-weight: 500; line-height: 1.04; letter-spacing: -.025em; }
.story-card > p:not(.story-kicker) { position: relative; z-index: 1; margin: 0; color: #445655; font-family: Georgia, "Times New Roman", serif; font-size: 18px; line-height: 1.56; }
.story-detail { position: relative; z-index: 1; display: grid; gap: 5px; margin: 26px 0; padding-top: 20px; border-top: 1px solid var(--line); }
.story-detail strong { color: var(--red); font-size: 11px; letter-spacing: .13em; text-transform: uppercase; }
.story-detail span { color: #4e5b59; font-size: 13px; line-height: 1.48; }
.source-link {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 12px 16px;
  border: 2px solid var(--red-dark);
  border-radius: 7px;
  color: var(--white);
  background: var(--red);
  box-shadow: 0 7px 16px rgba(126,43,40,.18);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}
.story-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.story-actions .source-link { align-self: auto; }
.secondary-link { color: var(--red-dark); background: transparent; box-shadow: none; }
.secondary-link:hover { color: var(--white); }
.source-link:hover {
  color: var(--white);
  background: var(--red-dark);
  box-shadow: 0 9px 20px rgba(126,43,40,.24);
  transform: translateY(-2px);
}

.footer-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.footer-nav a { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 13px; border: 1px solid rgba(255,255,255,.38); border-radius: 6px; text-align: center; }
.footer-nav a.current { color: #203837; border-color: var(--gold); background: var(--gold); }

.source-dialog {
  width: min(680px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  overflow: auto;
  padding: 0;
  border: 1px solid rgba(130, 40, 34, .24);
  border-radius: 24px;
  color: #243634;
  background: #fbf8f0;
  box-shadow: 0 24px 80px rgba(12, 28, 29, .32);
}

.source-dialog::backdrop { background: rgba(10, 27, 29, .68); backdrop-filter: blur(3px); }
.source-dialog-inner { position: relative; padding: clamp(26px, 5vw, 46px); }
.source-dialog h2 { margin: 5px 44px 18px 0; font: 600 clamp(30px, 5vw, 46px)/1.05 Georgia, serif; color: #17383a; }
.source-summary { font: 19px/1.6 Georgia, serif; }
.street-photo-gallery { display: grid; grid-template-columns: 1fr; gap: 18px; margin: 6px 0 26px; }
.street-photo-gallery figure { margin: 0; overflow: hidden; border: 1px solid #d3cab9; border-radius: 12px; background: #fff; }
.street-photo-gallery img { display: block; width: 100%; height: auto; object-fit: contain; background: #e8e3d9; }
.street-photo-gallery figcaption { padding: 9px 11px 10px; color: #4d5956; font: 700 13px/1.3 Arial, sans-serif; }
.evidence-heading { margin: 0 0 8px; color: #922e29; font: 700 13px/1.2 Arial, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.dialog-close { position: absolute; top: 18px; right: 18px; width: 42px; height: 42px; border: 1px solid #c9c1b2; border-radius: 50%; background: #fff; color: #17383a; font-size: 28px; line-height: 1; cursor: pointer; }
.citation-box { margin: 24px 0 14px; padding: 18px 20px; border-left: 4px solid #922e29; background: #f1eadc; }
.citation-box strong { display: block; margin-bottom: 8px; color: #922e29; font: 700 12px/1.2 Arial, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.citation-box p { margin: 0; font: 15px/1.55 Arial, sans-serif; }
.source-note { color: #5d625e; font: 14px/1.5 Arial, sans-serif; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 24px; }
.secondary-action { padding: 13px 18px; border: 1px solid #8e978f; border-radius: 8px; background: transparent; color: #17383a; font-weight: 700; cursor: pointer; }

@media (max-width: 520px) {
  .source-dialog-inner { padding: 28px 22px 24px; }
  .source-summary { font-size: 17px; }
  .dialog-actions { align-items: stretch; flex-direction: column; }
  .dialog-actions > * { justify-content: center; text-align: center; }
}

.place-list { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-top: 18px; }
.place-button { display: flex; align-items: center; gap: 11px; min-height: 56px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: rgba(255,253,248,.72); text-align: left; cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.place-button:hover { transform: translateY(-2px); border-color: #b8a889; background: var(--white); }
.place-button.active { border-color: var(--red); background: #fff8ea; box-shadow: inset 0 0 0 1px var(--red); }
.place-button i { flex: 0 0 auto; display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; color: white; background: var(--ink); font-style: normal; font-size: 10px; font-weight: 900; }
.place-button.nearby i { color: var(--purple); border: 2px dashed var(--purple); background: white; }
.place-button span { display: block; min-width: 0; }
.place-button strong, .place-button small { display: block; }
.place-button strong { font-size: 12px; line-height: 1.25; }
.place-button small { margin-top: 3px; color: #777064; font-size: 10px; }

.sources { padding: 74px 0 66px; border-top: 1px solid var(--line); }
.sources > div:first-child { max-width: 650px; }
.source-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 34px; }
.source-grid a { display: grid; gap: 8px; min-height: 164px; padding: 23px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: rgba(255,253,248,.66); text-decoration: none; transition: transform .16s ease, background .16s ease; }
.source-grid a:hover { transform: translateY(-3px); background: var(--white); }
.source-grid span { color: var(--red); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.source-grid strong { font: 600 23px/1.15 Georgia, serif; }
.source-grid small { align-self: end; color: #676b64; line-height: 1.4; }
.method-note { max-width: 850px; margin: 30px 0 8px; color: #555f5b; font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.55; }
.attribution { margin: 0; color: #7a776f; font-size: 11px; }

footer { display: flex; justify-content: space-between; gap: 20px; padding-top: 24px; padding-bottom: 40px; border-top: 1px solid var(--line); color: #626860; font-size: 12px; }
footer a { color: var(--red-dark); font-weight: 800; }

@media (max-width: 900px) {
  .explorer-grid { grid-template-columns: 1fr; }
  .story-card { min-height: 0; }
  .place-list { grid-template-columns: repeat(3, 1fr); }
  .source-grid { grid-template-columns: 1fr; }
  .source-grid a { min-height: 118px; }
}

@media (max-width: 680px) {
  .topbar, .hero-copy, .section-heading, .explorer-grid, .place-list, .sources, footer { width: min(100% - 24px, 1180px); }
  .hero { min-height: 610px; }
  .topbar { padding-top: 16px; }
  .brand-logo { width: 76px; height: 76px; }
  .brand strong { font-size: 15px; }
  .brand small { font-size: 10px; }
  .preview-pill { padding: 7px 9px; font-size: 10px; }
  .hero-copy { padding-top: 78px; }
  h1 { font-size: clamp(44px, 14vw, 66px); }
  .lede { font-size: 18px; }
  .section-heading { display: grid; align-items: start; }
  .filters { justify-self: start; }
  .map-topline { align-items: flex-start; flex-direction: column; gap: 8px; }
  .map-note { white-space: normal; }
  .map-wrap { padding: 4px; }
  #historyMap { min-height: 430px; }
  .place-list { grid-template-columns: repeat(2, 1fr); }
  footer { flex-direction: column; }
}

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