/* =========================================================
   Lookora — Products component styles
   File: /assets/css/products.css
   Purpose: global product cards and product sections
   ========================================================= */

/* ---------------------------------------------------------
   Product section foundation
   --------------------------------------------------------- */
.cd-products-section {
  width: min(100%, var(--container, 73.75rem));
  margin: clamp(2.75rem, 6vw, 5.25rem) auto 0;
}

.cd-products-section *,
.cd-products-section *::before,
.cd-products-section *::after {
  box-sizing: border-box;
}

.cd-products-section img {
  display: block;
  max-width: 100%;
}

.cd-products-section a {
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------
   Product section affiliate disclosure
   --------------------------------------------------------- */
.cd-products-section .cd-affiliate-disclosure {
  width: 100%;
  margin: 0 0 clamp(1.15rem, 2.8vw, 1.75rem);
  padding: 0.82rem 1rem;
  border: 1px solid rgba(63, 48, 40, 0.11);
  border-radius: 1.2rem;
  background:
    linear-gradient(135deg, rgba(255, 250, 243, 0.82), rgba(243, 234, 220, 0.5));
  color: var(--text-muted, #75685e);
  font-size: 0.84rem;
  line-height: 1.55;
  box-shadow: 0 0.45rem 1.4rem rgba(63, 48, 40, 0.035);
}

/* ---------------------------------------------------------
   Product grid
   3 columns = 3 rows of 3 with 9 products.
   --------------------------------------------------------- */
.cd-product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.78rem, 1.7vw, 1.08rem);
  align-items: stretch;
  width: 100%;
}

/* ---------------------------------------------------------
   Product card shell
   --------------------------------------------------------- */
.cd-product-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(63, 48, 40, 0.095);
  border-radius: 1.24rem;
  background:
    linear-gradient(180deg, rgba(255, 250, 243, 0.98), rgba(250, 244, 235, 0.94));
  box-shadow:
    0 0.5rem 1.35rem rgba(63, 48, 40, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.68);
  transform: translateZ(0);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.cd-product-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 84% 0%, rgba(168, 95, 69, 0.11), transparent 7rem),
    radial-gradient(circle at 0% 100%, rgba(141, 155, 129, 0.09), transparent 7rem);
  pointer-events: none;
}

.cd-product-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.44), transparent 36%),
    linear-gradient(180deg, transparent 62%, rgba(63, 48, 40, 0.028));
  pointer-events: none;
}

.cd-product-card:hover {
  transform: translateY(-0.18rem);
  border-color: rgba(168, 95, 69, 0.26);
  box-shadow:
    0 0.8rem 1.8rem rgba(63, 48, 40, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

/* ---------------------------------------------------------
   Product media
   --------------------------------------------------------- */
.cd-product-card__media {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  margin: 0.36rem 0.36rem 0;
  border-radius: 0.98rem;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 250, 243, 0.72), transparent 7rem),
    linear-gradient(135deg, #efe1d1, #dfccba);
}

.cd-product-card__media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border: 1px solid rgba(255, 250, 243, 0.42);
  border-radius: inherit;
  pointer-events: none;
}

.cd-product-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, transparent 50%, rgba(36, 31, 27, 0.16)),
    radial-gradient(circle at 16% 0%, rgba(255, 250, 243, 0.22), transparent 6rem);
  pointer-events: none;
}

.cd-product-card__media img,
.cd-product-card > img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transform: scale(1.01);
  transition:
    transform 420ms ease,
    filter 420ms ease;
}

.cd-product-card:hover .cd-product-card__media img,
.cd-product-card:hover > img {
  transform: scale(1.045);
  filter: saturate(1.04) contrast(1.02);
}

/* ---------------------------------------------------------
   Product ribbon
   Premium editorial capsule overlaid on image.
   --------------------------------------------------------- */
