/* playnewhope.com/map: side panel + Leaflet map. Uses the site's colours from site.css. Script: public/js/map.js */
.nhmap { --mp-gap: 0px; position: relative; z-index: 0; isolation: isolate; display: grid; grid-template-columns: 17.5rem minmax(0, 1fr); height: calc(100dvh - var(--mp-top, 4rem) - var(--mp-gap)); margin-top: var(--mp-gap); min-height: 26rem; border-top: 1px solid var(--line); }
html.xmas .nhmap { --mp-gap: 1.4rem; } /* room for the Christmas lights under the top bar */
/* The map fills the screen: no page scroll, no footer on this page */
body:has(.nhmap) { overflow: hidden; }
body:has(.nhmap) footer { display: none; }
.mp-side { background: var(--surface); border-right: 1px solid var(--line); padding: 0.85rem 0.9rem 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.55rem; }
.mp-sidehd { display: flex; align-items: center; justify-content: space-between; }
.mp-sidehd h1 { font-family: var(--display); font-size: 1.15rem; text-transform: uppercase; letter-spacing: 0.02em; margin: 0; }
.mp-close, .mp-open { display: none; }
.mp-lbl { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0.4rem 0 0; font-weight: 400; }
.mp-searchwrap { position: relative; }
.mp-search { width: 100%; font: inherit; font-size: 0.88rem; color: var(--fg); background: var(--bg, #110c0d); border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.45rem 0.65rem; }
.mp-search:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
.mp-results { position: absolute; left: 0; right: 0; top: calc(100% + 0.25rem); z-index: 1200; list-style: none; margin: 0; padding: 0.25rem; background: var(--raised); border: 1px solid var(--line); border-radius: 0.5rem; max-height: 20rem; overflow-y: auto; box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.5); }
.mp-results li { padding: 0.5rem 0.6rem; border-radius: 0.35rem; cursor: pointer; display: flex; flex-direction: column; }
.mp-results li:hover, .mp-results li:focus { background: var(--surface); outline: none; }
.mp-results li b { font-weight: 600; }
.mp-results li small, .mp-results li.none { color: var(--muted); font-size: 0.78rem; }
.mp-hint, .mp-fine { color: var(--muted); font-size: 0.7rem; margin: 0; line-height: 1.45; }
.mp-live { background: linear-gradient(135deg, #3a0f17, var(--raised)); border: 1px solid #ff454555; border-radius: 0.5rem; padding: 0.5rem 0.6rem; display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.8rem; }
.mp-live:empty { display: none; }
.mp-livehd { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.mp-live b { white-space: nowrap; font-family: var(--display); text-transform: uppercase; letter-spacing: 0.03em; color: #ff6b6b; }
.mp-live span { color: var(--muted); font-size: 0.74rem; text-align: right; }
.mp-next { color: var(--muted); font-size: 0.72rem; margin-top: -0.2rem; }
.mp-chips { display: flex; flex-wrap: wrap; gap: 0.2rem; max-height: 4.4rem; overflow-y: auto; }
.mp-chips button { font: inherit; font-size: 0.68rem; color: var(--fg); background: #ff30301f; border: 1px solid #ff454566; border-radius: 999px; padding: 0.05rem 0.45rem; cursor: pointer; }
.mp-chips button:hover { background: #ff303040; }
.mp-layers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.mp-layers h3 { margin: 0 0 0.15rem; font: 600 0.66rem var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.mp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem; }
.mp-sw { display: flex; align-items: center; gap: 0.45rem; min-width: 0; font: inherit; font-size: 0.8rem; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 0.35rem; padding: 0.28rem 0.4rem; cursor: pointer; text-align: left; }
.mp-sw:hover { background: var(--raised); color: var(--fg); }
.mp-sw[aria-checked="true"] { color: var(--fg); background: #ffffff0d; border-color: var(--line); }
.mp-sw i { flex: none; width: 0.8rem; height: 0.8rem; border-radius: 0.2rem; border: 2px solid var(--c, #fff); background: transparent; }
.mp-sw[aria-checked="true"] i { background: var(--c, #fff); }
.mp-sw span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-sw:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
.mp-tierchips { display: flex; gap: 0.2rem; margin-top: 0.25rem; }
.mp-tierchips button { flex: 1; font: 700 0.7rem var(--display); color: #141010; border: 2px solid transparent; border-radius: 0.3rem; padding: 0.1rem 0; cursor: pointer; }
.mp-tierchips button[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px #0008; }
.mp-map { position: relative; min-width: 0; }
#mp { position: absolute; inset: 0; background: #0b1a20; font-family: inherit; }
.mp-pos { position: absolute; left: 0.75rem; bottom: 0.75rem; z-index: 800; font: 0.75rem var(--mono); color: var(--fg); background: #0d0909d9; border: 1px solid var(--line); border-radius: 0.35rem; padding: 0.3rem 0.55rem; pointer-events: none; }
.mp-pos:empty { display: none; }

/* Leaflet look */
#mp .leaflet-control-zoom a { background: var(--surface); color: var(--fg); border-color: var(--line); }
#mp .leaflet-control-zoom a:hover { background: var(--raised); }
#mp .leaflet-bar { border: 1px solid var(--line); box-shadow: none; }
#mp .leaflet-control-scale-line { background: #0d0909cc; color: var(--fg); border-color: var(--fg); }
.mp-tip.leaflet-tooltip, .mp-pop .leaflet-popup-content-wrapper { background: #0d0909f0; color: var(--fg); border: 1px solid var(--line); border-radius: 0.45rem; box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.5); font-size: 0.82rem; line-height: 1.4; }
.mp-tip.leaflet-tooltip { padding: 0.45rem 0.65rem; width: max-content; max-width: 17rem; white-space: normal; }
.mp-tip b { font-size: 0.9rem; }
.mp-tip small, .mp-pop small { color: var(--muted); }
.mp-tip.leaflet-tooltip-top::before { border-top-color: #0d0909f0; }
.mp-tip.leaflet-tooltip-bottom::before { border-bottom-color: #0d0909f0; }
.mp-tip.leaflet-tooltip-left::before { border-left-color: #0d0909f0; }
.mp-tip.leaflet-tooltip-right::before { border-right-color: #0d0909f0; }
.mp-pop .leaflet-popup-tip { background: #0d0909f0; }
.mp-pop .leaflet-popup-content { margin: 0.6rem 0.8rem; }
#mp .leaflet-popup-close-button { color: var(--muted); }
.mp-red { color: #ff6b6b; font-weight: 600; }
.mp-tiers { image-rendering: auto; mix-blend-mode: normal; }

/* Pins */
.mp-pin { display: grid; place-items: center; }
.mp-pin span { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; font: 700 0.8rem var(--display); border: 2px solid; box-shadow: 0 1px 4px #000a; }
.mp-trader span { background: #133222; color: #3ccf7a; border-color: #3ccf7a; font-size: 0.95rem; }
.mp-ai span { background: #2c1d08; color: #ffb347; border-color: #ffb347; font-size: 0.68rem; }
.mp-ai.t4 span { border-color: #f0b43a; }
.mp-ai.t3 span { border-color: #8a6cf0; color: #c9b8ff; }
.mp-heli span { background: #2c1407; color: #ff8a3d; border-color: #ff8a3d; font-size: 0.7rem; }
.mp-convoy span { background: #2a1c10; color: #d9a066; border-color: #d9a066; font-size: 0.55rem; }
.mz-1 .mp-pin:is(.mp-ai, .mp-heli, .mp-convoy, .mp-fire) span, .mz0 .mp-pin:is(.mp-ai, .mp-heli, .mp-convoy, .mp-fire) span { transform: scale(0.72); }
.mp-fire span { background: #2c1407; border-color: #ff7a3d; font-size: 0.7rem; }

.mp-zb span { background: #1d1214; color: #ff8a8a; border: 1.5px dashed #ff6060; font: 0.72rem/1 system-ui, sans-serif; opacity: 0.9; }
.mp-zb.on span { background: #b3161f; color: #fff; border: 2px solid #ff6b6b; box-shadow: 0 0 0 3px #ff30304d, 0 1px 4px #000a; opacity: 1; }
.mp-zb.always span { background: #a3125a; border-color: #ff5aa8; box-shadow: 0 0 0 3px #ff2e8a4d, 0 1px 4px #000a; }
.mz2 .mp-zb, .mz3 .mp-zb, .mz4 .mp-zb, .mz5 .mp-zb, .mz6 .mp-zb { display: none; }

/* Labels: big places always, smaller ones as you zoom in */
.mp-town, .mp-zlabel, .mp-gl { pointer-events: none; }
.mp-town span, .mp-zlabel span { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; color: #fff; font-weight: 700; text-shadow: 0 0 3px #000, 0 0 6px #000, 0 1px 2px #000; }
.mp-town span { font-size: 0.78rem; }
.mp-town.t-Capital span { font-size: 1.05rem; letter-spacing: 0.02em; }
.mp-town.t-City span { font-size: 0.9rem; }
.mp-town.t-Hill span, .mp-town.t-Marine span, .mp-town.t-Ruin span, .mp-town.t-Local span, .mp-town.t-Camp span { font-size: 0.7rem; font-weight: 600; font-style: italic; color: #e6ddd6; }
.mp-town.t-Marine span { color: #a9d8ff; }
.mz-1 .mp-town.t-Village, .mz0 .mp-town.t-Village { display: none; }
.mz-1 .mp-town:is(.t-Hill, .t-Marine, .t-Ruin, .t-Local, .t-Camp), .mz0 .mp-town:is(.t-Hill, .t-Marine, .t-Ruin, .t-Local, .t-Camp), .mz1 .mp-town:is(.t-Hill, .t-Marine, .t-Ruin, .t-Local, .t-Camp) { display: none; }
.mp-zlabel span { font-size: 0.68rem; color: #ffd0d0; transform: translate(-50%, 0.6rem); }
.mz-1 .mp-zlabel, .mz0 .mp-zlabel { display: none; }
.mz-1 .leaflet-interactive.mp-mil, .mz-1 .mp-heli, .mz-1 .mp-convoy { opacity: 0.85; }
.mp-gl { font: 0.68rem var(--mono); color: #ffffffb3; text-shadow: 0 0 3px #000; }
.mp-gl.top { transform: translate(-50%, 0.2rem); }
.mp-gl.left { transform: translate(0.25rem, -50%); }

/* Phones and narrow screens: the panel opens over the map */
@media (max-width: 56rem) {
  .nhmap { grid-template-columns: minmax(0, 1fr); }
  .mp-side { position: fixed; inset: var(--mp-top, 4rem) 0 0 0; z-index: 1500; transform: translateX(-102%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s; max-width: 24rem; box-shadow: 0 0 2rem #000c; }
  .mp-side.open { transform: none; visibility: visible; }
  .mp-close { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; font-size: 1.5rem; line-height: 1; color: var(--fg); background: var(--raised); border: 1px solid var(--line); border-radius: 0.4rem; cursor: pointer; }
  .mp-open { display: block; position: absolute; left: 0.75rem; top: 0.75rem; z-index: 900; font: 600 0.85rem inherit; font-family: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 0.45rem; padding: 0.55rem 0.8rem; box-shadow: 0 2px 8px #0008; cursor: pointer; }
  #mp .leaflet-top.leaflet-left { top: 3.25rem; }
}
@media (prefers-reduced-motion: reduce) { .mp-side { transition: none; } }

/* Phones, zoomed all the way out: fewer names and smaller pins so the map isn't a pile of icons. Zoom in for the rest. */
@media (max-width: 56rem) {
  .mz-1 .mp-town.t-City { display: none; }
  .mz-1 .mp-town.t-Capital span { font-size: 0.85rem; }
  .mz-1 .mp-pin span, .mz0 .mp-pin span { transform: scale(0.62); }
}
