/* ── VARIABLES ── */
:root {
    --bg:        #0b0e14;
    --surface:   #13161f;
    --surface2:  #1a1e2c;
    --surface3:  #202436;
    --accent:    #f5c842;
    --accent-dim:#8a6f10;
    --gold:      #f5c842;
    --silver:    #b0b8cc;
    --bronze:    #d4824a;
    --ladies:    #e878a8;
    --ladies-bg: rgba(232,120,168,0.10);
    --ladies-bd: rgba(232,120,168,0.22);
    --mens:      #5bc8f5;
    --mens-bg:   rgba(91,200,245,0.10);
    --mens-bd:   rgba(91,200,245,0.22);
    --text:      #eef0f8;
    --muted:     #6b7190;
    --border:    #252840;
    --hover:     #181c2a;
    --radius:    10px;
}

/* ── RESET ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Barlow', sans-serif;
    font-size: 14px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── INDEX PAGE: ANIMATED BACKGROUND ── */
.bg-lines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-lines::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -10%;
    width: 140%;
    height: 140%;
    background: repeating-linear-gradient(
        -18deg,
        transparent,
        transparent 80px,
        rgba(245,200,66,0.022) 80px,
        rgba(245,200,66,0.022) 81px
    );
    animation: drift 22s linear infinite;
}

@keyframes drift {
    from { transform: translateX(0); }
    to   { transform: translateX(81px); }
}

.bg-glow {
    position: fixed;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(245,200,66,0.055) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ── HEADER: INDEX (fixed, frosted) ── */
header.fixed {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: rgba(11,14,20,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 40px;
    justify-content: space-between;
}

/* ── HEADER: INNER PAGES (sticky, solid) ── */
header.sticky {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* ── LOGO ── */
.logo {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 28px;
    background: var(--accent);
    border-radius: 2px;
}

.logo-sub {
    color: var(--muted);
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 1px;
    margin-left: 4px;
}

/* ── NAV ── */
nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 7px 16px;
    border-radius: 8px;
    transition: color 0.18s, background 0.18s;
}

nav a:hover {
    color: var(--text);
    background: var(--surface2);
}

nav a.active {
    color: var(--accent);
    background: rgba(245,200,66,0.08);
}

/* ── LIVE DOT ── */
.last-updated {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ── MAIN CONTENT WRAPPER (inner pages) ── */
main {
    max-width: 1160px;
    margin: 0 auto;
    padding: 36px 24px 60px;
}

/* ── PAGE HEADING (inner pages) ── */
.page-hero {
    margin-bottom: 36px;
}

.page-hero-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 56px;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    line-height: 1;
    color: var(--text);
}

.page-hero-title span { color: var(--accent); }

.page-hero-sub {
    color: var(--muted);
    font-weight: 300;
    font-size: 14px;
    margin-top: 6px;
    letter-spacing: 0.5px;
}

/* ── STAT CARDS ── */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 2px 0 0 2px;
}

.stat-card:nth-child(2)::after { background: var(--mens); }
.stat-card:nth-child(3)::after { background: var(--ladies); }

.stat-num {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 36px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.stat-lbl {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 500;
}

/* ── FILTER CONTROLS ── */
.controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.ctrl-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 140px;
}

.ctrl-group label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
}

.ctrl-group select,
.ctrl-group input[type="text"] {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 9px 14px;
    border-radius: 8px;
    font-family: 'Barlow', sans-serif;
    font-size: 14px;
    transition: border-color 0.2s, background 0.2s;
    width: 100%;
}

.ctrl-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7190' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

.ctrl-group select:focus,
.ctrl-group input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface2);
}

.ctrl-group select:hover,
.ctrl-group input[type="text"]:hover {
    border-color: var(--muted);
}

.search-wrap { position: relative; }
.search-wrap input { padding-left: 36px; }

.search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    font-size: 15px;
}

/* ── GENDER TABS (standings) ── */
.gender-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    width: fit-content;
}

.gender-tab {
    padding: 8px 20px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--muted);
    transition: all 0.18s;
    letter-spacing: 0.3px;
}

