/* AMM 2.27.77 · UNMISSABLE header lowering + easier bottom dock.
   This stylesheet loads last across pages to resolve the legacy cascade.
   Do not disable pinch zoom. No fixed document height or scroll lock. */
:root{--amm-edge:24px;--amm-physical-top-clearance:72px;--amm-safe-top:env(safe-area-inset-top,0px);--amm-safe-bottom:env(safe-area-inset-bottom,0px)}
html{scroll-behavior:auto;scroll-padding-bottom:150px;max-width:100%;overflow-x:clip}
body{max-width:100%;min-width:0;overflow-x:clip}
.amm-universal-history{box-sizing:border-box}
.amm-universal-history button{touch-action:manipulation}
@media(max-width:820px){
  :root{--amm-edge:24px}
  html{width:100%;scroll-padding-top:24px;scroll-padding-bottom:calc(235px + var(--amm-safe-bottom));-webkit-text-size-adjust:100%}
  body{width:100%;min-width:0;overflow-x:clip;min-height:100%;-webkit-overflow-scrolling:touch;
    padding-top:var(--amm-physical-top-clearance)!important;
    box-sizing:border-box!important;
  }
  /* Deliberately empty top zone before ALL page chrome, instead of the old tiny 10px tweak.
     Header + Back/Forward are both moved lower IN DOCUMENT FLOW, not just painted lower. */
  body>header,body>.amm-universal-history{scroll-margin-top:calc(22px + env(safe-area-inset-top,0px))}
  /* All top-corner controls remain INSIDE the physical screen edge and notch. */
  body>header.topbar,
  body>header.radio-header,
  body>header.ml-top,
  body>header.seo-header,
  body>header:not([class]){
    box-sizing:border-box!important;
    width:100%!important;max-width:100%!important;
    padding-top:calc(10px + var(--amm-safe-top))!important;
    padding-bottom:9px!important;
    padding-left:max(var(--amm-edge),env(safe-area-inset-left,0px))!important;
    padding-right:max(var(--amm-edge),env(safe-area-inset-right,0px))!important;
    gap:8px!important;
  }
  body>header.topbar{position:relative!important;top:auto!important;min-height:62px!important}
  body>header .amm4-head-actions{gap:7px!important;flex:none;max-width:50%;justify-content:flex-end}
  body>header.topbar .amm4-head-actions button{
    min-height:44px!important;min-width:46px!important;
    padding:9px 11px!important;font-size:12px!important;
    touch-action:manipulation!important;
  }
  body>header.topbar .brand{min-width:0;max-width:50%}
  body>header.topbar .brand-type{min-width:0}
  body>header.topbar .brand-type strong{font-size:10px!important}
  /* Slim, reachable Back/Forward row. Does not stick over content or steal scroll. */
  body>.amm-universal-history{
    position:relative!important;top:auto!important;
    z-index:45!important;box-sizing:border-box!important;
    width:calc(100% - 2 * var(--amm-edge))!important;
    margin:7px var(--amm-edge) 4px!important;
    padding:3px 6px!important;min-height:46px!important;
    border:1px solid rgba(156,187,240,.22)!important;
    border-radius:14px!important;
    background:rgba(12,20,35,.93)!important;
  }
  body>.amm-universal-history button{
    min-height:40px!important;min-width:64px!important;
    font-size:13px!important;padding:8px 11px!important;
  }
  body>.amm-universal-history .amm-universal-location{font-size:11px;max-width:32%;text-align:right}
  /* Shorter hero; the essentials land earlier without reducing legibility. */
  #home.amm5-home{padding-top:12px!important;padding-left:var(--amm-edge)!important;padding-right:var(--amm-edge)!important;padding-bottom:48px!important;overflow-x:clip!important}
  #home .amm5-hero{padding-top:17px!important;padding-bottom:22px!important;gap:18px!important}
  #home .amm5-hero h1{margin-top:10px!important;margin-bottom:14px!important}
  #home .amm5-hero-copy>p{margin-bottom:15px!important}
  #home .amm5-desk{margin-top:28px!important}
  #home .amm5-paths{margin-top:34px!important}
  /* Dock must be physically reachable, not behind home indicator / gesture bar. */
  body .mobile-dock.amm-public-dock{
    position:fixed!important;
    left:max(var(--amm-edge),env(safe-area-inset-left,0px))!important;
    right:max(var(--amm-edge),env(safe-area-inset-right,0px))!important;
    bottom:calc(76px + var(--amm-safe-bottom))!important;
    width:auto!important;max-width:530px!important;
    margin-inline:auto!important;
    transform:none!important;
    padding:6px!important;z-index:110!important;
    -webkit-transform:translateZ(0)!important;
  }
  body .mobile-dock.amm-public-dock a{
    min-height:53px!important;max-width:100%;touch-action:manipulation!important;
    padding:5px 2px!important;
  }
  body .mobile-dock.amm-public-dock .amm-public-dock-label{font-size:10px!important;max-width:100%!important}
  body:has(.amm-public-dock){padding-bottom:calc(240px + var(--amm-safe-bottom))!important}
  body:has(.amm-public-dock) .mini-player{bottom:calc(166px + var(--amm-safe-bottom))!important}
  body:has(.amm-public-dock) .back-to-top{bottom:calc(184px + var(--amm-safe-bottom))!important}
  .radio-page .radio-dock:not(.hidden){bottom:calc(76px + var(--amm-safe-bottom))!important;max-width:calc(100% - 2 * var(--amm-edge))!important}
  .admin-body .amm-x-mobile-admin-dock{bottom:calc(76px + var(--amm-safe-bottom))!important;left:var(--amm-edge)!important;right:var(--amm-edge)!important;width:auto!important}
  .admin-body .admin-shell,.radio-page .radio-main{padding-bottom:calc(248px + var(--amm-safe-bottom))!important}
  /* All dialogs fit the visible viewport, have an internal scroll, and retain exits. */
  #amm4Menu[open], dialog[open]{
    box-sizing:border-box;max-width:calc(100vw - 2 * var(--amm-edge));
    max-height:calc(100dvh - var(--amm-safe-top) - var(--amm-safe-bottom) - 50px)!important;
    overscroll-behavior:contain;
  }
  #amm4Menu[open]{width:calc(100vw - 2 * var(--amm-edge))!important;overflow-y:auto!important;
    margin:auto!important;border-radius:18px!important}
  .amm4-menu-head{padding:15px 17px 12px!important;position:sticky;top:0;z-index:1;background:#111a2c}
  .amm4-menu-list{padding:8px!important}
  .amm4-menu-list a{min-height:44px!important;padding:10px 12px!important}
  .amm4-menu-utilities,.amm4-menu-history{margin:6px 10px 12px!important}
  /* The final item of every page must be able to scroll completely above the dock. */
  body>main, body>footer{max-width:100%;scroll-margin-bottom:calc(240px + var(--amm-safe-bottom))}
  body>footer{padding-bottom:max(30px,var(--amm-safe-bottom))}
  a,button,[role="button"]{-webkit-tap-highlight-color:transparent}
}
@media(max-width:370px){
  :root{--amm-edge:18px}
  body>header.topbar .brand-logo-wrap{width:32px!important;height:32px!important;flex-basis:32px!important}
  body>header.topbar .brand-type strong{font-size:9px!important}
  body>header.topbar .amm4-head-actions button{padding:8px 9px!important;min-width:42px!important}
  body>.amm-universal-history .amm-universal-location{display:none!important}
  body>.amm-universal-history{justify-content:space-between!important}
  #home .amm5-hero h1{font-size:clamp(40px,11.7vw,48px)!important}
}
@media(max-height:570px) and (orientation:landscape){
  :root{--amm-physical-top-clearance:28px} body>.topbar{padding-top:calc(5px + var(--amm-safe-top))!important;padding-bottom:5px!important;min-height:52px!important}
  body .mobile-dock.amm-public-dock{bottom:calc(28px + var(--amm-safe-bottom))!important}
  body>.amm-universal-history{min-height:40px!important}
  #home .amm5-hero{padding-block:10px!important}
}
@media(prefers-reduced-motion:reduce){.amm-universal-history *,body>.topbar *,body .mobile-dock.amm-public-dock *{transition:none!important}}
/* iPad: the mobile header is active at tablet widths; keep bottom destinations
   visible instead of hiding them at 761px as the old desktop breakpoint did. */
