/* --------------------------------------------------
   2) Contenitore MAIN
--------------------------------------------------- */
.main-content {
/*  max-width: 900px; */           /* contenuto centrato e leggibile */
  margin: 40px auto;
  background: #ffffff;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  font-family: 'Open Sans', sans-serif;
  color: #343a40;
}

/* --------------------------------------------------
   3) Header del post
--------------------------------------------------- */
.post-header {
  text-align: center;
  margin-bottom: 30px;
}
.post-header h1 {
  font-family: 'Merriweather', serif;
  font-size: 2.75rem;
  font-weight: 700;
  color: #212529;
  margin-bottom: 20px;
}

/* --------------------------------------------------
   4) Immagine in evidenza 16:9
--------------------------------------------------- */
.post-featured-image {
  position: relative;
  width: 80%;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  aspect-ratio: 16/9;
  margin-bottom: 30px;
  padding-top: 0;
}
@media (max-width: 768px) {
  .post-featured-image {
    width: 100%;
  }
}


.post-featured-image img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;   /* ritaglio centrato */
}

/* --------------------------------------------------
   5) Contenuto articolo
--------------------------------------------------- */
.main-content article {
  font-size: 1rem;
  line-height: 1.8;
}

/* Headings */
.main-content h2,
.main-content h3,
.main-content h4 {
  font-family: 'Merriweather', serif;
  color: #212529;
  margin: 1.5em 0 0.5em;
  line-height: 1.25;
}
.main-content h1{
  font-family: 'Merriweather', serif;
  color: #212529;
  line-height: 1.25;
}
.main-content h1 { font-size: 2rem; }
.main-content h2 { font-size: 1.6rem; }
.main-content h3 { font-size: 1.3rem; }
.main-content h4 { font-size: 1.1rem; }

/* Paragrafi e formattazioni inline */
.main-content p { margin: 1.25em 0; }
.main-content strong,
.main-content b { font-weight: 600; color: #212529; }
.main-content em,
.main-content i { font-style: italic; }

/* Link */
.main-content a {
  color: #007bff;
  text-decoration: none;
  border-bottom: 1px solid rgba(0,123,255,0.3);
  transition: color .2s, border-color .2s;
}
.main-content a:hover {
  color: #0056b3;
  border-color: #0056b3;
}

/* Liste */
/*.main-content ul, .main-content ol {margin: 1em 0 1em 1.5em;}*/
.main-content li { margin-bottom: 0.5em; }

/* Blockquote */
.main-content blockquote {
  margin: 1.5em 0;
  padding: 0.75em 1em;
  border-left: 4px solid #dee2e6;
  background: #f8f9fa;
  font-style: italic;
}

/* Codice */
.main-content code {
  font-family: Consolas, Monaco, monospace;
  background: #e9ecef;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.95em;
}
.main-content pre {
  background: #e9ecef;
  padding: 1em;
  overflow-x: auto;
  border-radius: 6px;
  margin: 1.5em 0;
}

/* Figure e didascalie */
.main-content figure {
  margin: 1.5em 0;
  text-align: center;
}
.main-content figcaption {
  font-size: 0.875rem;
  color: #6c757d;
  margin-top: 0.5em;
}

/* Tabelle */
.main-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}
.main-content th,
.main-content td {
  border: 1px solid #dee2e6;
  padding: 0.3em;
  text-align: left;
}
.main-content th {
  background: #f1f3f5;
}

/* Orizzontale */
.main-content hr {
  border: none;
  height: 1px;
  background: #dee2e6;
  margin: 2em 0;
}

/* --------------------------------------------------
   6) Meta-data (data di creazione/aggiornamento)
--------------------------------------------------- */
.post-meta {
  margin-top: 2em;
  text-align: right;
  font-size: 0.875rem;
  color: #6c757d;
  font-family: 'Open Sans', sans-serif;
}
.post-meta small {
  margin-left: 1em;
}
.post-meta small:first-child {
  margin-left: 0;
}
/* ===========================
   Responsive MAIN (tablet)
   =========================== */
@media (max-width: 992px) {
  /* Wrapper: impila main e aside in colonna */
  .content-wrapper {
    display: flex;
    flex-direction: column;
  }

  /* Main a piena larghezza, margini ridotti */
  .main-content {
    width: 100%;
    margin: 20px auto;
    padding: 30px;
  }

  /* Titolo un po’ più piccolo sui tablet */
  .post-header h1 {
    font-size: 2.25rem;
  }

  /* Immagine featured mantiene 16:9 ma full-width */
  .post-featured-image {
    aspect-ratio: 16/9;      /* riserva altezza corretta */
    margin-bottom: 1.5rem;
    padding-top: 0;          /* assicurati di rimuovere l’hack */
  }

  /* Spazio tra articolo e meta ridotto */
  .post-meta {
    margin-top: 1.5rem;
    text-align: right;
  }
}

/* =============================
   Responsive MAIN (smartphone)
   ============================= */
