/* ═══════════════════════════════════════════════
   Stadium patch — Theme toggle (topbar) + dark-mode nav fixes
   Loaded AFTER css/app.css. Markup lives in renderNavbar()
   (js/app.js); clicks are handled by the delegated listener
   in index.html. Same aria-pressed mechanic as the site
   /stadium/ ThemeToggle component.
   ═══════════════════════════════════════════════ */

.theme-toggle {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--control-border);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover {
    background: var(--control-bg-hover);
    color: var(--text);
}
.theme-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Icon swap driven by aria-pressed (kept in sync by the inline script) */
.theme-toggle .ico { display: none; }
.theme-toggle[aria-pressed="false"] .ico-moon { display: block; }
.theme-toggle[aria-pressed="true"] .ico-sun { display: block; }

@media (prefers-reduced-motion: reduce) {
    .theme-toggle { transition: none; }
}

/* Compact topbar at phone widths: the 32px toggle was pushing the last
   nav link (MY BETS) out of the fixed-height bar at 390px */
@media (max-width: 640px) {
    .theme-toggle { width: 28px; height: 28px; }
    .theme-toggle svg { width: 16px; height: 16px; }
    .top-nav { padding-left: 12px; padding-right: 12px; }
    .nav-right { gap: 6px; }
}

/* ── Logo chip (mirrors the site nav fix, retour user #23): the PNG has an
      integrated dark background that smudges on cream AND melts into dark.
      Ink chip in light (theme-immutable, the PNG frame merges into it),
      lifted surface + hairline in dark. ── */
.nav-logo {
    width: 32px;
    height: 32px;
    padding: 3px;
    box-sizing: border-box;
    background: #1a1d18;
    border-radius: 8px;
}
html[data-theme="dark"] .nav-logo {
    background: var(--bg3);
    border: 1px solid var(--line);
}

/* ═══ Nav uniformity with site /stadium/ Nav (2026-06-13) ═══
   Aligne la présentation de la topbar espace-membre sur la nav landing :
   rail de pills arrondi + pill active pleine + pill compte outline à point vert. */
.top-nav .nav-links {
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 99px;
  overflow-x: auto;
}
.top-nav .nav-link {
  position: relative;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--text2);
  padding: 8px 16px;
  min-height: 0;
  border-radius: 99px;
}
.top-nav .nav-link::after { display: none !important; }
.top-nav .nav-link:hover { color: var(--text); background: transparent; }
.top-nav .nav-link-active,
.top-nav .nav-link-active:hover { background: var(--text); color: var(--bg); }
.top-nav .nav-account {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; min-height: 0;
  border: 1px solid var(--line); border-radius: 99px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text2); text-decoration: none;
  transition: border-color .15s ease, color .15s ease;
}
.top-nav .nav-account:hover,
.top-nav .nav-account.nav-link-active { border-color: var(--text); color: var(--text); background: transparent; }
.top-nav .nav-account::after { display: none !important; }
.top-nav .nav-account-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--grass); flex-shrink: 0; }
.top-nav .nav-cta { font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.22em; border-radius: 99px; }
@media (max-width: 640px) {
  .top-nav .nav-links { padding: 3px; gap: 2px; }
  .top-nav .nav-link { padding: 7px 11px; font-size: 13px; }
  .top-nav .nav-account { padding: 7px 11px; font-size: 10px; }
}

/* ═══ Nav : bouton « Guide » explicite (remplace le « ? » cryptique) — 2026-06-13 ═══ */
.nav-guide {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: 99px;
  background: transparent; cursor: pointer;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text2);
  transition: border-color .15s ease, color .15s ease;
}
.nav-guide:hover { border-color: var(--text); color: var(--text); }
.nav-guide:focus-visible { outline: 2px solid var(--ball); outline-offset: 2px; }
.nav-guide-ico { flex-shrink: 0; }
@media (max-width: 560px) { .nav-guide { display: none; } }  /* mobile : 1re visite = nudge auto, topbar dégagée */

/* ═══ Nav : burger mobile (2026-06-14) ═══
   Le rail horizontal de pills débordait sous 460px (libellés coupés « Play[ers] »).
   Desktop : rail pill inchangé, burger masqué. Mobile : burger pill (DA Stadium,
   ink + actif lime), le rail se replie en panneau déroulant ancré sous la topbar. */
.nav-burger {
  display: none;            /* desktop : caché, le rail pill suffit */
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text2);
  transition: border-color .15s ease, color .15s ease;
}
.nav-burger:hover { border-color: var(--text); color: var(--text); }
.nav-burger:focus-visible { outline: 2px solid var(--ball); outline-offset: 2px; }
.nav-burger-bars {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  flex-shrink: 0;
  transition: background .15s ease;
}
.nav-burger-bars::before,
.nav-burger-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform .18s ease, top .18s ease;
}
.nav-burger-bars::before { top: -5px; }
.nav-burger-bars::after { top: 5px; }
/* Open state : bars morph into an X */
.top-nav.nav-open .nav-burger { border-color: var(--text); color: var(--text); }
.top-nav.nav-open .nav-burger-bars { background: transparent; }
.top-nav.nav-open .nav-burger-bars::before { top: 0; transform: rotate(45deg); }
.top-nav.nav-open .nav-burger-bars::after { top: 0; transform: rotate(-45deg); }

@media (max-width: 460px) {
  /* Burger takes over from the rail */
  .nav-burger { display: inline-flex; }

  /* Collapse the pill rail into a dropdown panel, hidden until open */
  .top-nav .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 12px;
    right: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 8px;
    overflow-x: visible;
    background: var(--card, var(--bg));
    border: 2px solid var(--text);
    border-radius: 20px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
    z-index: 60;
  }
  .top-nav.nav-open .nav-links { display: flex; }
  .top-nav .nav-links .nav-link {
    width: 100%;
    text-align: left;
    padding: 11px 14px;
    font-size: 15px;
    border-radius: 14px;
  }
  /* Active link keeps the Stadium full pill (ink fill) */
  .top-nav .nav-links .nav-link-active,
  .top-nav .nav-links .nav-link-active:hover { background: var(--text); color: var(--bg); }
  .top-nav .nav-links .nav-link:hover { background: var(--control-bg-hover, transparent); color: var(--text); }
}

@media (prefers-reduced-motion: reduce) {
  .nav-burger,
  .nav-burger-bars,
  .nav-burger-bars::before,
  .nav-burger-bars::after { transition: none; }
}
