/* reddit_tracker.css — styles for /tools/reddit-stock-tracker hub + detail pages.
   Class prefix: rs- (Reddit Stock tracker).
   Adapted from prototypes in .superpowers/brainstorm/83898-1778208183/content/
   landing-v3-desktop.html and per-ticker-v2-desktop.html.
*/

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

/* ── Page shell ──────────────────────────────────────────────────────────── */
.rs-page {
  background: #0e0f12;
  color: #e6e7ea;
  padding: 40px 56px;
  max-width: 1280px;
  margin: 0 auto;
  font-family: "DM Sans", "Noto Sans SC", -apple-system, system-ui, sans-serif;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.rs-crumb {
  font-size: 12px;
  color: #8a8d94;
  margin-bottom: 14px;
  letter-spacing: 0.04em;
}
.rs-crumb a { color: #8a8d94; text-decoration: none; }
.rs-crumb a:hover { color: #fff; }

/* ── Hero ────────────────────────────────────────────────────────────────── */
.rs-hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 36px;
  padding-bottom: 32px;
  border-bottom: 1px solid #24272e;
}

.rs-h1 {
  font-family: 'DM Sans', 'Instrument Serif', Georgia, serif;
  font-style: normal;
  font-size: 56px;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 14px;
  color: #fff;
  font-weight: 600;
}

.rs-lede {
  font-size: 16px;
  color: #b8bbc2;
  line-height: 1.65;
  max-width: 540px;
}
.rs-lede strong { color: #ff6b35; font-weight: 600; }

.rs-hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.rs-hero-stat {
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 10px;
  padding: 18px 20px;
}
.rs-hero-num {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 28px;
  color: #fff;
  font-weight: 500;
  line-height: 1.1;
}
.rs-hero-label {
  font-size: 11px;
  color: #8a8d94;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
}

/* ── Section headings ────────────────────────────────────────────────────── */
.rs-h2 {
  font-family: 'DM Sans', 'Instrument Serif', Georgia, serif;
  font-style: normal;
  font-size: 28px;
  letter-spacing: -0.01em;
  color: #fff;
  margin: 0;
  font-weight: 600;
}

.rs-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.rs-section-sub {
  font-size: 13px;
  color: #8a8d94;
}

/* ── Filter row ──────────────────────────────────────────────────────────── */
.rs-filter-row {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
  padding: 14px 18px;
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 10px;
}

.rs-filter-label {
  font-size: 11px;
  color: #8a8d94;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.rs-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.rs-filter {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 6px 12px;
  background: #1a1d24;
  border: 1px solid #24272e;
  border-radius: 16px;
  color: #b8bbc2;
  cursor: pointer;
  text-decoration: none;
}

.rs-filter.on {
  background: #2a3450;
  color: #9bb5ff;
  border-color: #3a4a6e;
}

/* ── Leaderboard table ───────────────────────────────────────────────────── */
.rs-table {
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 36px;
}

/* 9 columns: # / Ticker / Company / Mentions / Upvotes / 24h Δ / PE / IV / Verdict
   30d trend (sparkline) column temporarily hidden — daily snapshot is still
   accumulating; restore once history is meaningful (~30 days of cron runs). */
.rs-row {
  display: grid;
  grid-template-columns: 44px 90px 1fr 100px 90px 80px 90px 90px 160px;
  gap: 12px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #1f2127;
  text-decoration: none;
  color: inherit;
}

.rs-row:last-child { border-bottom: none; }
.rs-row:hover { background: #1a1d24; cursor: pointer; }

/* Top 25 visible by default; rows 26-100 reveal when .rs-expanded toggles on. */
.rs-row-extra { display: none; }
.rs-table.rs-expanded .rs-row-extra { display: grid; }

/* "Show all 100" toggle button. */
.rs-show-more {
  display: flex;
  justify-content: center;
  margin-top: -20px;
  margin-bottom: 36px;
}
.rs-show-more-btn {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 10px 24px;
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 8px;
  color: #b8bbc2;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.rs-show-more-btn:hover { background: #1a1d24; color: #fff; border-color: #3a4a6e; }

.rs-row-head {
  color: #8a8d94;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 20px;
  background: #12141a;
  cursor: default !important;
}
.rs-row-head:hover { background: #12141a; }

.rs-rank { font-family: 'DM Mono', monospace; font-size: 14px; color: #ff6b35; font-weight: 500; }
.rs-tick { font-family: 'DM Mono', monospace; font-size: 15px; color: #fff; font-weight: 500; }
.rs-name { font-size: 13px; color: #b8bbc2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-num-r { font-family: 'DM Mono', monospace; font-size: 14px; color: #fff; text-align: right; }
.rs-num-r.up { color: #4ade80; }
.rs-num-r.down { color: #ff8a8a; }
.rs-num-r.muted { color: #b8bbc2; }
/* Semantic label badge for cells where the metric is intentionally
   inapplicable (loss-makers' PE, distorted PE etc). Matches the
   .bas-num-tag treatment on /picks/best-ai-stocks. */
.rs-num-tag {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a8d94;
  background: #1f2127;
  border: 1px solid #2a2d34;
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}
.rs-spark { height: 28px; }

/* Verdict pill */
.rs-verdict-pill {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 12px;
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.rs-verdict-pill.bad { background: rgba(255,138,138,0.12); color: #ff8a8a; border: 1px solid rgba(255,138,138,0.25); }
.rs-verdict-pill.good { background: rgba(74,222,128,0.12); color: #4ade80; border: 1px solid rgba(74,222,128,0.25); }
.rs-verdict-pill.neutral { background: rgba(212,176,105,0.12); color: #d4b069; border: 1px solid rgba(212,176,105,0.25); }
.rs-verdict-pill.cool { background: rgba(122,162,255,0.12); color: #7aa2ff; border: 1px solid rgba(122,162,255,0.25); }

/* ── Bridge cards ────────────────────────────────────────────────────────── */
.rs-bridge {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}

.rs-bridge-card {
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 10px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
}
.rs-bridge-card:hover { border-color: #3a4a6e; background: #1a1d24; }
.rs-bridge-icon { font-family: 'DM Mono', monospace; font-size: 24px; color: #ff6b35; }
.rs-bridge-title { font-size: 14px; color: #fff; font-weight: 500; margin: 12px 0 4px; }

/* ── Bottom SEO / FAQ section ────────────────────────────────────────────── */
.rs-bottom {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  padding: 32px;
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 10px;
}

.rs-bottom p { font-size: 14px; color: #b8bbc2; line-height: 1.75; }
.rs-bottom p + p { margin-top: 14px; }
.rs-bottom details { padding: 14px 0; border-bottom: 1px solid #24272e; color: #b8bbc2; font-size: 13px; }
.rs-bottom details:last-child { border-bottom: none; }
.rs-bottom summary { cursor: pointer; color: #e6e7ea; }

/* ── Generic block ───────────────────────────────────────────────────────── */
.rs-block {
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 16px;
}

.rs-block-title {
  font-family: 'DM Sans', 'Instrument Serif', Georgia, serif;
  font-style: normal;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: #fff;
  margin: 0 0 4px;
  font-weight: 600;
}

.rs-block-sub {
  font-size: 12px;
  color: #8a8d94;
  margin-bottom: 16px;
}

/* ── Detail — ticker header ──────────────────────────────────────────────── */
.rs-thead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 12px;
  margin-bottom: 16px;
}

.rs-thead-tick {
  font-family: 'DM Mono', monospace;
  font-size: 32px;
  color: #fff;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.rs-thead-meta {
  display: flex;
  gap: 28px;
  font-size: 12px;
  color: #8a8d94;
}

.rs-thead-meta span strong {
  display: block;
  color: #fff;
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  margin-top: 2px;
}

/* ── Detail — verdict card ───────────────────────────────────────────────── */
.rs-verdict {
  background: linear-gradient(135deg, #1a1d24 0%, #1f1418 100%);
  border: 1px solid #5a3535;
  border-radius: 12px;
  padding: 32px 36px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 36px;
  align-items: start;
}
.rs-verdict-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rs-verdict-left .rs-verdict-archetype { margin-bottom: 0; }
.rs-verdict-left .rs-verdict-title { margin: 0; }
.rs-verdict-left .rs-verdict-body { margin: 0; }
.rs-verdict-left .rs-cta-row { margin-top: 8px; }
.rs-verdict-right {
  align-self: center;
}

.rs-verdict-archetype {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: #ffb88a;
  opacity: 0.7;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.rs-verdict-title {
  font-family: 'DM Sans', 'Instrument Serif', Georgia, serif;
  font-style: normal;
  font-size: 36px;
  letter-spacing: -0.02em;
  color: #ffb88a;
  margin: 0 0 16px;
  font-weight: 600;
  line-height: 1.15;
}

.rs-verdict-body {
  color: #e6e7ea;
  font-size: 15px;
  line-height: 1.7;
}

.rs-cta-row {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.rs-cta {
  background: #2a3450;
  color: #9bb5ff;
  border: 1px solid #3a4a6e;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  text-decoration: none;
}

/* Verdict pill variant applied to full verdict section */
.rs-verdict.pill-bad { border-color: #5a3535; }
.rs-verdict.pill-good { border-color: #1e4a33; background: linear-gradient(135deg, #1a1d24 0%, #141f18 100%); }
.rs-verdict.pill-neutral { border-color: #4a3d1e; background: linear-gradient(135deg, #1a1d24 0%, #1f1c14 100%); }
.rs-verdict.pill-cool { border-color: #1e2f5a; background: linear-gradient(135deg, #1a1d24 0%, #141828 100%); }

/* Verdict bars */
.rs-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: rgba(0,0,0,0.25);
  border-radius: 10px;
}

.rs-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.rs-bar-label { width: 110px; color: #b8bbc2; font-size: 13px; }
.rs-bar-track { flex: 1; height: 8px; background: #2a2d33; border-radius: 4px; overflow: hidden; }
.rs-bar-fill { height: 100%; border-radius: 4px; }
.rs-bar-value { width: 110px; text-align: right; font-family: 'DM Mono', monospace; font-size: 12px; color: #b8bbc2; }

/* ── Metric strip ────────────────────────────────────────────────────────── */
.rs-metric-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.rs-metric {
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 10px;
  padding: 22px;
}

.rs-metric-label {
  font-size: 11px;
  color: #8a8d94;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rs-metric-num {
  font-family: 'DM Mono', monospace;
  font-size: 32px;
  color: #fff;
  font-weight: 500;
  margin-top: 6px;
}
.rs-metric-num.up { color: #4ade80; }

/* ── Subreddit breakdown ─────────────────────────────────────────────────── */
.rs-sub-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  margin-bottom: 10px;
}

.rs-sub-name { width: 160px; color: #b8bbc2; font-family: 'DM Mono', monospace; }
.rs-sub-track { flex: 1; height: 6px; background: #2a2d33; border-radius: 3px; overflow: hidden; }
.rs-sub-fill { height: 100%; background: #ff6b35; border-radius: 3px; }
.rs-sub-pct { width: 50px; text-align: right; font-family: 'DM Mono', monospace; font-size: 12px; color: #8a8d94; }

/* ── Fundamentals grid ───────────────────────────────────────────────────── */
.rs-fund-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.rs-fund-card {
  background: #1a1d24;
  border: 1px solid #24272e;
  border-radius: 8px;
  padding: 18px;
}

.rs-fund-label {
  font-size: 10px;
  color: #8a8d94;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rs-fund-num {
  font-family: 'DM Mono', monospace;
  font-size: 28px;
  color: #fff;
  margin: 8px 0;
}

.rs-fund-link {
  display: block;
  margin-top: 10px;
  font-size: 11px;
  color: #7aa2ff;
  text-decoration: none;
  font-family: 'DM Mono', monospace;
}

/* ── Sidebar / related ───────────────────────────────────────────────────── */
.rs-side-title {
  font-family: 'DM Sans', 'Instrument Serif', Georgia, serif;
  font-style: normal;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: #fff;
  margin: 0 0 12px;
  font-weight: 600;
}

.rs-related {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rs-related li {
  padding: 9px 12px;
  background: #1a1d24;
  border-radius: 6px;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  color: #8a8d94;
}

.rs-related a {
  color: #fff;
  text-decoration: none;
}

/* ── Grid layout (detail page) ───────────────────────────────────────────── */
.rs-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  margin-bottom: 32px;
}

/* ── Responsive: tablet (768–1023px) ─────────────────────────────────────── */
@media (max-width: 1023px) and (min-width: 768px) {
  /* Tablet: drop Company column, narrow grid to 8 cols */
  .rs-row { grid-template-columns: 36px 80px 90px 80px 70px 80px 80px 110px; }
  .rs-row > div:nth-child(3) { display: none; }  /* Company name hidden */
}

/* ── Responsive: mobile (<768px) ─────────────────────────────────────────── */
@media (max-width: 767px) {
  .rs-page { padding: 20px 16px; }
  .rs-hero { grid-template-columns: 1fr; gap: 24px; }
  .rs-h1 { font-size: 36px; }
  .rs-hero-stats { grid-template-columns: 1fr 1fr; }
  .rs-bridge { grid-template-columns: 1fr 1fr; }
  .rs-bottom { grid-template-columns: 1fr; gap: 24px; }

  /* Leaderboard → card list */
  .rs-table { background: transparent; border: none; }
  /* Compact 4-row card per ticker:
       Row 1: rank · ticker (left) · verdict pill (right)
       Row 2: company name (full width, muted)
       Row 3: mentions · upvotes · 24h Δ      (Reddit-side signals)
       Row 4: PE · IV                          (fundamentals)
     Inline column labels via ::before { content: attr(data-mlabel) }
     give mobile readers the table-header context they lose without
     the column row. */
  .rs-row {
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-template-areas:
      "rank     tick     verdict"
      "name     name     name"
      "mentions upvotes  momentum"
      "pe       iv       .";
    gap: 6px 12px;
    padding: 14px 16px;
    background: #16181d;
    border-radius: 8px;
    margin-bottom: 8px;
    align-items: center;
  }
  .rs-row-head { display: none; }
  .rs-rank { grid-area: rank; font-size: 13px; }
  .rs-tick { grid-area: tick; font-size: 16px; }
  .rs-name { grid-area: name; font-size: 12px; color: #8a8d94; white-space: normal; }
  .rs-col-verdict { grid-area: verdict; justify-self: end; }
  .rs-col-mentions { grid-area: mentions; }
  .rs-col-upvotes  { grid-area: upvotes; }
  .rs-col-momentum { grid-area: momentum; }
  .rs-col-pe       { grid-area: pe; }
  .rs-col-iv       { grid-area: iv; }
  .rs-row .rs-num-r {
    text-align: left;
    font-size: 13px;
    justify-self: start;
  }
  .rs-row .rs-num-r::before {
    content: attr(data-mlabel) " ";
    color: #5e6168;
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 4px;
  }
  /* Restore mid-table breakpoint's hidden company-name reset since we want
     the name back on phones for context. */
  .rs-row > .rs-name { display: block; }

  /* Detail page mobile collapse */
  .rs-verdict { display: block; }
  .rs-bars { margin-top: 16px; }
  .rs-metric-strip { grid-template-columns: 1fr 1fr; }
  .rs-grid { grid-template-columns: 1fr; }
  .rs-fund-grid { grid-template-columns: 1fr; }
}
