/* ==========================================================================
   Category and product pages. Uses only the design tokens from site.css.
   ========================================================================== */

/* ---------- Breadcrumb and page head ---------- */
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; font-size: .875rem; color: var(--muted); }
.breadcrumb li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumb li + li::before { content: "/"; margin: 0 8px; color: var(--muted); }
.breadcrumb a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; min-height: var(--tap); }
.breadcrumb a:hover { color: var(--brand-blue); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--navy); font-weight: 500; }
.breadcrumb-product { padding-top: 8px; }
.breadcrumb-product li:last-child { display: none; } /* the product title follows right below */
@media (min-width: 720px) { .breadcrumb-product li:last-child { display: inline-flex; } }

.page-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 0 32px; }
.page-title { margin: 8px 0 8px; }
.page-count { margin: 0; color: var(--muted); font-weight: 500; }
.page-intro { margin: 12px 0 0; max-width: 68ch; color: var(--muted); font-size: 1.0625rem; }
@media (min-width: 960px) { .page-head { padding-bottom: 40px; } }

.catalog-section { padding: 32px 0 56px; }
@media (min-width: 960px) { .catalog-section { padding: 48px 0 80px; } }
.catalog-empty { color: var(--muted); padding: 24px 0; margin: 0; }

/* ---------- Product grid: 1 / 2 / 3 / 4 columns, cards never stretch ---------- */
.product-grid {
  --cols: 1; --gap: 16px;
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--gap);
}
.product-grid.is-sparse { justify-content: center; } /* few products: keep the row centred and balanced */
.card-cell { display: flex; flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); min-width: 0; }
@media (min-width: 560px) { .product-grid { --cols: 2; --gap: 20px; } }
@media (min-width: 1024px) { .product-grid { --cols: 3; --gap: 24px; } }
@media (min-width: 1440px) { .product-grid { --cols: 4; } }

