/* /css/dfs.css
 *
 * Styles for /dfs/* pages. Loaded after /css/article.css (linked by
 * site-shell.js) so the site chrome — header nav, compliance footer —
 * inherits article styling. All DFS-specific selectors are prefixed
 * .rl-dfs- to avoid collisions.
 *
 * Aesthetic per ARCHITECTURE.md: "broadcast booth" — dark, data-dense,
 * Barlow Condensed for headings, Share Tech Mono for stats. Teal accent
 * matches the article surface.
 */

:root {
  --rl-dfs-bg: #06090f;
  --rl-dfs-surface: #0e1320;
  --rl-dfs-surface-2: #131a2c;
  --rl-dfs-border: rgba(255, 255, 255, 0.08);
  --rl-dfs-border-strong: rgba(255, 255, 255, 0.18);
  --rl-dfs-fg: #e8edf5;
  --rl-dfs-fg-muted: rgba(232, 237, 245, 0.62);
  --rl-dfs-fg-faint: rgba(232, 237, 245, 0.42);
  --rl-dfs-accent: #2ec4b6;
  --rl-dfs-warn: #f4a261;
  --rl-dfs-pos: #2ec4b6;
  --rl-dfs-neg: #e63946;
  --rl-dfs-pp: #5b2ba6;
  --rl-dfs-ud: #ff4d4d;
  --rl-dfs-dk: #53d337;
  --rl-dfs-fd: #1493ff;
}

body.rl-dfs-page {
  background: var(--rl-dfs-bg);
  color: var(--rl-dfs-fg);
  /* Literal font-family — not var(--rl-font-body) — because empirical
     testing showed prose elements rendering in browser-default serif
     even though --rl-font-body is declared in /css/article.css :root
     and the body class matched. Whatever broke the var() cascade in
     practice, a plain string is bulletproof. Every prose element below
     also gets its own explicit font-family declaration — defense in
     depth, no reliance on inheritance for the elements that are known
     to render wrong without it. */
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* room for the sticky bottom nav so content isn't hidden behind it */
  padding-bottom: 5.5rem;
}

.rl-dfs-page-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1rem 1rem;
}

/* ── Header ─────────────────────────────────────────────────────── */
.rl-dfs-edges-header { margin-bottom: 1.25rem; }

.rl-dfs-eyebrow {
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  color: var(--rl-dfs-accent);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.rl-dfs-h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.05;
  margin: 0 0 0.5rem;
}
.rl-dfs-dek {
  /* Explicit — body inheritance was empirically not reaching this
     element. Same string as body.rl-dfs-page. */
  font-family: 'Barlow Condensed', sans-serif;
  color: var(--rl-dfs-fg-muted);
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
  max-width: 60ch;
  line-height: 1.45;
}
.rl-dfs-stamps {
  display: flex; flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.78rem;
  color: var(--rl-dfs-fg-faint);
}
.rl-dfs-stamps strong { color: var(--rl-dfs-fg); font-weight: 500; }
.rl-dfs-stamp-sep { opacity: 0.4; }

/* ── Mock-data banner ────────────────────────────────────────────── */
/* Loud, unmistakable. Visible only when /dfs/edges is serving
   MOCK_EDGES because compute-projections hasn't run yet for the
   slate. Position above the CTA rail so it lands in the user's
   first scroll, not behind the books. */
.rl-dfs-mock-banner {
  font-family: 'Barlow Condensed', sans-serif;
  margin: 0.5rem 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--rl-dfs-warn);
  border-left-width: 4px;
  border-radius: 8px;
  background: rgba(244, 162, 97, 0.08);
  color: var(--rl-dfs-fg);
  font-size: 0.9rem;
  line-height: 1.45;
}
.rl-dfs-mock-banner strong { color: var(--rl-dfs-warn); }

