/* ============================================================
   BrettZone v2 — Mobile chrome layer
   Loaded after bz-chrome.css so these rules win at <1100px.
   Source of truth: docs/brettzone-refresh/02-mobile-brief.md
   ============================================================ */

/* ============================================================
   Breakpoint contract
   - >= 1100px: desktop sidebar + topbar, no mobile chrome.
   -  < 1100px: mobile topbar + bottom tabbar, sidebar hidden.
   -  < 768px:  tables collapse to cards, media goes edge-to-edge.
   ============================================================ */

@media (max-width: 1099.98px) {
  /* Sidebar disappears on mobile; mobile chrome takes over. */
  .bz-sidebar { display: none !important; }

  /* Desktop topbar (breadcrumbs) is replaced by bz-mtopbar. */
  .bz-topbar { display: none !important; }

  /* Shell collapses to a single column. */
  .bz-shell { grid-template-columns: 1fr; }

  /* Page reserves space for the bottom tab bar + safe area. */
  .bz-page {
    padding-bottom: calc(20px + var(--bz-tabbar-pad));
    padding-left: max(16px, var(--bz-safe-left));
    padding-right: max(16px, var(--bz-safe-right));
  }
  .bz-page--bleed {
    padding-bottom: var(--bz-tabbar-pad);
    padding-left: 0;
    padding-right: 0;
  }
}

@media (min-width: 1100px) {
  /* Hide mobile chrome on desktop. */
  .bz-mtopbar,
  .bz-tabbar,
  .bz-sheet { display: none !important; }
}

/* ============================================================
   Mobile top bar (Mobile Brief §2.1)
   ============================================================ */

.bz-mtopbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 10, 22, 0.92);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color var(--bz-d-base) var(--bz-ease);
}
.bz-mtopbar.is-scrolled { border-bottom-color: var(--bz-border); }

.bz-mtopbar__safetop {
  height: var(--bz-safe-top);
}

.bz-mtopbar__row {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 10px;
  min-height: var(--bz-mtopbar-h);
}

.bz-mtopbar__btn,
.bz-mtopbar__brand {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: var(--bz-surface-2);
  border: 1px solid var(--bz-border);
  color: var(--bz-text);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.bz-mtopbar__btn:hover { background: var(--bz-surface-3); color: var(--bz-text); }
.bz-mtopbar__btn:active { background: var(--bz-surface-3); }

.bz-mtopbar__brand {
  text-decoration: none;
  background: transparent;
  border: none;
  border-radius: 0;
}
.bz-mtopbar__brand-mark {
  /* Official NHRL mark */
  display: block;
  width: 34px;
  height: auto;
}

.bz-mtopbar__text {
  min-width: 0;
  overflow: hidden;
}
.bz-mtopbar__eyebrow {
  font-family: var(--bz-font-mono);
  font-size: 9px;
  color: var(--bz-text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bz-mtopbar__title {
  font-family: var(--bz-font-display);
  font-weight: 700;
  font-size: 24px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.bz-mtopbar__title--shrink { font-size: 20px; }

.bz-mtopbar__action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* ============================================================
   Mobile bottom tab bar (Mobile Brief §2.2)
   ============================================================ */

.bz-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  background: rgba(11, 10, 22, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--bz-border);
}

.bz-tabbar__row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.bz-tabbar__safebottom {
  height: var(--bz-safe-bottom);
}

.bz-tabbar__tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px 8px;
  min-height: var(--bz-tabbar-h);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--bz-text-muted);
  text-decoration: none;
  font-family: var(--bz-font-ui);
}
.bz-tabbar__tab:hover { color: var(--bz-text); }
.bz-tabbar__tab .bz-icon {
  width: 22px;
  height: 22px;
  color: var(--bz-text-muted);
  transition: color var(--bz-d-fast) var(--bz-ease);
}
.bz-tabbar__label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.bz-tabbar__live-dot {
  position: absolute;
  top: 8px;
  right: calc(50% - 16px);
}
.bz-tabbar__tab--active {
  color: var(--bz-text);
}
.bz-tabbar__tab--active .bz-icon {
  color: var(--bz-accent-strong);
}
.bz-tabbar__tab--active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 2px;
  background: var(--bz-accent);
  border-radius: 0 0 2px 2px;
  transition: left var(--bz-d-base) var(--bz-ease);
}

/* ============================================================
   Bottom sheet primitive (Mobile Brief §2.3)
   ============================================================ */

.bz-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.bz-sheet[hidden] { display: none; }

.bz-sheet__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 220ms var(--bz-ease);
}
.bz-sheet.is-open .bz-sheet__scrim { opacity: 1; }

