/* ==========================================================================
   fux_products — Base CSS
   --------------------------------------------------------------------------
   Projekt-neutrales BEM-Styling fuer Produkt-Karten, -Grid, -Detail,
   -Spec-Table. Per CSS-Custom-Properties konfigurierbar. Projekte koennen
   via eigenes CSS nachueberschreiben.
   ========================================================================== */

:root {
  --prod-color-primary: #09458d;
  --prod-color-primary-light: #ececfb;
  --prod-color-primary-lighter: #f4f4fd;
  --prod-color-text: #111827;
  --prod-color-muted: #6b7280;
  --prod-color-border: #e5e7eb;
  --prod-color-bg: #fff;
  --prod-color-bg-muted: #f9fafb;
  --prod-radius-sm: 6px;
  --prod-radius-md: 12px;
  --prod-space-1: 4px;
  --prod-space-2: 8px;
  --prod-space-3: 12px;
  --prod-space-4: 16px;
  --prod-space-5: 24px;
  --prod-space-6: 32px;
  --prod-space-8: 48px;
  --prod-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
  --prod-shadow-md: 0 4px 12px rgb(0 0 0 / 0.08);
  --prod-shadow-lg: 0 8px 24px rgb(0 0 0 / 0.12);
  --prod-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   Produkt-Grid (Liste / Similar Products)
   -------------------------------------------------------------------------- */
.product-grid {
  display: grid;
  gap: var(--prod-space-5);
  grid-template-columns: repeat(1, 1fr);
}

@media (min-width: 576px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .product-grid--cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-grid--cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* 1-Spalte: erzwingt vertikalen Stack ueber alle Breakpoints
   (verhindert das 2-col-Layout bei 576px+ und 3-col bei 992px+) */
@media (min-width: 576px) {
  .product-grid.product-grid--cols-1 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 992px) {
  .product-grid.product-grid--cols-1 {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Produkt-Karte — nur das funktional Noetige

   Die Optik der Karten liefert das Projekt, nicht diese Extension. Hier stehen
   ausschliesslich die beiden Regeln, ohne die der Klick-Overlay-Link nicht
   arbeiten kann: Er spannt sich absolut ueber die ganze Karte, dafuer braucht
   die Karte einen Positionierungskontext.

   Welche Klassen ein Projekt gestalten muss, steht im README unter "Styling".
   -------------------------------------------------------------------------- */
.card-product__link-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
  text-decoration: none;
}

.card-product {
  position: relative;
}

/* --------------------------------------------------------------------------
   Produkt-Detail
   -------------------------------------------------------------------------- */
.product-detail {
  display: grid;
  gap: var(--prod-space-6);
  grid-template-columns: 1fr;
}

@media (min-width: 992px) {
  .product-detail {
    grid-template-columns: 1.1fr 1fr;
    gap: var(--prod-space-8);
  }
}

.product-detail__gallery {
  display: flex;
  flex-direction: column;
  gap: var(--prod-space-3);
}

.product-detail__gallery-main {
  /* Breite explizit setzen. Der Container ist ein Spalten-Flexbox mit
     align-items: center (aus styles.css), darin bekaeme diese Box sonst nur
     Inhaltsbreite — und die haengt am Bild. Solange das Bild auf 800 Pixel
     zugeschnitten wurde, fiel das nicht auf; seit es unbeschnitten und damit
     beliebig schmal sein kann, kollabierte der Kasten mit ihm. */
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--prod-color-bg-muted);
  border-radius: var(--prod-radius-md);
  overflow: hidden;
}

.product-detail__gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Galerie-Slides: alle Bilder sind gerendert, sichtbar ist nur das aktive. */
.product-detail__gallery-slide {
  display: none;
  width: 100%;
  height: 100%;
}

.product-detail__gallery-slide--active {
  display: block;
}

/* Der Zoom-Link aus ce:link.clickEnlarge umschliesst das Bild und muss
   die volle Flaeche einnehmen, sonst kollabiert das Slide auf Textzeilenhoehe. */
.product-detail__gallery-slide > a {
  display: block;
  width: 100%;
  height: 100%;
}

.product-detail__gallery-thumbs {
  display: flex;
  gap: var(--prod-space-2);
  flex-wrap: wrap;
}

.product-detail__gallery-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--prod-radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--prod-color-bg-muted);
}

