/* ==========================================================================
   Live event styles — only loaded on days an event is actually running.
   Covers: the LIVE hero slide, the stat bar above the standings, and the
   auto-refresh "updated" stamp / row flash.
   ========================================================================== */

:root {
    --nwds-live: #ff2d2d;
}

/* --------------------------------------------------------------------------
   1. LIVE hero slide
   -------------------------------------------------------------------------- */

.nwds-live-pretitle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.nwds-live-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--nwds-live);
    box-shadow: 0 0 0 0 rgba(255, 45, 45, 0.7);
    animation: nwds-pulse 1.8s infinite;
    flex: 0 0 auto;
}

@keyframes nwds-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 45, 45, 0.7); }
    70%  { box-shadow: 0 0 0 12px rgba(255, 45, 45, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 45, 45, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .nwds-live-dot { animation: none; }
}

.nwds-live-location {
    display: block;
    margin-top: 10px;
    margin-bottom: 22px;
    font-size: 18px;
    letter-spacing: 0.04em;
    color: #ffffff;
    opacity: 0.85;
}

.nwds-live-location i {
    color: var(--theme-color);
    margin-right: 8px;
}

/* --------------------------------------------------------------------------
   2. Stat bar
   -------------------------------------------------------------------------- */

/* The header is sticky — keep the section title clear of it when the hero's
   "Live Results" button jumps down here. */
#nwds-live-standings {
    scroll-margin-top: 170px;
}

.nwds-live-bar {
    background: linear-gradient(135deg, #0b1220 0%, #14243d 100%);
    border: 1px solid rgba(1, 186, 248, 0.25);
    border-radius: 6px;
    padding: 26px 30px;
    margin-bottom: 45px;
}

.nwds-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 22px;
}

.nwds-stat {
    flex: 1 1 130px;
    min-width: 120px;
}

.nwds-stat-value {
    display: block;
    font-size: 34px;
    line-height: 1.1;
    font-weight: 700;
    color: #ffffff;
}

.nwds-stat-label {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8fa3bd;
}

