/* --- listing.css --- */
.listing-section {
  background: #ffffff;
}
.listing-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 var(--so-page-gutter, 12px);
}
.listing-breadcrumb {
  font-size: 13px;
  color: #444;
  margin-bottom: 12px;
}
.listing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.listing-title {
  font-size: var(--so-h1-size, clamp(24px, 2.5vw, 32px));
  margin: 0;
}
.listing-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 0;
  margin: 14px 0 16px;
  background: #fff;
  border: 0;
  border-radius: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}
.listing-toolbar-left,
.listing-toolbar-center,
.listing-quick-filters,
.listing-toolbar-right {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e6e6e6;
  overflow: hidden;
}
.listing-toolbar > * + * {
  border-left: 0; /* avoid double borders between cells */
}
.listing-toolbar-center {
  justify-content: center;
}
.listing-toolbar-count {
  font-size: 13px;
  color: #444;
  text-transform: none;
  letter-spacing: 0;
}
.listing-filter-trigger {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12px;
  color: #000;
  text-transform: none;
  letter-spacing: 0;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.listing-filter-icon {
  display: inline-flex;
}
.listing-filter-icon--open {
  display: none;
}
.listing-filter-trigger[aria-expanded="true"] .listing-filter-icon--closed {
  display: none;
}
.listing-filter-trigger[aria-expanded="true"] .listing-filter-icon--open {
  display: inline-flex;
}
.listing-filter-label {
  display: inline-flex;
}
.listing-quick-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin: 0;
}
.listing-quick-filters > * {
  min-width: 0;
}
.listing-toolbar .discount-filter,
.listing-toolbar .new-arrivals-filter {
  width: 100%;
  white-space: nowrap; /* keep "In sconto" / "Nuovi arrivi" on one line */
}

.listing-toolbar .sorting-filter {
  width: 100%;
  justify-content: center;
}
.listing-toolbar .listing-sort {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: center;
}
.listing-toolbar .js .sort-trigger {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
}
.listing-drawer {
  border: none;
  padding: 0;
  background: #fff;
  margin-bottom: 16px;
}
.listing-active-filters {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.listing-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}
.page-link {
  padding: 6px 10px;
  border: 1px solid #ddd;
  color: #111;
  text-decoration: none;
  border-radius: 0;
}
.page-link.active {
  background: #111;
  color: #fff;
}

@media (max-width: 768px) {
  .listing-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .listing-toolbar-left,
  .listing-toolbar-right {
    min-height: 44px;
  }
  .listing-toolbar-center {
    display: none;
  }
  .listing-quick-filters {
    display: none;
  }
}

/* --- ListingPage.css --- */
.listing-page {
  background: #ffffff;
  width: 100%;
  margin: 0;
  overflow-x: hidden;
}

.listing-page-top {
  width: 100%;
  margin: 0;
  padding: 12px var(--so-page-gutter, 12px) 0;
}

.listing-page-grid {
  min-height: 520px;
}

.listing-page-grid--no-results {
  min-height: 0;
}

.listing-page-description {
  margin: 2rem auto;
  max-width: 860px;
}

.listing-page-description--bottom {
  margin-top: 3rem;
}

.listing-disclosure {
  margin-top: 1rem;
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* gutters are centralized in `--so-page-gutter` (see public/css/base/main.css) */

/* --- Filters.css --- */
.listing-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px,1fr));
  gap: 16px;
}
.filter-block {
  padding: 12px 0;
  background: #fff;
}
.filter-block-title {
  margin-top: 0;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
}
.filter-block ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-block ul li a {
  color: #111;
  text-decoration: none;
}
.price-filter {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.price-filter input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #dcdcdc;
}
.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}

/* --- ActiveFilters.css --- */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
  align-items: center;
  justify-content: center;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f5f5f5;
  color: #111;
  padding: 6px 10px;
  text-decoration: none;
  border-radius: 0;
  border: 1px solid #e5e5e5;
  font-size: 12px;
}

.filter-chip__label {
  text-transform: none;
  letter-spacing: 0;
  color: #444;
}

.filter-chip__value {
  color: #111;
}

.filter-chip__close {
  margin-left: 2px;
  color: #666;
}

.filter-chip--clear {
  background: #fff;
  border: 1px solid #ddd;
  color: #111;
}

@media (max-width: 768px) {
  .active-filters {
    justify-content: center;
  }
}

