/* ========================================================================== 
   Tablet · 768px–1024px · Collapsible side panel, touch + pointer
   ========================================================================== */
.desktop-only, .mobile-only { display: none !important; }
.tablet-only, .mobile-tablet-only { display: initial; }

.topbar { top: max(8px, var(--safe-top)); left: max(8px, var(--safe-left)); right: max(8px, var(--safe-right)); height: 64px; }
.brand-copy strong { font-size: .82rem; }
.brand-copy small { font-size: .61rem; }
.status-pill { min-height: 31px; }
.icon-button { height: 35px; min-width: 35px; }

.search-panel { top: calc(var(--safe-top) + 84px); left: max(10px, var(--safe-left)); width: min(330px, 34vw); padding: 14px; transition: transform .3s ease; }
.search-panel.is-collapsed { transform: translateX(calc(-100% + 42px)); }
.panel-toggle { position: absolute; right: -16px; top: 14px; width: 32px; height: 36px; border: 1px solid rgba(101, 210, 246, .28); border-radius: 0 10px 10px 0; background: rgba(4, 18, 29, .94); color: var(--cyan); }
.search-panel.is-collapsed .panel-toggle { transform: rotate(180deg); }
.search-form { grid-template-columns: 1fr; }
.search-submit { height: 38px; }
.quick-cities { max-height: 63px; overflow: hidden; }

.weather-panel { top: calc(var(--safe-top) + 84px); right: max(10px, var(--safe-right)); width: min(350px, 36vw); max-height: calc(100dvh - 182px); overflow: auto; padding: 15px; }
.temperature strong { font-size: 3rem; }
.metric-grid { gap: 6px; }
.metric-grid article { padding: 8px; }
.weather-alert p { font-size: .57rem; }
.hourly-forecast { grid-auto-columns: 52px; }

.globe-controls { left: 50%; transform: translateX(-50%); bottom: max(12px, var(--safe-bottom)); }
.layer-drawer { z-index: 40; left: 50%; bottom: calc(var(--safe-bottom) + 74px); width: 420px; transform: translateX(-50%); padding: 14px; background: rgba(3, 14, 24, .96); }
.drawer-heading { display: flex; justify-content: space-between; align-items: center; padding-bottom: 9px; border-bottom: 1px solid rgba(101,194,225,.16); }
.drawer-heading button { width: 31px; height: 31px; border-radius: 50%; border: 1px solid rgba(255,95,114,.25); background: rgba(87,12,24,.3); color: #ff9ba7; }
.layer-drawer label { display: inline-flex; width: 49%; gap: 8px; padding: 9px 4px; color: var(--muted); font-size: .7rem; }
.layer-drawer input { accent-color: #48c9ef; }

@media (orientation: portrait) {
  .search-panel { width: min(310px, 40vw); }
  .weather-panel { top: auto; left: max(10px, var(--safe-left)); right: max(10px, var(--safe-right)); bottom: calc(var(--safe-bottom) + 76px); width: auto; max-height: 30dvh; }
  .weather-primary { margin: 7px 0; }
  .metric-grid { grid-template-columns: repeat(4,1fr); }
  .metric-grid article { min-height: 52px; }
  .weather-alert, .jarvis-line { margin-top: 6px; }
  .forecast-block { display: none; }
}

/* Phones in landscape can exceed 767px CSS width. Short-height mode keeps the
   center of the globe usable instead of applying the full tablet dashboard. */
@media (orientation: landscape) and (max-height: 540px) {
  :root { --header-h: 46px; }
  .topbar { top: max(4px, var(--safe-top)); height: 46px; padding-inline: 9px; }
  .brand-orbit { width: 29px; height: 29px; }
  .brand-copy small { display: none; }
  .status-pill { min-height: 25px; }
  .icon-button { width: 31px; min-width: 31px; height: 31px; }
  .icon-button .button-label { display: none; }
  #open-help { display: none; }

  .search-panel {
    top: calc(var(--safe-top) + 55px); left: max(6px, var(--safe-left));
    width: min(250px, 31vw); padding: 8px; transform: none;
  }
  .search-panel .compact-heading, .quick-cities, .search-actions, .privacy-note, .panel-toggle { display: none; }
  .search-form { margin: 0; grid-template-columns: minmax(0, 1fr) 64px; gap: 5px; }
  .search-input-wrap { height: 36px; padding-inline: 7px; }
  .search-input-wrap input { font-size: .68rem; }
  .search-submit { height: 36px; min-width: 0; padding: 0 6px; font-size: .61rem; }
  .search-results { top: 48px; left: 0; right: 0; max-height: 56dvh; }

  .weather-panel {
    left: auto; top: calc(var(--safe-top) + 55px); right: max(6px, var(--safe-right));
    bottom: auto; width: min(275px, 34vw); max-height: none; padding: 7px 9px;
  }
  .weather-panel .panel-heading p, .weather-alert, .forecast-block, .jarvis-line { display: none; }
  .weather-symbol { width: 34px; height: 34px; font-size: 1rem; }
  .weather-primary { margin: 5px 0; gap: 8px; }
  .temperature strong { font-size: 2rem; }
  .temperature span { font-size: .68rem; }
  .weather-primary > div:last-child strong { font-size: .62rem; }
  .weather-primary > div:last-child span { font-size: .51rem; }
  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .metric-grid article { min-height: 39px; padding: 5px; text-align: center; justify-items: center; }
  .metric-grid span { font-size: .47rem; }
  .metric-grid strong { font-size: .57rem; }
  .metric-grid small { display: none; }

  .globe-controls { bottom: max(4px, var(--safe-bottom)); width: min(420px, 58vw); padding: 3px; }
  .globe-controls button { min-height: 40px; min-width: 44px; }
  .globe-controls button b { font-size: .46rem; }
  .layer-drawer { bottom: calc(var(--safe-bottom) + 52px); max-height: 72dvh; overflow: auto; }
}

.scan-card { bottom: 118px; width: min(410px, calc(100% - 30px)); }
