/* ============================================================
   TGC: the season, on the clock (scripts/tgc-season.js)

   Builds on the shared .season__grid / .round cards (sections-b.css)
   and their states (sections-c.css). This file only adds the TGC
   timing-board layer: the filter, the ticks, the drop-in, the glow.
   ============================================================ */

/* ---------- the bar: filter + members note ---------- */
.tseason__bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.9rem 1.5rem;
  margin-bottom: clamp(1rem, 2vw, 1.6rem);
}
.tseason__seg {
  display: inline-flex;
  border: 1px solid var(--line);
  background: var(--surface);
}
.tseason__seg button {
  appearance: none; border: 0; background: none; cursor: pointer;
  color: var(--muted);
  padding: 0.7em 1em;
  min-height: 2.75rem;   /* a thumb-sized target */
  display: inline-flex; align-items: center; gap: 0.55em;
  transition: color var(--d2) var(--ease-out), background var(--d2) var(--ease-out);
}
.tseason__seg button + button { border-left: 1px solid var(--line); }
.tseason__seg button:hover { color: var(--ink); }
.tseason__seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink, #050505); }
.tseason__seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; position: relative; z-index: 1; }
.tseason__n { font-variant-numeric: tabular-nums; opacity: 0.7; }

.tseason__note {
  margin: 0;
  display: inline-flex; align-items: center; gap: 0.6em;
  color: var(--ink);
}
.tseason__tick {
  width: 0.55em; height: 0.55em; flex: none;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.tseason__status {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; margin: 0;
}

/* ---------- the board ---------- */
/* Separate cells instead of hairline gaps, so a card can lift clear of
   its neighbours. */
.tseason__grid {
  background: none; border: 0;
  gap: clamp(6px, 0.7vw, 10px);
}
.tseason__grid .round {
  border: 1px solid var(--line);
}
.tseason__grid .round[hidden] { display: none; }

/* Timing-board ticks along the top edge: orange on what is still to
   race, grey once it is spent or the room sits it out. */
.tseason__grid .round::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 1px, transparent 1px 9px);
  opacity: 0.45;
  pointer-events: none;
}
.tseason__grid .round[data-round="raced"]::before,
.tseason__grid .round[data-round="away"]::before {
  background: repeating-linear-gradient(90deg, var(--muted) 0 1px, transparent 1px 9px);
  opacity: 0.35;
}
.tseason__of { color: var(--muted); }

.tseason__grid .round:hover,
.tseason__grid .round:focus-visible {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent),
    0 18px 44px -22px color-mix(in srgb, var(--accent) 80%, transparent);
  z-index: 1;
}
.tseason__grid .round:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Next up: the one that glows. */
.tseason__grid .round[data-round="next"] {
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
    0 0 46px -12px color-mix(in srgb, var(--accent) 70%, transparent);
}
.tseason__grid .round[data-round="next"]::before { opacity: 1; }
.tseason__grid .round[data-round="next"] .round__flag {
  background: var(--accent); color: var(--accent-ink, #050505); border-color: var(--accent);
}

/* ---------- drop-in on scroll, flip on filter ---------- */
.tseason__grid .round.is-wait {
  translate: 0 -18px;
  clip-path: inset(0 0 100% 0);
}
.tseason__grid .round {
  transition-property: background, opacity, transform, box-shadow, border-color, translate, clip-path;
  transition-duration: var(--d2), var(--d2), var(--d3), var(--d3), var(--d2), var(--d4), var(--d3);
  transition-timing-function: var(--ease-out);
}
.tseason__grid.is-flip .round {
  animation: tseason-flip var(--d3) var(--ease-out) both;
  animation-delay: calc(min(var(--i, 0), 16) * 28ms);
}
@keyframes tseason-flip {
  from { translate: 0 -14px; clip-path: inset(0 0 100% 0); }
  to   { translate: 0 0;     clip-path: inset(0 0 0 0); }
}

/* ---------- phones: two columns ---------- */
@media (max-width: 599px) {
  .tseason__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tseason__grid .round { aspect-ratio: auto; grid-template-rows: auto auto auto; gap: 0.55rem; padding: 0.8rem; }
  .tseason__grid .round__art { aspect-ratio: 1 / 1; }
  .tseason__grid .round__head .mono--muted { display: none; }
  .tseason__seg { width: 100%; }
  .tseason__seg button { flex: 1; justify-content: center; padding-inline: 0.5em; }
}

@media (prefers-reduced-motion: reduce) {
  .tseason__grid .round,
  .tseason__grid .round:hover,
  .tseason__grid .round:focus-visible { transform: none; translate: none; clip-path: none; animation: none; }
}
