/* ContentNest — Editorial theme
 *
 * CSS custom properties sono iniettate via Ghost `codeinjection_head` dal backend
 * ContentNest per ciascun blog (--color-primary, --color-accent, --font-heading, ecc.).
 * Qui definiamo i fallback per quando il blog non ha branding custom.
 */

/* Font self-hosted (woff2 variabile, subset latin) — sostituiscono Google Fonts
   esterno (render-blocking). font-display: swap evita il FOIT; unicode-range
   limita al latino (i glifi fuori range usano il fallback di sistema). */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/fraunces.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: 'Inter';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('../fonts/inter.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;
}

:root {
  --color-primary: #8b1a1a;
  --color-accent: #d97757;
  --color-bg: #fdfcf8;
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
  --color-muted: #6b6558;
  --color-border: #e8e3d8;
  --font-heading: var(--gh-font-heading, "Fraunces", Georgia, serif);
  --font-body: var(--gh-font-body, "Inter", system-ui, sans-serif);
  --radius: 0.5rem;
  --max-width: 680px;
  /* --rubric-color è sovrascritto per-tag via codeinjection_head del backend.
     Default: accent del blog (parità con magazine/tech). */
  --rubric-color: var(--color-accent);
}

[data-theme="dark"] {
  --color-bg: #171411;
  --color-surface: #1f1b17;
  --color-text: #eee7d9;
  --color-muted: #a09988;
  --color-border: #2d2822;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1.75rem 1.5rem;
}
.site-header .wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
}
.site-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
  max-width: min(60%, 360px);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}
.site-title img { max-height: 2rem; width: auto; max-width: 100%; display: block; }
/* Menu rubriche — skin disclosure (struttura in cn-responsive.css) */
.rubric-nav__button {
  color: var(--color-muted);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
}
.rubric-nav__button:hover { color: var(--color-text); }
.rubric-nav__panel a { color: var(--color-muted); transition: color 0.15s; white-space: nowrap; }
.rubric-nav__panel a:hover,
.rubric-nav__panel a[aria-current="page"] { color: var(--color-text); }
.btn-subscribe {
  background: var(--color-primary);
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  transition: background 0.15s;
  display: inline-block;
}
.btn-subscribe:hover { background: var(--color-accent); color: #fff; }
.theme-toggle {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.15s;
}
.theme-toggle:hover { border-color: var(--color-text); color: var(--color-text); }

/* Intro (home) */
.intro {
  max-width: var(--max-width);
  margin: 4rem auto 3rem;
  padding: 0 1.5rem;
}
.intro h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.875rem, 5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.intro p {
  color: var(--color-muted);
  font-size: 1.1rem;
  line-height: 1.55;
  margin: 0;
}

/* Feed */
.feed {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
}
.post-card {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--color-border);
}
.post-card:last-child { border-bottom: none; }
.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.post-tag {
  color: var(--color-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
}
.post-dot { opacity: 0.4; }
.post-card h2 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 0.75rem;
  transition: color 0.15s;
}
.post-card:hover h2 { color: var(--color-primary); }
.post-excerpt {
  color: var(--color-muted);
  line-height: 1.6;
  margin: 0 0 1rem;
}
.post-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}
.author-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
}

/* Tag hero */
.tag-hero {
  max-width: var(--max-width);
  margin: 4rem auto 3rem;
  padding: 0 1.5rem;
  text-align: center;
}
.tag-eyebrow {
  color: var(--color-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: block;
}
.tag-hero h1 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.tag-hero p {
  color: var(--color-muted);
  font-size: 1.15rem;
  max-width: 540px;
  margin: 0 auto;
}
.tag-count {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  font-size: 0.85rem;
  color: var(--color-muted);
}
.tags-cloud {
  max-width: var(--max-width);
  margin: 4rem auto;
  padding: 0 1.5rem;
  text-align: center;
}
.tags-cloud h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  margin: 0 0 1rem;
}
.tags-cloud a {
  display: inline-block;
  margin: 0.25rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  font-size: 0.9rem;
  color: var(--color-muted);
  transition: all 0.15s;
}
.tags-cloud a:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Post single */
.post {
  max-width: var(--max-width);
  margin: 3rem auto;
  padding: 0 1.5rem;
}
.post .post-tag {
  display: inline-block;
  margin-bottom: 1rem;
}
.post-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.post-subtitle {
  font-family: var(--font-heading);
  font-weight: 400;
  font-style: italic;
  color: var(--color-muted);
  font-size: 1.35rem;
  line-height: 1.35;
  margin: 0 0 2rem;
}
.post-byline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 3rem;
}
.post-byline .author-avatar {
  width: 44px;
  height: 44px;
}
.byline-info { flex: 1; }
.byline-name { font-weight: 600; font-size: 0.95rem; }
.byline-meta { color: var(--color-muted); font-size: 0.85rem; }

