/* Race floor view (optional, inside a race's start list). Link after rc-results.css.
   Uses the page's theme variables: --primary-color, --text-body, --cat1..--cat10. */

.rc-floor { --rc-floor-bg: #fafafa; margin: 0 0 .75rem; border: 1px solid rgba(0,0,0,.12); border-radius: .5rem; background: var(--rc-floor-bg); }
.rc-floor-sum {
  cursor: pointer; list-style: none; padding: .6rem .8rem; font-weight: 600;
  display: flex; align-items: center; gap: .5rem; min-height: 44px; box-sizing: border-box;
}
.rc-floor-sum::-webkit-details-marker { display: none; }
.rc-floor-sum::after { content: '\25BE'; margin-left: auto; transition: transform .15s ease; }
.rc-floor[open] .rc-floor-sum::after { transform: rotate(180deg); }
.rc-floor-sys { font-weight: 400; opacity: .7; font-size: .9em; }

/* Machines are finger-sized (40px minimum). When the floor is wider than the screen, only the
   .rc-floor-scroll box scrolls sideways - the card, its title and the page stay where they are. */
.rc-floor-map { padding: 0 .6rem .4rem; }

.rc-floor-scroll {
  overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain;              /* a sideways swipe doesn't drag the page */
  -webkit-overflow-scrolling: touch;
  scroll-padding: 0 1rem;
  padding: 4px 2px 6px;                        /* room for the selected / search outline */
  /* soft shadows at whichever edge has more to scroll to */
  background:
    linear-gradient(to right, var(--rc-floor-bg, #fafafa) 30%, transparent) left / 24px 100% no-repeat local,
    linear-gradient(to left,  var(--rc-floor-bg, #fafafa) 30%, transparent) right / 24px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.18), transparent) left / 10px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.18), transparent) right / 10px 100% no-repeat scroll;
}
.rc-floor-scroll:focus-visible { outline: 2px solid var(--text-body, #111); outline-offset: 2px; }

/* at least 40px a machine; fills the width when there's room, up to ~48px, centred */
.rc-floor-grid {
  display: grid; gap: 4px;
  width: max(100%, calc(var(--cols) * 44px));
  max-width: calc(var(--cols) * 52px);
  margin: 0 auto;
}
.rc-floor-frontline {
  width: max(100%, calc(var(--cols) * 44px));
  max-width: calc(var(--cols) * 52px);
  margin: 6px auto 0; border-top: 2px solid currentColor; opacity: .75;
}

.rc-floor-tile {
  aspect-ratio: 1; min-width: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 6px;
  background: var(--primary-color, #35619c); color: #fff;
  font-family: inherit; font-weight: 700; line-height: 1; font-size: 15px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.rc-floor-tile.rc-floor-empty { background: transparent; color: rgba(0,0,0,.35); box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
/* keyboard focus: thin dashed ring. Mouse/touch focus never shows a ring (site or browser styles could otherwise
   leave one on the previously tapped machine, which looks like the wrong one is selected). */
.rc-floor-tile:focus { outline: none; }
.rc-floor-tile:focus-visible { outline: 2px dashed var(--text-body, #111); outline-offset: 2px; }
/* the machine tapped: solid ring, and every other machine on this floor fades back
   (rc-results.js adds .rc-floor-picked to the floor while a machine is picked).
   Was a 1.08x "grow", which was hard to spot on a full floor. */
.rc-floor-tile { transition: opacity .15s ease; }
.rc-floor-picked .rc-floor-tile:not(.rc-floor-sel) { opacity: .3; }
.rc-floor-tile.rc-floor-sel { outline: 3px solid var(--text-body, #111); outline-offset: 2px; position: relative; z-index: 2;
  opacity: 1; box-shadow: 0 2px 6px rgba(0,0,0,.35); }

/* the person searched for */
.rc-floor-tile.rc-hit { outline: 3px solid #f59e0b; outline-offset: 1px; position: relative; z-index: 1; }

.rc-floor-back, .rc-floor-front { text-align: center; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; opacity: .6; padding: .25rem 0; }
.rc-floor-front { opacity: .75; }

.rc-floor-info { margin: 0; padding: .5rem .8rem .7rem; font-size: .9rem; min-height: 1.5em; }

.lane-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 12px;
    padding: .6em .8em;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}

.lane-num {
    font-family: inherit;
    font-size: 1.6rem;
    font-weight: 800;
    color: #888;
    min-width: 32px;
    text-align: center;
    line-height: 1;
}

.lane-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 3px;
    min-width: 0;
    font-family: inherit;
}

.lane-name, .lane-empty {
    font-size: 0.95rem;
    font-weight: 700;
}

.lane-team {
    font-size: 0.8rem;
    color: #777;
}

.lane-cats {
    font-size: 0.7rem;
    color: #6b6b6b;   /* #999 was too faint on the light card */
}
/* Dark mode. Before, this relied on sitestyle.css, which removed the scroll-edge shadows
   (background: none) and left the selected-machine ring in --text-body, which is usually
   dark and so almost invisible on the dark card. */
@media (prefers-color-scheme: dark) {
  .rc-floor { --rc-floor-bg: #242427; border-color: rgba(255,255,255,.12); }
  .rc-floor-scroll {
    background:
      linear-gradient(to right, var(--rc-floor-bg) 30%, transparent) left / 24px 100% no-repeat local,
      linear-gradient(to left,  var(--rc-floor-bg) 30%, transparent) right / 24px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.6), transparent) left / 10px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.6), transparent) right / 10px 100% no-repeat scroll;
  }
  .rc-floor-scroll:focus-visible,
  .rc-floor-tile:focus-visible,
  .rc-floor-tile.rc-floor-sel { outline-color: #eeeeee; }
  .rc-floor-tile.rc-floor-sel { box-shadow: 0 2px 8px rgba(0,0,0,.7); }
  .rc-floor-tile.rc-floor-empty { color: #8a8a93; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
  .lane-num { color: #eeeeee; }
  .lane-team { color: #b9b9c0; }
  .lane-cats { color: #9a9aa3; }
}

/* =====================================================================
   Tapped machine: one card holding who's on it AND their live numbers.
   Before, the details (.lane-info.card) were the same colour as the floor
   panel in dark mode (#242427 on #242427), so the card barely showed, and
   the live numbers sat in a separate line underneath it.
   ===================================================================== */
.rc-floor-card {
    --rc-card-bg: #ffffff;
    --rc-card-line: rgba(0,0,0,.14);
    margin: 0 .6rem .7rem;
}
/* only looks like a card once a machine is tapped (the hint text stays plain) */
.rc-floor-card:has(.lane-info, .rc-floor-live:not([hidden])) {
    background: var(--rc-card-bg);
    border: 1px solid var(--rc-card-line);
    border-left: 4px solid var(--rc-accent, var(--primary-color, #35619c));
    border-radius: 3px;   /* same squarer corners as the race cards and tags */
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.06);
    overflow: hidden;
}
.rc-floor-card .rc-floor-info { padding: .5rem .2rem; }
.rc-floor-card:has(.lane-info) .rc-floor-info { padding: 0; }

/* the inner details lose their own card look – the wrapper is the card now
   (!important beats sitestyle's dark-mode .card rules) */
.rc-floor-card .lane-info,
.rc-floor-card .lane-info.card {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0;
    margin: 0;
}

@media (prefers-color-scheme: dark) {
    .rc-floor-card {
        --rc-card-bg: #30313b;               /* clearly lighter than the #242427 floor panel */
        --rc-card-line: rgba(255,255,255,.22);
    }
    .rc-floor-card:has(.lane-info, .rc-floor-live:not([hidden])) {
        box-shadow: 0 2px 10px rgba(0,0,0,.55);
    }
    .rc-floor-card .lane-name { color: #ffffff; }
    .rc-floor-card .lane-team { color: #c8cad2; }
    .rc-floor-card .lane-cats { color: #b4b6c0; }
}


/* =====================================================================
   LIVE RACE DATA (was rc-live.css, which the page never loaded).
   Kept here because rc-floor.css is already linked on the timetable page.
   ===================================================================== */
/* rc-live.css – live race data on the start list (add to the site's stylesheet). */

/* Live columns only show once that race has had live data. */
.rc-item:not(.rc-has-live) .rc-live-col { display: none; }

/* Live numbers line up neatly as they change */
[data-live] { font-variant-numeric: tabular-nums; }

/* Stroke rate on its own small line under the pace: "1:44.3" / "32 spm" */
.rc-live-sub { display: block; font-size: .8em; opacity: .75; }
[data-live="spm"]:not(:empty)::after { content: " spm"; }

/* A lane that has finished a distance race: its time replaces the distance */
.rc-finished [data-live="dist"] { font-weight: 700; }

/* Race floor: a small position badge in the corner of each machine while racing */
.rc-has-live .rc-floor-tile { position: relative; }
.rc-has-live .rc-floor-tile[data-live-pos]::after {
    content: attr(data-live-pos);
    position: absolute; top: -6px; right: -6px;
    min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
    font-size: 11px; line-height: 18px; text-align: center; font-weight: 700;
    background: #fff; color: #111; box-shadow: 0 0 0 1px rgba(0,0,0,.25);
    pointer-events: none;
}
.rc-has-live .rc-floor-tile.rc-finished::after { background: #111; color: #fff; }

/* Race floor: the tapped machine's live numbers – the bottom band of the same card as
   "who's on it", tinted in the live green so it reads as live data at a glance */
.rc-floor-live {
    margin: 0; padding: .5rem .8rem;
    font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums;
    background: var(--rc-live-fade, rgba(30,142,62,.10));
    border-top: 1px solid var(--rc-live, #1E8E3E);
    color: inherit;
}
.rc-floor-live[hidden] { display: none; }
/* if the script writes each number in its own element, they space out as separate readings */
.rc-floor-live > * { margin-right: .9rem; white-space: nowrap; }
.rc-floor-live .rc-fl-pos { font-weight: 800; }
.rc-floor-live .rc-fl-spm { font-weight: 600; opacity: .8; }

/* ---------- start list: live columns stand out ---------- */
/* position always bold */
[data-live="pos"] { font-weight: 800; }

/* distance / pace / rate cells get the live green tint (the header too, in green) */
.rc-sheet td.rc-live-col { background: var(--rc-live-fade, rgba(30,142,62,.10)); font-weight: 600; }
.rc-sheet th.rc-live-col { color: var(--rc-live, #1E8E3E); }
/* the tinted cells join into one green band down the table, with a hairline between rows */
.rc-sheet td.rc-live-col { border-bottom-color: rgba(30,142,62,.18); }

@media (prefers-color-scheme: dark) {
    .rc-sheet td.rc-live-col { background: rgba(91,209,126,.16); color: #ffffff; border-bottom-color: rgba(91,209,126,.22); }
    .rc-floor-live { background: rgba(91,209,126,.16); }
}


/* ---------- race clock on a live race's bar (added by rc-racestate.js) ---------- */
.rc-live-clock {
    display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 3px;
    min-width: 3.2em; text-align: center; white-space: nowrap; vertical-align: 1px;
    font-weight: 700; font-size: .95em; line-height: 1.2; font-variant-numeric: tabular-nums;
    border: 1px solid var(--rc-live, #1E8E3E); color: var(--rc-live, #1E8E3E);
}
/* steady digits: each one sits in a slot as wide as a "0" (the script wraps them), and the box is
   wide enough for "00:00", so nothing shifts as the clock ticks */
.rc-live-clock { min-width: 4.6ch; }
.rc-live-clock .rc-cd { display: inline-block; width: 1ch; text-align: center; }
.rc-live-clock .rc-cs { display: inline-block; padding: 0 .05em; }
/* race over: frozen on the final time, in plain text colour */
.rc-live-clock.rc-clock-stopped { border-color: var(--rc-muted, #5F6670); color: var(--rc-text, inherit); }

/* "ON THE RACE FLOOR" tag: same roomier padding as the clock (transparent border so both are the same height) */
.rc-live-tag { padding: 3px 9px; border: 1px solid transparent; }

/* ---------- phones: live race bar uses the right-hand side ----------
   "ON THE RACE FLOOR" on the right of the first line, the clock under it on the right of the
   second line (beside system · distance). Name and system line take the rest and shorten with … */
@media (max-width: 767.98px) {
    .rc-race { padding-right: 8px; column-gap: 6px; }
    .rc-race .rc-txt:has(> .rc-live-tag, > .rc-live-clock) {
        display: grid; grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 8px; row-gap: 3px; align-items: center;
    }
    .rc-race .rc-txt:has(> .rc-live-tag, > .rc-live-clock) > * { grid-column: 1; min-width: 0; }
    .rc-race .rc-txt > .rc-name-inline { grid-row: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .rc-race .rc-txt > .rc-meta { grid-row: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .rc-race .rc-txt > .rc-live-tag   { grid-column: 2; grid-row: 1; justify-self: end; margin-left: 0; }
    .rc-race .rc-txt > .rc-live-clock { grid-column: 2; grid-row: 2; justify-self: end; margin-left: 0; }
    /* a little tighter so both fit comfortably beside the name */
    .rc-race .rc-live-tag { padding: 2px 7px; }
    .rc-race .rc-live-clock { padding: 1px 7px; }
}

/* ---------- start list on phones while a race is live (_DrawData.cshtml) ----------
   Category column and club line hidden; category shown under the name instead; long names shorten
   with …; distance and pace get the right-hand side. Not live, or tablet/desktop: unchanged. */
.rc-draw .rc-livecat { display: none; }
@media (max-width: 767.98px) {
    .rc-has-live .rc-draw { table-layout: fixed; }
    /* widths include the padding, so the competitor column gets everything that's left */
    .rc-has-live .rc-draw th { box-sizing: border-box; }
    .rc-has-live .rc-draw th:nth-child(1) { width: 36px; }
    .rc-has-live .rc-draw th:nth-child(2) { width: 44px; }
    .rc-has-live .rc-draw th.rc-live-col.rc-r { width: 66px; }
    .rc-has-live .rc-draw th.rc-cat-h,
    .rc-has-live .rc-draw td.rc-cat,
    .rc-has-live .rc-draw td.rc-comp .rc-meta.rc-phone { display: none; }

    .rc-has-live .rc-draw td.rc-comp { overflow: hidden; }
    .rc-has-live .rc-draw .rc-cname { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .rc-has-live .rc-draw .rc-livecat {
        display: block; margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--rc-muted);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .rc-has-live .rc-draw .rc-livesub { font-weight: 400; }

    /* position and lane centred, position a little larger */
    .rc-has-live .rc-draw th:nth-child(-n+2),
    .rc-has-live .rc-draw td:nth-child(-n+2) { text-align: center; padding-left: 4px; padding-right: 4px; }
    .rc-has-live .rc-draw td:first-child [data-live="pos"] { font-size: 1.15rem; }
    .rc-has-live .rc-draw td.rc-live-col { white-space: nowrap; }
}

/* ---------- open live race: bar and table headings stay put while you scroll ----------
   The race bar pins under the day heading; the start list's heading row pins under the bar.
   Only while the race is on the floor or showing live numbers, and only for that race's card -
   once you scroll past the card they move on with it. Heights are measured by rc-racestate.js. */
.rc-item.rc-live > .rc-bar-btn[aria-expanded="true"],
.rc-item.rc-has-live > .rc-bar-btn[aria-expanded="true"] {
    position: sticky; z-index: 4;
    top: calc(var(--rc-head-h, 0px) + var(--rc-day-h, 0px) - 1px);
}
.rc-item.rc-live .rc-draw thead th,
.rc-item.rc-has-live .rc-draw thead th {
    position: sticky; z-index: 3;
    top: calc(var(--rc-head-h, 0px) + var(--rc-day-h, 0px) + var(--rc-bar-h, 0px) - 1px);
    background: var(--rc-bg);
    box-shadow: inset 0 -1px 0 var(--rc-accent);   /* keeps the heading's underline while it's pinned */
}

/* a lane that has finished: its rate reads 0, so don't show it under the pace */
.rc-finished [data-live="spm"] { display: none; }

/* =====================================================================
   LIGHT MODE tuning (dark mode is untouched)
   ===================================================================== */
@media (prefers-color-scheme: light) {
    /* race floor panel: a soft grey so it reads as its own area and the white card stands out */
    .rc-floor { --rc-floor-bg: #eaedf1; border-color: #d9dee4; }
    /* position badges on the machines: dark, so they show on light tiles and on faded machines */
    .rc-has-live .rc-floor-tile[data-live-pos]::after { background: #1d2433; color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.8); }
    .rc-has-live .rc-floor-tile.rc-finished::after { background: #1E8E3E; }
    /* lane number in the competitor card: stronger */
    .rc-floor-card .lane-num { color: #3b4250; }
    /* live columns and the card's live band: a touch more green */
    .rc-sheet td.rc-live-col, .rc-floor-live { background: rgba(30,142,62,.13); }
}
