/* ═══════════════════════════════════════════════════════════════════
   mt-a · Rassegna — ricerca, pagina risultati, strumenti del blog
   Dipende dai token definiti in mta-theme.css
   ═══════════════════════════════════════════════════════════════════ */

/* Riga strumenti: filtri categoria a sinistra, ricerca a destra */
.mta-rassegna-tools {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px 24px; flex-wrap: wrap; margin-bottom: 36px;
}
.mta-rassegna-tools .mta-filters { margin-bottom: 0; flex: 1 1 auto; }

/* Modulo di ricerca */
.mta-search {
  position: relative; display: flex; align-items: center;
  flex: 0 1 380px; min-width: min(100%, 260px);
}
.mta-search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--ink-3); pointer-events: none;
}
.mta-search-input {
  width: 100%; appearance: none; -webkit-appearance: none;
  padding: 11px 78px 11px 40px;
  border: 1px solid var(--border-default); border-radius: var(--radius-pill);
  background: var(--surface-card); color: var(--text-strong);
  font-family: var(--font-sans); font-size: var(--text-sm); line-height: 1.3;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.mta-search-input::placeholder { color: var(--ink-4); }
.mta-search-input:focus { outline: none; border-color: var(--ink); box-shadow: var(--ring-focus); }
.mta-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.mta-search-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: var(--ink); color: var(--paper); cursor: pointer;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  padding: 8px 13px; border-radius: var(--radius-pill);
  transition: background var(--dur-base) var(--ease-out);
}
.mta-search-btn:hover { background: var(--red); }

/* Dropdown risultati live */
.mta-search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  max-height: min(70vh, 520px); overflow-y: auto; text-align: left;
}
.mta-search-results[hidden] { display: none; }
.mta-sr-item {
  display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center;
  padding: 10px 14px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--border-subtle);
}
.mta-sr-item:last-child { border-bottom: 0; }
.mta-sr-item:hover, .mta-sr-item.is-active { background: var(--paper-2); color: inherit; }
.mta-sr-thumb { display: block; width: 56px; height: 42px; object-fit: cover; border-radius: var(--radius-sm); background: var(--sand); }
.mta-sr-type  { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.mta-sr-title { display: block; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-strong); line-height: 1.3; margin-top: 2px; }
.mta-sr-meta  { display: block; font-size: var(--text-xs); color: var(--text-faint); margin-top: 2px; }
.mta-sr-foot, .mta-sr-empty { display: block; padding: 12px 14px; font-size: var(--text-sm); color: var(--text-muted); text-decoration: none; line-height: 1.5; }
.mta-sr-foot { font-weight: var(--weight-medium); color: var(--text-strong); border-top: 1px solid var(--border-subtle); }
.mta-sr-foot:hover, .mta-sr-foot.is-active { background: var(--paper-2); color: var(--text-strong); }

/* Pagina risultati */
.mta-search-page .mta-search { max-width: 560px; margin-top: 28px; flex-basis: auto; }
.mta-search-count {
  font-family: var(--font-mono); font-size: var(--text-sm); color: var(--ink-3);
  letter-spacing: var(--tracking-wide); margin-bottom: 24px;
}
.mta-article-type {
  display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px;
}
.mta-article-type .mta-article-cat { color: var(--text-accent); }
.mta-search-empty { padding: clamp(16px, 3vw, 32px) 0 clamp(32px, 5vw, 56px); max-width: 62ch; }
.mta-search-empty h2 {
  font-family: var(--font-serif); font-weight: 400; letter-spacing: var(--tracking-tight);
  font-size: clamp(24px, 2.6vw, 34px); color: var(--ink); line-height: 1.15; margin-bottom: 12px;
}
.mta-search-empty p { color: var(--text-muted); line-height: var(--leading-relaxed); }
.mta-search-empty .mta-filters { margin-top: 20px; margin-bottom: 0; }

/* Conteggio articoli accanto alla categoria nel filtro */
.mta-filter small { font-family: var(--font-mono); opacity: .55; margin-left: 4px; letter-spacing: 0; }

/* Accessibilità: testo solo per screen reader (se il core non lo definisce) */
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); clip-path: inset(50%); white-space: nowrap; }

