/* Vibe Stints — timing-screen vernacular: purple = fastest, green = personal best.
   Faces: Barlow Semi Condensed (display), Barlow (body), IBM Plex Mono (data).

   Graphite is the first-visit theme. Both palettes remain available and
   theme.js respects the visitor's saved `sb-theme` choice. These web tokens
   implement the approved September 2026 redesign without changing timing
   semantics or the Companion's separate display palette. */
:root {
  color-scheme: dark;
  --ground: #101416;
  --card: #191E21;
  --raised: #20272B;
  --ink: #F0F1ED;
  --muted: #A6AFAE;
  --accent: #AC96F0;
  --accent-ink: #171221;
  --accent-soft: #272335;
  --pb: #48C790;
  --pb-soft: #17342A;
  --hairline: #333C40;
  --field: #191E21;
  --danger: #EE847B;
  --border: #606B70;
  --shadow-card: inset 0 1px 0 rgb(255 255 255 / 0.04);
  --radius-sm: 6px;
  --radius-md: 8px;
  --bg: var(--ground);
  --line: var(--hairline);
  --purple: var(--accent);
}
:root[data-theme="light"] {
  color-scheme: light;
  --ground: #F4F5F2;
  --card: #FFFFFF;
  --raised: #ECEDE9;
  --ink: #1B2523;
  --muted: #4B5852;
  --accent: #6941CB;
  --accent-ink: #FFFFFF;
  --accent-soft: #EEE8FA;
  --pb: #1A7A52;
  --pb-soft: #E3F2EA;
  --hairline: #C8D1CC;
  --field: #FFFFFF;
  --danger: #B4372E;
  --border: #778780;
  --shadow-card: 0 1px 3px rgb(27 37 35 / 0.06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Barlow", "Segoe UI", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 960px; margin: 0 auto; padding: 2rem 1.25rem 5rem; }
h1, h2 {
  font-family: "Barlow Semi Condensed", "Barlow", "Arial Narrow", sans-serif;
  margin: 0 0 0.5rem;
  text-wrap: balance;
}
h1 { font-size: 2.4rem; font-weight: 700; line-height: 1.05; letter-spacing: -0.01em; }
h2 { font-size: 1.4rem; font-weight: 600; line-height: 1.15; }
/* h3 is a text-size head, so it stays in the text face — condensed type
   only earns its keep above ~1.3rem. */
h3 { font-family: inherit; font-size: 1.1rem; font-weight: 600; line-height: 1.3; margin: 0 0 0.35rem; }
p { max-width: 65ch; }
a { color: var(--accent); }
strong { font-weight: 600; }

.eyebrow, .label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.muted { color: var(--muted); }

/* ---------- controls ---------- */
button, .btn {
  font: 600 0.9rem "Barlow", sans-serif;
  line-height: 1.2;
  min-height: 2.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  border-radius: 6px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
button:hover, .btn:hover { background: var(--ground); }
button.primary, .btn.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
button.primary:hover, .btn.primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--ink));
  border-color: color-mix(in srgb, var(--accent) 88%, var(--ink));
}
button.ghost, .btn.ghost { background: transparent; border-color: transparent; }
button.ghost:hover, .btn.ghost:hover { background: var(--ground); }
/* Red Flag is for destructive actions — quiet until hovered, never a filled button. */
button.danger { background: transparent; border-color: transparent; color: var(--danger); }
button.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
button:disabled { opacity: 0.5; cursor: default; }
.btn-sm { min-height: 2rem; padding: 0.3rem 0.7rem; font-size: 0.8rem; border-radius: 6px; }
.icon-btn { width: 2.75rem; padding: 0; }
.icon-btn svg { width: 1.1rem; height: 1.1rem; display: block; }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Theme toggle: shows the mode you would switch TO. */
.theme-toggle .moon { display: block; }
.theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }

select {
  font: 500 0.9rem "Barlow", sans-serif;
  background: var(--field);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  min-height: 2.25rem;
  max-width: 260px;
}
input[type="text"], input[type="email"], .textarea {
  font: 1rem "Barlow", sans-serif;
  background: var(--field);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  width: 100%;
}
.textarea { line-height: 1.45; resize: vertical; }
input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.form-row { margin-bottom: 1rem; }
.form-row .label { display: block; margin-bottom: 0.3rem; }
.help { color: var(--muted); font-size: 0.85rem; margin: 0.4rem 0 0; }

