/* NFL section.
 *
 * Thin on purpose. The tables are React islands carrying their own
 * stylesheets from assets/ — the same ones the Reflex page loads — so this is
 * the page frame and the sidebar filters around them.
 */

.ps-page { padding: 24px; }

@media (max-width: 900px) {
  .ps-page { padding: 16px; }
}

.ps-title {
  margin: 0 0 16px;
  font-size: 1.4rem;
  font-weight: 600;
}

.ps-sub {
  color: var(--text-secondary);
  font-weight: 400;
}

.ps-message {
  margin: 0 0 16px;
  color: var(--text-secondary);
}

/* The table is fixed-width and wide; let it scroll inside its own box so the
   page itself never scrolls sideways. */
#player-stats { overflow-x: auto; }

/* --- Sidebar filters ---------------------------------------------------- */

.ps-filters { display: flex; flex-direction: column; gap: 14px; }

.ps-field { display: flex; flex-direction: column; gap: 6px; }

.ps-field label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.ps-field select,
.ps-field input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
}

.ps-field select:focus-visible,
.ps-field input:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 1px;
}

/* Unlike the fantasy filters this form does not submit on change — the stat
   type and the volume floor are usually changed together, and reloading
   between them would throw away the second choice. */
.ps-go {
  padding: 8px 16px;
  border: 1px solid var(--accent-blue);
  border-radius: 6px;
  background: var(--accent-blue);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.ps-go:hover { filter: brightness(1.1); }

/* --- Advanced filters ----------------------------------------------------
 *
 * The time range, downs and opponent filters are play-by-play derived, which
 * is why they sit behind a disclosure rather than in the main list: they only
 * apply to 1999+ and most visits never touch them. The route opens the
 * <details> when any of them is set, so a shared link never hides the reason
 * its numbers differ from the defaults.
 */

.ps-advanced {
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}

.ps-advanced > summary {
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  list-style: none;
}

/* The default triangle sits inconsistently across browsers; this draws one
   that rotates with the open state. */
.ps-advanced > summary::-webkit-details-marker { display: none; }
.ps-advanced > summary::before {
  content: "\25B8";
  display: inline-block;
  width: 1em;
  transition: transform 0.15s ease;
}
.ps-advanced[open] > summary::before { transform: rotate(90deg); }

.ps-advanced > summary:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.ps-advanced > *:not(summary) { margin-top: 14px; }

.ps-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.ps-warn {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--accent-red, #b45309);
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-red, #b45309) 12%, transparent);
  color: var(--text-primary);
  font-size: 0.78rem;
  line-height: 1.35;
}

/* All / Last 3 / Clear, and the opponent strength presets. These are submit
   buttons, not JavaScript — pressing one is an ordinary form submission, so
   the resulting URL is still the shareable one. */
.ps-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ps-quick button {
  flex: 1 1 auto;
  padding: 5px 8px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--bg-dark);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.72rem;
  white-space: nowrap;
  cursor: pointer;
}

