:root {
    --max-width: 960px;
    --navy: #0c2366;
    --blue: #0a6cd1;
    --white: #ffffff;
    --text: #0c2366;
    --muted: #5b6585;
    --border: #e2e6f0;
    --bg: #ffffff;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

/* Avoid the 300ms double-tap delay on touch devices. */
a, button, input, select, label, summary {
    touch-action: manipulation;
}

/* Visible keyboard focus for every interactive element. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
    border-radius: 2px;
}

main:focus {
    outline: none;
}

/* Skip link: off-screen until focused. */
.skip-link {
    position: absolute;
    left: 0.5rem;
    top: -3rem;
    z-index: 100;
    background: var(--navy);
    color: #fff;
    padding: 0.5rem 0.9rem;
    border-radius: 0.4rem;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* Brand header bar */
.site-header {
    background: var(--navy);
}

.site-header__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.site-header__logo {
    display: inline-block;
}

.site-header__logo img {
    display: block;
    height: 40px;
    width: auto;
}

nav a {
    color: var(--white);
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 600;
}

nav a:first-child {
    margin-left: 0;
}

nav a:hover {
    color: var(--blue);
}

/* Header search */
.site-search {
    margin: 0;
    position: relative;
}

.site-search input {
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    width: 160px;
}

.site-search input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.site-search input:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 1px;
    border-color: var(--blue);
    background: rgba(255, 255, 255, 0.16);
}

/* Live search dropdown */
.search-suggest {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    width: 280px;
    max-height: 360px;
    overflow-y: auto;
    padding: 0.3rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(12, 35, 102, 0.18);
    z-index: 50;
}

.search-suggest__group {
    padding: 0.5rem 0.6rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.search-suggest__item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    color: var(--navy);
    text-decoration: none;
}

.search-suggest__item:hover,
.search-suggest__item[aria-selected="true"] {
    background: #eef3fd;
}

.search-suggest__main {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    min-width: 0;
}

.search-suggest__icon {
    flex-shrink: 0;
}

.search-suggest__meta {
    color: var(--muted);
    font-size: 0.8rem;
}

.search-suggest__empty {
    padding: 0.6rem;
    color: var(--muted);
    font-size: 0.85rem;
}

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

/* Search results page */
.search-form {
    display: flex;
    gap: 0.5rem;
    margin: 0 0 1.5rem;
}

.search-form input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.6rem 1rem;
    font-size: 1rem;
}

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

.result-meta {
    color: var(--muted);
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.result-icon {
    margin-right: 0.4rem;
}

/* Chart container */
.chart {
    position: relative;
    height: 280px;
    margin: 0 0 2rem;
}

/* Article chart blocks */
.chart-block {
    margin: 2rem 0;
}

/* Interactive stat explorer */
.chart-explorer__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
    margin: 0 0 1.25rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: #f7f9fc;
}

.chart-explorer__group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0;
    border: 0;
    padding: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--navy);
}

.chart-explorer__group select {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    background: #fff;
    font: inherit;
    font-weight: 500;
}

.chart-explorer__group legend {
    padding: 0;
    margin-bottom: 0.3rem;
}

.chart-explorer__group--metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: 0.2rem 0.75rem;
    flex: 1 1 100%;
}

.chart-explorer__group--inline {
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
}