.hero-image {
  margin: 0 0 2.5rem;
}
.hero-image img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
}
.hero-image figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  text-align: center;
  font-style: italic;
}

.post-body {
  font-size: 1.12rem;
  line-height: 1.7;
}
.post-body p { margin: 0 0 1.5rem; }
.post-body h2 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 1.75rem);
  letter-spacing: -0.015em;
  margin: 3rem 0 1rem;
}
.post-body h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.3rem;
  margin: 2.5rem 0 0.75rem;
}
.post-body a { color: var(--color-primary); border-bottom: 1px solid currentColor; }
.post-body blockquote {
  margin: 2rem 0;
  padding: 0.5rem 0 0.5rem 1.5rem;
  border-left: 3px solid var(--color-primary);
  font-family: var(--font-heading);
  font-weight: 400;
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--color-text);
}
.post-body ul, .post-body ol { padding-left: 1.2rem; margin: 0 0 1.5rem; }
.post-body li { margin-bottom: 0.5rem; }
.post-body figure { margin: 2rem 0; }
.post-body img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* Ghost Koenig editor card widths */
.gh-content .kg-width-wide {
  max-width: calc(var(--max-width) + 200px);
  margin-left: 50%;
  transform: translateX(-50%);
  position: relative;
}
.gh-content .kg-width-full {
  max-width: 100vw;
  width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
  position: relative;
}
.gh-content .kg-width-full img { width: 100%; border-radius: 0; }
.post-body pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.9rem;
}
.post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--color-surface);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}
.post-body pre code { background: none; padding: 0; }

.post-footer-cta {
  margin: 4rem 0 2rem;
  padding: 2.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) * 2);
  text-align: center;
}
.post-footer-cta h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}
.post-footer-cta p { color: var(--color-muted); margin: 0 0 1.5rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.9rem;
}
.site-footer a { color: var(--color-primary); text-decoration: underline; }

/* Error page */
.error-page {
  max-width: var(--max-width);
  margin: 6rem auto;
  padding: 0 1.5rem;
  text-align: center;
}
.error-code {
  font-family: var(--font-heading);
  font-size: 6rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0;
  line-height: 1;
}
.error-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin: 1rem 0 1.5rem;
}
.error-message { color: var(--color-muted); margin-bottom: 2rem; }

/* Pagination (Ghost built-in helper output) */
.pagination {
  max-width: var(--max-width);
  margin: 2rem auto 4rem;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--color-muted);
}
.pagination a { color: var(--color-primary); }
.pagination .older { margin-left: auto; }
.pagination .newer { margin-right: auto; }

/* (riduzioni @600 ora gestite dai clamp() su .post-title e .tag-hero h1) */

