/* Glasgow's Secret Geometry: the map. Tokens, type, masthead and drawer are in
   base.css (shared with the Astro site); this file is the map itself, over a
   greyed-out basemap. */
/* small-caps serif buttons, like the labels on Bell's maps */
.tabs button, .sort button, .back, .step-nav button {
  font-family: var(--font-label); font-size: .95rem; line-height: 1;
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 4px 2px 3px; cursor: pointer; color: var(--ink);
  text-decoration: none; white-space: nowrap;
}

/* search, at the top of the map's drawer */
.drawer-search { margin: 4px 0 6px 28px; }
.drawer-search input { width: 100%; font: inherit; font-size: 1rem; padding: 8px 10px; border: var(--line); border-radius: 2px; background: #fff; }
.drawer-search input::placeholder { color: var(--ink-soft); }
.key-ico { width: 24px; height: 24px; }
.search-results:not(:empty) { margin-top: 6px; }

.map-reset {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1000;
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 6px;
  background: var(--paper); border: 2px solid var(--ochre); border-radius: 999px; cursor: pointer;
  font-family: var(--font-label); font-size: 1rem; color: var(--ink); white-space: nowrap;
  box-shadow: 0 4px 14px -6px rgba(26, 24, 22, .45);
}
.map-reset svg { width: 18px; height: 18px; color: var(--ochre); }
.map-reset:hover { background: var(--ochre); color: #fff; }
.map-reset:hover svg { color: #fff; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 440px; border-bottom: var(--line); }
.map-panel { position: sticky; top: var(--mast-h); height: calc(100vh - var(--mast-h)); min-height: 460px; border-right: var(--line); }
#map { width: 100%; height: 100%; background: #f1eee7; }
/* the basemap goes grey so the black geometry reads first */
.maplibregl-canvas, .osm-classic { filter: grayscale(1) sepia(.2) contrast(1.05) brightness(.98); }
.leaflet-container { font-family: var(--font-sans); }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-bar { border: var(--line) !important; border-radius: 0 !important; box-shadow: none !important; }
.leaflet-bar a { border-radius: 0 !important; color: var(--ink) !important; }

.map-loader {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1000;
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--paper); border: var(--line);
  font-family: var(--font-label); font-size: .95rem; white-space: nowrap;
}
.spinner { width: 14px; height: 14px; border: 2px solid var(--ochre); border-right-color: transparent; border-radius: 50%; animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.side-panel { padding: 0 24px 32px; min-width: 0; }

/* ---------- sightline diagram ---------- */
.rays { margin: 18px -10px 8px; }
.rays svg { display: block; width: 100%; height: auto; overflow: visible; }
.rays .ray { stroke: var(--ink); stroke-width: 1.3; }
.rays .ray.is-on { stroke: var(--ochre); stroke-width: 2.4; }
.rays .end { fill: var(--ink); }
.rays .end.is-on { fill: var(--ochre); }
.rays .lbl { font-family: var(--font-fell); font-size: 8.6px; fill: var(--ink); }
.rays .lbl.big { font-family: var(--font-label); font-size: 10.5px; }
.rays a { cursor: pointer; text-decoration: none; }
.rays text { paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }
.rays a:hover .lbl { fill: var(--ochre); }
.rays a:hover .end { fill: var(--ochre); }
.rays .hub-lbl { font-family: var(--font-label); font-size: 12px; fill: var(--ink); }
.rays .hub { cursor: pointer; }
.rays .hub:hover .hub-lbl { fill: var(--ochre); }
.rays .road { font-family: var(--font-fell); font-style: italic; font-size: 7.6px; fill: var(--ink-soft); }
.rays .rose { stroke: var(--ink); stroke-width: 1; fill: none; }
.rays .rose .fill { fill: var(--ink); }
.rays .rose text { font-family: var(--font-label); font-size: 8px; fill: var(--ink); stroke: none; }
.rays figcaption { font-family: var(--font-fell); font-style: italic; font-size: .85rem; color: var(--ink-soft); text-align: center; margin-top: -4px; }

.steps-nav { margin-top: 12px; padding-top: 10px; border-top: var(--line); }
.steps-head { margin: 0 0 4px; font-family: var(--font-hand); font-weight: 400; font-size: 1.15rem; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps button { display: grid; grid-template-columns: 2.2em 1fr; align-items: baseline; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--rule-soft); padding: 5px 2px; cursor: pointer; font-family: var(--font-sans); font-size: 1rem; color: var(--ink); }
.steps .num { font-family: var(--font-label); color: var(--ochre); }
.steps .t { font-family: var(--font-label); font-size: 1.05rem; }
.steps .h { font-style: italic; color: var(--ink-soft); }
.steps button:hover, .steps button.is-on { background: var(--ochre-soft); }
.steps button.is-on .t { color: var(--red); }

/* ---------- overview ---------- */
.lede { margin: 6px 0 12px; }
.step-quote cite { display: block; margin-top: 4px; font-style: normal; font-family: var(--font-label); font-size: .85rem; color: var(--ochre); }
.stats { margin: 0; color: var(--ink-soft); font-size: .9rem; }
.stats strong { color: var(--ink); }

/* ---------- layers ---------- */
.layers { display: flex; flex-direction: column; }
.layer-group { border-bottom: 1px solid var(--rule-soft); }
.layer-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 7px 0; }
.layer-group > summary::-webkit-details-marker { display: none; }
.layer-group > summary::after { content: "+"; margin-left: 8px; font-weight: 600; }
.layer-group[open] > summary::after { content: "–"; }
.layer-group .folders { padding: 0 0 8px 26px; display: flex; flex-direction: column; gap: 2px; }
.layer-row { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.layer-row.top { font-weight: 400; }
.layer-row input { margin: 0; accent-color: var(--c); }
.layer-row .n, summary .n { margin-left: auto; color: var(--ink-soft); font-size: .78rem; font-variant-numeric: tabular-nums; }


/* ---------- list ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 0 6px; padding-top: 12px; border-top: var(--line); flex-wrap: wrap; }
.tabs, .sort { display: flex; }
.tabs { gap: 14px; } .sort { gap: 10px; }
.tabs button[aria-selected="true"], .sort button[aria-pressed="true"] { border-bottom-color: var(--ochre); }
.tabs button:hover, .sort button:hover { color: var(--ochre); }
.tabs span { opacity: .7; }

.list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--rule-soft); cursor: pointer; }
.item:hover, .item.is-hover { background: var(--ochre-soft); }
.item .dot, .kicker .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--c); flex: none; }
.item .bar { width: 16px; height: 0; border-top: 3px solid var(--c); flex: none; }
.item .bar.dash { border-top-style: dashed; }
.item .name { flex: 1; min-width: 0; font-weight: 400; line-height: 1.25; }
.item .sub { display: block; font-size: .8rem; color: var(--ink-soft); font-family: var(--font-fell); font-style: italic; }
.badge, .offset { font-size: .76rem; color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.empty { color: var(--ink-soft); padding: 12px 0; }
.along { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--c); display: grid; place-items: center; font-size: .7rem; font-weight: 600; flex: none; background: var(--paper); }
.centre-ico { width: 14px; height: 14px; flex: none; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--ochre); margin: 0 1px; }

/* ---------- detail ---------- */
.detail { padding-top: 8px; }
.detail .back { display: block; width: 100%; margin-top: 6px; padding: 9px 12px 8px; text-align: left; background: var(--ochre-soft); border: 0; border-left: 3px solid var(--ochre); font-size: 1.02rem; }
.detail .back:hover { background: var(--ochre); color: #fff; }
.kicker { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; font-family: var(--font-label); font-size: .92rem; color: var(--ink-soft); }
.detail h2.name { font-family: var(--font-fell); font-weight: 400; font-size: 1.75rem; line-height: 1.2; margin: 6px 0 12px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); margin: 0 0 14px; border: var(--line); }
.facts div { padding: 7px 10px; border-right: 1px solid var(--ink); }
.facts div:last-child { border-right: 0; }
.facts dt { font-family: var(--font-label); font-size: .8rem; color: var(--ink-soft); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; font-size: .98rem; }
.desc { font-size: 1rem; overflow-wrap: anywhere; }
.desc img { max-width: 100%; height: auto; display: block; margin: 4px 0 10px; filter: grayscale(1); }
.desc p { margin: .5em 0; }

/* ---------- story steps ---------- */
.step-head { font-family: var(--font-fell); font-weight: 400; font-size: 1.75rem; line-height: 1.2; margin: 6px 0 12px; }
.step p { margin: 0 0 .8em; }
.step figure { margin: 14px 0; border: 6px solid var(--ochre); background: var(--ochre); }
.step figure img { display: block; width: 100%; height: auto; filter: grayscale(1) contrast(1.05); }
.step figcaption { padding: 5px 4px 0; font-family: var(--font-fell); font-style: italic; font-size: .95rem; color: #fff; }
.step-quote { margin: 14px 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--ochre); font-family: var(--font-fell); font-style: italic; }
.step-nav { display: flex; justify-content: space-between; gap: 8px; margin: 18px 0 6px; }
.step-nav button:hover { color: var(--ochre); }
.step-source { font-size: .8rem; color: var(--ink-soft); }

/* ---------- map marks: plain serif labels with a paper halo, as on Bell's maps ---------- */
.leaflet-tooltip.tip { font-family: var(--font-fell); font-size: .9rem; padding: 2px 7px; border: var(--line); border-radius: 2px; box-shadow: none; color: var(--ink); background: var(--paper); }
.leaflet-tooltip.tip::before { display: none; }
.leaflet-tooltip.site-label, .leaflet-tooltip.centre-label {
  font-family: var(--font-fell); font-size: .82rem; padding: 0; background: none; border: 0; box-shadow: none; color: var(--ink); white-space: nowrap;
  text-shadow: 0 0 2px var(--paper), 0 0 3px var(--paper), 0 0 4px var(--paper), 0 0 5px var(--paper);
}
.leaflet-tooltip.centre-label { font-family: var(--font-label); font-size: 1rem; }
.leaflet-tooltip.site-label::before, .leaflet-tooltip.centre-label::before { display: none; }
.leaflet-tooltip.triangle-label { font-family: var(--font-fell); font-style: italic; font-size: .9rem; background: none; border: 0; box-shadow: none; color: var(--ochre); padding: 0; text-shadow: 0 0 3px var(--paper), 0 0 4px var(--paper); }
.leaflet-tooltip.triangle-label::before { display: none; }


/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  /* most of the screen: halfway between 60% and filling it bar a peek of the Layers below */
  .map-panel { position: relative; top: 0; height: calc(80vh - var(--mast-h) / 2 - 36px); height: calc(80svh - var(--mast-h) / 2 - 36px); min-height: 360px; border-right: 0; border-bottom: var(--line); }
  .side-panel { padding: 0 16px 24px; }
  .rays { max-width: 460px; margin-left: auto; margin-right: auto; }
}
@media (max-width: 620px) {
  summary .n { white-space: nowrap; }
  .map-reset { font-size: .92rem; top: 10px; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.centre-icon svg { display: block; width: 100%; height: 100%; overflow: visible; }
.centre-icon .halo { fill: var(--paper); stroke: var(--ochre); stroke-width: 2; }
.centre-icon .disc { fill: var(--ink); }
.centre-icon.is-faded { opacity: .25; }
.centre-icon.is-sel .disc { fill: var(--ochre); }
.centre-icon.is-sel .halo { stroke: var(--ink); }
.layer-note { margin: -4px 0 6px 26px; font-size: .88rem; font-style: italic; color: var(--ink-soft); line-height: 1.35; }

.steps-nav { margin: 0; padding: 0; border: 0; }
.legend { list-style: none; margin: 0 0 12px; padding: 0; }
.legend li { display: flex; align-items: center; gap: 12px; padding: 4px 0; line-height: 1.3; }
.legend .swatch { width: 26px; }
.legend .swatch.dot-line { border-top-style: dotted; }
.tri-ico { width: 26px; height: 16px; flex: none; background: rgba(217, 138, 28, .25); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.overview { padding-top: 4px; }
.filter { flex: 1 1 100%; margin-bottom: 4px; }
.filter input { width: 100%; font: inherit; font-size: 1rem; padding: 7px 10px; border: var(--line); border-radius: 2px; background: #fff; }
.filter input::placeholder { color: var(--ink-soft); }
.commons { margin: 0 0 12px; }
.commons img { display: block; width: 100%; height: auto; filter: grayscale(1); }
.commons figcaption { margin-top: 4px; font-size: .8rem; font-style: italic; color: var(--ink-soft); line-height: 1.3; }
.search-group { padding: 8px 2px 2px; font-family: var(--font-label); font-size: .9rem; color: var(--ochre); border-bottom: 1px solid var(--rule-soft); }
.about-ico { width: 16px; flex: none; text-align: center; font-size: 1.1rem; color: var(--ochre); }
.img-credit { display: block; margin: -6px 0 10px; font-size: .78rem; font-style: italic; color: var(--ink-soft); line-height: 1.3; }
.img-link { display: inline-block; margin: 4px 0 10px; font-style: italic; font-size: .9rem; }
