/*
 * Sezioni e stili dei blocchi (registrati in inc/blocks.php e scelti nell'editor).
 * Ogni classe is-style-* corrisponde a uno "Stile" del blocco nell'editor.
 * Caricato anche nell'editor, così l'anteprima è fedele.
 */

/* ---------- Sezioni (blocco Gruppo) ---------- */
.is-style-section,
.is-style-section-white,
.is-style-section-blue,
.is-style-section-gradient,
.is-style-section-dark,
.is-style-hero-home,
.is-style-hero-landing {
  padding: var(--pi-section-space) var(--pi-gutter);
  margin: 0;
}
/* :is() e non :where(): con specificità zero i margini di base.css (h2, p) annullavano il centraggio. */
:is(.is-style-section, .is-style-section-white, .is-style-section-blue, .is-style-section-gradient, .is-style-section-dark, .is-style-hero-home, .is-style-hero-landing) > * {
  max-width: var(--pi-container);
  margin-inline: auto;
}
:where(.is-style-section, .is-style-section-white, .is-style-section-blue, .is-style-section-gradient, .is-style-section-dark) > * + * { margin-top: 30px; }

.is-style-section-white { background: var(--pi-white); }
.is-style-section-blue { background: var(--pi-blue); }
.is-style-section-gradient { background: var(--pi-gradient-section); }
.is-style-section-dark { background: var(--pi-gradient-faq); }

/* Testi chiari sui fondi scuri. */
:is(.is-style-section-blue, .is-style-section-gradient, .is-style-section-dark, .is-style-hero-home, .is-style-hero-landing, .is-style-card-dark) :is(h1, h2, h3, h4):not(.pi-form *) { color: var(--pi-white); }
:is(.is-style-section-blue, .is-style-section-gradient, .is-style-section-dark, .is-style-hero-home, .is-style-hero-landing, .is-style-card-dark, .is-style-glass) { color: var(--pi-white); }
:is(.is-style-section-gradient, .is-style-glass) > :is(h2, h3, h4),
.is-style-section-gradient :is(h3, h4):not(.pi-form *) { color: var(--pi-grey); }

/* Larghezze utili per i testi (classe aggiuntiva). */
.pi-narrow { max-width: 800px !important; }
.pi-w-600 { max-width: 600px !important; }

/* ---------- Hero ---------- */
.is-style-hero-home,
.is-style-hero-landing {
  display: flex;
  align-items: center;
  min-height: 720px;
  padding-top: calc(var(--pi-header-height) + 0px);
}
.is-style-hero-home {
  min-height: 100vh;
  min-height: 100svh; /* sui telefoni esclude le barre del browser */
  background: var(--pi-ink) url("../img/bg-hero.svg") center / cover no-repeat fixed;
}
.is-style-hero-landing { padding-top: 80px; background: var(--pi-gradient-hero); }
.is-style-hero-home > .wp-block-columns,
.is-style-hero-landing > .wp-block-columns { width: 100%; gap: 50px; align-items: center; }
.is-style-hero-home > .wp-block-columns { justify-content: center; }
.is-style-hero-home > .wp-block-columns > .wp-block-column { flex: 0 1 600px; }
.is-style-hero-landing > .wp-block-columns > .wp-block-column:last-child { flex: 0 1 650px; }
.is-style-hero-home .wp-block-column > * + *,
.is-style-hero-landing .wp-block-column > * + * { margin-top: 20px; }
@media (max-width: 1024px) {
  .is-style-hero-home { background-attachment: scroll; }
  /* Landing: sotto i 1024px il form da 650px schiaccerebbe il testo, quindi una sola colonna
     (il core di WP affianca le colonne da 782px in su con flex-wrap: nowrap !important). */
  .is-style-hero-landing > .wp-block-columns { flex-wrap: wrap !important; }
  .is-style-hero-landing > .wp-block-columns > .wp-block-column,
  .is-style-hero-landing > .wp-block-columns > .wp-block-column:last-child { flex: 1 1 100%; }
}

/* Testo grande dell'hero (stile paragrafo "Display"). */
.is-style-display {
  margin: 0;
  font-size: clamp(25px, 3vw + 10px, 42px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--pi-grey);
  text-wrap: balance;
}

