/* when-to-race.css: the /when-to-race page on the site redesign layer (v2.css section 15, .sl-page).
   Design: StintLabs-research feature-demos/site-redesign/when-to-race (mockup.html, notes.md); the rank cells are #724.
   Only page rules here, all under .wtr-page; the cards, bar, tables, chips and rail come from section 15. */
.wtr-page {
    /* the Busy / Clean racers / Grid size ramp: one hue in OKLab from the theme's background to its accent */
    --wtr-lo: color-mix(in oklab, var(--bg-2) 88%, var(--accent)); --wtr-mid: color-mix(in oklab, var(--accent) 48%, var(--bg-2));
    --wtr-hi: color-mix(in oklab, var(--accent-soft, var(--accent)) 70%, var(--text-hi));
    --wtr-ink: #14161b;   /* digit ink on the rank fills: the fills are fixed hex in every theme, so the ink is too */
}
/* the rank fills of cells, tiles and swatches stay light in Daylight too, so the dark digit keeps AA */
.wtr-page :is(.wtr-cell, .wtr-tile, .wtr-sw)[data-rank="Bronze"] { --wtr-fill: #cd8a4e; }
.wtr-page :is(.wtr-cell, .wtr-tile, .wtr-sw)[data-rank="Silver"] { --wtr-fill: #c3cbd6; }
.wtr-page :is(.wtr-cell, .wtr-tile, .wtr-sw)[data-rank="Gold"] { --wtr-fill: #e6b93d; }
.wtr-page :is(.wtr-cell, .wtr-tile, .wtr-sw)[data-rank="Platinum"] { --wtr-fill: #7fd4e6; }
.wtr-page :is(button, a, select, summary):focus-visible { outline: none; box-shadow: var(--lmu-focus); }
.wtr-page #wtrBody.is-loading { opacity: .55; }
@media (prefers-reduced-motion: no-preference) { .wtr-page #wtrBody.is-loading { transition: opacity .15s; } .wtr-page .wtr-cell { transition: box-shadow .12s ease; } }

/* headings inside an eyebrow keep the eyebrow's look */
.wtr-page .wtr-eh { margin: 0; padding: 0; border: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }

/* the filter bar: native selects in the .sel look; under 760 it folds to a summary line plus Filters (v2 .fold-sum) */
.wtr-page .bar select.sel { appearance: auto; max-width: 300px; cursor: pointer; }
.wtr-page .bar select.sel::after { content: none; }
@media (max-width: 760px) {
    .wtr-page .bar.wtr-open .fold { display: flex; }
    .wtr-page .bar.wtr-open :is(select.sel, .seg) { width: 100%; max-width: none; }
    .wtr-page .bar.wtr-open .seg > * { flex: 1; }
    .wtr-page .bar.wtr-open .end { margin-left: 0; }
}

/* the answer */
.wtr-page .answer.is-empty h2 { color: var(--text-3); }
.wtr-page .answer p .rk { vertical-align: 1px; }

/* scope line and legend under the heat card's eyebrow */
.wtr-scope { margin: -2px 0 8px; font-size: 13px; color: var(--text-2); }
.wtr-scope a { font-weight: 650; }
.wtr-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 10px; font-size: 12px; color: var(--text-2); }
.wtr-sw { display: inline-flex; align-items: center; gap: 6px; }
.wtr-sw i, .wtr-tile { display: inline-grid; place-items: center; background: var(--wtr-fill, var(--line-3)); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .10); color: var(--wtr-ink); font: 700 11px/1 var(--font-ui); font-style: normal; font-variant-numeric: tabular-nums; }
.wtr-sw i { width: 18px; height: 18px; border-radius: 3px; }
.wtr-ramp { display: inline-block; width: 120px; height: 10px; border-radius: 3px; background: linear-gradient(90deg in oklab, var(--wtr-lo), var(--wtr-mid), var(--wtr-hi)); box-shadow: inset 0 0 0 1px var(--v2-line); }
.wtr-muted, .wtr-hint { color: var(--text-3); }

/* the heat grid: 24 columns that take the main column's width; a cell keeps a 1.7 : 1 shape between 26 and 60 px tall */
.wtr-heat { display: grid; grid-template-columns: 44px repeat(24, minmax(0, 1fr)); gap: 3px; }
.wtr-hh { height: 18px; display: flex; align-items: flex-end; font: 600 12px var(--font-ui); color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wtr-hh.sub { visibility: hidden; }
.wtr-dl { display: flex; align-items: center; font: 650 13px var(--font-display); color: var(--text-2); }
.wtr-page .wtr-cell { position: relative; display: block; width: 100%; height: auto; aspect-ratio: 1.7; min-height: 26px; max-height: 60px; margin: 0; padding: 0; border: 0; border-radius: 4px; background: var(--bg-2); box-shadow: none; transform: none; cursor: pointer; container-type: inline-size; overflow: hidden; }
.wtr-page .wtr-cell.is-empty { box-shadow: inset 0 0 0 1px var(--line-2); cursor: default; }
.wtr-page .wtr-cell.is-thin { opacity: .42; }
.wtr-page .wtr-cell.is-rank { background: var(--wtr-fill); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .10); }
.wtr-tier { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 13px/1 var(--font-ui); color: var(--wtr-ink); pointer-events: none; font-variant-numeric: tabular-nums; }
.wtr-page .wtr-cell.is-rank::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: var(--p, 0%); background: rgb(0 0 0 / .32); }
@container (min-width: 64px) { .wtr-tier { font-size: 15px; } }
@container (max-width: 27px) { .wtr-tier { font-size: 10px; } }
@container (max-width: 15px) { .wtr-tier { display: none; } .wtr-page .wtr-cell.is-rank::after { display: none; } }
/* the percent to the next tier beside the digit (#986): side by side in a wide cell, stacked under it in a narrow one, gone
 * below 22 px (the phone grid), where the hour's readout still says it ("Silver 2 · 45% to Silver 3") */
.wtr-tier { gap: 3px; }
.wtr-pct { font-size: .7em; font-weight: 650; }
@container (max-width: 43px) { .wtr-tier { flex-direction: column; gap: 1px; } .wtr-tier .wtr-pct { font-size: 9px; } }
@container (max-width: 27px) { .wtr-tier .wtr-pct { font-size: 8px; } }
@container (max-width: 21px) { .wtr-tier .wtr-pct { display: none; } }
.wtr-page .wtr-cell:hover, .wtr-page .wtr-cell:focus-visible { box-shadow: inset 0 0 0 2px var(--text-hi); z-index: 1; outline: none; }
.wtr-page .wtr-cell.is-rank:hover, .wtr-page .wtr-cell.is-rank:focus-visible { box-shadow: inset 0 0 0 2px var(--wtr-ink), 0 0 0 2px var(--text-hi); }
.wtr-page .wtr-cell[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--text-hi), 0 0 0 2px var(--accent); z-index: 1; }
.wtr-page .wtr-cell.is-rank[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--wtr-ink), 0 0 0 2px var(--accent); }
.wtr-readout { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 28px; margin: 10px 0 0; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.wtr-readout b { color: var(--text-hi); font-weight: 650; }
.wtr-page .wtr-missing p { margin: 0; }

/* best hours list (the rail card, and the phone view inside the heat card): a rank tile ties it to the grid */
.wtr-best { list-style: none; margin: 0; padding: 0; }
.wtr-best li { border-top: 1px solid var(--v2-line); }
.wtr-best li:first-child { border-top: 0; }
.wtr-page .wtr-best button { display: grid; grid-template-columns: 16px 36px minmax(0, 1fr); gap: 2px 10px; align-items: center; width: 100%; min-height: 0; margin: 0; padding: 7px 0; border: 0; background: none; box-shadow: none; transform: none; text-align: left; color: inherit; font: inherit; border-radius: var(--r-md); cursor: pointer; }
.wtr-page .wtr-best button.no-tile { grid-template-columns: 16px minmax(0, 1fr); }
.wtr-page .wtr-best button:hover .wtr-when { color: var(--accent-soft); }
.wtr-page .wtr-best button[aria-pressed="true"] { background: var(--v2-wash); margin: 0 -8px; padding-inline: 8px; width: calc(100% + 16px); }
.wtr-pos { grid-row: 1 / 3; color: var(--text-3); font: 600 12px var(--font-display); font-variant-numeric: tabular-nums; }
.wtr-tile { width: 36px; height: 36px; border-radius: 6px; font-size: 16px; grid-row: 1 / 3; position: relative; overflow: hidden; }
.wtr-tile:has(.wtr-pct) { font-size: 14px; place-content: center; gap: 1px; }
.wtr-tile .wtr-pct { font-size: 10px; }
.wtr-tile::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p, 0%); background: rgb(0 0 0 / .32); }
.wtr-when { font: 650 14px/1.25 var(--font-display); color: var(--text-hi); }
.wtr-facts { display: flex; flex-wrap: wrap; gap: 3px 8px; align-items: center; font-size: 12px; color: var(--text-3); }
.wtr-best .no-tile .wtr-when, .wtr-best .no-tile .wtr-facts { grid-column: 2; }
.wtr-best button:not(.no-tile) .wtr-when, .wtr-best button:not(.no-tile) .wtr-facts { grid-column: 3; }
.wtr-facts b { color: var(--text-hi); font-weight: 650; }
/* phone: the best five lead, the grid opens under a button; the rail's copy of the list hides */
.wtr-phone-best, .wtr-toggle { display: none; }
@media (max-width: 760px) {
    .wtr-page .wtr-phone-best, .wtr-page .wtr-toggle { display: block; }
    .wtr-toggle { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--v2-line); }
    .wtr-page .wtr-railbest { display: none; }
    .wtr-heatwrap { display: none; }
    .show-week .wtr-heatwrap { display: block; margin-top: 8px; }
    .wtr-page .show-week .wtr-phone-best { display: none; }
    .wtr-heat { grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 2px; }
    .wtr-hh.q { visibility: hidden; }
    .wtr-dl { font-size: 12px; }
    .wtr-page .wtr-cell { aspect-ratio: auto; height: 26px; min-height: 0; border-radius: 2px; }
}

