/*
 * Shared card / table / passport primitives for the Results, Schedule and
 * Standings pages — the dashboard's card language applied to public data
 * pages so they don't drift apart. Consumes base.html tokens (--fmt-*) and
 * composes with tables.css (.fmt-num, .fmt-rank medals, .fmt-zebra).
 */

/* ── White panel ─────────────────────────────────────────────────── */
.fmt-panel {
    background: var(--fmt-surface);
    border: 1px solid var(--fmt-border);
    border-radius: var(--fmt-radius);
    box-shadow: var(--fmt-card-shadow);
    padding: 22px 24px;
}
.fmt-panel--flush {
    padding: 8px 24px;
}
.fmt-panel__scroll {
    overflow-x: auto;
}

/* ── Section header: numbered eyebrow + h2 + sub ─────────────────── */
.fmt-section {
    margin-bottom: 18px;
}
.fmt-section__eyebrow {
    font-family: var(--fmt-mono);
    font-size: 0.69rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fmt-primary);
}
.fmt-section__title {
    margin: 8px 0 0;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--fmt-text);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.fmt-section__sub {
    margin: 8px 0 0;
    color: var(--fmt-muted);
    font-size: 0.9rem;
}
.fmt-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fmt-primary);
    border: 1px solid rgba(18, 87, 214, 0.35);
    border-radius: 9px;
    padding: 2px 9px;
}

/* Light page eyebrow for hand-rolled headers (mirrors base .page-eyebrow) */
.fmt-eyebrow {
    font-family: var(--fmt-mono);
    font-size: 0.69rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fmt-primary);
    margin-bottom: 8px;
}

/* ── Chips ───────────────────────────────────────────────────────── */
.fmt-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 9px;
    border: 1px solid var(--fmt-border);
    background: #f1f4f9;
    color: #475569;
    white-space: nowrap;
}
.fmt-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 9px;
    white-space: nowrap;
    /* Neutral default so an unknown status still reads as a chip; every
       modifier below overrides both colours. */
    background: #f1f4f9;
    color: #475569;
}
.fmt-status-chip--ongoing,
.fmt-status-chip--active,
.fmt-status-chip--open {
    background: var(--fmt-green-bg);
    color: var(--fmt-green);
}
.fmt-status-chip--completed,
.fmt-status-chip--closed {
    background: var(--fmt-soft-bg);
    color: #475569;
}
.fmt-status-chip--scheduled {
    background: var(--fmt-primary-soft);
    color: var(--fmt-primary);
}
.fmt-status-chip--cancelled {
    background: #fef2f2;
    color: #b91c1c;
}
.fmt-status-chip__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
}
.fmt-status-chip--open .fmt-status-chip__dot {
    animation: fmt-pulse 1.6s infinite ease-out;
}
@keyframes fmt-pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.fmt-mono-pill {
    display: inline-flex;
    align-items: center;
    font-family: var(--fmt-mono);
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    background: #f1f4f9;
    border-radius: 9px;
    padding: 5px 12px;
}

/* ── Passport / meta grid (2 columns of mono cells) ──────────────── */
.fmt-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #eef2f7;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    overflow: hidden;
}
.fmt-meta-cell {
    background: var(--fmt-surface);
    padding: 13px 15px;
    min-width: 0;
}
.fmt-meta-cell__label {
    font-family: var(--fmt-mono);
    font-size: 9.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fmt-muted);
}
.fmt-meta-cell__value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #293b52;
    margin-top: 4px;
    overflow-wrap: anywhere;
}
.fmt-meta-cell__value--mono {
    font-family: var(--fmt-mono);
}

/* ── Reference values (light list) ───────────────────────────────── */
.fmt-ref-list__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #eef2f7;
}
.fmt-ref-list__row:last-child {
    border-bottom: none;
}
.fmt-ref-list__label {
    font-weight: 600;
    color: var(--fmt-text);
    font-size: 0.92rem;
}
.fmt-ref-list__value {
    font-family: var(--fmt-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--fmt-text);
    text-align: right;
}
.fmt-ref-list__unit {
    color: var(--fmt-muted);
    font-size: 0.8rem;
}

/* ── Carded data table ───────────────────────────────────────────── */
.fmt-dtable {
    width: 100%;
    border-collapse: collapse;
}
.fmt-dtable thead th {
    font-family: var(--fmt-mono);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fmt-muted);
    text-align: left;
    padding: 11px 12px;
    border-bottom: 1px solid var(--fmt-border);
    white-space: nowrap;
}
.fmt-dtable tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid #eef2f7;
    font-size: 0.9rem;
    color: var(--fmt-text);
    vertical-align: middle;
}
.fmt-dtable tbody tr:last-child td {
    border-bottom: none;
}
.fmt-dtable tbody tr:hover td {
    background: #fafbfc;
}
.fmt-dtable th.fmt-num,
.fmt-dtable td.fmt-num {
    text-align: right;
}
.fmt-dtable a {
    font-weight: 600;
    color: var(--fmt-text);
    text-decoration: none;
}
.fmt-dtable a:hover {
    color: var(--fmt-primary);
}

/* Rank pill (#N); top-3 medal comes from tables.css .fmt-rank */
.fmt-rank-pill {
    display: inline-block;
    font-family: var(--fmt-mono);
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    background: #f1f4f9;
    padding: 3px 8px;
    border-radius: 6px;
}
.fmt-rank-pill--top {
    color: var(--fmt-primary);
    background: var(--fmt-primary-soft);
}
.fmt-dtable tbody tr.is-current-user td {
    background: var(--fmt-primary-soft);
}

/* ── Section sub-heading + per-metric cup (results_tour / results_season) ── */
.tr-subhead {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--fmt-text);
    margin: 24px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tr-cup {
    margin-bottom: 12px;
}
.tr-cup h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--fmt-text);
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 7px;
}

/* ── Clickable card affordance ───────────────────────────────────── */
.fmt-card-link {
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.fmt-card-link:hover,
.fmt-card-link:focus-visible {
    border-color: #cbd5e1;
    color: inherit;
}
.fmt-card-link:focus-visible {
    outline: 3px solid rgba(18, 87, 214, 0.45);
    outline-offset: 2px;
}
