.atlas {
  padding-block: 38px 50px;
}
.atlas-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 30px;
  margin-bottom: 28px;
}
.atlas-heading h1 {
  font: 750 clamp(42px, 5vw, 68px) / 1.02 var(--sans);
  letter-spacing: -0.045em;
}
.atlas-heading p {
  font-size: 17px;
  color: var(--muted);
  margin-top: 12px;
}
.atlas-heading nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  font-size: 15px;
  font-weight: 650;
}
.atlas-heading nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.atlas-controls {
  display: flex;
  gap: 18px;
  align-items: end;
  flex-wrap: wrap;
  background: var(--wash);
  border-block: 1px solid var(--line);
  padding: 20px;
  margin-bottom: 25px;
}
.atlas-controls > label {
  display: grid;
  gap: 7px;
  font-size: 15px;
  font-weight: 650;
}
.atlas-controls > label:first-child {
  flex: 1;
  min-width: 200px;
}
.atlas-controls > label:nth-child(2) {
  width: 25%;
}
.atlas-controls input[type="search"],
.atlas-controls select {
  width: 100%;
  min-height: 47px;
  border: 1px solid var(--ink);
  padding: 10px 12px;
  background: white;
  font-size: 17px;
  font-weight: 400;
}
.atlas-controls .atlas-saved {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 47px;
  font-weight: 500;
  font-size: 15px;
}
.atlas-saved input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}
#atlas-reset {
  min-height: 47px;
  padding: 10px 0;
  border: 0;
  background: none;
  text-decoration: underline;
  font-size: 15px;
  font-weight: 650;
  color: var(--blue);
}
#atlas-reset:disabled {
  color: var(--muted);
  opacity: 0.6;
}
.atlas-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 25px;
  align-items: start;
}
.map-sheet {
  border: 1px solid var(--ink);
  background: var(--wash);
  overflow: hidden;
}
.map-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 9px;
}
.map-tools button {
  min-width: 44px;
  min-height: 44px;
  background: white;
  border: 1px solid var(--ink);
  padding: 7px 12px;
  font-weight: 650;
}
.map-tools button:hover {
  background: var(--wash);
}
.map-tools button:disabled {
  opacity: 0.4;
}
.map-tools span {
  margin-left: auto;
  font: 500 11px/1.4 var(--mono);
  padding-right: 4px;
}
#town-map {
  display: block;
  width: 100%;
  aspect-ratio: 1000/720;
  touch-action: none;
  cursor: grab;
}
#town-map:active {
  cursor: grabbing;
}
#map-points circle {
  fill: var(--blue);
  stroke: white;
  cursor: pointer;
}
#map-points circle.selected {
  fill: var(--ink);
  stroke: var(--yellow);
}
.map-attribution {
  display: flex;
  justify-content: space-between;
  gap: 4px 12px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: white;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.map-attribution a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}
