/* =========================================================
   BLOG CSS CONSOLIDATO
   Arti e Pensieri - News / Blog custom
   ========================================================= */

/* -----------------------------
   Sezione blog
----------------------------- */

.blog-page-wrapper, .blog-section, .blog-section .container {
  background: transparent !important;
}

.blog-section {
  position: relative;
}

/* -----------------------------
   Filtro categorie compatto
   Select a sinistra, Admin a destra
----------------------------- */

.blog-filter-bar {
  --blog-filter-height: 44px;
  margin: 0 0 1.75rem;
  padding: 0;
  max-width: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.blog-filter-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.blog-filter-label {
  display: none;
}

.blog-category-select {
  flex: 0 1 260px;
  width: auto;
  min-width: 220px;
  height: var(--blog-filter-height);
  min-height: var(--blog-filter-height);
  box-sizing: border-box;
  margin: 0;
  padding: 0 2.4rem 0 1rem;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.94);
  color: #333;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.035);
  cursor: pointer;
}

.blog-category-select:hover {
  border-color: rgba(43, 183, 168, 0.75);
  background-color: #ffffff;
}

.blog-category-select:focus {
  border-color: #2bb7a8;
  box-shadow: 0 0 0 0.18rem rgba(43, 183, 168, 0.18);
}

.blog-category-select option {
  color: #333;
  background: #ffffff;
  font-size: 0.9rem;
  font-weight: 500;
}

.blog-admin-link {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: var(--blog-filter-height) !important;
  min-height: var(--blog-filter-height) !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 1.15rem !important;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #333;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1 !important;
  text-align: center;
  text-decoration: none !important;
  text-transform: none;
  letter-spacing: 0;
  opacity: 1;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.035);
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.blog-admin-link:hover {
  border-color: rgba(43, 183, 168, 0.75);
  background: #ffffff;
  color: #1d7f74;
  text-decoration: none !important;
  box-shadow: 0 8px 22px rgba(43, 183, 168, 0.08);
}

/* Vecchio contenitore categorie: usato solo come sorgente dati per JS */

.blog-categories-source, #blogCategories.blog-categories-source {
  display: none !important;
}

/* -----------------------------
   Lista post
----------------------------- */

.blog-posts {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.blog-post-card, .blog-post {
  padding: 2rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.045);
  overflow: hidden;
}

.blog-post-card + .blog-post-card, .blog-post + .blog-post {
  margin-top: 0;
}

.blog-post:last-child {
  border-bottom: 0;
}

/* -----------------------------
   Meta post
----------------------------- */

.blog-post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.8rem;
  color: #777;
  font-size: 0.78rem;
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 1;
}

.blog-post-date, .blog-post-author, .blog-post-category {
  display: inline-flex;
  align-items: center;
}

.blog-post-category {
  color: #2bb7a8;
  font-weight: 700;
}

.blog-post-meta span:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-left: 0.75rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
}

/* -----------------------------
   Titolo post
----------------------------- */

.blog-post-title {
  margin: 0 0 1.2rem;
  color: #2bb7a8 !important;
  font-family: "GOOD BRUSH", cursive !important;
  font-size: clamp(2rem, 3vw, 2.5rem);
  font-weight: 400;
  font-style: normal;
  line-height: 1.08;
  letter-spacing: 0;
  text-transform: none;
}

.blog-post-title a {
  color: inherit;
  text-decoration: none;
}

.blog-post-title a:hover {
  color: #1d7f74;
}

/* -----------------------------
   Testo post
   Contenuti normalizzati: titoletti interni in h4
----------------------------- */

.blog-post-content {
  color: #222;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.55;
}

.blog-post-content * {
  font-family: inherit !important;
  font-size: inherit;
  line-height: inherit;
}

.blog-post-content p {
  margin: 0 0 0.38rem;
}

.blog-post-content p:last-child {
  margin-bottom: 0;
}

.blog-post-content p + p {
  margin-top: 0;
}

/* Se subito dopo un paragrafo o un titolo arriva una lista, la lista parte senza salto verticale extra */

.blog-post-content p + ul, .blog-post-content p + ol, .blog-post-content h1 + ul, .blog-post-content h2 + ul, .blog-post-content h3 + ul, .blog-post-content h4 + ul, .blog-post-content h5 + ul, .blog-post-content h6 + ul, .blog-post-content h1 + ol, .blog-post-content h2 + ol, .blog-post-content h3 + ol, .blog-post-content h4 + ol, .blog-post-content h5 + ol, .blog-post-content h6 + ol {
  margin-top: 0;
}

