/*
 * L6 — AppShell, SportSwitcher, TaskNav, ContextBar, grid, breakpoints, footer.
 * Content column is 1232px; at a 1280px viewport that leaves 24px on each side.
 * Fonts: DM Sans (UI/body/controls/meta) via --font-ui; Roboto Condensed
 * (H1–H3, scores, compact section titles) via --font-display. Display face is locked.
 */

.ca-app-shell,
.chase-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--surface-header);
  border-bottom: 1px solid var(--border-subtle);
}

.chase-nav,
.ca-shell-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  max-width: var(--shell-max);
  min-width: 0;
  margin: 0 auto;
  padding: 0 var(--shell-gutter-sm);
  height: var(--shell-header-h);
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .chase-nav,
  .ca-shell-inner {
    padding: 0 var(--shell-gutter);
  }
}

.chase-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  min-height: var(--touch-min);
  text-decoration: none;
  color: var(--text-primary);
}
.chase-logo:hover { color: var(--text-primary); }

.chase-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: var(--type-20);
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.chase-wordmark__accent { color: var(--text-secondary); }

.chase-nav-logo--icon {
  height: 36px;
  width: 36px;
  object-fit: contain;
  display: block;
}
.chase-nav-logo--compact { display: none; }
.chase-nav-logo-fallback {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--type-16);
  color: var(--text-primary);
}

.chase-nav-links,
.ca-task-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
  justify-content: center;
  overflow: hidden;
}

.chase-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--touch-min);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: var(--type-14);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
/* The header search used to be killed here with display:none !important, so
   the markup shipped but never rendered. The reference chrome carries it, and
   it now drives the same slate filter as the toolbar field
   (matchup_card.js binds #chaseNavSearch), so it is a real control. Layout and
   the responsive hide live further down this file. */
.chase-nav-model {
  flex-shrink: 0;
  min-height: var(--touch-min);
  padding: 0 var(--space-4);
  white-space: nowrap;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.chase-dropdown { position: relative; }
.chase-dropdown > button.chase-nav-link {
  background: transparent;
  border: 0;
  cursor: pointer;
}
.chase-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  padding: var(--space-2);
  background: var(--surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: var(--elevation-2);
  z-index: var(--z-header);
}
.chase-dropdown.open .chase-dropdown-menu,
.chase-dropdown:hover .chase-dropdown-menu { display: block; }
.chase-dropdown-item {
  display: flex;
  align-items: center;
  min-height: var(--touch-min);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: var(--type-14);
  text-decoration: none;
}
.chase-dropdown-item:hover { background: var(--accent-soft); }
.chase-dropdown-item.disabled {
  color: var(--text-disabled);
  pointer-events: none;
}
.chase-dropdown-badge {
  font-size: var(--type-12);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--text-meta);
}
.chase-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-2) 0;
}

/* Status capsule — must shrink, never push the document past --shell-max. */
.chase-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 1 auto;
  min-width: 0;
  max-width: 40%;
}
.chase-timestamp,
.ca-status-capsule {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  max-width: 100%;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--surface-inset);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-ui);
  font-size: var(--type-12);
  font-weight: 500;
  color: var(--text-meta);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chase-header .ca-datastatus {
  flex-wrap: nowrap;
  gap: var(--space-2);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.chase-header .ca-datastatus-meta,
.chase-header .ca-datastatus-source { display: none; }

.chase-pipeline-dot {
  width: var(--space-2);
  height: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--status-ok);
  flex-shrink: 0;
}

.chase-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-1);
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  padding: var(--space-2);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.chase-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
}

.chase-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--surface-overlay);
  z-index: calc(var(--z-header) - 2);
  pointer-events: none;
}
.chase-mobile-overlay.open { pointer-events: auto; }

.chase-mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: min(300px, 100%);
  height: 100%;
  background: var(--surface-page);
  border-left: 1px solid var(--border-subtle);
  z-index: calc(var(--z-header) - 1);
  overflow-y: auto;
}
.chase-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}
.chase-mobile-close {
  width: var(--touch-min);
  height: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-meta);
  cursor: pointer;
}
.chase-mobile-brand { display: none; }
.chase-mobile-nav {
  padding: var(--space-3) var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.chase-mobile-link {
  display: flex;
  align-items: center;
  min-height: var(--touch-min);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--type-16);
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
}
.chase-mobile-link:hover,
.chase-mobile-link.active {
  background: var(--accent-soft);
  color: var(--text-accent);
}
.chase-mobile-section {
  padding: var(--space-3) var(--space-3) var(--space-1);
  font-size: var(--type-12);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--text-meta);
}
.chase-mobile-status {
  padding: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

/* SportSwitcher */
.ca-sport-switcher,
.ca-sport-select {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-4) 0;
}
.ca-sport-select-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: var(--control-bg);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: var(--type-14);
  font-weight: 600;
  text-decoration: none;
}
.ca-sport-select-pill.active,
.ca-sport-select-pill[aria-current="page"] {
  background: var(--control-bg-active);
  border-color: var(--border-accent);
  color: var(--text-accent);
}

