/**
 * v0.36.5.3.8 (5.3g) Phase 3 — stats-pages.css
 *
 * Shared styling for /stats/ (Stats_Index, Phase 3) and /stat/{id}/{year}/
 * (Stat_Detail, Phase 4). Loaded on both pages.
 *
 * Pills and color anchors taken from special-teams-card.css so visual
 * consistency holds across the whole "explore the catalog" surface.
 */

/* Container */
.nfl-stats-index__container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* Header */
.nfl-stats-index__header {
    margin-bottom: 1.25rem;
}
.nfl-stats-index__header h1 {
    margin: 0 0 0.35rem;
    font-size: 1.85rem;
    color: #1d2327;
}
.nfl-stats-index__lede {
    margin: 0;
    color: #50575e;
    font-size: 0.95rem;
}

/* Filter strip */
.nfl-stats-index__filters {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}
.nfl-stats-index__filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}
.nfl-stats-index__filter-row:last-child {
    margin-bottom: 0;
}
.nfl-stats-index__search {
    display: block;
    flex: 1 1 280px;
}
.nfl-stats-index__search-input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 0.95rem;
    background: #fff;
}
.nfl-stats-index__search-input:focus {
    outline: 2px solid #2271b1;
    outline-offset: -1px;
}

/* Pills (shared base; specific pills extend) */
.nfl-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #1d2327;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.nfl-pill:hover {
    background: #f0f0f1;
}
.nfl-pill.is-active {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}
.nfl-pill__count {
    background: rgba(0, 0, 0, 0.12);
    color: inherit;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}
.nfl-pill.is-active .nfl-pill__count {
    background: rgba(255, 255, 255, 0.25);
}

.nfl-stats-index__family-pill {
    /* same as .nfl-pill, but the count badge is always visible */
}

/* Toggles */
.nfl-stats-index__toggles {
    gap: 1.5rem;
}
.nfl-stats-index__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: #1d2327;
    cursor: pointer;
}

/* Accordion body */
.nfl-stats-index__body {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    overflow: hidden;
}
.nfl-stats-index__family {
    border-bottom: 1px solid #f0f0f1;
}
.nfl-stats-index__family:last-child {
    border-bottom: none;
}
.nfl-stats-index__family-summary {
    list-style: none;
    cursor: pointer;
    padding: 0.85rem 1rem;
    background: #fafafa;
    font-weight: 600;
    color: #1d2327;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.nfl-stats-index__family-summary::-webkit-details-marker {
    display: none;
}
.nfl-stats-index__family-summary::before {
    content: '▶';
    display: inline-block;
    font-size: 0.7rem;
    color: #50575e;
    transition: transform 0.15s;
}
.nfl-stats-index__family[open] > .nfl-stats-index__family-summary::before {
    transform: rotate(90deg);
}
.nfl-stats-index__family-summary:hover {
    background: #f0f0f1;
}
.nfl-stats-index__family-name {
    flex: 1;
}
.nfl-stats-index__family-count {
    color: #50575e;
    font-weight: 400;
    font-size: 0.85rem;
}

/* Rows */
.nfl-stats-index__family-body {
    padding: 0;
}
.nfl-stats-index__row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 1rem;
    border-top: 1px solid #f0f0f1;
    transition: background 0.1s;
}
.nfl-stats-index__row:hover {
    background: #f6f7f7;
}
.nfl-stats-index__row.is-filtered-out {
    display: none;
}

