/*
 * Il box delle offerte (plugin 2.5.0, 12 novembre 2026).
 *
 * Il disegno del prototipo approvato da Enzo il 12/11 ("Ok va bene"): nome corto e riga, un
 * bollino solo sopra il prezzo, lo sconto in etichetta, e in fondo una striscia col voto, la sua
 * parola e il negozio. Misure e soglie copiate da
 * docs/superpowers/prototipi/box-e-scheda-2026-11-12/proto.tpl.html.
 *
 * Regge da 139 px (due colonne su un telefono da 320) a 362 px: niente esce e niente si taglia.
 * La striscia e' una griglia: anello, parola con sotto il negozio, e l'ora solo se c'e' posto.
 *
 * Ogni regola comincia da `.bx` e ogni classe ha il prefisso `bx-`: il 12/11 una classe `.buono`
 * di un altro pezzo ha rotto i bollini. I colori stanno tutti qui (`--bx-...`), perche' il box
 * vive anche fuori dalla pagina /offerte/. Dentro, ogni pezzo scrive il suo colore, la sua
 * misura e la sua interlinea, e i selettori hanno due classi: la pagina e il tema danno stili a
 * article, h3, p, a e button, e con una classe sola vincerebbero loro.
 *
 * Solo ASCII fuori dai commenti: LiteSpeed unisce i fogli senza dichiarare la codifica.
 */

.bx {
  --bx-carta: #ffffff; --bx-carta-2: #f8f9fb; --bx-foto: #f4f5f7;
  --bx-bordo: #e3e6ec; --bx-bordo-forte: #ccd1da; --bx-traccia: #e8ebf0;
  --bx-testo: #12141c; --bx-testo-2: #586070; --bx-testo-3: #6b7280;
  --bx-arancio: #ff7a1a; --bx-arancio-testo: #b04b00; --bx-arancio-fondo: #fff0e2;
  --bx-verde: #05703f; --bx-verde-fondo: #e2f5eb; --bx-verde-velo: #f1f8f4;
  --bx-pieno: #05703f; --bx-pieno-testo: #ffffff; --bx-pieno-testo-2: #d3eee0;
  --bx-voto-onesta: #aab2c0; --bx-voto-buona: #7fcaae; --bx-voto-ottima: #3fbd88;
  --bx-tempo-fondo: #fdecea; --bx-tempo-testo: #b42318;
  --bx-oro: #f5c451; --bx-inchiostro: #12141c;
  --bx-ombra: 0 1px 2px rgba(18, 20, 28, .05), 0 18px 36px -24px rgba(18, 20, 28, .35);
  --bx-f-titoli: "Funnel Display", "Funnel Sans", system-ui, sans-serif;
  --bx-f-testo: "Funnel Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bx-striscia: var(--bx-carta-2); --bx-parola: var(--bx-testo);
  --bx-anello: var(--bx-voto-onesta); --bx-anello-fondo: var(--bx-traccia); --bx-anello-testo: var(--bx-testo);
  container: bx / inline-size;
  position: relative; display: flex; flex-direction: column; box-sizing: border-box; min-width: 0; margin: 0; padding: 0;
  background: var(--bx-carta); border: 1px solid var(--bx-bordo); border-radius: 16px; overflow: hidden; cursor: pointer;
  color: var(--bx-testo); font-family: var(--bx-f-testo); font-size: 16px; line-height: 1.5; text-align: left;
  transition: transform .2s cubic-bezier(.2, .7, .2, 1), box-shadow .2s, border-color .2s;
}
html[data-tema="scuro"] .bx {
  --bx-carta: #171a23; --bx-carta-2: #1d2029; --bx-foto: #eef0f4;
  --bx-bordo: #2c3140; --bx-bordo-forte: #3b4152; --bx-traccia: #262a36;
  --bx-testo: #eef0f5; --bx-testo-2: #a8afbe; --bx-testo-3: #8b93a3;
  --bx-arancio-testo: #ffb27a; --bx-arancio-fondo: #3a2414;
  --bx-verde: #4fd08f; --bx-verde-fondo: #12301f; --bx-verde-velo: #14231c;
  --bx-pieno: #15b36c; --bx-pieno-testo: #06180f; --bx-pieno-testo-2: #0b3a22;
  --bx-voto-onesta: #7d8698; --bx-voto-buona: #5fae93;
  --bx-tempo-fondo: #3a1715; --bx-tempo-testo: #ff8a80;
  --bx-ombra: 0 1px 2px rgba(0, 0, 0, .4), 0 18px 36px -24px rgba(0, 0, 0, .8);
}
.bx *, .bx *::before, .bx *::after { box-sizing: border-box; }
/* Le schede di riserva escono nascoste (righe.js le scopre se servono): un flex ignorerebbe `hidden`. */
.bx[hidden] { display: none; }

