/*
 * public/css/header.css
 * PHONE navigation only (plus the desktop/phone show-hide switches).
 *
 * The desktop header keeps its original (step-1) look, styled entirely by
 * the inline <style> block in includes/header.php. This file is linked
 * AFTER that block and must contain nothing that changes the desktop look.
 *
 * Selected items match the original style everywhere: bold text with the
 * white underline bar. No pills, no pale-blue backgrounds.
 */

/* ---- Desktop (default): hide the phone row and Browse panel ---- */
.site-nav .nav-phone,
.site-nav .browse-panel {
  display: none;
}

/* ============================================================
   PHONES (below 48rem / 768px)
   ============================================================ */
@media (max-width: 47.99rem) {

  /* Swap the lists: desktop list off, phone row on */
  .site-nav .nav-desktop { display: none; }

  .site-nav .nav-phone {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: space-between;
    gap: 0;
    list-style: none;
  }
  .site-nav .nav-phone > li { display: flex; }

  /* Row items: same voice as the original nav (white, 0.9rem),
     taller for 44px tap targets, no wrapping at 320px. */
  .site-nav .nav-phone a,
  .site-nav .browse-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-right: 0;
    padding: 0.6rem 0.25rem;
    min-height: 44px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--color-white);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
  }
  .site-nav .nav-phone a:hover,
  .site-nav .browse-toggle:hover {
    border-bottom-color: var(--color-white);
  }

  /* Selected: bold + white underline bar, exactly like the original. */
  .site-nav .nav-phone a[aria-current="page"],
  .site-nav .browse-toggle.is-active {
    font-weight: 700;
    border-bottom-color: var(--color-white);
  }

  /* Browse disclosure button (real <button>, styled like the links) */
  .site-nav .browse-toggle {
    background: transparent;
    border-top: none;
    border-left: none;
    border-right: none;
    cursor: pointer;
  }
  .site-nav .browse-toggle:focus-visible {
    outline: 2px solid var(--color-white);
    outline-offset: 2px;
    border-radius: 1px;
  }
  /* Fallback for browsers without :focus-visible */
  .site-nav .browse-toggle:focus {
    outline: 2px solid var(--color-white);
    outline-offset: 2px;
  }
  .site-nav .browse-toggle:focus:not(:focus-visible) { outline: none; }

  .browse-chevron {
    width: 0.75em;
    height: 0.75em;
    flex-shrink: 0;
  }
  .site-nav .browse-toggle[aria-expanded="true"] .browse-chevron {
    transform: rotate(180deg);
  }

  .nav-search-icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
  }

  /* ---- Browse panel: short full-width list under the row ---- */
  .site-nav .browse-panel {
    display: block;
    list-style: none;
    padding: 0 0 0.3rem;
    border-top: 1px solid rgba(255, 255, 255, 0.35);
  }
  .site-nav .browse-panel li + li {
    border-top: 1px solid rgba(255, 255, 255, 0.35);
  }
  .site-nav .browse-panel a {
    display: flex;
    align-items: center;
    width: 100%;
    margin-right: 0;
    min-height: 44px;
    padding: 0.7rem 0.25rem;
    border-bottom: 2px solid transparent;
  }
  .site-nav .browse-panel a[aria-current="page"] {
    font-weight: 700;
    border-bottom-color: var(--color-white);
  }

  /* JS present: panel collapsed until opened; the Browse button only
     appears when it can work. Without JS the button stays hidden and
     the panel links render open under the row. */
  html:not(.js) .site-nav .browse-toggle { display: none; }
  html.js .site-nav .browse-panel:not(.open) { display: none; }
}

/* Very narrow phones: tighter padding so Issues · Photos · Browse ·
   Search stays on one row even at 320px. */
@media (max-width: 22.5rem) {
  .site-nav .nav-phone a,
  .site-nav .browse-toggle {
    padding: 0.6rem 0.15rem;
  }
}
