/* Route-specific, isolated WXRadar navigation (all same-tab) */
#wxPortalNav{
 position:fixed;z-index:100050;display:flex;align-items:center;gap:3px;
 padding:6px;border:1px solid rgba(125,148,170,.35);border-radius:13px;
 background:rgba(245,248,252,.96);box-shadow:0 8px 24px #0002;
 backdrop-filter:blur(16px);font:700 12px/1.25 "DM Sans",system-ui,sans-serif;
 max-width:calc(100vw - 18px)
}
#wxPortalNav a{color:#30465b;text-decoration:none;border-radius:9px;padding:10px 12px;white-space:nowrap;
 transition:background .2s,color .2s;outline-offset:2px}
#wxPortalNav a:is(:hover,:focus-visible){background:#dae7ef;color:#132d40}
#wxPortalNav a.active{background:#d5eafa;color:#134f74}
body.ui-dark #wxPortalNav{
 background:rgba(11,21,34,.95);border-color:#394759;box-shadow:0 9px 24px #0006}
body.ui-dark #wxPortalNav a{color:#d1dce9}
body.ui-dark #wxPortalNav a.active{background:#1a486f;color:#eaf7ff}
body.ui-dark #wxPortalNav a:hover{background:#30455b}
/* RADAR desktop: selector below MAP TYPE and COUNTIES, top-right */
html[data-wx-page="radar"] #wxPortalNav{top:105px;right:18px;left:auto;transform:none}
/* METEOGRAMS + NWP: nav centered horizontally on all devices */
html[data-wx-page="meteograms"] #wxPortalNav,
html[data-wx-page="nwp"] #wxPortalNav{top:8px;left:50%;right:auto;transform:translateX(-50%)}
/* Meteograms: ONLY plain basemap + genuine original forecast launcher and graph */
html[data-wx-page="meteograms"] :is(#topbar,.tools-wrap,#quickMapTools,#legendDock,
 .timeline-panel,#attributionsControl,.radar-site-indicator,.radar-site-marker,
 .radar-marker,.radar-site-label,.radar-site-badge,#radarSiteStatusDock,
 #radar3dViewer,#satelliteLegend,#reflectivityLegend,.boundary-settings-panel,
 #wxWeatherModelsButton,.location-marker,.storm-tracking-panel){display:none!important}
html[data-wx-page="meteograms"] .meteogram-launcher{top:72px!important}
html[data-wx-page="meteograms"] .meteogram-panel:not(.is-hidden){
 width:min(1420px,calc(100vw - 28px))!important;
 height:min(820px,calc(100dvh - 94px))!important;
 max-height:calc(100dvh - 88px)!important;min-width:0!important}
/* NWP: exact original full-screen cassette, with space reserved for navigation */
html[data-wx-page="nwp"] :is(#topbar,.tools-wrap,#quickMapTools,.timeline-panel,
 #legendDock,#attributionsControl){display:none!important}
html[data-wx-page="nwp"] #wxWeatherModelsPanel.wx-open{padding-top:48px!important}
/* No extra native Meteograms Home control on desktop. */
#wxPortalHomeMobile{display:none}
@media(max-width:760px){
  #wxPortalNav{gap:1px;padding:4px;border-radius:11px;font-size:clamp(9px,2.65vw,11px)}
  #wxPortalNav a{padding:9px clamp(5px,1.6vw,9px)}
  html[data-wx-page="radar"] #wxPortalNav{display:none!important}
  #wxPortalHomeMobile{display:flex;align-items:center;justify-content:center;flex:0 0 auto;
    height:auto;min-height:44px;max-height:57px;width:auto;min-width:64px;padding:0 12px;
    border:1px solid var(--border);border-radius:14px;box-shadow:var(--shadow);
    background:rgba(241,245,249,.88);color:#152e41;font:800 12px/1.2 "DM Sans",system-ui,sans-serif;
    text-decoration:none;transition:background .2s,color .2s}
  body.ui-dark #wxPortalHomeMobile{background:#172334;color:#e5edf8;border-color:#485166}
  /* ensure it stays beside native Meteograms quick tool */
  body.meteogram-mode-active #wxPortalHomeMobile{opacity:1!important;width:auto!important;max-width:none!important;
    min-width:64px!important;padding:0 12px!important;transform:none!important;pointer-events:auto!important}
  html[data-wx-page="meteograms"] .meteogram-launcher{top:65px!important}
  html[data-wx-page="meteograms"] .meteogram-panel:not(.is-hidden){
    width:calc(100vw - 10px)!important;height:calc(100dvh - 82px)!important;
    max-height:calc(100dvh - 82px)!important}
  html[data-wx-page="nwp"] #wxWeatherModelsPanel.wx-open{padding-top:46px!important}
}