/* ── CTA rail ────────────────────────────────────────────────────── */
.rl-dfs-cta-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0 1.25rem;
}
.rl-dfs-cta {
  display: flex; flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0.9rem 0.75rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--rl-dfs-border);
  background: var(--rl-dfs-surface);
  color: var(--rl-dfs-fg);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.rl-dfs-cta:hover {
  transform: translateY(-1px);
  border-color: var(--rl-dfs-border-strong);
}
.rl-dfs-cta::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.rl-dfs-cta-pp::before { background: var(--rl-dfs-pp); }
.rl-dfs-cta-ud::before { background: var(--rl-dfs-ud); }
.rl-dfs-cta-dk::before { background: var(--rl-dfs-dk); }
.rl-dfs-cta-fd::before { background: var(--rl-dfs-fd); }
.rl-dfs-cta-book {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.rl-dfs-cta-action {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.78rem;
  color: var(--rl-dfs-fg-muted);
}

/* ── Toolbar ─────────────────────────────────────────────────────── */
.rl-dfs-toolbar {
  display: flex; flex-wrap: wrap;
  gap: 0.6rem 1.25rem;
  padding: 0.65rem 0.9rem;
  margin: 0 0 1rem;
  border: 1px solid var(--rl-dfs-border);
  border-radius: 10px;
  background: var(--rl-dfs-surface);
  font-size: 0.85rem;
}
.rl-dfs-toolbar-group {
  border: 0; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  align-items: center;
}
.rl-dfs-toolbar-group legend {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: var(--rl-dfs-fg-faint);
  text-transform: uppercase;
  padding-right: 0.5rem;
}
.rl-dfs-toolbar-group label {
  /* Filter labels (Hits / TB / K / HR / High / Medium / Low). Form
     control descendants are the most cascade-fragile because <input>
     and <button> bring their own user-agent fonts. */
  font-family: 'Barlow Condensed', sans-serif;
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.rl-dfs-toolbar-submit {
  background: var(--rl-dfs-accent);
  color: #06090f;
  border: 0;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

/* ── Table ───────────────────────────────────────────────────────── */
.rl-dfs-edges-table-wrap {
  border: 1px solid var(--rl-dfs-border);
  border-radius: 10px;
  background: var(--rl-dfs-surface);
  overflow-x: auto;
}
.rl-dfs-edges-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.rl-dfs-edges-table th {
  text-align: left;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rl-dfs-fg-faint);
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--rl-dfs-border);
  background: var(--rl-dfs-surface-2);
  white-space: nowrap;
}
.rl-dfs-edges-row td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--rl-dfs-border);
  vertical-align: middle;
}
.rl-dfs-edges-row:hover { background: var(--rl-dfs-surface-2); }

/* Player column: name on top, team/pos/opp metadata below */
.rl-dfs-edges-player { min-width: 11rem; }
.rl-dfs-edges-name {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}
.rl-dfs-edges-meta {
  display: block;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  color: var(--rl-dfs-fg-faint);
  margin-top: 0.1rem;
}

/* Market column: "Hits" + line on its own row */
.rl-dfs-edges-market { white-space: nowrap; }
.rl-dfs-edges-market-label {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.1;
}
.rl-dfs-edges-line {
  display: block;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.8rem;
  color: var(--rl-dfs-fg-muted);
  margin-top: 0.1rem;
}

.rl-dfs-edges-modelpct {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1rem;
  white-space: nowrap;
}

.rl-dfs-edges-edge { white-space: nowrap; }
.rl-dfs-edge-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-family: 'Share Tech Mono', monospace;
  font-weight: 700;
  font-size: 0.85rem;
}
.rl-dfs-edge-high   { background: rgba(46, 196, 182, 0.18); color: var(--rl-dfs-pos); }
.rl-dfs-edge-medium { background: rgba(244, 162,  97, 0.16); color: var(--rl-dfs-warn); }
.rl-dfs-edge-low    { background: rgba(255, 255, 255, 0.06); color: var(--rl-dfs-fg-muted); }

.rl-dfs-conf-pill {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.18rem 0.45rem;
  border-radius: 4px;
}
.rl-dfs-conf-high   { background: rgba(46, 196, 182, 0.14); color: var(--rl-dfs-pos); }
.rl-dfs-conf-medium { background: rgba(244, 162,  97, 0.14); color: var(--rl-dfs-warn); }
.rl-dfs-conf-low    { background: rgba(255, 255, 255, 0.06); color: var(--rl-dfs-fg-muted); }

