/*
Theme Name: GeneratePress Child — MSP In Cloud
Theme URI: https://blog.mspincloud.com
Description: Child theme brand MSP In Cloud (navy #0f172a, blu #3b82f6, Inter self-hosted). Additivo e reversibile: per tornare indietro riattivare GeneratePress.
Author: MSP In Cloud
Template: generatepress
Version: 1.0.0
Text Domain: gp-child-msp
*/

/* ============ FONT SELF-HOSTED (GDPR: niente Google Fonts remoto) ============ */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/Inter-var.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('fonts/JetBrainsMono-var.woff2') format('woff2');
}

:root {
  --msp-navy: #0f172a;
  --msp-ink: #020617;
  --msp-panel: #111827;
  --msp-blue: #3b82f6;
  --msp-blue-d: #2563eb;
  --msp-blue-l: #93c5fd;
  --msp-txt: #f1f5f9;
  --msp-soft: #e2e8f0;
  --msp-muted: #94a3b8;
  --msp-border: #1e293b;
  --msp-page: #f8fafc;
  --msp-card-border: #e2e8f0;
  --msp-body: #1e293b;
  --msp-body-muted: #64748b;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--msp-page);
  color: var(--msp-body);
  -webkit-font-smoothing: antialiased;
  font-size: 17px;
  line-height: 1.7;
}
h1, h2, h3, h4, h5, h6 { font-family: 'Inter', system-ui, sans-serif; font-weight: 700; letter-spacing: -0.015em; color: #0f172a; }

/* ============ HEADER ============ */
.site-header {
  background: var(--msp-navy);
  border-bottom: 1px solid var(--msp-border);
}
.site-header .inside-header { padding: 18px 40px; }
.site-logo img { max-height: 44px; width: auto; }
.main-navigation, .main-navigation.grid-container {
  background: var(--msp-navy);
  border-bottom: 1px solid var(--msp-border);
}
.main-navigation .main-nav ul li a {
  font-weight: 500;
  font-size: 15px;
  color: var(--msp-soft);
  line-height: 52px;
  transition: color .15s ease;
}
.main-navigation .main-nav ul li a:hover,
.main-navigation .main-nav ul li.current-menu-item a { color: var(--msp-blue-l); }
.main-navigation .main-nav ul li.msp-nav-cta a {
  background: var(--msp-blue);
  color: #fff;
  border-radius: 8px;
  line-height: 36px;
  padding: 0 16px;
  margin: 8px 0 8px 12px;
  font-weight: 600;
}
.main-navigation .main-nav ul li.msp-nav-cta a:hover { background: var(--msp-blue-d); color: #fff; }

/* ============ HERO (homepage) ============ */
.msp-hero {
  background:
    radial-gradient(60rem 28rem at 78% -10%, rgba(59,130,246,.28), transparent 60%),
    radial-gradient(40rem 22rem at 12% 110%, rgba(37,99,235,.18), transparent 60%),
    linear-gradient(160deg, var(--msp-ink) 0%, var(--msp-navy) 65%, #16233f 100%);
  color: var(--msp-txt);
  padding: 96px 24px 104px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.msp-hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(148,163,184,.06) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(148,163,184,.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(50rem 26rem at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(50rem 26rem at 50% 0%, #000 30%, transparent 75%);
  pointer-events: none;
}
.msp-hero > * { position: relative; }
.msp-hero .msp-hero-kicker {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--msp-blue-l);
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.35);
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 22px;
}
.msp-hero h1 {
  color: #fff;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 auto 18px;
  max-width: 820px;
  line-height: 1.12;
}
.msp-hero .msp-hero-sub {
  color: var(--msp-muted);
  font-size: clamp(1.02rem, 2vw, 1.22rem);
  max-width: 640px;
  margin: 0 auto 34px;
  line-height: 1.6;
}
.msp-hero .wp-block-buttons { justify-content: center; }
.msp-hero .wp-block-button__link {
  border-radius: 10px;
  font-weight: 600;
  padding: 13px 26px;
  font-size: 16px;
}
.msp-hero .msp-btn-primary .wp-block-button__link {
  background: linear-gradient(135deg, var(--msp-blue), var(--msp-blue-d)) !important;
  color: #fff;
  box-shadow: 0 10px 28px -10px rgba(59,130,246,.55);
}
.msp-hero .msp-btn-primary .wp-block-button__link:hover { filter: brightness(1.08); }
.msp-hero .msp-btn-ghost .wp-block-button__link {
  background: transparent !important;
  color: var(--msp-soft);
  border: 1px solid rgba(148,163,184,.4);
}
.msp-hero .msp-btn-ghost .wp-block-button__link:hover { border-color: var(--msp-blue-l); color: #fff; }

/* ============ SEZIONI HOME ============ */
.msp-section { padding: 64px 24px; max-width: 1140px; margin: 0 auto; }
.msp-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 34px; flex-wrap: wrap; }
.msp-section-head h2 { font-size: 1.75rem; margin: 0; }
.msp-section-head a { color: var(--msp-blue-d); font-weight: 600; text-decoration: none; font-size: 15px; }
.msp-section-head a:hover { text-decoration: underline; }

/* ============ CARD ARTICOLI (query loop) ============ */
.msp-cards .wp-block-post-template {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
@media (max-width: 980px) { .msp-cards .wp-block-post-template { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .msp-cards .wp-block-post-template { grid-template-columns: 1fr; } }
.msp-cards .wp-block-post-template > li {
  background: #fff;
  border: 1px solid var(--msp-card-border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
  margin: 0;
}
.msp-cards .wp-block-post-template > li:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 38px -16px rgba(15,23,42,.22);
  border-color: #bfdbfe;
}
.msp-cards .wp-block-post-featured-image { margin: 0; }
.msp-cards .wp-block-post-featured-image img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: 100%;
  display: block;
}
.msp-cards .msp-card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.msp-cards .wp-block-post-terms { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.msp-cards .wp-block-post-terms a {
  color: var(--msp-blue-d);
  background: #eff6ff;
  border: 1px solid #dbeafe;
  padding: 3px 10px;
  border-radius: 999px;
  text-decoration: none;
}
.msp-cards .wp-block-post-terms a:hover { background: #dbeafe; }
.msp-cards .wp-block-post-title { font-size: 1.14rem; line-height: 1.35; margin: 0; }
.msp-cards .wp-block-post-title a { color: #0f172a; text-decoration: none; }
.msp-cards .wp-block-post-title a:hover { color: var(--msp-blue-d); }
.msp-cards .wp-block-post-excerpt { font-size: .92rem; color: var(--msp-body-muted); margin: 0; }
.msp-cards .wp-block-post-excerpt__more-text { display: none; }
.msp-cards .wp-block-post-date { font-size: .8rem; color: #94a3b8; margin-top: auto; }
.msp-cards .wp-block-query-pagination { margin-top: 40px; justify-content: center; font-weight: 600; }
.msp-cards .wp-block-query-pagination a { color: var(--msp-blue-d); text-decoration: none; }

/* ============ CTA BAND ============ */
.msp-cta {
  background: linear-gradient(135deg, var(--msp-navy), #16233f);
  border: 1px solid var(--msp-border);
  border-radius: 18px;
  color: var(--msp-txt);
  padding: 52px 32px;
  text-align: center;
  max-width: 1140px;
  margin: 8px auto 72px;
}
.msp-cta h2 { color: #fff; font-size: 1.6rem; margin: 0 0 10px; }
.msp-cta p { color: var(--msp-muted); max-width: 560px; margin: 0 auto 26px; }
.msp-cta .wp-block-buttons { justify-content: center; }
.msp-cta .wp-block-button__link {
  background: var(--msp-blue) !important;
  color: #fff;
  border-radius: 10px;
  font-weight: 600;
  padding: 12px 24px;
}
.msp-cta .wp-block-button__link:hover { background: var(--msp-blue-d) !important; }

/* ============ PAGINA ARTICOLO: larghezza lettura ============ */
.single-post .site-main .inside-article,
.page:not(.home) .site-main .inside-article { padding: 48px 0 56px; }
.single-post .entry-header,
.single-post .entry-content,
.single-post .entry-meta,
.single-post .post-navigation,
.single-post .comments-area {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.single-post .entry-header .entry-title { font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.18; margin-bottom: 12px; }
.single-post .entry-meta { font-size: .85rem; color: #94a3b8; }
.single-post .entry-content { font-size: 1.06rem; line-height: 1.78; }
.single-post .entry-content > .wp-block-image:first-child img,
.single-post .entry-content img { border-radius: 12px; }
.single-post .entry-content h2 { font-size: 1.55rem; margin-top: 2.4em; padding-top: .4em; }
.single-post .entry-content h3 { font-size: 1.22rem; margin-top: 1.9em; }
.single-post .entry-content a { color: var(--msp-blue-d); }
.single-post .entry-content blockquote {
  border-left: 3px solid var(--msp-blue);
  background: #f1f5f9;
  border-radius: 0 10px 10px 0;
  padding: 14px 20px;
  color: #334155;
  font-style: normal;
}
.single-post .entry-content ul li, .single-post .entry-content ol li { margin-bottom: .4em; }

/* code — brand navy */
.entry-content code, .entry-content kbd {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .88em;
  background: #eef2f7;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: .12em .4em;
  color: #0f2c5f;
}
.entry-content pre, .entry-content .wp-block-code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: var(--msp-navy);
  color: var(--msp-soft);
  border: 1px solid var(--msp-border);
  border-radius: 12px;
  padding: 20px 22px;
  overflow-x: auto;
  font-size: .88rem;
  line-height: 1.65;
}
.entry-content pre code { background: transparent; border: 0; padding: 0; color: inherit; }

/* tabelle */
.entry-content table, .entry-content .wp-block-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: .93rem;
  border: 1px solid var(--msp-card-border);
  border-radius: 12px;
  overflow: hidden;
}
.entry-content .wp-block-table { overflow-x: auto; }
.entry-content table th {
  background: var(--msp-navy);
  color: var(--msp-txt);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border: 0;
}
.entry-content table td { padding: 10px 14px; border-top: 1px solid var(--msp-card-border); border-left: 0; border-right: 0; }
.entry-content table tr:nth-child(even) td { background: #f8fafc; }

/* FAQ / dettagli */
.entry-content details {
  border: 1px solid var(--msp-card-border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
  background: #fff;
}
.entry-content details summary { font-weight: 600; cursor: pointer; color: #0f172a; }

/* ============ ARCHIVI categorie (fallback non-query-loop) ============ */
.archive .site-main article {
  background: #fff;
  border: 1px solid var(--msp-card-border);
  border-radius: 14px;
  padding: 26px 28px;
  margin-bottom: 22px;
}
.archive .page-header { max-width: 1140px; margin: 0 auto 26px; }
.archive .page-header .page-title { font-size: 1.6rem; }

/* ============ FOOTER ============ */
.site-footer { background: var(--msp-navy); color: var(--msp-muted); }
.footer-widgets {
  background: var(--msp-navy);
  border-top: 1px solid var(--msp-border);
  padding: 56px 0 34px;
  font-size: .92rem;
}
.footer-widgets .widget-title, .footer-widgets h2 {
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .04em;
  margin-bottom: 16px;
}
.footer-widgets a { color: var(--msp-muted); text-decoration: none; }
.footer-widgets a:hover { color: var(--msp-blue-l); }
.footer-widgets ul { list-style: none; margin: 0; padding: 0; }
.footer-widgets ul li { margin-bottom: 9px; }
.footer-widgets p { color: var(--msp-muted); }
.site-info {
  background: var(--msp-ink);
  border-top: 1px solid var(--msp-border);
  padding: 22px 0;
  font-size: .82rem;
  color: #64748b;
}
.site-info a { color: var(--msp-muted); }
.site-info a:hover { color: var(--msp-blue-l); }

/* mobile */
@media (max-width: 768px) {
  .site-header .inside-header { padding: 12px 20px; }
  .site-logo img { max-height: 34px; }
  .msp-hero { padding: 64px 20px 72px; }
  .msp-section { padding: 44px 18px; }
  .msp-cta { padding: 40px 22px; margin-left: 16px; margin-right: 16px; }
}

/* ==========================================================================
   REVISIONE DESIGN 2026-07-22 (mockup owner) — additivo/reversibile
   ========================================================================== */

/* --- HERO: sottolineatura blu su "Spiegati bene" + visual edifici astratti --- */
.msp-hero .msp-underline {
  text-decoration: underline;
  text-decoration-color: var(--msp-blue);
  text-decoration-thickness: .13em;
  text-underline-offset: .16em;
}
.msp-hero::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 170px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='980' height='170' viewBox='0 0 980 170'%3E%3Cg fill='%231b2a45'%3E%3Crect x='10' y='84' width='64' height='86'/%3E%3Crect x='86' y='44' width='56' height='126'/%3E%3Crect x='154' y='104' width='70' height='66'/%3E%3Crect x='236' y='64' width='48' height='106'/%3E%3Crect x='296' y='24' width='66' height='146'/%3E%3Crect x='374' y='94' width='56' height='76'/%3E%3Crect x='442' y='54' width='62' height='116'/%3E%3Crect x='516' y='114' width='72' height='56'/%3E%3Crect x='600' y='34' width='58' height='136'/%3E%3Crect x='670' y='84' width='64' height='86'/%3E%3Crect x='746' y='54' width='52' height='116'/%3E%3Crect x='810' y='104' width='68' height='66'/%3E%3Crect x='890' y='64' width='58' height='106'/%3E%3C/g%3E%3Cg fill='%233b82f6' opacity='.7'%3E%3Crect x='100' y='58' width='8' height='8'/%3E%3Crect x='118' y='76' width='8' height='8'/%3E%3Crect x='100' y='94' width='8' height='8'/%3E%3Crect x='312' y='40' width='8' height='8'/%3E%3Crect x='330' y='58' width='8' height='8'/%3E%3Crect x='312' y='94' width='8' height='8'/%3E%3Crect x='346' y='76' width='8' height='8'/%3E%3Crect x='458' y='70' width='8' height='8'/%3E%3Crect x='476' y='88' width='8' height='8'/%3E%3Crect x='614' y='50' width='8' height='8'/%3E%3Crect x='632' y='68' width='8' height='8'/%3E%3Crect x='614' y='104' width='8' height='8'/%3E%3Crect x='760' y='70' width='8' height='8'/%3E%3Crect x='778' y='106' width='8' height='8'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: bottom center;
  opacity: .45;
  pointer-events: none;
}
.msp-hero { padding-bottom: 150px; }

/* --- CHIP FILTRI CATEGORIE sotto il hero --- */
.msp-chips {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  max-width: 1140px; margin: 0 auto; padding: 28px 20px 0;
}
.msp-chips a {
  border: 1px solid var(--msp-card-border); background: #fff; color: #334155;
  border-radius: 999px; padding: 8px 18px; font-size: 14px; font-weight: 600;
  text-decoration: none;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.msp-chips a:hover { border-color: #bfdbfe; color: var(--msp-blue-d); background: #eff6ff; }
.msp-chips a.is-active { background: var(--msp-blue); border-color: var(--msp-blue); color: #fff; }

/* --- SEZIONE "DA LEGGERE / In evidenza": label blu + card grandi --- */
.msp-kicker {
  color: var(--msp-blue-d); font-size: 12.5px; font-weight: 700;
  letter-spacing: .15em; text-transform: uppercase; margin: 0 0 6px;
}
.msp-cards-lg .wp-block-post-template { grid-template-columns: repeat(2, 1fr) !important; gap: 32px; }
@media (max-width: 700px) { .msp-cards-lg .wp-block-post-template { grid-template-columns: 1fr !important; } }
.msp-cards-lg .wp-block-post-title { font-size: 1.4rem; line-height: 1.3; }
.msp-cards-lg .msp-card-body { padding: 24px 26px 26px; }
.msp-cards-lg .wp-block-post-excerpt { font-size: .97rem; }

/* --- ARTICOLO: breadcrumb + badge categoria --- */
.msp-breadcrumb {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  font-size: .85rem; color: #94a3b8; margin-bottom: 18px;
}
.msp-breadcrumb a { color: #64748b; text-decoration: none; }
.msp-breadcrumb a:hover { color: var(--msp-blue-d); }
.msp-bc-sep { color: #cbd5e1; }
.msp-bc-cur { color: #94a3b8; }
.msp-cat-pill {
  display: inline-block; background: #eff6ff; color: var(--msp-blue-d);
  border: 1px solid #dbeafe; font-size: 12px; font-weight: 700;
  letter-spacing: .1em; border-radius: 999px; padding: 5px 14px;
  margin-bottom: 14px; text-decoration: none;
}
.msp-cat-pill:hover { background: #dbeafe; color: var(--msp-blue-d); }

/* --- ARTICOLO: sottotitolo + byline (avatar MI, meta, Condividi/Salva) --- */
.msp-article-sub {
  font-size: 1.17rem; color: var(--msp-body-muted); line-height: 1.55;
  margin: 12px 0 22px;
}
.msp-byline {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 0; border-top: 1px solid var(--msp-card-border);
  border-bottom: 1px solid var(--msp-card-border); margin-bottom: 28px;
}
.msp-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--msp-blue), var(--msp-blue-d));
  color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .02em;
  display: inline-flex; align-items: center; justify-content: center;
}
.msp-byline-txt { display: flex; flex-direction: column; font-size: .9rem; line-height: 1.35; }
.msp-byline-txt strong { color: #0f172a; }
.msp-byline-meta { color: #94a3b8; font-size: .82rem; }
.msp-byline-actions { margin-left: auto; display: flex; gap: 8px; }
.msp-act {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--msp-card-border); color: #334155;
  border-radius: 8px; padding: 7px 13px; cursor: pointer;
  font: 600 .82rem/1.2 'Inter', system-ui, sans-serif;
}
.msp-act:hover { border-color: #bfdbfe; color: var(--msp-blue-d); background: #eff6ff; }
.msp-act.is-saved { background: #eff6ff; color: var(--msp-blue-d); border-color: #bfdbfe; }
@media (max-width: 600px) {
  .msp-byline-actions { margin-left: 54px; }
}

/* --- ARTICOLO: cover grande arrotondata + niente doppioni GP --- */
.msp-article-cover { margin: 0 0 34px; }
.msp-article-cover img { width: 100%; height: auto; border-radius: 16px; display: block; }
.single-post .entry-header .entry-meta,
.single-post .inside-article > .featured-image,
.single-post .inside-article > .post-image { display: none; }

/* --- ARTICOLO: indice (accordion mobile, aperto desktop via JS) --- */
.msp-toc {
  background: #fff; border: 1px solid var(--msp-card-border);
  border-radius: 12px; padding: 16px 20px; margin: 0 0 30px;
}
.msp-toc summary { font-weight: 700; color: #0f172a; cursor: pointer; }
.msp-toc ol { margin: 12px 0 2px 18px; padding: 0; }
.msp-toc li { margin-bottom: 7px; font-size: .93rem; }
.msp-toc a { color: #334155; text-decoration: none; }
.msp-toc a:hover { color: var(--msp-blue-d); text-decoration: underline; }
.single-post .entry-content h2 { scroll-margin-top: 90px; }

/* --- ARTICOLO: incipit in bold + figure in-article --- */
.single-post .entry-content > p:first-of-type {
  font-size: 1.12rem; font-weight: 600; color: #1e293b;
}
.entry-content .msp-figure { margin: 28px 0; }
.entry-content .msp-figure img {
  width: 100%; height: auto; display: block;
  border-radius: 12px; border: 1px solid var(--msp-card-border);
}
.entry-content .msp-figure figcaption {
  font-size: .83rem; color: #94a3b8; margin-top: 10px; text-align: center;
}

/* misc */
.entry-content .wp-block-separator { border-color: var(--msp-card-border); }
button, .button, input[type=submit] { background: var(--msp-blue); border-radius: 8px; }
button:hover, .button:hover, input[type=submit]:hover { background: var(--msp-blue-d); }
::selection { background: rgba(59,130,246,.25); }

/* ==========================================================================
   REVISIONE LAYOUT 2026-07-25: mobile-first, additiva e REVERSIBILE
   (per annullare: cancellare da questo commento alla fine del file)

   1. header su UNA riga anche da telefono: logo a sinistra, apertura menu a
      destra (prima erano due righe centrate e mangiavano mezzo schermo);
   2. un solo gutter laterale per header, sezioni, card, CTA e testo articolo,
      cosi' tutto cade sulla stessa colonna;
   3. zero sfondamento orizzontale (le figure in-article uscivano di 2px);
   4. ritmo verticale piu' compatto: la home regge anche con pochi articoli.
   ========================================================================== */

:root { --msp-gut: 20px; --msp-max: 1100px; }
@media (min-width: 769px)  { :root { --msp-gut: 28px; } }
@media (min-width: 1025px) { :root { --msp-gut: 40px; } }

/* --- 1) ALLINEAMENTO: header, sezioni e CTA sulla stessa colonna ---------- */
.site-header .inside-header { padding-left: var(--msp-gut); padding-right: var(--msp-gut); }
.msp-section, .msp-chips, .msp-cta { box-sizing: border-box; }
/* Il contenitore dell'header di GeneratePress e' content-box: il suo max-width
   vale sul CONTENUTO. Le sezioni ricalcano la stessa colonna, cosi' logo, menu,
   card e CTA cadono tutti sulla stessa verticale. */
.msp-section, .msp-chips { max-width: calc(var(--msp-max) + 2 * var(--msp-gut)); }
.msp-section { padding-left: var(--msp-gut); padding-right: var(--msp-gut); }
.msp-chips   { padding-left: var(--msp-gut); padding-right: var(--msp-gut); }
.msp-hero    { padding-left: var(--msp-gut); padding-right: var(--msp-gut); }
.msp-cta {
  width: min(100% - 2 * var(--msp-gut), var(--msp-max));
  max-width: none;
  margin-left: auto; margin-right: auto;
}

/* GeneratePress aggiunge 30px di padding a ogni .wp-block-group__inner-container:
   dentro le nostre sezioni si sommavano al gutter e le card restavano larghe
   294px su uno schermo da 390. Qui il contenitore torna neutro e lo spazio lo
   decide una sola regola. */
.msp-hero > .wp-block-group__inner-container,
.msp-section > .wp-block-group__inner-container,
.msp-cta > .wp-block-group__inner-container { padding: 0; }

/* --- 2) NIENTE SFONDAMENTO ORIZZONTALE ----------------------------------- */
.entry-content img,
.entry-content figure,
.entry-content .msp-figure img,
.msp-cards img { max-width: 100%; box-sizing: border-box; }

/* --- 3) HEADER MOBILE: logo a sinistra, apertura menu a destra, UNA riga -- */
@media (max-width: 768px) {
  .site-header { text-align: left; position: relative; }
  .site-header .inside-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: nowrap; gap: 12px; padding-top: 10px; padding-bottom: 10px;
  }
  /* I clearfix ::before/::after di GP diventerebbero flex item e sposterebbero
     logo e bottone verso il centro: nel layout a riga non servono. */
  .site-header .inside-header::before,
  .site-header .inside-header::after { display: none; }
  /* GP mette 20px sotto ogni figlio dell'header: qui spezzerebbe la riga */
  .site-header .inside-header > *:not(:last-child):not(.main-navigation) { margin-bottom: 0; }
  .site-header .site-logo { flex: 0 1 auto; min-width: 0; line-height: 0; margin: 0; }
  .site-header .site-logo img,
  .site-header .site-logo img.header-image {
    width: auto; max-width: 200px; height: 32px; max-height: 32px;
    object-fit: contain; object-position: left center;
  }
  .site-header .main-navigation {
    flex: 0 0 auto; width: auto; position: static;
    background: transparent; border-bottom: 0;
  }
  /* GP rende .inside-navigation position:relative: diventerebbe lei il
     riferimento del pannello e il menu resterebbe largo quanto il bottone. */
  .site-header .main-navigation .inside-navigation { padding: 0; display: block; position: static; }

  /* il bottone: bersaglio comodo al pollice, non piu' una barra a tutta riga */
  .site-header .menu-toggle {
    display: inline-flex; align-items: center; gap: 9px;
    width: auto; margin: 0; padding: 0 15px;
    height: 44px; line-height: 1;
    font-size: 14px; font-weight: 600;
    color: var(--msp-soft);
    background: rgba(148, 163, 184, .1);
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 10px;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
  }
  .site-header .menu-toggle::before {
    content: ''; width: 17px; height: 12px; flex: none;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 12'%3E%3Crect width='17' height='2' rx='1'/%3E%3Crect y='5' width='17' height='2' rx='1'/%3E%3Crect y='10' width='17' height='2' rx='1'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 12'%3E%3Crect width='17' height='2' rx='1'/%3E%3Crect y='5' width='17' height='2' rx='1'/%3E%3Crect y='10' width='17' height='2' rx='1'/%3E%3C/svg%3E") center/contain no-repeat;
  }
  .site-header .menu-toggle:hover,
  .site-header .menu-toggle:focus,
  .site-header .main-navigation.toggled .menu-toggle {
    background: rgba(59, 130, 246, .18);
    border-color: rgba(59, 130, 246, .5);
    color: #fff;
  }
  .site-header .menu-toggle:focus-visible { outline: 2px solid var(--msp-blue-l); outline-offset: 2px; }

  /* menu aperto: pannello a tutta larghezza SOTTO l'header, non dentro il bottone */
  .site-header .main-navigation .main-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--msp-navy);
    border-top: 1px solid var(--msp-border);
    border-bottom: 1px solid var(--msp-border);
    box-shadow: 0 22px 36px -22px rgba(2, 6, 23, .95);
    z-index: 60;
  }
  .site-header .main-navigation .main-nav > ul > li > a {
    line-height: 1.4; padding: 15px var(--msp-gut);
    border-top: 1px solid rgba(30, 41, 59, .8);
    font-size: 16px;
  }
  .site-header .main-navigation .main-nav > ul > li:first-child > a { border-top: 0; }
  .site-header .main-navigation .main-nav ul li.msp-nav-cta a {
    margin: 14px var(--msp-gut) 18px; padding: 0;
    line-height: 46px; text-align: center; border-top: 0;
  }
}

/* --- 4) HEADER TABLET (769-859px): la barra desktop andava a capo --------- */
@media (min-width: 769px) and (max-width: 980px) {
  .site-header .site-logo img,
  .site-header .site-logo img.header-image {
    width: auto; max-width: 175px; height: 32px; max-height: 32px; object-fit: contain;
  }
  .main-navigation .main-nav ul li a { font-size: 14px; padding-left: 12px; padding-right: 12px; }
  .main-navigation .main-nav ul li.msp-nav-cta a { padding: 0 13px; margin-left: 8px; }
}

/* --- 5) HERO: piu' compatto da telefono, skyline proporzionata ------------ */
@media (max-width: 768px) {
  .msp-hero { padding-top: 54px; padding-bottom: 104px; }
  .msp-hero::after { height: 104px; }
  .msp-hero .msp-hero-kicker { margin-bottom: 16px; font-size: 12px; }
  .msp-hero .msp-hero-sub { margin-bottom: 26px; }
}
@media (max-width: 560px) {
  /* due bottoni affiancati diventano illeggibili: pieni e impilati */
  .msp-hero .wp-block-buttons { flex-direction: column; align-items: stretch; gap: 10px; }
  .msp-hero .wp-block-button { width: 100%; }
  .msp-hero .wp-block-button__link { display: block; width: 100%; padding: 14px 20px; }
}

/* --- 6) CHIPS: una riga sola che scorre, non tre righe che riempiono lo schermo */
.msp-chips { padding-top: 24px; }
@media (max-width: 768px) {
  .msp-chips {
    flex-wrap: nowrap; justify-content: flex-start;
    overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 4px;
  }
  .msp-chips::-webkit-scrollbar { display: none; }
  .msp-chips a { flex: 0 0 auto; scroll-snap-align: start; }
}

/* --- 7) CARD: piu' larghezza al testo, altezze coerenti ------------------- */
.msp-cards .wp-block-post-excerpt__excerpt {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 700px) {
  .msp-cards .wp-block-post-template { gap: 18px; }
  .msp-cards-lg .msp-card-body { padding: 18px 18px 20px; gap: 9px; }
  .msp-cards-lg .wp-block-post-title { font-size: 1.2rem; }
  .msp-cards-lg .wp-block-post-excerpt { font-size: .93rem; }
}

/* --- 8) RITMO VERTICALE: con pochi articoli la pagina non deve galleggiare - */
@media (max-width: 768px) {
  .msp-section { padding-top: 34px; padding-bottom: 34px; }
  .msp-section-head { margin-bottom: 20px; }
  .msp-section-head h2 { font-size: 1.5rem; }
  .msp-cta { padding: 34px 22px; margin-top: 4px; margin-bottom: 44px; }
  .msp-cta h2 { font-size: 1.35rem; }
}

/* --- 8b) DESKTOP: composizione piu' densa, con pochi articoli la pagina non
   deve galleggiare in mezzo al bianco. I chip partono dalla stessa verticale
   del titolo di sezione e delle card, cosi' la colonna e' una sola. ---------- */
@media (min-width: 769px) {
  .msp-chips { justify-content: flex-start; padding-top: 20px; }
  .msp-section { padding-top: 48px; padding-bottom: 48px; }
  .msp-section-head { margin-bottom: 26px; }
  .msp-cta { margin-top: 0; margin-bottom: 56px; }
}

/* --- 9) ARTICOLO: margini laterali veri da telefono ----------------------- */
@media (max-width: 768px) {
  /* In home il gutter lo mettono gia' hero, chips, sezioni e CTA: il padding
     mobile che GeneratePress aggiunge a .entry-content si sommava al nostro e
     rubava 40px di larghezza alle card. */
  .home .entry-content { padding-left: 0; padding-right: 0; }
  .single-post .entry-header,
  .single-post .entry-content,
  .single-post .post-navigation,
  .single-post .comments-area {
    padding-left: var(--msp-gut); padding-right: var(--msp-gut);
    box-sizing: border-box;
  }
  .single-post .site-main .inside-article,
  body.page:not(.home) .site-main .inside-article { padding-top: 28px; padding-bottom: 40px; }
  .single-post .entry-content { font-size: 1.02rem; }
  .msp-byline-actions { margin-left: auto; }
}

/* --- 10) PAGINE DI TESTO E ARCHIVI: margine laterale a ogni larghezza ------
   Il contenitore di GeneratePress lascia spazio ai lati solo quando lo schermo
   supera la sua larghezza massima: sotto quella soglia (tipicamente fra 769 e
   1180px) il testo delle pagine e le schede degli archivi finivano attaccati al
   bordo. Qui il margine mancante viene calcolato: e' la differenza fra il gutter
   voluto e quello che il contenitore gia' offre, mai negativa. Cosi' non c'e'
   nessuno scalino quando si ridimensiona la finestra.
   Le sezioni della home e di /articoli/ sono escluse: il gutter ce l'hanno gia'. */
body.page:not(.home) .entry-header,
body.page:not(.home) .entry-content > :not(.msp-section):not(.msp-chips):not(.msp-cta):not(.msp-hero),
.archive .site-main > article,
.archive .page-header,
.search .site-main > article,
.search .page-header,
.error404 .site-main > .inside-article {
  margin-left: max(0px, calc(var(--msp-gut) - max(0px, (100vw - var(--msp-max)) / 2)));
  margin-right: max(0px, calc(var(--msp-gut) - max(0px, (100vw - var(--msp-max)) / 2)));
}