/* v8: lift navigation out of the main model toolbar; compact while keeping touch targets. */
html[data-wx-page="radar"] #wxPortalNav{top:86px!important;right:18px!important}
html[data-wx-page="nwp"] #wxPortalNav,
html[data-wx-page="meteograms"] #wxPortalNav{top:2px!important;left:50%!important;transform:translateX(-50%)!important}
html[data-wx-page="nwp"] #wxPortalNav a,
html[data-wx-page="meteograms"] #wxPortalNav a{padding-block:7px}
html[data-wx-page="nwp"] #wxWeatherModelsPanel.wx-open{padding-top:56px!important}
@media(max-width:760px){
 html[data-wx-page="radar"] #wxPortalNav{display:none!important}
 html[data-wx-page="nwp"] #wxPortalNav a,
 html[data-wx-page="meteograms"] #wxPortalNav a{padding:9px clamp(5px,1.5vw,9px)}
 html[data-wx-page="nwp"] #wxWeatherModelsPanel.wx-open{padding-top:54px!important}
}
/* Card styles are supplied by the Home document (not by this route CSS). */

/* v9.3: meteograms only — put the Leaflet provider credit at the bottom on phones.
   Retain the attribution and its links; never obscure the location picker. */
@media (max-width:760px) {
  html[data-wx-page="meteograms"] .leaflet-control-attribution,
  html[data-wx-page="meteograms"] .leaflet-bottom .leaflet-control-attribution {
    position:fixed !important;
    top:auto !important;
    bottom:calc(env(safe-area-inset-bottom, 0px) + 7px) !important;
    left:calc(env(safe-area-inset-left, 0px) + 7px) !important;
    right:auto !important;
    width:max-content !important;
    max-width:calc(100vw - 18px) !important;
    max-height:64px !important;
    padding:3px 7px !important;
    overflow-wrap:anywhere;
    overflow-y:auto;
    font-size:9px !important;
    line-height:1.25 !important;
    text-align:left;
    z-index:1100 !important;
  }
}

/* Radar: desktop native vertical quick tools instead of floating 4-route nav. */
html[data-wx-page="radar"] #wxPortalNav {display:none!important}
#wxPortalHomeDesktop {display:none}
@media (min-width: 821px) and (min-height: 601px) {
 html[data-wx-page="radar"] #wxPortalHomeDesktop {display:grid;grid-template-columns:24px minmax(0,1fr);align-items:center;gap:7px;text-decoration:none;color:inherit}
 html[data-wx-page="radar"] #wxWeatherModelsButton {display:grid;grid-template-columns:24px minmax(0,1fr);gap:7px;align-items:center;order:0!important;width:148px;height:43px;min-height:43px}
 html[data-wx-page="radar"] #wxWeatherModelsButton .wx-model-button-label {display:block!important}
}
@media(max-width:820px),(max-height:600px) and (max-width:960px){#wxPortalHomeDesktop{display:none!important}}
@media(max-width:390px){#wxPortalHomeMobile{min-width:38px!important;width:38px!important;max-width:38px!important;padding:1px!important;font-size:0!important}}

/* Compact-phone Home remains recognizable after its label is hidden. */
#wxPortalHomeMobile .wx-mobile-home-icon {display:none}
@media(max-width:390px){
  #wxPortalHomeMobile .wx-mobile-home-icon {display:block; flex:0 0 auto}
  #wxPortalHomeMobile .wx-mobile-home-label {display:none!important}
}


/* v3: desktop Home is the first element of the LEFT map tools column. */
@media (min-width: 821px) and (min-height: 601px) {
 html[data-wx-page="radar"] .tools-wrap > #wxPortalHomeDesktop {
   display: grid !important;
   order: 0 !important;
   width: 138px !important;
   min-height:43px !important;
   height:43px !important;
   grid-template-columns:22px minmax(0,1fr) !important;
   gap:5px !important;
   justify-content:start !important;
   text-align:left !important;
   padding:5px 8px !important;
   margin:0 !important;
   font-size:10px !important;
   border-radius:13px !important;
   flex:0 0 auto !important;
 }
}

/* Basic astronomy addition: isolated from operational map, radar and NWP logic */
#wxPortalAstronomyDesktop,#wxPortalAstronomyMobile {text-decoration:none;color:inherit}
.wx-astronomy-button-image {display:block;width:100%;height:100%;object-fit:contain}
#wxPortalAstronomyDesktop{display:none}
#wxPortalAstronomyMobile{display:none}
@media(min-width:821px) and (min-height:601px){
 html[data-wx-page="radar"] #wxPortalAstronomyDesktop{
   display:grid!important;grid-template-columns:24px minmax(0,1fr)!important;
   gap:7px!important;align-items:center!important;order:999!important;
   width:148px!important;min-height:43px!important;height:43px!important;
 }
 html[data-wx-page="radar"] #wxPortalAstronomyDesktop .quick-map-tool-label{display:block!important}
 html[data-wx-page="radar"] #wxWeatherModelsButton{order:20!important}
}
@media(max-width:820px),(max-height:600px) and (max-width:960px){
 html[data-wx-page="radar"] #wxPortalAstronomyMobile{
   display:grid!important;place-items:center;flex:0 0 42px;min-width:42px;
   width:42px;height:42px;min-height:42px;padding:4px;
 }
 html[data-wx-page="radar"] #wxPortalAstronomyMobile .wx-toolbar-button-icon{width:27px;height:27px;display:grid;place-items:center}
 html[data-wx-page="radar"] #wxPortalAstronomyMobile .quick-map-tool-label{display:none!important}
}
@media(max-width:390px){
 html[data-wx-page="radar"] #wxPortalAstronomyMobile{width:38px!important;min-width:38px!important;max-width:38px!important;height:38px!important;min-height:38px!important;flex:0 0 38px!important}
}

