/* ============================================================================
   cartellino-home.css — home del restyling «Cartellino» (spec 2026-09-23 §6, scelta H1)
   Un solo layout responsive: vetrina (titolo + scontrino | carosello errori), banco, feed.
   Caricato da Web e MAUI dopo cartellino-shell.css.
   ========================================================================== */

.ct-home { display: flex; flex-direction: column; gap: 22px; padding-top: 6px; }

/* ── Vetrina ──────────────────────────────────────────────────────────────── */
.ct-home-hero { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 26px; align-items: start; }
.ct-home-hero__intro { display: flex; flex-direction: column; gap: 10px; }
.ct-home-title { font-weight: 900; font-size: clamp(30px, 3.4vw, 46px); line-height: 0.98; letter-spacing: -0.04em; margin: 2px 0 0; color: var(--ink); }
.ct-home-title em {
  font-style: normal; display: inline-block; padding: 0 8px;
  background: var(--danger); color: var(--on-danger); transform: rotate(-2deg);
}
.ct-home-sub { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.45; }

/* Scontrino del giorno */
.ct-receipt {
  margin-top: 6px; padding: 12px 14px 16px;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 12px 12px 0 0;
  font-family: var(--font-mono); font-size: 12px;
  box-shadow: var(--shadow-hard);
}
.ct-receipt__head { font-size: 10px; letter-spacing: 0.16em; color: var(--ink-muted); padding-bottom: 6px; border-bottom: 1.5px dashed var(--rule); }
.ct-receipt__row, .ct-receipt__total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--rule); }
.ct-receipt__row b, .ct-receipt__total b { font-family: var(--font-sans); font-weight: 900; font-size: 16px; color: var(--ink); }
.ct-receipt__row b.is-danger { color: var(--danger); }
.ct-receipt__row b.is-save { color: var(--save); }
.ct-receipt__total { border-bottom: 0; padding-top: 8px; }

/* Carosello */
.ct-showcase { position: relative; min-width: 0; }
.ct-showcase__track {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: calc((100% - 2 * 16px) / 3);
  gap: 16px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0;
  padding: 4px 6px 18px 4px; margin: -4px -6px 0 -4px;
  scrollbar-width: none;
}
.ct-showcase__track::-webkit-scrollbar { display: none; }
.ct-showcase__track > * { scroll-snap-align: start; }
.ct-showcase__nav { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.ct-showcase.is-single .ct-showcase__nav { display: none; }
.ct-showcase__progress { flex: 1; display: flex; gap: 6px; }
.ct-showcase__progress i { flex: 1; max-width: 70px; height: 5px; border-radius: 3px; background: var(--rule); overflow: hidden; cursor: pointer; }
.ct-showcase__progress i.is-done { background: var(--ink); }
.ct-showcase__progress i.is-on::after { content: ''; display: block; height: 100%; width: 0; background: var(--brand); animation: ct-fill 5s linear forwards; }
.ct-showcase__progress i.is-on.is-paused::after { animation-play-state: paused; }
@keyframes ct-fill { to { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .ct-showcase__progress i.is-on::after { animation: none; width: 100%; } }
.ct-showcase__count { font: 500 11px var(--font-mono); color: var(--ink-muted); min-width: 44px; text-align: right; }
.ct-showcase__empty { display: flex; gap: 14px; align-items: center; padding: 22px; }
.ct-showcase__empty > i { font-size: 30px; color: var(--save); }
.ct-showcase__empty b { display: block; font-size: 16px; }
.ct-showcase__empty span { color: var(--ink-muted); font-size: 13px; }
/* Danny 15-10: senza errori aperti la vetrina dice che cosa mostra (errori finiti e offerte top) */
.ct-showcase__note { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px; font-size: 13px; line-height: 1.4; color: var(--ink-muted); }
.ct-showcase__note > i { flex: none; margin-top: 1px; }

/* Card errore */
.ct-err-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 16px; min-height: 300px; overflow: visible; }
.ct-err-card.is-skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-sunk) 50%, var(--surface) 75%); background-size: 200% 100%; animation: ct-shimmer 1.4s infinite; }
@keyframes ct-shimmer { to { background-position: -200% 0; } }
.ct-err-card__hit { position: absolute; inset: 0; z-index: 2; background: none; border: 0; cursor: pointer; border-radius: inherit; }
.ct-err-card__hit:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
/* Card stretta (390 px, due per fila): «● errore finito» e «finito da 48 g» non ci stanno insieme e si toccavano.
   Il gap le separa, flex-wrap manda l'età a capo (a destra, con margin-left: auto) e nowrap non spezza le etichette;
   dove ci stanno la riga è quella di prima */