/* Skip-link accessibilità: visibile solo al focus tastiera */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 0.75rem 1rem;
  font-weight: 600;
  z-index: 9999;
  border-radius: 0 0 var(--radius) 0;
  transition: top 0.15s ease-in;
}
.skip-link:focus {
  top: 0;
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Touch target ≥ 44px su mobile (WCAG 2.5.5) */
.btn-subscribe {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 820px) {
  .theme-toggle {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .post-tag {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0.25rem 0;
  }
}

/* Error page suggerimenti (404) */
.error-actions { margin: 1.5rem 0; }
.error-suggestions {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  text-align: left;
}
.error-suggestions h2 {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  margin: 0 0 0.75rem;
}
.error-suggestions ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.error-suggestions li { margin: 0.5rem 0; }
.error-suggestions a {
  color: var(--color-primary);
  font-weight: 500;
}
.error-suggestions a:hover { text-decoration: underline; }

/* === AEO/GEO 2026: breadcrumb, lead answer, key takeaways === */
.breadcrumb {
  font-size: 0.8125rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.breadcrumb a { color: var(--color-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-primary); text-decoration: underline; }
.breadcrumb-sep { margin: 0 0.4em; color: var(--color-border); }
.breadcrumb-current { color: var(--color-text); }

.lead-answer {
  font-size: 1.15rem;
  line-height: 1.6;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 1.5rem;
}

.key-takeaways {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 0 0 2rem;
}
.key-takeaways > p:first-child {
  margin: 0 0 0.5rem;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-primary);
}
.key-takeaways ul { margin: 0; padding-left: 1.25rem; }
.key-takeaways li { margin: 0.35rem 0; }

/* === TOC (indice ancorato) === */
.toc {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 2rem;
  font-size: 0.9375rem;
}
.toc-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}
.toc ul { margin: 0; padding-left: 1.25rem; }
.toc li { margin: 0.25rem 0; }
.toc a { color: var(--color-text); text-decoration: none; }
.toc a:hover { color: var(--color-primary); text-decoration: underline; }

/* Autore E-E-A-T — card baked (partial cn-author): box in coda articolo + pagina autore */
.cn-author-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin: 3rem 0;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}
.cn-author-card .cn-author-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.cn-author-info { flex: 1; min-width: 0; }
.cn-author-name { margin: 0; font-weight: 600; font-size: 1rem; }
.cn-author-name a { color: inherit; text-decoration: none; }
.cn-author-name a:hover { text-decoration: underline; }
.cn-author-jobtitle { margin: 0.15rem 0 0; color: var(--color-muted); font-size: 0.85rem; }
.cn-author-bio { margin: 0.6rem 0 0; color: var(--color-text); font-size: 0.9rem; line-height: 1.5; }
.cn-author-social { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0.75rem 0 0; padding: 0; list-style: none; font-size: 0.85rem; }
.cn-author-social a { color: var(--color-primary); text-decoration: none; }
.cn-author-social a:hover { text-decoration: underline; }
.cn-author-knows { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.7rem 0 0; padding: 0; list-style: none; }
.cn-author-knows .cn-author-topic {
  background: var(--color-border);
  color: var(--color-muted);
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

/* Variante compatta in byline: solo avatar + nome (bio/social/competenze nascosti) */
.post-byline .cn-author-card {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  gap: 0.6rem;
  align-items: center;
}
.post-byline .cn-author-card .cn-author-avatar { width: 40px; height: 40px; }
.post-byline .cn-author-jobtitle,
.post-byline .cn-author-bio,
.post-byline .cn-author-social,
.post-byline .cn-author-knows { display: none; }


/* === cn-responsive.css (shared) === */
/* ContentNest — CSS responsive condiviso
 *
 * Regole STRUTTURALI agnostiche ai token, identiche nei 3 temi. build.mjs le
 * concatena in coda a `assets/css/main.css` di ogni tema (un solo file
 * render-blocking, niente <link> extra). Usano le variabili già definite dai
 * temi (--color-*, --max-width, --radius, --rubric-color), così ereditano sia
 * il default del tema sia il branding per-blog iniettato dal backend.
 *
 * Lo SKIN visivo (colori, tipografia, padding) resta in ciascun main.css.
 */

/* ============================================================
   Header chrome — gruppo azioni (logo + Tema + Iscriviti)
   ============================================================ */
.site-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  flex-shrink: 0;
}
/* Contesto di posizionamento per il dropdown rubriche (vedi sotto) */
.site-header { position: relative; }

/* ============================================================
   Menu rubriche — Disclosure Navigation (editorial)
   Pattern W3C APG: <button aria-expanded> + pannello di link.
   Fallback no-JS: pannello visibile come lista inline (il bottone è
   nascosto finché non c'è JS). Con .js (settato nello <script> inline in
   <head>, prima del paint → niente FOUC) il pannello diventa un dropdown
   ancorato e position:absolute, quindi la sua apertura NON causa reflow/CLS.
   ============================================================ */
.rubric-nav { position: relative; }

/* No-JS: bottone nascosto, pannello = lista inline */
.rubric-nav__button {
  display: none;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0 0.25rem;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}
.js .rubric-nav__button { display: inline-flex; }
.rubric-nav__chevron { transition: transform 0.2s ease; }
.js .rubric-nav__button[aria-expanded="true"] .rubric-nav__chevron { transform: rotate(180deg); }

.rubric-nav__panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
}
/* Con JS: pannello collassato in dropdown ancorato (absolute → no CLS) */
.js .rubric-nav__panel {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 50;
  min-width: 220px;
  max-height: 70vh;
  overflow-y: auto;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
  padding: 0.5rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.js .rubric-nav__button[aria-expanded="true"] + .rubric-nav__panel { display: flex; }
.js .rubric-nav__panel a {
  display: block;
  padding: 0.6rem 0.75rem;
  min-height: 44px;
  box-sizing: border-box;
}
/* Su mobile il dropdown si ancora all'header (non al bottone), così non sfora
   il bordo sinistro del viewport (no overflow-x del body). */
@media (max-width: 600px) {
  .js .rubric-nav { position: static; }
  .js .rubric-nav__panel { left: 1rem; right: 1rem; min-width: 0; }
}

/* ============================================================
   Menu rubriche — barra scrollabile (magazine / tech)
   Scroll orizzontale nativo (zero JS richiesto). Le fade ai bordi e
   l'affordance "is-overflow-*" sono attivate da cn-nav.js via
   IntersectionObserver (nessuno scroll listener, impatto INP nullo).
   ============================================================ */
.rubric-bar { position: relative; }
.rubric-bar__track {
  display: flex;
  align-items: center;
  gap: 0 1.25rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
  scrollbar-gutter: stable;        /* evita lo shift al primo scroll su scrollbar classiche */
  overscroll-behavior-x: contain;  /* non sfonda nella navigazione di sistema (swipe-back) */
  -webkit-overflow-scrolling: touch;
  scroll-padding-inline: 1.5rem;
}
.rubric-bar__track::-webkit-scrollbar { height: 6px; }
.rubric-bar__track::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}
/* Sentinelle inerti per l'IntersectionObserver (0 impatto layout) */
.rubric-bar__edge { flex: 0 0 1px; width: 1px; align-self: stretch; }
.rubric-bar__track a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  white-space: nowrap;
}