.atlas-index {
  border-top: 3px solid var(--blue);
}
#atlas-count {
  padding: 12px 0;
  font-size: 16px;
  font-weight: 650;
}
#place-index {
  max-height: 480px;
  overflow: auto;
  border-block: 1px solid var(--line);
  scrollbar-color: var(--blue) var(--wash);
}
#place-index button {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 13px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  background: white;
}
#place-index button > span {
  font-size: 17px;
  font-weight: 600;
  display: block;
  line-height: 1.25;
}
#place-index button > small {
  font-size: 13px;
  display: block;
  line-height: 1.3;
  color: var(--muted);
  margin-top: 6px;
}
#place-index button[aria-pressed="true"] {
  border-left: 4px solid var(--blue);
  background: var(--wash);
  padding-left: 6px;
}
#place-index button:hover {
  background: var(--wash);
}
#pin-details {
  padding: 20px;
  margin-bottom: 16px;
  background: var(--wash);
  border-left: 4px solid var(--blue);
}
#pin-details h2 {
  font: 700 27px/1.1 var(--sans);
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.pin-address {
  font-size: 16px;
  margin: 12px 0 14px;
}
.pin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
}
.pin-actions a,
.pin-actions button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
  font-weight: 650;
  color: var(--blue);
}
.pin-actions button {
  border: 0;
  background: none;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.pin-actions button[aria-pressed="true"] {
  font-weight: 750;
  color: var(--ink);
}
.pin-source {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 5px;
  font-size: 14px;
}
.pin-source summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  list-style: none;
  font-weight: 650;
}
.pin-source summary::after {
  content: "+";
  margin-left: auto;
  font-size: 22px;
  color: var(--blue);
}
.pin-source[open] summary::after {
  content: "−";
}
.pin-source ul {
  padding-left: 18px;
  margin: 8px 0 0;
}
.pin-source li {
  margin-top: 8px;
}
.pin-source a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
}
.pin-coordinates {
  font: 500 12px/1.6 var(--mono);
  overflow-wrap: anywhere;
  margin-top: 6px;
}
.map-copy-field {
  display: block;
  width: 100%;
  min-width: 0;
  background: white;
  border: 1px solid var(--ink);
  padding: 9px;
  margin-top: 14px;
  font-size: 14px;
}
.map-empty {
  padding: 15px 10px;
  font-size: 16px;
}
.map-feedback {
  font-size: 16px;
  color: var(--blue);
}
.map-feedback:not(:empty) {
  padding-block: 18px;
}
.atlas-foot {
  display: grid;
  grid-template-columns: 0.5fr 1fr;
  gap: 8%;
  border-top: 2px solid var(--ink);
  margin-top: 42px;
  padding-top: 30px;
}
.atlas-foot h2 {
  font: 550 clamp(30px, 3vw, 43px) / 1.08 var(--editorial);
  letter-spacing: -0.04em;
}
.atlas-foot p {
  font-size: 16px;
  margin-bottom: 16px;
}
.atlas-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--blue);
  margin-right: 23px;
}
@media (max-width: 1000px) {
  .atlas-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 20px;
  }
  .atlas-controls > label:nth-child(2) {
    width: 32%;
  }
}
@media (max-width: 740px) {
  .atlas {
    padding-top: 28px;
  }
  .atlas-heading {
    align-items: start;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
  }
  .atlas-heading h1 {
    font-size: 48px;
  }
  .atlas-heading p {
    margin-top: 9px;
    font-size: 16px;
  }
  .atlas-controls {
    padding: 17px;
    gap: 13px;
    margin-bottom: 22px;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .atlas-controls > label:first-child {
    grid-column: 1/-1;
    min-width: 0;
  }
  .atlas-controls > label:nth-child(2) {
    width: auto;
    grid-column: 1/-1;
  }
  .atlas-controls .atlas-saved {
    font-size: 14px;
  }
  #atlas-reset {
    justify-self: end;
  }
  .atlas-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .map-tools span {
    font-size: 10px;
  }
  .map-tools button {
    padding-inline: 9px;
  }
  .map-attribution {
    font-size: 11px;
  }
  #place-index {
    max-height: 390px;
  }
  #pin-details {
    padding: 22px;
  }
  #pin-details h2 {
    font-size: 29px;
  }
  .pin-source a {
    min-height: 44px;
  }
  .atlas-foot {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 30px;
  }
  .atlas-foot h2 {
    font-size: 37px;
  }
}

