/* Font ospitati sul sito (niente richieste a Google): solo il sottoinsieme latin, che copre l'italiano */
@font-face {
  font-family: "Bodoni Moda";
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url("/static/fonts/bodoni-moda-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bodoni Moda";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/static/fonts/bodoni-moda-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Sofia Sans";
  font-style: italic;
  font-weight: 1 1000;
  font-display: swap;
  src: url("/static/fonts/sofia-sans-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Sofia Sans";
  font-style: normal;
  font-weight: 1 1000;
  font-display: swap;
  src: url("/static/fonts/sofia-sans-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------------
   AI Trash Planet: il rotocalco del pianeta spazzatura.
   Giallo da settimanale di gossip, inchiostro nero, e la testata stampata
   con ciano e magenta fuori registro (l'unico vezzo: tutto il resto è sobrio).
   ------------------------------------------------------------------ */

:root {
  /* Palette: cambiare tema vuol dire cambiare solo queste variabili */
  /* "Carta patinata": magazine di lusso con la testata stampata storta */
  --fondo: #fff;              /* carta patinata */
  --fondo-2: #f1f1f4;         /* segnaposto delle immagini mentre caricano */
  --inchiostro: #000;         /* testo, filetti, barre */
  --inchiostro-2: #55555f;    /* testo secondario: 7.4:1 sul bianco */
  --accento: #e4007c;         /* bollino, evidenziatore, selezione */
  --su-accento: #fff;         /* testo sopra l'accento */
  --lastra-a: #00a3e0;        /* le due lastre fuori registro della testata */
  --lastra-b: #e4007c;
  --fusione: multiply;        /* multiply su carta chiara, screen su fondo scuro */

  --display: "Bodoni Moda", "Bodoni 72", Didot, "Times New Roman", serif;
  --testo: "Sofia Sans", "Helvetica Neue", Arial, sans-serif;

  --max: 1120px;              /* larghezza della colonna di testo */
  --gutter: clamp(20px, 4vw, 40px);
  --filetto: 3px solid var(--inchiostro);

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--inchiostro);
  font: 400 1.125rem/1.55 var(--testo);
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accento); color: var(--su-accento); }

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--accento); }
a:focus-visible { outline: 3px solid var(--inchiostro); outline-offset: 3px; border-radius: 2px; }

img { max-width: 100%; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 10;
  padding: 10px 16px; background: var(--inchiostro); color: var(--fondo);
  font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- Testata ---------- */

/* Testata, contenuto e colophon condividono la stessa colonna: i filetti si allineano */
.masthead, main, .colophon {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

.masthead { padding-top: clamp(16px, 3vw, 36px); }

.testata { display: inline-block; color: var(--inchiostro); text-decoration: none; }
.testata:focus-visible { outline-offset: 6px; }

.testata-ink {
  position: relative;
  display: inline-block;
  isolation: isolate;
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  font-variation-settings: "opsz" 96;
  font-size: clamp(2.6rem, 10.4vw, 8.75rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  padding-right: 0.08em; /* il corsivo sporge a destra */
}

/* Le due lastre colorate, appena fuori registro rispetto al nero */
.testata-ink::before,
.testata-ink::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  mix-blend-mode: var(--fusione);
  pointer-events: none;
}
.testata-ink::before {
  color: var(--lastra-a);
  transform: translate(-0.035em, 0.03em);
  animation: registro-ciano 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s both;
}
.testata-ink::after {
  color: var(--lastra-b);
  transform: translate(0.04em, -0.02em);
  animation: registro-magenta 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s both;
}

/* All'apertura le lastre "cercano il registro", come una rotativa che parte */
@keyframes registro-ciano { from { transform: translate(-0.3em, 0.16em); } }
@keyframes registro-magenta { from { transform: translate(0.32em, -0.12em); } }

.strip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 28px;
  margin-top: clamp(12px, 2vw, 20px);
  padding-block: 10px;
  border-top: var(--filetto);
  border-bottom: 1px solid var(--inchiostro);
  font-size: 0.9375rem;
  font-weight: 600;
}
.strip p { margin: 0; }
.strip-tagline { color: var(--inchiostro-2); font-weight: 500; }
.strip-nav { display: flex; gap: 4px 20px; margin-left: auto; }
.strip-nav a {
  display: inline-block;
  padding-block: 6px; /* area di tocco più comoda */
  font-weight: 800;
  text-decoration: none;
}
.strip-nav a:hover,
.strip-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 3px; }

/* ---------- Prima pagina ---------- */

main { padding-bottom: clamp(32px, 6vw, 72px); }

.dateline {
  margin: 0;
  color: var(--inchiostro-2);
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: lining-nums;
}

.lead {
  padding-block: clamp(24px, 4vw, 48px);
  border-bottom: var(--filetto);
}

.lead-body {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(20px, 3.5vw, 44px);
  align-items: start;
}

.lead-media, .article-figure { position: relative; display: block; margin: 0; }

.lead-img, .article-img, .story-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: var(--fondo-2);
  border: 3px solid var(--inchiostro);
}