.blog-post-content strong, .blog-post-content b {
  font-weight: 700;
}

.blog-post-content em, .blog-post-content i {
  font-style: italic;
}

.blog-post-content a {
  color: #2bb7a8;
  font-weight: 600;
  text-decoration: none;
}

.blog-post-content a:hover {
  text-decoration: underline;
}

/* Titoletti interni dei vecchi post convertiti in h4 */

.blog-post-content h1, .blog-post-content h2, .blog-post-content h3, .blog-post-content h4, .blog-post-content h5, .blog-post-content h6 {
  margin: 0.78rem 0 0.08rem;
  color: #222;
  font-family: inherit;
  font-weight: 700;
  line-height: 1.2;
}

.blog-post-content h1 {
  font-size: 1.35rem;
}

.blog-post-content h2 {
  font-size: 1.25rem;
}

.blog-post-content h3 {
  font-size: 1.1rem;
}

.blog-post-content h4, .blog-post-content h5, .blog-post-content h6 {
  font-size: 1rem;
  text-transform: uppercase;
}

/* Elenchi puntati blog con pennellata */

.blog-post-content ul {
  list-style: none;
  margin: 0.22rem 0 0.55rem;
  padding-left: 0;
}

.blog-post-content ul li {
  position: relative;
  margin-bottom: 0.18rem;
  padding-left: 1.85rem;
  line-height: 1.55;
}

.blog-post-content ul li::before {
  content: "";
  position: absolute;
  left: 0.22rem;
  top: 0.78em;
  width: 0.9rem;
  height: 0.34rem;
  transform: translateY(-50%) rotate(-4deg);
  border-radius: 999px;
  background-color: var(--brush-bullet-color, #2bb7a8);
  opacity: 0.95;
}

.blog-post-content ul li::after {
  content: "";
  position: absolute;
  left: 0.32rem;
  top: 0.78em;
  width: 0.62rem;
  height: 0.18rem;
  transform: translateY(-50%) rotate(3deg);
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.28);
  pointer-events: none;
}

.blog-post-content ul li:last-child {
  margin-bottom: 0;
}

/* Liste numerate: restano numerate */

.blog-post-content ol {
  margin: 0.22rem 0 0.55rem 1.25rem;
  padding-left: 1rem;
}

.blog-post-content ol li {
  margin-bottom: 0.18rem;
  padding-left: 0.15rem;
  line-height: 1.55;
}

.blog-post-content ol li:last-child {
  margin-bottom: 0;
}

.blog-post-content img {
  max-width: 100%;
  height: auto;
}

.blog-post-content hr {
  margin: 0.75rem 0;
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}

/* -----------------------------
   Copertina + gallery immagini
   Cover banner 3:1, gallery 6 colonne desktop / 4 mobile
----------------------------- */

.blog-post-cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  margin: 1.15rem 0 0.85rem;
  border-radius: 18px;
  overflow: hidden;
  background: #f2f2f2;
}

.blog-post-cover .blog-gallery-item, .blog-post-cover button.blog-gallery-item {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
  cursor: zoom-in;
}

.blog-post-cover .blog-gallery-item img, .blog-post-cover button.blog-gallery-item img {
  position: absolute;
  left: 0;
  top: 50%;
  display: block;
  width: 100%;
  height: auto;
  min-height: 100%;
  max-width: none;
  transform: translateY(-50%);
  object-fit: unset;
  object-position: center center;
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.blog-post-cover .blog-gallery-item:hover img, .blog-post-cover button.blog-gallery-item:hover img {
  opacity: 0.94;
}

.blog-post-gallery, .blog-post-media, .blog-gallery {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 0.85rem 0 1.25rem;
}

.blog-post-gallery a, .blog-post-media a, .blog-gallery a, .blog-gallery-item, .blog-post-gallery a:first-child, .blog-post-media a:first-child, .blog-gallery a:first-child {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #f2f2f2;
  cursor: zoom-in;
}

.blog-post-gallery img, .blog-post-media img, .blog-gallery img, .blog-gallery-item img, .blog-post-gallery a:first-child img, .blog-post-media a:first-child img, .blog-gallery a:first-child img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease, opacity 0.25s ease, filter 0.25s ease;
}

