/* Products feature: catalog directory, store-style cards, product pages and the showcase block. */

/* ---- Filter chips (directory) ---- */
.products-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
}

.product-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.product-chip:hover {
  border-color: var(--border-strong);
  color: var(--ink-1);
}

.product-chip.active {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent);
}

.product-chip-count {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink-3) 14%, transparent);
  color: inherit;
}

/* ---- Grid ---- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(var(--products-cols, 3), minmax(0, 1fr));
  gap: clamp(14px, 2vw, 22px);
}

/* ---- Card ---- */
.product-card[hidden] { display: none; }

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

@media (hover: hover) and (pointer: fine) {
  .product-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
    box-shadow: var(--shadow-md, var(--shadow-sm));
  }

  .product-card:hover .product-card-title { color: var(--accent); }
  .product-card:hover .product-card-media img:not(.product-card-media-icon) { transform: scale(1.03); }
}

.product-card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  color: inherit;
  text-decoration: none;
  border-radius: inherit;
}

/* Stretched click target: the pseudo-element covers the card's content and
   padding, not only the link's box, so the whole tile behaves like a post. */
.product-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  transition: background-color 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .product-card:hover .product-card-link::after {
    background: color-mix(in srgb, var(--accent) 4%, transparent);
  }
}

.product-card-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.product-card-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  overflow: hidden;
}

.product-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform 0.5s ease;
}

.product-card-media-fill {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 120% at 20% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    linear-gradient(140deg, color-mix(in srgb, var(--accent) 7%, var(--surface-2)), var(--surface-2));
}

.product-card-media-initial {
  position: absolute;
  font-family: var(--font-display);
  font-size: 5.5rem;
  font-weight: 700;
  line-height: 1;
  color: color-mix(in srgb, var(--accent) 16%, transparent);
  user-select: none;
}

.product-card-media-fill img {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: contain;
  box-shadow: var(--shadow-md, var(--shadow-sm));
}

.product-card-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 15px;
  min-width: 0;
}

/* Compact style (default): icon-first card without the media preview. */
.product-card--compact .product-card-main {
  gap: 7px;
  padding: 13px 15px 14px;
}

.product-card--compact .product-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
}

.product-card--compact .product-card-title { font-size: 0.97rem; }

.product-card--compact .product-card-tagline {
  font-size: 0.8rem;
  line-height: 1.45;
}

.product-card-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
}

.product-card-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  overflow: hidden;
}

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

.product-card-icon img[hidden],
.product-store-icon img[hidden],
.product-card-initial[hidden],
.product-store-initial[hidden] {
  display: none;
}

.product-card-initial {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

.product-card-heading {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.product-card-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--heading-color);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.product-card-title { transition: color 0.2s; }

.product-card-featured {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.product-card-tagline {
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.5;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.product-card-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-1);
}

.product-card-star { color: var(--accent); }

.product-card-rating-count {
  font-weight: 500;
  color: var(--ink-3);
}

.product-platform {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink-3) 10%, transparent);
  color: var(--ink-2);
  white-space: nowrap;
}

.product-card-price {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-1);
}

/* ---- Product page: store hero ---- */
.product-page {
  /* Sidebar metrics, shared by the body layout and the related strip so the
     strip can follow the description column exactly. */
  --product-aside-w: 300px;
  --product-aside-gap: clamp(24px, 4vw, 48px);
  padding-bottom: 12px;
}

.product-store {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 28px);
  padding: clamp(16px, 3vw, 28px) 0 clamp(18px, 3vw, 30px);
}

.product-store-icon {
  flex: 0 0 auto;
  width: clamp(78px, 13vw, 112px);
  height: clamp(78px, 13vw, 112px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 24%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.product-store-initial {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  font-weight: 700;
  color: var(--accent);
}

.product-store-body { flex: 1; min-width: 0; }

.product-store-body h1 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4.2vw, 2.5rem);
  line-height: 1.1;
  color: var(--heading-color);
}

.product-store-tagline {
  margin: 0;
  max-width: 640px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-2);
}

.product-store-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.product-store-price {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.product-store-buy {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.product-store-install {
  padding: 12px 30px;
  font-weight: 700;
  box-shadow: var(--shadow-md, var(--shadow-sm));
}

.product-store-install-arrow { font-weight: 400; }

.product-store-hint {
  font-size: 0.72rem;
  color: var(--ink-3);
}

/* ---- Product page: screenshot gallery ---- */
.product-gallery {
  position: relative;
  margin: 0 0 clamp(24px, 5vw, 40px);
}

.product-gallery-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 2px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  outline: none;
}

.product-gallery-track::-webkit-scrollbar { display: none; }

.product-gallery-track:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 12px;
}

.product-gallery-item {
  flex: 0 0 auto;
  margin: 0;
  height: clamp(250px, 38vh, 360px);
  aspect-ratio: var(--shot-ratio, 9 / 16);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  scroll-snap-align: start;
  box-shadow: var(--shadow-sm);
}

.product-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.product-gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink-1);
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  z-index: 2;
  transition: border-color 0.2s, color 0.2s;
}

