/* ==========================================================================
   PK Tech Services — Products page (Milestone 12)
   Page-scoped styles for pages/products.html only. No reusable component
   code is duplicated; classes are `.products-*` prefixed on the same
   BEM-lite model as home.css / about.css / services.css.

   Doc references: Phase 2 §3 PRODUCTS (layouts), Phase 3 §3 PRODUCTS (copy).
   ========================================================================== */

/* --------------------------------------------------------------------------
   Category header (Phase 2 §3.4.7) — consistent row for all six categories:
   "Category name (H2) | one-line description | CTA (right-aligned)". Stacks
   on mobile; title + description share a left block, CTA right on ≥1024px.
   -------------------------------------------------------------------------- */
.products-category__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-16);
  align-items: start;
}

@media (min-width: 768px) {
  .products-category__header {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
    align-items: center;
    gap: var(--space-24);
  }
}

.products-category__title {
  margin: 0;
  color: var(--color-primary);
}

.products-category__desc {
  margin: 0;
  color: var(--color-body);
}

@media (min-width: 768px) {
  .products-category__cta {
    justify-self: end;
  }
}

/* Long category CTA labels must wrap on the narrowest phones (320–374px)
   instead of pushing the header wider than the viewport (Phase R10). */
@media (max-width: 374px) {
  .products-category__cta .button {
    max-width: 100%;
    white-space: normal;
  }
}

/* --------------------------------------------------------------------------
   Intro anchor chips (Phase 2 §3.8): one row desktop, 3-per-row tablet,
   2-per-row mobile. Static pills use `.products-pill`; anchor chips add
   `.products-chip` (link + focus states).
   -------------------------------------------------------------------------- */
.products-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-8);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 768px) {
  .products-chips {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .products-chips {
    display: flex;
    flex-wrap: wrap;
  }
}

.products-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--space-32);
  padding: 0 var(--space-16);
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-heading);
  font-size: var(--text-small-current);
  font-weight: var(--weight-semibold);
  line-height: var(--lh-label);
  text-align: center;
}

@media (max-width: 1023px) {
  .products-pill {
    width: 100%;
  }
}

.products-chip {
  text-decoration: none;
}

.products-chip:hover,
.products-chip:focus-visible {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Protocol tag rail (Phase 2 §3.4.4) — inline pills beneath the diagram */
.products-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* R11 — additional LAN materials: label above the supporting list, and a
   small gap between the two tag rows so they read as separate lists. */
.products-materials-label {
  margin-block-start: var(--space-24);
}

.products-tag-row + .products-tag-row {
  margin-block-start: var(--space-8);
}

/* R11-expand — carousel viewport for the products-rail items (Handheld OTDR,
   fusion splicer). Mirrors the rail image styling (1:1 cover, radius-md,
   hairline border) so the carousel looks native; the generic carousel
   machinery (track/slide/nav/dots) lives in card.css and is shared. */
.products-rail__carousel-viewport {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  touch-action: pan-y;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

/* The rail's generic img rule adds a border/radius inside the viewport;
   neutralize those so the viewport carries the frame (keeps single line). */
.products-rail__carousel-viewport .card__carousel-slide img {
  height: 100%;
  border: 0;
  border-radius: 0;
  background: none;
}

/* --------------------------------------------------------------------------
   Diagram / photo frames (Phase 2 §3.6). Ratio on the img so the figure box
   can also carry a caption; media images supplied in later phases.
   -------------------------------------------------------------------------- */
.products-media {
  margin: 0;
}

.products-media--16-9 img,
.products-media--21-9 img,
.products-media--4-3 img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.products-media--16-9 img {
  aspect-ratio: 16 / 9;
}

.products-media--21-9 img {
  aspect-ratio: 21 / 9;
}

.products-media--4-3 img {
  aspect-ratio: 4 / 3;
}

.products-media__caption {
  margin: var(--space-8) 0 0;
  font-size: var(--text-small-current);
  line-height: var(--lh-small);
  color: var(--color-body);
}

/* Full-width diagram band (Phase 2 §3.4.2 / §3.4.4 / §3.4.6) — surface fill
   behind the wide 21:9 diagrams inside background sections. */
.products-diagram {
  background: var(--color-surface);
  border-block: 1px solid var(--color-border);
  padding-block: var(--space-24);
}

/* --------------------------------------------------------------------------
   Mono spec panel (Phase 2 §3.4.1) — "Parameter | Value" rows, horizontal
   rules only. Rows are `<div>`s inside a `<dl>`.
   -------------------------------------------------------------------------- */
.products-spec {
  margin: 0;
}

.products-spec__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-16);
  align-items: baseline;
  padding-block: var(--space-8);
  border-bottom: 1px solid var(--color-border);
}

.products-spec__row:last-child {
  border-bottom: 0;
}

