/* Dedicated rail map mode. The existing page stays mounted, preserving all fields,
 * results, active tab and scroll position. Only its visual layer retracts. */
.ip-map-fab{position:fixed;z-index:25;right:max(16px,env(safe-area-inset-right));bottom:calc(16px + env(safe-area-inset-bottom));width:52px;height:52px;border-radius:17px;display:grid;place-items:center;background:#07191e;color:#fffef8;border:1px solid #476258;box-shadow:0 5px 18px #07191e33;cursor:pointer;transition:transform .3s,opacity .25s}
.ip-map-fab svg{width:25px;height:25px}
.ip-map-fab:disabled{opacity:.5;cursor:wait}
.ip-map-mode[hidden]{display:none!important}
.ip-map-mode{position:fixed;z-index:30;inset:0;display:flex;flex-direction:column;gap:4px;background:#f5f5ef;color:#10292b;padding:max(8px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));box-sizing:border-box;opacity:0;pointer-events:none;transition:opacity .32s ease .04s;overflow:hidden}
html.ip-map-open,html.ip-map-open body{overflow:hidden;overscroll-behavior:none}
.site-header,.page-shell{transition:transform .36s cubic-bezier(.25,.8,.25,1),opacity .28s ease}
html.ip-map-open .site-header,html.ip-map-open .page-shell{transform:translateY(-110%);opacity:0;pointer-events:none}
html.ip-map-open .ip-map-fab{transform:translateY(20px);opacity:0;pointer-events:none}
html.ip-map-open .ip-map-mode{opacity:1;pointer-events:auto}
.ip-map-top{display:flex;align-items:center;justify-content:space-between;gap:10px;flex:0 0 auto;padding:0 2px 2px}
.ip-map-stub{display:grid;justify-items:center;gap:4px;min-width:122px;min-height:43px;padding:6px 12px 8px;background:#fffef8b8;border:1px solid #b9cabd;border-radius:0 0 12px 12px;box-shadow:0 2px 8px #07191e0e;color:#10292b;cursor:pointer}
.ip-map-grip{width:29px;height:3px;border-radius:4px;background:#a2b6a9}
.ip-map-stub-row{display:flex;align-items:center;gap:9px;font-size:14px}
.ip-map-stub-row svg{width:16px;height:16px;color:#526b62}
.ip-map-heading{display:grid;text-align:right;gap:1px;font-size:13px}.ip-map-heading span{font-size:12px;color:#526b62}
.ip-map-area{flex:1 1 0;min-height:0;position:relative;overflow:hidden;border-radius:13px;border:1px solid #d4dfd4;background:#f7f8f2}
.ip-map-stage{position:absolute;inset:0;touch-action:none;cursor:grab;overflow:hidden;user-select:none;-webkit-user-select:none}
.ip-map-stage:active{cursor:grabbing}
.ip-map-stage svg,.ip-map-stage canvas{position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none}
.ip-full-tracks path{stroke-width:2.5px;vector-effect:non-scaling-stroke;opacity:.78}
.ip-full-stations circle{vector-effect:non-scaling-stroke}
.ip-full-station-label{font-family:Helvetica,Arial,sans-serif;fill:#244138;font-weight:500;paint-order:stroke;stroke:#f7f8f2;stroke-width:2px;stroke-linejoin:round;vector-effect:non-scaling-stroke}
.ip-map-zoom{position:absolute;right:8px;bottom:26px;display:grid;gap:4px}
.ip-map-zoom button{display:grid;place-items:center;width:36px;height:36px;padding:0;border:1px solid #b9cabd;background:#fffef8ed;color:#244138;border-radius:8px;box-shadow:0 2px 8px #07191e0a;cursor:pointer}
.ip-map-zoom svg{width:18px;height:18px}
.ip-map-credit{position:absolute;left:7px;bottom:5px;font-size:9px;color:#60766a;background:#f7f8f2d9;text-decoration:none}
.ip-map-error{position:absolute;left:10px;right:10px;top:10px;padding:10px;border-radius:8px;background:#fffef8;color:#944a32;font-size:13px}
.ip-map-controls{flex:0 0 auto;background:rgba(255,254,248,.86);border:1px solid #b9cabd;border-radius:13px;padding:9px 10px 7px;box-shadow:0 4px 14px #07191e0c;display:grid;gap:5px}
.ip-map-play-row{display:flex;align-items:center;gap:9px}
#ipMapPlay{width:39px;height:39px;border:0;border-radius:10px;background:#07191e;color:#fffef8;display:grid;place-items:center;cursor:pointer;flex:none}
#ipMapPlay:disabled{opacity:.45}
#ipMapPlay svg{width:20px;height:20px}
#ipMapPlay[data-playing=true] .ip-map-play-glyph,#ipMapPlay[data-playing=false] .ip-map-pause-glyph{display:none}
.ip-map-time{display:grid;flex:1;min-width:0;gap:1px}
.ip-map-time span,.ip-map-range,.ip-map-coverage,.ip-map-speed-row>span{font-size:11px;color:#526b62}
.ip-map-time strong{font-size:23px;line-height:1.1;letter-spacing:-.035em;font-variant-numeric:tabular-nums}
.ip-map-total{font-size:13px;color:#244138;white-space:nowrap;font-variant-numeric:tabular-nums}
#ipMapScrubber{appearance:auto;-webkit-appearance:auto;accent-color:#5e8315;width:100%;height:24px;min-height:24px;margin:0;cursor:pointer;touch-action:pan-y}
.ip-map-range{display:flex;justify-content:space-between;margin-top:-5px;font-variant-numeric:tabular-nums}
.ip-map-speed-row{display:flex;align-items:center;gap:8px;margin:1px 0}
#ipMapSpeeds{flex:1;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:3px;background:#e9eee5;border:1px solid #d4dfd4;border-radius:8px;padding:3px}
#ipMapSpeeds button{background:transparent;border:0;border-radius:5px;color:#405d53;font-size:12px;font-weight:600;min-height:29px;padding:3px;cursor:pointer}
#ipMapSpeeds button[aria-pressed=true]{background:#bbee00;color:#07191e}
.ip-map-counts{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}
.ip-map-count{display:flex;align-items:center;justify-content:space-between;gap:3px;min-width:0;padding:4px 5px;border:1px solid #d6e0d5;border-radius:6px;background:#f7f8f2}
.ip-map-count span{border-radius:3px;padding:2px 3px;line-height:1.15;font-size:10px;font-weight:700}
.ip-map-count strong{font-size:13px;font-variant-numeric:tabular-nums}
.ip-map-coverage{text-align:center;min-height:13px}
@media(min-width:800px){.ip-map-controls{width:min(640px,100%);align-self:center}.ip-map-top{width:min(1160px,100%);align-self:center}.ip-map-area{width:min(1400px,100%);align-self:center}}
@media(max-height:560px) and (orientation:landscape){.ip-map-mode{display:grid;grid-template-columns:minmax(0,1fr) 320px;grid-template-rows:auto minmax(0,1fr);gap:5px}.ip-map-top{grid-column:1/-1}.ip-map-area{min-height:0}.ip-map-controls{align-self:center;width:auto;max-height:100%;overflow:auto}.ip-map-counts{grid-template-columns:repeat(5,minmax(0,1fr))}}
@media(max-width:350px){.ip-map-count{padding:3px}.ip-map-count span{font-size:9px;padding:2px}.ip-map-count strong{font-size:12px}.ip-map-controls{padding:7px}.ip-map-credit{font-size:8px}}
@media(prefers-reduced-motion:reduce){.site-header,.page-shell,.ip-map-mode,.ip-map-fab{transition:none}}


/* MapLibre draws the Positron vector basemap and rail overlay; trains remain
 * on the existing separate canvas, aligned by the map's screen projection. */
.ip-map-stage{touch-action:auto;isolation:isolate}
.ip-map-stage .ip-osm-map{position:absolute;inset:0;z-index:1;background:#f0f1ed}
.ip-map-stage .ip-osm-map svg,.ip-map-stage .ip-osm-map canvas{position:static;inset:auto;width:auto;height:auto;pointer-events:auto}
.ip-map-stage .ip-osm-map .maplibregl-canvas{position:absolute;left:0;top:0}
.ip-map-stage .ip-osm-map .maplibregl-canvas-container{touch-action:none}
.ip-map-stage #ipMapTrains{z-index:2;pointer-events:none}
.ip-map-stage .maplibregl-ctrl-attrib{font:10px/1.35 Helvetica,Arial,sans-serif;white-space:normal;max-width:100%;color:#405d53;background:#fffef8e8}
.ip-map-stage .maplibregl-ctrl-attrib a{color:#244138}
.ip-map-stage .maplibregl-ctrl-bottom-left{max-width:100%}
.ip-map-stage .maplibregl-popup-content{font:12px/1.4 Helvetica,Arial,sans-serif;color:#244138;border-radius:8px}
.ip-map-zoom,.ip-map-error{z-index:4}
.ip-map-zoom{bottom:45px}

.ip-map-train-card{position:absolute;top:0;left:8px;right:8px;max-width:360px;margin-inline:auto;z-index:4;display:flex;align-items:center;gap:9px;min-height:54px;padding:6px 9px;background:rgba(255,254,248,.92);border:1px solid #b9cabd;border-top:0;border-radius:0 0 12px 12px;box-shadow:0 4px 14px #07191e1a;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);transform:translateY(calc(-100% - 10px));opacity:0;pointer-events:none;transition:transform .28s cubic-bezier(.22,.8,.25,1),opacity .2s ease}
.ip-map-train-card[data-open=true]{transform:translateY(0);opacity:1;pointer-events:auto}
.ip-map-train-line{padding:4px 7px;border-radius:6px;font-size:12px;font-weight:700;flex:none}
#ipMapTrainLabel{flex:1;font-size:16px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ip-map-train-card button{display:grid;place-items:center;width:40px;height:40px;border:0;border-radius:8px;flex:none;cursor:pointer;padding:0}
.ip-map-train-card button svg{width:21px;height:21px}
#ipMapTrainRun{background:#07191e;color:#fffef8}
#ipMapTrainRun:disabled{opacity:.4;cursor:default}
#ipMapTrainClose{background:transparent;color:#526b62;width:34px}
.ip-map-clock-row{display:flex;align-items:center;gap:7px;min-width:0}
#ipMapNow{background:#e9eee5;border:1px solid #c8d6c7;border-radius:7px;padding:5px 8px;min-height:29px;font-size:12px;font-weight:700;color:#244138;cursor:pointer;flex:none}
#ipMapNow:disabled{opacity:.4;cursor:default}
@media(max-width:350px){.ip-map-clock-row{gap:4px}.ip-map-time strong{font-size:20px}#ipMapNow{padding:4px 5px}.ip-map-play-row{gap:6px}.ip-map-total{font-size:12px}}
@media(prefers-reduced-motion:reduce){.ip-map-train-card{transition:none}}

/* Expanded selected-working details, with no change to map dimensions. */
.ip-map-train-card{padding:10px 9px;gap:8px;max-width:400px}
.ip-map-train-copy{flex:1;min-width:0;display:grid;gap:4px}
.ip-map-train-title{display:flex;align-items:center;gap:7px;min-width:0}
.ip-map-train-title #ipMapTrainLabel{font-size:16px;line-height:1.2}
.ip-map-train-route{font-size:13px;line-height:1.3;font-weight:600;color:#244138;overflow-wrap:anywhere}
.ip-map-train-status{font-size:12px;line-height:1.3;color:#526b62;overflow-wrap:anywhere}
.ip-map-train-status[data-state=stopped]{color:#355b39}
.ip-map-train-status[data-state=inactive]{color:#697970}
@media(max-width:350px){.ip-map-train-card{gap:5px;padding:8px}.ip-map-train-card button{width:35px}#ipMapTrainClose{width:27px}.ip-map-train-route{font-size:12px}}

/* Camera lock on the selected train. Active lime matches playback controls. */
#ipMapTrainFollow{background:#e9eee5;color:#244138;border:1px solid #c8d6c7}
#ipMapTrainFollow[aria-pressed=true]{background:#bbee00;color:#07191e;border-color:#9bc000}
#ipMapTrainFollow:disabled{opacity:.4;cursor:default}
@media(max-width:380px){.ip-map-train-card{gap:5px;padding:8px}.ip-map-train-card button{width:35px}#ipMapTrainClose{width:27px}.ip-map-train-route{font-size:12px}}

/* Infrastructure layers menu, anchored above the map controls. */
#ipMapLayers[aria-expanded=true]{background:#bbee00;color:#07191e;border-color:#9bc000}
.ip-map-layer-panel[hidden]{display:none!important}
.ip-map-layer-panel{position:absolute;z-index:5;right:51px;bottom:45px;width:min(280px,calc(100% - 61px));max-height:calc(100% - 55px);overflow:auto;overscroll-behavior:contain;padding:11px 12px;box-sizing:border-box;background:rgba(255,254,248,.96);color:#10292b;border:1px solid #b9cabd;border-radius:12px;box-shadow:0 4px 20px #07191e20;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}
.ip-map-layer-heading{display:flex;align-items:center;justify-content:space-between;font-size:14px;margin-bottom:5px}
.ip-map-layer-heading button{border:0;background:transparent;color:#526b62;font-size:23px;line-height:1;width:30px;height:30px;cursor:pointer}
.ip-map-layer-panel label{display:flex;align-items:center;gap:7px;font-size:12px;line-height:1.25;min-height:34px;cursor:pointer}
.ip-map-layer-panel input{accent-color:#5e8315;flex:none;width:17px;height:17px;margin:0}
.ip-map-layer-panel label:has(input:disabled){opacity:.5;cursor:default}
.ip-layer-swatch{display:block;width:19px;flex:none;border-top:2px solid #526b62}
.ip-layer-swatch.dashed{border-top-style:dashed}.ip-layer-swatch.short-dash{border-top:2px dashed #526b62;opacity:.8}
.ip-layer-swatch.station{width:9px;height:9px;margin:0 5px;border:1.5px solid #526b62;border-radius:50%;background:#fff}
.ip-layer-swatch.future{border-top:2px dashed #0099aa}.ip-layer-swatch.proposed{border-top:2px dotted #97a74c}
#ipMapLayerStatus{font-size:11px;margin:8px 0 5px;padding-top:8px;border-top:1px solid #d6e0d5;color:#405d53}
.ip-map-layer-panel small{display:block;font-size:10px;color:#60766a;line-height:1.3}

/* Explicit landscape grid stretch prevents the absolutely positioned map collapsing. */
.ip-map-mode{width:100%;height:100%;height:100dvh;max-width:none;max-height:none;min-height:0}
.ip-map-area{min-width:0;box-sizing:border-box}
@media(orientation:landscape) and (max-height:650px){
 .ip-map-mode{display:grid;grid-template-columns:minmax(0,1fr) minmax(245px,36%);grid-template-rows:auto minmax(0,1fr);align-items:stretch;justify-items:stretch;gap:6px}
 .ip-map-top{grid-area:1/1/2/3;width:100%;align-self:stretch;box-sizing:border-box}
 .ip-map-area{grid-area:2/1/3/2;width:100%;height:100%;min-height:0;align-self:stretch;justify-self:stretch}
 .ip-map-controls{grid-area:2/2/3/3;width:100%;min-width:0;min-height:0;max-height:100%;box-sizing:border-box;align-self:center;overflow:auto;gap:4px}
 .ip-map-stub{min-height:34px;padding:4px 9px}.ip-map-zoom{bottom:30px;gap:3px}.ip-map-zoom button{width:30px;height:30px}
 .ip-map-count{padding:3px;gap:2px}.ip-map-count span{font-size:9px}.ip-map-count strong{font-size:12px}
}
.ip-layer-swatch.station{width:15px;height:9px;border-radius:2px;background:#526b6222;margin:0 2px}
.ip-layer-swatch.future,.ip-layer-swatch.proposed{border-top-style:solid}
