/*
 * Defrag refinements on top of Tabler. Tabler supplies the components (tables, badges, forms,
 * nav, alerts); this file only sets typography, the public page frame and the result display.
 */

@font-face {
    font-family: "Inter";
    src: url("/fonts/InterVariable-2bf3d951bf9d6109437ea0874bbf12fb.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --tblr-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    /* Brand colour is an open decision (docs/open-decisions.md); ink is used until then. */
    --df-ink: #111214;
    --df-muted: var(--tblr-secondary);
    --df-rule: var(--tblr-border-color);
    --df-gain: var(--tblr-green);
    --df-loss: var(--tblr-red);

    --df-space-section: 2.5rem;
}

.df-num {
    font-variant-numeric: tabular-nums;
}

/* ---- Public frame ---------------------------------------------------------- */

.df-public {
    background: var(--tblr-bg-surface);
    color: var(--df-ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.df-public main {
    flex: 1;
    padding-top: 1.5rem;
    padding-bottom: var(--df-space-section);
}

.df-header {
    border-bottom: 1px solid var(--df-rule);
}

.df-header .container-narrow {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 3.5rem;
}

.df-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--df-ink);
    text-decoration: none;
}

.df-brand:hover {
    color: var(--df-ink);
    text-decoration: none;
}

.df-mark {
    width: 1.5rem;
    height: 1.5rem;
    flex: none;
}

.df-brand-lg .df-mark {
    width: 2.25rem;
    height: 2.25rem;
}

.df-brand-lg .df-wordmark {
    font-size: 1.5rem;
}

.df-wordmark {
    font-size: 1.125rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--df-ink);
    text-decoration: none;
}

.df-wordmark b {
    font-weight: 800;
}

.df-wordmark:hover {
    color: var(--df-ink);
    text-decoration: none;
}

.df-header .nav {
    margin-left: auto;
    --tblr-nav-underline-gap: 1.25rem;
}

.df-header .nav-link {
    color: var(--df-muted);
    font-weight: 500;
    padding-top: 1.125rem;
    padding-bottom: 1rem;
}

.df-header .nav-link.active {
    color: var(--df-ink);
    border-bottom-color: var(--df-ink);
}

/* Phones: the links get their own row under the brand instead of wrapping. No JavaScript. */
@media (max-width: 575.98px) {
    .df-header .container-narrow {
        flex-wrap: wrap;
        row-gap: 0;
    }

    .df-header .df-brand {
        padding-top: 0.875rem;
    }

    .df-header .nav {
        margin-left: 0;
        width: 100%;
        flex-wrap: nowrap;
    }

    .df-header .nav-link {
        padding-top: 0.5rem;
        padding-bottom: 0.75rem;
    }
}

.df-footer {
    border-top: 1px solid var(--df-rule);
    padding: 1.5rem 0 2rem;
    font-size: 0.875rem;
    color: var(--df-muted);
}

.df-footer a {
    color: inherit;
}

.df-footer .container-narrow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

/* ---- Typography -------------------------------------------------------------- */

.df-display {
    font-size: clamp(2.25rem, 9vw, 3.5rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
}

.df-title {
    font-size: clamp(1.75rem, 6vw, 2.25rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.df-title a {
    color: inherit;
}

.df-lede {
    font-size: 1.125rem;
    color: var(--df-muted);
    max-width: 34rem;
}

.df-section {
    margin-top: var(--df-space-section);
}

.df-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--df-ink);
}

.df-section-head h2 {
    margin: 0;
}

.df-section-head a {
    font-size: 0.875rem;
}

.df-prose {
    max-width: 40rem;
}

.df-prose h2 {
    margin-top: 2rem;
}

/* ---- Tables ------------------------------------------------------------------ */

.df-table {
    margin-bottom: 0;
}

.df-table > :not(caption) > * > * {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.df-table > :not(caption) > * > :first-child {
    padding-left: 0;
}

.df-table > :not(caption) > * > :last-child {
    padding-right: 0;
}

.df-table a {
    color: var(--df-ink);
    text-decoration: none;
}

.df-table a:hover {
    text-decoration: underline;
}

.df-table .df-rank {
    width: 2.5rem;
    color: var(--df-muted);
}

.df-table .df-player {
    font-weight: 600;
}

.df-table .df-sub {
    display: block;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--df-muted);
}

.df-table .df-rating {
    font-weight: 700;
}

/* Results: date | player A | score | player B */
.df-results td {
    vertical-align: middle;
}

.df-results .df-date {
    width: 4.5rem;
    font-size: 0.8125rem;
    color: var(--df-muted);
    white-space: nowrap;
}

.df-results .df-side-a {
    text-align: right;
}

.df-results .df-score {
    width: 4.5rem;
    text-align: center;
    font-weight: 800;
    white-space: nowrap;
}

.df-results .df-score a {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border: 1px solid var(--df-rule);
    border-radius: var(--tblr-border-radius);
}

.df-winner {
    font-weight: 700;
}

.df-loser,
.df-table .df-loser a {
    color: var(--df-muted);
}

.df-change {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}

.df-change.up {
    color: var(--df-gain);
}

.df-change.down {
    color: var(--df-loss);
}

.df-change.flat {
    color: var(--df-muted);
}

.df-form .badge {
    width: 1.75rem;
    margin: 0;
}

/* ---- Stats strip (Tabler datagrid, tighter) ------------------------------------ */

.df-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    --tblr-datagrid-padding: 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--df-rule);
    border-bottom: 1px solid var(--df-rule);
}

