/* Cafe prices. Follows P&R's Signature design system (DESIGN.md in the signature repo):
   white canvas, navy type, Barlow, one 6 px radius, rules not boxes, no shadows. */
@font-face { font-family: 'Barlow'; src: url('fonts/barlow-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('fonts/barlow-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('fonts/barlow-condensed-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --canvas: #ffffff;
  --surface: #f5f5f3;
  --navy: #1c355e;
  --muted: #444441;
  --rule: #dcdbd7;
  --rule-strong: #888780;
  --teal: #00af90;
  --red: #eb3300;
  --radius: 6px;
  --tap: 44px;
  --gutter: 16px;
  --measure: 1120px;
  /* Data colours: identity of each group in charts and the map only. Validated for colour blindness. */
  --c-global: #3a6ea5;
  --c-australia: #eb3300;
  --c-reference: #008c73;
  --font: 'Barlow', Arial, sans-serif;
  --font-display: 'Barlow Condensed', 'Barlow', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--navy);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
h1, h2, h3 { color: var(--navy); line-height: 1.1; margin: 0 0 12px; font-weight: 600; }
h1 { font-family: var(--font-display); font-size: clamp(2rem, 7vw, 2.75rem); line-height: 1.05; max-width: 18em; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 12px; }
strong { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; display: inline-flex; align-items: center; min-height: var(--tap); padding: 8px 12px; background: var(--canvas); border: 1px solid var(--rule-strong); border-radius: var(--radius); z-index: 1100; }
.skip-link:focus { left: 8px; }
.lead { color: var(--muted); max-width: 40em; font-size: 1.125rem; }
.meta, .note { color: var(--muted); font-size: 0.9375rem; }
.small { font-size: 0.875rem; color: var(--muted); }

/* Header */
.app-header { border-bottom: 1px solid var(--rule); }
.app-header__inner { max-width: var(--measure); margin: 0 auto; padding: 8px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); text-decoration: none; }
.brand__mark { width: 32px; height: 32px; border-radius: var(--radius); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-weight: 600; font-size: 1.0625rem; }
.brand__by { font-size: 0.875rem; color: var(--muted); }
.topnav { display: flex; gap: 4px; }
.topnav a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 8px; text-decoration: none; color: var(--muted); position: relative; }
.topnav a:hover { color: var(--navy); }

/* Page */
.page { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); }
.intro { padding: 32px 0 8px; }
.section { padding-top: 32px; margin-top: 32px; border-top: 1px solid var(--rule); }
.section__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 4px; }
.section__head h2 { margin: 0; }

/* Headline figures: three numbers separated by rules, no boxes */
.figures { display: grid; grid-template-columns: repeat(3, 1fr); margin: 24px 0 0; border-top: 1px solid var(--rule); }
.figure { padding: 16px 16px 16px 0; }
.figure + .figure { padding-left: 16px; border-left: 1px solid var(--rule); }
.figure dt { color: var(--muted); font-size: 0.9375rem; }
.figure dd { margin: 0; }
.figure__value { display: block; font-family: var(--font-display); font-weight: 600; font-size: clamp(2rem, 6vw, 2.75rem); line-height: 1.1; font-variant-numeric: tabular-nums; }
.figure__sub { display: block; color: var(--muted); font-size: 0.9375rem; }

/* Segmented control: secondary buttons, selected is navy fill */
.segmented { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: var(--radius); }
.segmented button:first-child { border-radius: 5px 0 0 5px; }
.segmented button:last-child { border-radius: 0 5px 5px 0; }
.segmented button { min-height: var(--tap); padding: 0 16px; border: 0; background: var(--canvas); font-weight: 600; font-size: 0.9375rem; color: var(--navy); }
.segmented button + button { border-left: 1px solid var(--rule-strong); }
.segmented button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.segmented button:focus-visible { outline: 3px solid var(--navy); outline-offset: -3px; }
.segmented button[aria-pressed="true"]:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; position: relative; z-index: 1; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.9375rem; color: var(--muted); margin: 0 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch, .dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.dot { margin-right: 8px; vertical-align: 1px; }