/* --- ProductFilter.css --- */
.product-filter {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(440px, 92vw);
  max-width: 440px;
  height: 100%;
  transform: translateX(110%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.28s ease-in-out;
  z-index: 2200;
  background: #ffffff;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #eee;
  overflow-x: hidden;
}

.filter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 2100;
}

.product-filter.open,
body.filters-open .product-filter {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.filters-open .filter-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Header fisso in alto */
.filter-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: #ffffff;
  border-bottom: 1px solid #eee;
}

/* Pulsante di chiusura */
.filter-close-button {
  background: transparent;
  border: none;
  font-size: 24px;
  padding: 8px;
  color: #2b221d;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.filter-close-button:hover {
  background-color: transparent;
}

.filter-title {
  font-size: 18px;
  color: #111;
  margin: 0;
  letter-spacing: 0.02em;
  text-transform: none;
  font-family: inherit;
}

/* Contenuto centrale, scrollabile */
.filter-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-quick {
  padding: 12px 0;
  border-radius: 0;
  background: #ffffff;
  border: none;
  box-shadow: none;
}

.filter-quick__title {
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0.08em;
  color: #666;
  margin-bottom: 10px;
}

.filter-quick__toggles {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
}

/* Footer fisso in basso */
.filter-footer {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  padding: 16px 20px 20px;
  border-top: 1px solid #eee;
  background-color: #ffffff;
}

.filter-footer .button {
  flex: 1;
}

/* Personalizzazione scrollbar */
.filter-content::-webkit-scrollbar {
  width: 8px;
}
.filter-content::-webkit-scrollbar-thumb {
  background-color: #ddd;
  border-radius: 0;
}
.filter-content::-webkit-scrollbar-thumb:hover {
  background-color: #ccc;
}

@media (max-width: 768px) {
  .product-filter {
    width: 100%;
    border-left: none;
  }

  .filter-title {
    font-size: 16px;
  }
}

/* --- FilterList.css --- */
.filter-block {
  border: none;
  border-bottom: 1px solid #eee;
  padding: 10px 0;
}

.filter-block[open] .chevron {
  transform: rotate(180deg);
}

.filter-block__title {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: #111;
  padding: 6px 0;
}

.filter-block__title::-webkit-details-marker {
  display: none;
}

.filter-block__content {
  padding: 8px 0 2px;
}

.filter-search {
  margin: 6px 0 10px;
}

.filter-search-input {
  width: 100%;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  background: #fafafa;
}

.filter-search-input:focus {
  outline: none;
  border-color: #cfcfcf;
  background: #fff;
}

.filter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding-right: 6px;
}

.filter-checkbox-label {
  display: flex;
  align-items: flex-start;
  width: 100%;
  font-size: 13px;
  padding: 6px 0;
  cursor: pointer;
  user-select: none;
  gap: 8px;
}

.filter-checkbox-input {
  flex: 0 0 auto;
  margin-top: 2px;
}

.filter-list-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.filter-list-item.is-active .filter-list-label {
  font-weight: 600;
}

.filter-list-item.is-hidden {
  display: none;
}

.filter-empty {
  font-size: 12px;
  color: #777;
}

.chevron {
  display: inline-flex;
  transition: transform 0.2s ease;
}

.filter-list::-webkit-scrollbar {
  width: 8px;
}
.filter-list::-webkit-scrollbar-thumb {
  background-color: #ddd;
  border-radius: 10px;
}
.filter-list::-webkit-scrollbar-thumb:hover {
  background-color: #cfcfcf;
}

@media (max-width: 768px) {
  .filter-search-input {
    font-size: 16px;
  }
}

/* --- CategoryList.css --- */
.category-container {
  width: 100%;
  padding: 10px 0 14px;
  background: transparent;
}

.category-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.category-back {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  background: transparent;
  border: 0;
  color: #111;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
}

.category-back:hover,
.category-back:focus-visible {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.category-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
  color: #111;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-clear {
  flex: 0 0 auto;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  text-decoration: none;
  color: #111;
  opacity: 0.75;
}

.category-clear:hover,
.category-clear:focus-visible {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.category-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.category-nav-item {
  margin: 0;
}

.category-nav-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: transparent;
  color: #111;
  font-size: 14px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

a.category-nav-row {
  cursor: pointer;
  text-decoration: none;
}

.category-nav-link {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.category-nav-next {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: transparent;
  border: 0;
  cursor: pointer;
  opacity: 0.7;
  line-height: 0;
}

.category-nav-next:hover,
.category-nav-next:focus-visible {
  opacity: 1;
}

.category-nav-row:hover {
  border-color: rgba(0, 0, 0, 0.16);
}

.category-nav-row:focus-visible,
.category-nav-link:focus-visible,
.category-nav-next:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.35);
  outline-offset: 2px;
}