/* Chip vetro (titoli o paragrafi brevi). */
.is-style-chip {
  display: inline-block;
  width: fit-content;
  margin: 0;
  padding: 12px 18px;
  font-size: 16px !important;
  font-weight: 600;
  line-height: 1.2;
  color: var(--pi-grey);
  background: var(--pi-glass);
  border: 1px solid var(--pi-glass-border);
  border-radius: var(--pi-radius-pill);
  backdrop-filter: blur(12px);
}
/* Chip menta (landing). */
.is-style-chip-mint {
  display: inline-block;
  width: fit-content;
  margin: 0;
  padding: 12px 18px;
  font-size: 16px !important;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--pi-mint) !important;
  background: var(--pi-mint-20);
  border: 1px solid rgba(64, 221, 190, 0.5);
  border-radius: var(--pi-radius-pill);
}
.pi-chips { display: flex; flex-wrap: wrap; gap: 20px; }
.pi-chips > * { margin: 0 !important; }

/* ---------- Pannello vetro e card ----------
 * Il pulsante con stile "Vetro" ha la stessa classe is-style-glass: il pannello vale solo per i Gruppi.
 */
.is-style-glass:not(.wp-block-button) {
  padding: 32px;
  background: var(--pi-glass);
  border: 1px solid var(--pi-glass-border);
  border-radius: var(--pi-radius-panel);
  box-shadow: var(--pi-shadow-panel);
  backdrop-filter: blur(18px);
}
.is-style-glass > * + * { margin-top: 12px; }
.is-style-glass > :is(h2, h3, h4) { margin: 0; font-size: 28px; }
.is-style-glass > p { color: var(--pi-grey); }
/* Pannello che contiene un form (stepper della home): vetro più scuro, per leggere meglio i campi. */
.is-style-glass:has(.pi-form) { background: rgba(10, 47, 92, 0.45); }

.is-style-card,
.is-style-card-glass,
.is-style-card-dark,
.is-style-card-row {
  height: 100%;
  padding: 22px;
  border: 1px solid var(--pi-glass-border);
  border-radius: var(--pi-radius);
  box-shadow: var(--pi-shadow-card);
  transition: border-color 0.2s;
}
.is-style-card,
.is-style-card-row { background: var(--pi-card); }
.is-style-card:hover,
.is-style-card-row:hover { border-color: var(--pi-blue-20); }
.is-style-card-glass { background: var(--pi-glass-light); }
.is-style-card-dark {
  position: relative;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(135deg, var(--pi-blue-dark) 0%, var(--pi-ink) 100%);
}
.is-style-card-dark::before,
.is-style-card-dark::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50% 40% 60% 50%;
}
.is-style-card-dark::before { top: -20%; left: -10%; width: 60%; height: 60%; background: var(--pi-blue); filter: blur(120px); }
.is-style-card-dark::after { bottom: -30%; right: -10%; width: 70%; height: 70%; background: var(--pi-blue-20); filter: blur(140px); }

:is(.is-style-card, .is-style-card-glass, .is-style-card-dark, .is-style-card-row) > * { margin-top: 0; margin-bottom: 0; }
:is(.is-style-card, .is-style-card-glass, .is-style-card-dark) > * + * { margin-top: 20px; }
:is(.is-style-card, .is-style-card-glass, .is-style-card-dark, .is-style-card-row) h3 { font-size: 24px; }
:is(.is-style-card, .is-style-card-glass, .is-style-card-dark, .is-style-card-row) h4 { font-size: 20px; }
:is(.is-style-card, .is-style-card-row) :is(h2, h3, h4) { color: var(--pi-blue-dark); }
.is-style-section-white .is-style-card :is(h3, h4),
:is(.is-style-section, .is-style-section-white).pi-landing .is-style-card :is(h3, h4) { color: var(--pi-blue); }
.is-style-card-glass :is(h3, h4), .is-style-card-glass p { color: var(--pi-grey); }