@media (hover: hover) and (pointer: fine) {
  .product-gallery-nav:hover { border-color: var(--accent); color: var(--accent); }
}

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

/* ---- Product page: body + info sidebar ---- */
.product-body-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--product-aside-w);
  gap: var(--product-aside-gap);
  align-items: start;
}

.product-section { margin-bottom: clamp(28px, 5vw, 48px); }

.product-section-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  line-height: 1.2;
  color: var(--heading-color);
}

.product-aside {
  position: sticky;
  top: 90px;
}

.product-info-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

.product-info-title {
  margin: 0 0 13px;
  font-size: 0.95rem;
  color: var(--heading-color);
}

.product-info-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-info-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  font-size: 0.84rem;
}

.product-info-list dt { color: var(--ink-3); }

.product-info-list dd {
  margin: 0;
  color: var(--ink-1);
  font-weight: 600;
  text-align: right;
  min-width: 0;
}

.product-info-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.product-info-install { width: 100%; margin-top: 16px; }

/* ---- Product page: ratings and reviews ---- */
.product-reviews-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.product-reviews-score {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  color: var(--heading-color);
}

.product-reviews-count {
  font-size: 0.8rem;
  color: var(--ink-3);
}

.product-reviews-link {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.product-reviews-link:hover { text-decoration: underline; }

.product-stars {
  font-size: 0.95rem;
  letter-spacing: 1.5px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 100%), color-mix(in srgb, var(--ink-3) 26%, transparent) var(--fill, 100%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.product-stars-sm {
  font-size: 0.8rem;
  flex: none;
}

.product-review-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.product-review {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.product-review-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.product-review-avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.product-review-who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.product-review-who strong {
  font-size: 0.85rem;
  color: var(--ink-1);
}

.product-review-date {
  font-size: 0.72rem;
  color: var(--ink-3);
}

.product-review-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-2);
}

/* ---- Related strip / showcase block ---- */
.products-related {
  margin-top: clamp(36px, 7vw, 64px);
}

/* On the product page the strip belongs to the description column: with the
   info sidebar beside it, a full-width strip left the centred heading and
   the "view all" button floating over the wider page. */
@media (min-width: 961px) {
  .product-page .products-related {
    max-width: calc(100% - var(--product-aside-w) - var(--product-aside-gap));
  }
}

.products-related-more {
  margin-top: 20px;
  text-align: center;
}

.products-related-more .btn { text-decoration: none; }

.lp-products {
  padding: clamp(40px, 8vh, 72px) 0;
}

.lp-products.align-left .products-related-more { text-align: left; }
.lp-products.align-right .products-related-more { text-align: right; }

.lp-products .products-grid {
  margin-top: 6px;
}

.lp-products-text {
  max-width: 640px;
  margin: -6px auto 26px;
  text-align: center;
  color: var(--ink-2);
  line-height: 1.65;
}

/* List layout: one concise row per item, used by the directory, related strip
   and individual showcase blocks. */
.products-grid.products-layout-list {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.products-layout-list .product-card-link {
  flex-direction: row;
  align-items: stretch;
}

.products-layout-list .product-card-media {
  width: clamp(150px, 18vw, 210px);
  aspect-ratio: 16 / 10;
  flex: none;
}

.products-layout-list .product-card-main {
  flex-direction: row;
  align-items: center;
  gap: 18px;
  padding: 13px 18px;
}

.products-layout-list .product-card-head { flex: 1; }

.products-layout-list .product-card-meta {
  margin-left: auto;
  justify-content: flex-end;
}

.products-layout-list .product-card-price { margin-left: 0; }

/* ---- Empty filter state ---- */
.products-no-match {
  margin: 32px 0;
  text-align: center;
  color: var(--ink-3);
}

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .product-body-layout { grid-template-columns: minmax(0, 1fr); }
  .product-aside { position: static; }
  .product-info-card { max-width: 520px; }
}

@media (max-width: 900px) {
  .products-grid {
    grid-template-columns: repeat(min(var(--products-cols, 3), 2), minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .product-store {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px;
  }

  .product-store-icon {
    width: 72px;
    height: 72px;
  }

  .product-store-body { flex: 1 1 calc(100% - 86px); }

  .product-store-buy {
    width: 100%;
    align-items: stretch;
    gap: 5px;
  }

  .product-store-install { width: 100%; }

  .product-store-hint { text-align: center; }

  .product-gallery-nav { display: none; }

  .product-gallery-item {
    height: clamp(220px, 34vh, 290px);
    max-width: calc(100vw - 40px);
  }

  .product-reviews-link {
    margin-left: 0;
    flex-basis: 100%;
  }
}

@media (max-width: 620px) {
  .products-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .product-card-media { aspect-ratio: 16 / 9; }

  .products-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .products-filters::-webkit-scrollbar { display: none; }

  .product-chip { flex: 0 0 auto; }
}

@media (max-width: 700px) {
  .products-layout-list .product-card-main {
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    padding: 13px 15px;
  }

  .products-layout-list .product-card-meta {
    margin-left: 0;
    justify-content: flex-start;
  }

  .products-layout-list .product-card-media { width: 108px; }
}
