/*
 * waivers/styles — the stylesheet for the Waiver Scout page (GET /waivers,
 * ch. 16 E-24). Linked from src/api/waivers-page.js under a content-hashed
 * URL (src/assets.js) as `waivers.css`, before `waivers-join.css`.
 *
 * THE DRAWING IS THE SOURCE: demo-artifacts/product-mockups/waiver-scout/
 * mockup.html's `.ws…` rules, ported. Where the drawing keyed a rule on its
 * frame width (`.frame[data-w='320']`, `[data-w='1440']`) this file keys it
 * on a media query: ≤340 for what the drawing did at 320, ≥1024 for what it
 * did at 1440 (the brief: two columns at ≥1024, nothing else changes).
 *
 * The page base is show.css's: the tokens (the dashboard's own, from :root
 * in src/views/dashboard/styles.css — fifteen here because the cards read
 * the surfaces and the semantic colours; adding one means copying it from
 * there, never inventing a shade), `.skip`, `.sr-only`, `:focus-visible`.
 * The state box and the skeleton are in waivers-join.css, at the ceiling.
 *
 * Dark-only (ch. 03). Mobile-first for 320 / 768 / 1024 / 1440: one column
 * that stops widening at 1240px; the cards and the join go two-up at ≥1024.
 * Every control is ≥44px. Nothing here can push the document wider than the
 * viewport: 14px gutters, `minmax(0, 1fr)` on every grid, `overflow-wrap:
 * anywhere` on every text container that holds an API name.
 */

/* ---------- page base -------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0b0d10;
  --surface: #14171c;
  --surface-2: #1b1f26;
  --surface-3: #232a33;
  --border: #2a303a;
  --border-soft: #21262e;
  --text: #f2f4f7;
  --muted: #9aa4b2;
  --faint: #6b7280;
  --accent: #6366f1;
  --good: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --gold: #eab308;
  --radius: 12px;
  --radius-sm: 8px;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  /* Standalone iOS: the last card would sit under the home-indicator bar. */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

a {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--gold);
  color: #1a1400;
  padding: 12px 16px;
  z-index: 60;
  border-radius: 0 0 8px 0;
}
.skip:focus {
  left: 0;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- the page ---------------------------------------------------- */

/* The reading column. 14px gutters at 320 (the shell's own are 14px too). */
.ws {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 14px 24px;
}

.ws-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0 0 12px;
}
.ws-sum {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0;
}
.ws-sum b {
  color: var(--text);
}

/* Rank by: two 44px halves in one pill. */
.ws-rank {
  margin-left: auto;
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.ws-rank button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.ws-rank button[aria-pressed='true'] {
  background: var(--surface-3);
  color: var(--text);
}
.ws-rank button:disabled {
  cursor: default;
  opacity: 0.6;
}
/* Inset, not offset: an outline outside a clipped pill is cut off. */
.ws-rank button:focus-visible {
  outline-offset: -3px;
}

.ws h2 {
  margin: 16px 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.ws h2 small {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--faint);
}
.ws h2:first-of-type {
  margin-top: 4px;
}

/* The join's one line when no man qualifies for a row. */
.join-empty {
  margin: 0;
  color: var(--faint);
  font-size: 0.82rem;
  padding: 6px 2px 4px;
}

/* ---------- league by league ------------------------------------------- */

.lgs {
  display: grid;
  gap: 12px;
}
.lg {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 14px 8px;
  min-width: 0;
}
/* E-20's two-line head: the league name, the reader's own team beneath. */
.lg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  margin-bottom: 8px;
}
.lg-name {
  font-weight: 800;
  font-size: 1rem;
  flex-basis: 100%;
  overflow-wrap: anywhere;
}
.lg-team {
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.lg-meta {
  font-size: 0.74rem;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
}

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.tag.warn,
.tag.q {
  color: var(--warn);
  border-color: rgba(245, 158, 11, 0.5);
}
.tag.bad {
  color: var(--bad);
  border-color: rgba(239, 68, 68, 0.5);
}

/* The drop: first on the card, the same man for every pickup. */
.drop {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.82rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.drop .k {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-right: 6px;
}
.drop b {
  font-weight: 700;
}
.drop .then {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
}
.drop .why {
  color: var(--faint);
  display: block;
  font-size: 0.74rem;
  margin-top: 2px;
}

/* The column heads over the candidate rows, on the rows' own grid. */
.lg-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px 56px;
  gap: 6px;
}
.lg-cols .col {
  text-align: right;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.pos {
  border-top: 1px solid var(--border-soft);
  padding: 8px 0 6px;
}
.pos-h {
  font-size: 0.8rem;
  margin-bottom: 2px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.pos-h b {
  color: var(--text);
  font-weight: 800;
}
.pos-h.empty,
.pos-h.empty b {
  color: var(--warn);
}
.pos-h small {
  color: var(--faint);
}

/* A candidate: the man, this week, the horizon. */
.cand {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px 56px;
  gap: 6px;
  align-items: center;
  min-height: 36px;
  font-size: 0.86rem;
}
.cand .who {
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.cand .who small {
  color: var(--faint);
  font-size: 0.72rem;
  margin-left: 5px;
  white-space: nowrap;
}
.cand .n {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.15;
}
.cand .n b {
  display: block;
  font-weight: 700;
}
.cand .n span {
  font-size: 0.72rem;
  color: var(--faint);
}
.cand.up .n b.g {
  color: var(--good);
}
.cand .n b.r {
  color: var(--bad);
}
.cand.dim {
  color: var(--muted);
}

/* The rest of the wire, one tap under a summary that names the next two. */
details.more {
  margin: 2px 0 4px;
}
/* 44px, not the drawing's 36: the summary is a tap target (ch. 03). */
details.more summary {
  list-style: none;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
details.more summary::-webkit-details-marker {
  display: none;
}
details.more summary::before {
  content: '▸';
  margin-right: 6px;
  color: var(--faint);
  flex: none;
}
details.more[open] summary::before {
  content: '▾';
}

.quiet {
  font-size: 0.76rem;
  color: var(--faint);
  padding: 8px 0 4px;
  border-top: 1px solid var(--border-soft);
}

/* A notice: a wire that did not answer, positions that failed. */
.notice {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}
.notice > span {
  flex: 1 1 200px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.notice.warn {
  border-color: rgba(245, 158, 11, 0.45);
}
.notice b {
  color: var(--text);
}
.notice .btn {
  margin-left: auto;
}

.btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover {
  background: var(--surface-3);
}
.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

/* ---------- breakpoints ------------------------------------------------- */

/* The narrowest phones: Rank by takes the whole width, the subtitle goes. */
@media (max-width: 340px) {
  .ws-rank {
    margin-left: 0;
    width: 100%;
  }
  .ws-rank button {
    flex: 1;
  }
  .ws h2 small {
    display: none;
  }
  .cand .who small {
    display: block;
    margin-left: 0;
    white-space: normal;
  }
}

/* Two league cards abreast, and the join two-up (waivers-join.css). */
@media (min-width: 1024px) {
  .lgs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  .sk-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}