.lead-title {
  max-width: 20ch;
  margin: 0 0 clamp(20px, 3vw, 32px);
  font-family: var(--display);
  font-weight: 800;
  font-variation-settings: "opsz" 96;
  font-size: clamp(2.3rem, 6vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.lead-title a, .story-title a { text-decoration: none; }
.lead-title a:hover, .story-title a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accento);
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.12em;
}

/* Il sommario, in corsivo come sotto i titoli dei settimanali */
.lead-excerpt {
  margin: 0 0 0.9em;
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-variation-settings: "opsz" 24;
  font-size: clamp(1.25rem, 1.9vw, 1.6rem);
  line-height: 1.35;
}

.lead-more { margin: 1.2em 0 0; }
.lead-more a {
  display: inline-block;
  padding: 10px 18px;
  background: var(--inchiostro);
  color: var(--fondo);
  font-weight: 800;
  text-decoration: none;
}
.lead-more a:hover { background: var(--accento); color: var(--su-accento); }

/* Il bollino: tutto quello che c'è qui è generato da un'AI */
.bollino {
  position: absolute;
  top: -22px;
  right: -14px;
  display: grid;
  place-items: center;
  width: clamp(76px, 9vw, 104px);
  aspect-ratio: 1;
  background: var(--accento);
  color: var(--su-accento);
  font-family: var(--testo);
  font-weight: 900;
  font-size: clamp(0.95rem, 1.2vw, 1.2rem);
  line-height: 1;
  text-align: center;
  transform: rotate(12deg);
  clip-path: polygon(50.0% 0.0%, 56.4% 9.5%, 65.5% 2.4%, 68.6% 13.5%, 79.4% 9.5%, 79.0% 21.0%, 90.5% 20.6%, 86.5% 31.4%, 97.6% 34.5%, 90.5% 43.6%, 100.0% 50.0%, 90.5% 56.4%, 97.6% 65.5%, 86.5% 68.6%, 90.5% 79.4%, 79.0% 79.0%, 79.4% 90.5%, 68.6% 86.5%, 65.5% 97.6%, 56.4% 90.5%, 50.0% 100.0%, 43.6% 90.5%, 34.5% 97.6%, 31.4% 86.5%, 20.6% 90.5%, 21.0% 79.0%, 9.5% 79.4%, 13.5% 68.6%, 2.4% 65.5%, 9.5% 56.4%, 0.0% 50.0%, 9.5% 43.6%, 2.4% 34.5%, 13.5% 31.4%, 9.5% 20.6%, 21.0% 21.0%, 20.6% 9.5%, 31.4% 13.5%, 34.5% 2.4%, 43.6% 9.5%);
}

.section { padding-top: clamp(24px, 4vw, 40px); }

.section-title {
  margin: 0 0 clamp(20px, 3vw, 32px);
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  line-height: 1.1;
}

.stories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: clamp(32px, 4vw, 48px) clamp(24px, 3vw, 40px);
}

.story-img { border-width: 2px; margin-bottom: 14px; }

