/* Helios V2 client. Colours are tokens on :root (light), redefined for dark mode.
   The navy/teal/coral family comes from the V1 dark theme. On the map, the drawn
   boundary is blue and the venue dots are red, each with its own dark-mode value. */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --border: #d5dae5;
  --text: #1a1a2e;
  --muted: #535b70;
  --link: #0f3460;
  --accent: #1f7a62;
  --alert: #b3263f;
  --focus: #2a78d6;

  --map-area: #1c5cab;
  --map-venue: #b3263f;

  --radius: 8px;
  --gutter: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a2e;
    --surface: #16213e;
    --surface-2: #0f3460;
    --border: #2b3a5e;
    --text: #e0e0e0;
    --muted: #a4adbf;
    --link: #8ce0c3;
    --accent: #4ecca3;
    --alert: #ff7a8f;
    --focus: #6da7ec;

    --map-area: #6da7ec;
    --map-venue: #ff7a8f;
  }
  /* OSM tiles are light; dim and invert them so the dark page has a dark map. */
  .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.85); }
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--link); }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
code { font-size: 0.9em; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.site-header {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 12px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.brand-sub { font-weight: 400; color: var(--muted); font-size: 0.95rem; margin-left: 4px; }
nav { display: flex; gap: 16px; }
nav a { text-decoration: none; padding: 4px 0; }
nav a[aria-current] { font-weight: 700; border-bottom: 2px solid var(--accent); }

main { max-width: 1100px; margin: 0 auto; padding: 16px var(--gutter) 48px; }
main:focus { outline: none; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 1.2rem; margin: 24px 0 8px; }

.loading { color: var(--muted); }
.error { background: var(--surface); border: 1px solid var(--alert); border-radius: var(--radius); padding: 16px; }
.error h1 { color: var(--alert); }
.trace-id { user-select: all; }

.headline {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.headline p { margin: 4px 0; }
.headline-figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.figure { font-size: 2.5rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.figure-label { color: var(--muted); }

.map { height: min(65vh, 560px); min-height: 320px; border-radius: var(--radius); border: 1px solid var(--border); }
.leaflet-container { font: inherit; background: var(--surface-2); }
/* While drawing, the map takes clicks as corners, not as the start of a drag. */
.map.drawing.leaflet-grab, .map.drawing .leaflet-interactive { cursor: crosshair; }
.draw-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.draw-status { min-height: 1.5em; margin: 0 0 8px; }
.area-results { margin-top: 16px; }
.area-results:focus, .area-results h2:focus { outline: none; }
.leaflet-tooltip { background: var(--surface); color: var(--text); border-color: var(--border); }
.area-summary h2, .area-summary h3 { margin: 0 0 4px; }
.area-section { margin-top: 24px; }
.area-section h3 { font-size: 1.1rem; margin: 0 0 4px; }
.area-section > p { margin: 4px 0; }
.item-search { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 8px 0; }
.item-search label { font-weight: 600; }
.item-search-row { display: flex; gap: 8px; flex: 1 1 280px; min-width: 0; max-width: 480px; }
.item-search input {
  flex: 1; min-width: 0; font: inherit; padding: 7px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.items.area-items { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 16px; margin: 8px 0 12px; }
.items.area-items:empty { display: none; }
.items.area-items.restaurant-results { background: none; border: 0; padding: 0; }
.restaurant-result { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin: 8px 0; }
.restaurant-title { cursor: pointer; min-height: 44px; padding: 10px 0; font-weight: 600; overflow-wrap: anywhere; }
.restaurant-match-count { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.restaurant-address { display: block; margin: 4px 0 0; color: var(--muted); font-weight: 400; overflow-wrap: anywhere; }
.restaurant-matches { margin-top: 8px; }

table { border-collapse: collapse; width: 100%; margin-top: 8px; font-size: 0.95rem; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-weight: 600; color: var(--muted); }

.crumbs { margin: 0 0 8px; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.button {
  font: inherit; min-height: 44px; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--link); cursor: pointer;
}
.button[aria-disabled="true"] { color: var(--muted); cursor: progress; }
.link-button { font: inherit; background: none; border: 0; padding: 2px 0; color: var(--link); cursor: pointer; text-align: left; text-decoration: underline; }
.filter { display: flex; align-items: center; gap: 4px; }
.area-stats { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }

.cards { list-style: none; margin: 8px 0 16px; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.card p { margin: 4px 0 0; }
.card-title { font-weight: 600; overflow-wrap: anywhere; }
.status { font-size: 0.85rem; color: var(--muted); }
.status-open { color: var(--accent); }
.status-closed { color: var(--alert); font-weight: 600; }

.venue-header p { margin: 4px 0; }
.resource-controls { margin: 8px 0 16px; }
.resource-controls > p { margin: 4px 0; }
.resource-controls .error { margin-top: 8px; }
.list-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.paged-list > p { margin: 4px 0; }
.paged-list > [tabindex]:focus { outline: none; }
.paged-list .error { margin-top: 8px; }
.coverage-note { color: var(--muted); }
.price-source { color: var(--muted); font-size: 0.8rem; }
.price-source summary { cursor: pointer; min-height: 28px; padding: 4px 0; }
.menu-content:focus { outline: none; }
.menu { margin-top: 24px; }
.menu-meta { color: var(--muted); margin: 0 0 8px; overflow-wrap: anywhere; }
.menu-page { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 20px; }
.toc { margin: 8px 0; }
.toc summary { cursor: pointer; color: var(--link); }
.toc ul { columns: 2 220px; margin: 8px 0; padding-left: 20px; }
.menu-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.menu-section h3 { margin: 0 0 8px; font-size: 1.1rem; }
.items { list-style: none; margin: 0; padding: 0; }
.item { padding: 8px 0; border-top: 1px solid var(--border); }
.item:first-child { border-top: 0; }
.item-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.item-name { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.item-desc { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.prices { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.price { display: flex; flex-direction: column; align-items: flex-end; }
.amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.amount-none { font-weight: 400; color: var(--muted); font-style: italic; }
.price-context { font-size: 0.8rem; color: var(--muted); }
.price-meta { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.source-kind { text-decoration: underline dotted; cursor: help; }
.trail-link { font-size: 0.8rem; }
.options { margin: 4px 0 0 16px; }
.options-title { margin: 4px 0 0; font-size: 0.85rem; color: var(--muted); }
.options ul { list-style: none; margin: 0; padding: 0; }
.option { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; padding: 4px 0; }
.option-name { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }

.table-scroll { overflow-x: auto; }
.trail-table table { min-width: 640px; }

.prose { max-width: 70ch; }
.prose h2 { margin-top: 28px; }

@media (max-width: 480px) {
  .figure { font-size: 2rem; }
  .menu-section { padding: 10px 12px; }
  .item-head, .option { flex-direction: column; }
  .item-name, .option-name { flex: none; }
  .items.area-items { padding: 0 12px; }
  .prices, .price { align-items: flex-start; text-align: left; }
  .price-meta { white-space: normal; }
  /* The trail table stacks: one block per row, each cell labelled. */
  .trail-table table { min-width: 0; }
  .trail-table thead { display: none; }
  .trail-table tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .trail-table td { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px; border: 0; padding: 2px 0; text-align: left; }
  .trail-table td::before { content: attr(data-label); color: var(--muted); font-weight: 600; }
  .options { margin-left: 8px; }
  h1 { font-size: 1.3rem; }
  th, td { padding: 6px 4px; }
}
