/* Weather and radar share the space around a narrower clock: 37.5 / 25 / 37.5. */
:is([data-design=atmosphere],[data-design=classic]) .dashboard-thirds{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr) minmax(0,3fr);gap:14px;align-items:stretch;height:auto;min-height:230px}
.dashboard-thirds{--dashboard-reading-size:clamp(60px,calc(9.5vw - 17px),170px)}
.dashboard-thirds>*,.dashboard-thirds .map-card{min-width:0;min-height:0}
.dashboard-thirds>*{order:0}
.dashboard-thirds .map-card{container-type:inline-size;container-name:dashboard-radar}
.clock-card{container-type:inline-size;position:relative;display:flex;border:1px solid var(--line);border-radius:20px;background:radial-gradient(ellipse at 50% 10%,color-mix(in srgb,var(--blue),transparent 90%),transparent 75%),var(--surface);padding:12px;min-height:230px;color:var(--text);box-shadow:inset 0 1px 0 #ffffff08}
.clock-card .clock-block{min-width:0;width:100%;display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center}
.clock-card .clock-toggle{flex:1;width:100%;height:auto;min-height:120px;justify-content:center;align-items:center}
.clock-card .top-clock{font-size:var(--dashboard-reading-size);font-weight:350;line-height:1;letter-spacing:-.045em;font-variant-numeric:tabular-nums}
.clock-card .analog-clock{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:min(100cqi,360px);height:calc(100% - 4px);max-height:360px}
.clock-card .top-date{flex:none;margin:0;padding:0 0 2px;font-size:clamp(28px,13cqi,44px);font-weight:450;line-height:1.2;max-width:100%;text-align:center;color:var(--muted)}
[data-design=classic] .clock-card{border-radius:15px}
[data-design=atmosphere] .dashboard-thirds .sky-hero{container-type:inline-size}
[data-design=atmosphere] .dashboard-thirds .hero-reading{position:relative;left:auto;right:auto;bottom:auto;display:grid;grid-template-columns:max-content minmax(0,1fr);gap:8px 12px;margin:12px 18px 18px;align-items:center}
[data-design=atmosphere] .dashboard-thirds .hero-temperature{grid-column:1;grid-row:1;margin:0;font-size:var(--dashboard-reading-size);font-weight:350;line-height:1}
[data-design=classic] .dashboard-thirds .temperature{font-size:var(--dashboard-reading-size);font-weight:350}
[data-design=atmosphere] .dashboard-thirds .hero-reading h2{grid-column:2;grid-row:1;align-self:center;font-size:24px;overflow-wrap:anywhere}
[data-design=atmosphere] .dashboard-thirds .hero-reading p{grid-column:1/-1;grid-row:2;margin-top:0;align-self:start;font-size:20px}
[data-design=atmosphere] .dashboard-thirds .atmos-radar{height:auto;min-height:230px}
[data-design=atmosphere] .nav-tools{width:auto}
@media(min-width:801px){
  [data-design=classic] body[data-view=overview] .display-frame{min-height:100vh;min-height:100dvh}
  [data-design=classic] body[data-view=overview] .main{display:flex;flex-direction:column;gap:14px}
  [data-design=classic] body[data-view=overview] .main>.display-context{flex:none}
  [data-design=classic] .dashboard-thirds{flex:1 0 auto;min-height:350px}
  [data-design=classic] body[data-view=overview] .forecast-band{flex:none;margin-top:0}
}
.dashboard-thirds .map-controls{grid-template-columns:44px minmax(0,1fr) 60px;gap:8px;left:8px;right:8px;bottom:22px;padding:2px 8px;border-radius:12px}
.dashboard-thirds .play-button{width:44px;height:44px}
.dashboard-thirds .radar-time{font-size:22px;line-height:1.15}
.dashboard-thirds .range-wrap .radar-scale{font-size:15px;margin:0;line-height:18px;white-space:nowrap}
.dashboard-thirds .radar-track{padding:0}
.dashboard-thirds #radar-slider{height:24px;min-height:24px}
.dashboard-thirds .radar-now-marker{top:18px;font-size:0;line-height:0}
.dashboard-thirds .radar-now-marker::before{height:12px}
@container dashboard-radar (max-width:320px){
  .dashboard-thirds .map-controls{grid-template-columns:44px minmax(0,1fr)}
  .dashboard-thirds .radar-time{position:absolute;bottom:calc(100% + 6px);right:0;padding:5px 8px;border-radius:8px;background:var(--surface)}
}
/* Filter the OSM tiles only: precipitation, marker and controls retain their colours. */
.map[data-dark-map=true]{background:#15212c}
.map[data-dark-map=true] .leaflet-tile-pane{filter:invert(1) hue-rotate(180deg) saturate(.45) brightness(.76) contrast(.9)}
.dashboard-thirds .radar-filter{position:absolute;z-index:550;top:8px;right:52px;width:44px;height:44px;display:grid;place-items:center;padding:9px;border:1px solid #ffffff30;border-radius:12px;background:#172b3aeb;color:#f0f7f9}
.dashboard-thirds .radar-filter svg{width:24px;height:24px}
.dashboard-thirds .radar-filter[aria-pressed=true]{background:#d9e6f0;color:#172b3a}
[data-design=atmosphere] .dashboard-thirds .map-heading{top:8px;left:10px;right:104px;max-width:calc(100% - 114px);padding:6px 10px}
[data-design=atmosphere] .dashboard-thirds .map-heading p{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
[data-design=atmosphere] .dashboard-thirds .radar-legend{display:none}
[data-design=atmosphere] .dashboard-thirds .leaflet-top.leaflet-left{left:auto;right:10px}
[data-design=atmosphere] .dashboard-thirds .leaflet-control-zoom{margin-top:8px!important;margin-left:0!important}
@media(max-width:800px){
  .dashboard-thirds{--dashboard-reading-size:clamp(60px,32vw,170px)}
  :is([data-design=atmosphere],[data-design=classic]) .dashboard-thirds{grid-template-columns:minmax(0,1fr);height:auto;gap:14px}
  .dashboard-thirds .clock-card{height:clamp(240px,34dvh,360px)}
  [data-design=atmosphere] .dashboard-thirds .sky-hero{display:flex;flex-direction:column;justify-content:space-between}
  [data-design=atmosphere] .dashboard-thirds .atmos-radar{height:clamp(280px,40dvh,460px)}
  [data-design=classic] .dashboard-thirds>.map-card{height:clamp(300px,45dvh,500px)}
  [data-design=atmosphere] .nav-shell .nav{flex:1 1 0;order:0}
}

/* A single readable value line gives its former label space back to the map. */
[data-design=atmosphere] .atmos-metrics{grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}
[data-design=atmosphere] .atmos-metric{min-height:58px;padding:8px 12px;gap:10px;border-radius:14px}
[data-design=atmosphere] .atmos-metric .metric-symbol{display:block;width:28px;height:28px;flex:0 0 28px}
[data-design=atmosphere] .atmos-metric strong{font-size:34px;line-height:1.15;margin:0;letter-spacing:-.035em}
[data-design=atmosphere] .atmos-metric strong small{font-size:20px}
[data-design=atmosphere] .atmos-hours{position:relative;display:block;width:100%;padding:8px 12px;text-align:inherit;touch-action:manipulation}
[data-design=atmosphere] .atmos-hours:hover{border-color:var(--muted)}
.hour-step-badge{position:absolute;right:12px;top:-10px;padding:1px 8px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--muted);font-size:13px;line-height:18px;white-space:nowrap}
@media(min-width:801px) and (max-width:900px){
  [data-design=atmosphere] .atmos-metric{padding:8px;gap:8px}
  [data-design=atmosphere] .atmos-metric strong{font-size:30px}
  [data-design=atmosphere] .atmos-metric strong small{font-size:18px}
}
@media(max-width:800px){
  [data-design=atmosphere] .atmos-metrics{grid-template-columns:repeat(6,minmax(0,1fr))}
  [data-design=atmosphere] .atmos-metric{grid-column:span 2}
  [data-design=atmosphere] .atmos-metric:nth-last-child(-n+2){grid-column:span 3}
}
@media(max-width:540px){
  [data-design=atmosphere] .atmos-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
  [data-design=atmosphere] .atmos-metric,[data-design=atmosphere] .atmos-metric:nth-last-child(-n+2){grid-column:auto;padding:8px 10px;gap:8px}
  [data-design=atmosphere] .atmos-metric:first-child{grid-column:1/-1}
  [data-design=atmosphere] .atmos-metric strong{font-size:30px}
}

/* Reserve space for the forecasts before sizing the three main tiles. A definite
   frame and a shrinkable flex row also work on older Android WebViews without
   container queries or dynamic viewport units. Extremely short screens scroll
   inside main instead of clipping weather values. */
@media(min-width:801px){
  [data-design=atmosphere] body[data-view=overview] .display-frame{
    flex:none;height:100vh;height:100dvh;min-height:0;
    grid-template-rows:auto auto minmax(0,1fr);
  }
  [data-design=atmosphere] body[data-view=overview] .main{
    min-height:0;overflow:auto;scrollbar-width:thin;
  }
  [data-design=atmosphere] .dashboard-thirds{
    flex:1 1 0;min-height:200px;grid-template-rows:minmax(0,1fr);
  }
  [data-design=atmosphere] .dashboard-thirds :is(.sky-hero,.clock-card,.atmos-radar,.map-card){min-height:0}
  .dashboard-thirds .clock-block,.dashboard-thirds .clock-toggle{min-height:0}
}
/* Short landscape tablets keep the readable values; padding and the tall
   forecast stack give way first. Navigation remains reachable by swiping. */
@media(min-width:801px) and (max-height:740px){
  [data-design=atmosphere] body[data-view=overview] .topbar{min-height:60px;padding:6px 0}
  [data-design=atmosphere] body[data-view=overview] .topbar .brand.brand-logo{width:150px;flex-basis:150px}
  [data-design=atmosphere] body[data-view=overview] .nav-shell{padding:4px 0 6px;gap:8px}
  [data-design=atmosphere] body[data-view=overview] .nav{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
  [data-design=atmosphere] body[data-view=overview] .nav::-webkit-scrollbar{display:none}
  [data-design=atmosphere] body[data-view=overview] .nav-button{flex:none;white-space:nowrap;padding:9px 10px;min-height:44px}
  [data-design=atmosphere] body[data-view=overview] .main{gap:8px;padding-bottom:8px;padding-bottom:max(8px,env(safe-area-inset-bottom))}
  [data-design=atmosphere] .dashboard-thirds{min-height:180px;gap:10px;--dashboard-reading-size:clamp(60px,min(calc(9.5vw - 17px),15vh),170px)}
  [data-design=atmosphere] .dashboard-thirds .hero-reading{margin:8px 14px 10px;gap:6px 10px}
  [data-design=atmosphere] .dashboard-thirds .hero-reading h2{font-size:22px}
  [data-design=atmosphere] .dashboard-thirds .clock-card{padding:8px}
  [data-design=atmosphere] .dashboard-thirds .top-date{font-size:28px;line-height:1.2}
  [data-design=atmosphere] body[data-view=overview] .atmos-hours{padding-top:6px;padding-bottom:6px}
  [data-design=atmosphere] body[data-view=overview] .day-card{display:grid;grid-template-columns:auto auto;justify-content:center;align-content:center;column-gap:4px;row-gap:0;padding:6px 4px}
  [data-design=atmosphere] body[data-view=overview] .day-card .day-label{grid-column:1/-1}
  [data-design=atmosphere] body[data-view=overview] .day-card .weather-icon{width:32px;height:32px}
  [data-design=atmosphere] body[data-view=overview] .day-card .day-temperatures{font-size:clamp(22px,2.2vw,28px);white-space:nowrap}
  [data-design=atmosphere] body[data-view=overview] .day-card .day-temperatures span{font-size:clamp(18px,1.9vw,24px);margin-left:4px}
  [data-design=atmosphere] body[data-view=overview] .day-card .rain-small{grid-column:1/-1;margin-top:0}
}