/* Books column: a row of small book pills */
.rl-dfs-edges-books {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.rl-dfs-book {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 0.25rem 0.55rem;
  min-width: 60px;
  border-radius: 6px;
  border: 1px solid var(--rl-dfs-border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--rl-dfs-fg);
  font-family: 'Share Tech Mono', monospace;
  text-decoration: none;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.rl-dfs-book:hover {
  transform: translateY(-1px);
  border-color: var(--rl-dfs-border-strong);
}
.rl-dfs-book-label {
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.rl-dfs-book-line {
  color: var(--rl-dfs-fg-muted);
  font-size: 0.82rem;
  margin-top: 0.05rem;
}
.rl-dfs-book-pp { border-color: rgba( 91,  43, 166, 0.45); }
.rl-dfs-book-ud { border-color: rgba(255,  77,  77, 0.45); }
.rl-dfs-book-dk { border-color: rgba( 83, 211,  55, 0.40); }
.rl-dfs-book-fd { border-color: rgba( 20, 147, 255, 0.45); }

/* Expand chevron — first column on every row.
   Sized to a 44×44 minimum touch target (Apple HIG / WCAG AA) so
   thumbs hit the button cleanly on mobile. The cell sits at the far
   left, well separated from the affiliate pills column on the right;
   that physical distance is the primary defense against accidental
   affiliate clicks. */
.rl-dfs-edges-expand-cell {
  width: 56px;        /* 44 button + 12 padding */
  padding: 0.4rem 0.3rem 0.4rem 0.6rem;
  text-align: left;
  vertical-align: middle;
}
.rl-dfs-edges-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 1px solid var(--rl-dfs-border);
  border-radius: 6px;
  padding: 0;
  color: var(--rl-dfs-fg-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.18s ease, color 0.12s ease, border-color 0.12s ease;
}
.rl-dfs-edges-expand:hover {
  color: var(--rl-dfs-fg);
  border-color: var(--rl-dfs-border-strong);
}
.rl-dfs-edges-expand[aria-expanded="true"] {
  transform: rotate(180deg);
  color: var(--rl-dfs-fg);
}

/* Tappable rows get a pointer cursor so the affordance is obvious.
   Rows without expandable detail (no manager_context / no salaries)
   keep the default cursor. */
.rl-dfs-edges-row-tappable { cursor: pointer; }

/* Quality-flag badge rendered next to the player name. Subtle amber
   warning glyph — visible enough to notice, restrained enough not to
   pull attention from the player name itself. Click expands the
   row's detail panel (where the full flag explanation lives);
   native title attribute gives a hover tooltip too. */
.rl-dfs-edges-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 0.3rem;
  padding: 0;
  border: 1px solid var(--rl-dfs-warn);
  border-radius: 50%;
  background: rgba(244, 162, 97, 0.12);
  color: var(--rl-dfs-warn);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  vertical-align: -2px;
}
.rl-dfs-edges-flag:hover { background: rgba(244, 162, 97, 0.22); }

/* Detail-row block listing all flag explanations. Same layout
   conventions as the manager-context block so they sit side by
   side comfortably. */
.rl-dfs-edges-flags-block {
  grid-column: 1 / -1;
  border-top: 1px dashed var(--rl-dfs-border);
  padding-top: 0.65rem;
  margin-top: 0.35rem;
}
.rl-dfs-edges-flags-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rl-dfs-warn);
  margin-bottom: 0.3rem;
}
.rl-dfs-edges-flags-list {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0;
  padding-left: 1.1rem;
  color: var(--rl-dfs-fg);
}
.rl-dfs-edges-flags-list li { margin-bottom: 0.15rem; }
.rl-dfs-edges-flags-list strong { color: var(--rl-dfs-warn); font-weight: 600; }

/* "Hide uncertain projections" toolbar toggle. When the wrapper
   carries .rl-dfs-hide-flagged, every row marked
   data-has-flags="true" disappears, and so does its companion
   detail row (which is the immediate next sibling). */
.rl-dfs-edges-table-wrap.rl-dfs-hide-flagged tr[data-has-flags="true"],
.rl-dfs-edges-table-wrap.rl-dfs-hide-flagged tr[data-has-flags="true"] + tr.rl-dfs-edges-detail {
  display: none;
}

