/* Fantasy section.
 *
 * Deliberately thin. The builders in templates/ carry their own inline styles
 * — they were written to be dropped into a Reflex page as raw HTML — so this
 * only styles the page frame and the sidebar filters around them.
 */

.fan-page { padding: 24px; }

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

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

.fan-season {
  color: var(--text-secondary);
  font-weight: 400;
}

.fan-message {
  margin: 0;
  color: var(--text-secondary);
}

/* The builders emit fixed-width markup; let it scroll inside its own box so
   the page never scrolls sideways. */
.fan-bracket { overflow-x: auto; }

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

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

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

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

.fan-field select {
  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;
}

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

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

.fan-go {
  padding: 7px 16px;
  border: 1px solid var(--accent-blue);
  border-radius: 6px;
  background: var(--accent-blue);
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
}

/* --- Weekly stats -------------------------------------------------------
 *
 * Same rule as above: the story, performer and card markup all carry their
 * own inline styles from templates/, so this is the frame around them.
 */

.wk-matchups, .wk-shape, .wk-facts {
  margin-bottom: 28px;
}

/* The story and the performers share a row, as they did in Reflex: rx.grid
   with columns 5fr 3fr above md, one column below. The port made them two
   stacked sections, which left the right of the story empty on a wide screen.
   `start` so a short performers panel does not stretch to the story's height. */
.wk-top {
  display: grid;
  grid-template-columns: 5fr 3fr;
  align-items: start;
  gap: 16px;
  margin-bottom: 28px;
}

/* Reflex's md. Below it the two stack, which is the only thing that fits once
   the sidebar has taken its share. */
@media (max-width: 900px) {
  .wk-top { grid-template-columns: 1fr; }
}

/* No max-width any more: the column is the constraint, and capping it at
   500px left a gap inside its own cell on a wide screen. */
.wk-performers { min-width: 0; }

.wk-performers.is-empty {
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-dark);
}

.wk-performers-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

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

.wk-hint, .wk-caption, .wk-loading {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: center;
}

/* --- Matchup cards --- */

.wk-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 1.25rem 1.5rem;
  max-width: 1400px;
  margin: 0.75rem auto 0;
  padding: 0.75rem 0.75rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.wk-card {
  display: flex;
  flex-direction: column;
  flex: 0 0 calc(50% - 0.75rem);
  max-width: calc(50% - 0.75rem);
  min-width: 22.5rem;
  box-sizing: border-box;
}

/* Expanding hides every other card, so the survivor gets the full width. */
.wk-card[hidden] { display: none; }

.wk-grid:has(.wk-card[hidden]) .wk-card {
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 800px) {
  .wk-card { flex-basis: 100%; max-width: 100%; min-width: 0; }
}

/* A button so the top half is reachable by keyboard, stripped back to a
   plain block — the card markup inside brings its own look. */
.wk-card-top {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.wk-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px 12px 0 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.wk-card-top:hover .wk-card-overlay,
.wk-card-top:focus-visible .wk-card-overlay { opacity: 1; }

.wk-card-top[aria-expanded="true"] .wk-card-overlay::after {
  content: " to hide";
}

.wk-card-bottom { display: flex; flex-direction: column; flex: 1; }

.wk-lineup { max-width: 1050px; margin: 0 auto 12px; }

/* --- League Shape --- */

.wk-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.wk-tabs button {
  padding: 8px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.wk-tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent-blue);
  color: var(--text-primary);
}

.wk-chart { width: 100%; min-height: 350px; }

.wk-metrics {
  display: flex;
  justify-content: center;
  gap: 48px;
  padding-top: 12px;
  flex-wrap: wrap;
}

.wk-metrics div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.wk-metrics span { font-size: 0.75rem; color: var(--text-secondary); }
.wk-metrics strong { font-size: 1.15rem; }

/* --- All Facts --- */

.wk-facts summary { cursor: pointer; user-select: none; }

.wk-facts-scroll { max-height: 400px; overflow: auto; margin-top: 12px; }

.wk-facts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.wk-facts-table th {
  position: sticky;
  top: 0;
  background: var(--bg-dark);
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
}

.wk-facts-table th, .wk-facts-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