/* More: a details holding an .sl-grid, open by default from 1800 (when-to-race.js) */
.wtr-more > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 8px 2px; font: 650 13px var(--font-ui); color: var(--text-2); }
.wtr-more > summary::-webkit-details-marker { display: none; }
.wtr-more > summary::before { content: "\25B8"; font-size: 11px; color: var(--text-3); }
.wtr-more[open] > summary::before { content: "\25BE"; }
.wtr-more > summary small { font-weight: 400; color: var(--text-3); }
.wtr-plain p { margin: 0 0 8px; font-size: 13px; color: var(--text-2); max-width: var(--sl-prose); }
.wtr-plain p:last-child { margin-bottom: 0; }
.wtr-row { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; margin: 0 0 8px; }
.wtr-ctl { display: grid; gap: 4px; min-width: 0; max-width: 100%; font: 700 var(--fs-micro) var(--font-display); letter-spacing: var(--caps); text-transform: uppercase; color: var(--text-3); }
.wtr-ctl select.sel { appearance: auto; max-width: 100%; text-transform: none; letter-spacing: 0; }
.wtr-ctl select.sel::after { content: none; }
.wtr-linkish { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.wtr-page .wtr-name { min-height: 0; margin: 0; padding: 0; border: 0; background: none; box-shadow: none; transform: none; color: var(--text-hi); font: inherit; font-weight: 650; text-align: left; cursor: pointer; }
.wtr-page .wtr-name:hover { color: var(--accent-soft); text-decoration: underline; text-underline-offset: 3px; }
.wtr-page .foot-note .btn { min-height: 0; padding: 0; color: var(--accent-soft); }

/* rail cards: Drivers by day bars (gray quietest, bright busiest, both named in the note), series health chips, sign in */
.wtr-days .hbar { grid-template-columns: 40px minmax(0, 1fr) 54px; }
.wtr-days .hbar i { background: var(--accent); opacity: .85; }
.wtr-days .hbar.quiet i { background: var(--text-4); opacity: 1; }
.wtr-days .hbar.busy i { background: var(--accent-soft); opacity: 1; }
.wtr-chips { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12px; color: var(--text-2); margin: 10px 0 0; }
.wtr-signin p { margin: 0 0 10px; font-size: 13px; color: var(--text-2); }
.wtr-signin .btn { align-self: flex-start; }
.wtr-mini { font-size: 12px; color: var(--text-3); margin: 8px 0 0; }