/* Shared Weather cassette: original operational Meteograms runs in a SAME-ORIGIN
   iframe; preserve its full models, ensemble controls and forecast canvases. */
html.wx-meteo-embedded #wxPortalNav,
html.wx-meteo-embedded #map,
html.wx-meteo-embedded .leaflet-control-container,
html.wx-meteo-embedded .map-attribution {display:none!important}
html.wx-meteo-embedded,html.wx-meteo-embedded body {background:transparent!important}
html.wx-meteo-embedded .meteogram-panel:not(.is-hidden){
 position:fixed!important;left:5px!important;right:5px!important;top:5px!important;bottom:5px!important;
 width:calc(100vw - 10px)!important;height:calc(100vh - 10px)!important;
 max-height:calc(100vh - 10px)!important;max-width:none!important;
 transform:none!important;margin:0!important;z-index:105000!important;
}
html.wx-meteo-embedded .meteogram-launcher:not(.is-hidden){top:15px!important;left:50%!important;transform:translateX(-50%)!important;z-index:105000!important}


/* v6.2: share ONE VISIBLE map, render only the true operational WXRadar
   meteogram component inside the Weather cassette. Never draw its secondary
   Leaflet map, page header, navigation or other radar widgets. */
html.wx-meteo-embedded,html.wx-meteo-embedded body{
  margin:0!important;padding:0!important;width:100%!important;height:100%!important;
  min-height:0!important;max-width:none!important;overflow:hidden!important;
  background:transparent!important;
}
html.wx-meteo-embedded body > :not(#meteogramPanel){
  visibility:hidden!important;pointer-events:none!important;
}
html.wx-meteo-embedded body > #meteogramPanel{
  visibility:visible!important;
}
html.wx-meteo-embedded #meteogramPanel:not(.is-hidden){
  display:flex!important;position:fixed!important;inset:0!important;
  left:0!important;top:0!important;right:0!important;bottom:0!important;
  width:100%!important;height:100%!important;min-width:0!important;
  min-height:0!important;max-width:none!important;max-height:none!important;
  margin:0!important;padding:0!important;transform:none!important;
  border-radius:0!important;border:0!important;resize:none!important;
  box-shadow:none!important;overflow:hidden!important;
  z-index:105000!important;
}
html.wx-meteo-embedded .meteogram-resize-handle{display:none!important}
html.wx-meteo-embedded .meteogram-header{cursor:default!important;touch-action:auto!important}
html.wx-meteo-embedded .meteogram-launcher{display:none!important}
/* No duplicate location picker: the shared map's search already owns it. */
html.wx-meteo-embedded .meteogram-location-search-desktop{display:none!important}
/* Primary controls adapt to the available forecast width rather than clipping. */
html.wx-meteo-embedded .meteogram-header{display:flex!important;align-items:center!important;
  justify-content:space-between!important;flex-wrap:wrap!important;row-gap:6px!important;
  padding:9px 12px!important;min-width:0!important}
html.wx-meteo-embedded .meteogram-header-copy{flex:1 1 180px!important;min-width:0!important}
html.wx-meteo-embedded .meteogram-header-actions{
  display:flex!important;flex:0 1 auto!important;flex-wrap:wrap!important;
  align-items:center!important;gap:6px!important;justify-content:flex-end!important;
  min-width:0!important
}
html.wx-meteo-embedded #meteogramClose{display:none!important}
/* Preserve native chart and ensemble proportions within the actual pane. */
html.wx-meteo-embedded #meteogramChartShell{flex:1 1 auto!important;min-height:0!important}
html.wx-meteo-embedded .meteogram-mode-picker select,
html.wx-meteo-embedded .meteogram-duration-picker select,
html.wx-meteo-embedded .meteogram-model-picker select{max-width:100%!important}
@media(max-width:1050px){
 html.wx-meteo-embedded .meteogram-help-button{display:none!important}
 html.wx-meteo-embedded .meteogram-header{padding:8px!important}
 html.wx-meteo-embedded .meteogram-header h2{font-size:16px!important}
 html.wx-meteo-embedded .meteogram-header-actions{gap:5px!important}
}
@media(max-width:720px){
 html.wx-meteo-embedded #meteogramPanel:not(.is-hidden){width:100%!important;height:100%!important}
 html.wx-meteo-embedded .meteogram-header-actions{flex:1 1 100%!important;justify-content:flex-start!important}
 html.wx-meteo-embedded .meteogram-header{gap:5px!important}
 html.wx-meteo-embedded .meteogram-header-copy{flex:1 1 100%!important}
}