.product-detail__gallery-thumb--active {
  border-color: var(--prod-color-primary);
}

.product-detail__gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-detail__article {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--prod-color-muted);
  font-weight: 600;
  margin-bottom: var(--prod-space-2);
}

.product-detail__title {
  margin: 0 0 var(--prod-space-4);
  font-size: 2rem;
  font-weight: 700;
  color: var(--prod-color-text);
  line-height: 1.2;
}

.product-detail__text {
  color: var(--prod-color-muted);
  line-height: 1.65;
  margin-bottom: var(--prod-space-5);
}

.product-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--prod-space-3);
  margin-top: var(--prod-space-5);
}

.product-detail__categories {
  margin-top: var(--prod-space-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--prod-space-2);
}

.product-detail__category {
  display: inline-block;
  padding: 2px var(--prod-space-3);
  background: var(--prod-color-primary-lighter);
  color: var(--prod-color-primary);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Produkt-Spec-Table
   -------------------------------------------------------------------------- */
.product-specs {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--prod-space-5);
}

.product-specs__row {
  border-bottom: 1px solid var(--prod-color-border);
}

.product-specs__row:last-child {
  border-bottom: none;
}

.product-specs__label {
  padding: var(--prod-space-3) var(--prod-space-4) var(--prod-space-3) 0;
  width: 40%;
  font-weight: 500;
  color: var(--prod-color-muted);
  vertical-align: top;
  display: flex;
  align-items: center;
  gap: var(--prod-space-2);
}

.product-specs__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--prod-color-primary);
}

.product-specs__icon img {
  max-width: 100%;
  max-height: 100%;
}

.product-specs__value {
  padding: var(--prod-space-3) 0;
  color: var(--prod-color-text);
  font-weight: 500;
}

/* Table-Version (semantisches <table>) */
table.product-specs td {
  padding: var(--prod-space-3) var(--prod-space-4) var(--prod-space-3) 0;
  vertical-align: top;
  border-bottom: 1px solid var(--prod-color-border);
}

table.product-specs td:first-child {
  width: 40%;
  font-weight: 500;
  color: var(--prod-color-muted);
}

table.product-specs td:last-child {
  color: var(--prod-color-text);
  font-weight: 500;
}

table.product-specs tr:last-child td {
  border-bottom: none;
}

.product-specs__unit {
  color: var(--prod-color-muted);
  margin-left: 2px;
  font-weight: 400;
}

.product-detail__gallery-main--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--prod-color-muted);
  border: 1px dashed var(--prod-color-border);
}

.product-detail__datasheet {
  display: inline-flex;
  align-items: center;
  gap: var(--prod-space-2);
}

.product-detail__empty {
  padding: var(--prod-space-6);
  text-align: center;
  color: var(--prod-color-muted);
  background: var(--prod-color-bg-muted);
  border-radius: var(--prod-radius-md);
}

/* --------------------------------------------------------------------------
   Aehnliche Produkte
   -------------------------------------------------------------------------- */

/* Die Karte stammt aus dem Site-Package (.card-branch--with-media) und fuellt
   ihren Medienkasten dort mit object-fit: cover — richtig fuer die
   Branchen-Teaser, die formatfuellende Fotos zeigen. Produktbilder sollen
   dagegen vollstaendig sichtbar bleiben, deshalb hier contain. Die Regel ist
   bewusst auf die Sektion begrenzt und aendert die Teaser nicht. */