@media (max-width: 576px) {
  /* Padding e margini ancora più compatti */
  .main-content {
    padding: 20px;
    margin: 15px auto;
  }

  /* Titolo e testo scalati per leggibilità */
  .post-header h1 {
    font-size: 1.85rem;
  }
  .main-content article {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  /* Meta ancora più piccolo */
  .post-meta {
    font-size: 0.8rem;
  }
}
/* FOOTER DELL’ARTICOLO */
.article-footer {
  border-top: 1px solid #dcdcdc;
  margin-top: 2.5rem;
  padding-top: 2rem;
  background-color: #fff;
  font-family: 'Open Sans', sans-serif;
}

/* ETICHETTA “Tag:” */
.post-tags__label {
  font-weight: 600;
  font-size: 0.95rem;
  color: #555;
  margin-right: 0.75rem;
  /* Da block a inline-block */
  display: inline-block;
  vertical-align: middle;
}

/* LISTA TAG */
.post-tags {
  list-style: none;
  padding: 0;
  margin: 0;
  display: inline-flex;      /* inline invece di flex pieno */
  flex-wrap: wrap;
  gap: 0.75rem;
  vertical-align: middle;    /* allinea con la label */
}

/* OGNI ITEM DELLA LISTA */
.post-tags li {
  margin: 0;
}

/* OGNI TAG COME “BADGE” */
.post-tags__item {
  display: inline-flex;
  align-items: center;
  padding: 0.35em 0.8em;
  font-size: 0.875rem;
  font-weight: 500;
  color: #0066cc;
  background-color: #f5faff;
  border: 1px solid #b3d4fc;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  text-decoration: none;
  transition: 
    background-color 0.2s ease, 
    border-color 0.2s ease,
    transform 0.1s ease,
    box-shadow 0.1s ease;
}

/* STATO HOVER/FOCUS */
.post-tags__item:hover,
.post-tags__item:focus {
  background-color: #e0f0ff;
  border-color: #80bfff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transform: translateY(-1px);
  outline: none;
}

/* MOBILE: badge più compatti */
@media (max-width: 576px) {
  .post-tags__item {
    padding: 0.3em 0.6em;
    font-size: 0.8rem;
  }
}
/* Ottimizza render iniziale: salta paint del fuori-schermo */
.post-body {
  content-visibility: auto;
  contain-intrinsic-size: 1000px 2000px; /* stima prudente per evitare CLS */
}
/* Override finale: allinea i titoli ad Open Sans */
.post-header h1,
.main-content h1, .main-content h2, .main-content h3, .main-content h4 {
  font-family: "Open Sans", Arial, "Helvetica Neue", system-ui, sans-serif !important;
}


/* override per centrare l'immagine nel header del post */
.post-header {
  text-align: center;
}
.post-header .post-featured-image {
  display: inline-block;
  width: 80%;
  margin: 0 auto 30px;
}
@media (max-width: 768px) {
  .post-header .post-featured-image {
    width: 100%;
  }
}


@media (max-width: 768px) {
  .table-mobile-cards {
    --card-bg: #ffffff;
    --card-border: #dbe3ea;
    --card-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);

    --title-bg: #eef4f8;
    --title-border: #2f6f9f;
    --title-color: #18354a;

    --body-bg: #fcfdfe;
    --body-color: #334155;

    --label-color: #5b6b79;
    --label-bg: #edf2f6;
  }

  .table-mobile-cards thead {
    display: none;
  }

  .table-mobile-cards,
  .table-mobile-cards tbody,
  .table-mobile-cards tr,
  .table-mobile-cards th,
  .table-mobile-cards td {
    display: block;
    width: 100%;
  }

  .table-mobile-cards tr {
    margin-bottom: 1rem;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
  }

  /* toglie zebra bootstrap */
  .table.table-striped.table-mobile-cards > tbody > tr:nth-of-type(odd) > *,
  .table.table-striped.table-mobile-cards > tbody > tr:nth-of-type(even) > * {
    --bs-table-accent-bg: transparent !important;
    box-shadow: none !important;
  }

  .table-mobile-cards th[scope="row"] {
    background: var(--title-bg) !important;
    color: var(--title-color) !important;
    border-left: 4px solid var(--title-border);
    border-bottom: 1px solid #d9e5ee;
    padding: 1rem 1rem 1rem 1.1rem;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.35;
    margin: 0;
  }

  .table-mobile-cards td {
    background: var(--body-bg) !important;
    color: var(--body-color);
    padding: .9rem 1rem;
    border: 0 !important;
    border-bottom: 1px solid #e8eef3 !important;
    white-space: normal;
    line-height: 1.5;
  }

  .table-mobile-cards td:last-child {
    border-bottom: 0 !important;
  }

  .table-mobile-cards td::before {
    content: attr(data-label);
    display: block;
    font-weight: 600;
    color: var(--label-color);
    margin-bottom: .35rem;
    font-size: .82rem;
    letter-spacing: .01em;
  }

  .table-responsive {
    overflow-x: visible !important;
  }
}