.blog-post-gallery a:hover img, .blog-post-media a:hover img, .blog-gallery a:hover img, .blog-gallery-item:hover img {
  transform: scale(1.025);
  opacity: 0.92;
}

.blog-post-title + .blog-post-gallery, .blog-post-title + .blog-post-media, .blog-post-title + .blog-gallery {
  margin-top: 0.85rem;
}

.blog-post-gallery .is-cover, .blog-post-media .is-cover, .blog-gallery .is-cover, .blog-post-gallery .featured, .blog-post-media .featured, .blog-gallery .featured, .blog-post-gallery .cover, .blog-post-media .cover, .blog-gallery .cover {
  grid-column: auto !important;
  grid-row: auto !important;
}

.blog-post-highlight {
  animation: blogPostHighlight 1.8s ease;
  scroll-margin-top: 170px;
}

@keyframes blogPostHighlight {
  0%, 100% {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.045);
  }
  20%, 70% {
    box-shadow: 0 18px 46px rgba(43, 183, 168, 0.22);
  }
}

.blog-share {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1.15rem 0 0.35rem;
}

.blog-share-label {
  display: none;
}

.blog-share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #333;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.035);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.blog-share-button svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: currentColor;
}

.blog-share-button:hover {
  border-color: rgba(43, 183, 168, 0.75);
  background: #ffffff;
  color: #1d7f74;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(43, 183, 168, 0.08);
}

.blog-share-button.is-main {
  width: 38px;
  min-width: 38px;
  padding: 0;
  gap: 0;
  font-weight: 600;
}

.blog-share-button.is-main svg {
  width: 18px;
  height: 18px;
}

.blog-share-button.is-copied {
  border-color: rgba(43, 183, 168, 0.75);
  color: #1d7f74;
}

/* -----------------------------
   Tag
----------------------------- */

.blog-post-tags, .blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.4rem;
}

.blog-post-tags span, .blog-post-tags a, .blog-tags span, .blog-tags a {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(43, 183, 168, 0.1);
  color: #1d7f74;
  font-size: 0.75rem;
  line-height: 1.2;
  text-decoration: none;
}

.blog-post-tags a:hover, .blog-tags a:hover {
  background: rgba(43, 183, 168, 0.18);
}

/* -----------------------------
   Loader / messaggi
----------------------------- */

#blogLoader {
  min-height: 88px;
  color: #777;
  font-size: 0.95rem;
}

#blogLoader:not(.d-none) {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.blog-loader-text {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.25rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.035);
  opacity: 1;
}

#blogLoader:not(.d-none) .blog-loader-text::after, #blogLoader.is-loading .blog-loader-text::after {
  content: "";
  display: inline-block;
  width: 1.05rem;
  height: 1.05rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: blogSpin 0.8s linear infinite;
}

.blog-end-text {
  display: inline-block;
  padding: 0.7rem 1rem;
  color: #777;
  font-size: 0.9rem;
}

.blog-empty, .blog-error {
  opacity: 0.75;
}

.blog-error {
  color: #b00020;
}

@keyframes blogSpin {
  to {
    transform: rotate(360deg);
  }
}

/* -----------------------------
   Placeholder Bootstrap Studio
----------------------------- */

.blog-placeholder-preview {
  margin-bottom: 2rem;
  outline: 2px dashed rgba(43, 183, 168, 0.35);
  outline-offset: 6px;
}

.blog-placeholder-preview::before {
  content: "Anteprima placeholder - da rimuovere prima della pubblicazione";
  display: block;
  margin-bottom: 1rem;
  color: #2bb7a8;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* -----------------------------
   Lightbox
----------------------------- */

.blog-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: rgba(0, 0, 0, 0.86);
}

.blog-lightbox-open {
  overflow: hidden;
}

.blog-lightbox-img {
  max-width: min(1100px, 92vw);
  max-height: 86vh;
  object-fit: contain;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
}

.blog-lightbox-close, .blog-lightbox-prev, .blog-lightbox-next {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 999px;
  line-height: 1;
}

.blog-lightbox-close {
  top: 1.25rem;
  right: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 2rem;
}

.blog-lightbox-prev, .blog-lightbox-next {
  top: 50%;
  width: 3rem;
  height: 3rem;
  font-size: 2.5rem;
  transform: translateY(-50%);
}

.blog-lightbox-prev {
  left: 1.25rem;
}

.blog-lightbox-next {
  right: 1.25rem;
}

.blog-lightbox-close:hover, .blog-lightbox-prev:hover, .blog-lightbox-next:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* -----------------------------
   Tablet