/* Card su una riga (recensioni home): titolo, stelle, testo e link a destra. */
.is-style-card-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; height: auto; }
.is-style-card-row > :last-child { margin-left: auto; }
.is-style-card-row a { font-size: 20px; font-weight: 700; color: var(--pi-blue-dark); text-decoration: none; }
.is-style-card-row a:hover { color: var(--pi-blue); }

/* Icona sopra una card o in testa a una caratteristica: classe aggiuntiva pi-icon--<nome>. */
:is(.is-style-card, .is-style-feature, .is-style-feature-center)[class*="pi-icon--"]::before {
  content: "";
  display: block;
  width: 48px;
  height: 48px;
  flex: none;
  background: var(--pi-mint);
  border-radius: 12px;
}
.is-style-card[class*="pi-icon--"].has-text-align-center::before,
.is-style-card[class*="pi-icon--"]:has(.has-text-align-center)::before { margin-inline: auto; }

/* Il simbolo bianco dentro il quadrato menta. */
:is(.is-style-card, .is-style-feature, .is-style-feature-center)[class*="pi-icon--"] { position: relative; }
:is(.is-style-card, .is-style-feature, .is-style-feature-center)[class*="pi-icon--"]::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  background: #fff;
  -webkit-mask: var(--pi-icon) center / contain no-repeat;
  mask: var(--pi-icon) center / contain no-repeat;
}
.is-style-card[class*="pi-icon--"]::after { top: 34px; left: 34px; }
.is-style-card[class*="pi-icon--"]:has(.has-text-align-center)::after { left: calc(50% - 12px); }

/* Caratteristica: icona a sinistra (o centrata), titolo e testo. */
.is-style-feature {
  display: grid;
  grid-template-columns: 48px 1fr;
  column-gap: 18px;
  align-items: start;
}
.is-style-feature > * { grid-column: 2; margin: 0; }
.is-style-feature::before { grid-column: 1; grid-row: 1 / span 3; }
.is-style-feature::after { top: 12px; left: 12px; }
.is-style-feature h3, .is-style-feature h4 { margin-bottom: 5px; font-size: 20px; color: var(--pi-blue); }
.is-style-feature-center { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 5px; }
.is-style-feature-center::before { margin-bottom: 12px; border-radius: 50%; }
.is-style-feature-center::after { top: 12px; left: calc(50% - 12px); }
.is-style-feature-center h3, .is-style-feature-center h4 { margin: 0; font-size: 20px; }
.is-style-feature-center p { margin: 0; }
.is-style-section-blue .is-style-feature-center p { color: var(--pi-surface); }

/* Numero degli step (stile paragrafo "Numero"). */
.is-style-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  margin: 0;
  padding: 8px;
  font-weight: 700;
  color: #fff;
  background: var(--pi-glass);
  border: 1px solid var(--pi-glass-border);
  border-radius: 5px;
}

/* Stelle (stile paragrafo "Stelle"): scrivere ★★★★★. */
.is-style-stars { margin: 0; font-size: 18px; letter-spacing: 2px; color: var(--pi-mint); line-height: 1; }
.is-style-stars.pi-stars--gold { color: #ffd139; }
.is-style-card-row .is-style-stars { color: var(--pi-blue-dark); font-size: 14px; }

/* Riquadri recensioni nell'hero landing. */
.pi-badges { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px 60px; }
.pi-badges > * { margin: 0 !important; }
.pi-badges > * > * { margin: 0 0 1px; }

/* Barra decorativa sopra i titoli di sezione (stile titolo "Decorato"). */
.is-style-decorated { position: relative; color: var(--pi-blue); }
.is-style-decorated::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 50%;
  width: 33%;
  max-width: 150px;
  height: 4px;
  background: var(--pi-mint);
  transform: translateX(-50%);
}
.is-style-decorated:not(.has-text-align-center)::before { left: 0; transform: none; }
:is(.is-style-section-blue, .is-style-section-dark) .is-style-decorated { color: var(--pi-white); }

/* ---------- Raggruppamenti ---------- */
.pi-stack { display: flex; flex-direction: column; gap: 20px; }
.pi-features { display: flex; flex-direction: column; gap: 30px; max-width: 560px !important; }
.is-style-card-row h3 { margin: 0; font-size: 20px; }
.pi-grazie-text { margin: 30px auto 0; }