.ct-err-card__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; font: 500 10px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; }
.ct-err-card__top > span { white-space: nowrap; }
.ct-err-card__kind { color: var(--danger); }
.ct-err-card__age { color: var(--ink-muted); margin-left: auto; }
.ct-err-card__img { height: 170px; margin: 6px 0 4px; border-radius: 9px; background: #fff; border: 1px solid var(--rule); position: relative; display: grid; place-items: center; overflow: hidden; }
.ct-err-card__trip { font-size: 12px; color: var(--ink-muted); }
/* La foto copre il riquadro in assoluto: dentro la griglia l'altezza 100% non si risolveva (riga in altezza
   automatica), l'immagine restava quadrata alla larghezza della card e il riquadro ne mostrava solo la fascia
   centrale (Danny 25-10: «le immagini non si vedono bene»). */
.ct-err-card__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 6px; }
/* Il fondo è bianco nei due temi: il grigio è quello del tema chiaro, non var(--ink-muted) che in scuro schiarisce */
.ct-err-card__img > i { font-size: 36px; color: #6b6456; }
/* Il segnaposto si vede solo senza foto o con la foto rotta (onerror mette hidden); le foto sono trasparenti ai lati */
.ct-err-card__img > img:not([hidden]) ~ i { display: none; }
.ct-err-card__name { font-weight: 700; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 35px; }
.ct-err-card__store { font: 500 10px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted); }
.ct-err-card__price { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; flex-wrap: wrap; }
.ct-err-card.is-sold .ct-err-card__img img { filter: grayscale(1); opacity: 0.55; }
.ct-err-card.is-sold .ct-stamp { bottom: 14px; }

/* ── Feed ─────────────────────────────────────────────────────────────────── */
.ct-home-section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ct-home-section-head h2 { font-weight: 900; font-size: 22px; letter-spacing: -0.03em; margin: 0; }
.ct-home-section-head span { color: var(--ink-muted); font-size: 13px; }
.ct-home .rd-feed { margin: 0; }
/* Griglia del feed: le stesse card delle pagine lista, 5 colonne su PC largo, 4 su PC, 3 su tablet, 1 su
   telefono (dove la card offerta è orizzontale) — spec §6.3 */
.ct-feed { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (min-width: 1440px) { .ct-feed { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.ct-feed > .rd-empty { grid-column: 1 / -1; }

/* ── Banco della home (FilterBanco): schede in testa e ordinamento di «Tutto il meglio» ── */
.ct-home-tabs { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.ct-home-tabs .ct-chip { font-family: var(--font-sans); font-weight: 700; font-size: 13px; }
.ct-home-tabs small { font: 500 10px var(--font-mono); opacity: 0.75; }
.ct-home-sort { display: flex; gap: 6px; }
.ct-home-sort .ct-chip { font-size: 11px; min-height: 28px; padding: 3px 10px; }
.ct-home-more { font-weight: 700; font-size: 13px; color: var(--brand-text); text-decoration: none; }

/* ── Tablet ───────────────────────────────────────────────────────────────── */
@media (max-width: 1023.98px) {
  .ct-feed { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ct-home-hero { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .ct-home-hero__intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 6px 20px; align-items: start; }
  .ct-home-hero__intro .ct-receipt { grid-row: 1 / span 3; grid-column: 2; margin-top: 0; }
  .ct-showcase__track { grid-auto-columns: calc((100% - 16px) / 2); }
}

/* ── Telefono ─────────────────────────────────────────────────────────────── */
@media (max-width: 639.98px) {
  .ct-home { gap: 16px; }
  .ct-home-hero__intro { display: flex; }
  .ct-home-sub { font-size: 14px; }
  /* Su telefono lo scontrino non c'è (Danny, 23-09: «statistiche così grandi non hanno senso»): gli errori
     aperti li dice già la riga LIVE sopra il titolo, i negozi il sottotitolo; la vetrina sale in vista */
  .ct-home-hero__intro .ct-receipt { display: none; }
  .ct-showcase__track { grid-auto-columns: 66%; gap: 12px; }
  .ct-err-card { min-height: 280px; }
  .ct-err-card__img { height: 140px; }

  .ct-home-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ct-home-tabs::-webkit-scrollbar { display: none; }
  .ct-home-tabs .ct-chip { flex: none; }
  .ct-home-sort { overflow-x: auto; max-width: 46vw; scrollbar-width: none; }
  .ct-feed { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}
.ct-err-card__kind.is-top { color: var(--brand-text); }
.ct-err-card__kind.is-ended { color: var(--ink-muted); }

/* ── Banner «Usa ErroriDiPrezzo dal tuo assistente AI» (MCP remoto, spec §11) ─ spento di default, subito sotto la testata */
.ct-asstbanner {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--surface); color: var(--ink);
  border: 2px solid var(--ink); border-radius: var(--radius-lg); box-shadow: var(--shadow-hard-sm);
}
.ct-asstbanner__icon { font-size: 22px; color: var(--brand-text); flex: none; }
.ct-asstbanner__text { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; line-height: 1.3; }
.ct-asstbanner__cta { flex: none; white-space: nowrap; }
@media (max-width: 639.98px) {
  .ct-asstbanner { flex-wrap: wrap; align-items: flex-start; gap: 8px 10px; }
  .ct-asstbanner__text { flex-basis: calc(100% - 40px); }
  .ct-asstbanner__cta { width: 100%; min-height: 44px; }
}
