/* Rockport map page: the game's menu look (see ../mw.css) around the game's own map */

.map-main { padding: 78px clamp(12px, 3vw, 40px) 40px; max-width: 1640px; margin: 0 auto; }
.map-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 30px; flex-wrap: wrap; margin: 0 0 16px; }
.map-head .crumb { margin: 0 0 8px; }
.map-head h1 { margin: 0; line-height: 0; }
.map-head h1 img { height: clamp(40px, 5vw, 60px); width: auto; }
.map-head .sub { max-width: 520px; margin: 0; color: var(--mute); font-size: 15px; }

.map-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }

/* legend: one of the game's menu windows */
.legend { position: sticky; top: 74px; max-height: calc(100svh - 86px); display: flex; flex-direction: column; }
.legend .mw-head { justify-content: space-between; padding: 8px 10px 8px 14px; }
.legend h2 { margin: 0; line-height: 0; }
.legend h2 img { height: 22px; width: auto; }
.all { display: flex; gap: 6px; }
.all button, .zoom button {
  font: 700 13px var(--cond); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); cursor: pointer;
  padding: 4px 9px; border: 1px solid var(--tan); background: var(--night);
}
.all button:hover, .zoom button:hover { background: var(--amber); border-color: var(--amber); color: #120d04; }

.layers { list-style: none; margin: 0; padding: 6px 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--tan) transparent; }
.layers button {
  width: 100%; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  padding: 6px 14px; border: 0; background: transparent; color: var(--ink);
  font: 600 16px var(--cond); letter-spacing: .06em; text-transform: uppercase;
}
.layers button:hover, .layers button:focus-visible { background: var(--amber); color: #120d04; outline: none; }
.layers button:hover .count { color: #120d04; }
.layers button[aria-pressed="false"] { color: #6d6556; }
.layers button[aria-pressed="false"] .sw { opacity: .3; filter: grayscale(1); }
.layers button[aria-pressed="false"] .name { text-decoration: line-through; }
.layers .count { font-size: 14px; color: var(--tan); }
.layers .sep { margin: 8px 14px 4px; padding-top: 8px; border-top: 1px solid var(--line); font: 700 13px var(--cond); letter-spacing: .2em; text-transform: uppercase; color: var(--amber); grid-column: 1 / -1; }
.sw { width: 30px; height: 22px; display: grid; place-items: center; }
.sw img { width: 22px; height: 22px; }
.sw svg { width: 26px; height: 22px; overflow: visible; }

.index { border-top: 1px solid var(--line); padding: 10px 14px 4px; }
.index summary { cursor: pointer; line-height: 0; list-style: none; display: flex; align-items: center; gap: 8px; }
.index summary::before { content: "▶"; color: var(--amber); font-size: 10px; line-height: 1; }
.index[open] summary::before { content: "▼"; }
.index summary img { height: 18px; width: auto; }
.index ol { list-style: none; margin: 10px 0 0; padding: 0; max-height: 40svh; overflow: auto; font-size: 14px; scrollbar-width: thin; scrollbar-color: var(--tan) transparent; }
.index li button { all: unset; cursor: pointer; display: flex; gap: 8px; width: 100%; padding: 3px 6px; color: var(--ink); box-sizing: border-box; }
.index li button:hover, .index li button:focus-visible { background: var(--amber); color: #120d04; }
.index li b { min-width: 24px; color: var(--amber); font: 700 15px var(--cond); }
.index li button:hover b { color: #120d04; }
.index .note { font-size: 12.5px; color: var(--mute); margin: 10px 0 6px; }

/* the map inside a menu window frame */
.map-frame { height: max(520px, calc(100svh - 196px)); border: 2px solid var(--tan); background: #0b0d14; }
.viewport { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; outline: none; }
.viewport.drag { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.world > img, .world > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }

.zoom { position: absolute; right: 12px; top: 12px; display: grid; gap: 6px; z-index: 3; }
.zoom button { width: 36px; height: 36px; padding: 0; font-size: 20px; letter-spacing: 0; }
.zoom button.wide { font-size: 12px; letter-spacing: .04em; }
.zoom button.ico { display: grid; place-items: center; }
.zoom .ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: square; }
.zoom .ico svg .fill { fill: currentColor; stroke: none; }
#fullscreen .close, #fullscreen.on .open { display: none; }
#fullscreen.on .close { display: inline; }

/* legend fold */
.all .fold { width: 28px; padding: 4px 0; font-size: 16px; line-height: 1; }
.legend.folded .layers, .legend.folded .index { display: none; }

/* full screen: the map fills the screen, the legend floats in the top left corner.
   The browser's own full screen, or (no API, e.g. iPhone) the same block covering the page. */
.map-wrap:fullscreen, .map-wrap.max { display: block; background: #0b0d14; }
.map-wrap.max { position: fixed; inset: 0; z-index: 50; }
.map-wrap:fullscreen .map-frame, .map-wrap.max .map-frame {
  position: absolute; inset: 0; width: auto; height: auto; max-width: none; max-height: none; aspect-ratio: auto; margin: 0; border: 0;
}
.map-wrap:fullscreen .map-frame::before, .map-wrap.max .map-frame::before { display: none; }
.map-wrap:fullscreen .legend, .map-wrap.max .legend {
  position: absolute; top: 18px; left: 18px; z-index: 5; width: min(300px, calc(100% - 90px)); max-height: calc(100% - 36px);
}
.map-wrap:fullscreen .legend.folded, .map-wrap.max .legend.folded { width: auto; }
html.map-max, html.map-max body { overflow: hidden; }
.zoom button[disabled] { opacity: .5; cursor: progress; }

.tip {
  position: absolute; z-index: 4; pointer-events: none; transform: translate(-50%, calc(-100% - 14px));
  padding: 6px 12px; white-space: nowrap; font: 600 15px var(--cond); letter-spacing: .04em; color: var(--ink);
  background: var(--night); border: 1px solid var(--tan); border-left: 4px solid var(--amber);
}
.tip b { color: var(--amber); font-weight: 700; text-transform: uppercase; }
.tip small { display: block; color: var(--mute); font: 400 12px var(--body); white-space: normal; max-width: 320px; }

.credits { margin: 18px 0 30px; color: var(--mute); font-size: 13px; text-align: center; }

/* ---------- SVG layers ---------- */
#svg { overflow: visible; }
#svg .hood { fill-opacity: .2; stroke-width: calc(var(--u) * 2.5px); stroke-linejoin: round; }
#svg .hood:hover { fill-opacity: .32; }
#svg .street path { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: min(20px, calc(var(--u) * 14px)); stroke-opacity: .5; }
#svg .street:hover path, #svg .street.hl path { stroke-opacity: .95; }
#svg .street .hit { stroke: transparent; stroke-width: calc(max(28px, var(--u) * 14px)); stroke-opacity: 0; }
#svg text { font-family: var(--body); paint-order: stroke; stroke: #07080d; stroke-linejoin: round; pointer-events: none; }
#svg .pin { transform: translate(calc(var(--x) * 1px), calc(var(--y) * 1px)) scale(var(--u)); }
#svg .pin .shape { stroke: #08080c; stroke-width: 2.5; }
#svg .pin .shape.thin { stroke-width: 1.5; }
#svg .pin:hover { filter: drop-shadow(0 0 4px #fff); }
#svg .lbl-hood { font-weight: 700; font-size: 14px; letter-spacing: .04em; stroke-width: 4px; }
#svg .lbl-boro { font-weight: 700; font-size: 150px; fill: #fff; stroke-width: 22px; letter-spacing: .02em; }
#svg .lbl-lm { font-size: 11.5px; font-weight: 500; fill: #f0f0f0; stroke-width: 3.5px; }
#svg .lbl-place { font-size: 12.5px; font-weight: 700; font-style: italic; fill: #ffd27a; stroke-width: 3.5px; letter-spacing: .02em; }
#svg .lbl-nz { font-weight: 700; font-size: 11px; fill: #e6e6e6; stroke-width: 3.5px; letter-spacing: .1em; }
#svg .lbl-street { font-weight: 600; fill: #fff; stroke-width: calc(var(--u) * 3.5px); font-size: calc(var(--u) * 11px); letter-spacing: .03em; }
/* names wait until there is room for them */
.viewport:not(.z2) #svg .g-streetnames, .viewport:not(.z1) #svg .lbl-lm { display: none; }

@media (max-width: 980px) {
  .map-wrap { grid-template-columns: 1fr; }
  .legend { position: relative; top: 0; max-height: none; order: 2; }
  .layers { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .map-frame { height: auto; aspect-ratio: 1; max-height: 82svh; margin: 0 auto; width: 100%; max-width: 82svh; }
}
@media (max-width: 620px) {
  .map-main { padding-top: 70px; }
  .layers { grid-template-columns: 1fr 1fr; }
  .layers button { grid-template-columns: 24px 1fr; gap: 8px; padding: 7px 8px; font-size: 14px; }
  .layers .count { display: none; }
  .zoom { top: auto; bottom: 10px; right: 10px; }
  .zoom button { width: 32px; height: 32px; font-size: 17px; }
}
