/* RadarCeska rail R5 parity PREVIEW ONLY. Desktop geometry derived from live weather R5.
   Native RailPublicR18 is sole owner of open/close and train content.
   No new map-control elements, no JS translation of individual buttons. */
@media (min-width:1060px) {
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] {
    --rrail-r5-width:var(--r5-width,358px);
  }
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #r5Panel,
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #r5Reopen,
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] .r53-edge-handle,
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #railPubDockHandle[hidden],
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #railPubLauncher[hidden],
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #railPubR17[hidden] {
    display:none!important;
  }
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #railPubR17:not([hidden]) {
    position:fixed!important;inset:0 0 0 auto!important;
    width:var(--rrail-r5-width)!important;max-width:100vw!important;
    height:100vh!important;height:100dvh!important;
    background:#f7fafb!important;border-left:1px solid #dde8e9!important;
    border-radius:0!important;box-shadow:-8px 0 24px rgba(32,68,80,.075)!important;
    z-index:5600!important;visibility:visible!important;pointer-events:auto!important;
    transform:none!important;display:flex!important;
  }
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #railPubR17 .railPub-head {
    background:#fff!important;border-bottom:1px solid #e3ecee!important;
  }
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #railPubR17 .railPub-content {
    background:#f7fafb!important;overflow-y:auto;overscroll-behavior-y:contain;
    scrollbar-width:thin;scrollbar-color:#c7d8dc transparent;
  }
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #railPubR17 :is(.railPub-highlights,.railPub-selected,.railPub-editorial,.railPub-journey) {
    border-radius:14px;
  }
  /* R5 edge handle and reopening tab: same boundary and same interaction geometry. */
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #railPubDockHandle:not([hidden]) {
    display:grid!important;position:fixed!important;
    z-index:5602!important;top:50%!important;left:auto!important;right:var(--rrail-r5-width)!important;
    transform:translateY(-50%)!important;transition:none!important;
    width:27px!important;min-width:27px!important;height:64px!important;
    padding:0!important;margin:0!important;
    border:1px solid #d6e5e8!important;border-right:0!important;
    border-radius:11px 0 0 11px!important;
    background:#fff!important;color:#3b6775!important;
    box-shadow:-4px 2px 13px rgba(18,54,70,.12)!important;
    visibility:visible!important;pointer-events:auto!important;
  }
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #railPubLauncher:not([hidden]) {
    display:flex!important;position:fixed!important;
    z-index:5602!important;top:50%!important;bottom:auto!important;right:0!important;left:auto!important;
    transform:translateY(-50%)!important;transition:none!important;
    align-items:center!important;justify-content:center!important;
    min-height:95px!important;min-width:36px!important;width:36px!important;height:auto!important;
    padding:10px 6px!important;margin:0!important;
    background:#fff!important;border:1px solid #d6e5e8!important;border-right:0!important;
    border-radius:11px 0 0 11px!important;color:#087e74!important;
    box-shadow:-4px 2px 13px rgba(18,54,70,.12)!important;
    visibility:visible!important;pointer-events:auto!important;
  }
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #railPubLauncher span {
    writing-mode:vertical-rl!important;transform:rotate(180deg)!important;
  }
  /* R5's open/closed *map widths*, driven by native DOM [hidden], not by timers.
     Two :has IDs outrank older r5 canary selectors even when the weather
     checkbox is still present but hidden in a non-weather mode. */
  html:has(#railPubR17):has(#map) body.rrail-r5-parity-preview[data-railpub-r17="trains"] #map,
  html:has(#railPubR17):has(#map) body.rrail-r5-parity-preview[data-railpub-r17="trains"] #weatherMap,
  html:has(#railPubR17):has(#map) body.rrail-r5-parity-preview[data-railpub-r17="trains"] #mapContainer,
  html:has(#railPubR17):has(#map) body.rrail-r5-parity-preview[data-railpub-r17="trains"] .maplibregl-map {
    position:fixed!important;top:0!important;bottom:0!important;left:0!important;
    right:0!important;width:100vw!important;max-width:100vw!important;
    min-width:0!important;height:100dvh!important;
  }
  html:has(#railPubR17:not([hidden])):has(#map) body.rrail-r5-parity-preview[data-railpub-r17="trains"] #map,
  html:has(#railPubR17:not([hidden])):has(#map) body.rrail-r5-parity-preview[data-railpub-r17="trains"] #weatherMap,
  html:has(#railPubR17:not([hidden])):has(#map) body.rrail-r5-parity-preview[data-railpub-r17="trains"] #mapContainer,
  html:has(#railPubR17:not([hidden])):has(#map) body.rrail-r5-parity-preview[data-railpub-r17="trains"] .maplibregl-map {
    right:var(--rrail-r5-width)!important;
    width:calc(100vw - var(--rrail-r5-width))!important;
    max-width:calc(100vw - var(--rrail-r5-width))!important;
  }
  /* Map groups: map is already narrowed to the panel boundary like R5.
     Existing RailPublicR18 regularly reads geometry; it should see no overlap. */
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] .map-actions {
    position:fixed!important;right:16px!important;left:auto!important;
    translate:none!important;transition:none!important;
  }
  body.rrail-r5-parity-preview[data-railpub-r17="trains"]:has(#railPubR17:not([hidden])) .map-actions {
    right:calc(var(--rrail-r5-width) + 16px)!important;
  }
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] .map-actions > :is(#zoomInBtn,#zoomOutBtn,#layersBtn,#touristMapBtn),
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #map :is(.maplibregl-ctrl-top-right,.maplibregl-ctrl-bottom-right) {
    translate:none!important;transition:none!important;
  }
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] #map :is(.maplibregl-ctrl-top-right,.maplibregl-ctrl-bottom-right) {
    right:14px!important;
  }
}
/* Native train mobile map-first navigation is untouched, like weather R5 at <=1059px. */
@media (prefers-reduced-motion:reduce) {
  body.rrail-r5-parity-preview #railPubR17,
  body.rrail-r5-parity-preview #railPubDockHandle,
  body.rrail-r5-parity-preview #railPubLauncher {transition:none!important}
}
/* Weather R5 has no desktop dock at <=1059px. Keep the native train mobile /
   tablet presentation, but do not inherit an old 380px map clipping column. */
@media (max-width:1059px) {
  html:has(#railPubR17):has(#map) body.rrail-r5-parity-preview[data-railpub-r17="trains"] #map,
  html:has(#railPubR17):has(#map) body.rrail-r5-parity-preview[data-railpub-r17="trains"] .maplibregl-map {
    position:fixed!important;inset:0!important;
    width:100vw!important;max-width:100vw!important;min-width:0!important;
    height:100dvh!important;
  }
}
@media (min-width:831px) and (max-width:1059px) {
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] .map-actions {
    right:16px!important;translate:none!important;transition:none!important;
  }
  body.rrail-r5-parity-preview[data-railpub-r17="trains"]:has(#railPubR17:not([hidden])) .map-actions {
    right:calc(var(--railPub-weather-width,352px) + 16px)!important;
  }
  body.rrail-r5-parity-preview[data-railpub-r17="trains"] .map-actions > :is(#zoomInBtn,#zoomOutBtn,#layersBtn,#touristMapBtn) {
    translate:none!important;
  }
}

/* Timetable-phase display only; reused unchanged evidence policy from R19Q6. */
body.rrail-r5-parity-preview #railPubR17 .railPub-r17-fullstop.rrail-r19q-passed .railPub-r17-stopname{color:#81928b}
body.rrail-r5-parity-preview #railPubR17 .railPub-r17-fullstop.rrail-r19q-passed .railPub-r17-stopmark{background:#9cc9b5;border-color:#9cc9b5}
body.rrail-r5-parity-preview #railPubR17 .railPub-r17-fullstop.rrail-r19q-current{background:#e7f7ee;border-radius:9px;padding-inline:9px;margin-inline:-5px}
body.rrail-r5-parity-preview #railPubR17 .railPub-r17-fullstop.rrail-r19q-current .railPub-r17-stopmark{background:#0d946e;border-color:#0d946e;box-shadow:0 0 0 4px #cdf0de}
body.rrail-r5-parity-preview #railPubR17 .railPub-r17-fullstop.rrail-r19q-current .railPub-r17-stopname{color:#076c51;font-weight:830}
body.rrail-r5-parity-preview #railPubR17 .railPub-r17-fullstop.rrail-r19q-next .railPub-r17-stopname{color:#047c5e;font-weight:800}
body.rrail-r5-parity-preview #railPubR17 .rrail-r19q-phase{
 display:grid;grid-template-columns:31px minmax(0,1fr);gap:4px 10px;align-items:start;
 margin:12px 0;padding:14px 12px;border:1px solid #b8e2ce;border-radius:13px;
 background:linear-gradient(150deg,#effbf4 0%,#fff 80%);box-shadow:0 3px 12px rgba(21,84,59,.045)
}
body.rrail-r5-parity-preview #railPubR17 .rrail-r19q-phase-icon{grid-row:1;display:grid;place-items:center;width:30px;height:30px;background:#d5f2e1;border-radius:9px;color:#058565;font-size:16px;font-weight:900}
body.rrail-r5-parity-preview #railPubR17 .rrail-r19q-phase-main{min-width:0;display:grid;gap:2px;line-height:1.4}
body.rrail-r5-parity-preview #railPubR17 .rrail-r19q-phase-main strong{font-size:12px;line-height:1.25;color:#075d49;font-weight:810}
body.rrail-r5-parity-preview #railPubR17 .rrail-r19q-phase-main span{font-size:11.5px;color:#2c5647;font-weight:690;overflow-wrap:anywhere}
body.rrail-r5-parity-preview #railPubR17 .rrail-r19q-progress{height:5px;grid-column:1/-1;overflow:hidden;border-radius:99px;background:#daebe1;margin-top:5px}
body.rrail-r5-parity-preview #railPubR17 .rrail-r19q-progress span{display:block;height:100%;border-radius:99px;background:#10a275}
body.rrail-r5-parity-preview #railPubR17 .rrail-r19q-phase>small{grid-column:1/-1;color:#67887a;font-size:10px;line-height:1.45;margin-top:3px}
body.rrail-r5-parity-preview #railPubR17 .rrail-r19q-mapbtn{grid-column:1/-1;display:block;padding:10px 11px;border:1px solid #a5d9c1;border-radius:10px;background:#fff;color:#066f51;font-size:11px;font-weight:780;cursor:pointer;text-align:center}
body.rrail-r5-parity-preview #railPubR17 .rrail-r19q-mapbtn:hover{background:#e7f8ee}