/* Top HP of the day gets the emphasis — it's the number people came for. */
.nwds-stat-top {
    flex: 2 1 280px;
    min-width: 240px;
    padding-left: 24px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

/*
 * main.css carries a blanket `h1, h2, h3, h4, h5, h6, span, a { color: #111 }`.
 * That is an element-level rule, and an element rule always beats inheritance —
 * so every bare <span> nested in here has to state its own colour or it renders
 * near-black. Anything added below must do the same.
 */
.nwds-stat-top .nwds-stat-value {
    font-size: 40px;
}

/* Both the wrapper and the inner number, so the blanket rule can't reach it. */
.nwds-stat-top .nwds-stat-value,
.nwds-stat-top .nwds-stat-value .nwds-top-hp-value {
    color: #ffffff;
}

.nwds-stat-top .nwds-stat-value small {
    font-size: 18px;
    font-weight: 600;
    margin-left: 4px;
    color: #8fa3bd;
}

.nwds-top-name {
    display: block;
    margin-top: 6px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
}

.nwds-top-class {
    display: block;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8fa3bd;
}

@media (max-width: 767px) {
    .nwds-live-bar { padding: 22px 20px; }
    .nwds-stats { gap: 16px; }
    /* Keep the three counts on one row, then Top HP full-width beneath. */
    .nwds-stat {
        flex: 1 1 0;
        min-width: 0;
        padding-right: 0;
    }
    .nwds-stat-value { font-size: 24px; }
    .nwds-stat-label { font-size: 11px; letter-spacing: 0.08em; }
    .nwds-stat-top {
        flex: 1 1 100%;
        min-width: 0;
        padding-left: 0;
        padding-top: 18px;
        border-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }
    .nwds-stat-top .nwds-stat-value { font-size: 34px; }
}

/* --------------------------------------------------------------------------
   3. Class grid
   Bootstrap's row/col forces every card in a row to the tallest card's height,
   so a class with one entry reserved as much space as one with sixteen — the
   grid was mostly dead air. Multi-column layout packs the cards vertically
   instead, with no gaps. Reading order becomes column-major, which is fine:
   the cards are independent and the chips below give direct access anyway.
   -------------------------------------------------------------------------- */

.nwds-standings-grid {
    column-count: 3;
    column-gap: 24px;
}

.nwds-class-card {
    /* Keep a card whole rather than splitting a table across a column break. */
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    /* Safari needs a block-level wrapper to honour break-inside reliably. */
    display: inline-block;
    width: 100%;
    margin-bottom: 24px;
    /* Clear the sticky navbar and the chips bar. Both heights are measured at
       runtime by live-standings.js; the chips one is 0 where they're hidden. */
    scroll-margin-top: calc(var(--nwds-nav-h, 108px) + var(--nwds-chips-h, 0px) + 12px);
}

@media (max-width: 991px) {
    .nwds-standings-grid { column-count: 2; column-gap: 18px; }
    .nwds-class-card { margin-bottom: 18px; }
}

@media (max-width: 767px) {
    .nwds-standings-grid { column-count: 1; }
}

/* --------------------------------------------------------------------------
   4. Jump-to-class chips
   -------------------------------------------------------------------------- */

.nwds-chips {
    /* Wide screens show every class at once — nothing to jump to. */
    display: none;
    position: sticky;
    top: var(--nwds-nav-h, 108px);
    z-index: 20;
    margin-bottom: 20px;
    padding: 10px 0;
    background: #ffffff;
    border-bottom: 1px solid rgba(11, 18, 32, 0.12);
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.nwds-chips::-webkit-scrollbar { display: none; }

@media (max-width: 991px) {
    .nwds-chips { display: block; }
}

.nwds-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-right: 8px;
    padding: 7px 14px;
    border: 1px solid rgba(11, 18, 32, 0.18);
    border-radius: 999px;
    background: #0b1220;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    /* Explicit — main.css paints every bare <a> and <span> #111. */
    color: #ffffff;
    text-decoration: none;
}

.nwds-chip:last-child { margin-right: 0; }

.nwds-chip:hover,
.nwds-chip:focus {
    color: #ffffff;
    border-color: var(--theme-color, #01baf8);
}

.nwds-chip-n {
    color: #8fa3bd;
    font-size: 11px;
    font-weight: 700;
}

.nwds-chip:hover .nwds-chip-n,
.nwds-chip:focus .nwds-chip-n {
    color: var(--theme-color, #01baf8);
}

/* --------------------------------------------------------------------------
   5. Latest Runs
   Every span below states its own colour — see the note above about main.css's
   blanket `h1..h6, span, a { color: #111 }`.
   -------------------------------------------------------------------------- */

.nwds-runs {
    margin-bottom: 45px;
}

.nwds-runs-title {
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #5b6b7f;
    margin-bottom: 14px;
}

.nwds-runs-list {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: none;
}

.nwds-run {
    flex: 1 1 240px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #0b1220 0%, #14243d 100%);
    border: 1px solid rgba(1, 186, 248, 0.25);
    border-radius: 6px;
}

/* Newest run leads — give it the accent edge. */
.nwds-run:first-child {
    border-left: 3px solid var(--theme-color, #01baf8);
}

.nwds-run-hp {
    flex: 0 0 auto;
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
}

.nwds-run-unit {
    font-size: 12px;
    font-weight: 600;
    margin-left: 3px;
    color: #8fa3bd;
}

.nwds-run-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.nwds-run-who {
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nwds-run-meta {
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8fa3bd;
}

@media (max-width: 767px) {
    .nwds-runs-list { gap: 10px; }
    .nwds-run { flex: 1 1 100%; padding: 12px 14px; }
    .nwds-run-hp { font-size: 22px; }
}

/* --------------------------------------------------------------------------
   6. Updated stamp + refreshed-row flash
   -------------------------------------------------------------------------- */

.nwds-updated {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-size: 13px;
    letter-spacing: 0.06em;
    /* Sits on the light section background, not the dark bar — needs to be dark
       enough to actually read (#8fa3bd here was ~2.4:1 against white). */
    color: #5b6b7f;
}

/* Bare spans: state the colour or main.css's blanket rule turns them near-black. */
.nwds-updated .nwds-updated-time {
    color: inherit;
    font-weight: 600;
}

.nwds-updated .nwds-updated-note {
    color: inherit;
    font-weight: 400;
}

.nwds-updated .nwds-live-dot {
    width: 8px;
    height: 8px;
    background-color: #3ddc84;
    box-shadow: none;
    animation: none;
}

/* Polling failed — stop implying the number is fresh. */
.nwds-updated[data-state="stale"] { color: #a86a12; }
.nwds-updated[data-state="stale"] .nwds-live-dot { background-color: #d08b2c; }

.nwds-flash {
    animation: nwds-flash 2.2s ease-out 1;
}

@keyframes nwds-flash {
    0%   { background-color: rgba(1, 186, 248, 0.45); }
    100% { background-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .nwds-flash { animation: none; }
}
