/* ============================================================
   home-mobile.css — dedicated mobile design for index.php

   Loaded AFTER homeV0.01.css and topbar.css. The DESKTOP layout
   is intentionally untouched: every rule below lives inside the
   (max-width: 760px) query, so anything wider than a phone keeps
   the existing sidebar | main flex layout exactly as before.

   What it does on phones:
     - stops the side-by-side flex that pushed the page ~1.5
       screens wide (the "weird viewport" / horizontal panning);
     - turns the home catalogue nav (.home-nav) into a full-width
       app launcher: category dividers span the row, each link
       becomes a tappable tile;
     - hides the verbose .apps-cards grid (every app already lives
       in the launcher) while keeping all the text sections.

   CSP-safe: served as a 'self' stylesheet, no inline styles.
   Scoped to .home-nav so it can never touch the logged-in
   off-canvas cloud menu (#stashSidebar .sidebar).
============================================================ */

@media (max-width: 760px) {

  /* ---- Kill the horizontal pan ---------------------------------
     The body was display:flex (240px sidebar | main). On a phone
     that minimum width overflowed the viewport. Stack instead. */
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }
  body {
    display: block;
  }

  /* ---- Catalogue nav -> full-width app launcher --------------- */
  body.has-topbar .home-nav,
  .home-nav {
    width: 100%;
    min-height: 0;            /* was calc(100vh - 56px) */
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px 14px 18px;
  }

  .home-nav .logo {
    text-align: center;
    font-size: 22px;
    margin-bottom: 4px;
  }

  /* short tagline shown only here (marked [hidden] in the markup) */
  .home-tagline {
    display: block;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
    margin: 0 0 14px;
  }

  /* the launcher grid: ~2 cols on a phone, more as width allows */
  .home-nav .nav {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
    gap: 10px;
    align-items: stretch;
  }

  /* category labels (PDF, A/V, …) span the whole row as headers */
  .home-nav .nav .sep {
    grid-column: 1 / -1;
    margin: 16px 0 2px;
  }
  .home-nav .nav .sep:first-child {
    margin-top: 4px;
  }

  /* you are already on Home — don't spend a tile on it */
  .home-nav .nav a.active {
    display: none;
  }

  /* the app tiles */
  .home-nav .nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 58px;
    margin: 0;               /* grid gap handles spacing */
    padding: 10px 8px;
    font-size: 13px;
    line-height: 1.3;
    word-break: break-word;
  }
  .home-nav .nav a:active {
    transform: scale(0.97);
    background: #1b2a4d;
    color: var(--text);
  }

  /* ---- Main column: full width, tighter padding -------------- */
  .main {
    width: 100%;
    max-width: none;
    padding: 16px 14px 24px;
  }
  .section {
    padding: 16px;
  }

  /* the verbose card grid is replaced by the launcher above */
  .apps-cards {
    display: none;
  }
}
