/* Shared by the data pages (the moving-average screener, Reddit's most-mentioned
   stocks): a branded header band, a scoreboard of four counts and a bar, and the
   bars drawn inside table rows. Tones: loss (red), warn (amber), gain (green),
   mute (grey). */

/* The header block: tight, so the table starts higher on the screen. The intro
   runs the width of the page instead of a narrow column. */
.dp-head {
  gap: 0.5rem;
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  /* Your candlestick tile behind the title, so the page opens with the brand's texture. */
  background: url("/assets/scout-background-tile-05d5b292.png") center / 520px repeat;
}

/* The band is always a light card, like the sign-up stage, so the tile, the dark
   title and the black Scout read the same in the light and dark themes. */
.dp-head {
  color-scheme: light;
  color: #0b0f0c;
}

.dp-head .tl-hero__title,
.dp-head .tl-board__answer {
  color: #0b0f0c;
}

.dp-head .tl-hero__lead,
.dp-head .tl-board__updated {
  color: #5b655d;
}

.dp-head a {
  color: #2f7a35;
}

.dp-head a.is-active {
  color: #3f1f7a;
}

.dp-head .tl-hero__lead {
  max-width: 62em;
}

.dp-head .tl-board__answer {
  margin: 0.25rem 0 0;
}

.dp-head .tl-portfolio__title {
  letter-spacing: -0.03em;
}

/* The scoreboard: four numbers and a bar for where everything sits. */
.dp-score {
  display: grid;
  gap: 0.6rem;
}

.dp-score__tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
}

.dp-score__tile {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-radius: 14px;
  background: var(--surface, rgba(255, 255, 255, 0.04));
}