/* Detail row — manager context + salaries */
.rl-dfs-edges-detail td {
  padding: 0.9rem 1rem;
  background: var(--rl-dfs-surface-2);
  border-bottom: 1px solid var(--rl-dfs-border);
}
.rl-dfs-edges-detail-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem 1.25rem;
  align-items: start;
}
.rl-dfs-edges-context-label,
.rl-dfs-edges-salaries-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rl-dfs-fg-faint);
  margin-bottom: 0.3rem;
}
.rl-dfs-edges-context-body {
  /* Manager-context prose. This is the value-prop copy on every row;
     it has to look right. */
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--rl-dfs-fg);
}
.rl-dfs-edges-salaries-body {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.88rem;
  display: flex;
  gap: 0.7rem;
  white-space: nowrap;
}
.rl-dfs-edges-salaries-body strong {
  color: var(--rl-dfs-fg-faint);
  font-weight: 500;
}

/* ── Empty state ─────────────────────────────────────────────────── */
.rl-dfs-empty,
.rl-dfs-empty p {
  font-family: 'Barlow Condensed', sans-serif;
  border-radius: 10px;
  text-align: center;
  color: var(--rl-dfs-fg-muted);
}
.rl-dfs-empty {
  border: 1px dashed var(--rl-dfs-border);
  padding: 2rem 1.5rem;
}
.rl-dfs-empty-eyebrow {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--rl-dfs-fg-faint);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}
.rl-dfs-empty a { color: var(--rl-dfs-accent); }

/* ── Footnote ────────────────────────────────────────────────────── */
.rl-dfs-footnote,
.rl-dfs-footnote p {
  /* Methodology copy at the bottom of the page. Same explicit font as
     the dek and the manager-context body — these are the three prose
     surfaces a reader's eye lands on, all need to be Barlow. */
  font-family: 'Barlow Condensed', sans-serif;
  color: var(--rl-dfs-fg-muted);
  font-size: 0.85rem;
  line-height: 1.55;
}
.rl-dfs-footnote {
  margin-top: 1.25rem;
  padding: 1rem 0;
  border-top: 1px solid var(--rl-dfs-border);
}
.rl-dfs-footnote a { color: var(--rl-dfs-accent); }

/* ── Sticky bottom nav ──────────────────────────────────────────── */
/* Visible at every viewport — same chrome on desktop and mobile so the
 * page-to-page DFS jump is one tap or one click. */
.rl-dfs-bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: rgba(6, 9, 15, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--rl-dfs-border);
  z-index: 50;
  padding: 0.4rem max(env(safe-area-inset-left), 0.5rem)
           calc(0.5rem + env(safe-area-inset-bottom))
           max(env(safe-area-inset-right), 0.5rem);
}
.rl-dfs-bottomnav-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0.2rem;
  text-decoration: none;
  color: var(--rl-dfs-fg-muted);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 6px;
}
.rl-dfs-bottomnav-link:hover { color: var(--rl-dfs-fg); }
.rl-dfs-bottomnav-icon {
  font-size: 1.05rem;
  line-height: 1;
}
.rl-dfs-bottomnav-active {
  color: var(--rl-dfs-accent);
  background: rgba(46, 196, 182, 0.08);
}

/* ── Mobile tweaks ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .rl-dfs-edges-table { font-size: 0.82rem; }
  .rl-dfs-edges-table th,
  .rl-dfs-edges-row td { padding: 0.55rem 0.5rem; }
  .rl-dfs-edges-meta { font-size: 0.66rem; }
  .rl-dfs-edges-modelpct { font-size: 0.9rem; }
  .rl-dfs-cta-rail { grid-template-columns: repeat(2, 1fr); }
  .rl-dfs-edges-detail-grid { grid-template-columns: 1fr; }
  /* Keep the expand chevron at full 44px on mobile — the whole point of
     putting it on the left is that thumbs reach it without horizontal
     scroll. Tighter outer padding only. */
  .rl-dfs-edges-expand-cell {
    width: 52px;
    padding: 0.35rem 0.2rem 0.35rem 0.4rem;
  }
}
