/* ==================================================================
   scan.css — the daily scan board ("where should I look today"),
   app.neurostats.ai. Everything is scoped under .scan-* / #scan-*.
   The card reuses .demo, which keeps the dark instrument well (--well)
   in BOTH page themes — the same convention as the surface, replay and
   target cards — so in-card ink uses the same literal white alphas
   style.css already uses inside .demo; everything else rides the design
   tokens from style.css.
   ================================================================== */

/* ------------------------- the lens bar --------------------------- */
/* one child, so the bar is a plain flex row that wraps instead of
   overflowing; the chips are the whole control surface of this card */

.scan-bar { flex-wrap: wrap; row-gap: 10px; }

.scan-lenses {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.scan-lens {
  appearance: none;
  flex: 0 0 auto;
  cursor: pointer;
  background: transparent;
  color: rgba(245, 245, 247, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--mono);
  font-size: 12.5px; font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  padding: 7px 14px;
  border-radius: 999px;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out),
    background 0.2s var(--ease-out);
}
.scan-lens:hover {
  color: rgba(245, 245, 247, 0.92);
  border-color: rgba(255, 255, 255, 0.35);
}
.scan-lens[aria-pressed="true"] {
  background: rgba(245, 245, 247, 0.92);
  color: var(--well);
  border-color: transparent;
  font-weight: 600;
}

/* --------------------------- session head ------------------------- */

.scan-head {
  margin: 0;
  padding: 9px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(245, 245, 247, 0.42);
  font-variant-numeric: tabular-nums;
}
.scan-head:empty { display: none; }

/* ----------------------------- the board -------------------------- */

.scan-board { display: block; }

.scan-row {
  appearance: none;
  display: grid;
  width: 100%;
  margin: 0;
  padding: 13px 18px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 2px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  grid-template-columns:
    2.4em minmax(94px, 0.85fr) minmax(116px, 0.85fr) minmax(190px, 2.1fr) minmax(116px, 0.95fr);
  grid-template-areas: "rank sym big read spark";
  align-items: center;
  gap: 0 18px;
  transition: background 0.18s var(--ease-out), border-color 0.18s var(--ease-out);
}
.scan-row:last-child { border-bottom: 0; }
.scan-row:hover { background: rgba(255, 255, 255, 0.035); }

/* the member's own pick is amber — the same rule target.js follows, so a
   personal mark never reads as part of the cyan market-implied geometry */
.scan-row.is-picked {
  background: rgba(255, 209, 102, 0.07);
  border-left-color: var(--amber);
}
.scan-row.is-picked:hover { background: rgba(255, 209, 102, 0.1); }

.scan-row > * { min-width: 0; }

.scan-rank {
  grid-area: rank;
  font-family: var(--mono);
  font-size: 11px; font-weight: 500;
  color: rgba(245, 245, 247, 0.3);
  font-variant-numeric: tabular-nums;
}
.scan-row.is-picked .scan-rank { color: rgba(255, 224, 138, 0.6); }

.scan-id { grid-area: sym; }

.scan-sym {
  display: block;
  font-family: var(--mono);
  font-size: 14.5px; font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(245, 245, 247, 0.95);
}

.scan-meta {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 11px; font-weight: 500;
  color: rgba(245, 245, 247, 0.42);
  font-variant-numeric: tabular-nums;
}

/* the one big number: the answer to the active question, in its unit */
.scan-big { grid-area: big; }

.scan-num {
  display: block;
  font-family: var(--mono);
  font-size: clamp(22px, 2.5vw, 30px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: rgba(245, 245, 247, 0.97);
  font-variant-numeric: tabular-nums;
}

.scan-unit {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(245, 245, 247, 0.4);
}

.scan-read {
  grid-area: read;
  font-family: var(--mono);
  font-size: 12.5px; line-height: 1.5;
  color: rgba(245, 245, 247, 0.66);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.scan-row:hover .scan-read { color: rgba(245, 245, 247, 0.82); }

/* -------------------------- the sparkbar -------------------------- */

.scan-spark { grid-area: spark; }

.scan-spark-cvs {
  display: block;
  width: 100%;
  height: 26px;
}

.scan-spark-cap {
  display: block;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 9.5px; font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(245, 245, 247, 0.32);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------- footer / status strip --------------------- */

.scan-foot {
  padding: 12px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  text-align: center;
}

.scan-more {
  appearance: none;
  cursor: pointer;
  background: transparent;
  color: rgba(245, 245, 247, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-family: var(--mono);
  font-size: 12px; font-weight: 500;
  padding: 7px 16px;
  border-radius: 999px;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.scan-more:hover {
  color: rgba(245, 245, 247, 0.9);
  border-color: rgba(255, 255, 255, 0.35);
}

/* mirrors #surface-readout and .replay-verdict so the cards read as one kit */
.scan-status {
  margin: 0;
  min-height: 40px;
  padding: 10px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--mono);
  font-size: 12.5px; line-height: 1.5;
  color: rgba(245, 245, 247, 0.66);
  font-variant-numeric: tabular-nums;
}

/* -------------------------- focus rings --------------------------- */

.scan-lens:focus, .scan-row:focus, .scan-more:focus { outline: none; }
.scan-lens:focus-visible, .scan-more:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.scan-row:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -3px;
}

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

/* tablet: the sentence and the bar take their own lines, the number stays
   beside the symbol so the column of big numbers is still comparable */
@media (max-width: 980px) {
  .scan-row {
    grid-template-columns: 2.4em minmax(0, 1fr) minmax(112px, 0.8fr);
    grid-template-areas:
      "rank sym   big"
      "rank read  read"
      "rank spark spark";
    align-items: start;
    row-gap: 9px;
  }
  .scan-big { justify-self: end; text-align: right; }
}

/* phone: one column — the chips stop wrapping and scroll sideways instead,
   which keeps the bar one line tall however many questions exist */
@media (max-width: 620px) {
  .scan-lenses {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 5px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    width: 100%;
  }
  .scan-lens { scroll-snap-align: start; }
  .scan-lenses::-webkit-scrollbar { height: 3px; }
  .scan-lenses::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
  }

  .scan-row {
    padding: 14px 15px;
    grid-template-columns: 2.4em minmax(0, 1fr);
    grid-template-areas:
      "rank  sym"
      "big   big"
      "spark spark"
      "read  read";
    row-gap: 8px;
    column-gap: 12px;
  }
  .scan-big { justify-self: start; text-align: left; }
  .scan-head, .scan-status, .scan-foot { padding-left: 15px; padding-right: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .scan-lens, .scan-row, .scan-more { transition: none; }
}
