/* Layout: colonna di lettura stretta per l'apertura; i temi sono schede che si alternano a destra e a sinistra su schermi larghi */
:root {
  --bg: #f3f6f7;          /* bianco con riflesso d'acqua */
  --surface: #ffffff;
  --ink: #102530;         /* blu notte adriatico */
  --muted: #4a6370;
  --fb: #1877f2;
  --wa: #128c4a;
  --line: #d6e1e5;
  --accent: #0b6f8f;      /* mare di Rimini */
  --accent-soft: #e1f0f4;
  --marker: #ffe45c;      /* evidenziatore */
  --marker-ink: #102530;
  --warn: #8a5a00;
  --warn-soft: #fbf1dc;
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Literata", "Iowan Old Style", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1a21; --surface: #12242d; --ink: #e4eef1; --muted: #a6bcc5; --fb: #4b93f5; --wa: #1fa463; --line: #23404c;
    --accent: #5cc0dd; --accent-soft: #163845; --marker: #d9b72a; --marker-ink: #0c1a21;
    --warn: #f0c26a; --warn-soft: #33290f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1a21; --surface: #12242d; --ink: #e4eef1; --muted: #a6bcc5; --fb: #4b93f5; --wa: #1fa463; --line: #23404c;
  --accent: #5cc0dd; --accent-soft: #163845; --marker: #d9b72a; --marker-ink: #0c1a21;
  --warn: #f0c26a; --warn-soft: #33290f;
  color-scheme: dark;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.1875rem;
  line-height: 1.6;
}
.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 2rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
}
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* Testata */
.masthead { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.brand { margin: 0; display: flex; flex-direction: column; }
.brand .pre {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.25rem, 4vw, 1.6rem);
  letter-spacing: -0.01em;
  color: var(--muted);
}
.brand .city {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(4rem, 19vw, 7.5rem);
  line-height: 0.85;
  letter-spacing: -0.045em;
  color: var(--accent);
  margin-left: -0.04em;
}
.meta {
  font-family: var(--font-display);
  font-size: clamp(0.72rem, 3.1vw, 0.95rem);
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  gap: 0.6em;
  font-variant-numeric: tabular-nums;
}
.meta .sep { opacity: 0.5; }
.meta .clock { color: var(--ink); font-weight: 500; }
.meta .short { display: none; }
@media (max-width: 26rem) {
  .meta .long { display: none; }
  .meta .short { display: inline; }
}
.lede {
  font-size: 1.3rem;
  line-height: 1.7;
  margin: 0;
}

/* Evidenziatore */
.mark {
  text-decoration: none;
  color: var(--marker-ink);
  background-image: linear-gradient(100deg, transparent 0.15em, var(--marker) 0.3em, var(--marker) calc(100% - 0.3em), transparent calc(100% - 0.1em));
  background-size: 100% 0.95em;
  background-position: 0 70%;
  background-repeat: no-repeat;
  padding-inline: 0.15em;
  margin-inline: -0.1em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  border-radius: 0.2em;
}
.mark:hover { background-size: 100% 1.15em; }

/* Barra delle testate */
.outlets-bar {
  border-block: 1px solid var(--line);
  overflow: hidden;
  min-width: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent);
}
.outlets-track { display: flex; width: max-content; }
.outlets-list {
  display: flex;
  gap: 2.25rem;
  padding: 0.7rem 2.25rem 0.7rem 0;
  margin: 0;
  list-style: none;
}
.outlets-list a {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--muted);
  text-decoration: none;
}
.outlets-list a:hover { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .outlets-track { animation: scorri 40s linear infinite; }
  .outlets-bar:hover .outlets-track, .outlets-bar:focus-within .outlets-track { animation-play-state: paused; }
}
@media (prefers-reduced-motion: reduce) {
  .outlets-bar { -webkit-mask-image: none; mask-image: none; }
  .outlets-track { width: auto; }
  .outlets-list { flex-wrap: wrap; gap: 0.4rem 1.5rem; padding-right: 0; }
  .outlets-list[aria-hidden="true"] { display: none; }
}
@keyframes scorri { to { transform: translateX(-50%); } }