/* In prima pagina i primi due articoli occupano metà riga ciascuno, gli altri un terzo */
@media (min-width: 861px) {
  .stories-featured { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stories-featured > .story { grid-column: span 2; }
  .stories-featured > .story:nth-child(-n + 2) { grid-column: span 3; }
  .stories-featured > .story:nth-child(-n + 2) .story-title { font-size: 2rem; line-height: 1.06; }
}

.story-title {
  margin: 0 0 0.4em;
  font-family: var(--display);
  font-weight: 700;
  font-variation-settings: "opsz" 28;
  font-size: 1.5rem;
  line-height: 1.12;
  text-wrap: balance;
}

.story-excerpt { margin: 0 0 0.6em; color: var(--inchiostro-2); font-size: 1.0625rem; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: clamp(32px, 5vw, 56px);
  padding-top: 14px;
  border-top: var(--filetto);
}
.pager a {
  display: inline-block;
  padding-block: 10px;
  font-size: 1.125rem;
  font-weight: 800;
}

/* ---------- Articolo ---------- */

.article { max-width: 54rem; padding-top: clamp(24px, 4vw, 48px); }

.article-title {
  margin: 0.2em 0 0.6em;
  font-family: var(--display);
  font-weight: 800;
  font-variation-settings: "opsz" 72;
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.article-body {
  max-width: 38rem;
  margin-top: clamp(24px, 4vw, 40px);
  font-size: clamp(1.25rem, 1.6vw, 1.4rem);
  line-height: 1.6;
}
.article-body p { margin: 0 0 1em; }

.article-note {
  max-width: 36rem;
  margin: 2em 0 0;
  padding-left: 16px;
  border-left: 6px solid var(--accento);
  color: var(--inchiostro-2);
  font-size: 0.975rem;
}

.article + .section { margin-top: clamp(40px, 6vw, 72px); border-top: var(--filetto); }

/* ---------- Avvisi: vuoto e 404 ---------- */

.notice { max-width: 40rem; padding-block: clamp(40px, 8vw, 96px); }
.notice h1 {
  margin: 0 0 0.4em;
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  font-size: clamp(2.25rem, 6vw, 4rem);
  line-height: 1.05;
  text-wrap: balance;
}
.notice p { font-size: 1.25rem; }

/* ---------- Diario ---------- */

.diary-head { padding-top: clamp(24px, 4vw, 48px); max-width: 46rem; }

.page-title {
  margin: 0 0 0.35em;
  font-family: var(--display);
  font-weight: 800;
  font-variation-settings: "opsz" 72;
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.page-intro { margin: 0; font-size: 1.25rem; max-width: 40rem; }

/* I numeri principali dentro una frase, evidenziati come col pennarello */
.diary-summary {
  max-width: 52rem;
  margin: clamp(28px, 5vw, 56px) 0;
  font-family: var(--display);
  font-size: clamp(1.4rem, 2.6vw, 2.1rem);
  line-height: 1.45;
}
.big {
  font-style: italic;
  font-weight: 900;
  font-size: 1.35em;
  line-height: 1;
  font-variant-numeric: lining-nums;
  padding-inline: 0.08em;
  background: linear-gradient(transparent 58%, color-mix(in srgb, var(--accento) 34%, transparent) 58%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.stage { max-width: 52rem; padding-block: 24px 8px; border-top: var(--filetto); }
.stage-title {
  margin: 0 0 4px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.6vw, 1.75rem);
}
.stage-n { font-style: italic; }
.stage-intro { margin: 0; color: var(--inchiostro-2); }
.stage-empty { color: var(--inchiostro-2); font-style: italic; }

.bars { display: grid; gap: 12px; margin: 20px 0 16px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
.bar-row dt { font-weight: 600; }
.bar-row dd { display: flex; align-items: center; gap: 12px; margin: 0; min-width: 0; }
.bar {
  display: block;
  flex-shrink: 1;
  width: var(--w);
  height: 18px;
  background: var(--inchiostro);
  border-radius: 0 4px 4px 0;
}
.bar-val { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-pct { color: var(--inchiostro-2); font-weight: 600; }

/* ---------- Colophon ---------- */

.colophon {
  padding-block: 24px 40px;
  border-top: var(--filetto);
  color: var(--inchiostro-2);
  font-size: 0.975rem;
}
.colophon p { max-width: 46rem; margin: 0 0 12px; }
.colophon a { display: inline-block; margin-right: 20px; padding-block: 6px; color: var(--inchiostro); font-weight: 700; }

/* ---------- Schermi stretti ---------- */

@media (max-width: 860px) {
  .lead-body { grid-template-columns: 1fr; }
  .strip-nav { margin-left: 0; width: 100%; }
}

@media (max-width: 560px) {
  .bar-row { grid-template-columns: 1fr; gap: 4px; }
  .bollino { top: -16px; right: -6px; }
}

@media (prefers-reduced-motion: reduce) {
  .testata-ink::before, .testata-ink::after { animation: none; }
}
