/* ========================================
   FONTS
   ======================================== */

@font-face {
    font-family: 'Google Sans';
    src: url('../fonts/GoogleSans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Google Sans';
    src: url('../fonts/GoogleSans-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Google Sans';
    src: url('../fonts/GoogleSans-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ========================================
   BASE & VARIABLES
   ======================================== */

/* Global default font size: drop the root to 14px so all rem-based type,
   buttons, and spacing scale down ~12% (the site read too large). Body keeps
   a readable ~14px via the 1rem body var below. */
html {
    font-size: 14px;
}

:root {
    --bs-body-font-size: 1rem;
    --bs-card-border-width: 0;
    --bs-list-group-border-width: 0;
    --bs-table-border-width: 0;
    --accent: #3b82f6;
    --accent-subtle: rgba(59, 130, 246, 0.08);
    /* Brand the Bootstrap primary to the site accent so buttons, links and
       focus rings match the rest of the UI (was the default #0d6efd). */
    --bs-primary: #3b82f6;
    --bs-primary-rgb: 59, 130, 246;
    --surface-elevated: #ffffff;
    --surface-subtle: #f8fafc;
    --border-subtle: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --nav-height: 56px;
}

body {
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h4 {
    font-size: 1.0rem;
}

/* ========================================
   BUTTONS (cohesive, branded, less "default")
   ======================================== */
.btn {
    --bs-btn-font-weight: 500;
    --bs-btn-border-radius: 0.5rem;
    --bs-btn-padding-y: 0.45rem;
    --bs-btn-padding-x: 0.95rem;
    letter-spacing: 0.005em;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn-sm { --bs-btn-border-radius: 0.45rem; --bs-btn-padding-y: 0.3rem; --bs-btn-padding-x: 0.7rem; }
.btn-lg { --bs-btn-border-radius: 0.6rem; }

.btn-primary {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: #2f6fe0;
    --bs-btn-hover-border-color: #2f6fe0;
    --bs-btn-active-bg: #2563eb;
    --bs-btn-active-border-color: #2563eb;
    --bs-btn-disabled-bg: var(--accent);
    --bs-btn-disabled-border-color: var(--accent);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.10);
}
.btn-primary:hover { box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35); }

.btn-outline-primary {
    --bs-btn-color: var(--accent);
    --bs-btn-border-color: rgba(59, 130, 246, 0.35);
    --bs-btn-hover-bg: var(--accent);
    --bs-btn-hover-border-color: var(--accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #2563eb;
    --bs-btn-active-border-color: #2563eb;
}

.btn-outline-secondary {
    --bs-btn-color: var(--text-secondary);
    --bs-btn-border-color: var(--border-subtle);
    --bs-btn-hover-bg: var(--surface-subtle);
    --bs-btn-hover-color: var(--text-primary);
    --bs-btn-hover-border-color: var(--text-tertiary);
    --bs-btn-active-bg: var(--surface-subtle);
    --bs-btn-active-color: var(--text-primary);
}

/* ========================================
   LIGHT THEME
   ======================================== */

[data-bs-theme="light"] {
    --bs-body-bg: #ffffff;
    --bs-card-bg-custom: #f8fafc;
    --bs-table-hover-bg-custom: #f1f5f9;
    --bs-border-color: #e2e8f0;
    --surface-elevated: #ffffff;
    --surface-subtle: #f8fafc;
    --border-subtle: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
}

[data-bs-theme="light"] .navbar-custom {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

[data-bs-theme="light"] .card,
[data-bs-theme="light"] .list-group-item {
    background-color: var(--bs-card-bg-custom);
}

/* Homepage Tools row */
.tools-section { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.tool-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.15rem;
    border: 1px solid var(--border-subtle);
    border-radius: 0.6rem;
    background-color: var(--surface-elevated);
    text-decoration: none;
    height: 100%;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.tool-card:hover { border-color: var(--bs-primary); transform: translateY(-2px); }
.tool-card .bi { font-size: 1.6rem; color: var(--bs-primary); }
.tool-card-title {
    display: block; color: var(--text-primary);
    font-family: var(--font-display); font-weight: 700;
    text-transform: uppercase; letter-spacing: .01em; font-size: 1.15rem;
    line-height: 1.05;
}
.tool-card-sub { display: block; font-size: 0.85rem; color: var(--text-secondary); }
.tool-card .bi { transition: transform .15s ease; }
.tool-card:hover .bi { transform: scale(1.08); }

/* Head-to-head comparison */
.compare-table thead th {
    font-family: var(--font-display); text-transform: uppercase;
    font-size: clamp(1.2rem, 2.8vw, 1.55rem); letter-spacing: 0.01em;
    font-weight: 700; line-height: 1.15;
    border: 0 !important; padding-bottom: .6rem;
}
.compare-table thead th.text-muted {  /* the "Metric" middle header */
    font-family: var(--font-mono); font-size: .6rem; letter-spacing: .14em;
    font-weight: 600; color: var(--text-tertiary) !important; vertical-align: middle;
}
.compare-table tbody td { font-size: 0.95rem; padding-top: 0.55rem; padding-bottom: 0.55rem; }
/* The two driver-value columns read as instrument numerics. */
.compare-table tbody td:first-child,
.compare-table tbody td:last-child {
    font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1rem;
}
/* The centre metric label in mono caps. */
.compare-table tbody td:nth-child(2) {
    font-family: var(--font-mono); text-transform: uppercase;
    font-size: .62rem !important; letter-spacing: .12em; color: var(--text-tertiary) !important;
}
.compare-table tbody tr { border-bottom: 1px solid var(--border-subtle); }
.compare-table tbody tr:last-child { border-bottom: 0; }
.compare-picker {
    position: relative;
    background:
        radial-gradient(130% 130% at 50% -25%, var(--accent-subtle), transparent 60%),
        var(--surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 2rem 1.75rem 1.75rem;
    box-shadow: 0 18px 48px -24px rgba(15, 23, 42, 0.35);
}
/* Two driver slots flanking a centred VS medallion. */
.vs-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 0.85rem;
}
.vs-slot { position: relative; min-width: 0; }
.vs-slot-label {
    display: block; margin-bottom: 0.45rem; padding-left: 0.15rem;
    font-family: var(--font-mono); text-transform: uppercase;
    letter-spacing: 0.12em; font-size: 0.62rem; font-weight: 600;
    color: var(--text-tertiary);
}
.vs-input-wrap { position: relative; }
.vs-input-icon {
    position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%);
    color: var(--text-tertiary); font-size: 0.95rem; pointer-events: none;
    transition: color 0.15s ease;
}
.compare-picker .cmp-search {
    height: 52px; border-radius: 12px;
    padding-left: 2.55rem; padding-right: 1rem;
    background-color: var(--surface-subtle);
    border: 1.5px solid var(--border-subtle);
    font-size: 0.98rem; font-weight: 500; color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.compare-picker .cmp-search::placeholder { color: var(--text-tertiary); font-weight: 400; }
.compare-picker .cmp-search:focus {
    background-color: var(--surface-elevated);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-subtle);
}
.vs-slot:focus-within .vs-input-icon { color: var(--accent); }
/* Selected-driver state: accent border + check, hide the search glyph. */
.vs-slot.is-selected .cmp-search {
    background-color: var(--surface-elevated);
    border-color: var(--accent);
    padding-left: 1rem; padding-right: 2.5rem; font-weight: 600;
}
.vs-slot.is-selected .vs-input-icon { opacity: 0; }
.vs-slot-check {
    position: absolute; right: 0.9rem; top: 50%;
    transform: translateY(-50%) scale(0.5);
    color: var(--accent); font-size: 1.15rem;
    opacity: 0; pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.vs-slot.is-selected .vs-slot-check { opacity: 1; transform: translateY(-50%) scale(1); }
/* Centre VS medallion (nudged to sit centred on the 52px inputs). */
.vs-divider { display: flex; align-items: center; justify-content: center; margin-bottom: 3px; }
.vs-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #2563eb);
    color: #fff; font-family: var(--font-display);
    font-weight: 700; font-size: 1rem; letter-spacing: 0.04em;
    border: 3px solid var(--surface-elevated);
    box-shadow: 0 6px 18px -4px rgba(59, 130, 246, 0.55);
}
/* Full-width Compare CTA: muted until both drivers chosen, then a glowing gradient. */
.cmp-go-btn {
    width: 100%; margin-top: 1.5rem; height: 50px;
    border-radius: 12px; font-size: 1rem; font-weight: 600;
}
.cmp-go-btn:disabled {
    background: var(--surface-subtle); border-color: var(--border-subtle);
    color: var(--text-tertiary); box-shadow: none; opacity: 1;
}
.cmp-go-btn:not(:disabled) {
    background: linear-gradient(135deg, var(--accent), #2563eb);
    border-color: transparent;
    box-shadow: 0 10px 26px -8px rgba(59, 130, 246, 0.6);
}
/* Autocomplete dropdown. */
.cmp-results {
    top: calc(100% + 6px); left: 0;
    padding: 0.3rem; border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background-color: var(--surface-elevated);
    box-shadow: 0 16px 40px -12px rgba(15, 23, 42, 0.35);
    overflow: hidden;
}
.cmp-results:empty { display: none; }
.cmp-results .list-group-item {
    display: flex; align-items: center; gap: 0.6rem;
    cursor: pointer; border: 0; border-radius: 8px;
    padding: 0.6rem 0.7rem; font-weight: 500;
    background-color: transparent; color: var(--text-primary);
}
.cmp-results .list-group-item i { color: var(--text-tertiary); font-size: 1.05rem; }
.cmp-results .list-group-item:hover,
.cmp-results .list-group-item:focus {
    background-color: var(--accent-subtle); color: var(--accent);
}
.cmp-results .list-group-item:hover i { color: var(--accent); }
@media (max-width: 575.98px) {
    .vs-grid { grid-template-columns: 1fr; gap: 0.5rem; }
    .vs-divider { margin: 0.15rem 0; }
    .compare-picker { padding: 1.5rem 1.25rem; }
}
.matchup-chip {
    display: inline-flex; align-items: center;
    padding: 0.4rem 0.85rem; border-radius: 999px;
    border: 1px solid var(--border-subtle); background-color: var(--surface-elevated);
    color: var(--text-primary); text-decoration: none; font-size: 0.875rem;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.matchup-chip:hover { border-color: var(--bs-primary); transform: translateY(-1px); }
.cat-pill {
    display: inline-flex; align-items: center;
    padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.8rem; font-weight: 500;
    border: 1px solid var(--border-subtle); background-color: var(--surface-elevated);
    color: var(--text-secondary); text-decoration: none; transition: all 0.15s;
}
.cat-pill:hover { border-color: var(--bs-primary); color: var(--bs-primary); }
.cat-pill.active { background-color: var(--accent); border-color: var(--accent); color: #fff; }
.rank-badge {
    display: inline-flex; align-items: center; margin-bottom: 1.25rem;
    padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
    color: var(--accent); background-color: var(--accent-subtle);
    border: 1px solid rgba(59, 130, 246, 0.25); text-decoration: none; transition: all 0.15s;
}
.rank-badge:hover { background-color: var(--accent); color: #fff; }

/* Driver profile header: keep the name + lede column narrow so the action
   buttons (and the Top N% chip stacked beneath them) sit clearly on the right. */
.driver-header-info { max-width: 40rem; }

/* Chart surfaces: white panel in light mode, elevated dark surface in dark mode,
   so transparent Chart.js canvases don't show the gray card background. */
.chart-surface {
    background-color: var(--surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    padding: 0.5rem;
}

[data-bs-theme="light"] .table {
    --bs-table-bg: var(--bs-card-bg-custom);
    --bs-table-hover-bg: var(--bs-table-hover-bg-custom);
    --bs-table-striped-bg: var(--bs-table-hover-bg-custom);
}

[data-bs-theme="light"] .race-results-table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: var(--bs-table-hover-bg-custom);
    --bs-table-striped-bg: var(--bs-table-hover-bg-custom);
}
[data-bs-theme="light"] .race-results-table thead {
    background-color: transparent;
}
[data-bs-theme="light"] .race-results-table thead th {
    border-bottom: 1px solid var(--bs-border-color);
}

/* ========================================
   DARK THEME
   ======================================== */

[data-bs-theme="dark"] {
    --bs-body-bg: #0a0a0a;
    --bs-card-bg-custom: #141414;
    --bs-table-hover-bg-custom: #1e1e1e;
    --bs-border-color: #1e1e1e;
    --surface-elevated: #141414;
    --surface-subtle: #0f0f0f;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --accent-subtle: rgba(59, 130, 246, 0.12);
}

[data-bs-theme="dark"] .navbar-custom {
    background-color: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .list-group-item {
    background-color: var(--bs-card-bg-custom);
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: var(--bs-card-bg-custom);
    --bs-table-hover-bg: var(--bs-table-hover-bg-custom);
    --bs-table-striped-bg: var(--bs-table-hover-bg-custom);
}

[data-bs-theme="dark"] .race-results-table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: var(--bs-table-hover-bg-custom);
    --bs-table-striped-bg: var(--bs-table-hover-bg-custom);
}
[data-bs-theme="dark"] .race-results-table thead {
    background-color: transparent;
}
[data-bs-theme="dark"] .race-results-table thead th {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] #bd-theme.btn-link,
[data-bs-theme="dark"] .theme-toggle-btn {
    color: #fff;
}

[data-bs-theme="dark"] .dropdown-menu .bi {
    color: #fff;
}

[data-bs-theme="dark"] #bd-theme .bi {
    fill: #fff;
}

/* ========================================
   NAVIGATION
   ======================================== */

.navbar-custom {
    padding: 0.5rem 0;
    box-shadow: none;
    transition: background-color 0.2s;
    z-index: 1030;
}

.navbar-logo {
    height: 22px;
    width: auto;
}

.nav-link-custom {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 0.4rem 0.75rem !important;
    border-radius: 6px;
    transition: background-color 0.15s, color 0.15s;
    text-decoration: none !important;
    color: var(--text-secondary) !important;
}

.nav-link-custom:hover {
    background-color: var(--accent-subtle);
    color: var(--accent) !important;
}

.theme-toggle-btn {
    border: none !important;
    border-radius: 6px;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.theme-toggle-btn:hover {
    opacity: 1;
}

/* Hide the dropdown caret on theme toggle */
.theme-toggle-btn::after {
    display: none;
}

@media (min-width: 992px) {
    .navbar-center-links {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        margin: 0;
    }

    .navbar-collapse {
        position: static;
    }
}

@media (max-width: 991.98px) {
    .navbar-logo {
        max-width: 130px;
        height: auto;
    }
}

/* ========================================
   LOGO THEME HANDLING
   ======================================== */

.logo-dark { display: none; }
.logo-light { display: inline-block; }
[data-bs-theme="dark"] .logo-dark { display: inline-block; }
[data-bs-theme="dark"] .logo-light { display: none; }

@media (prefers-color-scheme: dark) {
    [data-bs-theme="auto"] .logo-dark { display: inline-block; }
    [data-bs-theme="auto"] .logo-light { display: none; }
}

@media (prefers-color-scheme: light) {
    [data-bs-theme="auto"] .logo-dark { display: none; }
    [data-bs-theme="auto"] .logo-light { display: inline-block; }
}

/* ========================================
   MAIN CONTENT
   ======================================== */

main.container {
    margin-top: 24px;
}

/* ========================================
   CARDS
   ======================================== */

.card {
    border: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    border-radius: 10px;
}

[data-bs-theme="dark"] .card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.card-header {
    padding: 1.25rem 1.25rem;
}

.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5 {
    font-size: 0.9rem;
    font-weight: 600;
}

.list-group-item h5 {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Mobile race result cards should have borders */
.mobile-race-card {
    border: 1px solid var(--bs-border-color) !important;
}

/* ========================================
   HERO LANDING PAGE
   ======================================== */

.hero-landing {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 0;
}

.hero-logo-wrapper {
    margin-bottom: 1rem;
}

.hero-logo {
    max-width: 420px;
    width: 100%;
    height: auto;
}

.hero-subtitle {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-bottom: 2.5rem;
    letter-spacing: 0.01em;
}

.hero-search-wrapper {
    max-width: 520px;
    margin: 0 auto;
}

.hero-famous-driver {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 1.5em;
}

.famous-driver-cycle-link {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.3s, transform 0.3s;
}

.famous-driver-cycle-link:hover {
    text-decoration: underline;
    color: var(--accent);
}

.hero-nav-links {
    margin-top: 2.5rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.hero-nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 1rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    background-color: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
    transition: all 0.15s;
}

.hero-nav-pill:hover {
    color: var(--accent);
    border-color: var(--accent);
    background-color: var(--accent-subtle);
}

.hero-nav-pill i {
    font-size: 0.75rem;
}

@media (max-width: 768px) {
    .hero-logo {
        max-width: 260px;
    }
    .hero-subtitle {
        font-size: 0.8rem;
    }
}

/* ========================================
   SEARCH BAR
   ======================================== */

.search-bar {
    display: flex;
    align-items: center;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background-color: var(--surface-elevated);
    padding: 0.25rem 0.25rem 0.25rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    gap: 0.5rem;
}

.search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.search-bar-icon {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.search-bar-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.9rem;
    flex: 1;
    padding: 0.5rem 0;
    color: var(--text-primary);
    font-family: inherit;
    min-width: 0;
}

.search-bar-input::placeholder {
    color: var(--text-tertiary);
}

.search-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: none;
    background-color: var(--accent);
    color: white;
    padding: 0.5rem 1.1rem;
    border-radius: 9px;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-bar-btn:hover {
    background-color: #2563eb;
}

.search-bar-btn:active {
    transform: scale(0.97);
}

.search-bar-btn-icon {
    font-size: 0.8rem;
}

/* Legacy support for old search-input-group */
.search-input-group {
    border-radius: .375rem;
    overflow: hidden;
    border: var(--bs-border-width) solid var(--bs-border-color);
}

.search-input-group:focus-within {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.search-input-group .form-control {
    border: 0;
    box-shadow: none;
}

.search-input-group .btn {
    border: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

@media (max-width: 576px) {
    .search-bar {
        padding: 0.2rem 0.2rem 0.2rem 0.75rem;
    }
    .search-bar-input {
        font-size: 0.85rem;
    }
    .search-bar-btn-text {
        display: none;
    }
}

/* ========================================
   SEARCH RESULTS PAGE
   ======================================== */

.search-results-hero {
    padding: 3rem 0 4rem;
}

.search-page-logo {
    height: 36px;
    width: auto;
}

.search-results-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--text-tertiary);
}

.search-results-query {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0.25rem 0 0;
    color: var(--text-primary);
}

.search-result-count {
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.search-results-list-new {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-result-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background-color: var(--surface-elevated);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.search-result-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
    color: inherit;
    transform: translateY(-1px);
}

.search-result-card-inner {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    gap: 0.85rem;
}

.search-result-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background-color: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.search-result-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-id {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.search-result-arrow {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: transform 0.15s, color 0.15s;
}

.search-result-card:hover .search-result-arrow {
    color: var(--accent);
    transform: translateX(2px);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state-icon {
    font-size: 2rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
    display: block;
}

.empty-state-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ========================================
   FAMOUS DRIVERS (Search Results)
   ======================================== */

.famous-drivers-section {
    margin-top: 2.5rem;
}

.section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 0.75rem;
}

.famous-drivers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.famous-driver-chip {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    background-color: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
    transition: all 0.15s;
}

.famous-driver-chip:hover {
    color: var(--accent);
    border-color: var(--accent);
    background-color: var(--accent-subtle);
}

/* Legacy famous-driver-card support */
.famous-driver-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
    height: 100%;
    min-height: 80px;
    box-shadow: none !important;
}

.famous-driver-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

[data-bs-theme="dark"] .famous-driver-card {
    background-color: var(--bs-gray-800);
    border: 1px solid var(--bs-gray-700);
}

[data-bs-theme="dark"] .famous-driver-card:hover {
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="light"] .famous-driver-card {
    background-color: var(--bs-white);
    border: 1px solid var(--bs-gray-300);
}

/* ========================================
   FEATURED SERIES (Search Results)
   ======================================== */

.featured-series-section {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-subtle);
}

.series-category-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 0.6rem;
    text-decoration: none;
    transition: color 0.15s;
}

.series-category-label:hover {
    color: var(--accent);
}

.series-link-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.series-link-item-new {
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.2rem 0;
    transition: color 0.15s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.series-link-item-new:hover {
    color: var(--accent);
}

/* One block per category, every series listed. Series flow into as many
   responsive columns as fit so a 40-series category stays compact. */
.series-cat-block { margin-bottom: 1.75rem; }
.series-cat-block:last-child { margin-bottom: 0; }

.series-category-label .series-cat-count {
    margin-left: 0.5rem;
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--text-tertiary);
    background: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    vertical-align: middle;
}

.series-link-cols {
    display: block;          /* override the flex column for CSS multi-columns */
    columns: 240px;
    column-gap: 2rem;
}
.series-link-cols .series-link-item-new {
    display: block;
    break-inside: avoid;
    white-space: normal;     /* allow long series names to wrap, not clip */
    overflow: visible;
    text-overflow: clip;
    line-height: 1.3;
}

/* ========================================
   FOOTER
   ======================================== */

.site-footer {
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border-subtle);
}

.site-footer--landing {
    border-top: none;
    margin-top: 0;
    padding: 1.5rem 0;
}

.footer-logo {
    height: 16px;
    width: auto;
    opacity: 0.4;
}

.footer-copyright {
    font-size: 0.75rem;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.footer-link:hover {
    color: var(--text-primary);
}

.footer-nav-link {
    font-size: 0.75rem;
}

.bmc-btn {
    font-size: 0.7rem;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
}

/* Cookie banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 1rem;
    background-color: var(--surface-elevated);
    border-top: 1px solid var(--border-subtle);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

/* ========================================
   UPDATE NOTIFICATION BANNER
   ======================================== */

#update-banner {
    position: sticky;
    top: 70px;
    z-index: 1020;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#update-banner .btn-close {
    padding: 0.5rem;
}

[data-bs-theme="dark"] #update-banner {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ========================================
   DRIVER STATS PAGE
   ======================================== */

.driver-stats-page h2.driver-name, .race-results-page h2.display-5 {
    font-size: 1.75rem;
}

.driver-stats-page .card-title {
    font-size: 1rem;
}

.driver-name {
    font-size: 1.5rem !important;
}

.career-stats-text {
    font-size: 1.1rem !important;
}

h3.stat-value {
    font-size: 2rem !important;
    font-weight: 500;
}

@media (max-width: 767.98px) {
    h3.stat-value {
        font-size: 1.5rem !important;
        font-weight: 500;
    }
}

.driver-name-link {
    font-weight: 500;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.form-select {
    font-size: .875rem;
    padding-top: .25rem;
    padding-bottom: .25rem;
    padding-left: .5rem;
}

/* ========================================
   LICENSE PLATES
   ======================================== */

.license-plate {
    display: inline-block;
    padding: 0.2em 0.4em;
    font-size: 0.8em;
    font-weight: bold;
    color: #fff;
    border-radius: 0.2rem;
}

.license-r {
    background-color: #d9534f;
    border: 1px solid #d43f3a;
}

.license-d {
    background-color: #f0ad4e;
    border: 1px solid #eea236;
}

.license-c {
    background-color: #f0e44e;
    border: 1px solid #e5d936;
    color: #333;
    text-shadow: none;
}

.license-b {
    background-color: #5cb85c;
    border: 1px solid #4cae4c;
}

.license-a {
    background-color: #0275d8;
    border: 1px solid #025aa5;
}

.license-pro {
    background: linear-gradient(45deg, #f0e44e, #d9534f, #0275d8);
    border: 1px solid #aaa;
}

.license-p {
    background-color: #111;
    border: 1px solid #000;
}

.license-n {
    background-color: #777;
    border: 1px solid #666;
}

/* ========================================
   TABLES
   ======================================== */

.table tbody tr td {
    vertical-align: middle;
}

/* Race results list-group styling */
/* Race finishing-order list adopts the championship "timing" treatment. */
.race-results-list { font-family: var(--font-mono); }

/* On the bare page (no card), the race list mirrors the leaderboard timing
   table: each row a separated panel with an inset hairline + hover slide. */
.race-results-list .list-group-item:not(.fw-bold) {
    background: var(--surface-elevated) !important;
    box-shadow: inset 0 0 0 1px var(--border-subtle);
    border: 0 !important;
    border-radius: .55rem;
    margin-bottom: 4px;
    padding: 0.6rem 1rem;
    transition: transform .12s ease, box-shadow .12s ease;
}

.race-results-list .list-group-item:not(.fw-bold):hover {
    transform: translateX(3px);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, var(--border-subtle));
}

.race-results-list .list-group-item .row {
    margin-left: 0;
    margin-right: 0;
}

.race-results-list .list-group-item.fw-bold {
    font-family: var(--font-mono);
    font-weight: 600 !important;
    text-transform: uppercase;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    color: var(--text-tertiary);
    background: transparent !important;
    border: 0 !important;
    padding: 0.2rem 1rem 0.4rem !important;
    margin-top: 0 !important;
}

/* Stats by category table */
/* Driver-profile tables adopt the championship "timing" treatment:
   separated rows with an inset hairline, hover slide, mono numerics, and
   condensed-mono uppercase headers. */
.stats-by-category-table {
    margin-bottom: 0 !important;
    border-collapse: collapse !important;
    font-family: var(--font-mono);
}

.stats-by-category-table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    color: var(--text-tertiary);
    border: 0 !important;
    background: transparent !important;
    padding: 0.2rem 1.25rem 0.65rem;
}

.stats-by-category-table tbody tr {
    background: transparent !important;
    border-bottom: 1px solid var(--border-subtle);
    transition: background-color .12s ease;
}
.stats-by-category-table tbody tr:last-child { border-bottom: 0; }

.stats-by-category-table tbody tr:hover {
    background: var(--surface-subtle) !important;
}

.stats-by-category-table tbody td {
    border: 0 !important;
    background: transparent !important;
    padding: 0.7rem 1.25rem;
    vertical-align: middle;
}

.stats-by-category-table tbody td:first-child {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: .01em;
    color: var(--text-primary);
}

/* Splits table */
.splits-table th,
.splits-table td {
    padding: 0.5rem 1rem;
}

.splits-table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--bs-secondary-color);
    border-top: 1px solid var(--bs-border-color);
}

[data-bs-theme="light"] .splits-table thead {
    background-color: #f8f9fa;
}

[data-bs-theme="dark"] .splits-table thead {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="light"] .splits-table tbody tr {
    background-color: #ffffff;
}

[data-bs-theme="dark"] .splits-table tbody tr {
    background-color: var(--bs-card-bg-custom);
}

.splits-expand-row {
    background-color: #ffffff !important;
}

[data-bs-theme="dark"] .splits-expand-row {
    background-color: var(--bs-card-bg-custom) !important;
}

/* Race results table */
.race-results-table th,
.race-results-table td {
    padding: 0.75rem 1rem;
}

.race-results-table thead th {
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--bs-secondary-color);
}

/* Recent Races Table */
/* Recent races + race-result tables share the championship "timing" look. */
.recent-races-table,
.race-results-table {
    margin-bottom: 0 !important;
    border-collapse: collapse !important;
    font-family: var(--font-mono);
}

.recent-races-table thead th,
.race-results-table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    color: var(--text-tertiary);
    border: 0 !important;
    background: transparent !important;
    padding: 0.2rem 1.25rem 0.65rem;
}

.recent-races-table tbody tr,
.race-results-table tbody tr {
    background: transparent !important;
    border-bottom: 1px solid var(--border-subtle);
    transition: background-color .12s ease;
}
.recent-races-table tbody tr:last-child,
.race-results-table tbody tr:last-child { border-bottom: 0; }

.recent-races-table tbody tr:hover,
.race-results-table tbody tr:hover {
    background: var(--surface-subtle) !important;
}

.recent-races-table tbody td,
.race-results-table tbody td {
    border: 0 !important;
    background: transparent !important;
    padding: 0.7rem 1.25rem;
    vertical-align: middle;
}
/* Series-name column in the condensed display face, matching leaderboard names. */
.recent-races-table tbody td:nth-child(2) {
    font-family: var(--font-display); font-weight: 600; font-size: 1.02rem;
}

/* Series/driver name columns read in the condensed display face. */
.recent-races-table tbody td:nth-child(2),
.race-results-table .name-col { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }

/* ========================================
   RACE DETAIL ELEMENTS
   ======================================== */

.race-details-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.race-detail-value {
    font-size: 1.1rem;
    font-weight: 500;
}

.race-series-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.race-track-info {
    font-size: 0.8rem;
}

.race-main-row {
    background-color: rgba(0,0,0,0.02);
}

[data-bs-theme="dark"] .race-main-row {
    background-color: rgba(255,255,255,0.03);
}

.race-main-row td {
    border-bottom: 0 !important;
}

.race-details-row td {
    padding: 0 !important;
}

.race-details-container {
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 1rem;
}

[data-bs-theme="dark"] .race-details-container {
    background-color: transparent;
}

.race-detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.8rem;
}

.race-detail-label {
    font-weight: 600;
    color: var(--bs-secondary-color);
    font-size: 0.7rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

@media (max-width: 767.98px) {
    .stats-by-category-table {
        font-size: 0.8rem;
    }

    .race-track-info {
        font-size: 0.75rem;
    }

    .race-details-grid {
        gap: 0.5rem;
    }

    .race-detail-label {
        font-size: 0.6rem;
    }

    .race-detail-value {
        font-size: 1rem;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .col-md-5-cols {
        flex: 0 0 auto;
        width: 20%;
    }
}

/* ========================================
   STAT ITEMS
   ======================================== */

.stats-container {
    display: flex;
    flex-wrap: wrap;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    text-align: center;
}

.stat-item {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    flex: 0 0 20%;
    max-width: 20%;
}

.desktop-stat-separator {
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    height: 4px;
}

/* ========================================
   LINKS
   ======================================== */

a.text-reset {
    text-decoration: underline;
}

.link-black-underlined {
    color: var(--bs-body-color);
    text-decoration: underline;
    font-weight: 600;
}

.link-black-underlined:hover {
    color: var(--bs-body-color);
    text-decoration: underline;
    font-weight: 600;
}

/* Race results series link */
.race-series-link {
    text-decoration: underline;
}

[data-bs-theme="light"] .race-series-link {
    color: black;
}

[data-bs-theme="dark"] .race-series-link {
    color: white;
}

/* ========================================
   LOGOS
   ======================================== */

.main-logo {
    max-width: 400px;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .main-logo {
        max-width: 330px;
    }
}

.search-results-list {
    min-width: 300px;
    max-width: 600px;
    margin: 0 auto;
}

.famous-driver-item {
    padding: 0.5rem 1rem;
}

.famous-driver-link {
    font-size: 1.1rem;
}

/* ========================================
   ANIMATION
   ======================================== */

.spinner-animation {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   BADGES
   ======================================== */

.verified-badge {
    font-size: 0.8rem !important;
    padding: 0.2rem 0.5rem;
    border-radius: 50px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background-color: var(--accent) !important;
    color: white !important;
    border: 2px solid var(--accent);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.verified-badge i {
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .verified-badge {
        font-size: 0.7rem !important;
        padding: 0.4rem 0.6rem;
    }

    .verified-badge i {
        font-size: 0.8rem;
    }
}

/* ========================================
   TOOLTIPS
   ======================================== */

.tooltip .tooltip-inner {
    font-size: 0.6rem !important;
    max-width: 280px !important;
    line-height: 1.2 !important;
    padding: 0.3rem 0.5rem !important;
}

.tooltip .tooltip-inner a {
    color: #ffeb3b !important;
    text-decoration: underline !important;
}

.tooltip .tooltip-inner a:hover {
    color: #fff59d !important;
}

.tooltip:hover {
    visibility: visible !important;
    opacity: 1 !important;
}

/* ========================================
   CATEGORY TAGS
   ======================================== */

.category-text {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.category-formula-road {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
}

.category-sports-car {
    color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
}

.category-road {
    color: #6c757d;
    background-color: rgba(108, 117, 125, 0.1);
}

.category-oval {
    color: #007bff;
    background-color: rgba(0, 123, 255, 0.1);
}

.category-dirt-oval {
    color: #6f4f28;
    background-color: rgba(111, 79, 40, 0.1);
}

.category-dirt-road {
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

/* ========================================
   STANDINGS TABLE
   ======================================== */

/* Series standings + series recent races (contained in cards) get the same
   clean hairline + mono treatment as the driver-profile tables, matching the
   leaderboard type scale. */
.standings-table,
.contained-data-table {
    font-family: var(--font-mono);
    border-collapse: collapse !important;
    margin-bottom: 0;
}
.standings-table thead th,
.contained-data-table thead th {
    font-weight: 600; text-transform: uppercase;
    font-size: 0.62rem; letter-spacing: 0.14em;
    color: var(--text-tertiary);
    border: 0 !important; background: transparent !important;
    padding: 0.2rem 1rem 0.65rem;
}
.standings-table tbody tr,
.contained-data-table tbody tr {
    background: transparent !important;
    border-bottom: 1px solid var(--border-subtle);
    transition: background-color .12s ease;
}
.standings-table tbody tr:last-child,
.contained-data-table tbody tr:last-child { border-bottom: 0; }
.standings-table tbody tr:hover,
.contained-data-table tbody tr:hover { background: var(--surface-subtle) !important; }
.standings-table tbody td,
.contained-data-table tbody td {
    border: 0 !important; background: transparent !important;
    padding: 0.7rem 1rem; vertical-align: middle;
}
/* Driver/winner name columns read in the condensed display face, like the
   leaderboard driver column. */
.standings-table tbody td:nth-child(2),
.contained-data-table tbody td:nth-child(4) {
    font-family: var(--font-display); font-weight: 600; font-size: 1.02rem;
}

.standings-table .flag-icon {
    width: 1.2em;
    height: 0.9em;
    vertical-align: baseline;
}

@media (max-width: 768px) {
    .standings-table {
        font-size: 0.75rem;
    }

    .standings-table th {
        font-size: 0.65rem;
        padding: 0.5rem 0.25rem;
    }

    .standings-table td {
        padding: 0.5rem 0.25rem;
    }

    .standings-table th:nth-child(8),
    .standings-table td:nth-child(8),
    .standings-table th:nth-child(9),
    .standings-table td:nth-child(9) {
        display: none;
    }
}

/* ============================================================
   CHAMPIONSHIPS & LEADERBOARDS — "Timing Tower" design system
   Motorsport-instrument aesthetic: condensed display type,
   monospaced numerics, podium hierarchy, dense timing rows.
   Cohesive with the global accent + light/dark surface tokens.
   ============================================================ */
:root {
    --font-display: 'Saira Condensed', 'Google Sans', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
    --gold:   #f5c518;
    --silver: #cbd5e1;
    --bronze: #d08b54;
}
[data-bs-theme="dark"] { --silver: #aab4c2; }

/* ---- Hero band ------------------------------------------------ */
.lb-hero {
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
    border: 1px solid var(--border-subtle);
    padding: 2.4rem 1.75rem 2rem;
    margin-bottom: 1.75rem;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(59,130,246,0.16), transparent 55%),
        linear-gradient(180deg, var(--surface-elevated), var(--surface-subtle));
}
.lb-hero::before {  /* diagonal speed lines */
    content: "";
    position: absolute; inset: 0;
    background-image: repeating-linear-gradient(
        -64deg, transparent 0 22px,
        color-mix(in srgb, var(--text-primary) 4%, transparent) 22px 24px);
    -webkit-mask-image: linear-gradient(105deg, #000, transparent 62%);
            mask-image: linear-gradient(105deg, #000, transparent 62%);
    pointer-events: none;
}
.lb-hero::after {  /* checkered flag corner */
    content: "";
    position: absolute; top: 0; right: 0; width: 120px; height: 120px;
    background-image:
        linear-gradient(45deg, color-mix(in srgb, var(--text-primary) 8%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--text-primary) 8%, transparent) 75%),
        linear-gradient(45deg, color-mix(in srgb, var(--text-primary) 8%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--text-primary) 8%, transparent) 75%);
    background-size: 18px 18px;
    background-position: 0 0, 9px 9px;
    -webkit-mask-image: radial-gradient(120px 120px at 100% 0%, #000, transparent 70%);
            mask-image: radial-gradient(120px 120px at 100% 0%, #000, transparent 70%);
    opacity: .6; pointer-events: none;
}
.lb-hero > * { position: relative; z-index: 1; }
.lb-eyebrow {
    font-family: var(--font-mono);
    font-size: .72rem; font-weight: 600; letter-spacing: .22em;
    text-transform: uppercase; color: var(--accent);
    display: inline-flex; align-items: center; gap: .5rem;
}
.lb-title {
    font-family: var(--font-display);
    font-weight: 800; letter-spacing: .005em; line-height: .98;
    text-transform: uppercase;
    font-size: clamp(2rem, 5vw, 3.25rem);
    color: var(--text-primary); margin: .35rem 0 .35rem;
}
.lb-sub { color: var(--text-secondary); max-width: 46rem; margin: 0; }
.lb-hero-logo {
    height: 56px; width: auto; object-fit: contain;
    filter: drop-shadow(0 4px 14px rgba(0,0,0,.25));
}

/* ---- Category chips ------------------------------------------- */
.cat-chip {
    display: inline-flex; align-items: center; gap: .4rem;
    font-family: var(--font-mono);
    font-size: .68rem; font-weight: 600; letter-spacing: .12em;
    text-transform: uppercase;
    padding: .28rem .6rem; border-radius: .4rem;
    border: 1px solid currentColor;
}
.cat-chip[data-cat="oval"]        { color:#3b82f6; }
.cat-chip[data-cat="sports-car"]  { color:#22c55e; }
.cat-chip[data-cat="formula-car"],
.cat-chip[data-cat="formula-road"]{ color:#ef4444; }
.cat-chip[data-cat="dirt-oval"]   { color:#d08b54; }
.cat-chip[data-cat="dirt-road"]   { color:#f59e0b; }
.cat-chip[data-cat="road"]        { color:#94a3b8; }
.cat-chip .dot { width:.5rem; height:.5rem; border-radius:50%; background:currentColor; }

/* ---- Championship index grid --------------------------------- */
.champ-cat-label {
    font-family: var(--font-display);
    text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
    font-size: 1.05rem; color: var(--text-primary);
    display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem;
}
.champ-cat-label::after {
    content: ""; flex: 1; height: 1px;
    background: linear-gradient(90deg, var(--border-subtle), transparent);
}
.champ-card {
    display: flex; align-items: center; gap: .85rem;
    padding: .8rem .9rem; height: 100%;
    border: 1px solid var(--border-subtle); border-radius: .7rem;
    background: var(--surface-elevated); text-decoration: none;
    position: relative; overflow: hidden;
    transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.champ-card::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--accent); transform: scaleY(0); transform-origin: bottom;
    transition: transform .16s ease;
}
.champ-card:hover {
    transform: translateY(-2px); border-color: var(--accent);
    box-shadow: 0 10px 26px -16px rgba(59,130,246,.7);
}
.champ-card:hover::before { transform: scaleY(1); }
.champ-card .series-logo,
.champ-card .series-logo-placeholder {
    width: 34px; height: 34px; object-fit: contain; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.champ-card-name {
    font-weight: 600; color: var(--text-primary); line-height: 1.2;
    display: block;
}
.champ-card-meta {
    font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em;
    text-transform: uppercase; color: var(--text-tertiary);
}
.champ-card .bi-chevron-right { color: var(--text-tertiary); transition: transform .14s ease; }
.champ-card:hover .bi-chevron-right { transform: translateX(3px); color: var(--accent); }

/* ---- Season hub cards ---------------------------------------- */
.season-card {
    display: flex; flex-direction: column; gap: .35rem;
    padding: 1rem 1.1rem; height: 100%;
    border: 1px solid var(--border-subtle); border-radius: .7rem;
    background: var(--surface-elevated); text-decoration: none;
    transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.season-card:hover {
    transform: translateY(-2px); border-color: var(--accent);
    box-shadow: 0 12px 28px -18px rgba(59,130,246,.7);
}
.season-card-year {
    font-family: var(--font-display); font-weight: 800; font-size: 1.7rem;
    line-height: 1; color: var(--text-primary); text-transform: uppercase;
}
.season-card-q {
    font-family: var(--font-mono); font-size: .72rem; font-weight: 600;
    letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
}
.season-card-foot {
    margin-top: auto; padding-top: .6rem;
    color: var(--text-tertiary); font-size: .8rem;
    display: flex; align-items: center; gap: .4rem;
}
.season-card.is-current { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-subtle)); }
.season-live {
    font-family: var(--font-mono); font-size: .62rem; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase;
    color: #22c55e; display: inline-flex; align-items: center; gap: .35rem;
}
.season-live .dot { width:.5rem; height:.5rem; border-radius:50%; background:#22c55e;
    box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: livePulse 1.8s infinite; }
@keyframes livePulse { 70%{ box-shadow:0 0 0 6px rgba(34,197,94,0);} 100%{box-shadow:0 0 0 0 rgba(34,197,94,0);} }

/* ---- Podium (top 3) ------------------------------------------ */
.podium {
    display: grid; grid-template-columns: 1fr 1.18fr 1fr;
    align-items: end; gap: .9rem; margin-bottom: 1.5rem;
}
.podium-card {
    position: relative; border: 1px solid var(--border-subtle);
    border-radius: .85rem; background: var(--surface-elevated);
    padding: 1.1rem 1rem 1rem; text-align: center; overflow: hidden;
    text-decoration: none; display: block;
    transition: transform .15s ease, box-shadow .15s ease;
}
.podium-card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px -20px rgba(0,0,0,.6); }
.podium-card::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
    background: var(--tier, var(--accent));
}
.podium-card[data-pos="1"] { padding-top: 1.4rem; --tier: var(--gold);
    background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--gold) 16%, var(--surface-elevated)), var(--surface-elevated) 70%); }
.podium-card[data-pos="2"] { --tier: var(--silver); }
.podium-card[data-pos="3"] { --tier: var(--bronze); }
.podium-pos {
    font-family: var(--font-display); font-weight: 800; line-height: 1;
    font-size: 2.4rem; color: var(--tier, var(--accent));
}
.podium-card[data-pos="1"] .podium-pos { font-size: 3rem; }
.podium-crown { font-size: 1.1rem; color: var(--gold); margin-bottom: .2rem; }
.podium-leader-tag {
    font-family: var(--font-mono); font-size: .58rem; font-weight: 700;
    letter-spacing: .16em; text-transform: uppercase; color: #22c55e;
    margin-bottom: .15rem;
}
.podium-name {
    font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
    letter-spacing: .01em; font-size: 1.05rem; color: var(--text-primary);
    margin: .5rem 0 .1rem; line-height: 1.05;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.podium-pts {
    font-family: var(--font-mono); font-weight: 700; font-size: 1.5rem;
    color: var(--text-primary); margin-top: .35rem;
}
.podium-pts small { font-size: .6rem; font-weight: 600; letter-spacing: .12em;
    text-transform: uppercase; color: var(--text-tertiary); display: block; margin-top: .1rem; }
.podium-line {
    font-family: var(--font-mono); font-size: .72rem; color: var(--text-secondary);
    margin-top: .55rem; display: flex; justify-content: center; gap: .9rem; flex-wrap: wrap;
}
.podium-line b { color: var(--text-primary); font-weight: 700; }

/* ---- Timing-tower table -------------------------------------- */
.timing {
    width: 100%; border-collapse: separate; border-spacing: 0 4px;
    font-family: var(--font-mono);
}
.timing thead th {
    font-size: .62rem; font-weight: 600; letter-spacing: .14em;
    text-transform: uppercase; color: var(--text-tertiary);
    padding: .2rem .6rem .5rem; text-align: right; white-space: nowrap;
}
.timing thead th.col-driver { text-align: left; }
.timing tbody tr {
    background: var(--surface-elevated);
    box-shadow: inset 0 0 0 1px var(--border-subtle);
    transition: transform .12s ease, box-shadow .12s ease;
}
.timing tbody tr:hover {
    transform: translateX(3px);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, var(--border-subtle));
}
.timing tbody td { padding: .5rem .6rem; text-align: right; vertical-align: middle; white-space: nowrap; }
.timing tbody td:first-child { border-radius: .55rem 0 0 .55rem; }
.timing tbody td:last-child  { border-radius: 0 .55rem .55rem 0; }
.timing .col-pos {
    width: 52px; text-align: center; font-weight: 700; font-size: .95rem;
    color: var(--text-secondary); position: relative;
}
.timing tr[data-tier="1"] .col-pos { color: var(--gold); }
.timing tr[data-tier="2"] .col-pos { color: var(--silver); }
.timing tr[data-tier="3"] .col-pos { color: var(--bronze); }
.timing .col-driver {
    text-align: left; font-family: var(--font-display); font-weight: 600;
    font-size: 1.02rem; letter-spacing: .01em;
}
.timing .col-driver a { color: var(--text-primary); text-decoration: none; }
.timing .col-driver a:hover { color: var(--accent); }
.timing .col-driver .flag-icon { width: 1.1em; height: .8em; margin-left: .45rem; opacity: .9; vertical-align: middle; }
.timing .col-pts { color: var(--text-primary); font-weight: 700; font-size: 1rem; }
.timing .col-gap { color: var(--text-tertiary); font-size: .82rem; }
.timing .col-num { color: var(--text-secondary); }
.timing .col-num.win { color: var(--text-primary); font-weight: 700; }
.timing .ir-badge {
    font-family: var(--font-mono); font-weight: 700; font-size: .8rem;
    color: var(--accent); background: var(--accent-subtle);
    padding: .12rem .45rem; border-radius: .35rem;
}
@media (max-width: 768px) {
    .podium { grid-template-columns: 1fr; }
    .podium-card[data-pos="1"] { order: -1; }
    .timing .hide-sm { display: none; }
    .timing thead th.hide-sm { display: none; }
}

/* ---- Sticky season / class selector bar ---------------------- */
.lb-selectbar {
    display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
    margin-bottom: 1.25rem;
}
.lb-select {
    font-family: var(--font-mono); font-size: .8rem; font-weight: 600;
    letter-spacing: .04em; border-radius: .5rem; border: 1px solid var(--border-subtle);
    background: var(--surface-elevated); color: var(--text-primary);
    padding: .45rem 2rem .45rem .75rem;
}
.classpill {
    font-family: var(--font-mono); font-size: .72rem; font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase;
    padding: .4rem .8rem; border-radius: 999px; text-decoration: none;
    border: 1px solid var(--border-subtle); color: var(--text-secondary);
    background: var(--surface-elevated); transition: all .14s ease;
}
.classpill:hover { border-color: var(--accent); color: var(--accent); }
.classpill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- Breadcrumb --------------------------------------------- */
.lb-crumb {
    font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em;
    text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 1rem;
}
.lb-crumb a { color: var(--text-secondary); text-decoration: none; }
.lb-crumb a:hover { color: var(--accent); }
.lb-crumb .sep { margin: 0 .5rem; opacity: .5; }

/* ============================================================
   SITEWIDE ADOPTION of the timing-tower design language
   (display headings, mono numerics, card hovers, hero bands)
   Defined after the championship system so the font vars exist.
   ============================================================ */

/* --- Display type on headings & page titles --- */
h1, .h1, h2, .h2, h3, .h3,
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6,
.driver-name, .page-title, .card-title, .series-category-label {
    font-family: var(--font-display);
    letter-spacing: .004em;
}
/* Condensed faces read better a touch heavier */
h1, .h1, h2, .h2, .display-4, .display-5, .display-6,
.driver-name, .page-title { font-weight: 700; }

/* --- Mono, tabular numerics for stats --- */
.stat-value, h3.stat-value, .career-stats-text, .stat-num, .mono,
.metric-value, .big-number {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* --- Section labels match the championship eyebrow --- */
.section-label, .series-category-label {
    font-family: var(--font-mono);
    letter-spacing: .14em;
    text-transform: uppercase;
}

/* --- Universal card: subtle life on hover --- */
.card { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
a.card, .card-hover, .hover-lift { cursor: pointer; }
a.card:hover, .card-hover:hover, .hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px -20px rgba(0,0,0,.55);
    border-color: var(--accent) !important;
}

/* --- Reusable page hero (alias of the championship hero) --- */
.page-hero {
    position: relative; overflow: hidden;
    border-radius: 1rem; border: 1px solid var(--border-subtle);
    padding: 2rem 1.75rem; margin-bottom: 1.5rem;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(59,130,246,0.14), transparent 55%),
        linear-gradient(180deg, var(--surface-elevated), var(--surface-subtle));
}
.page-hero::before {
    content: ""; position: absolute; inset: 0;
    background-image: repeating-linear-gradient(-64deg, transparent 0 22px,
        color-mix(in srgb, var(--text-primary) 4%, transparent) 22px 24px);
    -webkit-mask-image: linear-gradient(105deg, #000, transparent 62%);
            mask-image: linear-gradient(105deg, #000, transparent 62%);
    pointer-events: none;
}
.page-hero > * { position: relative; z-index: 1; }

/* --- Stat tiles (driver profile / series / team) get the instrument feel --- */
.stat-card, .stat-item {
    transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.stat-card:hover, .stat-item:hover { transform: translateY(-2px); }

/* --- Race results header stat strip (timing-tower chips) --- */
.race-stat-strip { display: flex; flex-wrap: wrap; gap: .5rem; }
.race-stat {
    font-family: var(--font-mono); font-size: .76rem;
    padding: .32rem .65rem; border-radius: .45rem;
    border: 1px solid var(--border-subtle); background: var(--surface-subtle);
    color: var(--text-secondary);
}
.race-stat b {
    color: var(--text-tertiary); font-weight: 600; font-size: .62rem;
    letter-spacing: .1em; text-transform: uppercase; margin-right: .35rem;
}

/* --- Driver profile name reads bigger inside the hero band --- */
.page-hero .driver-name {
    font-size: clamp(1.6rem, 4vw, 2.4rem) !important;
    text-transform: uppercase; line-height: 1;
}

/* --- Loading indicators: mono "telemetry" label + accent spinner --- */
#loading-spinner p,
#race-results-content p.loading-label,
.lb-loading-text {
    font-family: var(--font-mono) !important;
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: .72rem;
    color: var(--text-tertiary) !important;
    margin-top: 1rem !important;
}
#loading-spinner .spinner-border,
.lb-loading .spinner-border {
    color: var(--accent);
    width: 2.2rem; height: 2.2rem; border-width: .2em;
}

/* --- Mobile: tighten the timing-style driver tables so they fit ~360px --- */
@media (max-width: 575.98px) {
    .stats-by-category-table,
    .recent-races-table {
        border-spacing: 0 3px;
        font-size: .82rem;
    }
    .stats-by-category-table thead th,
    .recent-races-table thead th { padding: .15rem .55rem .4rem; font-size: .56rem; letter-spacing: .1em; }
    .stats-by-category-table tbody td,
    .recent-races-table tbody td { padding: .5rem .55rem; }
    .stats-by-category-table tbody td:first-child { font-size: .9rem; }
    .recent-races-table tbody td:nth-child(2) { font-size: .88rem; }
    /* keep the Results button compact */
    .recent-races-table .btn-sm { --bs-btn-padding-x: .5rem; --bs-btn-padding-y: .25rem; font-size: .72rem; }
}

/* --- Ad slots: reserve space (no CLS), subtle "Advertisement" label, on-brand --- */
.ad-slot {
    display: block;
    margin: 1.5rem auto;
    max-width: 100%;
    min-height: 100px;              /* reserve space so lazy fill doesn't shift layout */
    padding: .5rem;
    border: 1px solid var(--border-subtle);
    border-radius: .6rem;
    background: var(--surface-subtle);
    text-align: center;
    overflow: hidden;
}
.ad-slot-label {
    display: block;
    font-family: var(--font-mono);
    font-size: .58rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: .35rem;
}
.ad-slot-ins { display: block; width: 100%; min-height: 90px; }
.ad-slot--sidebar { min-height: 250px; }
.ad-slot--leaderboard { min-height: 90px; }
