/* ============================================================
   Home: a stack of bordered cards (the challenge, the member's last
   drive, passport and league season), one muted stats line, then what is
   on. Every colour is a theme token so a brand's accent carries through.
   ============================================================ */

/* A photo hero with no photo behind it (a member page with no ranked lap):
   the dark surface, no gradient to darken. Not the home page's, but it
   has always lived here. */
.photo-hero.is-plain { min-height: 220px; background: var(--surface); }
.photo-hero.is-plain::after { display: none; }
@media (max-width: 640px) {
  .photo-hero.is-plain .photo-hero-in { padding-top: 40px; }
}

/* ---------- the cards ---------- */
.home-cards { display: flex; flex-direction: column; gap: 16px; }
.home-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 32px 40px;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
}
.home-card.is-challenge { min-height: 250px; justify-content: flex-end; padding-block: 36px; }
.home-card.is-rail { border-left: 4px solid var(--accent); }
.home-card.is-passport { flex-direction: row; align-items: center; gap: 32px; }

/* The track photo across the whole card, sharp (no filter), under a dark
   wash a little lighter than the photo heroes' so the track reads: dark on
   the left where the text sits, lighter in the middle, dark again on the
   right for the side block. A card whose track has no photo has no layer
   at all and stays the plain surface. Every other child of the card sits
   above it. */
.home-card-photo, .home-card-photo > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.home-card-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--bg) 92%, transparent) 0%,
    color-mix(in srgb, var(--bg) 64%, transparent) 42%,
    color-mix(in srgb, var(--bg) 40%, transparent) 68%,
    color-mix(in srgb, var(--bg) 86%, transparent) 100%);
}
.home-card > :not(.home-card-photo) { position: relative; }