/* Fade ai bordi: overlay opacizzati (compositor-only, cheap). Default invisibili
   → no-JS = nessun fade ma scroll nativo comunque funzionante. */
.rubric-bar::before,
.rubric-bar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 2;
}
.rubric-bar::before { left: 0; background: linear-gradient(to right, var(--color-bg), transparent); }
.rubric-bar::after { right: 0; background: linear-gradient(to left, var(--color-bg), transparent); }
.rubric-bar.is-overflow-start::before { opacity: 1; }
.rubric-bar.is-overflow-end::after { opacity: 1; }

/* Focus visibile su tutti gli elementi nav (taglio della fade escluso: lo
   scroll-into-view nativo porta la voce in vista prima di mostrare l'outline) */
.rubric-nav__button:focus-visible,
.rubric-nav__panel a:focus-visible,
.rubric-bar__track a:focus-visible {
  outline: 2px solid var(--rubric-color, var(--color-primary));
  outline-offset: 2px;
  border-radius: 2px;
}

/* prefers-reduced-motion: azzera le micro-transizioni di nav */
@media (prefers-reduced-motion: reduce) {
  .rubric-nav__chevron,
  .rubric-bar::before,
  .rubric-bar::after { transition: none; }
}

/* ============================================================
   Corpo articolo — robustezza responsive (CSS-only, no wrapper HTML)
   Il contenuto vive in .post-body.gh-content (generato da {{content}}).
   img/figure/pre/kg-width-* sono già gestiti nei main.css per-tema.
   ============================================================ */

/* Tabelle larghe → scroll orizzontale CONTENUTO (niente overflow di pagina).
   display:block sul <table> crea il box scrollabile senza wrapper HTML (che
   non possiamo aggiungere: è dentro {{content}}); le righe restano tabellari
   via box anonimo. */
.post-body table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  font-size: 0.95em;
}
.post-body table th,
.post-body table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}
.post-body table th { font-weight: 600; background: var(--color-surface); }

/* Embed/iframe: mai più larghi del contenuto */
.post-body iframe { max-width: 100%; border: 0; }
/* Video Koenig (YouTube/Vimeo): responsive, niente altezza fissa che sfora */
.post-body iframe[src*="youtube.com"],
.post-body iframe[src*="youtube-nocookie.com"],
.post-body iframe[src*="youtu.be"],
.post-body iframe[src*="player.vimeo.com"] {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

/* Safety-net: card Koenig e gallery non sforano (card_assets copre il grosso) */
.post-body .kg-card,
.post-body .kg-gallery-container { max-width: 100%; }
.post-body .kg-embed-card { max-width: 100%; overflow-x: auto; }

/* ============================================================
   Touch target — area tap comoda CROSS-VIEWPORT (WCAG 2.5.5/2.5.8)
   Prima erano garantiti solo entro @media 820: qui valgono anche su desktop.
   ============================================================ */
.pagination a,
.tags-cloud a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.theme-toggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.breadcrumb a { display: inline-flex; align-items: center; min-height: 24px; }

/* ============================================================
   Breakpoint tablet — graduazione della spaziatura barra rubriche
   (colma il salto fra i breakpoint feed 900/600; il riflow del feed è in fase 4)
   ============================================================ */
@media (max-width: 768px) {
  .rubric-bar__track { gap: 0 1rem; padding-block: 0.4rem; }
}

/* ============================================================
   Author card → impila su mobile stretto.
   La variante compatta in .post-byline (avatar + nome) resta in riga.
   ============================================================ */
@media (max-width: 480px) {
  .cn-author-card { flex-direction: column; align-items: flex-start; }
  .post-byline .cn-author-card { flex-direction: row; align-items: center; }
}
