:root {
  --primary: #006db7;
  --primary-dark: #e96f14;
  --secondary: #2c2c2c;
  --accent: #62a5d9;
  --bg-main: #ffffff;
  --bg-soft: #ffffff;
  --border: #d6dfe2;
  --text-main: #2c2c2c;
  --text-muted: #4f6772;

  /* FULL WIDTH */
  --max-width: 100%;

  /* colonna centrale desktop: SEMPRE 1040px */
  --content-max: 1040px;

  --shadow-soft: 0 8px 24px rgba(0,0,0,0.06);
  --radius-md: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* HEADER */
.site-header {
  background-color: #ffd502;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 3px 8px rgba(0,0,0,0.04);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-block { display: flex; flex-direction: column; justify-content: center; }
.logo-link { display: inline-flex; align-items: center; }
.logo-img { height: 40px; width: auto; }

/* TOP NAV */
.top-nav { flex: 1; display: flex; justify-content: center; }

.top-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 18px;
  font-size: 0.9rem;
}

.nav-item { position: relative; }

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #2c2c2c;
  padding: 6px 0;
  text-decoration: none;
  font-weight: 500;
}

.nav-link:hover { color: var(--primary); text-decoration: none; }

.nav-link.active {
  color: var(--primary);
  font-weight: 500;
  box-shadow: inset 0 -2px 0 var(--primary);
}

.nav-submenu a.active,
.nav-sublink.active,
.nav-link[aria-current="page"],
.nav-sublink[aria-current="page"] {
  color: var(--primary);
  font-weight: 500;
}

.nav-item.has-children > .nav-link::after { content: "▾"; font-size: 0.7rem; }

.nav-submenu {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background-color: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 999;
}

.nav-submenu li a {
  display: block;
  padding: 6px 12px;
  color: var(--text-main);
  font-size: 0.86rem;
  white-space: nowrap;
}

.nav-submenu li a:hover { background-color: #e8f0fb; color: var(--primary-dark); }

.nav-item.has-children:hover > .nav-submenu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.header-right { display: flex; align-items: center; gap: 8px; }

/* Carrello anche in editoriale quando il menu è condiviso con lo shop */
body:not(.theme-shop) .shop-cart-btn { position: relative; }
body:not(.theme-shop) .shop-cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #c62828;
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}

.btn-small {
  border-radius: 999px;
  border: 1px solid var(--primary-dark);
  padding: 4px 10px;
  font-size: 0.8rem;
  background-color: #ffffff;
  color: var(--primary-dark);
  cursor: pointer;
  white-space: nowrap;
}