.category-nav-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-nav-icon {
  flex: 0 0 auto;
}

.category-nav-row[aria-current="true"] {
  border-color: rgba(0, 0, 0, 0.25);
}

.category-nav-empty {
  padding: 10px 10px;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.55);
}

/* --- DiscountFilter.css --- */
.discount-filter {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  user-select: none;
  width: 100%;
  height: auto;          /* let the container decide the height */
  padding: 0;            /* no extra spacing */
  border: 0;             /* no borders */
  background: transparent;
  color: #111;
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  line-height: 1.2;
  border-radius: 0;
  white-space: nowrap;
  position: relative;
}

.discount-filter-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.discount-filter-text {
  display: inline-flex;
  align-items: center;
}

/* Visual toggle (switch) – drawn as the last flex item */
.discount-filter::after {
  content: '';
  margin-left: auto;
  flex: 0 0 auto;
  width: 34px;
  height: 18px;
  border-radius: 0;
  border: 1px solid #d8d8d8;
  background-color: #d8d8d8; /* track */
  background-image: linear-gradient(#fff, #fff); /* knob */
  background-repeat: no-repeat;
  background-size: 14px 14px;
  background-position: 2px 50%;
  transition: background-color 160ms ease, background-position 160ms ease, border-color 160ms ease;
}

.discount-filter:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.discount-filter.is-active {
  color: #111;
}
.discount-filter.is-active::after {
  background-color: #111; /* track */
  background-position: 18px 50%;
  border-color: #111;
}

@media (max-width: 768px) {
  .discount-filter {
    font-size: 12px;
  }
}

/* --- NewArrivalsFilter.css --- */
.new-arrivals-filter {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  user-select: none;
  width: 100%;
  height: auto;          /* let the container decide the height */
  padding: 0;            /* no extra spacing */
  border: 0;             /* no borders */
  background: transparent;
  color: #111;
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  line-height: 1.2;
  border-radius: 0;
  white-space: nowrap;
  position: relative;
}

.new-arrivals-filter-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.new-arrivals-filter-text {
  display: inline-flex;
  align-items: center;
}

/* Visual toggle (switch) – drawn as the last flex item */
.new-arrivals-filter::after {
  content: '';
  margin-left: auto;
  flex: 0 0 auto;
  width: 34px;
  height: 18px;
  border-radius: 0;
  border: 1px solid #d8d8d8;
  background-color: #d8d8d8; /* track */
  background-image: linear-gradient(#fff, #fff); /* knob */
  background-repeat: no-repeat;
  background-size: 14px 14px;
  background-position: 2px 50%;
  transition: background-color 160ms ease, background-position 160ms ease, border-color 160ms ease;
}

.new-arrivals-filter:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.new-arrivals-filter.is-active {
  color: #111;
}
.new-arrivals-filter.is-active::after {
  background-color: #111; /* track */
  background-position: 18px 50%;
  border-color: #111;
}

@media (max-width: 768px) {
  .new-arrivals-filter {
    font-size: 12px;
  }
}

/* --- PriceFilter.css --- */
.price-filter {
  display: grid;
  gap: 10px;
}

.price-filter input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 0;
  padding: 8px 10px;
  font-size: 13px;
}

.price-filter-actions {
  display: flex;
  gap: 8px;
}

.price-filter-actions .button-form {
  flex: 1;
}

/* --- SortingFilter.css --- */
/* Wrapper: occupa tutto lo spazio del box header */
.sorting-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  z-index: 1200; /* sopra le card prodotto */
  min-width: 0;
}

/* Pulsante "ORDINA" SENZA BORDI (desktop) */
.sort-trigger {
  display: none;
  border: none;                   /* niente bordi su desktop */
  align-items: center;
  justify-content: center;
  text-transform: none;
  background: transparent;
  cursor: pointer;
  user-select: none;
  line-height: 1;
  color: inherit;
  font-size: 16px;
}

.sort-trigger-icon {
  display: inline-flex;
}

.listing-sort {
  border: 1px solid #ddd;
  border-radius: 0;
  padding: 8px 12px;
  font-size: 12px;
  background: #fff;
  text-transform: none;
  letter-spacing: 0;
  width: 100%;
  min-width: 0;
}

