/* ============================================================================
   sidebar.css — the ONE shared sidebar / nav for the All Boys League pages.
   Linked by /allboys/ and /allboys/rankings/ (and any future page) so the nav
   looks IDENTICAL everywhere. Edit the nav's appearance HERE and every page
   updates together. Page-specific bits (which item is .active, section-link
   targets, the breadcrumb, the admin-reveal rule) stay on each page.

   Relies on the page's :root design tokens (--bg-0/1, --gold, --gold-bright,
   --gold-soft, --line, --text-dim, --radiant, --dire), which both pages define.
   ========================================================================== */

/* ─── Self-contained tokens ───
   The nav defines its OWN colors (scoped to the nav elements) so it renders
   IDENTICALLY on every page — it must never inherit a page's :root values,
   which differ (e.g. --gold-soft is a strong solid gold on the tournament
   page but a weak translucent one elsewhere; --line is gold-tinted vs
   white-tinted). These are the canonical (tournament-page) values; every
   page now gets exactly this nav. */
.sidebar, .nav-hamburger, .nav-backdrop {
  --bg-0: #0a0d12;
  --bg-1: #0f1319;
  --gold: #d4af37;
  --gold-bright: #ffd54a;
  --gold-soft: #c79a2b;
  --line: rgba(212, 175, 55, 0.14);
  --line-strong: rgba(212, 175, 55, 0.32);
  --radiant: #a8c34e;
  --dire: #d94a3d;
  --text-dim: #9aa0a8;
  --text-faint: #5c6470;
}

/* ─── Sidebar shell ─── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 220px;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  border-right: 1px solid var(--line); padding: 24px 0; z-index: 60;
  overflow-y: auto; display: flex; flex-direction: column; gap: 18px;
  /* Pin the inheritable metrics so the nav renders IDENTICALLY no matter
     what the host page's <body> sets — otherwise the nav links inherit the
     page's line-height (1.5 on the tournament page, ~1.2 default on others)
     and the whole sidebar ends up shorter on some pages. */
  font-family: 'JetBrains Mono', monospace; font-weight: 400; line-height: 1.5;
  font-size: 13px;
}
.sidebar-brand {
  font-family: 'Cinzel', serif; font-size: 17px; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--gold); text-align: center;
  padding: 0 18px 22px; border-bottom: 1px solid var(--line); font-weight: 700; line-height: 1.2;
}
.sidebar-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.sidebar-nav-extra { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 4px; }

/* "New" Rankings link — promoted with a gold-tinted bg, glow + pulsing pill. */
.sidebar-nav a.nav-new {
  background: linear-gradient(90deg, rgba(212,175,55,0.22) 0%, rgba(212,175,55,0.06) 100%);
  border-left-color: var(--gold); color: var(--gold-bright) !important; position: relative;
  padding-right: 14px; box-shadow: inset 0 0 14px rgba(212,175,55,0.10);
}
.sidebar-nav a.nav-new .sidebar-icon { color: var(--gold-bright); }
.sidebar-nav a.nav-new:hover {
  background: linear-gradient(90deg, rgba(212,175,55,0.32) 0%, rgba(212,175,55,0.12) 100%);
  border-left-color: var(--gold-bright); box-shadow: inset 0 0 18px rgba(212,175,55,0.22);
}
.sidebar-nav a.nav-new .nav-label { flex: 1; }
.sidebar-nav a.nav-new .nav-badge-new {
  display: inline-block; font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.24em; font-weight: 800; color: #1a1408 !important;
  background-color: #ffd54a !important; background-image: none !important;
  padding: 4px 7px; line-height: 1; border-radius: 2px; margin-left: 6px; flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: 0 0 8px rgba(255, 213, 74, 0.55), 0 0 0 1px rgba(255,255,255,0.18) inset;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
  animation: rankingsNewPulse 2.6s ease-in-out infinite;
}
@keyframes rankingsNewPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 213, 74, 0.55), 0 0 0 1px rgba(255,255,255,0.18) inset; }
  50%      { box-shadow: 0 0 16px rgba(255, 213, 74, 0.9),  0 0 0 1px rgba(255,255,255,0.28) inset; }
}

