/* ── Responsive Web Design (loaded LAST so it wins) ───────────
   Mobile (≤699px): unchanged — single column, full width.
   Tablet/desktop (≥700px): fluid container; card lists reflow into
   centered multi-column grids; bus route list goes 2-column with the
   expanded route spanning the full row. */

/* Desktop narrow windows (560–699px) — e.g. an un-maximized Mac Safari/Chrome
   window. The single-column "mobile" layout stays, but a 44px phone hamburger
   looks tiny against a wide browser window, so give the chrome (menu + refresh)
   its full web size here too. Real phones in portrait are < 560px, so they
   keep the compact 44px button. */
@media (min-width: 560px) and (max-width: 699.98px) {
  .menu-btn {
    left: 14px;
    top: 14px;
    width: 62px;
    height: 62px;
    gap: 6px;
  }
  .menu-btn-bar { width: 28px; height: 3px; }

  .bus-refresh-btn,
  .em-refresh-btn,
  .hd-refresh-btn,
  .more-refresh-btn {
    width: 54px;
    height: 54px;
    top: 16px;
    right: 16px;
    font-size: 26px;
  }
}

@media (min-width: 700px) {
  /* Single content column width so all fixed UI can align to it.
     Column left edge = max(0, 50% - 550px). */
  html body { max-width: 1100px; }
  body::before { max-width: 1100px; }

  /* Hamburger button: properly sized for web (was a tiny phone button),
     aligned to the app column. */
  .menu-btn {
    left: max(14px, calc(50% - 534px));
    top: 14px;
    width: 62px;
    height: 62px;
    gap: 6px;
  }
  .menu-btn-bar { width: 28px; height: 3px; }

  /* Section-header refresh buttons mirror the 62px menu button on the
     right side — same visual weight, vertically centre-aligned with it. */
  .bus-refresh-btn,
  .em-refresh-btn,
  .hd-refresh-btn,
  .more-refresh-btn {
    width: 54px;
    height: 54px;
    top: 16px;
    right: 16px;
    font-size: 26px;
  }

  /* No install UI on desktop/laptop — belt & braces over the JS gate */
  #menu-install-btn, #install-banner, #install-wall { display: none !important; }

  /* On web the drawer becomes a floating dropdown PANEL anchored under the
     menu button — sized & themed to match the app (navy header inside). */
  .menu-backdrop { background: rgba(13, 27, 62, 0.30); }
  .menu-drawer {
    top: 86px;
    bottom: auto;
    left: max(14px, calc(50% - 534px));
    width: 380px;
    max-width: 380px;
    max-height: 78vh;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(13, 27, 62, 0.35);
    overflow-y: auto;
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;            /* fully hide when closed (not just opacity) */
    pointer-events: none;
    transition: transform 200ms ease, opacity 200ms ease, visibility 200ms ease;
  }
  .menu-drawer.open { transform: translateY(0); opacity: 1; visibility: visible; pointer-events: auto; }
  /* Roomier, larger menu items on web — proportional to the page */
  .menu-drawer .menu-item { padding-top: 18px; padding-bottom: 18px; }
  .menu-drawer .menu-item-ta { font-size: 1.12rem; }
  .menu-drawer .menu-item-en { font-size: 0.8rem; }
  .menu-drawer .menu-drawer-title-ta { font-size: 1.3rem; }

  /* Sheets (About/Feedback/etc.) → a centered floating modal, not full-screen.
     Closed sheets keep the base [hidden]{display:none} (so they are NOT rendered
     at page load); visibility belt-and-suspenders for the brief open frame. */
  .menu-sheet {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -48%);
    width: 480px;
    max-width: 92vw;
    max-height: 86vh;
    margin: 0;
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 220ms ease, opacity 220ms ease, visibility 220ms ease;
  }
  .menu-sheet.open { transform: translate(-50%, -50%); opacity: 1; visibility: visible; pointer-events: auto; }

  /* Flat card grids — cards STRETCH to fill the row (auto-fit + 1fr):
     multi-column when there are several, full-width when only one. */
  #driver-list,
  .hd-docs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    align-items: start;
  }
  #driver-list .driver-card,
  .hd-docs .hd-card { margin-bottom: 0; }

  /* Emergency + Services: CATEGORY PANELS side-by-side on web */
  #em-list,
  #more-services {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 14px;
    align-items: start;
    margin: 16px 12px 0;
  }
  #em-list .em-panel { margin: 0; }
  #more-services .svc-panel { margin: 0; }

  /* Acting driver rows: 2-up tiles inside the panel on web */
  #more-acting {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px;
    margin-top: 10px;
  }
  #more-acting .acting-row {
    border-bottom: none;
    background: #F7F8FA;
    border-radius: 12px;
    padding: 12px;
  }

  /* Bus: search + "now departing" strip stay a clean centered column */
  #section-bus .bus-search-wrap,
  #section-bus #bus-freshness,
  #section-bus #bus-now-strip {
    max-width: 660px;
    margin-left: auto;
    margin-right: auto;
  }
  /* Bus route list → multi-column; expanded route spans the full row
     so its timetable is wide and readable */
  .group-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 12px;
    align-items: start;
  }
  .route-wrap { min-width: 0; }
  .route-wrap.expanded { grid-column: 1 / -1; }

  /* Auto form constrained so single inputs don't stretch wide */
  .auto-hero, .auto-contact-card { max-width: 920px; margin-left: auto; margin-right: auto; }
  .auto-contact-form { max-width: 600px; margin-left: auto; margin-right: auto; }

  /* Bottom nav: a neat centered tab bar, not a stretched strip */
  #bottom-nav {
    max-width: 560px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -2px 18px rgba(0, 0, 0, 0.12);
  }
}