.home-card-top { position: relative; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.home-card-main { position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.home-card.is-challenge .home-card-main { gap: 10px; }
.home-card-side { position: relative; flex: none; text-align: right; }

.home-kicker {
  margin: 0;
  font-family: var(--font-text);
  font-style: normal;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.home-pill {
  align-self: flex-start;
  padding: 4px 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
a.home-pill:hover { background: var(--accent-hover); }

.home-title {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 44px;
  line-height: 1;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.home-title.is-xl { font-size: 54px; }
.home-title a:hover { color: var(--accent); }
.home-sub { margin: 0; font-size: 16px; line-height: 1.4; color: var(--ink-muted); }
.home-sub.is-lg { font-size: 17px; }
.home-sub b { font-weight: 500; color: var(--ink); }
.home-sub a:hover { color: var(--accent); }

/* Big numbers: a lap time, a position. */
.home-big {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 56px;
  line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--ink);
  white-space: nowrap;
}
.home-card.is-challenge .home-big { font-size: 64px; }
.home-big.is-fastest { color: var(--fastest); }
.home-big.is-word { font-size: 40px; }
.home-big-of { font-size: 22px; color: var(--ink-muted); }
.home-big-note { font-family: var(--font-text); font-weight: 600; font-size: 16px; vertical-align: middle; }
.home-last-pb { color: var(--pb); }
.home-side-line { margin: 4px 0 0; font-size: 15px; color: var(--ink); }
.home-side-line a:hover { color: var(--accent); }
.is-muted { color: var(--ink-muted); }
.home-side-line.is-muted { color: var(--ink-muted); }
.home-side-line.is-danger { color: var(--danger); }
.home-side-line.is-accent, .home-side-line .is-accent { color: var(--accent); }
.home-join { max-width: 22rem; margin-left: auto; }
.home-join a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- last drive: the sector tiles ---------- */
.home-sectors { display: grid; grid-template-columns: repeat(var(--sectors, 3), minmax(0, 1fr)); gap: 12px; }
.home-sectors.is-empty { grid-template-columns: minmax(0, 1fr); }
.home-sector { min-width: 0; padding: 12px 16px; background: var(--surface-2); border: 1px solid var(--edge); }
.home-sector-k { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); }
.home-sector-v { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1.2; color: var(--ink); }
.home-sector-n { font-size: 13px; color: var(--ink-muted); }
.home-sector.is-worst { background: var(--danger-soft); border-color: var(--danger); }
.home-sector.is-worst .home-sector-k, .home-sector.is-worst .home-sector-v { color: var(--danger); }
.home-sector.is-worst .home-sector-n { color: var(--ink); }
.home-sector.is-quiet { margin: 0; font-size: 15px; color: var(--ink-muted); }

/* The first-lap card's three steps, in the sector tiles' style. */
.home-steps { margin: 0; padding: 0; list-style: none; }
.home-step-title { font-weight: 600; font-size: 15px; color: var(--ink); }
.home-first-time { font-family: var(--font-display); font-weight: 700; font-size: 1.35em; font-variant-numeric: tabular-nums; color: var(--fastest); }
.home-card-side .home-side-line b { font-weight: 600; }

/* A visitor's "Top of the board": the challenge's top five beside the
   newest records. */
.home-board { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 32px; }
.home-board-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.home-board .home-table td.is-fastest { color: var(--fastest); }
.home-board .home-table th:nth-child(2), .home-board .home-table td:nth-child(2) { width: auto; }
.home-board-link { margin-top: 4px; font-size: 14px; }
.home-records { display: grid; gap: 0; }
.home-records li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 9px 0; border-bottom: 1px solid var(--surface-2); }
.home-record-what { font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.home-record-time { font-size: 18px; color: var(--ink); text-align: right; }
.home-record-who { grid-column: 1 / -1; font-size: 13px; color: var(--ink-muted); }

/* The sign-up card's stamp tile, beside its text. */
.home-pitch-stamp { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-stamps.is-one { grid-template-columns: 120px; }

/* The card's buttons: the accent one and an outlined one, square. */
.home-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.home-btn { margin-left: 0; padding: 10px 16px; font-size: 15px; border-radius: 0; box-shadow: none; }
.home-btn.is-outline { background: transparent; border-color: var(--edge-strong); color: var(--ink); }
.home-btn.is-outline:hover { border-color: var(--ink-faint); }
.home-last-thumb { flex: none; display: block; width: 96px; aspect-ratio: 16 / 9; background: var(--bg); overflow: hidden; }
.home-last-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.home-last-thumb:hover { outline: 1px solid var(--accent); }

/* ---------- passport ---------- */
.is-passport .home-card-main { gap: 10px; }
.is-passport .home-sub a { color: var(--ink); }
.home-progress { width: 100%; max-width: 520px; height: 6px; background: var(--edge); }
.home-progress span { display: block; height: 100%; background: var(--accent); }
.home-passport-btn { align-self: flex-start; margin-top: 6px; }
/* The group's stamps as the passport page's own tiles (passport.css
   .pp-tile), cut down to icon and name in a row: three across, two on a
   phone. The next one to chase gets a dashed accent border. */
.home-stamps { flex: none; display: grid; grid-template-columns: repeat(3, 120px); gap: 8px; }
.home-stamp { min-width: 0; }
.home-stamps div.pp-tile { flex-direction: row; align-items: center; gap: 8px; height: 56px; padding: 0 10px; }
.home-stamps .pp-tile-icon { flex: none; font-size: 1.2rem; }
.home-stamps .pp-tile-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.9rem;
  overflow-wrap: normal;
}
.home-stamp.is-next .pp-tile { border: 1px dashed var(--accent); opacity: 1; }
.home-stamp.is-next .pp-tile-name { color: var(--ink); }
.home-stamp.is-next .stamp-icon-unearned { filter: none; opacity: 1; }
/* The passport page dims a locked tile as a whole; over a card photo that
   would let the photo through, so here the tile stays solid and only its
   contents dim, which looks the same on the plain surface. */
.home-stamps .pp-tile.is-open { opacity: 1; }
.home-stamps .pp-tile.is-open > * { opacity: 0.78; }
.home-stamp.is-next .pp-tile.is-open > * { opacity: 1; }

/* ---------- league series: three rows of the table ---------- */
.home-table { position: relative; width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.home-table th {
  padding: 6px 0;
  border-bottom: 1px solid var(--edge);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-muted);
}
.home-table td { padding: 8px 0; border-bottom: 1px solid var(--surface-2); }
.home-table .is-num { text-align: right; }
.home-table th:first-child, .home-table td:first-child { width: 64px; padding-left: 8px; }
.home-table th:last-child, .home-table td:last-child { padding-right: 8px; }
.home-table tr.is-you td { background: var(--surface-2); font-weight: 600; border-bottom-color: transparent; }
.home-table tr.is-you .home-table-pos { color: var(--accent); }
.home-table a:hover { color: var(--accent); }

/* ---------- partner rail: one sideways row of tiles ----------
   Videos (16:9) then products (square), the row scrolling and snapping on
   its own; the arrows are only a mouse convenience. Tiles share one width
   so the 16:9 and square images line up along the top. */
.home-card.is-partner { gap: 16px; }
.home-rail-arrows:not([hidden]) { flex: none; display: flex; gap: 8px; }
.home-rail-arrow {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--edge-strong);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.home-rail-arrow:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.home-rail-arrow:disabled { opacity: 0.35; cursor: default; }
.home-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 240px;
  gap: 16px;
  margin: 0 -40px;
  padding: 0 40px 6px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 40px;
  scrollbar-width: thin;
  scrollbar-color: var(--edge-strong) transparent;
}
.home-rail-tile { min-width: 0; scroll-snap-align: start; }
.home-rail-tile a { display: flex; flex-direction: column; gap: 8px; color: var(--ink); }
.home-rail-media { display: block; overflow: hidden; background: var(--surface-2); border: 1px solid var(--edge); }
.home-rail-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.is-video .home-rail-media { aspect-ratio: 16 / 9; }
/* Product shots are cut out on white, so the frame is white too. */
.is-product .home-rail-media { aspect-ratio: 1; background: #fff; }
.is-product .home-rail-media img { object-fit: contain; }
.home-rail-tile a:hover .home-rail-media { border-color: var(--accent); }
.home-rail-tile a:hover .home-rail-title { color: var(--accent); }
.home-rail-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
}
.home-rail-meta { font-size: 13px; color: var(--ink-muted); }
.home-rail-meta.is-price { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }
.home-rail-foot { margin: 0; font-size: 13px; color: var(--ink-muted); }
.home-rail-foot a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.home-rail-foot a:hover { color: var(--accent); }

/* ---------- under the cards ---------- */
.home-after { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.home-stats-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 16px 4px 0;
  border-top: 1px solid var(--edge);
  font-size: 15px;
  color: var(--ink-muted);
}
.home-stats-line b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.home-stats-link:hover, .home-stats-link:hover b { color: var(--accent); }

.home-happening-card { gap: 10px; padding: 20px 24px; }
.home-happening { display: grid; gap: 10px; }
.home-happening li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 16px; font-size: 15px; }
.home-happening-title { min-width: 0; color: var(--ink); }
.home-happening-title a:hover { color: var(--accent); }
.home-happening-detail { color: var(--ink); }
.home-when { color: var(--accent); white-space: nowrap; }
.home-quiet { font-size: 0.9rem; line-height: 1.5; color: var(--ink-muted); }

/* The footer line: the way onto a rig, and for a visitor the way in. */
.home-foot { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--edge); }
.home-foot-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-left: auto; }
.home-foot-actions .btn { margin-left: 0; }