/* Le fasce del voto: la striscia e' neutra per "onesta" e sotto il 6, verde chiaro per "buona"
   e "ottima", verde piena per "rara". */
.bx.bx-f-senza, .bx.bx-f-onesta { --bx-striscia: var(--bx-carta-2); }
.bx.bx-f-buona { --bx-striscia: var(--bx-verde-velo); --bx-anello: var(--bx-voto-buona); }
.bx.bx-f-ottima { --bx-striscia: var(--bx-verde-fondo); --bx-parola: var(--bx-verde); --bx-anello: var(--bx-voto-ottima); }
.bx.bx-f-rara { --bx-striscia: var(--bx-pieno); --bx-parola: var(--bx-pieno-testo); --bx-anello: var(--bx-pieno-testo); --bx-anello-fondo: color-mix(in srgb, var(--bx-pieno-testo) 28%, transparent); --bx-anello-testo: var(--bx-pieno-testo); border-color: var(--bx-pieno); }
/* Nella striscia delle bombe ogni box riempie la sua casella. */
.bx.bx-striscia { width: 100%; }

/* -- La foto: sopra solo il cuore -- */
.bx .bx-foto { position: relative; aspect-ratio: 1 / .8; background: var(--bx-foto); }
.bx .bx-foto img { position: absolute; inset: 0; display: block; width: 300px; height: auto; margin: auto; max-width: 82%; max-height: 84%; object-fit: contain; mix-blend-mode: multiply; transition: transform .35s cubic-bezier(.2, .7, .2, 1); }
.bx .bx-cuore { position: absolute; top: 8px; right: 8px; z-index: 2; width: 36px; height: 36px; min-height: 0; margin: 0; padding: 0; border-radius: 50%; border: 0; display: grid; place-items: center; background: #ffffff; color: #586070; box-shadow: 0 1px 3px rgba(0, 0, 0, .14); cursor: pointer; }
.bx .bx-cuore:hover, .bx .bx-cuore:focus { background: #ffffff; color: #586070; }
.bx .bx-cuore:focus-visible { outline: 2px solid var(--bx-arancio); outline-offset: 2px; }
.bx .bx-i { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bx .bx-cuore[aria-pressed="true"], .bx .bx-cuore[aria-pressed="true"]:hover, .bx .bx-cuore[aria-pressed="true"]:focus { color: #e5484d; }
.bx .bx-cuore[aria-pressed="true"] .bx-i { fill: currentColor; }

/* -- Nome e riga --
   Dentro le regole (nome fino a 32 caratteri, riga fino a 44) niente resta tagliato: il tetto e' di
   tre righe a qualunque larghezza, e chi sta in due ne usa due. Misurato il 13/11 coi nomi veri e
   coi peggiori possibili: un nome con un codice lungo ("Corsair CMK32GX5M2B5600C36 DDR5") vuole
   tre righe fino a box larghi 235 px, una riga dalle parole lunghe fino a 196 (2.5.1, 2.5.3). */
.bx .bx-corpo { flex: 1; display: flex; flex-direction: column; padding: 12px 12px 11px; min-width: 0; }
.bx .bx-nome { margin: 0; padding: 0; font-family: var(--bx-f-testo); font-size: 15px; font-weight: 700; line-height: 1.25; letter-spacing: -.005em; text-transform: none; text-wrap: wrap; color: var(--bx-testo); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.bx .bx-nome a, .bx .bx-nome a:hover, .bx .bx-nome a:focus, .bx .bx-nome a:visited { color: inherit; text-decoration: none; box-shadow: none; }
/* Tutto il box porta dove porta il nome: il link si stende su tutto, il cuore gli sta sopra. */
.bx .bx-nome a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 16px; }
.bx .bx-nome a:focus-visible { outline: 0; }
.bx .bx-nome a:focus-visible::after { outline: 2px solid var(--bx-arancio); outline-offset: -2px; }
.bx .bx-riga { margin: 3px 0 0; padding: 0; font-family: var(--bx-f-testo); font-size: 12.5px; font-weight: 400; line-height: 1.35; text-wrap: wrap; color: var(--bx-testo-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* -- Bollino, prezzo e sconto stanno in fondo al corpo: in una fila di box restano alla stessa altezza -- */
.bx .bx-basso { margin-top: auto; padding-top: 12px; min-width: 0; }
.bx .bx-segno { display: flex; margin: 0 0 8px; padding: 0; min-width: 0; font-size: 16px; line-height: 1.5; }
.bx .bx-prezzi { display: flex; align-items: baseline; flex-wrap: wrap-reverse; gap: 3px 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.5; color: var(--bx-testo); }
.bx .bx-prezzo { font-family: var(--bx-f-titoli); font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; white-space: nowrap; color: var(--bx-testo); }
.bx .bx-prezzi s { font-size: 13px; font-weight: 400; color: var(--bx-testo-3); font-variant-numeric: tabular-nums; white-space: nowrap; text-decoration: line-through; }
.bx .bx-vero { margin: 7px 0 0; padding: 0; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 400; line-height: 1.5; color: var(--bx-testo-2); min-width: 0; white-space: nowrap; }
.bx .bx-meno { flex: none; padding: 2px 7px; border-radius: 7px; background: var(--bx-verde-fondo); color: var(--bx-verde); font-weight: 800; font-size: 12.5px; font-variant-numeric: tabular-nums; line-height: 1.35; }
.bx .bx-rispetto { min-width: 0; }

/* -- I bollini: uno solo, sopra il prezzo -- */
.bx .bx-chip { display: block; min-height: 22px; max-width: 100%; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--bx-arancio-fondo); color: var(--bx-arancio-testo); }
.bx .bx-chip.bx-chip-buono { padding: 2.5px 8px; background: var(--bx-carta); border: 1.5px dashed var(--bx-arancio); }
.bx .bx-chip.bx-chip-minimo { background: var(--bx-verde-fondo); color: var(--bx-verde); }
.bx .bx-chip.bx-chip-scelta { background: var(--bx-inchiostro); color: var(--bx-oro); }
.bx .bx-chip.bx-chip-tempo { background: var(--bx-tempo-fondo); color: var(--bx-tempo-testo); font-variant-numeric: tabular-nums; }
/* Un bollino a tempo finito: il copione lo nasconde con `hidden`, che da solo perde contro i `display` qui sopra. */
.bx .bx-chip[hidden], .bx .bx-segno[hidden] { display: none; }
/* Un bollino scuro su un box scuro: un bordo lo stacca. */
html[data-tema="scuro"] .bx .bx-chip.bx-chip-scelta { box-shadow: inset 0 0 0 1px #3b4152; }

/* -- La striscia del voto -- */
.bx .bx-voto { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 9px; min-height: 48px; padding: 7px 12px; border-top: 1px solid var(--bx-bordo); background: var(--bx-striscia); color: var(--bx-testo-2); font-size: 16px; line-height: 1.5; }
.bx.bx-f-ottima .bx-voto, .bx.bx-f-rara .bx-voto { border-top-color: transparent; }
.bx.bx-f-rara .bx-voto { color: var(--bx-pieno-testo-2); }
.bx .bx-anello { grid-column: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--bx-f-titoli); font-size: 11.5px; font-weight: 800; line-height: 1; color: var(--bx-anello-testo); font-variant-numeric: tabular-nums; background: radial-gradient(closest-side, var(--bx-striscia) 76%, transparent 78%), conic-gradient(var(--bx-anello) calc(var(--v, 0) * 1%), var(--bx-anello-fondo) 0); }
.bx .bx-chi { grid-column: 2; display: grid; min-width: 0; line-height: 1.25; }
.bx .bx-chi b { font-size: 12.5px; font-weight: 700; color: var(--bx-parola); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bx .bx-chi > span { font-size: 11px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bx .bx-su { font-style: normal; }
.bx .bx-lungo { display: inline; }
.bx .bx-corto { display: none; }
.bx .bx-quando { grid-column: 3; display: none; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.bx .bx-quando.bx-nuova::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--bx-arancio); flex: none; }
.bx.bx-f-rara .bx-quando.bx-nuova::before { background: var(--bx-pieno-testo); }
.bx .bx-quando.bx-ri { color: var(--bx-verde); }
.bx.bx-f-rara .bx-quando.bx-ri { color: var(--bx-pieno-testo); }
/* L'ora solo dove c'e' posto: da 206 px, da 218 coi negozi dal nome lungo. Sui telefoni no. */
@container bx (min-width: 206px) { .bx:not(.bx-neg-lungo) .bx-quando { display: inline-flex; } }
@container bx (min-width: 218px) { .bx.bx-neg-lungo .bx-quando { display: inline-flex; } }
@container bx (max-width: 166px) { .bx .bx-voto .bx-su { display: none; } }
@container bx (max-width: 146px) { .bx .bx-voto .bx-chi > span { font-size: 10.5px; letter-spacing: -.01em; } }

/* -- I box stretti -- */
@container bx (max-width: 190px) {
  .bx .bx-foto + .bx-corpo { padding: 10px 10px 10px; }
  .bx .bx-corpo .bx-nome { font-size: 14px; }
  .bx .bx-corpo .bx-riga { font-size: 12px; }
  .bx .bx-prezzi .bx-prezzo { font-size: 20px; }
  .bx .bx-corpo .bx-prezzi s { font-size: 12px; }
  .bx .bx-corpo + .bx-voto { padding-inline: 10px; column-gap: 8px; }
}
/* Nei box piu' stretti (telefoni da 320 a 360 px) la riga puo' volerne quattro: sotto i 144 px
   "Orologio GPS bambini, videochiamata HD, IP68" in tre non ci sta. */
@container bx (max-width: 158px) {
  .bx .bx-corpo .bx-riga { -webkit-line-clamp: 4; }
}
@container bx (max-width: 152px) {
  .bx .bx-corpo .bx-prezzi .bx-prezzo { font-size: 18px; }
  .bx .bx-foto + .bx-corpo + .bx-voto { column-gap: 7px; }
  .bx .bx-voto .bx-anello { width: 27px; height: 27px; font-size: 10.5px; }
  .bx .bx-voto .bx-lungo, .bx .bx-voto .bx-su { display: none; }
  .bx .bx-voto .bx-corto { display: inline; }
}
@media (hover: hover) {
  .bx:hover { transform: translateY(-3px); box-shadow: var(--bx-ombra); border-color: var(--bx-bordo-forte); }
  .bx.bx-f-rara:hover { border-color: var(--bx-pieno); }
  .bx:hover .bx-foto img { transform: scale(1.05); }
}
@media (prefers-reduced-motion: reduce) {
  .bx, .bx .bx-foto img { transition: none; }
  .bx:hover, .bx:hover .bx-foto img { transform: none; }
}