.chart-explorer__check {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Show axis/metric controls only for the chart types they apply to. */
.chart-explorer__group[data-modes] {
    display: none;
}

.chart-explorer[data-mode="bar"] .chart-explorer__group[data-modes~="bar"],
.chart-explorer[data-mode="line"] .chart-explorer__group[data-modes~="line"],
.chart-explorer[data-mode="scatter"] .chart-explorer__group[data-modes~="scatter"] {
    display: flex;
}

.chart-explorer[data-mode="bar"] .chart-explorer__group--metrics[data-modes~="bar"],
.chart-explorer[data-mode="line"] .chart-explorer__group--metrics[data-modes~="line"] {
    display: grid;
}

.chart-explorer__empty {
    color: var(--muted, #8a8f9c);
    font-style: italic;
}

a {
    color: var(--blue);
}

h1,
h2,
h3 {
    color: var(--navy);
}

/* Section rhythm */
main h1 {
    margin: 0 0 1rem;
}

main h2 {
    margin: 2rem 0 0.75rem;
}

/* Content lists (detail pages, home, etc.) */
main ul {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}

main li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

main li:last-child {
    border-bottom: none;
}

/* Tables */
table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1.5rem;
}

th,
td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

thead th {
    color: var(--white);
    background: var(--navy);
    font-weight: 600;
    border-bottom: none;
}

thead th a {
    color: var(--white);
    text-decoration: none;
}

thead th a:hover {
    text-decoration: underline;
}

thead th.is-sorted {
    background: var(--blue);
}

tbody tr:hover {
    background: #f2f6fd;
}

td {
    font-variant-numeric: tabular-nums;
}

/* League table: keep position + team left-aligned, stats centred */
.league-table th,
.league-table td {
    text-align: center;
}

.league-table th:nth-child(2),
.league-table td:nth-child(2) {
    text-align: left;
}

/* Recent form badges (WWDLW) */
.form {
    display: inline-flex;
    gap: 0.2rem;
}

.form__result {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1;
}

.form__result--w {
    background: #1f9d4d;
}

.form__result--d {
    background: #8a8f9c;
}

.form__result--l {
    background: #d23b3b;
}

.form__empty {
    color: var(--muted);
}

/* Recent results list */
.results li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.meta {
    color: var(--muted);
    margin: 0 0 1.5rem;
}

/* Landing hero */
.hero {
    background: var(--navy);
    color: var(--white);
    border-radius: 12px;
    padding: 3.5rem 2rem;
    margin: 1rem 0 2.5rem;
    text-align: center;
}

.hero__title {
    color: var(--white);
    font-size: 2.4rem;
    margin: 0 0 0.75rem;
}

.hero__lede {
    max-width: 40rem;
    margin: 0 auto 1.75rem;
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.85);
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.btn {
    display: inline-block;
    padding: 0.65rem 1.4rem;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
}

.btn--primary {
    background: var(--blue);
    color: var(--white);
}

.btn--primary:hover {
    background: #0857a8;
}

.btn--ghost {
    background: transparent;
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.45);
}

.btn--ghost:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Feature highlights */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.feature {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
}

.feature h2 {
    margin: 0 0 0.4rem;
}

.feature p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

/* Generic per-sport home panels (recent results + leaders) */
.sport-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin: 0 0 2.5rem;
}

.sport-panel {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.1rem 1.25rem 1.25rem;
}

.sport-panel > h2 {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
}

.sport-panel__heading {
    margin: 0.9rem 0 0.35rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.sport-panel__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sport-panel__list li {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}

.sport-panel__list li:last-child {
    border-bottom: 0;
}

.sport-panel__list--leaders li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.sport-panel__list--leaders span {
    color: var(--muted);
    white-space: nowrap;
}

/* Competition cards */
.competition-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.competition-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border: 1px solid var(--border);
    border-left: 4px solid var(--blue);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    background: var(--white);
    text-decoration: none;
}

.competition-card:hover {
    border-color: var(--blue);
}

.competition-card__name {
    font-weight: 700;
    color: var(--navy);
}

.competition-card__meta {
    color: var(--muted);
    font-size: 0.85rem;
}

/* Article relation tags */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 1.5rem;
}

.article-tags a {
    background: #eef3fd;
    color: var(--navy);
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.article-tags a:hover {
    background: var(--blue);
    color: var(--white);
}

/* Stat widgets */
.widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2.5rem;
}

.widget {
    border: 1px solid var(--border);
    border-top: 3px solid var(--blue);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    background: var(--white);
}

.widget__title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
}

.widget__list {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: rank;
}

ol.widget__list li {
    counter-increment: rank;
}

.widget__list li {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border);
}

.widget__list li:last-child {
    border-bottom: none;
}