@media(min-width:761px) and (max-width:1024px) and (pointer:coarse){
  body .mobile-dock.amm-public-dock{
    position:fixed!important;display:grid!important;visibility:visible!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    width:min(530px,calc(100% - 48px))!important;
    max-width:530px!important;left:0!important;right:0!important;
    margin-inline:auto!important;
    bottom:calc(76px + env(safe-area-inset-bottom,0px))!important;
    padding:7px!important;z-index:110!important;
  }
  body .mobile-dock.amm-public-dock a{min-height:53px!important;display:flex!important;align-items:center;justify-content:center;flex-direction:column}
  body:has(.amm-public-dock){padding-bottom:calc(240px + env(safe-area-inset-bottom,0px))!important}
}

/* iPad landscape, where width exceeds the normal phone breakpoint. */
@media(min-width:821px) and (max-width:1100px) and (pointer:coarse){
  body{padding-top:72px!important;box-sizing:border-box!important}
  body>header.topbar,body>header.seo-header,body>header.radio-header{
    position:relative!important;top:auto!important;transform:none!important;
    margin-top:0!important;
  }
  body>header.topbar .amm4-head-actions{display:flex!important;align-items:center!important;gap:10px!important;margin-left:auto!important}
  body>header.topbar .desktop-nav{display:none!important}
  body>header.topbar .header-actions{display:none!important}
  body .mobile-dock.amm-public-dock{bottom:calc(76px + env(safe-area-inset-bottom,0px))!important}
  body:has(.amm-public-dock){padding-bottom:calc(240px + env(safe-area-inset-bottom,0px))!important}
}
/* Global mobile viewport contract: document scrolls, never an off-screen top button. */
@media(max-width:820px){
  body>header.topbar, body>header.seo-header, body>header.radio-header,
  body>header.ml-top, body>header.seo-top, body>header.ce-top,
  body>header.admin-topbar {transform:none!important;translate:none!important;}
  body :is(input,textarea,select){font-size:max(16px,1rem)}
  body .amm-public-dock{overscroll-behavior:contain}
  body main{touch-action:pan-y pinch-zoom}
  body .amm-universal-history{scroll-snap-align:none}
}