.gender-tab.active-all    { background: var(--surface3); color: var(--text); }
.gender-tab.active-ladies { background: var(--ladies-bg); color: var(--ladies); border: 1px solid var(--ladies-bd); }
.gender-tab.active-mens   { background: var(--mens-bg); color: var(--mens); border: 1px solid var(--mens-bd); }

/* ── TABLE ── */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.table-header-bar {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface2);
}

.result-count {
    font-size: 12px;
    color: var(--muted);
}

.result-count strong {
    color: var(--text);
    font-weight: 600;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
}

thead th:hover { color: var(--text); }
thead th.sorted { color: var(--accent); }

.sort-arrow {
    margin-left: 4px;
    opacity: 0.4;
    font-size: 10px;
}

thead th.sorted .sort-arrow { opacity: 1; }

tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--hover); }

/* ── TABLE STATES ── */
.state-row td {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    margin-bottom: 14px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-icon { font-size: 32px; margin-bottom: 10px; display: block; }
.error-msg  { color: #f87171; }

/* ── STANDINGS: RANK CELL ── */
.rank-cell {
    width: 48px;
    text-align: center;
}

.rank-num {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--muted);
}

.medal { font-size: 20px; line-height: 1; }

tbody tr.rank-1 { background: rgba(245,200,66,0.04); }
tbody tr.rank-2 { background: rgba(176,184,204,0.03); }
tbody tr.rank-3 { background: rgba(212,130,74,0.03); }

/* ── STANDINGS: RUNNER NAME ── */
.runner-first { font-weight: 600; color: var(--text); }
.runner-last  { color: var(--muted); font-weight: 300; }

/* ── STANDINGS: DIVISION BADGE ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-ladies { background: var(--ladies-bg); color: var(--ladies); border: 1px solid var(--ladies-bd); }
.badge-mens   { background: var(--mens-bg);   color: var(--mens);   border: 1px solid var(--mens-bd); }

.badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}

/* ── STANDINGS: SCORE ── */
.score {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}

.score-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-bar {
    flex: 1;
    height: 4px;
    background: var(--surface3);
    border-radius: 2px;
    overflow: hidden;
    min-width: 40px;
    max-width: 80px;
}

.score-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.4s ease;
    opacity: 0.6;
}

.avg-val { color: var(--muted); font-weight: 300; }
.num-val { font-weight: 500; }

/* ── EVENTS: EVENT NAME ── */
.event-name {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

/* ── EVENTS: DISTANCE BADGE ── */
.dist-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
    white-space: nowrap;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 13px;
}

.dist-5k    { background: rgba(91,200,245,0.12);  color: var(--mens);   border: 1px solid rgba(91,200,245,0.25); }
.dist-10k   { background: rgba(245,200,66,0.12);  color: var(--accent); border: 1px solid rgba(245,200,66,0.25); }
.dist-half  { background: rgba(232,120,168,0.12); color: var(--ladies); border: 1px solid rgba(232,120,168,0.25); }
.dist-full  { background: rgba(160,120,255,0.12); color: #a078ff;       border: 1px solid rgba(160,120,255,0.25); }
.dist-other { background: rgba(107,113,144,0.15); color: var(--muted);  border: 1px solid var(--border); }

/* ── EVENTS: DATE ── */
.date-val {
    color: var(--text);
    font-weight: 400;
    white-space: nowrap;
}

.date-year {
    color: var(--muted);
    font-weight: 300;
    font-size: 12px;
    margin-left: 4px;
}

/* ── EVENTS: RUNNERS BAR ── */
.runners-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.runners-num {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    min-width: 28px;
}

.runners-bar {
    flex: 1;
    height: 4px;
    background: var(--surface3);
    border-radius: 2px;
    overflow: hidden;
    min-width: 40px;
    max-width: 80px;
}

.runners-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    opacity: 0.55;
}

/* ── INDEX: HERO ── */
.hero {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 100px 40px 60px;
    max-width: 1160px;
    margin: 0 auto;
}

.hero-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    animation: fadeUp 0.6s ease forwards 0.1s;
}

.hero-eyebrow::before {
    content: '';
    display: inline-block;
    width: 28px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

.hero-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: clamp(72px, 12vw, 140px);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    line-height: 0.9;
    color: var(--text);
    margin-bottom: 8px;
    opacity: 0;
    animation: fadeUp 0.7s ease forwards 0.2s;
}