/* Effetto sottile su hover/focus */
.sort-trigger:is(:hover, :focus-visible) {
  outline: none;
}

/* Popover che si apre VERSO IL BASSO — nessun bordo */
.sort-popover {
  position: absolute;
  top: calc(100% + 8px);          /* ⬅️ apre sotto il pulsante */
  left: auto;
  right: 0;
  width: min(320px, calc(100vw - 24px));
  bottom: auto;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff;
  border: 0;         
  box-shadow: none;
  border: 1px solid #eee;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);    /* piccola animazione dal pulsante */
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 1300;
}

.sort-popover-header {
  display: none;
}

.sort-popover-title {
  font-size: 16px;
  color: #111;
}

.sort-popover-close {
  background: transparent;
  border: none;
  font-size: 24px;
  padding: 8px;
  color: #2b221d;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

/* Quando il sort è aperto disabilita i link overlay delle card */
.sort-popover-open .product-item-link {
  pointer-events: none;
}
.sort-popover-open .product-item-details-link {
  pointer-events: none;
}

.sort-popover.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Lista opzioni */
.sort-list {
  margin: 0;
  padding: 8px;
  list-style: none;
}

.sort-option {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;                      /* nessun bordo sulle opzioni */
  background: transparent;
  cursor: pointer;
  text-transform: none;
  font-size: 14px;
  color: inherit;
  border-radius: 0;
}

.sort-option:hover {
  background: #f5f5f5;
}

.sort-option.is-active {
  background: #f0f0f0;
  font-weight: 700;
}

/* Desktop: popover più stretto e allineato a destra se serve */
@media (min-width: 992px) {
  .sort-popover {
    width: 280px;
    left: auto;
    right: 0;
  }
}

/* Mobile (≤768px): aggiungi SOLO qui il bordo del bottone */
@media (max-width: 768px) {
  /* Keep mobile stable on first paint: always use native select, no JS-only switch. */
  .sort-trigger,
  .sort-popover {
    display: none !important;
  }

  .listing-sort {
    display: block;
    width: 100%;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: center;
    line-height: 1.2;
    font-size: 16px; /* prevent iOS auto-zoom on focus */
  }
}

/* --- FilterReset.css --- */
/* FilterResetStyles.css */

.filter-reset-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px 0;
}

.reset-button {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;
}

.reset-button:hover {
  background-color: #00b327;
}

.filter-details {
  margin-top: 10px;
}

.detail-span {
  display: block;
  margin: 5px 0;
}

/* --- NoResults.css --- */
.listing-no-results {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #ffffff;
}

.listing-no-results-title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.2;
}

.listing-no-results-text {
  margin: 0;
  color: #475569;
  font-size: 0.98rem;
}

.listing-no-results-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.listing-no-results-action {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.listing-empty-suggestions {
  margin-top: 8px;
}

.listing-empty-suggestions-title {
  margin: 0 0 12px;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.2;
}

/* --- Grid.css --- */
.product-grid {
  display: grid;
  /* Desktop wide: 6 columns, then scale down by breakpoint. */
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

@media (max-width: 1800px) {
  .product-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1500px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

/* Mobile/tablet small: keep 2 columns and compact gap. */
@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

/* Listing page: hard override for responsive scale (2 -> 7 columns). */
.listing-page-grid .listing-product-grid,
.listing-page-grid .product-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px;
}

@media (min-width: 900px) {
  .listing-page-grid .listing-product-grid,
  .listing-page-grid .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1200px) {
  .listing-page-grid .listing-product-grid,
  .listing-page-grid .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1440px) {
  .listing-page-grid .listing-product-grid,
  .listing-page-grid .product-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1680px) {
  .listing-page-grid .listing-product-grid,
  .listing-page-grid .product-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1920px) {
  .listing-page-grid .listing-product-grid,
  .listing-page-grid .product-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  }
}

/* Allow grid items to shrink even with long unbreakable strings inside. */
.product-grid > * {
  min-width: 0;
}
.state {
  text-align: center;
  color: #666;
}

/* --- Item.css --- */
.product-item {
  /* Keep every card the same size in grid + carousels */
  --so-card-h: 500px;
  --so-card-media-h: 320px;
  width: 100%;
  min-width: 0;
  background-color: #fff;
  border-radius: 0;
  border: 1px solid #ededed;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  text-align: left;
  position: relative;
  display: flex;
  flex-direction: column;
  /* Use min-height to avoid clipping details (esp. price) if content grows. */
  min-height: var(--so-card-h);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.product-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.12);
}