/* Discovery controls share the directory's category data and saved places. */
.atlas-heading h1 { font-size:clamp(36px,4.5vw,58px); }
.atlas-controls { background:white; padding:0 0 18px; border-top:0; margin-bottom:14px; gap:16px; }
.atlas-controls > label:nth-child(2) { width:210px; }
.map-discovery { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:20px; }
.map-discovery button { min-height:44px; padding:9px 17px; background:white; border:1px solid var(--line); border-radius:24px; font:600 15px var(--sans); color:var(--ink); }
.map-discovery button[aria-pressed="true"] { color:white; background:var(--blue); border-color:var(--blue); }
.atlas-layout { grid-template-columns:minmax(0,1fr) 350px; gap:24px; }
.map-sheet { position:sticky; top:16px; border-color:var(--line); }
#town-map { height:auto; }
#map-points circle.has-story { fill:#8a2860; }
#map-points circle.selected { fill:var(--ink); stroke:var(--yellow); }
#map-label { pointer-events:none; }
#map-label text { font-family:var(--sans); font-weight:700; fill:#13233b; stroke:white; stroke-width:3px; paint-order:stroke; stroke-linejoin:round; vector-effect:non-scaling-stroke; }
.atlas-index-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; }
#map-fit-results { background:none; border:0; color:var(--blue); font:600 14px var(--sans); min-height:44px; }
#place-index { position:relative; max-height:440px; }
#place-index .row-story { color:var(--ink); font-size:14px; }
#pin-details { background:#f2f5fc; padding:20px; border:0; }
.pin-photo { margin:-20px -20px 18px; }
.pin-photo img { width:100%; height:180px; object-fit:cover; display:block; }
.pin-photo figcaption { font-size:11px; padding:7px 12px; color:var(--muted); background:white; }
.pin-story { font-size:16px; line-height:1.5; margin:12px 0; }
.pin-read { display:inline-flex; align-items:center; min-height:44px; padding:8px 14px; color:white; background:var(--blue); text-decoration:none; font-weight:650; }
.pin-connections { margin:18px 0; padding-top:14px; border-top:1px solid var(--line); }
.pin-connections h3 { font-size:14px; margin-bottom:4px; }
.pin-connections a { display:block; font-size:15px; padding:8px 0; }
.pin-actions { margin-top:14px; }
.map-stories { margin-top:42px; padding-top:28px; border-top:1px solid var(--line); }
.map-stories h2 { font-size:30px; letter-spacing:-.03em; }
.map-stories > p { margin:8px 0 20px; color:var(--muted); }
#map-story-links { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:26px; }
.map-story-link { text-decoration:none; color:var(--ink); }
.map-story-link img { width:100%; height:160px; object-fit:cover; margin-bottom:14px; }
.map-story-link h3 { color:var(--blue); font-size:21px; line-height:1.25; }
.map-story-link p { font-size:15px; line-height:1.5; margin-top:9px; }
.atlas :is(button,input,select,a):focus-visible { outline:3px solid #aa2860; outline-offset:3px; }
@media(max-width:1000px) { .atlas-layout { grid-template-columns:minmax(0,1fr) 300px; gap:18px; } .map-tools span { display:none; } }
@media(max-width:740px) {
  .atlas-layout { grid-template-columns:1fr; gap:20px; }
  .atlas-controls { grid-template-columns:1fr 1fr; padding:0 0 16px; gap:12px; }
  .atlas-controls > label:nth-child(2) { width:100%; grid-column:1/-1; }
  .map-sheet { position:static; }
  #town-map { height:auto; }
  .map-tools { flex-wrap:wrap; }
  .map-discovery { flex-wrap:nowrap; overflow:auto; padding:3px 3px 9px; }
  .map-discovery button { white-space:nowrap; flex-shrink:0; }
  #pin-details { padding:20px; }
  .pin-photo img { height:210px; }
  #map-story-links { grid-template-columns:1fr; gap:24px; }
  .map-story-link img { height:190px; }
  #place-index { max-height:320px; }
}
@media(prefers-reduced-motion:reduce) { .atlas * { scroll-behavior:auto; transition:none; } }
.story-credit { display:block; color:var(--muted); font-size:11px; margin:-8px 0 12px; }

.explorer-modes { display:flex; gap:0; border-bottom:1px solid var(--line); margin-bottom:24px; }
.explorer-modes button { border:0; border-bottom:3px solid transparent; min-height:48px; padding:8px 24px; font:650 17px var(--sans); background:white; color:var(--muted); }
.explorer-modes button[aria-pressed=true] { border-color:var(--blue); color:var(--blue); }
.story-tools { display:flex; align-items:end; gap:22px; justify-content:space-between; }
.story-search { position:relative; flex:1; max-width:500px; }
.story-search label { display:block; font-size:14px; font-weight:600; margin-bottom:6px; }
.story-search input { width:100%; min-height:46px; font:16px var(--sans); padding:12px 14px; border:1px solid var(--line); }
#story-matches:not(:empty) { position:absolute; top:100%; left:0; right:0; z-index:4; background:white; border:1px solid var(--line); box-shadow:0 8px 20px #13233b20; }
#story-matches button { display:block; width:100%; min-height:44px; text-align:left; padding:12px; border:0; border-bottom:1px solid var(--line); background:white; font:500 16px var(--sans); }
#story-matches p { padding:14px; }
#story-shuffle { background:var(--blue); color:white; border:0; min-height:46px; padding:12px 20px; font:650 15px var(--sans); }
.story-history { display:flex; justify-content:space-between; align-items:center; gap:15px; margin:16px 0 0; font-size:13px; color:var(--muted); }
#story-back { background:none; color:var(--blue); min-height:44px; font:500 14px var(--sans); border:0; text-align:left; padding:0; }
#story-back:disabled { color:var(--muted); }
.story-stage { position:relative; min-height:640px; margin:0 -8px; display:grid; grid-template-columns:1fr 1.22fr 1fr; align-items:center; }
.story-lines { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.story-lines path { fill:none; stroke:#bcc7df; stroke-width:1.5; }
#story-center { grid-column:2; position:relative; background:white; border:1px solid #a8b8dc; box-shadow:0 12px 40px #12316914; border-radius:10px; overflow:hidden; z-index:1; }
.story-hero { margin:0; }
.story-hero img { display:block; width:100%; height:230px; object-fit:cover; }
.story-hero figcaption { font-size:10px; line-height:1.4; color:var(--muted); padding:6px 12px; background:#f4f6fb; }
.story-hero figcaption a { color:inherit; }
.story-center-copy { padding:24px; }
.story-topic { color:var(--blue); font-size:12px; font-weight:650; margin-bottom:10px; }
#story-center h2 { font-size:clamp(26px,2.6vw,35px); line-height:1.05; letter-spacing:-.035em; }
.story-description { line-height:1.55; font-size:16px; margin:14px 0; }
.story-open { display:inline-flex; min-height:44px; align-items:center; color:var(--blue); font-weight:650; }
.story-node { position:absolute; top:calc(20px + var(--slot)*155px); width:27%; min-height:100px; display:flex; align-items:center; gap:12px; text-align:left; border:1px solid #ccd4e4; border-radius:8px; padding:12px; background:#f4f6fb; font-family:var(--sans); color:var(--ink); cursor:pointer; transition:transform .15s,box-shadow .15s; }
.story-node[data-side=left] { left:0; }
.story-node[data-side=right] { right:0; }
.story-node:hover { transform:translateY(-3px); border-color:var(--blue); box-shadow:0 6px 18px #12316915; }
.story-node img { width:54px; height:68px; object-fit:cover; border-radius:3px; }
.story-node-text { min-width:0; }
.story-node strong { display:block; font-size:16px; line-height:1.25; }
.story-node small { display:block; color:var(--muted); font-size:12px; margin-top:7px; }
.story-more { position:absolute; bottom:0; right:0; border:0; background:white; color:var(--blue); min-height:40px; font:500 13px var(--sans); }
.story-hint { color:var(--muted); font-size:13px; text-align:center; margin:18px 0 0; }
#story-explorer[data-connections="0"] .story-lines { display:none; }
@media(max-width:900px) { .story-node img { display:none; } .story-node { padding:14px; } .story-center-copy { padding:18px; } }
@media(max-width:740px) {
  .story-tools { display:block; } .story-search { max-width:none; } #story-shuffle { width:100%; margin-top:10px; }
  .story-stage { display:block; margin:0; min-height:0; } .story-lines { display:none; }
  .story-hero img { height:220px; } #story-center h2 { font-size:30px; }
  #story-neighbors { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:22px; }
  #story-neighbors::before { content:"Keep exploring"; grid-column:1/-1; font-size:20px; font-weight:650; }
  .story-node { position:static; width:auto; min-height:110px; display:block; padding:12px; }
  .story-node img { display:block; width:100%; height:90px; margin-bottom:10px; }
  .story-more { position:static; grid-column:1/-1; }
  .story-history { margin-bottom:12px; } .story-history p { text-align:right; }
  .explorer-modes button { flex:1; padding-inline:8px; font-size:16px; }
}
@media(prefers-reduced-motion:reduce) { .story-node { transition:none; } .story-node:hover { transform:none; } }