ol.widget__list li::before {
    content: counter(rank);
    min-width: 1rem;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.widget__meta {
    color: var(--muted);
    font-size: 0.8rem;
}

.widget__value {
    margin-left: auto;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Team cards */
.team-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.team-card {
    border: 1px solid var(--border);
    border-top: 3px solid var(--blue);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    background: var(--white);
}

.team-card__name {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
}

.team-card__name a {
    color: var(--navy);
    text-decoration: none;
}

.team-card__name a:hover {
    color: var(--blue);
}

.team-card__stats {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 1rem;
}

.team-card__stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.team-card__stat dt {
    color: var(--muted);
    font-size: 0.85rem;
}

.team-card__stat dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.team-card__stat--points dd {
    color: var(--blue);
}

/* Team badges */
.team-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Badge inside team links (league table, match score) */
.team-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.team-link img {
    flex-shrink: 0;
    object-fit: contain;
}

.match-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

/* Homepage featured teams */
.featured-teams {
    display: grid;
    /* Column counts are all divisors of the 12 featured teams, so every
       breakpoint fills even rows (6×2, 4×3, 3×4, 2×6). */
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}

@media (max-width: 900px) {
    .featured-teams { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 640px) {
    .featured-teams { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 420px) {
    .featured-teams { grid-template-columns: repeat(2, 1fr); }
}

.featured-team {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    background: var(--white);
    text-decoration: none;
    text-align: center;
}

.featured-team:hover {
    border-color: var(--blue);
}

.featured-team__sport {
    position: absolute;
    top: 0.4rem;
    right: 0.5rem;
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0.85;
}

.featured-team img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    /* A faint tinted backdrop + outline keeps white/transparent badges
       (e.g. some F1 constructor logos) visible on the white card. */
    background: #eef1f7;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px;
    filter: drop-shadow(0 0 0.5px rgba(12, 35, 102, 0.35));
}

.featured-team__monogram {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.featured-team__name {
    font-weight: 700;
    color: var(--navy);
    font-size: 0.9rem;
}

/* NFL sub-navigation */
.nfl-subnav {
    display: flex;
    gap: 1rem;
    margin: 0.5rem 0 1.25rem;
    border-bottom: 1px solid var(--border);
}

.nfl-subnav a {
    padding: 0.4rem 0.2rem;
    text-decoration: none;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.nfl-subnav a.is-active {
    color: var(--navy);
    font-weight: 700;
    border-bottom-color: var(--blue);
}

.nfl-subnav--pills {
    border-bottom: none;
}

/* NFL games list */
.nfl-games {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.nfl-game {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    background: var(--white);
    text-decoration: none;
    color: var(--text);
}

.nfl-game:hover {
    border-color: var(--blue);
}

.nfl-game__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.nfl-game__time {
    color: var(--muted);
    font-size: 0.78rem;
}

.nfl-game__team {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.nfl-game__abbr {
    font-weight: 700;
}

.football-games {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.football-game {
    gap: 0.45rem;
    overflow: hidden;
}

.football-game__team {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2rem;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.football-game__club {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.football-game__club img {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.football-game__name {
    color: var(--navy);
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.football-game__score {
    color: var(--navy);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    text-align: right;
}

/* Formula 1 section */
.f1-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.f1-summary__panel {
    min-width: 0;
}

.f1-races {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.f1-race {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    background: var(--white);
    color: var(--text);
    text-decoration: none;
}

.f1-race:hover {
    border-color: var(--blue);
}

.f1-race__meta {
    color: var(--muted);
    font-size: 0.78rem;
}

.f1-race__title {
    color: var(--navy);
    font-size: 1rem;
}

.f1-podium {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.f1-podium__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    color: var(--text);
    font-size: 0.9rem;
}

.f1-podium__row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.f1-podium__row strong {
    color: var(--navy);
    font-variant-numeric: tabular-nums;
}

.f1-result-row--podium td:first-child {
    border-left: 4px solid var(--blue);
    font-weight: 800;
}

.f1-result-row--p1 {
    background: #fff8df;
}

.f1-result-row--p1 td:first-child {
    border-left-color: #d7a300;
}

.f1-result-row--p2 {
    background: #f6f8fb;
}

.f1-result-row--p2 td:first-child {
    border-left-color: #9aa4b2;
}

.f1-result-row--p3 {
    background: #fff1e7;
}

.f1-result-row--p3 td:first-child {
    border-left-color: #b46a32;
}

.f1-badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.05rem 0.35rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    vertical-align: middle;
    line-height: 1.4;
}

.f1-badge--pole {
    background: #6c2bd9;
    color: #fff;
}

.f1-badge--fl {
    background: #8b1a78;
    color: #fff;
}

.nfl-game__score {
    font-variant-numeric: tabular-nums;
    min-width: 1.5rem;
    text-align: center;
}

.nfl-game__at {
    color: var(--muted);
    font-size: 0.85rem;
}

/* NFL game detail scoreline */
.nfl-scoreline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin: 1rem 0 0.25rem;
}

.nfl-scoreline__team {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
    font-size: 1.1rem;
}

.nfl-scoreline__team strong {
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
    color: var(--navy);
}

.nfl-scoreline__at {
    color: var(--muted);
}

.nfl-meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.nfl-breadcrumb {
    font-size: 0.9rem;
}

.nfl-roster {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.25rem 1rem;
}

.nfl-roster li {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding: 0.25rem 0;
}

.nfl-roster__pos {
    color: var(--muted);
    font-size: 0.85rem;
}

/* NFL player stat groups */
.stat-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 1rem 1rem;
    background: var(--white);
}

.stat-group h3 {
    margin: 0.5rem 0;
    color: var(--navy);
}

/* Inline help bubble with a hover/focus tooltip. */
.help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 50%;
    background: var(--border);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    position: relative;
    vertical-align: middle;
}

.help::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 200px;
    background: var(--navy);
    color: #fff;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.3;
    text-align: left;
    white-space: normal;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
    z-index: 10;
}

.help:hover::after,
.help:focus::after {
    opacity: 1;
}

/* Team Leaders: pin the value to the bottom so it aligns across cards even
   when some cards have an explanatory note. */
.stat-groups--leaders .stat-group {
    display: flex;
    flex-direction: column;
}

.stat-groups--leaders .stat-group ul {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.stat-group__value {
    margin-top: auto;
}

.stat-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.stat-group li {
    display: flex;
    justify-content: space-between;
    font-variant-numeric: tabular-nums;
}

.article-chart {
    height: 360px;
    margin: 2rem 0;
}

/* --- Article builder blocks --- */
.article-lead {
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--muted);
}

.article-body {
    max-width: 44rem;
    font-size: 1.05rem;
    line-height: 1.75;
}

.article-body h2 { margin: 2.2rem 0 0.6rem; }
.article-body h3 { margin: 1.8rem 0 0.5rem; }
.article-body p { margin: 0 0 1.1rem; }
.article-body ul,
.article-body ol { margin: 0 0 1.1rem 1.4rem; }
.article-body li { margin: 0.2rem 0; }
.article-body a { color: var(--blue); text-decoration: underline; }

.article-body img { max-width: 100%; height: auto; }

.article-body blockquote {
    margin: 1.5rem 0;
    padding: 0.4rem 0 0.4rem 1.1rem;
    border-left: 4px solid var(--blue);
    color: var(--muted);
    font-style: italic;
}

.article-body pre {
    background: #0c2366;
    color: #eaf1ff;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
}

.article-body code {
    background: #f0f3fa;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    font-size: 0.9em;
}

.article-body pre code { background: none; padding: 0; }

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.article-body th,
.article-body td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.7rem;
    text-align: left;
}

/* Figures: images and video, with alignment options */
.article-figure {
    margin: 1.8rem 0;
}

.article-figure img,
.article-figure video {
    display: block;
    width: 100%;
    border-radius: 0.5rem;
}

.article-figure figcaption {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}

.article-figure--left,
.article-figure--right {
    max-width: 22rem;
}

.article-figure--left { float: left; margin: 0.4rem 1.5rem 1rem 0; }
.article-figure--right { float: right; margin: 0.4rem 0 1rem 1.5rem; }
.article-figure--center { max-width: 100%; }

/* Wide/full break out of the body's reading column */
.article-figure--wide { width: min(58rem, 92vw); margin-left: 50%; transform: translateX(-50%); }
.article-figure--full { width: 96vw; margin-left: 50%; transform: translateX(-50%); }

@media (max-width: 640px) {
    .article-figure--left,
    .article-figure--right { float: none; max-width: 100%; margin: 1.5rem 0; }
    .article-figure--wide,
    .article-figure--full { width: 100%; margin-left: 0; transform: none; }
}

/* Responsive 16:9 embed wrapper */
.article-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #000;
}

.article-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Callout boxes */
.article-callout {
    margin: 1.8rem 0;
    padding: 1rem 1.2rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--blue);
    background: #f0f6ff;
}

.article-callout > :last-child { margin-bottom: 0; }
.article-callout--tip { border-left-color: #17914a; background: #effaf1; }
.article-callout--info { border-left-color: #0080fd; background: #f0f6ff; }
.article-callout--warning { border-left-color: #d99100; background: #fff8e8; }
.article-callout--note { border-left-color: #8a8f9c; background: #f6f7fb; }
.article-callout--quote {
    border-left-color: var(--navy);
    background: transparent;
    font-size: 1.2rem;
    font-style: italic;
}

.article-divider {
    margin: 2.5rem 0;
    border: 0;
    border-top: 1px solid var(--border);
}

/* Article presentation: cover, byline, preview banner */
.article-cover {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 0.6rem;
    margin: 0 0 1.5rem;
}

.article-byline {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0.2rem 0 0.8rem;
}

.article-preview-banner {
    background: #fff8e8;
    border: 1px solid #f0d488;
    color: #7a5b00;
    padding: 0.6rem 0.9rem;
    border-radius: 0.4rem;
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}

/* Article cards (list + related) */
.article-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.article-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    overflow: hidden;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    transition: box-shadow 0.15s, transform 0.15s;
}

.article-card:hover {
    box-shadow: 0 6px 20px rgba(12, 35, 102, 0.1);
    transform: translateY(-2px);
}

.article-card__media {
    display: block;
    aspect-ratio: 16 / 9;
    background: #f0f3fa;
}

.article-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.9rem 1rem 1.1rem;
}

.article-card__meta {
    font-size: 0.78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.article-card__title {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.3;
    color: var(--navy);
}

.article-card__summary {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.5;
}

.article-related {
    margin-top: 3rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

/* Author page */
.author-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin: 0 0 1.5rem;
}

.author-header__avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.author-header__social a { font-size: 0.9rem; }
.author-header__bio { color: var(--muted); margin: 0.4rem 0 0; max-width: 44rem; }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    margin: 2rem 0;
}

.pagination__status {
    color: var(--muted);
    font-size: 0.9rem;
}