.similar-products-section .card-branch__media img {
  object-fit: contain;
  padding: var(--prod-space-3);
}

/* --------------------------------------------------------------------------
   Produkt-Liste Layout (Filter-Sidebar + Grid)
   -------------------------------------------------------------------------- */
.product-list {
  display: grid;
  gap: var(--prod-space-5);
  grid-template-columns: 1fr;
}

@media (min-width: 992px) {
  .product-list--has-filter {
    grid-template-columns: 260px 1fr;
    gap: var(--prod-space-6);
    align-items: start;
  }
}

.product-list__main {
  min-width: 0;
}

.product-list__empty {
  display: none;
  padding: var(--prod-space-6);
  text-align: center;
  color: var(--prod-color-muted);
  background: var(--prod-color-bg-muted);
  border-radius: var(--prod-radius-md);
  margin-top: var(--prod-space-4);
}

.product-list__empty.is-visible {
  display: block;
}

.card-product.is-hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Filter-Sidebar
   -------------------------------------------------------------------------- */
.product-filter-sidebar {
  background: var(--prod-color-bg);
  border: 1px solid var(--prod-color-border);
  border-radius: var(--prod-radius-md);
  overflow: hidden;
}

@media (min-width: 992px) {
  .product-filter-sidebar {
    position: sticky;
    top: var(--prod-space-5);
  }
}

.product-filter-sidebar__inner {
  padding: var(--prod-space-5);
  display: flex;
  flex-direction: column;
  gap: var(--prod-space-5);
}

.product-filter-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--prod-space-3);
  padding-bottom: var(--prod-space-3);
  border-bottom: 1px solid var(--prod-color-border);
}

.product-filter-sidebar__headline {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--prod-color-text);
}

.filter-reset {
  background: none;
  border: none;
  padding: 0;
  color: var(--prod-color-primary);
  font-size: 0.8125rem;
  cursor: pointer;
  text-decoration: underline;
}

.filter-reset:hover {
  color: var(--prod-color-text);
}

/* Filter-Gruppen */
.filter-group {
  border: none;
  padding: 0;
  margin: 0;
}

.filter-group__legend {
  display: flex;
  align-items: center;
  gap: var(--prod-space-2);
  padding: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--prod-color-text);
  margin-bottom: var(--prod-space-3);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filter-group__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--prod-color-primary);
}

.filter-group__icon img {
  max-width: 100%;
  max-height: 100%;
}

.filter-group__options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--prod-space-2);
}

.filter-option-label {
  display: flex;
  align-items: center;
  gap: var(--prod-space-2);
  cursor: pointer;
  font-size: 0.9375rem;
  color: var(--prod-color-text);
  transition: color var(--prod-transition);
}

.filter-option-label:hover {
  color: var(--prod-color-primary);
}

.filter-option-label.is-disabled {
  color: var(--prod-color-muted);
  opacity: 0.5;
  cursor: default;
}

.filter-option {
  accent-color: var(--prod-color-primary);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.filter-option-label__text {
  flex-grow: 1;
}

.filter-option-label__count {
  color: var(--prod-color-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Mobile: Filter-Toggle
   -------------------------------------------------------------------------- */
.filter-toggle-mobile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--prod-space-3);
  width: 100%;
  padding: var(--prod-space-4) var(--prod-space-5);
  background: var(--prod-color-primary);
  color: #fff;
  border: none;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-toggle-mobile__icon {
  width: 14px;
  height: 14px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  transition: transform var(--prod-transition);
}

.filter-toggle-mobile.is-active .filter-toggle-mobile__icon {
  transform: rotate(-135deg);
}

@media (max-width: 991.98px) {
  .product-filter-sidebar__inner {
    display: none;
  }

  .product-filter-sidebar.is-open .product-filter-sidebar__inner {
    display: flex;
  }
}

@media (min-width: 992px) {
  .filter-toggle-mobile {
    display: none;
  }
}