/* ── Articoli a blocchi (Gutenberg) dentro .mta-post-body ─────────────── */
.mta-post-body p.has-drop-cap:not(:focus)::first-letter {
  font-family: var(--font-serif); font-weight: 400; font-size: 4.6em; line-height: .78;
  float: left; margin: .08em .12em 0 0; color: var(--ink);
}
.mta-post-body .wp-block-image { margin: var(--space-10) 0; }
.mta-post-body .wp-block-image .wp-element-caption,
.mta-post-body .wp-block-gallery .wp-element-caption {
  font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-2); text-align: center; line-height: 1.5;
}
.mta-post-body .wp-block-gallery { margin: var(--space-10) 0; gap: var(--space-4); align-items: flex-start; }
.mta-post-body .wp-block-gallery .wp-block-image { margin: 0; }
.mta-post-body .wp-block-gallery.is-cropped .wp-block-image img { aspect-ratio: 4/3; object-fit: cover; height: auto; width: 100%; }
/* Didascalie SOPRA la foto (in basso, velo scuro, testo bianco) — scelta di Mario 12/09/2026.
   Vale per le immagini singole e per quelle in galleria, così sono tutte uguali. */
.mta-post-body .wp-block-image { position: relative; overflow: hidden; border-radius: var(--radius-md); }
.mta-post-body .wp-block-image img { display: block; width: 100%; }
.mta-post-body .wp-block-image figcaption.wp-element-caption,
.mta-post-body .wp-block-gallery.has-nested-images figure.wp-block-image figcaption.wp-element-caption {
  position: absolute; left: 0; right: 0; bottom: 0; width: 100%; margin: 0; box-sizing: border-box;
  padding: 44px 16px 12px; text-align: left;
  font-family: var(--font-sans); font-size: var(--text-xs); line-height: 1.45; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.72) 0%, rgba(0,0,0,.35) 55%, rgba(0,0,0,0) 100%);
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.mta-post-body .wp-block-image figcaption.wp-element-caption a { color: #fff; text-decoration: underline; }
.mta-post-body .wp-block-gallery.has-nested-images figure.wp-block-image { border-radius: var(--radius-md); overflow: hidden; }
.mta-post-body .wp-block-gallery.has-nested-images figure.wp-block-image img { border-radius: 0; }
.mta-post-body .wp-block-pullquote blockquote { border: 0; padding: 0; margin: 0; font-style: normal; }
.mta-post-body .wp-block-pullquote cite { display: block; margin-top: var(--space-3); font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-muted); font-style: normal; }
.mta-post-body .wp-block-separator { border: none; border-top: 1px solid var(--border-subtle); margin: var(--space-12) 0; width: 100%; }
.mta-post-body .wp-block-details {
  background: var(--paper-2); border-radius: var(--radius-md); padding: var(--space-5) var(--space-6); margin: var(--space-10) 0;
}
.mta-post-body .wp-block-details summary {
  font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--ink); cursor: pointer; list-style: none;
}
.mta-post-body .wp-block-details summary::-webkit-details-marker { display: none; }
.mta-post-body .wp-block-details summary::after { content: "+"; float: right; font-size: var(--text-md); }
.mta-post-body .wp-block-details[open] summary::after { content: "–"; }
.mta-post-body .wp-block-details p { font-size: var(--text-sm); line-height: 1.6; color: var(--text-muted); margin: var(--space-3) 0 0; }
.mta-post-body .wp-block-details p strong { color: var(--text-strong); font-weight: var(--weight-semibold); }
.mta-post-body .wp-block-quote { border-left: 3px solid var(--red); padding: var(--space-2) 0 var(--space-2) var(--space-6); margin: var(--space-8) 0; }
.mta-post-body .wp-block-quote cite { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); font-style: normal; }
@media (max-width: 720px) {
  .mta-post-body .wp-block-gallery.columns-2 { grid-template-columns: 1fr; }
  .mta-post-body .wp-block-gallery.columns-2 .wp-block-image { width: 100% !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   GUIDE — schemi come blocchi nativi (al posto dei PNG 1600×900)
   Group .mta-scheme > kicker / titolo / contenuto (columns, table, list) / nota
   ═══════════════════════════════════════════════════════════════════ */
.mta-post-body .mta-scheme {
  margin: var(--space-10) 0; padding: clamp(20px, 3vw, 32px) clamp(18px, 3vw, 32px);
  background: var(--paper-2); border-radius: var(--radius-lg);
}
.mta-post-body .mta-scheme p { font-size: var(--text-md); line-height: 1.55; margin-bottom: var(--space-3); }
.mta-post-body .mta-scheme-kicker {
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--red); margin: 0 0 6px !important;
}
.mta-post-body .mta-scheme-title, .mta-post-body h3.mta-scheme-title {
  font-family: var(--font-serif); font-weight: 400; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.15;
  letter-spacing: -0.01em; color: var(--ink); margin: 0 0 var(--space-5);
}
.mta-post-body .mta-scheme-intro { color: var(--text-muted); margin-bottom: var(--space-5) !important; }
.mta-post-body .mta-scheme-total { margin: var(--space-5) 0 0 !important; text-align: center; color: var(--text-muted); font-size: var(--text-sm) !important; }
.mta-post-body .mta-scheme-total strong { display: block; font-size: var(--text-lg); color: var(--ink); margin-bottom: 4px; }
.mta-post-body .mta-scheme-note {
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-wide); text-transform: uppercase;
  color: var(--ink-3); border-top: 1px solid var(--border-default); padding-top: var(--space-3); margin: var(--space-5) 0 0 !important;
}
/* colonne e card */
.mta-post-body .mta-scheme .wp-block-columns { gap: var(--space-4); margin: 0; }
.mta-post-body .mta-card {
  background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-5) var(--space-4); margin: 0;
}
.mta-post-body .mta-card.is-muted { background: var(--paper); border-color: transparent; }
.mta-post-body .mta-card.is-ink  { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.mta-post-body .mta-card.is-ok   { background: var(--blue); color: #fff; border-color: var(--blue); }
.mta-post-body .mta-card.is-ink p, .mta-post-body .mta-card.is-ok p,
.mta-post-body .mta-card.is-ink strong, .mta-post-body .mta-card.is-ok strong { color: inherit; }
.mta-post-body .mta-card.is-ok .mta-card-kicker, .mta-post-body .mta-card.is-ink .mta-card-kicker { color: rgba(255,255,255,.8); }
.mta-post-body .mta-card-kicker {
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--red); margin: 0 0 8px !important;
}
.mta-post-body .mta-card-kicker.is-muted { color: var(--ink-3); }
.mta-post-body .mta-card-title, .mta-post-body h4.mta-card-title {
  font-family: var(--font-serif); font-weight: 400; font-size: clamp(20px, 2.2vw, 24px); line-height: 1.15; color: var(--ink); margin: 0 0 8px;
}
.mta-post-body .mta-card-title.is-sans { font-family: var(--font-sans); font-weight: var(--weight-bold); font-size: var(--text-lg); }
.mta-post-body .mta-card-unit { font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--ink-3); margin: 0 !important; }
.mta-post-body .mta-card-num {
  font-family: var(--font-serif); font-weight: 400; font-size: clamp(40px, 5vw, 56px); line-height: 1; color: var(--red);
  margin: 6px 0 2px !important; letter-spacing: -0.02em;
}
.mta-post-body .mta-card-num small { font-size: .5em; }
.mta-post-body .mta-card-num.is-ink { color: var(--ink); }
.mta-post-body .mta-card.is-muted .mta-card-num { color: var(--ink-3); }
.mta-post-body .mta-card-label { font-size: var(--text-sm) !important; color: var(--text-muted); margin: 0 0 var(--space-4) !important; }
.mta-post-body .mta-card-text { font-size: var(--text-sm) !important; line-height: 1.55; margin-bottom: 0 !important; }
.mta-post-body .mta-card-line { font-size: var(--text-sm) !important; line-height: 1.5; margin: 0 0 6px !important; padding-top: 6px; border-top: 1px solid var(--border-subtle); }
.mta-post-body .mta-card-line.is-strong { border-top: 0; padding-top: 0; }
.mta-post-body .mta-card-line.is-strong strong { color: var(--ink); }
.mta-post-body .mta-card-line em { color: var(--red); font-style: normal; }
/* coppie etichetta / valore */
.mta-post-body .mta-kv { display: flex; justify-content: space-between; gap: 12px; font-size: var(--text-sm) !important; margin: 0 !important; padding: 7px 0; border-bottom: 1px solid var(--border-subtle); }
.mta-post-body .mta-kv:last-child { border-bottom: 0; }
.mta-post-body .mta-kv span { color: var(--text-muted); }
.mta-post-body .mta-kv strong { text-align: right; white-space: nowrap; }
.mta-post-body .mta-kv strong em { color: var(--red); font-style: normal; }
/* timeline a fasi */
.mta-post-body .mta-phase { margin: 0; }
.mta-post-body .mta-phase-bar {
  display: block; background: var(--ink); color: var(--paper); font-size: var(--text-sm) !important; font-weight: var(--weight-semibold);
  text-align: center; padding: 10px 12px; border-radius: var(--radius-md); margin: 0 0 10px !important;
}
.mta-post-body .mta-phase.is-grey .mta-phase-bar { background: var(--ink-2); }
.mta-post-body .mta-phase.is-red  .mta-phase-bar { background: var(--red); }
.mta-post-body .mta-phase-time { font-family: var(--font-mono); font-size: var(--text-sm) !important; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--ink); text-align: center; margin: 0 0 4px !important; }
.mta-post-body .mta-phase-note { font-size: var(--text-xs) !important; color: var(--text-muted); text-align: center; margin: 0 !important; }
/* flusso a passi (rete duale) */
.mta-post-body ol.mta-flow { list-style: none; padding: 0; margin: 0 0 var(--space-4); counter-reset: mtaflow; }
.mta-post-body ol.mta-flow li {
  counter-increment: mtaflow; position: relative; padding: 10px 0 10px 44px; margin: 0; font-size: var(--text-sm); line-height: 1.5;
  border-left: 2px solid var(--red); margin-left: 15px;
}
.mta-post-body ol.mta-flow li::before {
  content: counter(mtaflow, decimal-leading-zero); position: absolute; left: -16px; top: 10px; width: 30px; height: 30px;
  border-radius: 50%; background: var(--surface-card); border: 2px solid var(--red); color: var(--red);
  font-family: var(--font-mono); font-size: var(--text-2xs); display: flex; align-items: center; justify-content: center;
}
.mta-post-body ol.mta-flow li strong { color: var(--ink); }
/* tabella */
.mta-post-body .wp-block-table.mta-scheme-table { margin: 0 0 var(--space-2); }
.mta-post-body .mta-scheme-table table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); background: var(--surface-card); border-radius: var(--radius-md); overflow: hidden; }
.mta-post-body .mta-scheme-table th, .mta-post-body .mta-scheme-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); text-align: left; vertical-align: top; }
.mta-post-body .mta-scheme-table th { font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-3); font-weight: 500; background: var(--paper); }
.mta-post-body .mta-scheme-table td.num { font-family: var(--font-mono); white-space: nowrap; color: var(--ink); }
.mta-post-body .mta-scheme-table td.num.is-red { color: var(--red); }
.mta-post-body .mta-scheme-table td.num.is-blue { color: var(--blue); }
.mta-post-body .mta-scheme-table td small { display: block; color: var(--text-muted); font-size: var(--text-xs); white-space: normal; }
.mta-post-body .mta-scheme-table tr:last-child td { border-bottom: 0; }
/* barra proporzionale nelle tabelle (--a inizio, --b fine, in %) */
.mta-post-body .mta-bar { position: relative; display: block; height: 10px; background: var(--paper-2); border-radius: 5px; margin-top: 6px; overflow: hidden; min-width: 120px; }
.mta-post-body .mta-bar::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--a); width: calc(var(--b) - var(--a)); background: var(--red); border-radius: 5px; }
.mta-post-body .mta-bar.is-blue::after { background: var(--blue); }
@media (max-width: 781px) {
  .mta-post-body .mta-scheme .wp-block-columns { flex-direction: column; }
  .mta-post-body .mta-scheme .wp-block-column { flex-basis: 100% !important; width: 100%; }
  .mta-post-body .mta-scheme-table { overflow-x: auto; }
}

@media (max-width: 720px) {
  .mta-rassegna-tools { flex-direction: column-reverse; align-items: stretch; }
  .mta-search { width: 100%; flex-basis: auto; min-width: 0; }
  .mta-search-results { max-height: 60vh; }
}
