/* 1.6: interventi mirati sulla base 1.4, senza cambiare header e catalogo. */
.mn-department-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.mn-department-card {
  min-width: 0;
  min-height: 98px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  color: var(--mn-ink);
  background: #f4f5f7;
  border: 1px solid transparent;
  border-radius: 7px;
  text-decoration: none;
  transition: border-color .18s, background-color .18s;
}
.mn-department-card strong { min-width: 0; font-size: 1rem; line-height: 1.3; }
.mn-department-card:hover { color: var(--mn-blue); border-color: #c5d2ef; background: #edf2fb; }
.mn-department-card:focus-visible { outline: 3px solid var(--mn-blue); outline-offset: 3px; }
.mn-department-photo { width: 96px; height: 76px; flex: 0 0 96px; display: grid; place-items: center; }
.mn-department-photo .mn-department-image { display: block; width: 100%; height: 100%; max-height: 76px; margin: 0; object-fit: contain; border-radius: 5px; }

/* The grid's height follows the summary; the sticky column stops before tabs. */
.single-product .mn-product-intro {
  --mn-gallery-top: 24px;
  --mn-gallery-frame: clamp(250px, calc(100vh - var(--mn-gallery-top) - 140px), 620px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: var(--mn-product-gap, 40px);
  margin-bottom: 32px;
}
.admin-bar.single-product .mn-product-intro { --mn-gallery-top: 56px; }
.single-product .mn-product-gallery-column { position: sticky; top: var(--mn-gallery-top); align-self: start; min-width: 0; }
.woocommerce div.product .mn-product-intro > div.summary,
.woocommerce div.product .mn-product-gallery-column div.images {
  float: none;
  width: 100%;
  min-width: 0;
  max-width: none;
  margin: 0;
}
.woocommerce div.product .mn-product-gallery-column div.images { box-sizing: border-box; }
.woocommerce div.product .mn-product-gallery-column .woocommerce-product-gallery__image > a > img,
.woocommerce div.product .mn-product-gallery-column .woocommerce-product-gallery__image--placeholder > img {
  display: block;
  width: 100%;
  height: var(--mn-gallery-frame);
  max-height: none;
  aspect-ratio: auto;
  object-fit: contain;
  object-position: center;
  margin: 0;
  background: #fff;
}
.woocommerce div.product .mn-product-gallery-column div.images .flex-control-thumbs {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin: 12px 0 0;
  padding: 3px 3px 7px;
  overflow-x: auto;
  overflow-y: hidden;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: #a9b8d0 #f3f5f9;
  overscroll-behavior-x: contain;
}
.woocommerce div.product .mn-product-gallery-column div.images .flex-control-thumbs::before,
.woocommerce div.product .mn-product-gallery-column div.images .flex-control-thumbs::after { content: none; }
.woocommerce div.product .mn-product-gallery-column div.images .flex-control-thumbs li {
  float: none !important;
  flex: 0 0 76px;
  width: 76px !important;
  height: 76px;
  min-width: 0;
  margin: 0 !important;
  padding: 0;
  overflow: visible;
}
.woocommerce div.product .mn-product-gallery-column div.images .flex-control-thumbs li img {
  display: block;
  box-sizing: border-box;
  width: 100% !important;
  height: 100% !important;
  padding: 5px;
  margin: 0;
  object-fit: contain;
  border: 1px solid #cbd5e3;
  border-radius: 9px;
  background: #fff;
  opacity: .75;
  cursor: pointer;
}
.woocommerce div.product .mn-product-gallery-column div.images .flex-control-thumbs li img.flex-active {
  opacity: 1;
  border: 2px solid var(--mn-blue);
  background: #f5f8ff;
}
.woocommerce div.product .mn-product-gallery-column div.images .flex-control-thumbs img:hover { opacity: 1; }
.woocommerce div.product .mn-product-gallery-column div.images .flex-control-thumbs img:focus-visible { outline: 3px solid var(--mn-blue); outline-offset: 2px; }

/* Condition always uses a written label, including in the main gallery. */
.mn-condition-label.mn-condition-new { color: #1746a2; background: #edf3ff; border-color: #bfd0f5; }
.mn-condition-label.mn-condition-used { color: #12603c; background: #e8f6ed; border-color: #acd8bf; }
.mn-condition-label.mn-condition-outlet { color: #79460a; background: #fff2df; border-color: #ecc995; }
.mn-condition-label { font-size: .75rem; line-height: 1.35; padding: 6px 9px; border-radius: 7px; }
.mn-product-gallery-column > .mn-condition-label { top: 14px; right: 14px; z-index: 5; max-width: calc(100% - 100px); font-size: .875rem; padding: 7px 11px; }
/* Include div.images: WooCommerce's own selector otherwise wins the cascade.
 * JS measures the badge when its label wraps or the text size changes. */
.woocommerce div.product .mn-product-gallery-column div.images .woocommerce-product-gallery__trigger {
  top: var(--mn-zoom-top, calc(40px + 1.18125rem));
  right: 15px;
  bottom: auto;
  left: auto;
}

/* Native disclosure on desktop: no clipping, no text fetched after a click. */
.mn-description-block { font-size: 1rem; }
.mn-description-block > h2 { margin-top: 0; }
.mn-description-intro { max-width: 85ch; margin: 0 0 16px; }
.mn-description-details > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 46px;
  max-width: 100%;
  padding: 10px 16px;
  color: var(--mn-blue);
  background: #f1f5ff;
  border: 1px solid #c4d2f2;
  border-radius: 8px;
  font-size: .9375rem;
  font-weight: 750;
  line-height: 1.4;
  list-style: none;
  cursor: pointer;
}
.mn-description-details > summary::-webkit-details-marker { display: none; }
.mn-description-details > summary:hover { background: #e5edff; }
.mn-description-details > summary:focus-visible { outline: 3px solid var(--mn-blue); outline-offset: 3px; }
.mn-description-details .mn-description-less { display: none; }
.mn-description-details[open] .mn-description-more { display: none; }
.mn-description-details[open] .mn-description-less { display: inline; }
.mn-description-block:has(> .mn-description-details[open]) > .mn-description-intro,
.mn-description-block.is-description-open > .mn-description-intro { display: none; }
.mn-description-chevron { width: 7px; height: 7px; flex: 0 0 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.mn-description-details[open] .mn-description-chevron { transform: rotate(225deg) translate(-1px, -1px); }
.mn-description-details[open] > .mn-long-description { margin-top: 22px; }
.mn-long-description { min-width: 0; overflow-wrap: anywhere; }
.mn-long-description img, .mn-long-description video, .mn-long-description iframe { max-width: 100%; }
.mn-long-description table { display: block; max-width: 100%; overflow-x: auto; }

@media (max-width: 1180px) and (min-width: 768px) {
  .mn-department-grid { gap: 12px; }
  .mn-department-card { padding: 10px; gap: 6px; }
  .mn-department-card strong { font-size: .875rem; }
  .mn-department-photo { width: 70px; flex-basis: 70px; }
}
@media (max-width: 1024px) {
  .single-product .mn-product-intro { --mn-gallery-frame: clamp(280px, 53vw, 460px); grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .single-product .mn-product-gallery-column { position: relative; top: auto; }
  /* The existing mobile tab opens the full text with a single tap. */
  .mn-description-mobile > .mn-description-intro,
  .mn-description-mobile > .mn-description-details > summary { display: none; }
  .mn-description-mobile > .mn-description-details[open] > .mn-long-description { margin-top: 0; }
}
@media (max-width: 767px) {
  .mn-department-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mn-department-card { min-height: 82px; padding: 8px 10px; gap: 4px; }
  .mn-department-card strong { font-size: .875rem; }
  .mn-department-photo { width: 68px; height: 64px; flex-basis: 68px; }
  .mn-department-photo .mn-department-image { max-height: 64px; }
  .single-product .mn-product-intro { --mn-gallery-frame: clamp(250px, 80vw, 380px); }
  .woocommerce div.product .mn-product-gallery-column div.images .flex-control-thumbs { gap: 8px; }
  .woocommerce div.product .mn-product-gallery-column div.images .flex-control-thumbs li { flex-basis: 64px; width: 64px !important; height: 64px; }
  .mn-product-gallery-column > .mn-condition-label { top: 12px; right: 12px; font-size: .8125rem; }
}
@media (max-width: 359px) {
  .mn-department-card { padding-inline: 8px; }
  .mn-department-photo { width: 50px; flex-basis: 50px; }
}
@media (min-width: 1025px) and (max-height: 470px) {
  .single-product .mn-product-gallery-column { position: relative; top: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .mn-department-card { transition: none; }
}
@media print {
  .single-product .mn-product-gallery-column { position: static; }
  .mn-description-intro, .mn-description-details > summary { display: none; }
  .mn-description-details > .mn-long-description { display: block !important; }
}
