/* ============================================================
   RPS Construction � Products Page (Dynamic)
   Product listing grid, filter chips, product detail page.
   Mobile-first, matches tokens.css design system.
   ============================================================ */

/* ---------- Filter Chips ---------- */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: var(--space-7);
}

.product-filters {
  position: sticky;
  top: 72px;
  z-index: 10;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  padding: var(--space-4) 0;
  margin-bottom: var(--space-7);
  overscroll-behavior: contain;
}

.product-filters .container {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
}

.product-filters .container::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  appearance: none;
  border: 1.5px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-muted-strong);
  border-radius: var(--r-pill);
  padding: 12px 24px;
  font-family: var(--ff-sans);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  min-height: 48px;
  transition: background-color 0.15s ease,
              border-color 0.15s ease,
              color 0.15s ease,
              box-shadow 0.15s ease;
  scroll-snap-align: start;
  flex-shrink: 0;
}

.filter-btn:hover {
  border-color: var(--c-cta);
  color: var(--c-brand);
}

.filter-btn[aria-pressed="true"] {
  background: var(--c-brand);
  border-color: var(--c-brand);
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(46, 53, 142, 0.25);
}

.filter-btn:focus-visible {
  outline: 2px solid var(--c-brand);
  outline-offset: 2px;
}

/* ---------- Product Grid ---------- */
.product-grid {
  display: grid;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  align-items: stretch;
}

/* ---------- Product Card ---------- */
.product-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.product-card {
  background: var(--c-surface-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 0.2s ease,
              transform 0.2s ease;
  cursor: pointer;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

.product-card:active {
  transform: translateY(-1px);
}

.product-card:focus-visible {
  outline: 2px solid var(--c-brand);
  outline-offset: 2px;
}

.product-card__img {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--c-band);
}

.product-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-card__img img {
  transform: scale(1.04);
}

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

.product-card__title {
  font-family: var(--ff-headings);
  font-size: var(--fs-md);
  font-weight: 700;
  line-height: 1.2;
  color: var(--c-text);
  margin-bottom: 8px;
}

.product-card__category {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--c-brand);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  margin-bottom: 12px;
}

.product-card__specs {
  font-size: 14px;
  color: var(--c-muted);
  line-height: 1.6;
  margin-bottom: 16px;
  flex: 1;
}

.product-card__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-cta);
  text-decoration: none;
  transition: gap 0.2s ease;
}

.product-card:hover .product-card__link {
  gap: 10px;
}

.product-card__link svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.product-card:hover .product-card__link svg {
  transform: translateX(2px);
}

/* ---------- Empty State ---------- */
.product-grid-empty {
  text-align: center;
  padding: var(--space-8) var(--space-6);
  color: var(--c-muted);
  font-size: var(--fs-md);
}

/* ---------- Loading State ---------- */
.product-grid-loading {
  display: grid;
  gap: var(--space-6);
}

.skeleton-card {
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--c-surface-card);
  border: 1px solid var(--c-border);
}

.skeleton-card__img {
  aspect-ratio: 4 / 3;
  background: linear-gradient(90deg, var(--c-band) 25%, #e8ecf0 50%, var(--c-band) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-card__body {
  padding: 24px;
}

.skeleton-card__line {
  height: 16px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--c-band) 25%, #e8ecf0 50%, var(--c-band) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  margin-bottom: 12px;
}

.skeleton-card__line--title {
  width: 70%;
  height: 20px;
}

.skeleton-card__line--badge {
  width: 40%;
  height: 12px;
  border-radius: var(--r-pill);
}

.skeleton-card__line--specs {
  width: 90%;
}

.skeleton-card__line--link {
  width: 30%;
  height: 14px;
  margin-bottom: 0;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   Product Detail Page
   ============================================================ */

/* ---------- Back Link ---------- */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-muted);
  text-decoration: none;
  padding: var(--space-4) 0;
  transition: color 0.15s ease;
}

.detail-back:hover {
  color: var(--c-cta);
}

.detail-back svg {
  width: 16px;
  height: 16px;
  transition: transform 0.15s ease;
}

.detail-back:hover svg {
  transform: translateX(-3px);
}

/* ---------- Detail Hero Image ---------- */
.detail-hero {
  margin-bottom: var(--space-7);
}

