/* ============================================================
   Phone — GLOBAL styles
   Loaded phone-only via <link media="(max-width: 48em)"> in _Layout.
   Everything here applies at <= 48em automatically; no @media needed.
   Keep phone rules OUT of site.css — this file is the phone-global bucket.
   ============================================================ */

/* ---- Page shell ---- */
/* Trim the heavy desktop side padding on small screens */
main {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* ---- Character card grid (.char-cards-grid) ----
   2026-11-20 (Session 274). site.css gives the grid four fixed columns at every width, which leaves
   each card a quarter of a phone screen: .char-card-wide is overflow: hidden, so the name is clipped
   away and the controls row overflows. Cards take at least 14rem each, so a phone gets one or two per
   row. Shared by My Characters, Profile, Manage Team and Team Composition — one fix for all four. */
.char-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr));
}

/* ---- Character picker grid (.survey-import-list) ----
   2026-11-20 (Session 274). The compact character cards in the Apply page's Add characters dialog
   (Application/_PickTab) and the Survey's two character pickers. site.css gives four fixed `1fr`
   columns; `1fr` will not shrink a column below its longest name, so on a phone the Battle.net tab ran
   off the side of the dialog and the Imported tab squeezed realms onto two lines. Columns of at least
   8rem instead: two or three per row on a phone, never wider than the dialog. Desktop unchanged. */
.survey-import-list {
    grid-template-columns: repeat(auto-fill, minmax(min(8rem, 100%), 1fr));
}

/* ---- Split layout: the "Contents" fold (.gp-split-phone-fold) ----
   2026-11-20 (Session 274). OPT-IN: only a .gp-split-layout that also carries .gp-split-phone-fold
   (today Information, FAQ, Team Info); every other split page keeps its desktop layout on a phone.
   The column goes above the content at full width, unpinned and uncapped (gp-split.js no longer
   writes a cap below 48em). gp-split.js adds the button and .gp-split-fold-ready; ONLY THEN is the
   column hidden behind it, so without the script a phone shows the column stacked, never unreachable.
   Hidden with :not(.is-fold-open) rather than shown with display: revert — revert would drop the
   sections' own display: flex (global.css .gp-split-left-section). */
/* SUPERSEDED the same day by the .gp-phone-fold block below (the fold moved to gp-phone-fold.js and
   gained the .roster-sidebar layout; the button now sits BEFORE the column and the whole column hides).
.gp-split-layout.gp-split-phone-fold {
    flex-direction: column;
    align-items: stretch;
}
.gp-split-phone-fold > .gp-split-left {
    position: static;
    width: 100%;
    max-height: none;
}
.gp-split-phone-fold.gp-split-fold-ready .gp-split-fold-toggle {
    display: flex;
}
.gp-split-phone-fold.gp-split-fold-ready > .gp-split-left:not(.is-fold-open) > :not(.gp-split-fold-toggle) {
    display: none;
}
*/

/* ---- Two-column layouts: the "Contents" fold (.gp-phone-fold) ----
   2026-11-20 (Session 274). OPT-IN, on the layout: Information, FAQ, Team Info (.gp-split-layout) and
   Character, Account (.raider-view-layout). Every other two-column page keeps its desktop layout.
   gp-phone-fold.js marks the left column .gp-phone-fold-column (one name for every layout), puts the
   button directly BEFORE it, and adds .gp-phone-fold-ready to the layout. The column goes above the
   content at full width, unpinned and uncapped (gp-split.js writes no cap below 48em); ONLY under -ready
   is it hidden behind the button, so without the script a phone shows it stacked, never unreachable.
   The column rule is two classes and loads after site.css, so it beats .sidebar-fit-layout
   .roster-sidebar (align-self: flex-start) and .roster-sidebar's sticky / 13rem width. */
.gp-phone-fold {
    flex-direction: column;
    align-items: stretch;
}
.gp-phone-fold > .gp-phone-fold-column {
    position: static;
    width: 100%;
    max-height: none;
    align-self: stretch;
}
.gp-phone-fold.gp-phone-fold-ready > .gp-phone-fold-toggle {
    display: flex;
}
.gp-phone-fold.gp-phone-fold-ready:not(.is-fold-open) > .gp-phone-fold-column {
    display: none;
}

/* ---- Team page header with a logo (.gp-team-head-main) ----
   2026-11-20 (Session 274). Team Info, Manage Team and Team Members. On a phone the right-hand column
   (.gp-page-head-side: the page's buttons, then the team switch) kept its full width and squeezed the
   text to a word per line; gp-header-logo.js sizes the logo to the text's height, so the logo grew
   with every wrapped line. The column now takes its own line under the logo and text (UI/PageHeading.md:
   "the side column goes under the title, left-aligned" — global.css already left-aligns it at 48em),
   so the text gets the full width beside the logo.
   THE CAP: the script writes the logo's width and height on the element, which no stylesheet rule can
   override, but max-width / max-height still bound them. 6rem keeps a long, wrapping team name from
   blowing the logo up again. Desktop has no cap. */
.gp-team-head-main {
    flex-wrap: wrap;
}
.gp-team-head-main > .gp-page-head-side {
    flex: 1 0 100%;
}
.gp-team-logo-wrap {
    max-width: 6rem;
    max-height: 6rem;
}

/* ---- Top navigation: collapse the menu bar into a hamburger drawer ---- */

/* nav becomes the positioning context for the drawer */
nav {
    position: relative;
}

/* Hamburger button — flat, matches the nav aesthetic (hidden on desktop via site.css) */
.nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;            /* sit at the far right of the bar */
    background: none;
    border: none;
    color: var(--ink-2);
    font-size: 1.25rem;
    line-height: 1;
    padding: 0.25em;
    cursor: pointer;
    transition: color 0.15s;
}
.nav-toggle:hover {
    color: var(--ink);
}

/* The collapsible group becomes a full-width vertical drawer below the bar */
.nav-collapse {
    display: none;                /* closed by default */
    position: absolute;
    top: 3.5rem;                  /* height of the nav bar */
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 1rem 0.75rem;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--sh-card);
    z-index: 100;
}
nav.nav-open .nav-collapse {
    display: flex;
}

/* Stack each top-level item full width */
.nav-collapse > .nav-link,
.nav-collapse > .nav-menu {
    width: 100%;
    padding: 0.625rem 0.25rem;
    border-bottom: 1px solid var(--line-soft);
}
.nav-collapse .nav-menu-btn {
    width: 100%;
    text-align: left;
}

/* Nested dropdowns render inline (accordion), not as floating popovers */
.nav-collapse .nav-dropdown {
    position: static;
    min-width: 0;
    border: none;
    box-shadow: none;
    background: transparent;
    padding-left: 0.75rem;        /* indent submenu under its parent */
}
.nav-collapse .nav-dropdown-right {
    right: auto;
}
.nav-collapse .nav-dropdown-item {
    padding: 0.5rem 0.25rem;
}