/* ---------- tablet and phone ---------- */
@media (max-width: 900px) {
  .home-card-top { flex-direction: column; align-items: flex-start; gap: 16px; }
  .home-card-side { text-align: left; }
  .home-join { margin-left: 0; }
  .home-card.is-passport { flex-direction: column; align-items: flex-start; gap: 24px; }
  .home-stamps { width: 100%; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .home-stamps.is-one { width: auto; grid-template-columns: 120px; }
  .home-board { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  /* Touch screens swipe the rail; no arrows. */
  .home-rail-arrows:not([hidden]) { display: none; }
}
@media (max-width: 640px) {
  /* Stacked on a phone the text runs the full width: a wash dark enough
     everywhere, lightest at the top. */
  .home-card-photo::after {
    background: linear-gradient(0deg,
      color-mix(in srgb, var(--bg) 94%, transparent) 0%,
      color-mix(in srgb, var(--bg) 82%, transparent) 55%,
      color-mix(in srgb, var(--bg) 62%, transparent) 100%);
  }
  .home-card { padding: 24px 20px; gap: 16px; }
  .home-card.is-challenge { min-height: 0; padding-block: 28px; }
  .home-title { font-size: 34px; }
  .home-title.is-xl { font-size: 40px; }
  .home-big, .home-card.is-challenge .home-big { font-size: 48px; }
  .home-big.is-word { font-size: 34px; }
  .home-big-note { display: block; margin-top: 4px; font-size: 15px; }
  .home-sectors { gap: 8px; }
  .home-sector { padding: 10px 12px; }
  .home-sector-v { font-size: 26px; }
  .home-happening-card { padding: 18px 20px; }
  .home-foot-actions { margin-left: 0; }
  .home-rail { grid-auto-columns: 200px; gap: 12px; margin: 0 -20px; padding: 0 20px 6px; scroll-padding-inline: 20px; }
}
@media (max-width: 640px) {
  .home-stamps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-stamps.is-one { grid-template-columns: 120px; }
}
@media (max-width: 420px) {
  .home-sectors { grid-template-columns: minmax(0, 1fr); }
}