.df-stats .datagrid-content {
    font-size: 1.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

/* ---- Match result ---------------------------------------------------------------- */

.df-result {
    padding: 1.5rem 0 1.75rem;
    border-bottom: 1px solid var(--df-rule);
    text-align: center;
}

.df-result-meta {
    margin-bottom: 1.25rem;
}

.df-result-sides {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 0.75rem;
}

.df-result-name {
    font-size: clamp(1.125rem, 5vw, 1.5rem);
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.df-result-name a {
    color: inherit;
}

.df-result-side.df-loser .df-result-name {
    color: var(--df-muted);
    font-weight: 600;
}

.df-result-rating {
    margin-top: 0.25rem;
    font-size: 0.9375rem;
    color: var(--df-muted);
    font-variant-numeric: tabular-nums;
}

.df-result-score {
    font-size: clamp(3.5rem, 18vw, 6rem);
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.df-result-score .df-dash {
    color: var(--df-muted);
    font-weight: 400;
    padding: 0 0.1em;
}

.df-result-status {
    margin-top: 1.25rem;
}

.df-result-status .badge {
    margin: 0;
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Mobile: names above the score, score full width. */
@media (max-width: 575.98px) {
    .df-result-sides {
        grid-template-columns: 1fr 1fr;
        row-gap: 1rem;
    }

    .df-result-score {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

/* Game line on the match page */
.df-game {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.df-game img {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: cover;
    border-radius: var(--tblr-border-radius);
    border: 1px solid var(--df-rule);
}

/* Game switcher on rankings */
.df-games .nav-link {
    font-weight: 600;
}

.df-games .nav-link.active {
    background: var(--df-ink);
    color: var(--tblr-bg-surface);
}

/* Head-to-head totals */
.df-h2h-totals {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    text-align: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--df-rule);
}

.df-h2h-totals .df-big {
    display: block;
    font-size: clamp(2.5rem, 12vw, 4rem);
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.df-h2h-totals .df-draws .df-big {
    color: var(--df-muted);
}

.df-report-example {
    color: var(--df-ink);
    background: var(--tblr-bg-surface-secondary);
    border: 1px solid var(--df-rule);
    border-radius: var(--tblr-border-radius);
    padding: 0.75rem 1rem;
    white-space: pre-wrap;
}

/* ---- Pending policy placeholders ---------------------------------------------- */

.df-pending {
    border-left: 3px solid var(--tblr-warning);
    padding: 0.5rem 0 0.5rem 1rem;
    color: var(--df-muted);
}

/* ---- Admin --------------------------------------------------------------------- */

.df-evidence img {
    width: 100%;
    height: 10rem;
    object-fit: cover;
    border-radius: var(--tblr-border-radius);
    border: 1px solid var(--df-rule);
}

.df-game-cover {
    width: 8rem;
    border-radius: var(--tblr-border-radius);
    border: 1px solid var(--df-rule);
}

.df-card-preview {
    width: 100%;
    max-width: 600px;
    border-radius: var(--tblr-border-radius);
}