/* Chart */
#chart svg { width: 100%; height: auto; font-family: var(--font); }
#chart .bar { cursor: pointer; }
#chart .bar:hover .mark, #chart .bar:focus .mark { opacity: .8; }
#chart .bar:focus { outline: none; }
#chart .bar:focus .hit { stroke: var(--navy); stroke-width: 3; }
#chart .bar:hover .label, #chart .bar:focus .label { text-decoration: underline; }
.tip { position: fixed; pointer-events: none; background: var(--canvas); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 8px 10px; font-size: 0.9375rem; z-index: 1000; max-width: 260px; color: var(--navy); }
.tip strong { display: block; }

/* Map: P&R greys for land, data colours for cities, no street tiles */
#map { height: 460px; border-radius: var(--radius); border: 1px solid var(--rule); background: #ffffff; z-index: 0; }
.leaflet-container { font-family: var(--font); background: #ffffff; }
.leaflet-container a { color: var(--navy); }
.leaflet-container svg, .leaflet-container img { max-width: none !important; }
.leaflet-bar a, .leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-size: 20px; color: var(--navy); }
.leaflet-bar, .leaflet-touch .leaflet-bar { border: 1px solid var(--rule-strong); border-radius: var(--radius); box-shadow: none; }
.leaflet-control-attribution { font-size: 0.75rem; background: rgba(255,255,255,.85) !important; }
.leaflet-tooltip.map-label { visibility: hidden; background: transparent; border: 0; box-shadow: none; padding: 0 4px; color: var(--navy); font-size: 0.875rem; font-weight: 400; white-space: nowrap; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; }
.leaflet-tooltip.map-label b { font-weight: 600; font-variant-numeric: tabular-nums; }
.leaflet-tooltip.map-label::before { display: none; }
#map.show-labels .leaflet-tooltip.map-label { visibility: visible; }
#map.show-labels .leaflet-tooltip.map-label.is-hidden { visibility: hidden; }
@media (max-width: 560px) { .leaflet-tooltip.map-label { line-height: 1.2; } .leaflet-tooltip.map-label b { display: block; } .leaflet-tooltip.map-label--left { text-align: right; } .leaflet-tooltip.map-label--top, .leaflet-tooltip.map-label--bottom { text-align: center; } }
.map-pop .leaflet-popup-content-wrapper { border-radius: var(--radius); box-shadow: none; border: 1px solid var(--rule-strong); }
.map-pop .leaflet-popup-tip { box-shadow: none; border: 1px solid var(--rule-strong); }
.map-pop .leaflet-popup-content { margin: 12px 16px; font-size: 0.9375rem; color: var(--navy); min-width: 180px; }
.map-pop p { margin: 0 0 4px; }
.pop-city { font-weight: 600; }
.pop-price { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; line-height: 1.1; }
.pop-price span { font-family: var(--font); font-weight: 400; font-size: 0.9375rem; color: var(--muted); }
.pop-meta { color: var(--muted); }
.pop-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.map-pop a.leaflet-popup-close-button { width: 44px; height: 44px; font-size: 22px; line-height: 44px; color: var(--muted); }
.map-caption { font-weight: 600; margin: 8px 0 4px; max-width: 40em; }
.map-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; }
.segmented--scroll { max-width: 100%; }
.segmented--scroll button { white-space: nowrap; }
@media (max-width: 720px) {
  .segmented--scroll { display: grid; grid-template-columns: repeat(6, 1fr); width: 100%; border: 0; gap: 8px; overflow: visible; }
  .segmented--scroll button { grid-column: span 2; }
  .segmented--scroll button:nth-child(n+4) { grid-column: span 3; }
  .segmented--scroll button { border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 0 8px; }
  .segmented--scroll button + button { border-left: 1px solid var(--rule-strong); }
  .segmented--scroll button:first-child, .segmented--scroll button:last-child { border-radius: var(--radius); }
}

