/* Pagine /esoneri e /guide: copertine degli esoneri, sezioni e card delle
   guide. Markup in templates/blog/_hub_cards.html, regole in
   HOMEPAGE_DESIGN.md §10. Contenitore e intestazione restano quelli di
   blog-list.css. */

/* ===== Card con copertina (esoneri) ===== */

.hub-eso-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.hub-eso {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 10px rgba(16, 42, 67, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hub-eso:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 30px rgba(16, 42, 67, 0.16);
  color: inherit;
  text-decoration: none;
}

.hub-eso-cover {
  position: relative;
  height: 156px;
  overflow: hidden;
  isolation: isolate;
  background: var(--cv-bg, #0f7d89);
}

/* Il disegno occupa la parte destra e sfuma verso il testo */
.hub-art {
  position: absolute;
  top: 0;
  right: 0;
  width: 58%;
  height: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 40%);
  mask-image: linear-gradient(90deg, transparent 0, #000 40%);
  transition: transform 0.5s ease;
}

.hub-eso:hover .hub-art {
  transform: scale(1.06);
}

.hub-art--icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 92px;
  color: rgba(255, 255, 255, 0.24);
}

.hub-key {
  font-size: 12px;
  font-weight: 700;
  fill: rgba(255, 255, 255, 0.82);
}

.hub-key--hi {
  fill: #053a40;
}

.hub-rank-n {
  font-size: 10.5px;
  font-weight: 700;
  fill: #8a4a06;
}

.hub-rank-n--hi {
  fill: #fff;
}

/* Sfondi: a sinistra, sotto il testo bianco, le tinte più scure */
.hub-eso--inglese { --cv-bg: #012169; }
.hub-eso--informatica { --cv-bg: linear-gradient(115deg, #08545c 0%, #0b6a74 45%, #0f8593 100%); }
.hub-eso--progressive { --cv-bg: linear-gradient(115deg, #36206f 0%, #4a2d97 45%, #6a44c2 100%); }
.hub-eso--icona { --cv-bg: linear-gradient(115deg, #0b5560 0%, #0f7d89 100%); }

@supports (background: color-mix(in srgb, red 50%, blue)) {
  .hub-eso--icona {
    --cv-bg: linear-gradient(115deg, color-mix(in srgb, var(--cv) 62%, #000) 0%, var(--cv) 100%);
  }
}

/* ATA e GPS: carta a quadretti */
.hub-eso--ata .hub-eso-cover {
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(115deg, #6b3904 0%, #8a4a06 45%, #b5670c 100%);
}

.hub-eso-label {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  max-width: 52%;
  padding-left: 26px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.hub-eso-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
}

.hub-eso-subject {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 3px 0 5px;
}

.hub-eso-sub {
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.94);
}

.hub-eso-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px 24px 22px;
}

.hub-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.hub-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #3e5670;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.5;
}

.hub-chip--uni::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot);
}

.hub-eso h2 {
  font-size: 1.3rem;
  line-height: 1.35;
  color: #102a43;
  margin: 0 0 10px;
}

.hub-eso h3 {
  font-size: 1rem;
  line-height: 1.4;
  color: #102a43;
  margin: 0 0 14px;
}

.hub-eso-excerpt {
  color: #52606d;
  font-size: 0.95rem;
  line-height: 1.65;
  margin: 0 0 18px;
}

.hub-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.hub-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #0f7d89;
  font-weight: 600;
  transition: gap 0.3s ease;
}

.hub-eso:hover .hub-link,
.hub-card:hover .hub-link {
  gap: 10px;
}

.hub-meta {
  color: #64748b;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Versione compatta, nella sezione Esoneri di /guide */
.hub-eso--compact {
  border-radius: 14px;
}

.hub-eso--compact .hub-eso-cover {
  height: 116px;
}

.hub-eso--compact .hub-eso-label {
  max-width: 54%;
  padding-left: 18px;
}

/* riquadro stretto: il disegno parte più a destra, lontano dal testo */
.hub-eso--compact .hub-art {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, transparent 14%, #000 55%);
  mask-image: linear-gradient(90deg, transparent 0, transparent 14%, #000 55%);
}

.hub-eso--compact .hub-eso-kicker {
  font-size: 0.66rem;
}

.hub-eso--compact .hub-eso-subject {
  font-size: 1.3rem;
  margin: 2px 0 3px;
}

.hub-eso--compact .hub-eso-sub {
  font-size: 0.76rem;
}

.hub-eso--compact .hub-eso-body {
  padding: 16px 18px 18px;
}

.hub-eso--compact .hub-chips {
  margin-bottom: 10px;
}

/* ===== /guide: argomenti, sezioni, card ===== */

.hub-topics {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 900px;
  margin: -28px auto 52px;
}

.hub-topic {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 7px 7px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #102a43;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(16, 42, 67, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.hub-topic:hover {
  color: #102a43;
  text-decoration: none;
  border-color: var(--c);
  box-shadow: 0 4px 12px rgba(16, 42, 67, 0.1);
  transform: translateY(-1px);
}

.hub-topic-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.82rem;
  color: var(--c);
  background: #eef8f9;
  background: color-mix(in srgb, var(--c) 13%, #fff);
}

.hub-topic-n {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #52606d;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

.hub-section {
  margin-bottom: 56px;
  scroll-margin-top: 76px;
}

.hub-section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.hub-section-ico {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 1.2rem;
  color: #fff;
  background: var(--c);
  box-shadow: 0 6px 16px rgba(16, 42, 67, 0.15);
}

.hub-section-text h2 {
  font-size: 1.6rem;
  line-height: 1.2;
  color: #102a43;
  margin: 0;
}

.hub-section-text p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1.5;
}

.hub-section-more {
  margin-left: auto;
  font-weight: 600;
  white-space: nowrap;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

/* Due colonne: una card rimasta sola in fondo prende tutta la riga */
.hub-grid > .hub-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* Tre colonne su una griglia da 6: l'ultima riga non resta mai a metà.
   Con 2 card in più si allargano a mezza riga; con 1 in più le ultime
   quattro vanno in due righe da due. */
@media (min-width: 901px) {
  .hub-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .hub-grid > .hub-card,
  .hub-grid > .hub-card:last-child:nth-child(odd) {
    grid-column: span 2;
  }

  .hub-grid > .hub-card:nth-child(3n+1):nth-last-child(2),
  .hub-grid > .hub-card:nth-child(3n+1):nth-last-child(2) ~ .hub-card,
  .hub-grid > .hub-card:nth-child(3n+1):nth-last-child(4),
  .hub-grid > .hub-card:nth-child(3n+1):nth-last-child(4) ~ .hub-card {
    grid-column: span 3;
  }
}

/* Esoneri in /guide: quattro copertine in fila */
.hub-eso-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

@media (min-width: 1081px) {
  .hub-eso-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  /* in fila stretta le etichette andrebbero a capo e i titoli non
     partirebbero alla stessa altezza */
  .hub-eso--compact .hub-chips {
    display: none;
  }
}

.hub-card {
  display: flex;
  flex-direction: column;
  padding: 20px 20px 18px;
  background: #fff;
  border: 1px solid #e6edf3;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(16, 42, 67, 0.05);
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.hub-card:hover {
  color: inherit;
  text-decoration: none;
  transform: translateY(-4px);
  box-shadow: 0 12px 26px rgba(16, 42, 67, 0.12);
  border-color: #cfdbe6;
  border-color: color-mix(in srgb, var(--ico) 40%, #e6edf3);
}

.hub-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.hub-card-ico {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  font-size: 1.05rem;
  color: var(--ico);
  background: #eef8f9;
  background: color-mix(in srgb, var(--ico) 13%, #fff);
  transition: background 0.2s ease, color 0.2s ease;
}

.hub-card:hover .hub-card-ico {
  background: var(--ico);
  color: #fff;
}

/* Nome breve nel colore della guida, scurito per il contrasto */
.hub-card-kicker {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #3e5670;
  color: color-mix(in srgb, var(--ico) 72%, #102a43);
}

.hub-card h3 {
  font-size: 1.08rem;
  line-height: 1.4;
  color: #102a43;
  margin: 0 0 8px;
}

.hub-card-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #52606d;
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 16px;
}

.hub-eso:focus-visible,
.hub-card:focus-visible,
.hub-topic:focus-visible {
  outline: 3px solid #0fabbc;
  outline-offset: 3px;
}

@media (max-width: 760px) {
  .hub-eso-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 600px) {
  .hub-grid,
  .hub-eso-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Argomenti: due per riga, senza il conteggio */
  .hub-topics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: -36px auto 40px;
  }

  .hub-topic {
    gap: 8px;
    padding: 7px 10px 7px 7px;
    border-radius: 14px;
    font-size: 0.86rem;
    line-height: 1.25;
  }

  .hub-topic-ico {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
  }

  .hub-topic-n {
    display: none;
  }

  .hub-card-excerpt {
    -webkit-line-clamp: 2;
  }

  .hub-section {
    margin-bottom: 44px;
  }

  .hub-section-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .hub-section-text {
    flex: 1;
    min-width: 0;
  }

  .hub-section-text h2 {
    font-size: 1.35rem;
  }

  /* il link va sotto, altrimenti schiaccia la descrizione */
  .hub-section-more {
    order: 3;
    flex-basis: 100%;
    margin: -4px 0 0 62px;
  }

  .hub-eso-cover {
    height: 136px;
  }

  .hub-art {
    width: 52%;
  }

  .hub-eso-label {
    max-width: 56%;
    padding-left: 20px;
  }

  /* a 320 px "Informatica" a 1,6rem usciva dal riquadro */
  .hub-eso-subject {
    font-size: clamp(1.35rem, 7vw, 1.6rem);
  }

  .hub-eso-body {
    padding: 18px 18px 20px;
  }

  /* Sezione Esoneri di /guide su telefono: una sotto l'altra, alte come
     le card grandi */
  .hub-eso--compact .hub-eso-cover {
    height: 124px;
  }

  .hub-eso--compact .hub-eso-subject {
    font-size: 1.45rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hub-eso,
  .hub-card,
  .hub-topic,
  .hub-art,
  .hub-link,
  .hub-card-ico {
    transition: none;
  }

  .hub-eso:hover,
  .hub-card:hover,
  .hub-topic:hover,
  .hub-eso:hover .hub-art {
    transform: none;
  }
}