@media (max-width: 1200px) {
  .product-item {
    --so-card-h: 470px;
    --so-card-media-h: 290px;
  }
}

@media (max-width: 768px) {
  .product-item {
    /* Mobile 2-col grid needs a bit more vertical room for title/store + price. */
    --so-card-h: 410px;
    --so-card-media-h: 230px;
  }
}
.product-item-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-width: 0;
}
.product-item-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  color: inherit;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
}
.product-item-media {
  position: relative;
  overflow: hidden;
  background: #fafafa;
  border-bottom: 1px solid #f0f0f0;
  height: var(--so-card-media-h);
  flex: 0 0 var(--so-card-media-h);
  min-width: 0;
}

/* Listing cards: use all available media area without cropping the image. */
.product-item-media .product-card-image img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
}
.product-item-image--placeholder {
  height: 100%;
  display: grid;
  place-items: center;
  color: #777;
  background: #f0f0f0;
}
.product-item .badge.badge-top-left {
  left: 10px;
}
.product-item .badge.badge-top-right {
  right: 10px;
}
.product-item .badge.badge-top-right.badge-avoid-wishlist {
  right: 54px;
}
.product-item .badge.badge-bottom-left {
  left: 10px;
}
.product-item .badge.badge-bottom-right {
  right: 10px;
}
.product-item .badge {
  padding: 4px 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.product-item-details-link {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 5;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 17, 17, 0.12);
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.15);
  border-radius: 0;
}

.product-item-share-button {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 5;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 17, 17, 0.12);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.15);
  border-radius: 0;
  padding: 0;
  cursor: pointer;
}

.product-item-share-icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.product-item-share-button:hover .product-item-share-icon,
.product-item-share-button:focus-visible .product-item-share-icon {
  opacity: 1;
}

.product-item-share-button:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.product-item-wishlist-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 17, 17, 0.12);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.15);
  border-radius: 0;
  padding: 0;
  cursor: pointer;
}

.product-item-wishlist-icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.product-item-wishlist-button:hover .product-item-wishlist-icon,
.product-item-wishlist-button:focus-visible .product-item-wishlist-icon {
  opacity: 1;
}

.product-item-wishlist-button:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.product-item-wishlist-button[data-wishlist-active="true"] {
  /* Keep the button surface unchanged: only the heart icon changes when active. */
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(17, 17, 17, 0.12);
}

.product-item-wishlist-button[data-wishlist-active="true"] .product-item-wishlist-icon {
  /* Tint the SVG <img> to red when active (heart-fill.svg is swapped by JS). */
  filter: brightness(0) saturate(100%) invert(17%) sepia(92%) saturate(5855%)
    hue-rotate(352deg) brightness(98%) contrast(112%);
  opacity: 1;
}

.product-item-details-icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.product-item-details-link:hover .product-item-details-icon,
.product-item-details-link:focus-visible .product-item-details-icon {
  opacity: 1;
}

.product-item-details-link:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}
.product-item-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 10px 12px;
  margin-top: auto;
  /* Ensure the price row is visible (brand/title/store/sizes/shipping/price). */
  min-height: 170px;
  flex: 1;
  overflow: visible;
  min-width: 0;
}

/* Keep the price pinned to the bottom of the card body. */
.product-item-body .price-container {
  margin-top: auto;
  padding-top: 4px;
}

/* Allow inner links/buttons in the BODY to be clickable above the overlay link. */
.product-item-body a,
.product-item-body button {
  position: relative;
  z-index: 3;
}