/* --- Season report ------------------------------------------------------
 *
 * The builders bring their own inline styles plus the stylesheet the route
 * inlines from season_report_standings.py, so this is the page frame.
 */

/* The builders size themselves with viewport media queries — they were
 * written for a Reflex page and stack at 768px of *window*. This page puts a
 * ~300px sidebar beside them, so at a 1200px window the content column is
 * only ~790px and those breakpoints fire hundreds of pixels too late: the
 * awards column ran off the side of the recap.
 *
 * Re-expressed here in terms of the container the grids are actually in.
 * Scoped to .fan-page and marked important because the flex ratios are inline
 * on the elements — the builders' own overrides do the same for the same
 * reason. Nothing here touches how the Reflex page renders.
 */
.fan-page .sr-story-flex { flex-wrap: wrap; }
.fan-page .sr-story-flex > div { flex: 1 1 320px !important; min-width: 0; }

.fan-page .sr-awards-grid,
.fan-page .sr-trades-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.fan-page .sr-team-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.sr-block { margin-bottom: 32px; }

.sr-heading { margin: 0 0 4px; font-size: 1.35rem; font-weight: 800; }

/* .sr-scroll, .sr-table and friends are in base.css — the NFL profile pages
   use them too and do not load this file. */

/* --- Standings --- */

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

/* A button so the cards are reachable by keyboard, stripped back to a plain
   block — the card markup inside brings its own look. */
.sr-team {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 12px;
  transition: transform 0.15s;
}

.sr-team:hover { transform: translateY(-2px); }
.sr-team:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }
.sr-team[aria-expanded="true"] { outline: 2px solid var(--accent-blue); }


/* --- Team detail tabs --- */

.sr-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.sr-tabs button {
  padding: 7px 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.sr-tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent-blue);
  color: var(--text-primary);
}

.sr-spark { width: 100%; min-height: 90px; margin: 12px 0; }

/* --- Sortable tables --- */

/* --- Best and worst --- */

.sr-games {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

/* Report an inappropriate league name. Its own form below the filters rather
   than inside the league dropdown — a nested form is not legal HTML, and the
   Reflex flag it replaces only appeared on hover, so it could not be reached
   by keyboard at all. */
.fan-report { margin-top: 4px; }

.fan-report > summary {
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-secondary);
  list-style: none;
}

.fan-report > summary::-webkit-details-marker { display: none; }
.fan-report > summary:hover { color: var(--text-primary); }
.fan-report > summary:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.fan-report-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

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

.fan-report-form textarea {
  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.85rem;
  resize: vertical;
}

.fan-report-form button {
  align-self: flex-start;
  padding: 6px 12px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.fan-report-form button:hover { border-color: var(--accent-blue); }

/* --- League badge ---------------------------------------------------------
 *
 * A header for the league select rather than the select itself. Reflex used
 * this as a popover trigger; the control here is a plain <select>, so the
 * badge's job is identity — which league these numbers belong to — not input.
 *
 * The avatar colour is inline, from services/leagues.league_badge_color: it is
 * derived from the name, so it is stable per league and the same for everyone.
 */

.fan-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
  margin-bottom: 4px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-dark);
}

.fan-badge-avatar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  /* The palette is chosen for contrast against white, not against the theme. */
  color: #fff;
}

/* min-width:0 on both, or the ellipsis below never triggers inside a flex row */
.fan-badge-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fan-badge-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fan-badge-meta {
  font-size: 0.625rem;
  color: var(--text-secondary);
}

/* Marks the champion's tab. Inline with the label, so it takes the tab's own
   colour and stays aligned with the text rather than sitting on its own line. */
.sr-champion-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 4px;
  color: var(--accent-gold);
}

/* Big-story bullets. Inline-block with a baseline nudge so the icon sits on
   the text line rather than pushing the bullet taller. */
.wk-story-icon {
  display: inline-block;
  width: 15px;
  height: 15px;
  vertical-align: -2px;
  margin-right: 6px;
  color: var(--accent-gold);
}

/* Winner marker beside a team abbreviation on the weekly matchup card.
   currentColor, so it picks up the team colour on the span around it. */
.wk-winner-icon {
  display: inline-block;
  width: 13px;
  height: 13px;
  vertical-align: -1px;
  margin-left: 4px;
  color: currentColor;
}