.ps-quick button:hover {
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

.ps-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ps-range span {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* fieldset carries a default border and padding that would break the column */
.ps-downs {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* A <legend> in a flex container is laid out inconsistently across browsers,
   so it is forced onto its own line rather than left to flex. */
.ps-downs legend {
  width: 100%;
  padding: 0;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.ps-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

/* The shared .ps-field rule stretches inputs to 100%; a checkbox must not. */
.ps-check input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* --- Player summary ------------------------------------------------------
 *
 * The stat tabs are links rather than buttons, so each one is a real URL a
 * quarterback's rushing page can be shared and indexed at.
 */

.pm-tabs { display: flex; flex-direction: column; gap: 2px; }

.pm-tab {
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}

.pm-tab:hover { background: rgba(255, 255, 255, 0.04); }

.pm-tab.is-active {
  background: var(--accent-blue);
  color: var(--text-primary);
  font-weight: 600;
}

.pm-header { margin-bottom: 20px; }

.pm-awards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.pm-awards li {
  padding: 3px 10px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  /* The years are in the title attribute. */
  cursor: help;
}

.pm-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.pm-hero-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-dark);
}

.pm-hero-stat strong { font-size: 1.35rem; font-weight: 700; }

.pm-hero-stat span {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.pm-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 24px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.pm-strip strong { color: var(--text-primary); }

/* Marked by the third element of each entry — a total worth noticing. */
.pm-hero-stat.is-highlight { border-color: var(--accent-blue); }
.pm-hero-stat.is-highlight strong,
.pm-strip .is-highlight strong { color: var(--accent-blue); }

.pm-heading { margin: 0 0 12px; font-size: 1.15rem; font-weight: 600; }

.pm-contracts { margin-top: 32px; }

#player-summary { overflow-x: auto; }

/* --- Franchise summary ---------------------------------------------------
 *
 * No island on this page — both tables are plain HTML and the expanded season
 * is a query parameter, so it needs no JavaScript at all.
 */

.fr-header {
  margin-bottom: 20px;
  padding-left: 12px;
  /* The franchise's own colours, resolved server-side. */
  border-left: 4px solid var(--team, var(--accent-blue));
}

.fr-history, .fr-schedule { margin-top: 28px; }

/* The season cell is a link; the rest of the row is not. */
.fr-table td:first-child a {
  color: var(--team, var(--accent-blue));
  font-weight: 600;
  text-decoration: none;
}

.fr-table td:first-child a:hover { text-decoration: underline; }

.fr-table tr.is-open { background: rgba(255, 255, 255, 0.04); }

/* Season, W, L, T and the yardage columns read as numbers; the coach and the
   leaders read as names. */
.fr-table td:nth-child(2),
.fr-table td:nth-child(7),
.fr-table td:nth-child(9),
.fr-table td:nth-child(11) { text-align: left; }

/* --- Games ---------------------------------------------------------------
 *
 * Two levels: a grid of game cards, then one game across five tabs. The only
 * JavaScript is the drive chart, and only on its own tab.
 */

.gm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

/* The whole card is a link, so a game is a real address. */
.gm-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-dark);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.gm-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
}

.gm-side { display: flex; flex-direction: column; gap: 2px; }
.gm-side:last-of-type { text-align: right; }

.gm-team { font-size: 0.8rem; color: var(--text-secondary); }
.gm-score { font-size: 1.3rem; font-weight: 700; }

/* The loser is dimmed rather than the winner highlighted — at a glance the
   eye should land on who won without a colour to decode. */
.gm-side:not(.is-winner) .gm-score { color: var(--text-secondary); }

.gm-at { font-size: 0.7rem; color: var(--text-secondary); }

.gm-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.gm-pager a { color: var(--accent-blue); text-decoration: none; }

/* --- One game --- */

.gm-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding: 18px 20px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-dark);
}

.gm-header-side {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-left: 10px;
  border-left: 4px solid var(--team, var(--border-light));
}

.gm-header-side:last-of-type {
  justify-content: flex-end;
  padding: 0 10px 0 0;
  border-left: 0;
  border-right: 4px solid var(--team, var(--border-light));
}

.gm-header-team { font-size: 1.05rem; font-weight: 600; }
.gm-header-score { font-size: 2rem; font-weight: 800; }

.gm-header-side:not(.is-winner) .gm-header-score {
  color: var(--text-secondary);
}

.gm-header-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* --- Stars --- */

.gm-stars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.gm-star {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--team, var(--accent-blue));
  border-radius: 10px;
}

.gm-star-pos {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.gm-star strong { font-size: 1rem; }
.gm-star-line { font-size: 0.78rem; color: var(--text-secondary); }

/* --- The statistic bars --- */

.gm-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px 28px;
}

.gm-bar-title {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 4px;
}

.gm-bar-row { display: flex; align-items: center; gap: 10px; }

.gm-bar-val {
  min-width: 60px;
  font-size: 0.85rem;
  font-weight: 600;
}

.gm-bar-val:last-child { text-align: right; }

/* One track per side. Each fill is that team's value as a share of the larger
   of the two, so the leader's bar is full and the other shows the gap — they
   do not sum to 100, which is why they are not one track. The away bar grows
   leftwards so the pair reads outward from the middle. */
.gm-bar-track {
  display: flex;
  flex: 1;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--border-light);
}

.gm-bar-track.is-away { justify-content: flex-end; }

.gm-bar-fill { height: 100%; border-radius: 4px; }

/* --- Key plays --- */

.gm-plays { margin: 0; padding: 0; list-style: none; }

.gm-plays li {
  display: flex;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.86rem;
}

.gm-play-meta {
  flex: 0 0 150px;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.gm-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.gm-chart { width: 100%; min-height: 420px; }

/* --- Section index pages ------------------------------------------------- */

.pi-search { max-width: 520px; margin-top: 8px; }

.pi-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
}

.pi-search input:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 1px;
}

.pi-search .sr-hint { margin: 8px 0 0; }

.pi-results { margin: 8px 0 0; padding: 0; list-style: none; }

.pi-results a {
  display: block;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text-primary);
  text-decoration: none;
}

.pi-results a:hover,
.pi-results a:focus-visible { background: rgba(255, 255, 255, 0.05); }

.ti-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.ti-team {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  /* The franchise's own colour, resolved server-side. */
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--team, var(--accent-blue));
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.ti-team:hover { transform: translateY(-2px); }

.ti-abbr {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.ti-name { font-size: 0.95rem; font-weight: 600; }

/* Present for screen readers, out of the visual flow. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