.nfl-stats-index__row-name {
    flex: 1;
    color: #2271b1;
    text-decoration: none;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nfl-stats-index__row-name:hover {
    text-decoration: underline;
}

/* Side tags */
.nfl-stats-index__side-tag {
    cursor: default;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    letter-spacing: 0.04em;
}
.nfl-stats-index__side-tag--off {
    background: #e7f1ff;
    border-color: #b6d4fe;
    color: #084298;
}
.nfl-stats-index__side-tag--def {
    background: #ffeaea;
    border-color: #f8c8c8;
    color: #842029;
}
.nfl-stats-index__side-tag--net {
    background: #efe6ff;
    border-color: #d3bff4;
    color: #4c2884;
}

/* Algo-eligible icon */
.nfl-stats-index__algo-icon {
    display: inline-block;
    width: 18px;
    text-align: center;
    color: #357935;
    font-size: 0.95rem;
    line-height: 1;
}
.nfl-stats-index__algo-icon--off {
    color: #8c8f94;
}

/* Sparkline placeholder — Phase 4 fills with SVG */
.nfl-stats-index__sparkline {
    display: inline-block;
    width: 80px;
    height: 18px;
    background: #f6f7f7;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Source tags */
.nfl-stats-index__source-tag {
    cursor: default;
    font-size: 0.72rem;
    padding: 2px 7px;
}
.nfl-stats-index__source-tag--both {
    background: #d4edda;
    border-color: #b6dab6;
    color: #155724;
}
.nfl-stats-index__source-tag--pfr {
    background: #fff3cd;
    border-color: #f1d9a3;
    color: #856404;
}
.nfl-stats-index__source-tag--nflverse {
    background: #e7f1ff;
    border-color: #b6d4fe;
    color: #084298;
}
.nfl-stats-index__source-tag--neither {
    background: #f0f0f1;
    border-color: #c3c4c7;
    color: #50575e;
}

/* Footer */
.nfl-stats-index__footer {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
}
.nfl-stats-index__counts {
    font-size: 0.88rem;
    color: #1d2327;
    line-height: 1.5;
}
.nfl-stats-index__counts--secondary {
    margin-top: 0.35rem;
    color: #50575e;
    font-size: 0.82rem;
}
.nfl-stats-index__count strong {
    font-weight: 700;
    color: #1d2327;
    font-variant-numeric: tabular-nums;
}
.nfl-stats-index__builder-link {
    margin: 0.75rem 0 0;
    font-size: 0.9rem;
}
.nfl-stats-index__builder-link a {
    color: #2271b1;
    font-weight: 600;
    text-decoration: none;
}
.nfl-stats-index__builder-link a:hover {
    text-decoration: underline;
}

/* Mobile breakpoint */
@media (max-width: 700px) {
    .nfl-stats-index__container {
        padding: 1rem 0.5rem;
    }
    .nfl-stats-index__row {
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .nfl-stats-index__row-name {
        flex: 1 1 100%;
        white-space: normal;
    }
    .nfl-stats-index__sparkline {
        width: 60px;
    }
}

/* ==================================================================
 * Stat Detail (Phase 4) — /stat/{id}/{year}/
 * ================================================================== */

.nfl-stat-detail__container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* Header */
.nfl-stat-detail__header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dcdcde;
}
.nfl-stat-detail__breadcrumb {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.nfl-stat-detail__breadcrumb a {
    color: #2271b1;
    text-decoration: none;
}
.nfl-stat-detail__breadcrumb a:hover {
    text-decoration: underline;
}
.nfl-stat-detail__title {
    margin: 0 0 0.5rem;
    font-size: 1.65rem;
    color: #1d2327;
}
.nfl-stat-detail__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin-bottom: 0.75rem;
}
.nfl-stat-detail__year-form {
    display: inline-flex;
    align-items: center;
    margin-right: 1rem;
}
.nfl-stat-detail__year-label {
    font-size: 0.9rem;
    color: #1d2327;
}
.nfl-stat-detail__year-text {
    color: #50575e;
    margin-right: 0.35rem;
}
.nfl-stat-detail__year-select {
    padding: 0.35rem 0.55rem;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fff;
    font-size: 0.9rem;
}
.nfl-stat-detail__about-link {
    font-size: 0.88rem;
    color: #2271b1;
    text-decoration: none;
}
.nfl-stat-detail__about-link:hover {
    text-decoration: underline;
}

/* Sections */
.nfl-stat-detail__section {
    margin-bottom: 2rem;
}
.nfl-stat-detail__section h2 {
    font-size: 1.15rem;
    margin: 0 0 0.35rem;
    color: #1d2327;
}
.nfl-stat-detail__sub,
.nfl-stat-detail__hero-sub {
    margin: 0 0 0.75rem;
    color: #50575e;
    font-size: 0.9rem;
}

/* Tile-and-modal cards: piggyback on .nfl-st-tiles / .nfl-st-tile from
 * special-teams-card.css. Stat-detail extension just sets max-width and
 * a subtle border on the section card. */
.nfl-stat-detail__card {
    margin-bottom: 1.5rem;
}

/* Hero chart + distribution chart container quirks. Chart.js canvas
 * sets its own height via Charts.php; the wrapper just enforces a
 * reasonable max-height so 32 horizontal bars don't go floor-to-ceiling
 * on giant screens. */
.nfl-stat-detail__hero-chart canvas {
    max-height: 700px;
}
.nfl-stat-detail__dist-chart canvas {
    max-height: 280px;
}

/* Heatmap section */
.nfl-stat-detail__heatmap {
    margin-top: 0.5rem;
}

/* Related stats */
.nfl-stat-detail__related-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.nfl-stat-detail__related-list li {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 999px;
    padding: 4px 12px;
}
.nfl-stat-detail__related-list a {
    color: #2271b1;
    text-decoration: none;
    font-size: 0.88rem;
}
.nfl-stat-detail__related-list a:hover {
    text-decoration: underline;
}

/* About expander */
.nfl-stat-detail__about-details {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 0;
}
.nfl-stat-detail__about-details summary {
    list-style: none;
    cursor: pointer;
    padding: 0.85rem 1rem;
    background: #fafafa;
    color: #1d2327;
}
.nfl-stat-detail__about-details summary::-webkit-details-marker {
    display: none;
}
.nfl-stat-detail__about-details summary::before {
    content: '▶';
    display: inline-block;
    font-size: 0.7rem;
    color: #50575e;
    margin-right: 0.5rem;
    transition: transform 0.15s;
}
.nfl-stat-detail__about-details[open] summary::before {
    transform: rotate(90deg);
}
.nfl-stat-detail__about-body {
    padding: 1rem;
    border-top: 1px solid #dcdcde;
}
.nfl-stat-detail__about-list {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(120px, 180px) 1fr;
    gap: 6px 1rem;
    font-size: 0.92rem;
}
.nfl-stat-detail__about-list dt {
    color: #50575e;
    font-weight: 600;
}
.nfl-stat-detail__about-list dd {
    margin: 0;
    color: #1d2327;
}

/* Modal table inside stat-detail tile cards */
.nfl-stat-detail__modal-table-wrap {
    overflow-x: auto;
}
.nfl-stat-detail__modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.nfl-stat-detail__modal-table th,
.nfl-stat-detail__modal-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #f0f0f1;
    text-align: left;
}
.nfl-stat-detail__modal-table th {
    background: #f6f7f7;
    font-weight: 600;
    color: #1d2327;
    position: sticky;
    top: 0;
}
.nfl-stat-detail__modal-table tbody tr:hover {
    background: #fafafa;
}

@media (max-width: 700px) {
    .nfl-stat-detail__container {
        padding: 1rem 0.5rem;
    }
    .nfl-stat-detail__title {
        font-size: 1.35rem;
    }
    .nfl-stat-detail__about-list {
        grid-template-columns: 1fr;
    }
}

/* ===================================================== v0.46.17 §P6 ====== */
/* STATS HOME. The page answers questions at the top and routes; the catalog
   is the reference shelf at the bottom. */

.nfl-stats-index__band { margin-bottom: var(--nfl-gap-7, 28px); }

.nfl-stats-index__cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--nfl-gap-5, 16px);
}
.nfl-stats-index__card-title { margin: 0 0 var(--nfl-gap-1, 6px); font-size: 1rem; }
.nfl-stats-index__card-blurb { margin: 0 0 var(--nfl-gap-2, 8px); font-size: 0.88rem; }
.nfl-stats-index__card-lead { margin: 0 0 var(--nfl-gap-1, 6px); font-weight: 600; }
.nfl-stats-index__card-uses,
.nfl-stats-index__card-eg,
.nfl-stats-index__card-count { margin: 0; font-size: 0.82rem; color: var(--nfl-color-text-muted, #6b7280); }

.nfl-stats-index__tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--nfl-gap-4, 12px);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nfl-stats-index__tile a { display: flex; flex-direction: column; gap: var(--nfl-gap-0, 4px); text-decoration: none; }
.nfl-stats-index__tile-stat { font-size: 0.82rem; color: var(--nfl-color-text-muted, #6b7280); }
.nfl-stats-index__tile-team { font-weight: 600; }
.nfl-stats-index__tile-value { font-size: 1.25rem; font-weight: 700; }

/* Sides are TEXT now, not pills (.117). */
.nfl-stats-index__sides { font-size: 0.8rem; }
.nfl-stats-index__side-tag { color: inherit; text-decoration: none; }
.nfl-stats-index__side-tag:hover { text-decoration: underline; }
.nfl-stats-index__side-sep { opacity: 0.5; }

/* View-only: the whole row reads restricted, not one corner of it. */
.nfl-stats-index__lock { opacity: 0.55; cursor: help; font-size: 0.8rem; }

.nfl-stats-index__source-strip { margin: 0 0 var(--nfl-gap-6, 20px); }

/* v0.46.17.1 — the blurb on the catalog row. Quiet, full-width under the name,
   and absent entirely when an entry has no line (no fallback by design). */
.nfl-stats-index__blurb {
  display: block;
  font-size: 0.82rem;
  line-height: 1.45;
  margin-top: var(--nfl-gap-0, 4px);
}

/* ===================================================== v0.46.18 §P7 ====== */
/* STAT DETAIL. Nine equal sections had no entry point; the KPI strip is the
   anchor and everything else reads as supporting it. */

.nfl-stat-detail__blurb {
  font-size: 0.95rem;
  color: var(--nfl-color-text-muted, #6b7280);
  margin: var(--nfl-gap-1, 6px) 0 var(--nfl-gap-2, 8px);
  max-width: 60ch;
}
.nfl-stat-detail__meta-text { font-size: 0.85rem; }
.nfl-stat-detail__freshness { margin: var(--nfl-gap-1, 6px) 0 0; }
.nfl-stat-detail__kpis { margin: 0 0 var(--nfl-gap-4, 12px); }
.nfl-stat-detail__breadcrumb { margin-bottom: var(--nfl-gap-2, 8px); font-size: 0.85rem; }

/* ==================================================== v0.46.21 §P10 ====== */
/* THE TABLE'S OWN OVERFLOW. Fourteen columns previously escaped clipping only
   because the heatmap card BELOW sets min-width:900px on its grid, forcing the
   whole item wide — the layout worked by accident and any change to that
   unrelated card broke this table. */
.nfl-teams-index__table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.nfl-teams-index__table-scroll table { min-width: 900px; }
@media (max-width: 479px) {
  /* L8 — the priority set stays readable rather than shrinking to nothing. */
  .nfl-teams-index__table-scroll table { min-width: 720px; }
}