.dp-score__tile strong {
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.dp-score__tile span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.dp-score__tile--loss { border-left-color: var(--loss); }
.dp-score__tile--loss strong { color: var(--loss); }
.dp-score__tile--warn { border-left-color: #d9a21b; }
.dp-score__tile--gain { border-left-color: var(--gain); }
.dp-score__tile--gain strong { color: var(--gain); }
.dp-score__tile--info { border-left-color: #5b6fd6; }
.dp-score__tile--info strong { color: #5b6fd6; }
.dp-score__tile--smart { border-left-color: #0f766e; }
.dp-score__tile--smart strong { color: #0f766e; }
.dp-score__tile--mute { border-left-color: var(--border); }
.dp-score__tile--mute strong { color: var(--muted); }

.dp-score__bar {
  display: flex;
  gap: 3px;
  height: 0.7rem;
  overflow: hidden;
  border-radius: 999px;
}

.dp-score__seg {
  flex-basis: 0;
  min-width: 0;
}

.dp-score__seg--loss { background: var(--loss); }
.dp-score__seg--warn { background: #d9a21b; }
.dp-score__seg--gain { background: var(--gain); }

/* A bar inside a table cell. Two-sided: it runs left of a centre line for a loss
   and right of it for a gain; the view sets the width as a share of that half.
   --one fills from the left edge instead, for a plain size (mentions). */
.dp-bar {
  position: relative;
  display: inline-block;
  width: 9rem;
  height: 0.55rem;
  margin-left: 0.6rem;
  vertical-align: middle;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 55%, transparent);
}

.dp-bar::before {
  content: "";
  position: absolute;
  inset: -0.15rem auto -0.15rem 50%;
  width: 1px;
  background: var(--muted);
  opacity: 0.6;
}

.dp-bar > span {
  position: absolute;
  top: 0;
  bottom: 0;
  max-width: 50%;
  border-radius: 999px;
}

.dp-bar--loss > span {
  right: 50%;
  background: var(--loss);
}

.dp-bar--gain > span {
  left: 50%;
  background: var(--gain);
}

.dp-bar--one::before {
  display: none;
}

.dp-bar--one > span {
  left: 0;
  max-width: 100%;
  background: var(--gain);
}

/* Row washes: a soft tint and an accent edge. */
.tl-board__row.dp-row--loss {
  background: color-mix(in srgb, var(--loss) 9%, transparent);
  box-shadow: inset 4px 0 0 var(--loss);
}

.tl-board__row.dp-row--gain {
  background: color-mix(in srgb, var(--gain) 9%, transparent);
  box-shadow: inset 4px 0 0 var(--gain);
}

/* A small tag beside a ticker, in the tone of the row it marks. */
.dp-pill {
  margin-left: 0.5rem;
  padding: 0.05rem 0.4rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.dp-pill--info { color: #5b6fd6; }
.dp-pill--gain { color: var(--gain); }
.dp-pill--loss { color: var(--loss); }

/* Room for the accent edge of a washed row, so it doesn't cover the rank. */
.tl-board--dp .tl-board__rank {
  padding-left: 0.9rem;
}

/* Mentions: the number, then a bar that lines up in every row. */
.tl-buzz__mentions {
  white-space: nowrap;
}

.tl-buzz__mentions .dp-bar {
  width: 6rem;
}

/* A header with art: the text on the left, the illustration on the right. The
   art is dropped on narrow screens so it doesn't squeeze the title. */
.dp-head--art {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 1rem 1.5rem;
}

.dp-head__text {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
}

.dp-head .dp-head__art {
  display: none;
}

@media (min-width: 56rem) {
  .dp-head--art {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  /* .dp-head for specificity: this sheet loads before the site's .scout-img
     (height: auto), which would otherwise win. */
  .dp-head .dp-head__art {
    display: block;
    width: auto;
    height: 11rem;
    max-width: 26rem;
  }
}

/* A small picture in a scoreboard tile, on its own light backdrop because the
   art is drawn in black and the tiles go dark with the theme. */
.dp-score .dp-score__art {
  align-self: center;
  width: 3.4rem;
  height: 3.4rem;
  margin: -0.2rem -0.4rem -0.2rem auto;
  padding: 0.2rem;
  border-radius: 12px;
  background: #f4f7f2;
}

/* A data page opens on a header band, so the page itself gets less air: a short
   top padding, tighter gaps between sections, and the width the sidebar leaves
   (the default column is narrow, leaving empty strips down both sides). */
main.tl:has(.dp-head) {
  max-width: 76rem;
  padding-top: 1rem;
  gap: 1.5rem;
}

/* The slim sign-up bar above a page's title: a line of text, then the form on one
   row (a daily/weekly choice if there is one, the email field and the button). */
.dp-signup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface, rgba(255, 255, 255, 0.04));
}

.dp-signup__text {
  margin: 0;
  flex: 1 1 14rem;
  max-width: 26rem;
  font-size: 0.95rem;
}

.dp-signup .tl-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  flex: 2 1 28rem;
  max-width: 46rem;
  margin: 0;
}

.dp-signup .tl-form__row {
  flex: 1 1 18rem;
}

.dp-signup .tl-form__frequency {
  flex: 0 0 auto;
  margin: 0;
}

/* The email field and the choice keep their labels for screen readers, without a
   visible line above the bar. */
.dp-signup .tl-form__label,
.dp-signup .tl-form__frequency legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The screener's best leads: stocks under their average that Congress or funds
   have recently bought, as a row of chips above the table. */
.ma-picks {
  display: grid;
  gap: 0.75rem;
}

.ma-picks .tl-section-title {
  margin: 0;
}

.ma-picks__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ma-picks__item {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.5rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-left: 4px solid #0f766e;
  border-radius: 12px;
  background: var(--surface, rgba(255, 255, 255, 0.04));
}

.ma-picks__item .dp-pill {
  margin-left: 0;
}

/* Two tabs above the screener's scoreboard: which list the page is showing. */
.ma-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ma-tabs__tab {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}

.ma-tabs__tab.is-active {
  border-color: #2f7a35;
  background: #2f7a35;
  color: #fff;
}

/* One row under a header's answer: when it was updated, and the links onward. */
.dp-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.5rem;
}

.dp-meta .tl-board__updated {
  margin: 0;
}

/* A wide banner as a band's art (the Congress header): a fixed width rather than a height. */
@media (min-width: 56rem) {
  .dp-head .dp-head__art--wide {
    width: 24rem;
    height: auto;
  }
}

/* Phones. A grid item won't shrink below its content, so a wide table made the
   whole page wider than the screen; let every part shrink, and turn the tables
   into stacked cards (each cell carries a data-label saying what it is). The
   older phone layout in trader_trades.css (a compact grid with its own labels)
   still applies to .tl-board, so these rules are prefixed to win over it. */
main.tl:has(.dp-head),
main.tl:has(.dp-head) > * {
  min-width: 0;
}

@media (max-width: 40rem) {
  main.tl:has(.dp-head) {
    padding-inline: 0.75rem;
    gap: 1rem;
  }

  .dp-head {
    padding: 1rem;
  }

  .dp-signup .tl-form__row {
    flex-wrap: wrap;
  }

  .dp-signup .tl-form__email {
    flex: 1 1 10rem;
    min-width: 0;
  }

  /* The choice may use the whole row and wrap, instead of running off the edge. */
  .dp-signup .tl-form__frequency {
    flex: 1 1 100%;
  }

  main.tl .tl-board--dp,
  main.tl .tl-board--dp tbody {
    display: block;
  }

  main.tl .tl-board--dp thead {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  main.tl .tl-board--dp tbody tr.tl-board__row {
    display: block;
    position: relative;
    margin: 0 0 0.6rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface, rgba(255, 255, 255, 0.03));
  }

  main.tl .tl-board--dp tbody th[scope="row"] {
    display: block;
    padding: 0 2.5rem 0.35rem 0;
    border: 0;
    font-size: 1.05rem;
  }

  main.tl .tl-board--dp td {
    display: block;
    padding: 0.2rem 0;
    border: 0;
    font-size: 0.95rem;
    text-align: left;
  }

  main.tl .tl-board--dp td::before {
    content: attr(data-label);
    display: inline-block;
    width: 8.5rem;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
  }

  main.tl .tl-board--dp td::after {
    content: none;
  }

  /* The rank sits in the card's corner as "#3" instead of taking a row. */
  main.tl .tl-board--dp td.tl-board__rank {
    position: absolute;
    top: 0.7rem;
    right: 0.9rem;
    padding: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--muted);
  }

  main.tl .tl-board--dp td.tl-board__rank::before {
    content: "#";
    width: auto;
    font-size: inherit;
  }

  main.tl .tl-board--dp .dp-bar {
    width: 5.5rem;
  }
}

/* The teal and purple accents are chosen for a light card; lighten them on the
   dark theme (dark is anything but an explicit light) so the numbers stay legible. */
:root:not([data-theme="light"]) .dp-score__tile--smart strong,
:root:not([data-theme="light"]) .ma-picks__item .dp-pill--info { color: #2dd4bf; }

:root:not([data-theme="light"]) .dp-score__tile--info strong,
:root:not([data-theme="light"]) .dp-pill--info { color: #93a3f5; }

:root:not([data-theme="light"]) .dp-score__tile--smart,
:root:not([data-theme="light"]) .ma-picks__item { border-left-color: #2dd4bf; }

/* Sortable headers: links that look like headings, the active one in bold with its
   arrow; and the header stays under the top bar while a long table scrolls. */
.dp-sort {
  color: inherit;
  text-decoration: none;
}

.dp-sort:hover {
  text-decoration: underline;
}

.dp-sort.is-active {
  font-weight: 700;
}

@media (min-width: 40.01rem) {
  .tl-board--dp thead th {
    position: sticky;
    top: 3.1rem;
    z-index: 5;
    background: var(--bg);
  }
}

/* Sparklines: a small line in a table row, coloured by tone. The marker is a dashed
   reference level, such as the moving average the stock is measured against. */
.dp-spark {
  width: 6rem;
  height: 1.75rem;
  vertical-align: middle;
  overflow: visible;
}

.dp-spark polyline {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.dp-spark--gain { color: var(--gain); }
.dp-spark--loss { color: var(--loss); }

.dp-spark__marker {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.7;
}

/* Signed-out preview of a leaderboard: made-up rows, blurred, under a sign-in card. */
.dp-locked { position: relative; }
.dp-locked__blur { filter: blur(6px); user-select: none; pointer-events: none; }
.dp-locked__card {
  position: absolute; top: 62%; left: 50%; transform: translate(-50%, -40%);
  width: min(92%, 26rem); padding: 1.25rem; text-align: center;
  background: var(--surface, #fff); border: 1px solid var(--border, #d9dde3);
  border-radius: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.15);
}
.dp-locked__title { margin: 0 0 .4rem; font-weight: 700; font-size: 1.1rem; }
.dp-locked__text { margin: .4rem 0; font-size: .95rem; }
.dp-locked__button {
  display: inline-block; margin: .5rem 0; padding: .65rem 1.1rem; border-radius: 8px;
  background: var(--accent, #1a56db); color: #fff; font-weight: 600; text-decoration: none;
}
