/* St B Runs design system.
   Chrome is Bulldog navy; gold is reserved for OUR rows and marks, so the eye
   finds St. Bernadette in any table without reading. Times are set in a mono
   face with tabular figures because a split sheet is read down a column. */

@font-face { font-family: 'Barlow Condensed'; font-weight: 500; font-display: swap; src: url(fonts/BarlowCondensed-500.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap; src: url(fonts/BarlowCondensed-600.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-display: swap; src: url(fonts/BarlowCondensed-700.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 100 700; font-display: swap; src: url(fonts/IBMPlexSans-var.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap; src: url(fonts/IBMPlexMono-400.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url(fonts/IBMPlexMono-500.woff2) format('woff2'); }

:root {
  --navy: #14213D;
  --navy-2: #1F2F57;
  --navy-ink: #0D1730;
  --gold: #E3A61C;
  --gold-deep: #B8830E;
  --gold-soft: #FBF1D6;
  --paper: #FFFFFF;
  --ground: #EEF0F3;
  --ink: #1B1F27;
  --muted: #5E6673;
  --line: #D9DDE3;
  --line-soft: #EAECF0;
  --win: #1E7B4C;
  --win-soft: #E3F3EA;
  --loss: #B42318;
  --loss-soft: #FBE7E4;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(13,23,48,.06), 0 8px 24px rgba(13,23,48,.08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.5;
}
a { color: var(--navy-2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--navy-ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.1; }
.h-display { font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: .01em; text-transform: none; }
h2 { font-family: var(--display); font-weight: 600; font-size: 1.6rem; letter-spacing: .01em; }
h3 { font-family: var(--display); font-weight: 600; font-size: 1.25rem; }
.eyebrow { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; font-size: .85rem; color: var(--gold-deep); margin: 0 0 .5rem; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 60ch; }
.mono, .t { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; padding: 0 1.25rem; height: 58px;
  background: var(--navy); color: #fff; border-bottom: 3px solid var(--gold);
}
.wordmark { display: inline-flex; align-items: baseline; gap: .15rem; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.6rem; letter-spacing: .06em; }
.wm-stb { color: var(--gold); }
.wm-runs { color: #fff; }
.nav { display: flex; gap: .25rem; margin-left: .5rem; height: 100%; }
.nav a {
  display: inline-flex; align-items: center; padding: 0 .75rem; height: 58px; color: #D5DBE8; text-decoration: none;
  font-family: var(--display); font-weight: 600; font-size: 1.05rem; letter-spacing: .04em; text-transform: uppercase;
  border-bottom: 3px solid transparent; margin-bottom: -3px;
}
.nav a:hover { color: #fff; }
.nav a.is-active { color: #fff; border-bottom-color: var(--gold); }
.nav-coach { color: var(--gold) !important; }
.whoami { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .9rem; color: #C3CBDB; }
.linkish { background: none; border: 0; color: #fff; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; padding: 0; }

.page { max-width: 1120px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.foot { max-width: 1120px; margin: 0 auto; padding: 1rem 1.25rem 2rem; display: flex; flex-wrap: wrap; gap: .5rem 2rem; font-size: .8rem; color: var(--muted); }

.hero { padding: 2rem 0 1rem; }
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.card-narrow { max-width: 560px; }

/* Forms */
.field { display: block; margin-bottom: 1rem; }
.field > span { display: block; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .3rem; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.field input:focus { border-color: var(--navy-2); outline: 3px solid rgba(227,166,28,.35); outline-offset: 0; }
.btn { font: inherit; font-family: var(--display); font-weight: 600; font-size: 1.1rem; letter-spacing: .06em; text-transform: uppercase; padding: .7rem 1.25rem; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-ink); }
.btn-block { width: 100%; }
.form-error { margin: 0 0 1rem; padding: .6rem .75rem; border-radius: 8px; background: var(--loss-soft); color: var(--loss); font-size: .95rem; }

/* Login: the card is a race bib. */
.login-body { background: var(--navy); background-image: linear-gradient(160deg, #182750 0%, #0D1730 100%); min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.bib {
  position: relative; width: min(420px, 100%); background: #fff; border-radius: 14px; padding: 1.5rem 1.75rem 1.25rem;
  box-shadow: 0 30px 60px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.2);
}
.pin { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #F5F6F8; border: 2px solid #AEB6C4; box-shadow: inset 0 1px 2px rgba(0,0,0,.25); }
.pin::after { content: ''; position: absolute; left: 3px; top: 4px; width: 5px; height: 2px; background: #8E98A8; transform: rotate(-35deg); }
.pin-tl { top: 12px; left: 12px; } .pin-tr { top: 12px; right: 12px; } .pin-bl { bottom: 12px; left: 12px; } .pin-br { bottom: 12px; right: 12px; }
.bib-band { margin: 0 .5rem 1rem; padding: .55rem .75rem .5rem; background: var(--navy); color: #fff; border-radius: 6px; text-align: center; display: flex; flex-direction: column; gap: .1rem; }
.bib-school { font-family: var(--display); font-weight: 700; font-size: 1.35rem; letter-spacing: .1em; text-transform: uppercase; }
.bib-sport { font-family: var(--display); font-weight: 500; font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.bib-number { font-family: var(--display); font-weight: 700; font-size: 7.5rem; line-height: .9; text-align: center; color: var(--navy); letter-spacing: -.02em; }
.bib-tag { text-align: center; font-family: var(--mono); font-size: .8rem; letter-spacing: .12em; color: var(--muted); margin: .25rem 0 1.5rem; }
.bib .field { margin: 0 .5rem 1rem; }
.bib .btn-block { width: calc(100% - 1rem); margin: 0 .5rem; }
.bib .form-error { margin: 0 .5rem 1rem; }
.bib-foot { margin: 1.1rem .5rem .25rem; font-size: .8rem; color: var(--muted); text-align: center; }

@media (max-width: 720px) {
  .topbar { height: auto; flex-wrap: wrap; padding: .5rem 1rem; gap: .5rem 1rem; }
  .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .nav a { height: 42px; padding: 0 .6rem; font-size: 1rem; }
  .whoami { margin-left: auto; }
  .bib { padding: 1.25rem 1rem 1rem; }
  .bib-number { font-size: 6rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .topbar, .foot, .whoami { display: none !important; }
  body { background: #fff; }
  .page { max-width: none; padding: 0; }
}

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl th { text-align: left; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .4rem .6rem; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl td { padding: .5rem .6rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl .num { text-align: right; }
.tbl tr.ours td { background: var(--gold-soft); font-weight: 500; }
.tbl tr.ours td:first-child { box-shadow: inset 4px 0 0 var(--gold); }
.tbl .place { font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: var(--navy); }
.tbl.compact { font-size: .9rem; }
.tbl.compact td { padding: .35rem .5rem; }
.places { letter-spacing: .02em; white-space: nowrap; }
.race-lines .t { white-space: nowrap; }
.muted { color: var(--muted); }
.fine { font-size: .82rem; color: var(--muted); margin: .75rem 0 0; line-height: 1.45; }
.h-sub { font-family: var(--body); font-weight: 400; font-size: .9rem; color: var(--muted); letter-spacing: 0; margin-left: .4rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
a.plain { text-decoration: none; color: inherit; }

/* Race page */
.race-head { margin-bottom: 1rem; }
.race-head .eyebrow a { color: inherit; text-decoration: none; }
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.tab { font-family: var(--display); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: 1rem; padding: .35rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--navy-2); text-decoration: none; }
.tab.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }
.scoreline { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; padding: 1.1rem 1.5rem; margin: 1rem 0 1.5rem; background: var(--navy); color: #fff; border-radius: var(--radius); border-left: 6px solid var(--gold); }
.stat { display: flex; flex-direction: column; min-width: 90px; }
.stat-big { font-family: var(--display); font-weight: 700; font-size: 2.4rem; line-height: 1; color: var(--gold); }
.stat-label { font-size: .8rem; color: #C3CBDB; margin-top: .3rem; max-width: 22ch; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; align-items: start; }
.two-col > .card { margin: 0; }
.card + .card, .card + .two-col, .two-col + .card, .battles, .notes { margin-top: 1.25rem; }
.chip { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .85rem; font-weight: 500; }
.chip-win { background: var(--win-soft); color: var(--win); }
.chip-loss { background: var(--loss-soft); color: var(--loss); }
.win-h { color: var(--win); } .loss-h { color: var(--loss); }
.count { font-family: var(--mono); font-size: .9rem; color: var(--muted); margin-left: .3rem; }
.filter { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .5rem; }
.filter select { font: inherit; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.prose { white-space: normal; line-height: 1.55; }

/* Clumps: a horizontal bar per 30-second band; our names in gold */
.clumps { display: grid; grid-template-columns: max-content max-content 1fr; gap: .35rem .9rem; align-items: center; }
.clump { display: contents; }
.clump-band { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.clump-count { font-size: .9rem; text-align: right; }
.clump-bar-wrap { display: flex; align-items: center; gap: .5rem; min-height: 16px; }
.clump-bar { display: inline-block; height: 16px; background: var(--navy-2); border-radius: 3px; min-width: 3px; }
.clump-me .clump-bar, .clump:has(.clump-names) .clump-bar { background: var(--gold); }
.clump-names { font-family: var(--display); font-weight: 600; font-size: .95rem; color: var(--gold-deep); white-space: nowrap; }
.clump-beyond .clump-band, .clump-beyond .clump-count { color: var(--muted); font-style: italic; }
.clump-me .clump-band { color: var(--navy); font-weight: 600; }

/* Meets list */
.season + .season { margin-top: 2.5rem; }
.meet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.meet-card { display: block; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; text-decoration: none; color: inherit; border-top: 4px solid var(--navy); }
.meet-card.no-results { border-top-color: var(--line); opacity: .8; }
.meet-card:hover { box-shadow: 0 2px 4px rgba(13,23,48,.08), 0 12px 28px rgba(13,23,48,.14); }
.meet-card-top { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-bottom: .3rem; }
.week-tag { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-deep); }
.meet-card h3 { margin-bottom: .2rem; }
.meet-loc { margin: 0 0 .5rem; font-size: .85rem; color: var(--muted); }
.race-lines { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.race-lines li { display: flex; justify-content: space-between; gap: .5rem; padding: .25rem 0; border-top: 1px solid var(--line-soft); }

/* Athletes */
.athlete-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; margin-bottom: 1.5rem; }
.athlete-card { display: flex; flex-direction: column; gap: .15rem; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1rem; text-decoration: none; color: inherit; border-left: 4px solid var(--gold); }
.athlete-name { font-family: var(--display); font-weight: 600; font-size: 1.2rem; color: var(--navy); }
.athlete-meta { font-size: .8rem; color: var(--muted); }
.athlete-last { font-size: .95rem; margin-top: .3rem; }

/* Sheet */
.sheet-head { position: relative; margin-bottom: 1rem; }
.sheet-line { font-size: 1.05rem; color: var(--muted); margin: .25rem 0 0; }
.sheet-line strong { color: var(--ink); }
.big-time { font-family: var(--display); font-weight: 700; font-size: 2rem; color: var(--navy); }
.dot { margin: 0 .5rem; }
.neighbors tr.you td { background: var(--gold-soft); font-weight: 600; }
.neighbors tr.you td:first-child { box-shadow: inset 4px 0 0 var(--gold); }
.you-tag { font-family: var(--display); font-weight: 700; letter-spacing: .1em; color: var(--gold-deep); }
.neighbors tr.teammate td { color: var(--navy-2); }
.gap-up, .gap-down { color: var(--muted); }
.standings-mini td { padding: .3rem .5rem; }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--line); font-size: .95rem; padding: .4rem .9rem; }
.print-btn { position: absolute; right: 0; top: 0; }

@media (max-width: 820px) {
  .two-col { grid-template-columns: 1fr; }
  .scoreline { gap: 1rem 1.5rem; padding: 1rem; }
  .stat-big { font-size: 1.9rem; }
  .print-btn { position: static; margin-top: .5rem; }
  .tbl { display: block; overflow-x: auto; }
}
@media print {
  @page { margin: 12mm; }
  body { font-size: 11pt; }
  .card { box-shadow: none; padding: 0; margin: 0 0 .8rem; }
  .print-btn, .tabs { display: none !important; }
  .two-col { grid-template-columns: 1fr 1fr; gap: 1rem; }
  .sheet-body .eyebrow a { color: inherit; text-decoration: none; }
  a { color: inherit; text-decoration: none; }
}

/* Clipboard (coach pages) */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.tool { display: flex; flex-direction: column; gap: .35rem; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; text-decoration: none; color: inherit; border-top: 4px solid var(--gold); }
.tool-soon { border-top-color: var(--line); }
.tool-name { font-family: var(--display); font-weight: 700; font-size: 1.4rem; color: var(--navy); }
.tool-desc { font-size: .92rem; color: var(--muted); }
.tool-hint { font-size: .8rem; color: var(--gold-deep); font-weight: 600; margin-top: .25rem; }
.form-row[hidden] { display: none; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1 1 200px; }
.form-row .btn { margin-bottom: 1rem; }
.ingest-form textarea { font-family: var(--mono); font-size: .85rem; }
.card.warn { border-left: 5px solid var(--gold); }
.card.block { border-left: 5px solid var(--loss); }
.decision { padding: .75rem 0; border-top: 1px solid var(--line-soft); }
.decision-q { margin: 0 0 .4rem; }
.choice { display: block; padding: .2rem 0; }
.roster-edit input, .roster-edit select { font: inherit; font-size: .9rem; padding: .3rem .4rem; border: 1px solid var(--line); border-radius: 6px; width: 100%; min-width: 0; }
.roster-edit tr.inactive td { opacity: .6; }
.btn-sm { font-size: .85rem; padding: .3rem .6rem; }
.small { font-size: .8rem; }
code { font-family: var(--mono); font-size: .9em; background: var(--ground); padding: .05rem .3rem; border-radius: 4px; }

/* Home */
.hero-row { display: flex; gap: 1.5rem; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1.5rem; }
.next-card { display: flex; flex-direction: column; gap: .15rem; background: var(--navy); color: #fff; border-radius: var(--radius); padding: 1rem 1.25rem; text-decoration: none; min-width: 260px; border-left: 6px solid var(--gold); }
.next-label { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; color: var(--gold); }
.next-title { font-family: var(--display); font-weight: 700; font-size: 1.6rem; }
.next-meta { font-size: .85rem; color: #C3CBDB; }
.race-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; margin-top: .75rem; }
.race-tile { display: flex; flex-direction: column; background: var(--ground); border-radius: 8px; padding: .75rem .9rem; text-decoration: none; color: inherit; border-left: 4px solid var(--gold); }
.race-tile-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.race-tile-big { font-family: var(--display); font-weight: 700; font-size: 2rem; line-height: 1.1; color: var(--navy); }
.race-tile-sub { font-size: .85rem; color: var(--muted); }

/* Calendar */
.month + .month { margin-top: 1.5rem; }
.agenda, .agenda-mini { list-style: none; margin: 0; padding: 0; }
.agenda li, .agenda-mini li { display: flex; gap: 1rem; align-items: flex-start; padding: .6rem 0; border-top: 1px solid var(--line-soft); }
.agenda li.past { opacity: .55; }
.agenda li.today { background: var(--gold-soft); margin: 0 -.5rem; padding: .6rem .5rem; border-radius: 6px; }
.agenda-date { display: flex; flex-direction: column; align-items: center; min-width: 44px; }
.agenda-dow { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.agenda-dom { font-family: var(--display); font-weight: 700; font-size: 1.5rem; line-height: 1; color: var(--navy); }
.agenda-body { display: flex; flex-direction: column; gap: .1rem; flex: 1; }
.agenda-title { font-weight: 600; }
.agenda-meta, .agenda-notes { font-size: .85rem; color: var(--muted); }
.agenda-races { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .85rem; }
.badge { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; padding: .2rem .5rem; border-radius: 4px; background: var(--ground); color: var(--muted); align-self: center; }
.badge-meet { background: var(--navy); color: var(--gold); }
.badge-practice { background: var(--gold-soft); color: var(--gold-deep); }
.weekdays { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: 1rem; }
.wd { font-size: .95rem; }
.nowrap { white-space: nowrap; }
.btn-danger { color: var(--loss); }

/* Maps */
.map { width: 100%; height: 360px; border-radius: 8px; background: var(--ground); }
.map-edit { cursor: crosshair; }
.map-card { padding: 1rem; }
.addr { font-size: 1.05rem; }
.addr-row { display: flex; gap: .5rem; }
.addr-row input { flex: 1; }
.geo-results { list-style: none; margin: -.5rem 0 1rem; padding: .5rem .75rem; background: var(--ground); border-radius: 8px; font-size: .9rem; }
.geo-results li { padding: .2rem 0; }
