/* The distance board.
 *
 * The set, the brandbar and the footer come from style.css and lobby.css - this
 * page wears the lobby's clothes on purpose, because it is a wall in the same
 * showground rather than a separate document. Only the board's own furniture is
 * here.
 *
 * A BOARD IS A TABLE AND IT IS BUILT AS ONE. Rank, rider, distance and show are
 * four columns of related data with a header row, which is what <table> is for;
 * a grid of divs would read to a screen reader as a pile of text and would lose
 * the column headers that make a rank column mean anything.
 */

.boardwrap { max-width: 920px; margin: 0 auto; padding: 1.5rem 16px 3rem; position: relative; z-index: 1; }
.board h1 { font-size: clamp(2rem, 6vw, 3rem); text-wrap: balance; }
.board .lede { color: var(--text-dim); max-width: 56ch; margin: 0 0 1.6rem; }

/* ── The two modes ───────────────────────────────────────────────────────────
 * Heavier than the window pills below them, because this is the bigger split:
 * which game you are looking at, not which slice of it. An underline rather
 * than a second row of pills, so the two controls cannot be mistaken for each
 * other.
 */
.modes { display: flex; gap: 1.4rem; margin: 0 0 1.4rem; border-bottom: 1px solid var(--card-line); }
.mode {
    font: inherit;
    font-family: 'Alfa Slab One', Georgia, serif;
    font-size: 1.05rem;
    color: var(--text-dim);
    background: none; border: 0;
    border-bottom: 3px solid transparent;
    padding: 0.5rem 0.1rem 0.6rem;
    margin-bottom: -1px;
    cursor: pointer;
}
.mode:hover { color: var(--text); }
.mode.is-on { color: var(--corn); border-bottom-color: var(--corn); }

/* ── The three windows ───────────────────────────────────────────────────── */
.windows { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.6rem; }
.win {
    font: inherit; font-weight: 600;
    color: var(--text-dim);
    background: var(--card);
    border: 1px solid var(--card-line);
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    cursor: pointer;
}
.win:hover { color: var(--text); border-color: var(--dust); }
.win.is-on {
    color: var(--asphalt);
    background: var(--corn);
    border-color: var(--corn);
}
.winnote { color: var(--text-dim); font-size: 0.92rem; margin: 0 0 1.2rem; }

/* ── The board itself ────────────────────────────────────────────────────── */
.boardbox {
    background: var(--card);
    border: 1px solid var(--card-line);
    border-radius: var(--radius);
    /* The table can outgrow a phone; it scrolls in here rather than pushing the
     * page sideways. */
    overflow-x: auto;
}
.state { padding: 2rem 1.2rem; margin: 0; color: var(--text-dim); text-align: center; }

.rows { width: 100%; border-collapse: collapse; min-width: 480px; }
.rows th {
    text-align: left;
    font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--dust); font-weight: 600;
    padding: 0.9rem 0.8rem;
    border-bottom: 1px solid var(--card-line);
    white-space: nowrap;
}
.rows td {
    padding: 0.8rem;
    border-bottom: 1px solid rgba(201, 168, 124, 0.14);
    vertical-align: middle;
}
.rows tr:last-child td { border-bottom: 0; }
.rows tbody tr:hover { background: rgba(242, 226, 196, 0.04); }

.c-rank { width: 3.2rem; font-family: 'Alfa Slab One', Georgia, serif; color: var(--dust); }
/* Digits in a rank and a distance column have to line up, or the eye cannot
 * compare them down the page - which is the only thing a board is for. */
.c-rank, .c-far { font-variant-numeric: tabular-nums; }
.c-far { text-align: right; font-weight: 700; white-space: nowrap; }
/* The header has to sit over its own column edge. Left-aligned above
 * right-aligned figures reads as a misplaced heading, not as a style. */
.rows th.c-far { text-align: right; }
.c-show { color: var(--text-dim); white-space: nowrap; }

/* A member's face from the game center (GDD s11.7). The slot exists only on a
 * board where somebody has one; see faceSlot() in leaderboard.js. Square with a
 * soft corner, not a circle: the hub's faces are pixel art drawn to the edge of
 * the frame, and a circle crops the hair off them. */
.c-who .face {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; margin-right: 0.55rem;
    vertical-align: middle; overflow: hidden;
    border-radius: 6px;
    border: 1px solid var(--card-line);
    background: rgba(242, 226, 196, 0.06);
}
.c-who .face img { width: 100%; height: 100%; display: block; object-fit: cover; }
/* No picture: the rider's initial, quiet enough not to read as a broken one. */
.c-who .face.none {
    font-family: 'Alfa Slab One', Georgia, serif; font-size: 0.8rem; line-height: 1;
    color: var(--dust);
}
.rows tr.top .c-who .face { border-color: rgba(242, 226, 196, 0.45); }
.c-who .nm { font-weight: 600; }
.c-who .cc { margin-left: 0.45rem; }
.c-who .clan {
    margin-left: 0.45rem; font-size: 0.72rem; font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--sky);
    border: 1px solid rgba(95, 168, 160, 0.4);
    border-radius: 4px; padding: 0.05rem 0.3rem;
}

/* The top three, by weight and colour only. Gold, chrome and canyon red read as
 * a podium without a podium graphic, which on a board this short would be most
 * of the page. */
.rows tr.top .c-rank { color: var(--corn); font-size: 1.15rem; }
.rows tr.top1 .c-rank { color: var(--corn); }
.rows tr.top2 .c-rank { color: var(--chrome); }
.rows tr.top3 .c-rank { color: var(--tangerine); }
.rows tr.top .c-who .nm { color: var(--cream); }

/* ── Nobody yet ──────────────────────────────────────────────────────────── */
.nobody {
    background: var(--card);
    border: 1px solid var(--card-line);
    border-radius: var(--radius);
    padding: 2.2rem 1.4rem;
    text-align: center;
}
.nobody h2 { margin-bottom: 0.8rem; }
.nobody p { color: var(--text-dim); max-width: 48ch; margin: 0 auto 0.8rem; }
.nobody .first { color: var(--corn); font-weight: 600; }
.nobody .btn { margin-top: 0.8rem; }

/* ── Where they ride ─────────────────────────────────────────────────────── */
.nations { margin-top: 2.4rem; }
.nations .sub { color: var(--text-dim); margin: 0 0 1rem; }
.natlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.natlist li {
    display: grid;
    grid-template-columns: 1.8rem 1fr auto auto;
    align-items: center;
    gap: 0.8rem;
    background: var(--card);
    border: 1px solid var(--card-line);
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
}
.natlist .nm { font-weight: 600; letter-spacing: 0.04em; }
.natlist .sc { font-weight: 700; font-variant-numeric: tabular-nums; }
.natlist .rd { color: var(--text-dim); font-size: 0.85rem; white-space: nowrap; }

.backrow { margin-top: 2.4rem; }

@media (max-width: 560px) {
    .natlist li { grid-template-columns: 1.6rem 1fr auto; }
    .natlist .rd { grid-column: 2 / -1; }
}