/* ---------- Product card ---------- */
.product-card {
  position: relative; display: flex; flex-direction: column; width: 100%;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.product-card:hover { color: var(--text); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.product-card:focus-visible { outline: none; box-shadow: var(--focus-ring), var(--shadow-md); border-color: var(--brand-blue); }

.card-media {
  aspect-ratio: 4 / 3; background: var(--surface);
  display: flex; align-items: center; justify-content: center; padding: 12px;
  border-bottom: 1px solid var(--border);
}
.card-media picture { display: contents; }
.card-media img {
  width: 100%; height: 100%; object-fit: contain;
  mix-blend-mode: multiply; /* white photo backgrounds melt into the neutral surface */
  transition: transform 300ms ease;
}
.product-card:hover .card-media img { transform: scale(1.03); }
.card-noimage svg, .gallery-noimage svg { stroke: var(--muted); stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.card-body { display: flex; flex-direction: column; flex: 1; padding: 16px 20px 18px; }
.card-title {
  font-size: 1.0625rem; line-height: 1.35; margin: 0 0 6px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  min-height: calc(2 * 1.35em);
}
.card-text {
  margin: 0 0 14px; color: var(--muted); font-size: .9375rem; line-height: 1.5;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  min-height: calc(2 * 1.5em);
}
.card-more {
  margin-top: auto; display: inline-flex; align-items: center; gap: 6px;
  color: var(--brand-blue); font-weight: 500; font-size: .9375rem;
}
.card-more svg { stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--ease); }
.product-card:hover .card-more svg { transform: translateX(3px); }

/* ---------- Product page: gallery + info ---------- */
.product-top { padding: 8px 0 40px; }
.product-layout { display: grid; gap: 24px; }
@media (min-width: 960px) {
  .product-top { padding: 16px 0 64px; }
  .product-layout { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 56px; align-items: start; }
  .product-info { position: sticky; top: calc(var(--header-h) + 24px); padding-top: 8px; }
}

.gallery-main {
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 4 / 3; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: zoom-in; overflow: hidden;
}
.gallery-main picture { display: contents; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.gallery-main:focus-visible { outline: none; box-shadow: var(--focus-ring); border-color: var(--brand-blue); }
.gallery-noimage { cursor: default; }
.zoom-hint {
  position: absolute; right: 12px; bottom: 12px;
  display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap);
  background: var(--bg); border: 1px solid var(--border); border-radius: 50%; box-shadow: var(--shadow-sm);
  color: var(--navy); transition: transform var(--ease), color var(--ease);
}
.zoom-hint svg { stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.gallery-main:hover .zoom-hint { color: var(--brand-blue); transform: scale(1.06); }

.gallery-thumbs { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.gallery-thumb {
  display: flex; width: 88px; aspect-ratio: 4 / 3; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.gallery-thumb picture { display: contents; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.gallery-thumb:hover { border-color: var(--muted); }
.gallery-thumb[aria-current="true"] { border-color: var(--brand-blue); box-shadow: inset 0 0 0 1px var(--brand-blue); }
.gallery-thumb:focus-visible { outline: none; box-shadow: var(--focus-ring); }
@media (min-width: 960px) { .gallery-thumb { width: 104px; } }

.product-eyebrow {
  display: inline-flex; align-items: center; min-height: 32px;
  font-size: .8125rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brand-blue); text-decoration: none;
}
.product-eyebrow:hover { text-decoration: underline; }
.product-title { margin: 4px 0 12px; font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.25rem); line-height: 1.2; }
.product-sku { margin: 0 0 12px; color: var(--muted); font-size: .9375rem; }
.product-lead { color: var(--muted); font-size: 1.125rem; line-height: 1.6; margin: 0 0 24px; max-width: 52ch; }

.product-specs { margin-top: 8px; }
.product-specs .detail-title { font-size: 1.125rem; margin-bottom: 12px; }

/* ---------- Description ---------- */
.product-details { padding: 40px 0 56px; border-top: 1px solid var(--border); }
@media (min-width: 960px) { .product-details { padding: 64px 0 80px; } }
.detail-title { font-size: 1.375rem; margin-bottom: 16px; }
.product-description { max-width: 70ch; }
.product-description p { font-size: 1.0625rem; line-height: 1.7; }
.product-description p:last-child { margin-bottom: 0; }

/* ---------- Specifications table ---------- */
.spec-table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.spec-table tr { border-bottom: 1px solid var(--border); }
.spec-table tr:first-child { border-top: 1px solid var(--border); }
.spec-table th, .spec-table td { padding: 14px 0; vertical-align: top; text-align: left; line-height: 1.5; }
.spec-table th { width: 42%; padding-right: 20px; color: var(--muted); font-weight: 500; }
.spec-table td { color: var(--navy); }

/* ---------- Related products ---------- */
.related .section-head { flex-wrap: wrap; }
.related-all { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 500; }

/* ---------- Zoom viewer ---------- */
.lightbox {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: transparent; color: #fff;
}
.lightbox::backdrop { background: rgba(15, 23, 42, .92); }
.lightbox-inner { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 64px 16px; }
.lightbox-img {
  max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
  background: #fff; border-radius: var(--radius); padding: 16px;
}
.lightbox-btn {
  position: absolute; display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%;
  background: var(--bg); color: var(--navy); cursor: pointer; box-shadow: var(--shadow-md);
  transition: background-color var(--ease), color var(--ease);
}
.lightbox-btn svg { stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.lightbox-btn:hover { background: var(--brand-blue-tint); color: var(--brand-blue); }
.lightbox-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.lightbox-close { top: 12px; right: 12px; }
.lightbox-prev, .lightbox-next { bottom: 12px; }
.lightbox-prev { left: calc(50% - 64px); }
.lightbox-next { right: calc(50% - 64px); }
.lightbox-count { position: absolute; top: 24px; left: 0; right: 0; margin: 0; text-align: center; font-size: .9375rem; color: rgba(255, 255, 255, .85); pointer-events: none; }
@media (min-width: 960px) {
  .lightbox-inner { padding: 64px 96px; }
  .lightbox-prev, .lightbox-next { top: 50%; bottom: auto; transform: translateY(-50%); }
  .lightbox-prev { left: 24px; }
  .lightbox-next { right: 24px; }
  .lightbox-close { top: 20px; right: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .product-card:hover, .product-card:hover .card-media img, .gallery-main:hover .zoom-hint,
  .product-card:hover .card-more svg { transform: none; }
}
