/* ═══════════════════════════════════════════════════════════════
   css/news.css — algo-freedom society
   Novità / News. Eredita hero, filtri, badge e paginazione da
   press.css e press_detail.css: qui solo ciò che è specifico.
   ═══════════════════════════════════════════════════════════════ */

.news-page { padding-block: 1.75rem 2.5rem; }
.news-filter { margin-bottom: 1.5rem; border-radius: var(--radius); }
.news-narrow { max-width: 860px; }

/* ─── Card ────────────────────────────────────────────────────── */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 22px;
}
.news-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .16s ease;
}
.news-card:hover, .news-card:focus-within { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.news-card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #0f2a46 0%, #1a3f60 100%);
}
.news-card-media > img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.news-card:hover .news-card-media > img { transform: scale(1.04); }
.news-card-placeholder { height: 100%; display: grid; place-items: center; }
.news-card-placeholder img { width: 64px; height: auto; opacity: .35; filter: brightness(0) invert(1); }

.news-card-play, .news-embed-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 56px; height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  transition: transform .16s ease;
}
.news-card-play svg, .news-embed-play svg { width: 22px; height: 22px; fill: var(--nav-2); margin-left: 3px; }

.news-card-body { display: flex; flex-direction: column; gap: .6rem; padding: 18px 20px 20px; flex: 1; }
.news-card-meta { display: flex; align-items: center; justify-content: space-between; gap: .6rem; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.news-card-title { margin: 0; font-size: 17px; font-weight: 800; line-height: 1.34; color: #1b2a44; text-wrap: pretty; }
.news-card-title a { color: inherit; }
.news-card-title a:hover { color: var(--accent-2); }
/* Tutta la card è cliccabile, ma nel tab order resta un solo link */
.news-card-title a::after { content: ""; position: absolute; inset: 0; }
.news-card-title a:focus-visible { outline: none; }
.news-card:has(.news-card-title a:focus-visible) { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.news-card-excerpt { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }

/* In primo piano: immagine e testo affiancati se c'è spazio */
.news-card--lead { margin-bottom: 26px; }
@media (min-width: 820px) {
  .news-card--lead { flex-direction: row; }
  .news-card--lead .news-card-media { flex: 1.35; aspect-ratio: auto; min-height: 340px; }
  .news-card--lead .news-card-media > img { position: absolute; inset: 0; }
  .news-card--lead .news-card-body { flex: 1; justify-content: center; padding: clamp(24px, 3vw, 40px); gap: .9rem; }
}
.news-card--lead .news-card-title { font-size: clamp(1.35rem, 2.4vw, 1.9rem); font-weight: 900; line-height: 1.22; text-wrap: balance; }
.news-card--lead .news-card-excerpt { font-size: 15.5px; }

/* ─── Articolo ────────────────────────────────────────────────── */
.news-hero .prd-title { font-size: clamp(1.55rem, 4vw, 2.5rem); line-height: 1.18; text-wrap: balance; }
.news-dek { margin: 0; font-size: clamp(1rem, 1.8vw, 1.2rem); line-height: 1.55; color: rgba(255, 255, 255, .86); text-wrap: pretty; }
.news-article { padding-block: 0 2.5rem; }
.news-cover { margin: 1.75rem 0 0; }
.news-cover img {
  width: 100%; height: auto;
  display: block;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

/* Giustificato di default; hyphens evita i buchi tra le parole sugli schermi stretti */
.news-prose { margin-top: 1.9rem; font-size: 1.075rem; line-height: 1.75; color: #1e293b; overflow-wrap: break-word; text-align: justify; hyphens: auto; }
.news-prose .afs-align-left { text-align: left; }
.news-prose .afs-align-right { text-align: right; }
.news-prose > :first-child { margin-top: 0; }
.news-prose p, .news-prose ul, .news-prose ol { margin: 0 0 1.15em; }
.news-prose ul, .news-prose ol { padding-left: 1.4em; }
.news-prose li { margin-bottom: .35em; }
.news-prose h2 { margin: 1.7em 0 .55em; font-size: 1.45rem; font-weight: 800; line-height: 1.28; color: #1b2a44; }
.news-prose h3 { margin: 1.5em 0 .5em; font-size: 1.18rem; font-weight: 800; color: #1b2a44; }
.news-prose a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }
.news-prose blockquote {
  margin: 1.5em 0;
  padding: .3em 0 .3em 1.2em;
  border-left: 4px solid var(--accent);
  font-size: 1.14em;
  font-style: italic;
  color: var(--nav-1);
}

.news-block { margin-top: 2.5rem; }
.news-block h2 { margin: 0 0 1rem; font-size: 1.25rem; font-weight: 800; color: #1b2a44; }

/* ─── Embed al clic ───────────────────────────────────────────── */
.news-embed { margin: 0 0 1.75rem; }
.news-embed-facade, .news-embed iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #0f2a46 0%, #2f5f86 100%);
  box-shadow: var(--shadow);
}
.news-embed--tall .news-embed-facade, .news-embed--tall iframe { aspect-ratio: 9 / 16; max-width: 340px; margin-inline: auto; }
.news-embed--post .news-embed-facade, .news-embed--post iframe { aspect-ratio: auto; height: 600px; max-width: 520px; margin-inline: auto; background-color: #fff; }
.news-embed--post .news-embed-facade { height: 260px; }
.news-embed-facade { position: relative; padding: 0; overflow: hidden; cursor: pointer; color: #fff; }
.news-embed-facade img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-embed-facade:hover .news-embed-play { transform: scale(1.1); }
.news-embed-facade:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.news-embed-platform {
  position: absolute;
  left: 12px; bottom: 12px;
  padding: .25rem .65rem;
  border-radius: 999px;
  background: rgba(8, 22, 44, .78);
  font-size: 12px;
  font-weight: 700;
}
.news-embed figcaption { display: flex; flex-wrap: wrap; gap: .25rem .75rem; margin-top: .55rem; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.news-embed figcaption strong { flex-basis: 100%; font-size: 14px; color: #1b2a44; }
.news-embed figcaption a { color: var(--accent-2); font-weight: 700; white-space: nowrap; }

/* ─── Galleria e link ─────────────────────────────────────────── */
.news-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 10px; }
.news-gallery a { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius-sm); }
.news-gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.news-gallery a:hover img { transform: scale(1.05); }
.news-gallery a:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }

.news-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.news-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.05rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, transform .15s ease;
}
.news-links a:hover { border-color: var(--accent-2); transform: translateX(2px); }
.news-links strong { color: #1b2a44; font-size: 14.5px; overflow-wrap: anywhere; }
.news-links span { flex-shrink: 0; color: var(--muted); font-size: 12.5px; }

/* ─── Autore ──────────────────────────────────────────────────── */
.news-author { margin: 2.5rem 0 0; font-size: 14.5px; color: #1b2a44; }
.news-author span { color: var(--muted); }
.news-author a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }
.news-author + .news-share { margin-top: 1.1rem; }

/* ─── Condivisione ────────────────────────────────────────────── */
.news-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-top: 2.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}
.news-share strong { margin-right: .35rem; color: #1b2a44; font-size: 14px; }
.news-share a, .news-share button {
  padding: .42rem .85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--nav-1);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.news-share a:hover, .news-share button:hover { background: var(--nav-2); color: #fff; }

/* ─── Altre novità ────────────────────────────────────────────── */
.news-related { padding-block: 2.5rem 3rem; background: #e6ebf2; }
.news-related-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.news-related-head h2 { margin: 0; font-size: 1.4rem; font-weight: 900; color: #1b2a44; }
.news-related-head a { color: var(--accent-2); font-size: 14px; font-weight: 700; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .news-card, .news-card-media > img, .news-gallery img, .news-links a, .news-card-play, .news-embed-play { transition: none; }
  .news-card:hover, .news-card:focus-within { transform: none; }
  .news-card:hover .news-card-media > img, .news-gallery a:hover img { transform: none; }
}
