/* =================================================================================
 * Mega menu Prodotti + template prodotti — tema nextframe (2Gamma)
 * Rosso ricavato dall'immagine di riferimento (Menu_prodotti.png).
 * Riusa le variabili del tema (--ink, --muted, --line, --blue) quando disponibili.
 * ================================================================================= */

:root {
  --tg-red: #61AFE1;
  --tg-red-dark: #61b0e1af;
}

/* ---------------------------------------------------------------------------------
 * Trigger "Prodotti" nella nav principale
 * --------------------------------------------------------------------------------- */
.main-nav__products {
  position: static;
  display: inline-flex;
}

.main-nav__products-trigger {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.main-nav__products-trigger:hover,
.main-nav__products-trigger:focus-visible {
  color: inherit;
}

.main-nav__products-trigger:focus-visible {
  outline: 2px solid var(--tg-red);
  outline-offset: 4px;
  border-radius: 3px;
}

.products-mega-menu__trigger-arrow {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform .2s ease;
}

.main-nav__products-trigger[aria-expanded="true"] .products-mega-menu__trigger-arrow {
  transform: rotate(-135deg);
  margin-top: 3px;
}

/* ---------------------------------------------------------------------------------
 * Mega menu desktop — full width, sotto l'header
 * --------------------------------------------------------------------------------- */
.products-mega-menu {
  --tg-edge: max(24px, calc((100vw - 1240px) / 2));
  position: absolute;
  top: 100%;
  left: 0;
  width: 100vw;
  z-index: 90;
  background: #fff;
  border-top: 1px solid var(--line, rgba(16, 32, 28, .14));
  box-shadow: 0 26px 50px rgba(0, 0, 0, .18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
}

.products-mega-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.products-mega-menu__inner {
  display: flex;
  align-items: stretch;
  width: 100%;
}

/* Colonna sinistra rossa */
.products-mega-menu__sidebar {
  flex: 0 0 clamp(260px, 30%, 430px);
  background: var(--tg-red);
  padding: 30px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.products-mega-menu__line {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px var(--tg-edge);
  color: rgba(255, 255, 255, .8);
  font: 600 clamp(20px, 1.9vw, 28px)/1.1 "Space Grotesk", sans-serif;
  text-align: left;
  transition: background .2s ease, color .2s ease;
}

.products-mega-menu__line:hover,
.products-mega-menu__line:focus-visible {
  color: #fff;
  background: rgba(0, 0, 0, .12);
}

.products-mega-menu__line:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

.products-mega-menu__line.is-active {
  color: #fff;
  background: rgba(0, 0, 0, .18);
}

.products-mega-menu__line-arrow {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: .65;
  transition: transform .2s ease, opacity .2s ease;
}

.products-mega-menu__line.is-active .products-mega-menu__line-arrow {
  opacity: 1;
  transform: rotate(45deg) translate(2px, -2px);
}

/* Area destra bianca */
.products-mega-menu__content {
  flex: 1 1 auto;
  min-width: 0;
  background: #fff;
  padding: 40px 0 36px;
  padding-right: var(--tg-edge);
  padding-left: clamp(28px, 3.5vw, 64px);
}

.products-mega-menu__panel {
  display: none;
}

.products-mega-menu__panel.is-active {
  display: block;
}

.products-mega-menu__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 32px 40px;
}

.products-mega-menu__category-title {
  margin: 0 0 14px;
  font: 700 19px/1.2 "Space Grotesk", sans-serif;
  color: var(--ink, #10201c);
  letter-spacing: .01em;
}

.products-mega-menu__product-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.products-mega-menu__product {
  display: inline-block;
  color: var(--muted, #66716d);
  font-size: 15px;
  line-height: 1.35;
  text-decoration: none;
  transition: color .15s ease, transform .15s ease;
}

.products-mega-menu__product:hover,
.products-mega-menu__product:focus-visible {
  color: var(--tg-red);
  transform: translateX(2px);
}

.products-mega-menu__footer {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line, rgba(16, 32, 28, .12));
}

.products-mega-menu__all {
  font: 700 14px/1 "Space Grotesk", sans-serif;
  color: var(--ink, #10201c);
  text-decoration: none;
}

.products-mega-menu__all:hover,
.products-mega-menu__all:focus-visible {
  color: var(--tg-red);
}

/* ---------------------------------------------------------------------------------
 * Fisarmonica mobile (dentro l'overlay del menu hamburger) — nascosta su desktop
 * --------------------------------------------------------------------------------- */
.products-mega-menu__mobile {
  display: none;
}

.products-mega-menu__macc-toggle {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 6px;
  font: 600 20px/1.2 "Space Grotesk", sans-serif;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}

.products-mega-menu__macc-toggle--cat {
  font-size: 16px;
  padding-left: 18px;
  color: rgba(255, 255, 255, .85);
}

.products-mega-menu__macc-icon {
  position: relative;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

.products-mega-menu__macc-icon::before,
.products-mega-menu__macc-icon::after {
  content: "";
  position: absolute;
  background: currentColor;
  transition: transform .25s ease, opacity .25s ease;
}

.products-mega-menu__macc-icon::before {
  top: 6px;
  left: 0;
  width: 14px;
  height: 2px;
}

.products-mega-menu__macc-icon::after {
  top: 0;
  left: 6px;
  width: 2px;
  height: 14px;
}

.products-mega-menu__macc-toggle[aria-expanded="true"] .products-mega-menu__macc-icon::after {
  transform: scaleY(0);
  opacity: 0;
}

.products-mega-menu__macc-panel,
.products-mega-menu__macc-products {
  overflow: hidden;
  max-height: 0;
  transition: max-height .28s ease;
}

.products-mega-menu__macc-products {
  list-style: none;
  margin: 0;
  padding: 0;
}

.products-mega-menu__macc-products li {
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.products-mega-menu__macc-products a {
  display: block;
  padding: 11px 6px 11px 30px;
  color: rgba(255, 255, 255, .9);
  font-size: 16px;
  text-decoration: none;
}

.products-mega-menu__macc-products a:active {
  background: rgba(255, 255, 255, .08);
}

.products-mega-menu__macc-all {
  display: inline-block;
  margin-top: 18px;
  padding: 12px 22px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 999px;
  color: #fff;
  font: 700 15px "Space Grotesk", sans-serif;
  text-decoration: none;
}

/* ---------------------------------------------------------------------------------
 * Responsive: comportamento mobile / tablet
 * --------------------------------------------------------------------------------- */
@media (max-width: 900px) {

  /* Il pannello mega desktop non si usa su mobile */
  .products-mega-menu {
    display: none !important;
  }

  .main-nav__products {
    display: block;
    width: min(100%, 460px);
  }

  .main-nav__products-trigger {
    width: 100%;
    justify-content: center;
    font-size: 23px;
    padding: 12px 6px;
  }

  /* La fisarmonica vive dentro l'overlay del menu */
  .menu-open .products-mega-menu__mobile {
    display: block;
  }

  .products-mega-menu__mobile {
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s ease;
    text-align: left;
  }

  .main-nav {
    overflow-y: auto;
  }
}

/* Tablet: nel mega desktop riduci a 2 colonne nette */
@media (min-width: 901px) and (max-width: 1100px) {
  .products-mega-menu__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .products-mega-menu__sidebar {
    flex-basis: clamp(220px, 28%, 320px);
  }
}

/* Riduzione movimento */
@media (prefers-reduced-motion: reduce) {

  .products-mega-menu,
  .products-mega-menu__macc-panel,
  .products-mega-menu__macc-products,
  .products-mega-menu__mobile,
  .products-mega-menu__line,
  .products-mega-menu__product,
  .products-mega-menu__trigger-arrow {
    transition: none !important;
  }
}

/* Header solido di default sulle pagine prodotto (sfondo chiaro -> leggibilità).
 * Replica l'aspetto di .site-header.scrolled senza dipendere dallo scroll JS. */
.post-type-archive-prodotti .site-header,
.single-prodotti .site-header,
.tax-tg_linea_prodotto .site-header,
.tax-tg_categoria_prodotto .site-header {
  padding: 13px 0;
  color: var(--ink, #10201c);
  background: rgba(243, 244, 239, .92);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 1px 0 var(--line, rgba(16, 32, 28, .14));
}

.post-type-archive-prodotti .site-header .brand-subtitle,
.single-prodotti .site-header .brand-subtitle {
  color: rgba(16, 32, 28, .72);
}

.post-type-archive-prodotti .site-header .nav-cta,
.single-prodotti .site-header .nav-cta {
  border-color: var(--line, rgba(16, 32, 28, .14));
  background: var(--ink, #10201c);
  color: #fff;
}

/* =================================================================================
 * Template Prodotti: archivio e singolo (riusa .container e .button del tema)
 * ================================================================================= */
.tg-products {
  padding: 150px 0 90px;
}

.tg-products__head {
  margin-bottom: 36px;
}

.tg-products__eyebrow {
  display: block;
  margin-bottom: 12px;
  font: 800 12px/1 "Space Grotesk", sans-serif;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--tg-red);
}

.tg-products__title {
  margin: 0;
  font: 600 clamp(38px, 5vw, 64px)/1.02 "Space Grotesk", sans-serif;
  color: var(--ink, #10201c);
}

.tg-products__intro {
  margin: 16px 0 0;
  max-width: 640px;
  color: var(--muted, #66716d);
  line-height: 1.7;
}

.tg-product-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line, rgba(16, 32, 28, .14));
}

.tg-product-filters a {
  padding: 9px 16px;
  border: 1px solid var(--line, rgba(16, 32, 28, .2));
  border-radius: 999px;
  color: var(--ink, #10201c);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background .2s, color .2s, border-color .2s;
}

.tg-product-filters a:hover {
  border-color: var(--tg-red);
  color: var(--tg-red);
}

.tg-product-filters a.is-current {
  background: var(--tg-red);
  border-color: var(--tg-red);
  color: #fff;
}

.tg-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px;
}

.tg-product-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line, rgba(16, 32, 28, .12));
  border-radius: 18px;
  transition: transform .25s ease, box-shadow .25s ease;
}

.tg-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .1);
}

.tg-product-card__media {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #eef0ea;
}

.tg-product-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tg-product-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 22px 24px;
  flex: 1;
}

.tg-product-card__line {
  font: 800 11px/1 "Space Grotesk", sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tg-red);
}

.tg-product-card__title {
  margin: 0;
  font: 600 21px/1.2 "Space Grotesk", sans-serif;
  color: var(--ink, #10201c);
}

.tg-product-card__title a {
  color: inherit;
  text-decoration: none;
}

.tg-product-card__title a:hover {
  color: var(--tg-red);
}

.tg-product-card__desc {
  margin: 0;
  color: var(--muted, #66716d);
  font-size: 15px;
  line-height: 1.55;
}

.tg-product-card__more {
  margin-top: auto;
  padding-top: 10px;
  font: 700 14px "Space Grotesk", sans-serif;
  color: var(--ink);
  text-decoration: none;
}

.tg-product-card__more:hover {
  color: var(--tg-red);
}

/* Singolo prodotto */
.tg-single {
  padding: 150px 0 90px;
}

.tg-breadcrumb {
  margin: 0 0 26px;
  font-size: 13px;
  color: var(--muted, #66716d);
}

.tg-breadcrumb a {
  color: var(--muted, #66716d);
  text-decoration: none;
}

.tg-breadcrumb a:hover {
  color: var(--tg-red);
}

.tg-breadcrumb span[aria-current] {
  color: var(--ink, #10201c);
}

.tg-single__grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 56px;
  align-items: start;
}

.tg-single__grid--noimg {
  grid-template-columns: 1fr;
  max-width: 860px;
}

.tg-single__media img {
  width: 100%;
  height: auto;
  border-radius: 20px;
  display: block;
}

.tg-single__eyebrow {
  display: block;
  margin-bottom: 10px;
  font: 800 12px/1 "Space Grotesk", sans-serif;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--tg-red);
}

.tg-single__title {
  margin: 0;
  font: 600 clamp(34px, 4.4vw, 56px)/1.03 "Space Grotesk", sans-serif;
  color: var(--ink, #10201c);
}

.tg-single__subtitle {
  margin: 14px 0 0;
  font-size: 19px;
  line-height: 1.5;
  color: var(--muted, #66716d);
}

.tg-single__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 0;
}

.tg-single__meta span {
  padding: 7px 14px;
  border: 1px solid var(--line, rgba(16, 32, 28, .18));
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink, #10201c);
}

.tg-single__content {
  margin: 26px 0 0;
  line-height: 1.7;
  color: var(--ink, #10201c);
}

.tg-single__cta {
  margin-top: 30px;
}

.tg-single__code {
  margin: 18px 0 0;
  font-size: 14px;
  color: var(--muted, #66716d);
}

.tg-single__code strong {
  color: var(--ink, #10201c);
}

.tg-related {
  margin-top: 80px;
}

.tg-related__title {
  margin: 0 0 26px;
  font: 600 30px/1 "Space Grotesk", sans-serif;
  color: var(--ink, #10201c);
}

@media (max-width: 900px) {

  .tg-products,
  .tg-single {
    padding-top: 120px;
  }

  .tg-single__grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}