.bz-sheet__panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 76vh;
  background: var(--bz-surface-1);
  border-top: 1px solid var(--bz-border-strong);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--bz-shadow-2);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 280ms var(--bz-ease);
  padding-bottom: var(--bz-safe-bottom);
}
.bz-sheet.is-open .bz-sheet__panel { transform: translateY(0); }
.bz-sheet.is-closing .bz-sheet__panel {
  transform: translateY(100%);
  transition-duration: 220ms;
  transition-timing-function: cubic-bezier(.4, 0, 1, 1);
}
.bz-sheet.is-closing .bz-sheet__scrim {
  opacity: 0;
  transition-duration: 220ms;
}

.bz-sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--bz-border-strong);
  margin: 8px auto 4px;
  flex-shrink: 0;
}

.bz-sheet__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--bz-border);
  flex-shrink: 0;
}
.bz-sheet__title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}
.bz-sheet__reset {
  background: transparent;
  border: none;
  color: var(--bz-text-muted);
  font: 600 11px/1 var(--bz-font-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 8px;
}
.bz-sheet__reset:hover { color: var(--bz-accent-strong); }
.bz-sheet__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bz-surface-2);
  border: 1px solid var(--bz-border);
  color: var(--bz-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.bz-sheet__close:hover { background: var(--bz-surface-3); }

.bz-sheet__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 16px;
  -webkit-overflow-scrolling: touch;
}

.bz-sheet__foot {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--bz-border);
  flex-shrink: 0;
  background: var(--bz-surface-1);
}
.bz-sheet__action {
  width: 100%;
  justify-content: center;
  padding: 12px 16px;
  font-size: 13px;
  min-height: var(--bz-touch-min);
}

/* Page underneath gets pushed back while a sheet is open */
body.bz-sheet-open {
  overflow: hidden;
}

/* ============================================================
   More-sheet route list
   ============================================================ */

.bz-msheet-nav {
  display: flex;
  flex-direction: column;
}
.bz-msheet-nav__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  color: var(--bz-text);
  text-decoration: none;
  border-bottom: 1px solid var(--bz-border);
  min-height: var(--bz-touch-min);
}
.bz-msheet-nav__row:last-child { border-bottom: none; }
.bz-msheet-nav__row:hover,
.bz-msheet-nav__row:active { background: var(--bz-surface-2); color: var(--bz-text); }
.bz-msheet-nav__icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bz-surface-2);
  border-radius: var(--bz-r-sm);
  color: var(--bz-accent-strong);
  flex-shrink: 0;
}
.bz-msheet-nav__label {
  flex: 1;
  font-family: var(--bz-font-display);
  font-weight: 600;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

/* ============================================================
   Search overlay — full-screen variant of the cmdk modal
   (Mobile Brief §2.4)
   ============================================================ */

@media (max-width: 767.98px) {
  .bz-cmdk {
    padding: 0;
    align-items: stretch;
  }
  .bz-cmdk__modal {
    max-width: none;
    max-height: none;
    height: 100dvh;
    height: 100vh; /* fallback */
    border-radius: 0;
    border: none;
    padding-top: var(--bz-safe-top);
    padding-bottom: var(--bz-safe-bottom);
  }
  .bz-cmdk__input {
    padding: 16px;
  }
  .bz-cmdk__input input { font-size: 16px; } /* avoid iOS zoom */
}

/* ============================================================
   Filter chip row — horizontal scroll
   ============================================================ */

.bz-chiprow {
  display: flex;
  gap: 6px;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.bz-chiprow::-webkit-scrollbar { display: none; }
.bz-chiprow > * {
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* Active-filter strip above result lists */
.bz-filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0;
}
.bz-filter-strip__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 10px;
  background: var(--bz-surface-2);
  border: 1px solid var(--bz-border);
  border-radius: 14px;
  font: 600 10px/1 var(--bz-font-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bz-text);
  cursor: pointer;
}
.bz-filter-strip__chip-x {
  font-family: var(--bz-font-mono);
  font-size: 12px;
  color: var(--bz-text-muted);
  margin-left: 2px;
}
.bz-filter-strip__chip:hover .bz-filter-strip__chip-x { color: var(--bz-live); }
.bz-filter-strip__add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: transparent;
  border: 1px dashed var(--bz-border-strong);
  border-radius: 14px;
  font: 600 10px/1 var(--bz-font-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bz-text-muted);
  cursor: pointer;
}
.bz-filter-strip__add:hover { color: var(--bz-text); border-color: var(--bz-text-muted); }

/* ============================================================
   Touch target floor — bump small interactive elements
   ============================================================ */