/* Etichette di sezione */
.section-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Editoriale */
.editorial {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem 1.5rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.editorial .kicker {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.byline { display: flex; align-items: center; gap: 0.9rem; }
.portrait {
  width: 3.75rem;
  height: 3.75rem;
  flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.portrait svg { width: 100%; height: 100%; display: block; }
.byline-text { display: flex; flex-direction: column; min-width: 0; }
.byline-text .lead { font-family: var(--font-display); font-size: 0.85rem; color: var(--muted); }
.byline-text .name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; line-height: 1.2; }
.byline-text .role { font-size: 0.85rem; color: var(--muted); font-style: italic; }
.editorial h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 4vw, 1.75rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}
.editorial .body { display: flex; flex-direction: column; gap: 0.8rem; }
.editorial .body p { margin: 0; }
.editorial .body p:first-child::first-letter {
  font-family: var(--font-display);
  font-weight: 800;
  float: left;
  font-size: 3.1em;
  line-height: 0.85;
  padding: 0.08em 0.1em 0 0;
  color: var(--accent);
}

/* Temi: schede alternate */
.topics { display: flex; flex-direction: column; gap: 1.5rem; }
.topic {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.4rem 1.4rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  scroll-margin-top: 1.5rem;
}
.topic:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topic h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}
.topic p { margin: 0; }
/* Il rimando: la frase sottolineata che apre l'articolo della testata */
.topic .pointer a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.topic .pointer a:hover { background: var(--accent-soft); }

/* Elenco fonti */
.sources {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}
.sources li { border-bottom: 1px solid var(--line); }
.topic .sources li:last-child { border-bottom: 0; }
.sources a {
  display: grid;
  grid-template-columns: 8.5rem 1fr auto;
  gap: 0.75rem;
  padding: 0.7rem 0.25rem;
  min-height: 48px;
  text-decoration: none;
  align-items: baseline;
  border-radius: 4px;
}
.sources a:hover { background: var(--accent-soft); }
.src {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
}
.hl { font-size: 1rem; line-height: 1.45; min-width: 0; }
.arrow { font-family: var(--font-display); font-weight: 700; color: var(--accent); font-size: 0.9rem; white-space: nowrap; }

/* Di cosa si tratta */
.context { border-radius: 10px; background: var(--accent-soft); }
.context summary {
  list-style: none;
  cursor: pointer;
  min-height: 48px;
  padding: 0.6rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
}
.context summary::-webkit-details-marker { display: none; }
.context summary::after {
  content: "";
  width: 0.6rem; height: 0.6rem;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(45deg) translateY(-25%);
  flex: none;
}
.context[open] summary::after { transform: rotate(-135deg) translateY(-25%); }
.context summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.context-body { padding: 0 0.9rem 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; font-size: 1.05rem; }
.context-body p { margin: 0; }
.context-body .prev { font-family: var(--font-display); font-size: 0.9rem; color: var(--muted); }
.context-body .prev a { color: var(--accent); font-weight: 700; text-underline-offset: 3px; }

/* Condividi */
.share { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.2rem; }
.share a {
  flex: 1 1 10rem;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: #ffffff;
  text-decoration: none;
  padding: 0.5rem 1rem;
}
.share svg { width: 1.25rem; height: 1.25rem; flex: none; }
.share .fb { background: var(--fb); }
.share .wa { background: var(--wa); }
.share a:hover { filter: brightness(1.08); }

/* Altri titoli */
.note { font-size: 0.9rem; color: var(--muted); margin: -0.6rem 0 0.8rem; }

/* Piede */
footer { display: flex; flex-direction: column; gap: 1.25rem; font-size: 0.9rem; color: var(--muted); }
footer h3 { font-family: var(--font-display); color: var(--ink); font-size: 1rem; margin: 0 0 0.3rem; }
footer p { margin: 0; max-width: 38rem; }

@media (max-width: 34rem) {
  .topic { padding: 1.1rem 1rem 0.9rem; }
  .sources a { grid-template-columns: 1fr auto; gap: 0.1rem 0.75rem; }
  .sources .src { grid-column: 1 / -1; }
  .sources .hl { grid-column: 1; }
  .sources .arrow { grid-column: 2; grid-row: 2; }
}
@media (min-width: 60rem) {
  .wrap { max-width: 62rem; }
  .editorial-wrap, .others, footer { max-width: 46rem; }
  .topics { gap: 2rem; }
  .topic { width: min(40rem, 70%); }
  .topic:nth-child(even) { align-self: flex-end; }
}
@media (prefers-reduced-motion: no-preference) {
  .sources a { transition: background-color 120ms ease; }
  .mark { transition: background-size 150ms ease; }
  .topic { transition: border-color 200ms ease, box-shadow 200ms ease; }
  html { scroll-behavior: smooth; }
}

/* Testata cliccabile e ritorno alla pagina dell'edizione */
.brand a { color: inherit; text-decoration: none; display: flex; flex-direction: column; }
.back { margin: 1.5rem 0 2rem; font-family: var(--font-display); font-weight: 700; }
.back a { color: var(--accent); display: inline-block; min-height: 48px; line-height: 48px; text-underline-offset: 3px; }
