/* Las cajas de arriba de Presales (2026-11-03, en vivo;
   `templates/presales/_hero.html`). Prefijo `psh-`. Se apoya en las piezas
   de /markets (`mo-card`, `ms-cell`, `ms-lbl`, `ms-val`, `mc-*` de
   mkthover.js) y en las barras de la página (`ps2-kbar`, `ps2-bars`,
   `ps2-split`). Sólo tokens de color: se ve igual de bien en los dos temas.
   Quitarlas es borrar este fichero, la plantilla y `presales/hero.py`. */

.psh { display: grid; gap: var(--s3); margin-bottom: var(--s4); }

/* Lo de hoy: cuatro celdas en una caja, como «Market status». */
.psh-now { padding: var(--s2); }
.psh-cells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line);
  border-radius: 10px; overflow: hidden; }
.psh-cells .ms-cell { align-content: start; padding: var(--s2) var(--s3); }
.psh-cells .ms-lbl { flex-wrap: wrap; }
.psh-cells .ms-val small { font-weight: 500; }

/* La rejilla de las ocho cajas. */
.psh-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); align-items: stretch; }
.psh-w2 { grid-column: span 2; }
.psh-box { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.psh-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.psh-hd .mo-hd { font-size: var(--size-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
  font-weight: 600; }
.psh-ctl { display: inline-flex; gap: var(--s2); flex-wrap: wrap; }

/* Los selectores: botones pegados, como las sub-pestañas de la sección. */
.psh-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--line); }
.psh-seg button { font: inherit; font-size: var(--size-2xs); font-weight: 600; color: var(--text-muted); background: none;
  border: 0; border-radius: 6px; padding: 4px 8px; min-height: 24px; cursor: pointer; white-space: nowrap; }
.psh-seg button:hover { color: var(--text); }
.psh-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 12%); }
.psh-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.psh-pane { display: none; flex: 1; flex-direction: column; gap: var(--s2); min-width: 0; }
.psh-pane.on { display: flex; }
.psh-empty { margin: 0; font-size: var(--size-sm); }
.psh-foot { margin: auto 0 0; font-size: var(--size-2xs); color: var(--text-faint); line-height: 1.4; }
.psh-foot a { color: var(--text-muted); }
.psh-line { margin: 0; font-size: var(--size-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.warn-t { color: var(--warn); }

.psh-big { font-size: var(--size-xl); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15;
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; }
.psh-big small { font-size: var(--size-sm); font-weight: 500; color: var(--text-muted); }

/* Mejores y peores, una al lado de la otra. */
.psh-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2) var(--s4); }
.psh-col { display: grid; gap: 4px; align-content: start; min-width: 0; }
.psh-colhd { font-size: var(--size-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.psh-colhd.up { color: var(--up); }
.psh-colhd.down { color: var(--down); }

/* Una fila: logo, nombre con su línea, barra y cifra. */
.psh-rows { display: grid; gap: 2px; }
.psh-row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(48px, 28%) 4.6em; align-items: center;
  gap: var(--s2); padding: 4px 6px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none;
  min-height: 32px; }
.psh-grow, .psh-code { grid-template-columns: minmax(0, 1fr) minmax(48px, 26%) 4.6em; }
.psh-trip { grid-template-columns: auto minmax(0, 1fr) auto; }
.psh-news { grid-template-columns: auto minmax(0, 1fr) 4.6em; }
a.psh-row:hover, a.psh-row:focus-visible { background: var(--surface-hover); }
a.psh-row:hover b { color: var(--accent); }
.psh-nm { display: grid; min-width: 0; line-height: 1.25; }
.psh-nm b { font-size: var(--size-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.psh-nm small { font-size: var(--size-2xs); color: var(--text-faint); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-variant-numeric: tabular-nums; }
.psh-x, .psh-n, .psh-pk { font-size: var(--size-sm); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right;
  white-space: nowrap; }
.psh-x.up, .psh-pk .up { color: var(--up); }
.psh-x.down, .psh-pk .down { color: var(--down); }
.psh-pk { font-weight: 600; }

/* La barra desde el precio de la venta: la raya del medio es 1×. */
.psh-div { position: relative; height: 8px; border-radius: 4px; background: var(--surface-sunken); }
.psh-div::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-strong); }
.psh-div i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.psh-div i.up { background: var(--up-fill); }
.psh-div i.dn { background: var(--down); }

/* Barras de un tramo (avisos, sectores, lo que queda del máximo). */
.psh-track { display: block; height: 8px; border-radius: 4px; background: var(--surface-sunken); overflow: hidden; }
.psh-track i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.psh-track i.good { background: var(--up-fill); }
.psh-track i.bad { background: var(--danger); }
.psh-track i.warnish { background: var(--warn); }
.psh-track i.muted { background: var(--text-faint); }
.psh-ath i { background: color-mix(in srgb, var(--down) 70%, transparent); }

/* «Where buyers stand» y las semanas de las rondas: columnas. */
.psh-hist { display: flex; align-items: flex-end; gap: 4px; height: 96px; padding-top: 14px; flex: 1; min-height: 72px; }
.psh-hist > span { position: relative; flex: 1 1 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.psh-hist i { display: block; border-radius: 3px 3px 0 0; min-height: 2px; }
.psh-hist .bad i { background: var(--down); }
.psh-hist .good i { background: var(--up-fill); }
.psh-hist .acc i { background: var(--accent); }
.psh-hist em { font-style: normal; font-size: var(--size-2xs); color: var(--text-muted); text-align: center;
  font-variant-numeric: tabular-nums; pointer-events: none; margin-bottom: 2px; }
.psh-hist-k { display: flex; gap: 4px; }
.psh-hist-k span { flex: 1 1 0; min-width: 0; font-size: 10px; line-height: 1.2; color: var(--text-faint); text-align: center; }
.psh-wk { height: 84px; padding-top: 0; }
.psh-wk-k { justify-content: space-between; }
.psh-wk-k span { flex: none; }

/* «Gains handed back»: dos medidores. */
.psh-meter { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px var(--s2); align-items: baseline; font-size: var(--size-sm); }
.psh-meter > span:first-child { color: var(--text-muted); }
.psh-meter b { font-size: var(--size-lg); font-variant-numeric: tabular-nums; }
.psh-meter .psh-track { grid-column: 1 / -1; height: 10px; }

/* «In our news or not»: dos columnas frente a frente. */
.psh-vs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.psh-vs-c { display: grid; gap: 4px; align-content: start; min-width: 0; }
.psh-vs-c small { font-size: var(--size-2xs); }

@media (max-width: 1100px) {
  .psh-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .psh-cells { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .psh-grid { grid-template-columns: minmax(0, 1fr); }
  .psh-w2 { grid-column: auto; }
  .psh-two { grid-template-columns: minmax(0, 1fr); }
  .psh-cells .ms-val { font-size: var(--size-md); }
  .psh-cells .ms-cell { padding: var(--s2); }
  .psh-row { grid-template-columns: auto minmax(0, 1fr) minmax(44px, 26%) 4.2em; gap: 6px; }
  .psh-grow, .psh-code { grid-template-columns: minmax(0, 1fr) minmax(44px, 30%) 4.2em; }
  .psh-hd { align-items: flex-start; }
  .psh-seg button { padding: 6px 8px; min-height: 28px; }
}