.hero-title .accent { color: var(--accent); }

.hero-title-line2 {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: clamp(72px, 12vw, 140px);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    line-height: 0.9;
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(238,240,248,0.2);
    margin-bottom: 36px;
    opacity: 0;
    animation: fadeUp 0.7s ease forwards 0.3s;
}

.hero-desc {
    font-size: 16px;
    font-weight: 300;
    color: var(--muted);
    max-width: 480px;
    line-height: 1.7;
    margin-bottom: 48px;
    opacity: 0;
    animation: fadeUp 0.7s ease forwards 0.4s;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── INDEX: NAV CARDS ── */
.nav-cards {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    opacity: 0;
    animation: fadeUp 0.7s ease forwards 0.55s;
}

.nav-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 28px;
    text-decoration: none;
    width: 220px;
    transition: transform 0.22s ease, border-color 0.22s, background 0.22s;
    position: relative;
    overflow: hidden;
}

.nav-card::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: var(--card-accent, var(--accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.nav-card:hover {
    transform: translateY(-4px);
    border-color: var(--card-accent, var(--accent));
    background: var(--surface2);
}

.nav-card:hover::before { transform: scaleX(1); }

.nav-card.events   { --card-accent: var(--mens); }
.nav-card.standings { --card-accent: var(--accent); }

.card-icon  { font-size: 28px; line-height: 1; }
.card-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text);
}

.card-desc  { font-size: 12px; font-weight: 300; color: var(--muted); line-height: 1.5; }

.card-arrow {
    margin-top: auto;
    font-size: 18px;
    color: var(--card-accent, var(--accent));
    transition: transform 0.2s;
}

.nav-card:hover .card-arrow { transform: translateX(5px); }

/* ── INDEX: STATS STRIP ── */
.stats-strip {
    position: relative;
    z-index: 1;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 36px 40px;
}

.stats-strip-inner {
    max-width: 1160px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.strip-stat {
    padding: 0 32px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.strip-stat:first-child { padding-left: 0; }
.strip-stat:last-child  { border-right: none; }

.strip-num {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 42px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.strip-lbl {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--muted);
}

/* ── INDEX: FEATURES SECTION ── */
.features {
    position: relative;
    z-index: 1;
    max-width: 1160px;
    margin: 0 auto;
    padding: 80px 40px;
}

.section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-label::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 2px;
    background: var(--accent);
}

.section-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 42px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: 48px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.2s, background 0.2s;
}

.feature-card:hover {
    border-color: rgba(245,200,66,0.3);
    background: var(--surface2);
}

.feature-icon  { font-size: 26px; line-height: 1; }

.feature-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text);
}

.feature-text {
    font-size: 13px;
    font-weight: 300;
    color: var(--muted);
    line-height: 1.65;
}

/* ── FOOTER ── */
footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    padding: 28px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-logo {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
}

.footer-links { display: flex; gap: 24px; }

.footer-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.18s;
}

.footer-links a:hover { color: var(--accent); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    header.fixed  { padding: 0 20px; }
    header.sticky { padding: 0 20px; }

    /* Index hero */
    .hero { padding: 90px 20px 48px; }
    .nav-cards { flex-direction: column; gap: 12px; }
    .nav-card  { width: 100%; max-width: 340px; }

    /* Stats strip */
    .stats-strip { padding: 28px 20px; }
    .stats-strip-inner { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .strip-stat { border-right: none; padding: 0; }
    .strip-stat:nth-child(odd) { border-right: 1px solid var(--border); padding-right: 20px; }

    /* Features */
    .features { padding: 48px 20px; }
    .feature-grid { grid-template-columns: 1fr; }

    /* Footer */
    footer { flex-direction: column; gap: 16px; text-align: center; padding: 24px 20px; }

    /* Inner pages */
    .page-hero-title { font-size: 38px; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
    .stat-cards .stat-card:last-child { grid-column: 1 / -1; }
    thead th, tbody td { padding: 10px; }
    .score-bar  { display: none; }
    .runners-bar { display: none; }
    .date-year  { display: none; }
}
