/* Colours come from data/palette.css (exported from copy/palette.json). */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.95rem; margin-top: 0.9rem; }
p { margin: 0.4rem 0; }
a { color: var(--ink); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 0.5rem; top: -4rem; background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; z-index: 2000; }
.skip:focus { top: 0.5rem; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
#map:focus-visible { outline-offset: -4px; }

.top { padding: 0.6rem 1rem 0.5rem; border-bottom: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); }
.where { margin: 0 0 0.1rem; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.where-city { color: var(--teal); font-weight: 700; }
.place { width: auto !important; height: auto !important; margin: 0 !important; transform-origin: center;
  white-space: nowrap; font-size: 0.82rem; font-weight: 600; color: var(--place); letter-spacing: 0.04em;
  text-shadow: 0 0 2px var(--paper), 0 0 2px var(--paper), 0 0 3px var(--paper), 0 0 5px var(--paper); translate: -50% -50%; }
.place-water { font-style: italic; color: var(--teal); }
.series { margin: 0.1rem 0 0; font-size: 0.85rem; color: var(--ink-soft); }

.layout { display: flex; flex-direction: column; }
.mapcol { position: relative; }
#map { height: 62vh; min-height: 320px; background: var(--paper); }
.leaflet-container { background: var(--paper); font: inherit; }
.map-error { margin: 1rem; padding: 0.8rem; border: 2px solid var(--ink); background: var(--paper); }
.mapcol .map-error { position: absolute; inset: 1rem auto auto 1rem; z-index: 1000; }
.mapcredit { position: absolute; right: 0; bottom: 0; z-index: 1000; margin: 0; padding: 0 0.5rem;
  background: color-mix(in srgb, var(--paper) 92%, transparent); font-size: 0.8rem; color: var(--ink); }
.mapcredit a { display: inline-block; padding: 0.7rem 0.2rem; font-weight: 600; }
.credits:focus { outline: none; }
.street-map-control { width: 184px; padding: 6px; background: var(--paper); color: var(--ink);
  border: 1px solid var(--ink-soft); border-radius: 6px; font: 13px/1.4 system-ui, sans-serif; }
.street-map-control button { width: 100%; min-height: 44px; border: 1px solid var(--ink); border-radius: 4px;
  color: var(--ink); background: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.street-map-control button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.street-map-control button:disabled { opacity: 0.5; cursor: default; }
.street-map-control label { display: block; margin-top: 8px; }
.street-map-control output { float: right; font-variant-numeric: tabular-nums; }
.street-map-control input { display: block; width: 100%; margin: 0; min-height: 44px; accent-color: var(--teal); }
#street-map-credit a { display: inline; padding: 0; }
@media (max-width: 600px) {
  .mapcol:has(#street-map-credit:not([hidden])) .locator { bottom: 5.8rem; }
}
.leaflet-bar a, .leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-size: 22px; color: var(--ink); }
.dock-tip { background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: none; font-size: 0.85rem; padding: 2px 6px; }
.dock-tip::before { display: none; }

.panel { padding: 0.75rem 1rem 1.5rem; }
.panel > section, .panel > footer { margin-bottom: 1.1rem; }

.controls { padding: 0.75rem 1rem 0.6rem; }
.controls:focus { outline: none; }
.search { position: relative; }
.search label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
#q { width: 100%; min-height: 44px; font: inherit; padding: 0.5rem 0.7rem; color: var(--ink);
  background: #fff; border: 2px solid var(--ink); border-radius: 6px; }
#q-list { position: absolute; left: 0; right: 0; z-index: 1500; margin: 2px 0 0; padding: 0; list-style: none;
  background: #fff; border: 2px solid var(--ink); border-radius: 6px; max-height: 50vh; overflow-y: auto; }
#q-list li { min-height: 44px; padding: 0.55rem 0.7rem; cursor: pointer; border-bottom: 1px solid #ddd; }
#q-list li[aria-selected="true"] { background: var(--ink); color: #fff; }
.q-none { font-size: 0.9rem; color: var(--ink-soft); margin: 0.2rem 0 0; min-height: 0; }
.q-none:empty { display: none; }

.seg { border: 0; padding: 0; margin: 0.8rem 0 0; display: flex; flex-wrap: wrap; }
.seg legend { font-weight: 600; padding: 0; margin-bottom: 0.25rem; }
.seg label { flex: 1 1 0; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0.3rem 0.4rem;
  border: 2px solid var(--ink); margin-left: -2px; text-align: center; background: #fff; font-size: 0.95rem; }
.seg label:first-of-type span { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg label:last-of-type span { border-radius: 0 6px 6px 0; }
.seg input:checked + span { background: var(--ink); color: #fff; font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; position: relative; z-index: 1; }
.readout { font-weight: 600; margin-top: 0.5rem; }

.card { background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 0.8rem 1rem 1rem; }
.card-head { display: flex; align-items: flex-start; gap: 0.5rem; }
.card-head h2 { flex: 1; font-size: 1.15rem; padding-top: 0.55rem; }
.close { flex: none; width: 44px; height: 44px; font-size: 1.6rem; line-height: 1; background: transparent;
  border: 2px solid var(--ink); border-radius: 6px; color: var(--ink); cursor: pointer; }
.card-period { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0; }
.bf { font-weight: 600; }
button.link { font: inherit; color: var(--ink); background: none; border: 0; padding: 0.35rem 0; min-height: 44px;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; text-align: left; }
.bars { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.bars li { margin: 0 0 0.4rem; }
.bars .row { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.9rem; }
.bars .row span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bars .bar { height: 8px; background: var(--teal); border-radius: 2px; margin-top: 2px; }
.bars .bar.pink { background: var(--pink); }
.bars .bar.other { opacity: 0.55; }
.chosen { list-style: none; padding: 0; margin: 0.3rem 0 0; max-height: 14rem; overflow-y: auto;
  border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; }
.chosen:empty { display: none; }
.chosen li { border-bottom: 1px solid #eee; }
.chosen button.link { width: 100%; font-size: 0.95rem; }

.howto, .credits { font-size: 0.95rem; }
.key { list-style: none; padding: 0; margin: 0.5rem 0; }
.key li { display: flex; gap: 0.6rem; align-items: flex-start; margin-bottom: 0.45rem; }
.keymark { flex: none; width: 48px; height: 20px; margin-top: 2px; }
.k-thin { fill: none; stroke: var(--teal); stroke-width: 1.6; }
.k-thick { fill: none; stroke: var(--teal); stroke-width: 4.5; stroke-linecap: round; }
.keymark .pink { stroke: var(--pink); }
.small { font-size: 0.85rem; color: var(--ink-soft); }
.credits p { font-size: 0.85rem; }

/* phone: the card is a bottom sheet */
@media (max-width: 899.98px) {
  /* margin 0: the panel's section margin would lift a fixed card off the bottom edge */
  .card { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 !important; z-index: 1200; max-height: 46vh; overflow-y: auto;
    border-radius: 14px 14px 0 0; border-width: 2px 0 0; box-shadow: 0 -4px 16px rgba(0,0,0,0.18); }
  body.has-card .panel { padding-bottom: 48vh; }
  .chosen { max-height: 11rem; }
}

/* desktop: map left, side panel right */
@media (min-width: 900px) {
  body { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
  .layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 390px;
    grid-template-rows: auto minmax(0, 1fr); }
  .mapcol { grid-column: 1; grid-row: 1 / span 2; min-width: 0; }
  #map { height: 100%; }
  .controls, .panel { grid-column: 2; border-left: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); }
  .controls { grid-row: 1; padding: 0.75rem 1rem 0.5rem; }
  .panel { grid-row: 2; overflow-y: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.locator { position: absolute; right: 0.6rem; bottom: 2.2rem; width: 96px; height: auto; z-index: 1000; pointer-events: none;
  background: color-mix(in srgb, var(--paper) 88%, transparent); border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); padding: 4px; }
.loc-land { fill: var(--ink-soft); opacity: 0.7; }
.loc-ring { fill: none; stroke: var(--teal); stroke-width: 1.2; }
.loc-dot { fill: var(--teal); }
.loc-text { font: 700 7px system-ui, sans-serif; fill: var(--teal); paint-order: stroke; stroke: var(--paper); stroke-width: 2px; }
@media (max-width: 600px) { .locator { width: 66px; bottom: 4.2rem; } }
