/* American Regulators USA Storm Tracker: radar-first layout (ar-layout.js adds body.arx).
   The map owns the screen; everything else is one panel (Details, Layers, Alerts, More) that is a
   right-hand drawer on desktop (pinnable) and a bottom sheet on phones. Only one panel is open. */

body.arx{--arx-top:84px;--arx-drawer:400px;--arx-sheet:0px;--arx-overlay:0px;--arx-bg:#0b1624;--arx-panel:#101f30;--arx-line:#294057;--arx-ink:#eef5fb;--arx-muted:#a7bacb;--arx-gold:#e7a932;--arx-obs:#2f8fd8;--arx-fc:#a46be0;overflow:hidden;height:100dvh;overscroll-behavior:none}
body.arx *{scrollbar-width:thin}

/* ---------------------------------------------------------------- header: one compact row */
body.arx header.site-header{display:block;padding:0;position:relative;z-index:1300;background:#101f30;border-bottom:1px solid var(--arx-line)}
body.arx .header-brandline{display:none!important}
body.arx .arx-top{display:flex;align-items:center;gap:.6rem;min-height:52px;padding:6px 12px}
body.arx .arx-brand{display:flex;align-items:center;gap:.55rem;min-width:0;text-decoration:none;color:inherit;flex:0 1 auto}
body.arx .arx-brand .arx-badge{width:38px;height:38px;border-radius:50%;overflow:hidden;flex:none;position:relative;background:#fff}
body.arx .arx-brand .arx-badge img{position:absolute;width:59px;height:auto;left:50%;top:50%;transform:translate(-50%,-50%)}
body.arx .arx-brand h1{margin:0;display:flex;flex-direction:column;line-height:1.05;font-size:.95rem;letter-spacing:.04em;min-width:0}
body.arx .arx-brand h1 .org-name{font-size:.95rem;white-space:nowrap}
body.arx .arx-brand h1 .tracker-name{font-size:.72rem;color:#ffcc6a;letter-spacing:.12em}
body.arx .arx-chips{display:flex;align-items:center;gap:.45rem;min-width:0;flex:1 1 auto;justify-content:center}
body.arx .arx-chip{display:inline-flex;align-items:center;gap:.4rem;min-height:40px;max-width:100%;padding:.35rem .7rem;border-radius:999px;border:1px solid #45637b;background:#172d42;color:var(--arx-ink);font:inherit;font-size:.88rem;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.arx .arx-chip:hover{background:#244963}
body.arx .arx-chip .t{overflow:hidden;text-overflow:ellipsis}
body.arx #arx-warn[data-state="none"]{border-color:#3e7a56;background:#15301f}
body.arx #arx-warn[data-state="active"]{border-color:#ff5862;background:#4a1820;color:#ffd7da;font-weight:700}
body.arx #arx-warn[data-state="watch"]{border-color:#f2a33a;background:#3d2a10;color:#ffe2b8;font-weight:700}
body.arx #arx-warn[data-state="error"]{border-color:#9aa6b2;background:#2a3038;color:#e3e8ee}
body.arx .arx-actions{display:flex;gap:.4rem;flex:none}
body.arx .arx-btn{display:inline-flex;align-items:center;justify-content:center;gap:.35rem;min-height:44px;min-width:44px;padding:.4rem .75rem;border-radius:10px;border:1px solid #45637b;background:#172d42;color:#fff;font:inherit;font-size:.92rem;cursor:pointer;white-space:nowrap}
body.arx .arx-btn:hover{background:#244963}
body.arx .arx-btn[hidden],body.arx .arx-chip[hidden]{display:none!important}
body.arx .arx-btn[aria-expanded="true"],body.arx .arx-btn[aria-pressed="true"]{background:#1b4b55;border-color:#5fc5c1}
body.arx .arx-btn svg{width:20px;height:20px;flex:none}
body.arx .arx-btn:focus-visible,body.arx .arx-chip:focus-visible{outline:3px solid #ffc351;outline-offset:2px}
body.arx .emergency-banner{display:block;width:100%;margin:0;border:0;border-top:1px solid #983140;border-radius:0;padding:4px 12px;font-size:.86rem;line-height:1.35;text-align:center;letter-spacing:.01em}

/* ---------------------------------------------------------------- main: map + panel */
body.arx main{display:grid!important;grid-template-columns:minmax(0,1fr);height:calc(100dvh - var(--arx-top));min-height:0!important;position:relative}
body.arx.arx-pinned main{grid-template-columns:minmax(0,1fr) var(--arx-drawer)}
body.arx .map-wrap{position:relative!important;display:block!important;height:100%!important;min-height:0!important;overflow:hidden}
body.arx #map{position:absolute!important;inset:0;height:100%!important;min-height:0!important;width:100%}
body.arx .bar,body.arx .map-utility,body.arx .map-readouts,body.arx .prep-wrn{display:none!important}

/* map tools: search + My Location (top-left), Layers + fullscreen (top-right, under zoom) */
body.arx .arx-tools{position:absolute;top:10px;left:10px;right:64px;z-index:1000;display:flex;flex-direction:column;gap:8px;pointer-events:none;max-width:560px}
body.arx .arx-tools>*{pointer-events:auto}
body.arx .arx-searchrow{display:flex;gap:6px;align-items:stretch}
body.arx .arx-search{position:relative;flex:1 1 auto;min-width:0;display:flex}
body.arx .arx-search input{flex:1 1 auto;min-width:0;min-height:44px;padding:.5rem .75rem;border-radius:10px 0 0 10px;border:1px solid #45637b;border-right:0;background:#0f2233;color:#fff;font:inherit;font-size:16px}
body.arx .arx-search input::placeholder{color:#9fb3c4}
body.arx .arx-search button{min-height:44px;padding:0 .8rem;border-radius:0 10px 10px 0;border:1px solid #45637b;background:#172d42;color:#fff;font:inherit;cursor:pointer}
body.arx .arx-results{position:absolute;top:calc(100% + 4px);left:0;right:0;margin:0;padding:4px;list-style:none;background:#0f2233;border:1px solid #45637b;border-radius:10px;box-shadow:0 10px 30px #000a;max-height:min(50vh,var(--arx-results-max,320px));overflow:auto;overscroll-behavior:contain;z-index:5}
body.arx .arx-results[hidden]{display:none}
body.arx .arx-results li{padding:.65rem .7rem;border-radius:8px;cursor:pointer;min-height:44px;display:flex;flex-direction:column;justify-content:center}
body.arx .arx-results li small{color:var(--arx-muted)}
body.arx .arx-results li[aria-selected="true"],body.arx .arx-results li:hover{background:#244963}
body.arx .arx-results .arx-empty{cursor:default;color:var(--arx-muted)}
body.arx .arx-mytools{display:flex;gap:6px}
body.arx #arx-locate{background:var(--arx-gold);color:#14202c;border:0;font-weight:700}
body.arx .arx-note{background:#0f2233ee;border:1px solid #35536d;border-radius:10px;padding:.5rem .7rem;font-size:.88rem;line-height:1.4;box-shadow:0 6px 20px #0008}
body.arx .arx-note[hidden]{display:none}
body.arx .arx-note .row{display:flex;flex-wrap:wrap;align-items:center;gap:.4rem .6rem}
body.arx .arx-note button{min-height:36px;padding:.25rem .6rem;border-radius:8px;border:1px solid #45637b;background:#172d42;color:#fff;font:inherit;font-size:.85rem;cursor:pointer}
body.arx .arx-note details summary{cursor:pointer;color:#ffcc6a;margin-top:.25rem}
body.arx .arx-note .x{margin-left:auto;background:transparent;border:0;min-width:36px}
body.arx .arx-right{position:absolute;right:10px;top:110px;z-index:1000;display:flex;flex-direction:column;gap:6px;align-items:flex-end}
body.arx .leaflet-top.leaflet-right .leaflet-control-zoom{margin-top:10px;margin-right:10px}
body.arx .leaflet-control-zoom a{width:44px!important;height:44px!important;line-height:44px!important;font-size:20px}

/* first-visit and install cards float over the map instead of pushing it down */
body.arx .ar-card{position:relative;border:1px solid #35536d;border-radius:12px;background:#13283cf2;box-shadow:0 10px 30px #000a;padding:.7rem .85rem}

/* ---------------------------------------------------------------- playback bar (inside the map) */
body.arx .radar-loop-control{position:absolute!important;z-index:1000;left:12px!important;right:calc(12px + var(--arx-overlay))!important;bottom:calc(12px + var(--arx-sheet) + env(safe-area-inset-bottom))!important;transform:none!important;width:auto!important;max-width:620px;margin:0 auto;display:grid!important;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"btns track latest" "frame frame frame";align-items:center;gap:6px 10px;padding:8px 10px!important;border-radius:14px;max-height:none!important;overflow:visible!important;transition:bottom .18s ease}
body.arx .radar-loop-control[hidden]{display:none!important}
body.arx .radar-loop-title,body.arx .radar-model-note,body.arx #radar-loop-status{display:none!important}
body.arx .radar-loop-actions{grid-area:btns;display:flex!important;gap:6px;width:auto!important}
body.arx .radar-loop-actions button{min-width:44px;min-height:44px!important;padding:0 .55rem!important;font-size:1rem!important}
body.arx #radar-loop-stop{grid-area:latest}
body.arx .radar-loop-track{grid-area:track;min-width:0}
body.arx #radar-loop-range{width:100%;height:44px;margin:0;background:transparent;-webkit-appearance:none;appearance:none;cursor:pointer}
body.arx #radar-loop-range::-webkit-slider-runnable-track{height:6px;border-radius:3px;background:linear-gradient(90deg,var(--arx-obs) 0 66.6%,var(--arx-fc) 66.6% 100%)}
body.arx #radar-loop-range::-moz-range-track{height:6px;border-radius:3px;background:linear-gradient(90deg,var(--arx-obs) 0 66.6%,var(--arx-fc) 66.6% 100%)}
body.arx #radar-loop-range::-webkit-slider-thumb{-webkit-appearance:none;width:24px;height:24px;margin-top:-9px;border-radius:50%;background:#fff;border:3px solid #0b1624;box-shadow:0 0 0 1px #fff}
body.arx #radar-loop-range::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:#fff;border:3px solid #0b1624}
body.arx #radar-loop-range:focus-visible{outline:3px solid #ffc351;outline-offset:2px;border-radius:6px}
body.arx .radar-loop-endpoints{display:flex;justify-content:space-between;font-size:.72rem;color:var(--arx-muted)}
body.arx .arx-frame{grid-area:frame;display:flex;flex-wrap:wrap;align-items:center;gap:.35rem .6rem;font-size:.86rem;min-height:22px}
body.arx .arx-frame .kind{display:inline-block;padding:.05rem .45rem;border-radius:6px;font-size:.72rem;font-weight:800;letter-spacing:.06em}
body.arx .arx-frame .kind.obs{background:#123a5c;color:#bfe1ff;border:1px solid var(--arx-obs)}
body.arx .arx-frame .kind.fc{background:#35205a;color:#ecd9ff;border:1px dashed var(--arx-fc)}
body.arx .arx-frame .kind.bad{background:#40262a;color:#ffd0d4;border:1px solid #d86a74}
body.arx .arx-frame .state{color:var(--arx-muted)}
body.arx .radar-loop-control.is-forecast{border-color:var(--arx-fc)!important;box-shadow:0 0 0 1px var(--arx-fc),0 8px 28px #000b}

/* ---------------------------------------------------------------- the panel */
body.arx aside.panel{display:none;flex-direction:column;padding:0!important;background:var(--arx-panel);border-left:1px solid var(--arx-line);overflow:hidden!important;min-height:0;z-index:1200}
body.arx.arx-open aside.panel{display:flex}
body.arx .arx-phead{display:flex;align-items:center;gap:.4rem;padding:8px 10px 8px 14px;border-bottom:1px solid var(--arx-line);flex:none}
body.arx .arx-phead h2{margin:0;font-size:1.05rem;flex:1 1 auto;min-width:0}
body.arx .arx-handle{display:none}
body.arx .arx-pbody{flex:1 1 auto;overflow:auto;overscroll-behavior:contain;padding:12px 14px calc(16px + env(safe-area-inset-bottom));-webkit-overflow-scrolling:touch}
body.arx .arx-view[hidden]{display:none}
body.arx .arx-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;margin:0 0 12px;position:sticky;top:-12px;background:var(--arx-panel);padding:6px 0;z-index:2}
body.arx .arx-tabs button{min-height:44px;padding:.3rem .25rem;border-radius:8px;border:1px solid #35536d;background:#13283c;color:#dbe7ef;font:inherit;font-size:.8rem;line-height:1.15;cursor:pointer}
body.arx .arx-tabs button[aria-selected="true"]{background:#1b4b55;border-color:#5fc5c1;color:#fff;font-weight:700}
body.arx .arx-group>h3{margin:.2rem 0 .6rem;font-size:1rem}
body.arx .arx-group .sidebar-category{margin:0 0 .6rem}
body.arx .arx-lead{margin:0 0 .75rem;color:var(--arx-muted);font-size:.9rem;line-height:1.45}
body.arx .arx-foot{margin-top:1rem;border-top:1px solid var(--arx-line);padding-top:.6rem;font-size:.8rem;color:var(--arx-muted)}
body.arx .arx-group .header-weather{display:grid!important;margin:0 0 .8rem}
body.arx .arx-group .header-weather .weather-metrics{grid-template-columns:repeat(3,minmax(0,1fr))!important}
body.arx #preparedness-menu{position:static}
body.arx #preparedness-menu>.control-menu-body{position:static!important;display:block;width:auto!important;max-width:none!important;max-height:none!important;box-shadow:none;border:0;padding:.5rem 0 0;background:transparent}

/* desktop drawer: overlays the map until pinned, then takes its own column */
@media (min-width:900px){
  body.arx aside.panel{position:absolute;top:0;right:0;bottom:0;width:var(--arx-drawer);box-shadow:-12px 0 30px #0008}
  body.arx.arx-pinned aside.panel{position:relative;box-shadow:none;width:auto}
  body.arx.arx-open:not(.arx-pinned){--arx-overlay:var(--arx-drawer)}
  body.arx.arx-open:not(.arx-pinned) .arx-right{right:calc(10px + var(--arx-drawer))}
  body.arx.arx-open:not(.arx-pinned) .arx-tools{right:calc(64px + var(--arx-drawer))}
  body.arx.arx-open:not(.arx-pinned) .leaflet-right{right:var(--arx-drawer)}
}

/* ---------------------------------------------------------------- Layers view */
body.arx .arx-lsec{border:1px solid #2c4760;border-radius:10px;padding:.6rem .7rem;margin:0 0 .7rem;background:#13283c}
body.arx .arx-lsec>h3{margin:0 0 .4rem;font-size:.95rem}
body.arx .arx-lsec p{margin:.3rem 0;font-size:.84rem;color:var(--arx-muted);line-height:1.4}
body.arx .arx-switch{display:flex;align-items:center;justify-content:space-between;gap:.6rem;width:100%;min-height:44px;padding:.35rem .1rem;border:0;background:transparent;color:var(--arx-ink);font:inherit;font-size:.93rem;text-align:left;cursor:pointer}
body.arx .arx-switch .sw{flex:none;width:44px;height:24px;border-radius:12px;background:#3a4f63;position:relative;transition:background .15s}
body.arx .arx-switch .sw::after{content:"";position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:#fff;transition:left .15s}
body.arx .arx-switch[aria-checked="true"] .sw{background:#2aa39c}
body.arx .arx-switch[aria-checked="true"] .sw::after{left:23px}
body.arx .arx-switch .lbl small{display:block;color:var(--arx-muted);font-size:.78rem}
body.arx .arx-switch:focus-visible{outline:3px solid #ffc351;outline-offset:2px;border-radius:8px}
body.arx .arx-lsec .legend{position:static!important;display:flex;flex-wrap:wrap;gap:.3rem .5rem;align-items:center;font-size:.8rem;margin:.3rem 0;background:transparent;padding:0;box-shadow:none}
body.arx .arx-lsec .legend[hidden]{display:none!important}
body.arx .arx-lsec .radar-tools label{font-size:.86rem}
body.arx .arx-lsec input[type=range]{width:100%}
body.arx .arx-lsec select{width:100%;min-height:44px}
body.arx .arx-lsec details>summary{cursor:pointer;min-height:40px;display:flex;align-items:center;font-weight:700}
body.arx .arx-reset{width:100%;min-height:44px;margin-top:.3rem}

/* ---------------------------------------------------------------- Alerts (bell) and More views */
body.arx .arx-box{border:1px solid #2c4760;border-radius:10px;padding:.7rem .8rem;margin:0 0 .8rem;background:#13283c}
body.arx .arx-box>h3{margin:0 0 .4rem;font-size:1rem}
body.arx .arx-box .push-settings{border:0;padding:0;margin:0;background:transparent}
body.arx .arx-box select{width:100%;min-height:44px}
body.arx .arx-partners{display:flex;flex-wrap:wrap;gap:.8rem;align-items:center}
body.arx .arx-partners .wrn-mark,body.arx .arx-partners .skywarn-mark{display:block!important;position:relative;width:auto!important}
body.arx .arx-partners .wrn-mark img{width:140px;height:auto}
body.arx .arx-partners .skywarn-mark img{height:100px;width:auto}
body.arx .arx-more-links{display:flex;flex-wrap:wrap;gap:.5rem;margin:.5rem 0 0}
body.arx .arx-more-links a,body.arx .arx-more-links button{min-height:44px;display:inline-flex;align-items:center}

/* ---------------------------------------------------------------- phones: bottom sheet */
@media (max-width:899px){
  body.arx .arx-brand h1 .org-name{font-size:.8rem}
  body.arx .arx-brand h1 .tracker-name{font-size:.66rem}
  body.arx .arx-top{gap:.4rem;padding:5px 8px;flex-wrap:nowrap}
  body.arx .arx-chips{justify-content:flex-start}
  body.arx .arx-chips{display:none}
  body.arx .arx-chiprow{display:flex;gap:6px}
  body.arx .arx-chiprow[hidden]{display:none}
  body.arx .arx-chiprow .arx-chip{flex:1 1 0;min-width:0;min-height:44px;justify-content:center;box-shadow:0 4px 14px #0007}
  body.arx .arx-brand h1 .org-name{white-space:normal}
  body.arx .arx-btn .lbl{display:none}
  body.arx .arx-btn{padding:.4rem .55rem}
  body.arx .emergency-banner{font-size:.78rem;padding:3px 8px}
  body.arx .arx-tools{right:10px;max-width:none}
  body.arx .arx-right{top:auto;bottom:calc(var(--arx-sheet) + var(--arx-play,120px) + 22px + env(safe-area-inset-bottom));right:10px}
  body.arx .leaflet-top.leaflet-right{top:auto;bottom:calc(var(--arx-sheet) + var(--arx-play,120px) + 22px + env(safe-area-inset-bottom) + 106px)}
  body.arx aside.panel{position:fixed;left:0;right:0;bottom:0;top:auto;width:auto;height:var(--arx-sheet);border-left:0;border-top:1px solid var(--arx-line);border-radius:16px 16px 0 0;box-shadow:0 -12px 30px #000a;transition:height .18s ease}
  body.arx .arx-handle{display:block;width:100%;height:26px;border:0;background:transparent;cursor:grab;touch-action:none;flex:none;position:relative}
  body.arx .arx-handle::before{content:"";position:absolute;left:50%;top:9px;width:44px;height:5px;margin-left:-22px;border-radius:3px;background:#5d7a93}
  body.arx .arx-phead{padding-top:0;touch-action:none}
  body.arx .arx-pin{display:none!important}
  body.arx .radar-loop-control{left:8px!important;right:8px!important;bottom:calc(24px + var(--arx-sheet) + env(safe-area-inset-bottom))!important;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"btns track latest" "frame frame frame";padding:4px 8px!important;gap:0 8px}
  body.arx .radar-loop-endpoints{display:none!important}
  body.arx .radar-loop-actions{gap:4px}
  body.arx .radar-loop-actions button{min-width:44px;padding:0 .35rem!important}
  body.arx #radar-loop-button{font-size:0!important;width:48px}
  body.arx #radar-loop-button::first-letter{font-size:1.15rem}
  body.arx .arx-frame{flex-wrap:nowrap;white-space:nowrap;overflow:hidden;font-size:.8rem}
  body.arx .arx-frame span:nth-child(2){overflow:hidden;text-overflow:ellipsis}
  body.arx .leaflet-control-attribution{max-width:calc(100vw - 16px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:10px;cursor:pointer}
  body.arx .leaflet-control-attribution.arx-open-attr{white-space:normal;position:relative;z-index:1100;background:#fffffff2}
  body.arx #radar-loop-stop{justify-self:end}
}
@media (max-width:899px){
  /* while a sheet is open, pinch zoom replaces the side buttons; at full height the search row
     tucks away too, and the playback bar stays just above the sheet */
  body.arx.arx-open .arx-right,body.arx.arx-open .leaflet-control-zoom{display:none!important}
  body.arx.arx-sheet-full .arx-tools{display:none!important}
}
@media (max-width:899px) and (orientation:landscape) and (max-height:500px){
  body.arx .emergency-banner{font-size:.74rem;padding:2px 8px}
  body.arx .radar-loop-control{grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"btns track latest" "frame frame frame";max-width:640px}
  body.arx .arx-tools{max-width:420px}
}
@media (min-width:900px){ body.arx .arx-expand{display:none!important} }
@media (prefers-reduced-motion:reduce){ body.arx aside.panel,body.arx .radar-loop-control{transition:none} }

/* ---------------------------------------------------------------- Power outages (ar-outages.js) */
body.arx .arx-out-status{font-size:.84rem;margin:.3rem 0;color:var(--arx-muted)}
body.arx .arx-out-status[data-kind="stale"],body.arx .arx-out-status[data-kind="error"]{color:#ffd0a8;background:#3a2410;border:1px solid #8a5a20;border-radius:8px;padding:.4rem .55rem}
body.arx .arx-out-status:empty{display:none}
body.arx .arx-out-op{display:block;font-size:.84rem;margin:.3rem 0}
body.arx .arx-out-legend{display:flex;flex-wrap:wrap;align-items:center;gap:.2rem .45rem;font-size:.78rem;margin:.35rem 0}
body.arx .arx-out-legend i{display:inline-block;width:14px;height:14px;border-radius:3px;vertical-align:-2px;border:1px solid #0006}
body.arx .arx-out-legend i.unknown{background:transparent;border:1.5px dashed #c9b8a6}
body.arx .arx-out-note{font-size:.78rem!important}
.arx-out-pop p{margin:.3rem 0}.arx-out-pop ul{margin:.3rem 0;padding-left:1.1rem}.arx-out-pop .stale{color:#9a3a00;font-weight:700}.arx-out-pop .src{font-size:.78rem;color:#555}
