/* Shell chrome: header bar, brand text, top-level nav, and the optional
   mod/live links. Loaded by the generic deployments of index.html and
   live.html. Leagues that embed the replay viewer or live dashboard into
   their own site skip this file — app.css is self-sufficient for the
   main content fragment.

   All colors and gradient stops used here resolve against CSS variables
   declared in app.css's :root block, so branded deployments can retheme
   by overriding those variables rather than editing this file. */

/* ---------- header ---------- */
header.site {
  position: sticky; top: 0; z-index: 20;
  padding: 2px 0; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--header-bg-top), var(--header-bg-bot));
  backdrop-filter: blur(6px) saturate(1.15);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand-icon { flex-shrink: 0; border-radius: 4px; }
.brand-logo { flex-shrink: 0; height: 40px; width: auto; display: block; }
.brand-divider {
  display: block; width: 1px; height: 28px; flex-shrink: 0;
  background: var(--line-2); opacity: .6;
}
.community-logo { flex-shrink: 0; height: 40px; width: auto; display: block; }
.brand .tag { color: var(--muted); font-size: 12px; margin-top: 3px; }

/* Header file picker — compact, inline */
.header-file-picker {
  display: flex; align-items: center; gap: 6px;
  margin-left: 6px;
}
.replay-select-compact {
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm, 6px);
  padding: 5px 9px; font: inherit; font-size: 12px;
  max-width: 420px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.replay-select-compact:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(61,155,224,.18); }
.file-btn-icon {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease, background .12s ease, transform .12s ease, box-shadow .12s ease;
}
.file-btn-icon:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(245, 166, 35, .1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.file-btn-icon:active { transform: translateY(0); box-shadow: none; }

.mod-link {
  color: var(--muted); text-decoration: none;
  font-size: 12px; font-weight: 500;
  border-bottom: 1px dashed rgba(125,133,144,.45);
  padding-bottom: 1px;
}
.mod-link:hover { color: var(--accent-2); border-bottom-color: var(--accent-2); }

/* Live-dashboard pill. Shouts "this is a distinct, active feature" so it
   reads as something worth clicking rather than sitting next to "need
   replays?" as a second-class footnote. The pulsing dot uses the red-team
   accent — same visual language as broadcast "LIVE" badges. */
.live-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 5px 11px 5px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--team-red) 55%, transparent);
  background: color-mix(in srgb, var(--team-red) 12%, transparent);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.live-link:hover {
  background: color-mix(in srgb, var(--team-red) 28%, transparent);
  border-color: color-mix(in srgb, var(--team-red) 90%, transparent);
  color: var(--text);
}
.live-link .live-dot {
  width: 7px; height: 7px;
  background: var(--team-red);
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--team-red) 60%, transparent);
  animation: live-pulse 1.8s ease-out infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0    color-mix(in srgb, var(--team-red) 60%, transparent); }
  70%  { box-shadow: 0 0 0 8px  color-mix(in srgb, var(--team-red)  0%, transparent); }
  100% { box-shadow: 0 0 0 0    color-mix(in srgb, var(--team-red)  0%, transparent); }
}
/* Respect the user's accessibility preference — a reduced-motion viewer
   still sees the dot as a solid indicator, just not the radiating ring. */
@media (prefers-reduced-motion: reduce) {
  .live-link .live-dot { animation: none; }
}

/* ---------- page nav (drawer toggle buttons) ---------- */
#pageNav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-drawer-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 10px;
  font-size: 12px; font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  transition: color .12s ease, background .12s ease, border-color .12s ease, transform .12s ease, box-shadow .12s ease;
}
.nav-drawer-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,.06);
  border-color: var(--line-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.nav-drawer-btn:active { transform: translateY(0); box-shadow: none; }
.nav-drawer-btn.active {
  color: var(--accent);
  background: rgba(245, 166, 35, .1);
  border-color: rgba(245, 166, 35, .3);
  box-shadow: inset 0 0 0 1px rgba(245,166,35,.18);
}
.nav-drawer-btn svg { flex-shrink: 0; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  header.site { padding: 8px 0; }
  .nav { gap: 6px; row-gap: 8px; }
  .brand h1 { font-size: 16px; }

  .header-file-picker {
    flex: 1 1 100%;
    order: 1;
  }
  .replay-select-compact { flex: 1; max-width: none; }
  .nav-drawer-btn span { display: none; }
  .nav-drawer-btn { padding: 6px 8px; }
}

/* Phones in portrait (≤520 px). Further compresses the header so the
   file picker and replay selector each get their own row, and drops
   the decorative "need replays?" link to save space. */
@media (max-width: 520px) {
  .brand-divider, .community-logo { display: none; }
  .mod-link { display: none; }
  /* Shrink the live pill on tight viewports but don't hide it — unlike
     "need replays?", this is a first-class navigation target. */
  .live-link { font-size: 11px; padding: 4px 9px; gap: 6px; }
  .live-link .live-dot { width: 6px; height: 6px; }
}

/* Respect iOS / Android safe-area insets on phones with notches /
   rounded corners. No-op on desktop (env() resolves to 0). */
@supports (padding: max(0px)) {
  header.site .wrap {
    padding-left:  max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }
}

/* Live dashboard's fullscreen mode trims the sticky header so tiles get
   more screen area. Lives here because it styles header.site; app.css
   owns the .tile / .live-grid fullscreen rules in live.css. */
body.live.fullscreen header.site { padding: 4px 0; }
