/* "See it on a map" on /area/ (area/map.mjs). Loaded after styles.css, tools.css and area.css, and only by
 * area/index.html: the per-area pages never draw the map. No @import, no URL of any kind. The five greens and the
 * no-figure grey are the design's (owner-agreed mock, 2026-11-06); tests/area-map.test.mjs checks the contrast of
 * every text colour here against the background it sits on. */

.map-band [hidden] { display: none; }

.map-panel {
  background: var(--paper); border: 1px solid #e3dccd; border-radius: 12px;
  padding: 28px 28px 24px; display: flex; flex-direction: column; gap: 18px;
}
.map-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.map-intro { max-width: 640px; }
.map-band h2 { font: 400 clamp(1.6rem, 2.6vw, 2.25rem)/1.15 var(--serif); letter-spacing: 0; margin: 0 0 4px; max-width: none; }
.map-lead { margin: 0; color: #3d4f49; }

/* The measure: two real buttons, pressed or not. 44px tall at least, so a thumb can take either. */
.map-measure { display: flex; flex-wrap: wrap; border: 1px solid var(--green); border-radius: 999px; overflow: hidden; }
.map-measure button, .map-views button, .map-card button, .map-fail button {
  min-height: 44px; font: inherit; font-size: 15px; cursor: pointer;
}
.map-measure button { padding: 8px 18px; border: 0; background: var(--paper); color: var(--green); }
.map-measure button[aria-pressed="true"] { background: var(--green); color: var(--paper); font-weight: 600; }
.map-measure button:disabled { background: #e9efe9; color: #5b6a64; font-weight: 400; cursor: default; }
.map-band button:focus-visible, .map-band a:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }

/* The state choice: one real button per state, pressed or not, under the lead. 44px tall, as every control here. */
.map-states { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.map-states button {
  min-height: 44px; font: inherit; font-size: 15px; cursor: pointer; padding: 8px 14px; border-radius: 8px;
  border: 1px solid #c9c1b0; background: var(--paper); color: #3d4f49;
}
.map-states button[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: var(--paper); font-weight: 600; }

/* "Greater Sydney / All of NSW": a phone shows one drawing at a time. A wider screen shows both, so no toggle. */
.map-views { display: none; gap: 8px; }
.map-views button { flex: 1 1 0; border-radius: 8px; border: 1px solid #c9c1b0; background: var(--paper); color: #3d4f49; }
.map-views button[aria-pressed="true"] { border-color: var(--green); background: var(--mint); color: var(--ink); font-weight: 600; }

.map-body { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.map-nsw-fig { flex: 999 1 560px; min-width: 0; }
.map-side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.map-fig { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.map-fig figcaption { font-size: 13px; color: #5b6a64; }
.map-pinch { display: none; }

.map-frame { border-radius: 8px; border: 1px solid #ece6d9; background: #f3efe6; overflow: hidden; }
.map-band[aria-busy="true"] .map-frame-nsw { min-height: 460px; display: flex; align-items: center; justify-content: center; }
.map-band[aria-busy="true"] .map-frame-syd { min-height: 260px; }
.map-band[aria-busy="true"] .map-card { min-height: 150px; background: #f7f4ec; border-color: #ece6d9; }
.map-status { margin: 0; padding: 16px; color: #3d4f49; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.map-spin circle { fill: none; stroke: #b9c9c1; stroke-width: 2.5; }
.map-spin path { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; }
.map-spin { animation: map-turn 1s linear infinite; flex: none; }
@keyframes map-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .map-spin { animation: none; } }

/* The drawing. Outlines are not tab stops: the lookup and the list are the way in by keyboard. */
.map-svg { display: block; width: 100%; height: auto; overflow: hidden; }
.map-svg .pc { stroke: var(--paper); stroke-width: .6px; stroke-linejoin: round; fill-rule: evenodd; cursor: pointer; }
.map-svg .pc:hover { stroke: var(--ink); stroke-width: 1.2px; }
/* Coral alone is under 3:1 on the middle greens: a pale halo under it keeps the chosen outline visible on all six. */
.map-svg .halo { fill: none; stroke: var(--paper); stroke-width: 6px; stroke-linejoin: round; pointer-events: none; }
.map-svg .halo.off { stroke: none; }
.map-svg .pc.on { stroke: var(--coral); stroke-width: 2.5px; }
.m0 { fill: #e6f3ec; }
.m1 { fill: #b4dcc8; }
.m2 { fill: #74b89a; }
.m3 { fill: #36896b; }
.m4 { fill: #145c48; }
/* No figure (.mn) has no fill here on purpose: each outline carries its drawing's hatch as a fill attribute
   (area/map.mjs), which any rule here would outrank. The hatch's own colours: */
.hatch-ground { fill: #f4f0e8; }
.hatch-stripe { fill: #bdb3a1; }

/* The chosen postcode's card. aria-live, so a screen reader hears each choice. */
.map-card {
  border: 1px solid #cfe6da; background: #f1f9f4; border-radius: 10px; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px; color: #3d4f49;
}
.map-card p { margin: 0; }
.map-card-where { font-size: 13px; }
.map-card-figure { font: 34px/1.1 var(--serif); color: var(--ink); }
.map-card-unit { font: 16px var(--sans); color: #3d4f49; }
.map-card-line, .map-card-hint { font-size: 14px; }
.map-card-note { font-size: 14px; color: #8f3a22; }
.map-card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.map-open {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 8px;
  background: var(--green); color: var(--paper); text-decoration: none; font-weight: 600; font-size: 15px;
}
.map-copy { padding: 0 16px; border-radius: 8px; border: 1px solid var(--green); background: var(--paper); color: var(--green); }
.map-card-copied { font-size: 14px; }
.map-card-copied .link { display: block; overflow-wrap: anywhere; -webkit-user-select: all; user-select: all; }

.map-legend-title { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--ink); }
.map-legend-list {
  list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 16px; font-size: 14px; color: var(--ink);
}
.map-legend-list li { display: flex; align-items: center; gap: 8px; }
/* Every swatch carries a darker outline so each meets 3:1 against the panel (WCAG 1.4.11; review of #119): the three
   palest fills alone are about 1.1, 1.5 and 2.4:1, and the legend is the only key to what they mean. */
.map-legend-list .chip { flex: none; width: 18px; height: 14px; border-radius: 3px; border: 1px solid #6f8a7d; }
.map-legend-list .chip.m0 { background: #e6f3ec; }
.map-legend-list .chip.m1 { background: #b4dcc8; }
.map-legend-list .chip.m2 { background: #74b89a; }
.map-legend-list .chip.m3 { background: #36896b; }
.map-legend-list .chip.m4 { background: #145c48; }
.map-legend-list .chip.mn {
  background: repeating-linear-gradient(45deg, #f4f0e8 0 3px, #bdb3a1 3px 4.5px);
  border: 1px solid #857a67;
}

.map-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  border-top: 1px solid #ece6d9; padding-top: 14px;
}
.map-source { margin: 0; max-width: 760px; font-size: 13px; color: #5b6a64; overflow-wrap: anywhere; }
.map-list { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; color: var(--green); }

/* The map could not load. */
.map-fail {
  min-height: 380px; border-radius: 8px; border: 1px solid #f0c9bd; background: #fdf3ef; color: #3d4f49;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center;
}
.map-fail p { margin: 0; max-width: 520px; }
.map-fail-title { font-size: 18px; font-weight: 600; color: var(--ink); }
.map-fail-icon { width: 28px; height: 28px; }
.map-fail-icon circle { fill: none; stroke: #b9472b; stroke-width: 2.2; }
.map-fail-icon path { fill: none; stroke: #b9472b; stroke-width: 2.4; stroke-linecap: round; }
.map-fail-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }
.map-again { padding: 0 18px; border-radius: 8px; border: 0; background: var(--green); color: var(--paper); font-weight: 600; }
.map-fail .map-list {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 8px;
  border: 1px solid var(--green); text-decoration: none; font-size: 15px;
}

@media (max-width: 40rem) {
  .map-panel { padding: 18px 16px; gap: 14px; }
  .map-measure { flex-direction: column; border-radius: 10px; width: 100%; }
  .map-measure button { text-align: left; padding: 8px 14px; }
  .map-measure button + button { border-top: 1px solid var(--green); }
  .map-views { display: flex; }
  .map-band[data-show="syd"] .map-nsw-fig { display: none; }
  .map-band[data-show="nsw"] .map-syd-fig { display: none; }
  .map-band[aria-busy="true"][data-show="syd"] .map-nsw-fig { display: flex; }
  .map-band[aria-busy="true"] .map-syd-fig { display: none; }
  .map-band[aria-busy="true"] .map-frame-nsw { min-height: 300px; }
  .map-pinch { display: inline; }
  .map-legend-list { grid-template-columns: 1fr; }
  .map-states { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-states button { padding: 8px 10px; }
  .map-card-actions { flex-direction: column; }
  .map-open { justify-content: center; }
  .map-foot { flex-direction: column; }
}