@media (max-width: 767.98px) {
  .bz-btn,
  .bz-btn--sm,
  .bz-pill {
    min-height: var(--bz-touch-min);
  }
  .bz-btn--sm {
    padding: 8px 10px;
    font-size: 11px;
  }
}

/* ============================================================
   Mobile legibility pass (user testing)
   DIN Next + Berkeley Mono set solid at desktop sizes but the wide
   tracking makes 9–11px unreadable on phones. Raise the type floor
   and rescale the hero score-bug so fighter names stop truncating.
   ============================================================ */

@media (max-width: 767.98px) {
  /* --- Utility floors --- */
  .bz-eyebrow  { font-size: 12px; letter-spacing: 0.14em; }
  .bz-mono-sm  { font-size: 12px; }
  .bz-mono-md  { font-size: 13px; }
  .bz-ui       { font-size: 13px; }

  /* --- Core components --- */
  .bz-chip     { font-size: 12px; }
  .bz-chip--sm { font-size: 11px; }
  .bz-status   { font-size: 11px; }
  .bz-btn      { font-size: 13px; }

  /* Ticker items ride the marquee — biggest legibility win */
  .bz-ticker         { height: 38px; }
  .bz-ticker__track  { font-size: 13px; }
  .bz-ticker__label  { font-size: 13px; }

  /* Mobile chrome */
  .bz-mtopbar__eyebrow { font-size: 11px; letter-spacing: 0.1em; }
  .bz-tabbar__label    { font-size: 10px; letter-spacing: 0.06em; }

  /* Empty states */
  .bz-empty__title { font-size: 12px; letter-spacing: 0.14em; }
  .bz-empty__sub   { font-size: 12px; }
  .bz-empty__body  { font-size: 14px; }

  /* Score bug (inline pages) */
  .bz-scorebug         { gap: 12px; padding: 12px 14px; }
  .bz-scorebug__name   { font-size: 18px; }
  .bz-scorebug__sub    { font-size: 11px; }
  .bz-scorebug__round  { font-size: 11px; letter-spacing: 0.12em; }
  .bz-scorebug__center { min-width: 96px; }

  /* Hero overlay score-bug — 64px photos + 28px names truncated
     everything at 390px. Rescale so full names fit. */
  .bz-hero__scorebug { gap: 10px; padding: 10px 12px; left: 10px; right: 10px; bottom: 10px; }
  .bz-hero__center   { min-width: 88px; }
  .bz-hero__photo    { width: 40px; height: 40px; }
  .bz-hero__side     { gap: 8px; }
  .bz-hero__name     { font-size: 16px; }
  .bz-hero__sub      { font-size: 10px; }
  .bz-hero__event    { font-size: 13px; }
  .bz-hero__meta     { font-size: 10px; }
  .bz-hero__eyebrow  { font-size: 10px; letter-spacing: 0.1em; }
  .bz-hero__play-caption { font-size: 10px; letter-spacing: 0.1em; bottom: calc(12px + 78px); }
}

/* Phones: drop the score-bug photos entirely — the bots are already on
   screen in the video, and the space buys full fighter names. */
@media (max-width: 479.98px) {
  .bz-hero__photo  { display: none; }
  .bz-hero__center { min-width: 72px; }
  .bz-hero__name   { font-size: 15px; }
  .bz-scorebug        { gap: 8px; }
  .bz-scorebug__photo { display: none; }
  .bz-scorebug__name  { font-size: 15px; }
  .bz-scorebug__sub   { white-space: nowrap; }
  .bz-scorebug__wedge { width: 5px; height: 36px; }
}

/* ============================================================
   Reduced motion — kill sheet/topbar/tabbar transitions
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .bz-sheet__panel,
  .bz-sheet__scrim,
  .bz-tabbar__tab--active::before { transition: none !important; }
}

/* ============================================================
   Save-Data swap (Mobile Brief §7)
   Under Save-Data, suppress autoplaying clips on Today + clips lists.
   Posters still render via the existing pinFrame() approach.
   ============================================================ */

.bz-savedata .bz-fightcard__video,
.bz-savedata .bz-today__clip video,
.bz-savedata .bz-bottok__video,
.bz-savedata .bz-hero__video { display: none; }

.bz-savedata .bz-hero__media::before {
  content: "DATA SAVER";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 11px/1 var(--bz-font-ui);
  letter-spacing: 0.18em;
  color: var(--bz-text-faint);
  z-index: 1;
}

/* ============================================================
   Lazy below-the-fold sections — gain back paint budget
   Apply to known long lists; safe everywhere CSS supports it.
   ============================================================ */

@media (max-width: 1099.98px) {
  .bz-table--cards tbody tr {
    content-visibility: auto;
    contain-intrinsic-size: 1px 96px;
  }
}
