/* Mobile / iPhone Safari layout fixes. Loaded last; desktop (>760px) is unaffected. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{overflow-x:clip}
.page-content,.main-column{min-width:0;max-width:100%}
img,svg,canvas,video{max-width:100%}

@media(max-width:760px){
  /* Drawer: sits above dock/ticker (they live outside .app-shell's stacking context) */
  body.drawer-open .mobile-dock,body.drawer-open .local-ticker{visibility:hidden}
  .sidebar{overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
  .sidebar .nav-item,.side-nav button,.side-nav a{min-height:44px}
  .icon-button,.dock-button,.geo-btn,.soc-btn,.button{min-height:44px}
  .icon-button{min-width:44px}

  /* Panels use the full width; keep iOS from zooming into form fields */
  .page-content,body[data-route] .page-content{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}
  input,select,textarea{font-size:16px}
  .panel,.soc-panel,.soc-map,.overview-top{max-width:100%}
  .map-svg,.world-shell svg{width:100%;height:auto}
  pre,code,.mono{overflow-wrap:anywhere}
  pre{white-space:pre-wrap}
  table{display:block;max-width:100%;overflow-x:auto}
}

@media(max-width:520px){
  .soc-stats{grid-template-columns:minmax(0,1fr)}
  .stat{min-height:0}
  .soc-title{flex-wrap:wrap}
  .soc-actions{flex-wrap:wrap}
  .soc-actions>*{flex:1 1 100%}
}

/* Keep stacked cards light and fully static on touch screens.
   No transform, will-change layer promotion, or 3D backface compositing. */
@media(max-width:760px){
  .deck-panel__surface{
    /* Neutral graphite, including before the shared theme finishes loading. */
    background:#151719;
    box-shadow:0 6px 14px rgba(0,0,0,.34);
  }
  .deck-panel__surface *{backdrop-filter:none}
}

/* Reduced motion: native sequential content with no sticky overlap. */
@media(prefers-reduced-motion:reduce){
  .sidebar{transition:none}
  .deck-panel{position:relative;top:auto;min-height:0}
}