.btn-small:hover { background-color: #f0f6f3; }

.nav-toggle {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 0.8rem;
  background-color: #ffffff;
  cursor: pointer;
  display: none;
  white-space: nowrap;
}

/* LAYOUT PRINCIPALE: full width + colonna centrale fissa 1040 */
.main-layout {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 16px 32px;

  display: grid;
  grid-template-columns: 260px var(--content-max) 280px;
  gap: 24px;

  justify-content: center;
}

.main-layout > main,
.main-layout main {
  width: 100%;
  justify-self: stretch;
  min-width: 0;
}

/* SIDEBAR SINISTRA */
.sidebar {
  position: sticky;
  top: 90px;
  align-self: flex-start;

  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 0;

  font-size: 0.88rem;
  min-width: 0;
}

.sidebar-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.sidebar-nav { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li { margin-bottom: 4px; }

.sidebar-nav a {
  display: block;
  padding: 4px 4px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.86rem;
}

.sidebar-nav a:hover { background-color: #e8f0fb; }

.sidebar-nav a.active {
  background-color: #e96f14;
  color: #ffffff;
}

.sidebar-subtitle {
  margin-top: 8px;
  margin-bottom: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* SIDEBAR DESTRA */
.cta-sidebar {
  position: sticky;
  align-self: flex-start;
  min-width: 0;
}

/* BOX LINK SOPRA CTA */
.cta-links {
  margin-bottom: 14px;
  padding: 14px 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--bg-soft);
  box-shadow: var(--shadow-soft);
}

.cta-links .sidebar-title { margin-bottom: 8px; }

/* CTA CARD */
.cta-card {
  background-color: #e8f0fb;
  border-radius: var(--radius-md);
  padding: 16px 14px;
  box-shadow: var(--shadow-soft);
  border: 1px solid #2c7eb7;
  color: var(--secondary);
  font-size: 0.92rem;
}

.cta-card h2 { margin-top: 0; margin-bottom: 8px; font-size: 1.05rem; color: var(--secondary); }
.cta-card p { margin-top: 0; margin-bottom: 10px; color: var(--secondary); font-size: 0.9rem; }

.cta-card ul {
  padding-left: 18px;
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--secondary);
}

.cta-card .btn-primary {
  display: inline-block;
  border-radius: 999px;
  border: none;
  background-color: var(--primary-dark);
  color: #ffffff;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 6px;
}

.cta-card .btn-primary:hover { background-color: var(--primary); text-decoration: none; }

.cta-contact { font-size: 0.82rem; margin-top: 4px; }
.cta-contact a { color: var(--secondary); font-weight: 600; }

/* CONTENUTO */
main article {
  background-color: #ffffff;
  border-radius: var(--radius-md);
 /* border: 1px solid var(--border);
   box-shadow: var(--shadow-soft);*/
  padding: 20px 18px;
}

h1, h2, h3 { color: var(--secondary); margin-top: 0; }

h1 {
  font-size: clamp(1.9rem, 3vw, 2.3rem);
  margin-bottom: 8px;
  color: #2c2c2c;
}

h2 { font-size: clamp(1.4rem, 2.3vw, 1.8rem); margin-top: 28px; margin-bottom: 8px; }
h3 { font-size: 1.1rem; margin-top: 20px; margin-bottom: 6px; }

p { margin-top: 0; margin-bottom: 10px; color: var(--text-muted); font-size: 0.95rem; font-weight:normal; }
.lead { font-size: 1.02rem; color: var(--text-main); margin-bottom: 14px; }

ul, ol { padding-left: 20px; margin-top: 0; margin-bottom: 10px; color: var(--text-muted); font-size: 0.95rem; }
hr { border: none; border-top: 1px solid var(--border); margin: 22px 0; }

/* ✅ FILTRI (pill tipo breadcrumb ma più piccoli) */
.filters-wrap {
  display: grid;
  gap: 8px;
  margin: 8px 0 10px;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.filters-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 800;
  margin-right: 2px;
}

.filter-chip {
  display: inline-block;
  padding: 3px 10px;            /* più piccolo dei breadcrumb */
  border-radius: 999px;
  background-color: #62a5d9;     /* stile breadcrumb */
  color: #ffffff;
  font-size: 0.78rem;           /* più piccolo */
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid rgba(0,0,0,0.06); /* leggera “cerchiatura” */
}

.filter-chip:hover {
  background-color: var(--primary);
  color: #ffffff;
  text-decoration: none;
}

.filter-chip.active,
.filter-chip[aria-current="page"] {
  background-color: var(--primary);
  border-color: rgba(0,0,0,0.10);
  color: #ffffff;
}

.filter-chip.active:hover,
.filter-chip[aria-current="page"]:hover {
  background-color: #62a5d9;
}

/* BREADCRUMB */
.breadcrumb { margin-bottom: 8px; }

.breadcrumb-list {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.breadcrumb-item a,
.breadcrumb-item span {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 999px;
  background-color: #006db7;
  color: #ffffff;
  font-size: 0.8rem;
  text-decoration: none;
}

.breadcrumb-item a:hover { text-decoration: underline; }

.breadcrumb-separator { color: #62a5d9; font-size: 0.8rem; margin: 0 2px; }

/* IMMAGINI WRAP */
.img-wrap { margin: 12px 0; }
.img-wrap img { border-radius: 16px; }
.img-caption { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* SOTTOCATEGORIE */
.subcat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0 6px;
}

.subcat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  box-shadow: var(--shadow-soft);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subcat-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background-color: var(--bg-soft);
  color: var(--primary-dark);
  border: 1px solid var(--border);
  font-weight: 600;
}

.subcat-card h3 { margin: 2px 0 0; font-size: 1.02rem; color: var(--secondary); }
.subcat-card p { margin: 0; font-size: 0.92rem; color: var(--text-muted); }

.subcat-link {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary-dark);
}


.subcat-thumb {
  border-radius: 12px;
  border: 1px solid #e1e9e4;
  overflow: hidden;
  margin-top: 6px;
  width: 100%;
  max-width: 310px;
  aspect-ratio: 1 / 1;
}

.subcat-thumb picture { display: block; width: 100%; height: 100%; }
.subcat-thumb a { display: block; width: 100%; height: 100%; }
.subcat-thumb img {
  border-radius: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* TREE */
.tree-nav { display: grid; gap: 8px; }

.tree-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.tree-toggle:hover { background-color: #e8f0fb; color: var(--primary-dark); }

.tree-caret {
  display: inline-block;
  width: 14px;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
  color: var(--primary-dark);
  flex: 0 0 auto;
}

.tree-toggle[aria-expanded="true"] .tree-caret { transform: rotate(90deg); }

.tree-children {
  list-style: none;
  margin: 0 0 6px 0;
  padding: 6px 0 0 18px;
  border-left: 2px solid #d6e2da;
  display: none;
  gap: 4px;
}

.tree-toggle[aria-expanded="true"] + .tree-children { display: grid; }

.tree-children a {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.86rem;
  color: var(--text-main);
  text-decoration: none;
}

.tree-children a:hover { background-color: #e8f0fb; color: var(--primary-dark); }
.tree-children a.active { background-color: var(--primary); color: #ffffff; }

/* FOOTER */
.site-footer {
  border-top: 1px solid var(--border);
  background-color: #201d48;
  padding: 12px 16px 18px;
  font-size: 0.8rem;
  color: #ffffff;
}

.site-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.site-footer a { color: #ffffff; }
.site-footer-logo img { height: 32px; width: auto; display: block; }

/* RESPONSIVE */


/* RESPONSIVE (desktop piccoli / laptop): evita overflow 3-colonne */
@media (max-width: 1600px) {
  /* Laptop: mantieni 3 colonne ma rendi la colonna centrale più stretta
     per evitare overflow su viewport 1440/1512/1536 */
  .main-layout {
    grid-template-columns: 220px minmax(0, 820px) 260px;
    gap: 16px;
    justify-content: center;
  }

  /* Se il layout è senza sinistra/destra/full rispetta la variante */
  body.layout-no-left .main-layout {
    grid-template-columns: minmax(0, 820px) 260px;
    gap: 16px;
    justify-content: center;
  }

  body.layout-no-right .main-layout {
    grid-template-columns: 220px minmax(0, 820px);
    gap: 16px;
    justify-content: center;
  }

  body.layout-full .main-layout {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }
}

/* Sotto 1200px: meglio 2 colonne (contenuto + sidebar destra) per leggibilità */
@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 16px;
    justify-content: stretch;
  }

  .sidebar { display: none !important; }

  body.layout-no-left .main-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    justify-content: stretch;
  }

  body.layout-no-right .main-layout,
  body.layout-full .main-layout {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }
}


@media (max-width: 1100px) {
  .top-menu { gap: 12px; font-size: 0.86rem; }
}

@media (max-width: 900px) {
  /*
    Mobile menu fix (SEO-safe):
    - evita l'apertura laterale/off-canvas su alcuni device
    - rende il menu un dropdown full-width sotto l'header (overlay)
    - mantiene i bottoni header allineati e previene overflow orizzontali
  */
  .site-header-inner {
    flex-wrap: wrap;
    align-items: center;
    position: relative; /* anchor per il dropdown */
  }

  .top-nav {
    order: 3;
    width: 100%;
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #ffd502;
    border-top: 1px solid var(--border);
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
    z-index: 1100;
    padding: 6px 16px 10px;
  }

  .top-nav.open { display: block; }

  .top-menu {
    flex-direction: column;
    gap: 0;
    width: 100%;
    padding: 4px 0;
    border-top: 0;
    margin-top: 0;
    font-size: 0.9rem;
  }

  .nav-item { width: 100%; }
  .nav-link { width: 100%; padding: 8px 0; }

  .nav-submenu {
    position: static;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    box-shadow: none;
    border: none;
    padding: 0 0 4px;
    margin-bottom: 4px;
  }

  .nav-submenu li a { padding-left: 18px; }

  .nav-toggle { display: inline-flex; padding: 6px 16px; font-size: 0.9rem; }

  .main-layout {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }

  .sidebar { display: none !important; }
  .cta-sidebar { position: static; display: block; margin-top: 16px; }

  .subcat-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  main article { padding: 16px 14px; }
  .logo-img { height: 34px; }
}

/* Varianti layout */
body.layout-no-left .sidebar { display: none; }
body.layout-no-left .main-layout {
  grid-template-columns: var(--content-max) 280px;
  justify-content: center;
}

body.layout-no-right .cta-sidebar { display: none; }
body.layout-no-right .main-layout {
  grid-template-columns: 260px var(--content-max);
  justify-content: center;
}

body.layout-full .sidebar,
body.layout-full .cta-sidebar { display: none; }
body.layout-full .main-layout {
  grid-template-columns: var(--content-max);
  justify-content: center;
}

/* TOC livelli (H3) */
.sidebar-link.level-3 { padding-left: 14px; font-size: 0.84rem; }
.sidebar-link.level-3::before { content: "– "; opacity: 0.7; }

/* =========================
   Flash messages (Shop PRG)
   ========================= */

.flash-wrap { width: 100%; }
.flash-inner {
  max-width: 1040px;
  margin: 10px auto 0;
  padding: 0 12px;
  display: grid;
  gap: 8px;
}

.flash {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.95rem;
  line-height: 1.2;
  background: var(--bg-soft);
  color: var(--text-main);
}

.flash-success {
  border-color: rgba(0,134,80,0.40);
  background: rgba(0,134,80,0.12);
}

.flash-warning {
  border-color: rgba(199,218,58,0.55);
  background: rgba(199,218,58,0.16);
}

.flash-error {
  border-color: rgba(220,38,38,0.35);
  background: rgba(220,38,38,0.08);
}


/* === Pagination (categorie) === */
.cms-pagination{margin-top:14px;}
.cms-pagination-inner{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;align-items:center;}
.cms-pagination-ellipsis{color:var(--text-muted);padding:0 4px;}
/* Spazio sopra i numeri della paginazione */
.cms-pagination{
  padding-top: 16px;
}

/* === Related posts (single) === */
.rel-box{
  margin-top: 8px;
}
.rel-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.rel-card{
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  padding: 12px;
}
.rel-card:hover{
  background: var(--bg-soft);
  text-decoration: none;
}
.rel-thumb{
  display: block;
  width: 90px;
  height: 90px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.rel-thumb picture,
.rel-thumb img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rel-thumb-fallback{
  display: block;
  width: 90px;
  height: 90px;
}
.rel-body{min-width:0; display:grid; gap:4px;}
.rel-title{
  font-weight: 900;
  color: var(--secondary);
  line-height: 1.15;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.rel-lead{
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.rel-cta{
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 0.92rem;
}

@media (max-width: 1100px){
  .rel-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px){
  .rel-grid{ grid-template-columns: minmax(0, 1fr); }
  .rel-card{ grid-template-columns: 110px minmax(0, 1fr); }
}


/* =========================================================
   CATEGORY: GALLERIA (testo + immagini)
   - Scoped: usa .cat-gallery-block
   - Non impatta categorie senza sezione galleria
   ========================================================= */

.cat-gallery-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 900px){
  .cat-gallery-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.cat-gallery-item{ margin:0; }

.cat-gallery-item .cms-pic,
.cat-gallery-item img{
  display:block;
  width:100%;
  height:auto;
  border-radius:14px;
}

.cat-gallery-item .cms-pic{
  overflow:hidden;
  border:1px solid var(--border);
  background: var(--bg-soft);
}

.cat-gallery-item figcaption{
  margin-top:6px;
  font-size:0.92rem;
  line-height:1.35;
  color: var(--text-muted);
}

/* =========================================================
   Gallery Lightbox (progressive enhancement)
   - Scoped: .gallery-lightbox / .gallery-zoom-link
   - NO brand colors, solo layout/accessibilità
   ========================================================= */

.gallery-zoom-link{
  display:block;
  color:inherit;
  text-decoration:none;
}

.gallery-zoom-link:focus{
  outline:2px solid currentColor;
  outline-offset:3px;
}

.gallery-lightbox[hidden]{ display:none; }

.gallery-lightbox{
  position:fixed;
  inset:0;
  z-index:9999;
}

.gallery-lightbox__backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.82);
}

.gallery-lightbox__dialog{
  position:relative;
  margin:24px auto;
  max-width:min(1100px, calc(100vw - 32px));
  max-height:calc(100vh - 48px);
  background:#fff;
  border-radius:18px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.gallery-lightbox__top{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px;
  border-bottom:1px solid var(--border);
  background:var(--bg-soft);
}

.gallery-lightbox__spacer{ flex:1; }

.gallery-lightbox__btn{
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  padding:8px 10px;
  font-weight:700;
  line-height:1;
  cursor:pointer;
}

.gallery-lightbox__btn:disabled{
  opacity:.5;
  cursor:default;
}

.gallery-lightbox__figure{
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  min-height:0;
}

.gallery-lightbox__img{
  display:block;
  width:100%;
  height:auto;
  max-height:calc(100vh - 140px);
  object-fit:contain;
  background:#000;
}

.gallery-lightbox__caption{
  padding:10px 12px;
  font-size:.95rem;
  color:var(--text-muted);
}

@media (max-width: 760px){
  .gallery-lightbox__dialog{ margin:12px auto; max-width:calc(100vw - 16px); max-height:calc(100vh - 24px); }
  .gallery-lightbox__btn{ padding:8px 9px; }
}

/* Evita scroll della pagina sottostante */
body.glb-open{ overflow:hidden; }

/* PRINT: stampa solo l'immagine (no header/footer) */
@media print {
  @page{ margin:10mm; }
  body.glb-open *{ visibility:hidden !important; }
  body.glb-open #gallery-lightbox,
  body.glb-open #gallery-lightbox *{ visibility:visible !important; }

  #gallery-lightbox{ position:static; inset:auto; }
  .gallery-lightbox__backdrop{ display:none !important; }
  .gallery-lightbox__top{ display:none !important; }
  .gallery-lightbox__dialog{ margin:0; max-width:none; max-height:none; border-radius:0; border:0; }
  .gallery-lightbox__figure{ break-inside:avoid; page-break-inside:avoid; }
  .gallery-lightbox__img{ max-height:none; max-width:100% !important; height:auto !important; background:transparent; }
}

/* =====================================================
   BLOCCO CATEGORIA: template editoriale-shop
   - Stili allineati allo shop (cards + CTA)
   - Scoped per evitare regressioni
   ===================================================== */

/*
  Nota: il blocco prodotti può comparire anche su post/pagine editoriali.
  Usiamo una classe generica "editorial-shop-products" per riutilizzare
  gli stessi stili senza caricare shop.css fuori dal tema shop.
*/
:where(.cat-shop-products, .editorial-shop-products){ margin-top:10px; }
:where(.cat-shop-products, .editorial-shop-products) h2{ margin-top:0; }

:where(.cat-shop-products, .editorial-shop-products) .product-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:14px;
  margin-top:10px;
}

:where(.cat-shop-products, .editorial-shop-products) .product-card{
  border:1px solid var(--border);
  border-radius:16px;
  background:#fff;
  overflow:hidden;
  display:grid;
  grid-template-rows:auto 1fr;
  min-width:0;
}

:where(.cat-shop-products, .editorial-shop-products) .product-media{
  position:relative;
  overflow:hidden;
  background:var(--bg-soft);
  aspect-ratio:4/3;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--text-muted);
  font-weight:700;
  border-bottom:1px solid var(--border);
}

/* Badge prodotto (shop) anche nei blocchi editoriali */
:where(.cat-shop-products, .editorial-shop-products) .shop-badge{
  position:absolute;
  top:10px;
  right:10px;
  z-index:3;
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  font-size:.78rem;
  font-weight:900;
  line-height:1;
  letter-spacing:.01em;
  box-shadow:var(--shadow-soft);
  border:1px solid rgba(0,0,0,.08);
  background:#fff;
  color:var(--text);
}
:where(.cat-shop-products, .editorial-shop-products) .shop-badge--bestseller{
  background:#fff3e0;
  border-color:#ffe0b2;
  color:#7a4b00;
}
:where(.cat-shop-products, .editorial-shop-products) .shop-badge--new{
  background:#e8f5e9;
  border-color:#c8e6c9;
  color:#1b5e20;
}
:where(.cat-shop-products, .editorial-shop-products) .shop-badge--deal{
  background:#ffebee;
  border-color:#ffcdd2;
  color:#b00020;
}

:where(.cat-shop-products, .editorial-shop-products) .product-media picture,
:where(.cat-shop-products, .editorial-shop-products) .product-media img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  max-width:100%;
}

:where(.cat-shop-products, .editorial-shop-products) .product-body{
  /* allineato a shop.css */
  padding:12px 12px 14px;
  display:flex;
  flex-direction:column;
  gap:8px;
  min-width:0;
}

:where(.cat-shop-products, .editorial-shop-products) .product-title{ margin:0; font-size:1rem; line-height:1.25; color:var(--secondary); }
:where(.cat-shop-products, .editorial-shop-products) .product-title a{ color:inherit; text-decoration:none; }
:where(.cat-shop-products, .editorial-shop-products) .product-title a:hover{ text-decoration:underline; }

:where(.cat-shop-products, .editorial-shop-products) .product-meta{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:baseline;
  min-width:0;
}

/* Prezzi + sconto (replica shop.css, scoped) */
:where(.cat-shop-products, .editorial-shop-products) .price-wrap{
  display:inline-flex;
  align-items:baseline;
  gap:8px;
  flex-wrap:wrap;
  min-width:0;
}
:where(.cat-shop-products, .editorial-shop-products) .price-wrap.has-discount{
  flex-direction:column;
  align-items:flex-start;
  gap:2px;
}
:where(.cat-shop-products, .editorial-shop-products) .price-wrap.has-discount .price-old{ margin-right:0; }

:where(.cat-shop-products, .editorial-shop-products) .price{ font-weight:900; color:var(--primary-dark); }
:where(.cat-shop-products, .editorial-shop-products) .price-old{ color:#9aa3a0; text-decoration:line-through; font-weight:400; font-size:.92rem; }

/* Prezzo "stile Amazon": intero grande + decimali piccoli (solo UI, testo reale) */
:where(.cat-shop-products, .editorial-shop-products) .shop-price{
  display:inline-flex;
  align-items:flex-start; /* allineamento in alto senza andare sopra */
  line-height:1;
  font-variant-numeric: tabular-nums;
}
:where(.cat-shop-products, .editorial-shop-products) .shop-price__int{
  font-size:2.0rem;
  font-weight:600;
  letter-spacing:-0.01em;
}
:where(.cat-shop-products, .editorial-shop-products) .shop-price__dec{
  font-size:1.0rem;
  margin-left:2px;
}
:where(.cat-shop-products, .editorial-shop-products) .shop-price__cur{
  font-size:1.0rem;
  margin-left:3px;
}

:where(.cat-shop-products, .editorial-shop-products) .shop-price--hero .shop-price__int{ font-size:2.0rem; font-weight:600; }
:where(.cat-shop-products, .editorial-shop-products) .shop-price--hero .shop-price__dec{ font-size:1.0rem; }
:where(.cat-shop-products, .editorial-shop-products) .shop-price--hero .shop-price__cur{ font-size:1.0rem; }

:where(.cat-shop-products, .editorial-shop-products) .shop-price--old .shop-price__int{ font-size:1.0rem; font-weight:400; letter-spacing:0; }
/* Prezzo "vecchio" barrato: mantieni intero+decimali+valuta con stessa dimensione (no decimali "in alto") */
:where(.cat-shop-products, .editorial-shop-products) .shop-price--old{
  align-items:baseline;
  color:#9aa3a0;
  text-decoration:line-through;
  text-decoration-thickness:1px;
}
:where(.cat-shop-products, .editorial-shop-products) .shop-price--old .shop-price__int,
:where(.cat-shop-products, .editorial-shop-products) .shop-price--old .shop-price__dec,
:where(.cat-shop-products, .editorial-shop-products) .shop-price--old .shop-price__cur{
  font-size:1.0rem;
  font-weight:400;
  letter-spacing:0;
}

:where(.cat-shop-products, .editorial-shop-products) .discount-badge{
  display:inline-flex;
  align-items:center;
  padding:3px 8px;
  border-radius:999px;
  background:#ffebee;
  border:1px solid #ffcdd2;
  color:#b00020;
  font-weight:900;
  font-size:.78rem;
  line-height:1;
}

:where(.cat-shop-products, .editorial-shop-products) .sku{
  color:var(--text-muted);
  font-size:.82rem;
}

:where(.cat-shop-products, .editorial-shop-products) .note-soft{ margin:0; color:var(--text-muted); font-size:.92rem; }

/* CTA / bottoni (replica shop.css, senza cambiare colori) */
:where(.cat-shop-products, .editorial-shop-products) .shop-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 14px;
  border-radius:999px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--primary-dark);
  font-weight:700;
  font-size:.9rem;
  cursor:pointer;
  text-decoration:none;
  white-space:nowrap;
  max-width:100%;
  box-sizing:border-box;
  line-height:1;
  height:42px;
}
:where(.cat-shop-products, .editorial-shop-products) .shop-btn:hover{ background:#fff1e8; text-decoration:none; }
:where(.cat-shop-products, .editorial-shop-products) .shop-btn-primary{
  background:var(--primary-dark);
  color:#fff;
  border-color:var(--primary-dark);
}
:where(.cat-shop-products, .editorial-shop-products) .shop-btn-primary:hover{ background:#c9692b; border-color:#c9692b; }

:where(.cat-shop-products, .editorial-shop-products) .product-actions{ display:flex; gap:10px; flex-wrap:wrap; margin-top:auto; }

.cat-shop-products-cta{ margin:12px 0 0; }
.cat-shop-products-cta-link{ font-weight:700; }

@media (max-width: 900px){
  :where(.cat-shop-products, .editorial-shop-products) .product-grid{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px){
  :where(.cat-shop-products, .editorial-shop-products) .product-grid{ grid-template-columns:minmax(0, 1fr); }
}

/* =============================
   Recently viewed band (footer)
   Editorial frontend ONLY (shop keeps its own styles in shop.css)
   Progressive enhancement: hidden until JS renders
   ============================= */

body:not(.theme-shop) .recently-viewed-band{
  background:#f3f4f6;
  border-top:1px solid rgba(0,0,0,0.08);
  margin-top:28px;
}

body:not(.theme-shop) .recently-viewed-inner{
  max-width:none;
  width:100%;
  margin:0;
  padding:36px 16px 72px;
  box-sizing:border-box;
}

body:not(.theme-shop) .recently-viewed-title{
  margin:0 0 10px 0;
  font-size:1.25rem;
  font-weight:500;
  color:var(--text-main);
}

/* Defensive reset if any legacy markup uses UL/LI */
body:not(.theme-shop) .recently-viewed-list,
body:not(.theme-shop) .recently-viewed-list ul{
  list-style:none;
  padding:0;
  margin:0;
}

body:not(.theme-shop) .recently-viewed-list li{ margin:0; padding:0; }

body:not(.theme-shop) .recently-viewed-list{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:10px;
}

body:not(.theme-shop) .recently-viewed-list > a,
body:not(.theme-shop) .recently-viewed-list .rv-card{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 10px;
  border:1px solid rgba(0,0,0,0.06);
  background:rgba(255,255,255,0.75);
  border-radius:12px;
  text-decoration:none;
  min-width:0;
  color:inherit;
}

body:not(.theme-shop) .recently-viewed-list > a:hover,
body:not(.theme-shop) .recently-viewed-list .rv-card:hover{
  background:#fff;
  text-decoration:none;
}

body:not(.theme-shop) .recently-viewed-list > a .rv-thumb,
body:not(.theme-shop) .rv-thumb{
  width:56px;
  height:56px;
  border-radius:12px;
  overflow:hidden;
  flex:0 0 56px;
  background:rgba(0,0,0,0.04);
}

body:not(.theme-shop) .rv-thumb img{
  display:block;
  width:56px;
  height:56px;
  object-fit:cover;
}

body:not(.theme-shop) .rv-thumb-ph{
  display:block;
  width:56px;
  height:56px;
}

body:not(.theme-shop) .rv-meta{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}

body:not(.theme-shop) .rv-name{
  font-size:0.88rem;
  line-height:1.15;
  font-weight:700;
  color:var(--text-main);
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

body:not(.theme-shop) .rv-price{
  font-size:0.82rem;
  color:var(--text-muted);
  font-weight:600;
}

@media (max-width:900px){
  body:not(.theme-shop) .recently-viewed-list{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
}

@media (max-width:600px){
  body:not(.theme-shop) .recently-viewed-inner{ padding:12px 12px; }
  body:not(.theme-shop) .recently-viewed-title{ font-size:0.9rem; margin-bottom:8px; }
  body:not(.theme-shop) .recently-viewed-list{ grid-template-columns:1fr; }
  body:not(.theme-shop) .recently-viewed-list{
    display:flex;
    gap:10px;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    scroll-snap-type:x proximity;
    padding-bottom:4px;
  }
  body:not(.theme-shop) .recently-viewed-list > a,
  body:not(.theme-shop) .recently-viewed-list .rv-card{
    flex:0 0 88%;
    scroll-snap-align:start;
    padding:8px 8px;
    border-radius:10px;
  }
  body:not(.theme-shop) .rv-thumb,
  body:not(.theme-shop) .rv-thumb img,
  body:not(.theme-shop) .rv-thumb-ph{
    width:48px;
    height:48px;
    flex-basis:48px;
  }
  body:not(.theme-shop) .rv-name{ font-size:0.85rem; }
  body:not(.theme-shop) .rv-price{ font-size:0.8rem; }
}



/* Editoriale: CTA verso categoria Shop (banner) */
.cat-shop-products-cta {
  margin: 18px 0 26px;
}

.cat-shop-products-cta-link {
  display: block;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff4e0; /* arancione chiaro */
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}

.cat-shop-products-cta-link:hover,
.cat-shop-products-cta-link:focus {
  text-decoration: none;
  border-color: rgba(0, 0, 0, 0.16);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.cat-shop-products-cta-link:active {
  transform: translateY(1px);
}

/* Micro “freccia” visiva senza cambiare testo */
.cat-shop-products-cta-link::after {
  content: " →";
  font-weight: 800;
}

/* Mobile: un filo più compatto */
@media (max-width: 900px) {
  .cat-shop-products-cta {
    margin: 14px 0 22px;
  }
  .cat-shop-products-cta-link {
    padding: 12px 14px;
    border-radius: 12px;
  }
}