.sidebar-nav a {
  display: flex; align-items: center; gap: 14px; padding: 16px 22px;
  color: var(--text-dim); text-decoration: none; font-family: 'JetBrains Mono', monospace;
  font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase; font-weight: 600;
  border-left: 2px solid transparent; transition: color 150ms, background 150ms, border-color 150ms;
}
.sidebar-nav a:hover { background: rgba(212, 175, 55, 0.08); color: var(--gold); border-left-color: var(--gold-soft); }
.sidebar-nav a.active { color: var(--gold); border-left-color: var(--gold); background: rgba(212, 175, 55, 0.12); }
.sidebar-icon { width: 18px; height: 18px; display: grid; place-items: center; color: var(--gold); flex-shrink: 0; }
.sidebar-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ─── Lock + Auth buttons at the bottom of the sidebar ─── */
.sidebar-auth-stack { margin: auto 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.sidebar-lock-btn,
.sidebar-auth-btn,
.sidebar-access-btn {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: linear-gradient(180deg, rgba(212,175,55,0.16), rgba(212,175,55,0.06));
  border: 1px solid var(--gold-soft); color: var(--gold);
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; font-weight: 700; cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms, box-shadow 150ms;
  white-space: normal; word-break: break-word; text-align: left; text-decoration: none;
}
.sidebar-lock-btn > span:not(.sidebar-icon),
.sidebar-auth-btn > span:not(.sidebar-icon),
.sidebar-access-btn > span:not(.sidebar-icon) { flex: 1; line-height: 1.25; }
.sidebar-lock-btn:hover,
.sidebar-auth-btn:hover,
.sidebar-access-btn:hover {
  background: rgba(212,175,55,0.22); border-color: var(--gold); box-shadow: 0 0 14px rgba(212,175,55,0.35);
}
.sidebar-access-btn .sidebar-icon { color: inherit; }
.sidebar-access-btn[hidden] { display: none; }
/* Lock button turns radiant-green when the site is unlocked. */
body:not(.is-locked) .sidebar-lock-btn {
  background: linear-gradient(180deg, rgba(168,195,78,0.18), rgba(168,195,78,0.06));
  border-color: rgba(168,195,78,0.55); color: var(--radiant);
}
body:not(.is-locked) .sidebar-lock-btn:hover {
  background: rgba(168,195,78,0.28); border-color: var(--radiant); box-shadow: 0 0 14px rgba(168,195,78,0.4);
}
/* Sign-out variant: dire-red tint. */
.sidebar-auth-btn.signed-in {
  background: linear-gradient(180deg, rgba(217,74,61,0.16), rgba(217,74,61,0.04));
  border-color: rgba(217,74,61,0.5); color: var(--dire);
}
.sidebar-auth-btn.signed-in:hover {
  background: rgba(217,74,61,0.26); border-color: var(--dire); box-shadow: 0 0 14px rgba(217,74,61,0.35);
}
.sidebar-lock-btn .sidebar-icon,
.sidebar-auth-btn .sidebar-icon { color: inherit; }
.sidebar-lock-btn[hidden],
.sidebar-auth-btn[hidden] { display: none; }

/* ─── Desktop: offset page content for the fixed sidebar; hide mobile chrome ─── */
@media (min-width: 901px) {
  body { padding-left: 220px; }
  .nav-hamburger, .nav-backdrop { display: none !important; }
}

/* ─── Mobile hamburger drawer (≤ 900px) ─── */
.nav-hamburger {
  display: none; position: fixed; top: 14px; right: 14px; z-index: 80; width: 44px; height: 44px;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  border: 1px solid var(--gold-soft); border-radius: 8px; cursor: pointer; padding: 0;
  align-items: center; justify-content: center; flex-direction: column; gap: 5px;
  transition: background 150ms, border-color 150ms, box-shadow 150ms;
}
.nav-hamburger:hover { background: rgba(212,175,55,0.12); border-color: var(--gold); }
.nav-hamburger:active { transform: scale(0.96); }
.nav-hamburger-bar { display: block; width: 20px; height: 2px; background: var(--gold); border-radius: 2px; transition: transform 200ms ease, opacity 150ms; }
body.nav-open .nav-hamburger-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-hamburger-bar:nth-child(2) { opacity: 0; }
body.nav-open .nav-hamburger-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-backdrop { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 65; opacity: 0; transition: opacity 220ms ease; }
body.nav-open .nav-backdrop { opacity: 1; }
@media (max-width: 900px) {
  .nav-hamburger { display: flex; }
  .sidebar {
    left: auto; right: 0; width: min(82vw, 320px); border-right: none; border-left: 1px solid var(--gold-soft);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5); transform: translateX(100%);
    transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1); padding-top: 22px; z-index: 70;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-backdrop { display: block; }
  body.nav-open { overflow: hidden; }
}

/* ─── Seamless cross-page navigation (progressive enhancement) ───
   /allboys/ and /allboys/rankings/ are two separate documents, so the browser
   normally does a full reload — white flash, whole window — when you move
   between them. Opting both pages into cross-document View Transitions turns
   that swap into a smooth cross-fade instead, and giving the fixed sidebar a
   stable transition name keeps it visually PUT, so only the page content
   changes — like an app whose left rail persists across navigation.
   Chromium 126+ honours this; every other browser ignores it and falls back to
   the normal (still perfectly functional) full load. */
@view-transition { navigation: auto; }
@media (min-width: 901px) {
  /* Desktop only: here the sidebar IS the fixed left rail, so pin it across the
     navigation. On mobile it's an off-screen drawer, so leave it to the default
     cross-fade rather than sliding a hidden element around. */
  .sidebar { view-transition-name: allboys-sidebar; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation-duration: 0.001ms !important;
  }
}
