/* Colours are the app's own (src/ui/theme.ts). */
:root {
  --ground: #F2F4F8; --surface: #FFFFFF; --text: #121525; --muted: #5A6072;
  --border: #E4E7F0; --border-strong: #C4CAD9; --action: #111E6C; --action-soft: #E4E7F5;
  --attention: #7A4200; --attention-bg: #F7E7CE;
  --pin-ring: #111E6C; --pin-head: #FBFAF3; --pin-surveyed: #3E4760;
  font-family: -apple-system, 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font-size: 15px; line-height: 1.5; display: flex; flex-direction: column; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }

.top { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; font-size: 18px; }
.tagline { margin: 0; color: var(--muted); font-size: 14px; }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 360px; }
#map { min-height: 0; }
.panel { background: var(--surface); border-left: 1px solid var(--border); padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.panel h1 { font-size: 18px; margin: 0; }
.status { margin: 0; color: var(--muted); }

.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 10px; }
.swatch { display: inline-block; border-radius: 50%; flex: none; }
.swatch.open { width: 18px; height: 18px; background: var(--pin-head); border: 3px solid var(--pin-ring); }
.swatch.done { width: 12px; height: 12px; margin: 0 3px; background: var(--pin-surveyed); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); }

.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.list li { border-bottom: 1px solid var(--border); }
.list button { width: 100%; text-align: left; background: none; border: 0; padding: 10px 4px; font: inherit; color: inherit; cursor: pointer; display: grid; gap: 2px; min-height: 44px; }
.list button:hover { background: var(--ground); }
.list .name { font-weight: 600; }
.list .meta { color: var(--muted); font-size: 13.5px; }

.note { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--action-soft); color: var(--action); font-size: 14px; }
.error { background: var(--attention-bg); color: var(--attention); }

.overview { display: flex; flex-direction: column; gap: 12px; }
.overview[hidden], .detail[hidden] { display: none; }

/* One place: the app's place screen, as cards in the side panel. */
.detail { display: flex; flex-direction: column; gap: 12px; }
.detail h2 { font-size: 20px; line-height: 1.3; margin: 0; }
.detail h2:focus { outline: none; }
.detail h3 { font-size: 13.5px; font-weight: 600; color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: .03em; }
.detail p { margin: 0; }
.detail-body { display: flex; flex-direction: column; gap: 12px; }
.detail-sub { color: var(--muted); margin-top: -8px !important; }
.back, .link { align-self: flex-start; background: none; border: 0; padding: 0; font: inherit; color: var(--action); font-weight: 600; cursor: pointer; min-height: 44px; }
.link { min-height: 0; text-align: left; }
.back::before { content: '‹ '; }
.card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.card h3 { margin: 0; }
.detail a { color: var(--action); font-weight: 600; overflow-wrap: anywhere; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.facts a { display: inline-block; min-height: 24px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.visit { color: var(--muted); font-size: 13.5px; }
.thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.thumb { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--ground); cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover img { opacity: .85; }
.credit { color: var(--muted); font-size: 13.5px; }
.inside-list { list-style: none; margin: 0; padding: 0; }
.inside-list li + li { border-top: 1px solid var(--border); }
.inside-list button { width: 100%; text-align: left; background: none; border: 0; padding: 8px 0; font: inherit; color: inherit; cursor: pointer; display: grid; gap: 2px; min-height: 44px; }
.inside-list .name { font-weight: 600; }
.inside-list .meta { color: var(--muted); font-size: 13.5px; }

/* The opened place, ringed on the map. */
.selected-pin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--action); box-shadow: 0 0 0 3px #fff; pointer-events: none; }

/* The photo viewer: the photo as large as the screen allows, the credit under it. */
.viewer { border: 0; padding: 0; width: min(960px, 100vw); max-width: 100vw; max-height: 100dvh; background: #0B0D16; color: #fff; border-radius: 12px; }
.viewer::backdrop { background: rgba(8, 10, 20, .8); }
.viewer-bar, .viewer-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; }
.viewer-figure { margin: 0; display: flex; flex-direction: column; }
.viewer-figure img { width: 100%; max-height: calc(100dvh - 190px); object-fit: contain; display: block; background: #000; }
.viewer figcaption { padding: 10px 14px 0; display: grid; gap: 4px; font-size: 14px; }
.viewer .credit { color: #C9CDE0; }
.viewer a { color: #fff; }
.viewer-btn { background: rgba(255, 255, 255, .12); color: #fff; border: 0; border-radius: 10px; padding: 0 14px; min-height: 44px; font: inherit; font-weight: 600; cursor: pointer; }
.viewer-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .22); }
.viewer-btn:disabled { opacity: .35; cursor: default; }
.viewer :focus-visible { outline-color: #fff; }

/* Phones: the map on top, the list under it. */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 58vh auto; }
  .panel { border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
  body { display: block; }
  #map { height: 58vh; }
  .viewer { border-radius: 0; width: 100vw; height: 100dvh; max-height: 100dvh; }
  .viewer[open] { display: flex; flex-direction: column; justify-content: space-between; }
}

/* ---------------------------------------------------------------------------
   Text pages (privacy, support). The same parts as the map page: the white
   header bar, white panels on the grey ground with a hairline border and 12px
   corners, 18px headings, muted secondary text, and the app's blue for links
   and notes. Shared here so every page stays in step.
   --------------------------------------------------------------------------- */
body.doc-page { display: block; height: auto; }
.top .brand a { color: inherit; text-decoration: none; }
.top nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 10px; color: var(--action); font-size: 14px; font-weight: 600; text-decoration: none; }
.top nav a:hover { background: var(--action-soft); }
.top nav a[aria-current="page"] { background: var(--action-soft); }

.page { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; display: grid; gap: 12px; }
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.sheet > :first-child { margin-top: 0; }
.sheet > :last-child { margin-bottom: 0; }
.page h1 { font-size: 20px; line-height: 1.3; margin: 0 0 4px; }
.page h2 { font-size: 18px; line-height: 1.35; margin: 0 0 8px; }
.page h3 { font-size: 15px; margin: 18px 0 4px; }
.page p, .page li { max-width: 68ch; }
.page p { margin: 0 0 10px; }
.page ul { margin: 0 0 10px; padding-left: 20px; }
.page li { margin-bottom: 6px; }
.page a { color: var(--action); font-weight: 600; }
.page code { font-size: 13.5px; background: var(--ground); padding: 1px 4px; border-radius: 4px; }
.meta { color: var(--muted); font-size: 14px; }

/* The "not final yet" notice and the open points inside the text. */
.note.draft { margin: 0; background: var(--attention-bg); color: var(--attention); }
.todo { background: var(--attention-bg); color: var(--attention); padding: 0 4px; border-radius: 4px; }

/* Tables read like the map list: rows divided by hairlines. */
.page table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 4px 0 10px; }
.page th, .page td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-top: 1px solid var(--border); }
.page th { color: var(--muted); font-weight: 600; font-size: 13.5px; }

.page-foot { color: var(--muted); font-size: 14px; text-align: center; padding: 8px 0 0; }

/* Phones: each table row becomes a small block, labelled by its column. */
@media (max-width: 760px) {
  .top nav { margin-left: 0; width: 100%; }
  .sheet { padding: 16px; }
  .page thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .page table, .page tbody, .page tr, .page td { display: block; width: 100%; }
  .page tr { border-top: 1px solid var(--border); padding: 8px 0; }
  .page td { border: 0; padding: 2px 0; }
  .page td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
}