/* ---------- surfaces ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.card-pad { padding: 1.1rem 1.25rem; }
.stat-row { display: flex; flex-wrap: wrap; gap: 1rem 1.75rem; padding: 0.9rem 1.25rem; }
.stat .label { display: block; }
.stat .value {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.2rem; font-weight: 600; line-height: 1.3;
}
.stat .value.purple { color: var(--accent); }
.stat .value.value-sm { font-size: 0.95rem; }

/* Rolling-pace ladder. Wraps to as many rows as the window count needs, so a
   75-lap stint and a 10-lap stint both read cleanly on a phone. */
.pace { padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--hairline); }
.pace-grid {
  display: grid; gap: 0.6rem 1.25rem; margin: 0.4rem 0 0.5rem;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
}
.pace-cell { display: flex; flex-direction: column; justify-content: space-between; gap: 0.2rem; min-width: 0; }
.pace-cell .label { display: block; line-height: 1.25; }
.pace-cell .value {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem; font-weight: 600;
  white-space: nowrap;
}
.pace-cell .value.purple { color: var(--accent); }
.pace .notice { margin: 0; }
tr.pace-row td { border-top: 1px solid var(--hairline); font-weight: 600; }
tr.pace-row.pace-first td { border-top: 2px solid var(--hairline); }
th .th-sub { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; }

.table-wrap { overflow-x: auto; position: relative; }
.scroll-y { max-height: 300px; overflow-y: auto; }
table {
  border-collapse: collapse; width: 100%;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
}
th, td { text-align: right; padding: 0.45rem 1rem; white-space: nowrap; }
th {
  font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 500;
  border-bottom: 1px solid var(--hairline);
}
td { border-top: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent); }
tr:first-child td { border-top: none; }
td:first-child, th:first-child { text-align: left; color: var(--muted); }
/* Timing semantics — bold and labelled as well as coloured, never colour alone. */
td.fastest { color: var(--accent); font-weight: 600; background: var(--accent-soft); }
td.pb { color: var(--pb); background: var(--pb-soft); }
td.kind { text-align: left; color: var(--muted); font-size: 0.75rem; }

.tabs { display: flex; gap: 0.25rem; margin: 1.5rem 0 1.25rem; border-bottom: 1px solid var(--hairline); }
.tabs button {
  border: none; background: none; border-radius: 0; min-height: 0;
  padding: 0.6rem 1rem; color: var(--muted); font-size: 0.95rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); background: none; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.drop {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 2.75rem 1.5rem;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: var(--card);
  transition: border-color 0.15s, background-color 0.15s;
}
.drop strong { color: var(--ink); font-size: 1.05rem; }
.drop:hover { border-color: var(--muted); }
.drop.over { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.progress { height: 6px; background: var(--hairline); border-radius: 3px; overflow: hidden; margin-top: 0.75rem; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.notice { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); }
.pad { padding: 0.9rem 1.25rem; }

/* ---------- team page frame ---------- */
.topbar {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem;
  align-items: flex-end; justify-content: space-between;
}
.topbar h1 { margin-bottom: 0; }
.roster { margin-top: 0.75rem; }
.filters { margin-top: 0.75rem; display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0.9rem; }
.spacer { flex: 1; }
.pick-list label { display: block; margin-bottom: 0.35rem; }
.pick-list input { margin-right: 0.35rem; accent-color: var(--accent); }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.tight { margin: 0.3rem 0; }
.stat-row-flush { padding: 0.6rem 0; }
.note-box { padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--hairline); }
.note-box .label { display: block; margin-bottom: 0.3rem; }
.note-actions { margin-top: 0.5rem; display: flex; gap: 0.6rem; align-items: center; }

@media (max-width: 600px) {
  main { padding: 1.25rem 1rem 4rem; }
  h1 { font-size: 2rem; }
  th, td { padding: 0.4rem 0.7rem; }
  .stat-row, .pace, .card-pad, .note-box { padding-left: 1rem; padding-right: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
@media (pointer: coarse) {
  button, .btn, .btn-sm, select { min-height: 44px; }
  select { font-size: 1rem; }
}
