/* best_ai_stocks.css — styles for /picks/best-ai-stocks (hub + archetype pages).
   Class prefix: bas- (Best Ai Stocks).
   Adapted from prototype at .superpowers/brainstorm/1788-1778232555/content/mockup-prod-v4.html.
   Depends on: DM Sans / DM Mono / Instrument Serif fonts + aim-nav.css (loaded by template).
*/

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #0a0b0e;
  color: #e6e7ea;
  font-family: "DM Sans", "Noto Sans SC", -apple-system, system-ui, sans-serif;
  min-height: 100vh;
}

.bas-page {
  background: #0e0f12;
  color: #e6e7ea;
  padding: 40px 56px;
  max-width: 1280px;
  margin: 0 auto;
}

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

/* ── Hero ───────────────────────────────────────────── */
.bas-hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 32px;
  border-bottom: 1px solid #24272e;
}
.bas-h1 {
  font-family: 'DM Sans', Georgia, serif;
  font-size: 56px;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 14px;
  color: #fff;
  font-weight: 600;
}
.bas-h1 em {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  color: #ff6b35;
  font-weight: 400;
}
.bas-lede {
  font-size: 16px;
  color: #b8bbc2;
  line-height: 1.65;
  max-width: 540px;
}
.bas-lede strong { color: #ff6b35; font-weight: 600; }
.bas-hero-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.bas-hero-stat { background: #16181d; border: 1px solid #24272e; border-radius: 10px; padding: 18px 20px; }
.bas-hero-num { font-family: 'DM Mono', ui-monospace, monospace; font-size: 28px; color: #fff; font-weight: 500; line-height: 1.1; }
.bas-hero-label { font-size: 11px; color: #8a8d94; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 6px; }

/* ── TOC ────────────────────────────────────────────── */
.bas-toc {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
  padding: 12px 18px;
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
}
.bas-toc-label { font-size: 11px; color: #8a8d94; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.bas-toc-links { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.bas-toc-links::-webkit-scrollbar { display: none; }
.bas-toc-link {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 6px 10px;
  background: #1a1d24;
  border: 1px solid #24272e;
  border-radius: 6px;
  color: #b8bbc2;
  text-decoration: none;
  white-space: nowrap;
}
.bas-toc-link:hover { background: #2a3450; color: #9bb5ff; border-color: #3a4a6e; }
.bas-toc-link .num { color: #ff6b35; margin-right: 6px; }

/* ── Filter row ─────────────────────────────────────── */
.bas-filter-row {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 22px;
  padding: 14px 18px;
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 10px;
}
.bas-filter-label { font-size: 11px; color: #8a8d94; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.bas-filters { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.bas-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;
  white-space: nowrap;
}
.bas-filter.on { background: #2a3450; color: #9bb5ff; border-color: #3a4a6e; }
.bas-filter .count { color: #5e6168; margin-left: 4px; }

/* ── Why ────────────────────────────────────────────── */
.bas-why {
  background: #16181d;
  border: 1px solid #24272e;
  border-left: 3px solid #ff6b35;
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 26px;
  font-size: 14px;
  line-height: 1.65;
  color: #b8bbc2;
}
.bas-why strong { color: #fff; font-weight: 600; }

/* ── Verdict criteria block (NEW in v4) ─────────────── */
.bas-criteria-wrap {
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 10px;
  padding: 24px 26px;
  margin-bottom: 24px;
}
.bas-criteria-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}
.bas-criteria-head h2 {
  font-family: 'DM Sans', Georgia, serif;
  font-size: 22px;
  color: #fff;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.bas-criteria-head .sub {
  font-size: 12px;
  color: #8a8d94;
}
.bas-criteria-grid {
  display: grid;
  gap: 10px;
}
.bas-crit {
  display: grid;
  grid-template-columns: 180px 1fr 1.4fr;
  gap: 18px;
  align-items: center;
  padding: 14px 16px;
  background: #1a1d24;
  border: 1px solid #1f2127;
  border-radius: 8px;
}
.bas-crit-pill { display: flex; }
.bas-crit-pill .bas-verdict-pill { font-size: 11px; padding: 5px 12px; }
.bas-crit-formula {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: #b8bbc2;
  line-height: 1.55;
}
.bas-crit-formula .op { color: #5e6168; }
.bas-crit-formula .num { color: #fff; }
.bas-crit-meaning {
  font-size: 13px;
  color: #b8bbc2;
  line-height: 1.55;
}
.bas-crit-meaning .ex {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: #5e6168;
  margin-top: 4px;
}
.bas-crit-meaning .ex strong { color: #8a8d94; font-weight: 500; }

/* ── Layer block ────────────────────────────────────── */
.bas-layer {
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  scroll-margin-top: 80px;
}
.bas-layer-head {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid #1f2127;
  background: #12141a;
}
.bas-layer-num { font-family: 'DM Mono', monospace; font-size: 12px; color: #ff6b35; letter-spacing: 0.08em; }
.bas-layer-name {
  display: block;
  font-family: 'DM Sans', Georgia, serif;
  font-size: 18px;
  color: #fff;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0;
}
.bas-layer-thesis {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: #8a8d94;
  margin-top: 2px;
}
.bas-layer-count { font-family: 'DM Mono', monospace; font-size: 11px; color: #8a8d94; }

/* ── Ticker rows (7 cols, no price/sparkline) ───────── */
.bas-trow {
  display: grid;
  grid-template-columns: 80px 1fr 80px 80px 70px 180px;
  gap: 14px;
  align-items: center;
  padding: 13px 22px;
  border-bottom: 1px solid #1f2127;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.bas-trow:last-child { border-bottom: none; }
.bas-trow:hover { background: #1a1d24; }
.bas-trow-head {
  background: #14161b;
  color: #5e6168;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 9px 22px;
  cursor: default;
}
.bas-trow-head:hover { background: #14161b; }
.bas-trow-head > span:nth-child(n+3):nth-child(-n+5) { text-align: right; }

.bas-tick { font-family: 'DM Mono', monospace; font-size: 15px; color: #fff; font-weight: 500; letter-spacing: 0.02em; }
.bas-name { font-size: 13px; color: #b8bbc2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bas-num { font-family: 'DM Mono', monospace; font-size: 13px; color: #fff; text-align: right; }
.bas-num.up { color: #4ade80; }
.bas-num.down { color: #ff8a8a; }
.bas-num.muted { color: #8a8d94; }
/* Semantic label badge for cells where the metric is intentionally
   inapplicable (loss-makers' PE, distorted PE etc). Reads as a small
   muted tag instead of a bare "—" so the page looks intentional. */
.bas-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;
}

/* ── Verdict pill ───────────────────────────────────── */
.bas-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;
  display: inline-block;
}
.bas-verdict-pill.bad     { background: rgba(255,138,138,0.12); color: #ff8a8a; border: 1px solid rgba(255,138,138,0.25); }
.bas-verdict-pill.good    { background: rgba(74,222,128,0.12);  color: #4ade80; border: 1px solid rgba(74,222,128,0.25); }
.bas-verdict-pill.neutral { background: rgba(212,176,105,0.12); color: #d4b069; border: 1px solid rgba(212,176,105,0.25); }
.bas-verdict-pill.cool    { background: rgba(122,162,255,0.12); color: #7aa2ff; border: 1px solid rgba(122,162,255,0.25); }
.bas-verdict-pill.trap    { background: rgba(190,90,140,0.14);  color: #d97aa8; border: 1px solid rgba(190,90,140,0.30); }
.bas-verdict-pill.muted   { background: rgba(138,141,148,0.10); color: #a8acb4; border: 1px solid rgba(138,141,148,0.22); }

/* ── Bottom ─────────────────────────────────────────── */
.bas-bottom {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  padding: 32px;
  background: #16181d;
  border: 1px solid #24272e;
  border-radius: 10px;
  margin-top: 36px;
}
.bas-bottom h3 { font-family: 'DM Sans', Georgia, serif; font-size: 18px; color: #fff; margin: 0 0 12px; font-weight: 600; }
.bas-bottom p { font-size: 14px; color: #b8bbc2; line-height: 1.75; margin: 0 0 12px; }
.bas-bottom details { padding: 12px 0; border-bottom: 1px solid #24272e; color: #b8bbc2; font-size: 13px; }
.bas-bottom details:last-child { border-bottom: none; }
.bas-bottom summary { cursor: pointer; color: #e6e7ea; font-weight: 500; }
.bas-bottom summary + p { margin-top: 8px; padding-left: 4px; }

.bas-foot {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #5e6168;
  font-family: 'DM Mono', monospace;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #24272e;
}
.bas-foot a { color: #7aa2ff; text-decoration: none; }

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

  /* Layer table → compact 3-row card per ticker.
     Row 1: ticker (left) + verdict pill (right)
     Row 2: company name (full width, muted)
     Row 3: AI % · PE %ile · IV (inline, with prefix labels via data-mlabel) */
  .bas-trow {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "tick    .       verdict"
      "name    name    name"
      "metrics metrics metrics";
    gap: 6px 10px;
    padding: 14px 16px;
    align-items: center;
  }
  .bas-trow-head { display: none; }

  .bas-tick { grid-area: tick; font-size: 16px; }
  .bas-name { grid-area: name; font-size: 12px; color: #8a8d94; }
  .bas-col-verdict { grid-area: verdict; justify-self: end; }

  /* Pack the 3 metrics into a single row inside the "metrics" grid area
     using a nested flex via display:contents trick — each .bas-col-*
     becomes its own grid cell within row 3, then we let the auto-cols
     align them left. */
  .bas-col-ai, .bas-col-pe, .bas-col-iv {
    grid-row: 3;
    text-align: left;
    font-size: 13px;
  }
  .bas-col-ai { grid-column: 1; }
  .bas-col-pe { grid-column: 2; justify-self: start; padding-left: 2px; }
  .bas-col-iv { grid-column: 3; justify-self: start; padding-left: 2px; }

  /* Inline column prefix labels — gives mobile readers context that the
     desktop column header provides. data-mlabel is on the cell span. */
  .bas-col-ai::before,
  .bas-col-pe::before,
  .bas-col-iv::before {
    content: attr(data-mlabel) " ";
    color: #5e6168;
    font-weight: 400;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 4px;
  }

  /* Criteria block stack */
  .bas-crit { grid-template-columns: 1fr; gap: 10px; }

  /* TOC scrolls horizontally already via overflow-x */
  .bas-bottom { grid-template-columns: 1fr; }
}