----------------------------- */

@media (max-width: 991.98px) {
  .blog-filter-bar {
    max-width: 100%;
  }
}

@media (max-width: 991.98px) {
  .blog-post-card, .blog-post {
    padding: 1.6rem;
  }
}

@media (max-width: 991.98px) {
  .blog-post-gallery, .blog-post-media, .blog-gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* -----------------------------
   Mobile
----------------------------- */

@media (max-width: 767.98px) {
  .blog-section {
    padding-top: 2.25rem !important;
  }
}

@media (max-width: 767.98px) {
  .blog-filter-bar {
    --blog-filter-height: 42px;
    margin-bottom: 1.25rem;
  }
}

@media (max-width: 767.98px) {
  .blog-filter-main {
    flex-direction: row;
    align-items: center;
    gap: 0.65rem;
  }
}

@media (max-width: 767.98px) {
  .blog-category-select {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    height: var(--blog-filter-height);
    min-height: var(--blog-filter-height);
    font-size: 0.86rem;
  }
}

@media (max-width: 767.98px) {
  .blog-admin-link {
    flex: 0 0 auto !important;
    height: var(--blog-filter-height) !important;
    min-height: var(--blog-filter-height) !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 0.85rem !important;
    font-size: 0.86rem;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}

@media (max-width: 767.98px) {
  .blog-post-card, .blog-post {
    padding: 1.35rem;
    border-radius: 22px;
  }
}

@media (max-width: 767.98px) {
  .blog-post-title {
    font-size: clamp(1.9rem, 8vw, 2.35rem);
    line-height: 1.12;
  }
}

@media (max-width: 767.98px) {
  .blog-post-content {
    font-size: 0.97rem;
    line-height: 1.48;
  }
}

@media (max-width: 767.98px) {
  .blog-post-content p {
    margin-bottom: 0.3rem;
  }
}

@media (max-width: 767.98px) {
  .blog-post-content ul {
    margin-top: 0.16rem;
    margin-bottom: 0.42rem;
  }
}

@media (max-width: 767.98px) {
  .blog-post-content ul li {
    padding-left: 1.75rem;
    margin-bottom: 0.12rem;
    line-height: 1.5;
  }
}

@media (max-width: 767.98px) {
  .blog-post-content ul li::before {
    left: 0.18rem;
    top: 0.78em;
  }
}

@media (max-width: 767.98px) {
  .blog-post-content ul li::after {
    left: 0.28rem;
    top: 0.78em;
  }
}

@media (max-width: 767.98px) {
  .blog-post-content ol {
    margin-top: 0.16rem;
    margin-bottom: 0.42rem;
  }
}

@media (max-width: 767.98px) {
  .blog-post-content ol li {
    margin-bottom: 0.12rem;
    line-height: 1.5;
  }
}

@media (max-width: 767.98px) {
  .blog-post-content h1, .blog-post-content h2, .blog-post-content h3, .blog-post-content h4, .blog-post-content h5, .blog-post-content h6 {
    margin-top: 0.62rem;
    margin-bottom: 0.04rem;
    line-height: 1.18;
  }
}

@media (max-width: 767.98px) {
  .blog-post-cover {
    margin: 0.95rem 0 1.05rem;
    border-radius: 14px;
  }
}

@media (max-width: 767.98px) {
  .blog-post-gallery, .blog-post-media, .blog-gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
}

@media (max-width: 767.98px) {
  .blog-post-gallery a, .blog-post-media a, .blog-gallery a, .blog-gallery-item {
    border-radius: 8px;
  }
}

@media (max-width: 767.98px) {
  #blogLoader {
    min-height: 110px;
  }
}

@media (max-width: 767.98px) {
  .blog-loader-text {
    width: 100%;
    justify-content: center;
    border-radius: 18px;
  }
}

/* -----------------------------
   Mobile molto stretto
----------------------------- */

@media (max-width: 420px) {
  .blog-post-gallery, .blog-post-media, .blog-gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
}

.blog-load-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1.35rem;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #333;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.035);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.blog-load-more-btn:hover {
  border-color: rgba(43, 183, 168, 0.75);
  background: #ffffff;
  color: #1d7f74;
}

/* Correzioni V5: cover renderizzata come button per lightbox coerente con JS originale */

/* Correzione V6: la cover usa l'immagine full e object-fit: contain per evitare zoom/crop sui banner già panoramici. */