.cd-product-card__ribbon {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: calc(100% - 1.2rem);
  min-height: 1.35rem;
  padding: 0.32rem 0.52rem;
  overflow: hidden;
  border: 1px solid rgba(255, 250, 243, 0.34);
  border-radius: 999px;
  background: rgba(47, 38, 31, 0.82);
  color: #fffaf3;
  font-size: 0.5rem;
  font-weight: 950;
  letter-spacing: 0.058em;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  backdrop-filter: blur(0.45rem);
  box-shadow: 0 0.38rem 0.9rem rgba(36, 31, 27, 0.18);
  pointer-events: none;
}

/* ---------------------------------------------------------
   Product body
   Button alignment:
   - body fills the available height
   - CTA is pushed to bottom with margin-top:auto
   --------------------------------------------------------- */
.cd-product-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 0.62rem 0.68rem 0.72rem;
}

/* ---------------------------------------------------------
   Product meta / badges
   3 chips on the same row:
   - .cd-product-card__badge    = editorial label
   - .cd-product-card__merchant = seller / merchant
   - .cd-product-card__size     = rug size
   --------------------------------------------------------- */
.cd-product-card__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: 0 0 auto;
  gap: 0.22rem;
  margin-bottom: 0.46rem;
}

.cd-product-card__badge,
.cd-product-card__merchant,
.cd-product-card__size,
.cd-product-card__tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 1.08rem;
  padding: 0.2rem 0.28rem;
  overflow: hidden;
  border-radius: 999px;
  font-size: 0.48rem;
  font-weight: 900;
  letter-spacing: 0.052em;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.cd-product-card__badge {
  border: 1px solid rgba(168, 95, 69, 0.15);
  background:
    linear-gradient(135deg, rgba(168, 95, 69, 0.16), rgba(168, 95, 69, 0.055));
  color: var(--accent-dark, #3f3028);
}

.cd-product-card__merchant {
  border: 1px solid rgba(63, 48, 40, 0.095);
  background: rgba(255, 250, 243, 0.74);
  color: var(--text-muted, #75685e);
}

.cd-product-card__size,
.cd-product-card__tag {
  border: 1px solid rgba(141, 155, 129, 0.24);
  background:
    linear-gradient(135deg, rgba(141, 155, 129, 0.16), rgba(255, 250, 243, 0.46));
  color: var(--accent-dark, #3f3028);
}

/* ---------------------------------------------------------
   Product title
   --------------------------------------------------------- */
.cd-product-card__body h3,
.cd-product-card h3 {
  display: -webkit-box;
  flex: 0 0 auto;
  min-height: 2.08em;
  margin: 0;
  overflow: hidden;
  color: var(--text, #241f1b);
  font-family: var(--font-heading, Georgia, serif);
  font-size: clamp(0.98rem, 1.1vw, 1.12rem);
  line-height: 1.04;
  letter-spacing: -0.034em;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---------------------------------------------------------
   Product description
   --------------------------------------------------------- */
.cd-product-card__description {
  display: -webkit-box;
  flex: 0 0 auto;
  min-height: 2.32em;
  margin-top: 0.34rem;
  overflow: hidden;
  color: var(--text-muted, #75685e);
  font-size: 0.62rem;
  line-height: 1.16;
  letter-spacing: 0.004em;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cd-product-card__body p {
  font-size: 0.62rem;
  line-height: 1.16;
}

/* ---------------------------------------------------------
   Product bullets
   Short editorial facts, max 3 lines recommended.
   --------------------------------------------------------- */
.cd-product-card__bullets {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 0.16rem;
  margin-top: 0.5rem;
  color: var(--text, #241f1b);
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.34;
}

.cd-product-card__bullets .bullet {
  display: flex;
  align-items: baseline;
  gap: 0.32rem;
  min-width: 0;
}

.cd-product-card__bullets .bullet::before {
  content: "·";
  flex-shrink: 0;
  color: var(--accent, #a85f45);
  font-size: 1.1em;
  line-height: 1;
}

/* ---------------------------------------------------------
   Legacy highlights compatibility
   --------------------------------------------------------- */
.cd-product-card__highlights {
  display: grid;
  flex: 0 0 auto;
  gap: 0.18rem;
  margin: 0.46rem 0 0;
  padding: 0;
  color: var(--text, #241f1b);
  font-size: 0.58rem;
  line-height: 1.2;
  list-style: none;
}

.cd-product-card__highlights li {
  position: relative;
  min-width: 0;
  padding-left: 0.66rem;
  line-height: 1.2;
}

.cd-product-card__highlights li::before {
  content: "";
  position: absolute;
  top: 0.46em;
  left: 0;
  width: 0.24rem;
  height: 0.24rem;
  border-radius: 999px;
  background: rgba(168, 95, 69, 0.72);
}

.cd-product-card__highlights li:nth-child(n + 3) {
  display: none;
}

/* ---------------------------------------------------------
   Editorial note compatibility
   --------------------------------------------------------- */
.cd-product-card__note {
  display: -webkit-box;
  flex: 0 0 auto;
  margin-top: 0.46rem;
  padding: 0.4rem 0.44rem;
  overflow: hidden;
  border: 1px solid rgba(168, 95, 69, 0.105);
  border-radius: 0.74rem;
  background:
    linear-gradient(135deg, rgba(168, 95, 69, 0.075), rgba(255, 250, 243, 0.48));
  color: var(--text-muted, #75685e);
  font-size: 0.56rem;
  line-height: 1.22;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---------------------------------------------------------
   Price
   Hidden by default to avoid static price issues.
   --------------------------------------------------------- */
.cd-product-card__price {
  display: none;
}

.cd-product-card__price-note {
  display: none;
}

/* ---------------------------------------------------------
   Product button
   Visible + aligned at card bottom.
   --------------------------------------------------------- */
.cd-product-card__button {
  position: relative;
  z-index: 3;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.05rem;
  margin-top: auto;
  padding: 0.5rem 0.62rem;
  overflow: hidden;
  border-radius: 999px;
  background:
    linear-gradient(135deg, #2f261f, var(--accent-dark, #3f3028) 54%, #735044);
  color: #fffaf3;
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: -0.006em;
  line-height: 1.08;
  text-align: center;
  text-decoration: none;
  box-shadow:
    0 0.42rem 0.95rem rgba(63, 48, 40, 0.18),
    inset 0 1px 0 rgba(255, 250, 243, 0.17);
  visibility: visible;
  opacity: 1;
  transition:
    transform 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.cd-product-card__button::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent, rgba(255, 250, 243, 0.16), transparent);
  transform: translateX(-120%);
  transition: transform 420ms ease;
  pointer-events: none;
}

.cd-product-card__button::after {
  content: "→";
  margin-left: 0.34rem;
  font-size: 0.92em;
  line-height: 1;
  transform: translateY(-0.02rem);
}

.cd-product-card__button:hover {
  transform: translateY(-0.06rem);
  background:
    linear-gradient(135deg, var(--accent-hover, #8f4f38), var(--accent, #a85f45));
  box-shadow:
    0 0.58rem 1.18rem rgba(63, 48, 40, 0.24),
    inset 0 1px 0 rgba(255, 250, 243, 0.18);
}

.cd-product-card__button:hover::before {
  transform: translateX(120%);
}

/* ---------------------------------------------------------
   Legacy product compatibility
   --------------------------------------------------------- */
.product-grid,
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.78rem, 1.7vw, 1.08rem);
  align-items: stretch;
  width: 100%;
}

.product-card,
.products-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(63, 48, 40, 0.095);
  border-radius: 1.24rem;
  background:
    linear-gradient(180deg, rgba(255, 250, 243, 0.98), rgba(250, 244, 235, 0.94));
  box-shadow: 0 0.5rem 1.35rem rgba(63, 48, 40, 0.07);
}

.product-card img,
.products-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* ---------------------------------------------------------
   Responsive tablet
   --------------------------------------------------------- */
@media (max-width: 1040px) {
  .cd-product-grid,
  .product-grid,
  .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---------------------------------------------------------
   Responsive small tablet
   --------------------------------------------------------- */
@media (max-width: 920px) {
  .cd-product-grid,
  .product-grid,
  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------------------------------------------------------
   Responsive mobile
   --------------------------------------------------------- */
@media (max-width: 720px) {
  .cd-product-grid,
  .product-grid,
  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.72rem;
  }

  .cd-product-card {
    border-radius: 1.08rem;
  }

  .cd-product-card__media {
    margin: 0.32rem 0.32rem 0;
    border-radius: 0.84rem;
  }

  .cd-product-card__body {
    padding: 0.5rem 0.52rem 0.56rem;
  }

  .cd-product-card__meta {
    gap: 0.16rem;
    margin-bottom: 0.34rem;
  }

  .cd-product-card__badge,
  .cd-product-card__merchant,
  .cd-product-card__size,
  .cd-product-card__tag {
    min-height: 0.92rem;
    padding: 0.15rem 0.2rem;
    font-size: 0.34rem;
    letter-spacing: 0.044em;
  }

  .cd-product-card__body h3,
  .cd-product-card h3 {
    min-height: 2.08em;
    font-size: 0.86rem;
    line-height: 1.04;
    letter-spacing: -0.032em;
  }

  .cd-product-card__description {
    min-height: 2.34em;
    margin-top: 0.28rem;
    font-size: 0.52rem;
    line-height: 1.17;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .cd-product-card__bullets {
    gap: 0.12rem;
    margin-top: 0.38rem;
    font-size: 0.7rem;
    line-height: 1.28;
  }

  .cd-product-card__highlights,
  .cd-product-card__note,
  .cd-product-card__price,
  .cd-product-card__price-note {
    display: none;
  }

  .cd-product-card__button {
    display: inline-flex;
    min-height: 1.68rem;
    margin-top: auto;
    padding: 0.38rem 0.42rem;
    font-size: 0.56rem;
    visibility: visible;
    opacity: 1;
  }

  .cd-product-card__ribbon {
    top: 0.48rem;
    right: 0.48rem;
    max-width: calc(100% - 0.96rem);
    min-height: 1.18rem;
    padding: 0.26rem 0.42rem;
    font-size: 0.38rem;
    letter-spacing: 0.044em;
    box-shadow: 0 0.28rem 0.7rem rgba(36, 31, 27, 0.18);
    backdrop-filter: blur(0.4rem);
  }
}

/* ---------------------------------------------------------
   Small mobile
   --------------------------------------------------------- */
@media (max-width: 390px) {
  .cd-product-grid,
  .product-grid,
  .products-grid {
    grid-template-columns: 1fr;
  }

  .cd-product-card__media {
    aspect-ratio: 4 / 3;
  }

  .cd-product-card__meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cd-product-card__badge,
  .cd-product-card__merchant,
  .cd-product-card__size,
  .cd-product-card__tag {
    font-size: 0.48rem;
    letter-spacing: 0.056em;
  }

  .cd-product-card__ribbon {
    top: 0.54rem;
    right: 0.54rem;
    min-height: 1.28rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.44rem;
  }
}

/* ---------------------------------------------------------
   Reduced motion
   --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .cd-product-card,
  .cd-product-card__media img,
  .cd-product-card__button,
  .cd-product-card__button::before {
    transition: none;
  }

  .cd-product-card:hover,
  .cd-product-card__button:hover {
    transform: none;
  }

  .cd-product-card:hover .cd-product-card__media img {
    transform: none;
  }

  .cd-product-card__button:hover::before {
    transform: translateX(-120%);
  }
}