/* ContextBar */
.ca-context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  min-height: var(--shell-context-h);
  margin: 0 auto;
  max-width: var(--shell-max);
  padding: var(--space-2) var(--shell-gutter-sm);
  font-size: var(--type-12);
  color: var(--text-meta);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: var(--shell-header-h);
  z-index: calc(var(--z-header) - 1);
  background: var(--surface-header);
}
@media (max-width: 599px) {
  .ca-context-bar {
    min-height: var(--shell-context-h-phone);
  }
  .chase-nav,
  .ca-shell-inner {
    height: var(--shell-header-h-phone);
  }
}
@media (min-width: 768px) {
  .ca-context-bar { padding-inline: var(--shell-gutter); }
}

/* Page grid — sport AppShell main only. Legacy .ca-page-shell is unmigrated. */
.ca-shell-main {
  max-width: var(--shell-max);
  width: 100%;
  margin: 0 auto;
  padding: var(--space-9) var(--shell-gutter-sm) var(--space-9);
  min-width: 0;
}
@media (min-width: 768px) {
  .ca-shell-main { padding-inline: var(--shell-gutter); }
}

.ca-shell-main .ca-page-title {
  font-family: var(--font-display);
  font-size: var(--type-h1);
  font-weight: 800;
  margin: 0;
}
.ca-shell-main .ca-lede,
.ca-shell-main .ca-helper {
  color: var(--text-2, var(--text-secondary));
  font-size: var(--type-ui);
  margin: 0;
}
.ca-shell-main .ca-desk-head {
  margin-bottom: var(--space-4);
}

.ca-entity-search-host label {
  display: block;
  font-size: var(--type-12);
  color: var(--text-meta);
  margin-bottom: var(--space-1);
}
.ca-entity-search {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.ca-shell-footer {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--space-6) var(--shell-gutter-sm) var(--space-9);
  font-size: var(--type-12);
  color: var(--text-meta);
  border-top: 1px solid var(--border-subtle);
}

/* Breakpoints: 390 / 768 / 1024 / 1280 / 1440. At 1280 the column is 1232. */
@media (min-width: 769px) {
  .chase-mobile-overlay,
  .chase-mobile-menu {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
  }
  .chase-hamburger { display: none !important; }
}

.chase-mobile-overlay.open {
  display: block;
  pointer-events: auto;
}
.chase-mobile-menu.open { display: block; }

@media (max-width: 768px) {
  .chase-nav-links,
  .chase-nav-search,
  .chase-nav-model,
  .chase-status .chase-timestamp { display: none; }
  .chase-hamburger { display: flex; }
  .chase-status { max-width: none; }
}

@media (max-width: 1279px) {
  .chase-header .ca-datastatus-age,
  .chase-header .ca-datastatus-retry { display: none; }
}

@media (min-width: 769px) and (max-width: 1100px) {
  .chase-header .ca-datastatus-slate,
  .chase-header .ca-datastatus-dot { display: none; }
}

@media (min-resolution: 2x) {
  .ca-shell-main,
  .chase-nav { max-width: var(--shell-max); }
}

/* ---------------------------------------------------------------------------
 * Desk restore (2026-09-09). Header chrome for the sport-tab shell, plus two
 * header defects the visual audit found. Appended last so equal-specificity
 * rules above are corrected by source order where that is the actual bug.
 * ------------------------------------------------------------------------ */

/* AUDIT B1 — the header CTA carries both .ca-btn--primary and .chase-nav-link.
 * Those are equal specificity (0,1,0) and chase-shell.css loads after
 * chase-components.css, so .chase-nav-link's --text-secondary was winning and
 * painting muted grey on the violet ground at 1.5:1. Raising specificity to
 * (0,2,0) settles it in favour of the button role regardless of load order. */
.chase-nav-link.ca-btn--primary,
.chase-nav-link.ca-btn--primary:hover,
.chase-mobile-link--model.ca-btn--primary {
  color: var(--text-on-accent);
  font-weight: 700;
}

/* AUDIT B2 — /model-center/ overflowed the viewport by ~41px at 390px.
 *
 * The cause is stylesheet order, not markup: that page is the only one that
 * loads mlbma_design_system.css AFTER chase-shell.css, and that file redefines
 * .ca-btn { display: inline-flex }. The mobile rule below is
 * `.chase-nav-model { display: none }` at specificity (0,1,0) — a media query
 * adds none — so the later .ca-btn declaration won and the Model Center button
 * stayed visible at 390px, pushing the 44px hamburger past the gutter.
 *
 * The hide is raised to (0,2,0) at the foot of this block. The .chase-status
 * rules here are a second belt: they keep any injected status node from
 * pushing the hamburger out, which is a real hazard independent of this bug. */