.detail-hero__img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--r-card);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-card);
  background: var(--c-band);
}

/* ---------- Detail Header ---------- */
.detail-header {
  margin-bottom: var(--space-7);
}

.detail-header__title {
  font-family: var(--ff-headings);
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1.1;
  color: var(--c-text);
  margin-bottom: 12px;
}

.detail-header__category {
  display: inline-block;
  padding: 6px 16px;
  border-radius: var(--r-pill);
  background: var(--c-brand);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
}

.detail-header__desc {
  font-size: var(--fs-md);
  color: var(--c-muted);
  line-height: 1.7;
  max-width: 60ch;
}

/* ---------- Key Specs Grid ---------- */
.key-specs {
  margin-bottom: var(--space-8);
}

.key-specs__title {
  font-family: var(--ff-headings);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: var(--space-6);
}

.key-specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.key-spec-card {
  background: var(--c-band);
  border: 1px solid var(--c-border);
  border-radius: var(--r-card);
  padding: 20px;
  display: grid;
  gap: 8px;
}

.key-spec-card__icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--c-surface-card);
  border: 1px solid var(--c-border);
  color: var(--c-brand);
}

.key-spec-card__icon svg {
  width: 20px;
  height: 20px;
}

.key-spec-card__value {
  font-family: var(--ff-headings);
  font-size: var(--fs-lg);
  font-weight: 700;
  line-height: 1.1;
  color: var(--c-brand);
}

.key-spec-card__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-muted);
}

/* ---------- Detail Spec Table ---------- */
.detail-specs {
  margin-bottom: var(--space-8);
}

.detail-specs__title {
  font-family: var(--ff-headings);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: var(--space-6);
}

.detail-spec-table {
  width: 100%;
  border-collapse: collapse;
}

.detail-spec-table tr {
  border-bottom: 1px solid var(--c-border);
}

.detail-spec-table tr:last-child {
  border-bottom: none;
}

.detail-spec-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
  background: var(--c-band);
  border-radius: var(--r-input);
  white-space: nowrap;
}

.detail-spec-table td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--c-muted-strong);
}

/* ---------- Detail Swatches ---------- */
.detail-colors {
  margin-bottom: var(--space-8);
}

.detail-colors__title {
  font-family: var(--ff-headings);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: var(--space-5);
}

.detail-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.detail-swatch {
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  border: 2px solid var(--c-border);
  cursor: pointer;
  transition: border-color 0.15s ease,
              transform 0.15s ease;
}

.detail-swatch:hover {
  border-color: var(--c-cta);
  transform: scale(1.1);
}

.detail-swatch--ral {
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--c-muted-strong);
  background: var(--c-band);
  border-style: dashed;
}

/* ---------- Detail Thickness ---------- */
.detail-thickness {
  margin-bottom: var(--space-8);
}

.detail-thickness__title {
  font-family: var(--ff-headings);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: var(--space-5);
}

.detail-thick-meter {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.detail-thick-meter__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.detail-thick-meter__bar {
  width: 32px;
  height: var(--h, 28px);
  background: var(--c-brand);
  border-radius: 6px 6px 0 0;
  opacity: 0.8;
  transition: opacity 0.15s ease;
}

.detail-thick-meter__col:hover .detail-thick-meter__bar {
  opacity: 1;
}

.detail-thick-meter__dim {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-muted-strong);
}

.detail-thick-meter__dim::after {
  content: " mm";
  font-weight: 400;
}

/* ============================================================
   Responsive � Products
   ============================================================ */
@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

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

  .detail-header__title {
    font-size: var(--fs-3xl);
  }
}

@media (max-width: 767px) {
  .product-card__body {
    padding: 20px;
  }

  .product-card__title {
    font-size: var(--fs-sm);
  }

  .detail-hero__img {
    border-radius: var(--r-input);
  }

  .detail-header__title {
    font-size: var(--fs-xl);
  }

  .detail-spec-table th,
  .detail-spec-table td {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: 0;
  }

  .detail-spec-table th {
    padding-bottom: 0;
    background: transparent;
    border-radius: 0;
  }

  .detail-spec-table tr {
    border: 1px solid var(--c-border);
    border-radius: var(--r-card);
    padding: 8px 0;
    margin-bottom: 12px;
    background: var(--c-surface-card);
  }
}