/* Tables: rows separated by 1 px rules */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
th, td { text-align: left; padding: 12px 12px 12px 0; overflow-wrap: break-word; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; white-space: nowrap; border-bottom-color: var(--rule-strong); vertical-align: bottom; }
th:not([data-sort]) { padding-bottom: 23px; }
th[data-sort] button { font: inherit; font-weight: 600; background: none; border: 0; padding: 0; min-height: var(--tap); min-width: var(--tap); color: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px; }
th[aria-sort="ascending"] button::after { content: " \2191"; }
th[aria-sort="descending"] button::after { content: " \2193"; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num button { text-align: right; }
tbody tr:hover td { border-bottom-color: var(--rule-strong); }
tr.group-row td { padding-top: 20px; font-weight: 600; color: var(--muted); border-bottom-color: var(--rule-strong); }
td .city-link { font-weight: 600; }
td .country { display: block; color: var(--muted); font-size: 0.875rem; }

/* City page */
.city-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 16px; padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--rule); }
.city-head h2 { font-family: var(--font-display); font-size: clamp(1.75rem, 5vw, 2.25rem); margin: 0; }
.back { display: inline-flex; align-items: center; min-height: var(--tap); padding-right: 8px; font-weight: 600; }
.city-head h2:focus { outline: none; }
.answer { font-size: 1.125rem; max-width: 40em; margin-top: 12px; }
.city-facts { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 8px 32px; margin: 16px 0 8px; padding: 0; }
.city-facts div { margin: 0; }
.city-facts dt { color: var(--muted); font-size: 0.9375rem; }
.city-facts dd { margin: 0; font-weight: 600; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.city-facts div:first-child dd { font-family: var(--font-display); font-size: 2rem; line-height: 1.1; }
.notice { border-left: 3px solid var(--navy); padding: 4px 0 4px 12px; color: var(--muted); max-width: 44em; }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 16px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--canvas); color: var(--navy); font-weight: 600; text-decoration: none; }
.button--primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.button:hover { text-decoration: underline; }

/* Method */
.method ul { padding-left: 20px; max-width: 44em; }
.method li { margin-bottom: 8px; }
.fold { border-top: 1px solid var(--rule); margin-top: 16px; }
.fold summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 600; cursor: pointer; list-style: none; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "+"; margin-left: 12px; font-size: 1.25rem; }
.fold[open] summary::after { content: "\2212"; }

/* Footer */
.app-footer { margin-top: 48px; border-top: 1px solid var(--rule); font-size: 0.9375rem; }
.app-footer__inner { max-width: var(--measure); margin: 0 auto; padding: 32px var(--gutter); }
.app-footer__ask { padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--rule); max-width: 40em; font-size: 1.0625rem; }
.app-footer__ask a { font-weight: 600; }
.app-footer__logo { width: 160px; height: auto; margin-bottom: 12px; }
.app-footer__links { display: flex; flex-wrap: wrap; gap: 0 24px; }
.app-footer__links a { display: inline-flex; align-items: center; min-height: var(--tap); }
.app-footer p a { padding-block: 12px; }
.section p a, .app-footer a, .meta a { padding-block: 12px; }
.cite-block { border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; max-width: 44em; }
.cite-block p { margin: 0 0 12px; overflow-wrap: anywhere; }

.tiles[hidden], [hidden] { display: none !important; }

@media (min-width: 960px) {
  :root { --gutter: 32px; }
  .intro { padding-top: 48px; }
  .section { padding-top: 48px; margin-top: 48px; }
  #map { height: 480px; }
}
@media (max-width: 900px) {
  #map-regions { width: 100%; }
  #map-regions button { flex: 1 1 auto; }
}
@media (max-width: 860px) {
  .city-table .col-notes { display: none; }
  .city-table td { overflow-wrap: anywhere; }
}
@media (max-width: 720px) {
  .section { padding-top: 24px; margin-top: 24px; }
  .figures { grid-template-columns: 1fr; }
  .figure, .figure + .figure { padding: 12px 0; border-left: 0; border-bottom: 1px solid var(--rule); }
  .figure { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
  .figure dd { text-align: right; }
  .app-header__inner { flex-wrap: wrap; gap: 0 16px; padding-bottom: 0; }
  .topnav { width: 100%; margin-left: -8px; overflow-x: auto; }
  #map { height: 420px; }
  .col-local, .col-range, .col-tax { display: none; }
  .city-facts { grid-template-columns: repeat(2, auto); }
  .city-table .col-paid, .city-table .col-notes { display: none; }
  .city-table td:first-child { min-width: 7.5em; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print {
  .app-header, .app-footer, #map, .segmented, .skip-link { display: none; }
}
.city-table td .small { white-space: nowrap; }
td .city-link, .city-table td a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; margin: -12px 0; }
.city-table td.src a { display: flex; align-items: center; min-height: 44px; min-width: 44px; margin: -12px 0 -4px; line-height: 1.3; }
.city-table td.src .src-date { display: block; margin-top: 2px; }
.city-table td.src { line-height: 1.4; }

.swatch--dot { width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box; }