.chase-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 0 1 auto;
  margin-left: auto;
}
.chase-status > *:not(.chase-hamburger) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chase-hamburger { flex: 0 0 auto; }

@media (max-width: 768px) {
  .chase-status > *:not(.chase-hamburger) { display: none !important; }
}

/* —— Sport switcher ——————————————————————————————————————————— */
.chase-sport-tabs {
  display: flex;
  align-items: stretch;
  gap: var(--space-1);
  min-width: 0;
  flex: 0 1 auto;
}

.chase-sport-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-3);
  min-height: var(--touch-min);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-family: var(--font-display);
  font-size: var(--type-16);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
}
.chase-sport-tab:hover { color: var(--text-primary); }

.chase-sport-tab[aria-current="page"] { color: var(--text-primary); }
.chase-sport-tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* WNBA and CFB have routes but no published slate. They stay visible so the
 * switcher matches the reference shell, and say so rather than 404ing. */
.chase-sport-tab[data-state="upcoming"] { color: var(--text-muted); }
.chase-sport-tab[data-state="upcoming"]:hover { color: var(--text-secondary); }

.chase-nav-rule {
  width: 1px;
  align-self: center;
  height: 22px;
  background: var(--border-default);
  flex: 0 0 auto;
}

.chase-nav-product {
  font-family: var(--font-display);
  font-size: var(--type-12);
  font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  flex: 0 0 auto;
}

/* —— Header search ————————————————————————————————————————————— */
.chase-nav-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 320px;
  min-width: 0;
  max-width: 380px;
}
.chase-nav-search svg {
  position: absolute;
  left: var(--space-3);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.chase-nav-search input {
  width: 100%;
  min-width: 0;
  padding-left: 38px;
  background: var(--surface-inset);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-size: var(--type-14);
}
.chase-nav-search input::placeholder { color: var(--text-muted); }

@media (max-width: 1100px) {
  .chase-nav-search { display: none; }
  .chase-nav-product,
  .chase-nav-rule { display: none; }
}
@media (max-width: 768px) {
  .chase-sport-tabs { display: none; }
}

/* Beats mlbma_design_system.css's later `.ca-btn { display: inline-flex }` on
 * the one page that loads it after the shell. Specificity (0,2,0). */
@media (max-width: 768px) {
  .chase-nav .chase-nav-model { display: none; }
}

/* ---------------------------------------------------------------------------
 * Top chrome, matched to the reference header (2026-09-10).
 *
 * Row 1: brand | rule | product label | sport switcher | search | Glossary |
 *        Model Center (text action) | account chip
 * Row 2: sport + slate date (left) | data-through + published (centre) |
 *        games available (right)
 * ------------------------------------------------------------------------ */

.chase-nav { gap: var(--space-5); }

/* Model Center reads as an action in the reference, not a filled slab. */
.chase-nav-link.chase-nav-model,
.chase-nav-link.chase-nav-model:hover {
  background: none;
  border: 0;
  padding: 0 var(--space-2);
  color: var(--accent-text);
  font-weight: 700;
  white-space: nowrap;
}
.chase-nav-link.chase-nav-model:hover { color: var(--text-primary); }

/* Account chip: initials when a session is present, "Sign in" otherwise. */
.chase-account {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch-min);
  padding: 0 var(--space-2) 0 var(--space-1);
  background: none;
  border: 0;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: var(--type-14);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.chase-account:hover { color: var(--text-primary); background: none; }

.chase-account__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: var(--type-12);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.chase-account__chev {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--text-muted);
}

/* Context bar: three zones, so freshness reads at a glance without hunting. */
.ca-context-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-4);
  width: min(100%, var(--shell-max));
  margin: 0 auto;
  padding: 0 var(--shell-gutter);
  min-height: var(--shell-context-h);
  font-family: var(--font-ui);
  font-size: var(--type-12);
  color: var(--text-muted);
}

.ca-context-bar__mid { justify-self: center; text-align: center; }
.ca-context-bar__end { justify-self: end; text-align: right; }
.ca-context-bar b { color: var(--text-secondary); font-weight: 600; }

@media (max-width: 900px) {
  .ca-context-bar { grid-template-columns: minmax(0, 1fr) auto; }
  .ca-context-bar__mid { display: none; }
}

@media (max-width: 1240px) {
  .chase-nav-product,
  .chase-nav-rule { display: none; }
}

@media (max-width: 1100px) {
  .chase-nav-search { display: none; }
}

@media (max-width: 768px) {
  .chase-account { display: none; }
}

/* Freshness lives in the context strip (row 2), per the reference chrome. The
   header pill repeated it and ran two fragments together with no separator
   ("Published: 23.5h agoSlate shown: Sep 9"). Hidden where a context bar is
   present; pages without one keep it. */
body:has(.ca-context-bar) .chase-header .chase-timestamp { display: none; }

.chase-account__label { font-weight: 600; }
.chase-account.is-signed-out .chase-account__badge { display: none; }
