/* The public /trading-psychology page.
 *
 * Loads after trades-page.css and portfolio-page.css and adds only what this
 * page needs.
 *
 * The page argues that a thin sample should look thin, so the styling has to
 * carry that rather than contradict it: a weak point is hollow with a dashed
 * segment, a gap is a break in the line, and the sample chips read as
 * cautions. None of it relies on colour alone — every state has a shape or a
 * word as well, because a reader who cannot separate red from green still has
 * to be able to tell an early signal from a settled one.
 */

/* ---- the ten tags -------------------------------------------------------- */

.py-tag-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.py-tag-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.py-tag-head {
  font-size: 11px;
  font-weight: 620;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.py-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.py-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-size: 12.5px;
  border-radius: 999px;
  border: .5px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text-secondary);
  white-space: nowrap;
}

.py-tag svg { flex: none; opacity: .65; }

/* A habit and a risk behaviour are not the same claim, so they do not look
   the same. The border carries it, not the text colour. */
.py-tag.is-good { border-color: color-mix(in srgb, var(--green) 45%, var(--border-strong)); }
.py-tag.is-risk { border-color: color-mix(in srgb, var(--red) 40%, var(--border-strong)); }

/* ---- the four populations ------------------------------------------------ */

.py-pop {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.py-pop li {
  display: grid;
  grid-template-columns: 72px minmax(120px, auto) minmax(0, 1fr);
  align-items: baseline;
  gap: 4px 14px;
  padding: 11px 14px;
  border: .5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  min-width: 0;
}

/* The population every share is actually counted from. Marked, because the
   section exists to say which one it is. */
.py-pop li.is-used {
  border-color: color-mix(in srgb, var(--cyan) 55%, var(--border));
  background: color-mix(in srgb, var(--cyan) 7%, var(--surface-raised));
}

.py-pop-n {
  font-size: 17px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: end;
}

.py-pop-label { font-size: 13px; font-weight: 600; }

.py-pop-note {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ---- the trend ----------------------------------------------------------- */

.py-trend { display: flex; flex-direction: column; gap: 14px; }

/* The chart reads left to right in every language: it is a time axis, and
   time does not mirror. */
.py-spark {
  width: 100%;
  height: 76px;
  direction: ltr;
  overflow: visible;
}

.py-spark line {
  stroke: var(--cyan);
  stroke-width: 2;
  stroke-linecap: round;
}

/* Under five trades behind a point, the segment into it is dashed and the
   point is hollow — the sample is visible before the value is read. */
.py-spark line.is-thin {
  stroke-dasharray: 4 4;
  opacity: .55;
}

.py-spark circle {
  fill: var(--cyan);
  stroke: var(--cyan);
  stroke-width: 2;
}

.py-spark circle.is-thin {
  fill: var(--surface-raised);
  opacity: .8;
}

.py-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.py-legend li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-muted);
}

.py-key {
  flex: none;
  width: 18px;
  height: 10px;
  margin-top: 4px;
  border-radius: 2px;
}

.py-key.is-gap {
  border-top: 2px dotted var(--text-muted);
  height: 2px;
  margin-top: 8px;
}

.py-key.is-thin {
  border: 2px dashed color-mix(in srgb, var(--cyan) 70%, transparent);
  height: 2px;
  border-bottom: 0;
  border-inline: 0;
  margin-top: 8px;
}

.py-key.is-widen {
  background: linear-gradient(to right, var(--cyan) 0 4px, transparent 4px 6px, var(--cyan) 6px 13px, transparent 13px 15px, var(--cyan) 15px);
  height: 3px;
  margin-top: 7px;
}

.py-chips { display: flex; flex-wrap: wrap; gap: 7px; }

.py-chip {
  font-size: 10.5px;
  padding: 2px 9px;
  border-radius: 999px;
  border: .5px solid var(--border-strong);
  color: var(--text-muted);
  white-space: nowrap;
}

.py-chip.is-low { border-color: color-mix(in srgb, var(--red) 40%, var(--border-strong)); }
.py-chip.is-mid { border-color: color-mix(in srgb, var(--amber, var(--yellow, #F4B740)) 45%, var(--border-strong)); }

/* ---- patterns you did not tag -------------------------------------------- */

/* The worst state is named in the row, not only tinted. */
.py-worst-tag {
  display: inline-block;
  margin-inline-start: 6px;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  border: .5px solid color-mix(in srgb, var(--red) 45%, var(--border-strong));
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- plan followed ------------------------------------------------------- */

.py-plan {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.py-plan-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 14px;
  border: .5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  min-width: 0;
}

.py-plan-cell span { font-size: 11px; color: var(--text-secondary); }
.py-plan-cell b { font-size: 18px; font-weight: 640; overflow-wrap: anywhere; }

/* "Not set" is neither an answer nor a failure, so it reads as neither. */
.py-plan-cell.is-muted { border-style: dashed; }
.py-plan-cell.is-muted b { color: var(--text-muted); }

@media (max-width: 640px) {
  .py-pop li { grid-template-columns: 60px minmax(0, 1fr); }
  .py-pop-note { grid-column: 1 / -1; }
}