.products-spec__label {
  color: var(--color-body);
  font-size: var(--text-body-current);
  line-height: var(--lh-body);
}

.products-spec__value {
  margin: 0;
  color: var(--color-heading);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-body-current);
  line-height: var(--lh-body);
  white-space: nowrap;
  text-align: right;
}

/* --------------------------------------------------------------------------
   Product rail / carousel (Phase 2 §3.4.1 / §3.4.3) — 1:1 tiles with a
   caption (+ optional mono spec line). Grid 4-across ≥1024, 2×2 tablet,
   horizontal scroll-snap swipe on mobile.
   -------------------------------------------------------------------------- */
.products-rail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-16);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 767px) {
  .products-rail {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--space-16);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: var(--space-8);
  }

  .products-rail__item {
    flex: 0 0 60%;
    scroll-snap-align: start;
  }
}

@media (min-width: 1024px) {
  .products-rail {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-24);
  }
}

.products-rail__item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.products-rail__caption {
  margin: var(--space-8) 0 0;
  font-size: var(--text-small-current);
  font-weight: var(--weight-semibold);
  line-height: var(--lh-small);
  color: var(--color-heading);
}

.products-rail__spec {
  margin: var(--space-4) 0 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-micro);
  line-height: var(--lh-small);
  color: var(--color-body);
}

/* --------------------------------------------------------------------------
   Fire device list (Phase 2 §3.4.5) — vertical icon + name + mono spec,
   "not cards". 1-col mobile → 2-col ≥768.
   -------------------------------------------------------------------------- */
.products-devices {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-8);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 768px) {
  .products-devices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-32);
  }
}

.products-devices__item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-16);
  align-items: start;
  padding-block: var(--space-16);
  border-bottom: 1px solid var(--color-border);
}

.products-devices__icon {
  width: 24px;
  height: 24px;
  color: var(--color-primary);
}

.products-devices__icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.products-devices__name {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-body-current);
  font-weight: var(--weight-semibold);
  line-height: var(--lh-body);
  color: var(--color-secondary);
}

.products-devices__spec {
  margin: var(--space-8) 0 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-micro);
  line-height: var(--lh-small);
  color: var(--color-body);
}

/* --------------------------------------------------------------------------
   Tables (Phase 2 §3.4.3 / §3.4.4 / §3.4.5 / §3.4.6) — Design System §9
   styling: no vertical rules, mono values, horizontal rules only. Wrapped in
   `.products-table-wrap` so matrices scroll horizontally on mobile.
   -------------------------------------------------------------------------- */
.products-table-wrap {
  overflow-x: auto;
}

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

.products-table th,
.products-table td {
  padding: var(--space-8) var(--space-16);
  text-align: left;
  font-size: var(--text-body-current);
  line-height: var(--lh-body);
  vertical-align: top;
}

.products-table th:first-child,
.products-table td:first-child {
  padding-inline-start: 0;
}

.products-table th:last-child,
.products-table td:last-child {
  padding-inline-end: 0;
}

.products-table thead th {
  border-bottom: 2px solid var(--color-border);
  font-size: var(--text-small-current);
  font-weight: var(--weight-semibold);
  line-height: var(--lh-small);
  color: var(--color-heading);
}

.products-table tbody td {
  border-bottom: 1px solid var(--color-border);
  color: var(--color-body);
}

.products-table tbody tr:last-child td {
  border-bottom: 0;
}

.products-table__mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.products-table__capability {
  color: var(--color-heading);
  font-weight: var(--weight-semibold);
}

/* --------------------------------------------------------------------------
   Visual Polish Pass 2 — intro section background texture (industrial
   Ethernet switches / network rack motif). Supplies the image for the shared
   `.section-bg` layer defined in pages.css.
   -------------------------------------------------------------------------- */
.page-intro--products {
  --section-bg-image: url("../images/backgrounds/bg-network-rack.webp");
}

/* --------------------------------------------------------------------------
   Brands We Work With (Phase R8.75) — compact secondary strip below the
   catalogue. Neutral heading (u-h3), no partnership claims. Logos sit in
   uniform white cells, wrap-centred, and scale with object-fit: contain.
   -------------------------------------------------------------------------- */
.brands-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-16);
  margin: 0;
  padding: 0;
  list-style: none;
}

.brands-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 150px;
  height: 84px;
  padding: var(--space-16);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.brands-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* R11-carousel — "Many More" card: same box as the logo cards, plain text
   only. No invented brand names or logos; it just signals further brands. */
.brands-item--more {
  flex-direction: column;
  gap: var(--space-4);
  text-align: center;
}

.brands-more-title {
  font-weight: var(--weight-semibold);
  color: var(--color-heading);
}

.brands-more-sub {
  font-size: var(--text-small-current);
  color: var(--color-body);
}