@media (max-width: 768px) {
  .product-item-body {
    padding: 8px 8px 10px;
    min-height: 152px;
  }
}
.product-item-brand {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
  margin: 0;
}
.product-item-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
  /* Prevent long titles from pushing the price out of view on fixed-height cards. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  /* NOTE: `line-clamp` is not widely supported yet; keep vendor prefix for WebKit. */
  line-clamp: 2;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.product-item-store {
  font-size: 12px;
  color: #777;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-item-sizes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.product-size-badge,
.product-size-more {
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid #e0e0e0;
}
.product-item-shipping {
  font-size: 12px;
  color: #333;
}
.product-item-price {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.product-item-price .old {
  text-decoration: line-through;
  color: #888;
}
.product-item-actions {
  margin-top: 6px;
}

/* --- Pagination.css --- */
.pagination-nav {
  width: 100%;
  margin: 20px 0;
}

.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.pagination-container li {
  margin: 0;
  box-shadow: none;
}

.pagination-container li a {
  min-width: 38px;
  height: 38px;
  background: #fff;
  color: #222;
  font-size: 1.08em;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.17s, color 0.17s;
  border: 1px solid #ddd;
  border-radius: 0;
}

.pagination-container li a:focus-visible {
  outline: 2px solid #007bff;
  z-index: 2;
}

.pagination-container li a:hover:not([aria-disabled='true']) {
  background: #f4f7fa;
}

.pagination-container li.active a {
  background: #111;
  color: #fff;
  font-weight: 600;
  box-shadow: none;
}

.pagination-container li.disabled a {
  background: #f3f3f3;
  color: #ccc;
  cursor: not-allowed;
  opacity: 0.64;
}

@media (max-width: 500px) {
  .pagination-container {
    gap: 3px;
  }
  .pagination-container li a {
    min-width: 30px;
    height: 30px;
    font-size: 1em;
  }
}

/* --- Badge.css --- */
.badge {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  background-color: #e60023;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 500;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

/* Tipologie di Badge */
/* Keep contrast >= 4.5:1 (WCAG AA) for small text. */
.badge-discount { background-color: #b00020; } /* white text on dark red */
.badge-new { background-color: #0b7a22; } /* white text on dark green */
.badge-bestseller { background-color: #f59e0b; color: #111827; }
.badge-limited { background-color: #6d28d9; }
.badge-exclusive { background-color: #1e3a8a; }
.badge-official { background-color: #0b7a22; }
.badge-hot { background-color: #b45309; }
.badge-default { background-color: #4b5563; }

.badge-primary { background: #e8edff; color: #1d4ed8; border-color: #cbdafe; }
.badge-success { background: #e8f7e8; color: #167a1c; border-color: #bfe6c1; }
.badge-warning { background: #fcac00; color: #030303; border-color: #fde68a; }
.badge-info { background: #ecfeff; color: #0369a1; border-color: #bae6fd; }
.badge-count { background: #efefef; color: #111827; border-color: #e5e7eb; }

/* Posizioni */
.badge-top-left { top: 10px; left: 0; border-radius: 0 5px 5px 0; }
.badge-bottom-left { bottom: 10px; left: 0; border-radius: 0 5px 5px 0; }
.badge-top-right { top: 10px; right: 0; border-radius: 5px 0 0 5px; }
.badge-bottom-right { bottom: 10px; right: 0; border-radius: 5px 0 0 5px; }
.badge-center { top: 50%; left: 50%; transform: translate(-50%, -50%); border-radius: 8px; }

/* --- BrandLabel.css --- */
.brand-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.15;
  width: 100%;
  min-height: 28px;
  text-align: left;
  min-width: 0;
}

.brand-label--center {
  justify-content: center;
  text-align: center;
}

.brand-label--left {
  justify-content: flex-start;
  text-align: left;
}

.brand-label--right {
  justify-content: flex-end;
  text-align: right;
}

.brand-label-link,
.brand-label .brand-label-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  justify-content: flex-start;
  min-height: 28px;
  width: 100%;
  overflow: hidden;
  min-width: 0;
}

.brand-label-logo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 50px;
}

.brand-label-logo {
  height: 22px;     /* compatto: perfetto per card/griglie */
  width: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.brand-label-text {
  font-size: 12px;
  font-weight: 500;
  color: #111827;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* helper accessibilità */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* --- PriceDisplay.css --- */
/* ===============================
   PriceDisplay - Stili Generali
   =============================== */
.price-container {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 100%;
  font-size: 13px;
  /* Allow wrapping on narrow cards (mobile 2-col grid) so the price never disappears/clips. */
  flex-wrap: wrap;
  white-space: normal;
}
  
  /* Prezzo originale barrato */
  .original-price {
    color: #000000;
    text-decoration: line-through;
    white-space: nowrap;
  }
  
  /* Prezzo scontato evidenziato */
  .discounted-price {
    color: #e60023; /* 🔥 Rosso evidenziato */
    white-space: nowrap;
    font-weight: 700;
  }
  
  /* Prezzo finale senza sconto */
  .final-price {
    color: #000;
    white-space: nowrap;
    font-weight: 700;
  }
  
  /* ===============================
     Varianti di Dimensione
     =============================== */
.price-small {
  font-size: 12px;
}

.price-medium {
  font-size: 14px;
}

.price-large {
  font-size: 16px;
}
  
  /* ===============================
     Responsive Design
     =============================== */
  @media (max-width: 768px) {
    .price-medium {
      font-size: 14px;
    }
    .price-large {
      font-size: 18px;
    }
  }

/* --- ProductTitle.css --- */
.product-title {
  margin: 0;
  padding: 0;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
  line-height: 1.3;
  /* Reserve one line without Safari/rounding clipping issues. */
  min-height: 1.3em;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .product-title {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .product-title {
    font-size: 12px;
  }
}

/* --- ShippingLabel.css --- */
.shipping-label {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.2;
  color: #6b7280;
  width: 100%;
  min-height: 16px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shipping-label.is-free {
  color: #16a34a;
  font-weight: 600;
}

/* --- SizePreview.css --- */
.size-preview {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  margin: 2px 0;
  line-height: 1;
  flex-wrap: nowrap;
  width: 100%;
  min-height: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.size-preview::-webkit-scrollbar { display: none; }

/* chip taglia */
.size-badge,
.size-more {
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 2px;
  background: #efecec;
  color: #333;
}

/* "+N" */
.size-more {
  color: #555;
}

/* stato vuoto */
.size-preview.is-empty {
  color: #777;
  gap: 3px;
}

.size-empty-text {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* icona (centrata e “pulita”) */
.size-icon {
  display: block;      /* evita baseline text */
  line-height: 0;
}

/* --- StoreLabel.css --- */
.store-label {
  display: block;
  width: 100%;
  font-size: 12px;
  color: #5d5d5d;
  text-align: left;
  letter-spacing: 0.03em;
  font-weight: lighter;
  text-transform: uppercase;
  min-height: 18px;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- ProductCardImage.css --- */
.product-card-image {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  transition: opacity 0.3s;
  margin: 0;
  background-color: #fdfdfd;
  background-image: linear-gradient(90deg, #f6f7f8 0px, #edeef1 40px, #f6f7f8 80px);
  background-size: 600px;
  animation: shimmer 1.2s infinite linear;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
  background: #fff;
}

.product-card-image .product-details-overlay {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.25s ease-out, opacity 0.2s ease;
  z-index: 3;
}

.product-card-image .product-details-overlay.visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

@media screen and (max-width: 480px) {
  .product-card-image img {
    object-fit: contain;
  }
}

@keyframes shimmer {
  0% {
    background-position: -300px 0;
  }
  100% {
    background-position: 300px 0;
  }
}

/* --- ProductDetail.css --- */
.product-page {
  width: 100%;
  margin: 0;
  overflow-x: clip;
  padding: 0 var(--so-page-gutter, 12px);
  background: #ffffff;
}

.product-detail {
  padding: 0;
}

.product-detail-breadcrumbs {
  margin-bottom: 0;
}

.product-detail--rich {
  background: #fff;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

.product-detail-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.product-detail-gallery-column {
  min-width: 0;
  display: flex;
  justify-content: center;
}

.product-detail-gallery-column .gallery-root {
  width: 100%;
  max-width: 520px;
}

.product-detail-info-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product-detail-brand {
  display: inline-flex;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: #111;
  text-decoration: none;
  opacity: 0.78;
}

.product-detail-brand:hover {
  opacity: 1;
}

.product-detail-heading h1 {
  margin: 6px 0 0;
  font-size: clamp(20px, 2.2vw, 30px);
  line-height: 1.12;
}

.product-detail-price {
  font-size: 20px;
  font-weight: 700;
}
.product-detail-store {
  display: inline-block;
  font-size: 12px;
  color: #777;
}
.product-detail-prices {
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.product-detail-price-old {
  text-decoration: line-through;
  color: #888;
}
.product-detail-price-badge {
  background: #f5f5f5;
  padding: 2px 8px;
  font-size: 12px;
}
.product-detail-shipping {
  font-size: 13px;
  color: #333;
}
.product-detail-variants ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.product-detail-variants li {
  font-size: 14px;
  border-bottom: 1px dashed #ddd;
  padding-bottom: 8px;
}
.product-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.product-detail-wishlist {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid #111;
  background: #fff;
  color: #111;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.product-detail-wishlist-icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.product-detail-wishlist-text {
  display: inline-flex;
  align-items: center;
}

.product-detail-wishlist:hover .product-detail-wishlist-icon,
.product-detail-wishlist:focus-visible .product-detail-wishlist-icon {
  opacity: 1;
}

.product-detail-wishlist:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.product-detail-wishlist[data-wishlist-active="true"] {
  background: #111;
  color: #fff;
}

.product-detail-wishlist[data-wishlist-active="true"] .product-detail-wishlist-icon {
  filter: invert(1);
  opacity: 1;
}

.product-detail-offers-summary {
  display: inline-flex;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #174aa3;
  text-decoration: none;
}

.product-detail-offers-summary:hover {
  text-decoration: underline;
}

.product-detail-extra {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.product-detail-sizes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.product-size-badge {
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid #dcdcdc;
}

@media (max-width: 900px) {
  .product-detail-shell {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .product-detail--rich {
    padding: 0;
  }
}

@supports not (overflow: clip) {
  .product-page {
    overflow-x: hidden;
  }
}

/* --- ProductDetailImageGallery.css --- */
.gallery-root {
  display: grid;
  gap: 10px;
}
.gallery-main {
  position: relative;
  background: #fff;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0;
  overflow: hidden;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 17, 17, 0.12);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.15);
  border-radius: 0;
  padding: 0;
  cursor: pointer;
}

.gallery-nav--prev {
  left: 10px;
}
.gallery-nav--next {
  right: 10px;
}

.gallery-nav:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.gallery-nav:hover {
  background: rgba(255, 255, 255, 0.98);
}

.gallery-main [data-gallery-image] {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  object-position: center top;
  display: block;
  background: #fff;
  border: 0 !important;
  border-radius: 0 !important;
  margin: 0;
  outline: 0;
}

.gallery-placeholder {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  color: #6b7280;
  background: #f3f4f6;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.gallery-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #111;
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
}

.gallery-thumbs-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto; /* center when the thumbs fit, left-align when they overflow */
}

.gallery-thumbs .thumb {
  border: 1px solid #dcdcdc;
  background: #fff;
  padding: 0;
  flex: 0 0 auto;
}
.gallery-thumbs .thumb.is-active {
  border-color: #111;
}
.gallery-thumbs .thumb img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  display: block;
  background: #fff;
}

@media (max-width: 520px) {
  .gallery-nav {
    width: 40px;
    height: 40px;
  }
  .gallery-nav--prev {
    left: 8px;
  }
  .gallery-nav--next {
    right: 8px;
  }
  .gallery-thumbs .thumb img {
    width: 62px;
    height: 62px;
  }
}

/* --- Carousel.css --- */
.carousel {
  position: relative;
  width: 100%;
  --carousel-items: 6;
  --carousel-gap: 12px;
}

@media (min-width: 1920px) {
  .carousel {
    --carousel-items: 7;
  }
}

.carousel-viewport {
  position: relative;
}

.carousel-track {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  gap: var(--carousel-gap);
  /* Give cards room for shadows and hover translate without clipping. */
  padding: 12px 8px 22px;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-slide {
  display: flex;
  min-width: 0;
  flex: 0 0 calc(
    (100% - (var(--carousel-gap) * (var(--carousel-items) - 1))) / var(--carousel-items)
  );
  scroll-snap-align: start;
}
.carousel-slide { scroll-snap-stop: always; }
.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  z-index: 10;
  color: rgba(0, 0, 0, 0.28);
  transition: transform 0.15s ease, color 0.15s ease, background-color 0.15s ease;
  border-radius: 999px;
}

.carousel-control:hover {
  color: rgba(0, 0, 0, 0.55);
  background: rgba(255, 255, 255, 0.55);
  transform: translateY(-50%) scale(1.03);
}

.carousel-control:active {
  transform: translateY(-50%) scale(0.98);
}

.carousel-control:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.28);
  outline-offset: 2px;
}

.carousel-control:disabled {
  opacity: 0.22;
  cursor: default;
  background: transparent;
  transform: translateY(-50%);
}

.carousel-control.next {
  right: 10px;
}

.carousel-control.prev {
  left: 10px;
}

.carousel-control-icon {
  display: block;
}

.pagination-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px;
  overflow: auto;
}

.carousel-page-btn {
  border: 0;
  padding: 0;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background-color: rgba(17, 17, 17, 0.08);
  color: rgba(17, 17, 17, 0.75);
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.carousel-page-btn:hover {
  background-color: rgba(17, 17, 17, 0.16);
  transform: translateY(-1px);
}

.carousel-page-btn.active,
.carousel-page-btn.is-active {
  background-color: #111;
  color: #fff;
}

.carousel-page-btn:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.28);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .carousel-control {
    width: 40px;
    height: 40px;
  }
}