/* ---------- Colonne di card ---------- */
.wp-block-columns { gap: 20px 30px; margin-bottom: 0; }
.wp-block-columns.pi-gap-sm { gap: 20px; }
.pi-center-cols { justify-content: center; }
.pi-center-cols > .wp-block-column { flex: 0 1 500px !important; }

/* ---------- Pulsanti (stili del blocco Pulsante) ---------- */
.wp-block-button__link {
  padding: 12px 24px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  background: var(--pi-blue);
  border-radius: var(--pi-radius-pill);
  transition: background 0.2s, color 0.2s, transform 0.1s;
}
.wp-block-button__link:hover { background: var(--pi-blue-dark); color: #fff; transform: translateY(-1px); }
.is-style-white .wp-block-button__link { background: #fff; color: var(--pi-blue); }
.is-style-white .wp-block-button__link:hover { background: var(--pi-bg); color: var(--pi-blue-dark); }
.is-style-mint .wp-block-button__link { background: var(--pi-mint); color: var(--pi-blue-dark); }
.is-style-mint .wp-block-button__link:hover { background: var(--pi-mint-light); color: var(--pi-blue-dark); }
.is-style-glass .wp-block-button__link,
.wp-block-button.is-style-glass .wp-block-button__link { background: var(--pi-glass-border); color: var(--pi-white); }
.wp-block-button.is-style-square .wp-block-button__link { border-radius: 4px; background: var(--pi-blue-dark); }
.wp-block-button.is-style-square .wp-block-button__link:hover { background: var(--pi-blue); }

/* CTA dentro una card: testo a sinistra, pulsante a destra. */
.pi-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.pi-cta > * { margin: 0 !important; }
.pi-cta h3 { margin-bottom: 6px; }

/* ---------- FAQ (blocco Dettagli) ---------- */
.wp-block-details {
  margin: 0 0 10px;
  padding: 14px 16px;
  background: #fff;
  border-radius: var(--pi-radius);
}
.wp-block-details summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  font-weight: 700;
  color: var(--pi-blue-dark);
  cursor: pointer;
  list-style: none;
}
.wp-block-details summary::-webkit-details-marker { display: none; }
.wp-block-details summary::before {
  content: "";
  width: 0;
  height: 0;
  flex: none;
  border-style: solid;
  border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent currentColor;
  transition: transform 0.2s;
}
.wp-block-details[open] summary::before { transform: rotate(90deg); }
.wp-block-details > :not(summary) { margin: 6px 10px 9px; }
.pi-faq { display: flex; flex-direction: column; }

/* FAQ su fondo scuro (landing). */
.is-style-section-dark .wp-block-details {
  background: transparent;
  border: 1px solid var(--pi-glass-border);
  border-radius: 5px;
  padding: 4px 8px;
}
.is-style-section-dark .wp-block-details summary { font-weight: 400; color: var(--pi-white); }
.is-style-section-dark .wp-block-details[open] summary { color: var(--pi-mint); }
.is-style-section-dark .wp-block-details p { color: var(--pi-white); }

/* Liste nei contenuti delle sezioni. */
:is(.is-style-section, .is-style-section-white) ul { padding-left: 1.2em; }

/* ---------- Home: barra di fiducia, card segmento, avvertenza, FAQ a gruppi ---------- */
.pi-trust { padding-block: 30px; }
.pi-trust .is-style-feature { align-items: center; }
/* Icona e testo centrati in verticale: l'icona occupa una sola riga e il simbolo segue il quadrato. */
.pi-trust .is-style-feature::before { grid-row: 1; }
.pi-trust .is-style-feature::after { top: calc(50% - 12px); }
.pi-trust .is-style-feature p { font-weight: 600; color: var(--pi-blue-dark); }
.pi-trust a { color: var(--pi-blue); }

.pi-segmento__sub { font-weight: 600; color: var(--pi-blue); }

/* Riga "Esempio" delle card ([pi_esempio formato="breve"]): compare solo se l'esempio completo è stampabile. */
.pi-esempio { font-size: 14px; font-weight: 600; color: var(--pi-blue-dark); }
.pi-esempio a { margin-left: 2px; color: var(--pi-blue); text-decoration: none; }
/* Su fondo scuro (hero). */
:is(.is-style-hero-home, .is-style-hero-landing) .pi-esempio { color: var(--pi-grey); }
:is(.is-style-hero-home, .is-style-hero-landing) .pi-esempio a { color: var(--pi-mint); }

.pi-avvertenza { font-weight: 700; color: var(--pi-blue-dark); }

.pi-faq > h3 { margin: 30px 0 12px; font-size: 20px; color: var(--pi-blue-dark); }
.pi-faq > h3:first-child { margin-top: 0; }

/* CTA finale: titolo h2 dentro la card. */
.pi-cta h2 { margin: 0 0 6px; font-size: clamp(24px, 1.5vw + 18px, 32px); }
.is-style-card-glass.pi-cta h2 { color: var(--pi-white); }

/* Form ripetuto a metà pagina: stessa composizione dell'hero. */
.pi-form-section > .wp-block-columns { gap: 50px; justify-content: center; }
.pi-form-section > .wp-block-columns > .wp-block-column { flex: 0 1 600px; }
.pi-form-section .wp-block-column > * + * { margin-top: 20px; }
@media (max-width: 1024px) {
  .pi-form-section > .wp-block-columns { flex-wrap: wrap !important; }
  .pi-form-section > .wp-block-columns > .wp-block-column { flex: 1 1 100%; }
}

/* Chi siamo con recensioni. */
/* Testo a sinistra, punti a destra (elenco con icona menta). */
.pi-chi-siamo { gap: 30px 80px; align-items: center; }
.pi-chi-siamo > .wp-block-column > * + * { margin-top: 16px; }
#chi-siamo ul.pi-points { display: flex; flex-direction: column; gap: 28px; margin: 0; padding: 0; list-style: none; }
.pi-points li { position: relative; display: grid; grid-template-columns: 48px 1fr; column-gap: 18px; align-items: start; }
.pi-points li::before { content: ""; grid-row: 1 / span 2; width: 48px; height: 48px; background: var(--pi-mint); border-radius: 12px; }
.pi-points li::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 12px;
  width: 24px;
  height: 24px;
  background: #fff;
  -webkit-mask: url("../img/icons/check.svg") center / contain no-repeat;
  mask: url("../img/icons/check.svg") center / contain no-repeat;
}
.pi-points strong { display: block; margin-bottom: 4px; font-size: 20px; color: var(--pi-blue); }
.pi-recensioni { margin-top: 110px !important; }
.pi-recensioni > * + * { margin-top: 20px; }
.pi-recensioni > h3 + * { margin-top: 40px; }
.pi-recensioni .is-style-stars { font-size: 18px; color: var(--pi-blue); }

/* Spazi verticali: pulsante sotto le card "Per chi è", titolo dei vantaggi. */
.pi-per-chi-cta { margin-top: 50px !important; }
#vantaggi > h2 + .wp-block-columns { margin-top: 60px; }
.pi-recensioni h3.has-text-align-center { font-size: 24px; color: var(--pi-blue-dark); }

/* Testo d'apertura di una sezione (classe aggiuntiva del paragrafo). */
.pi-lead {
  max-width: 820px !important;
  font-size: clamp(19px, 0.8vw + 15px, 24px);
  font-weight: 300;
  line-height: 1.5;
  color: var(--pi-blue-dark);
  text-wrap: pretty;
}
.pi-lead strong { font-weight: 700; color: var(--pi-blue); }

/* Card con icona: spazio tra il quadrato menta e il titolo. */
.is-style-card[class*="pi-icon--"]::before { margin-bottom: 20px; }

/* Landing statali, "Fino a due quinti dello stipendio": più aria sotto il titolo e gap uniforme tra le card. */
#delega > h2 + .wp-block-columns,
#comparti > h2 + .wp-block-columns { margin-top: 60px; }
#delega > .wp-block-columns { gap: 40px; }
#delega > .wp-block-columns + * { margin-top: 40px; }
