:root {
  --cpc-navy: #143b63;
  --cpc-ink: #233040;
  --cpc-muted: #67727f;
  --cpc-gold: #d6863a;
  --cpc-border: #e7e2d9;
}

compact-product-card {
  display: block;
  width: 100%;
  container-type: inline-size;
}

.cpc {
  display: grid;
  grid-template-columns: minmax(250px, 30%) 1fr;
  min-height: 315px;
  overflow: hidden;
  color: var(--cpc-ink);
  background: #fff;
  border: 1px solid rgba(20, 59, 99, 0.1);
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(20, 35, 51, 0.13);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.cpc__media {
  position: relative;
  min-height: 315px;
  overflow: hidden;
  background: #eee9e2;
}

.cpc__image,
.cpc__image-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cpc__image-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  color: var(--cpc-muted);
  background: linear-gradient(145deg, #f3f1ed, #e7e5e1);
  text-align: center;
}

.cpc__image-placeholder span {
  font-size: 0.82rem;
}

.cpc__image-placeholder strong {
  color: var(--cpc-ink);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.cpc__media-action {
  position: absolute;
  right: 16px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  color: var(--cpc-navy);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 13px;
  box-shadow: 0 8px 24px rgba(27, 29, 31, 0.14);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.cpc__media-action--favorite { top: 16px; }
.cpc__media-action--reaction { bottom: 16px; }

.cpc svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.cpc__content {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 18px;
  padding: 30px 34px 26px;
}

.cpc__heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.cpc__badge,
.cpc__category {
  display: inline-flex;
  margin: 0 9px 8px 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cpc__badge {
  padding: 5px 9px;
  color: #a85a18;
  background: #fff3e5;
  border-radius: 999px;
}

.cpc__category { color: var(--cpc-muted); }

.cpc__title {
  margin: 0 0 8px;
  color: var(--cpc-navy);
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.cpc__creator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cpc-muted);
  font-size: 0.9rem;
  font-weight: 650;
}

a.cpc__creator:hover { color: var(--cpc-navy); }

.cpc__avatar {
  width: 30px;
  height: 30px;
  object-fit: cover;
  border-radius: 50%;
}

.cpc__avatar--initials {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--cpc-navy);
  font-size: 0.72rem;
  font-weight: 800;
}

.cpc__avatar--placeholder {
  display: grid;
  place-items: center;
  color: var(--cpc-muted);
  background: #edf0f2;
  font-weight: 700;
}

.cpc__field-placeholder,
.cpc__badge--placeholder {
  color: var(--cpc-muted);
}

.cpc__verified {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: #fff;
  background: var(--cpc-gold);
  border-radius: 50%;
}

.cpc__verified svg { width: 12px; height: 12px; stroke-width: 2.5; }

.cpc__colors {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-top: 8px;
}

.cpc__color {
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--swatch);
  border: 2px solid var(--swatch-border);
  border-radius: 50%;
  cursor: pointer;
}

.cpc__color.is-selected {
  outline: 2px solid var(--cpc-gold);
  outline-offset: 3px;
}

.cpc__purchase {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.cpc__price {
  color: var(--cpc-navy);
  font-size: clamp(1.7rem, 3.5vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.cpc__buy {
  display: inline-flex;
  min-width: 150px;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  padding: 0 28px;
  color: #fff;
  background: var(--cpc-navy);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(20, 59, 99, 0.2);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.cpc__buy:hover { transform: translateY(-2px); }
.cpc__buy:active { transform: translateY(0); }
.cpc__buy:disabled { cursor: not-allowed; opacity: 0.45; }

.cpc__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding-top: 14px;
  color: var(--cpc-muted);
  border-top: 1px solid var(--cpc-border);
  font-size: 0.86rem;
}

.cpc__dimensions,
.cpc__stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cpc__dimensions strong { color: var(--cpc-navy); }
.cpc__material { color: var(--cpc-ink); font-weight: 650; }
.cpc__stats { margin-left: auto; }
.cpc__stat { display: inline-flex; align-items: center; gap: 5px; }
.cpc__stat svg { width: 16px; height: 16px; }

.cpc button:focus-visible,
.cpc a:focus-visible {
  outline: 3px solid rgba(214, 134, 58, 0.7);
  outline-offset: 3px;
}

/* Variante expérimentale de navigation dense. La V1 reste le rendu par défaut. */
.cpc--dense {
  position: relative;
  grid-template-columns: min(48%, 170px) minmax(0, 1fr);
  min-height: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(20, 59, 99, 0.11);
  border-radius: 0;
  box-shadow: none;
}

.cpc-v2__media {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  aspect-ratio: var(--cpc-v2-image-ratio, 4 / 3);
  min-width: 0;
  overflow: hidden;
  background: #eee9e2;
  border-radius: 10px;
}

.cpc-v2__media .cpc__image,
.cpc-v2__media .cpc__image-placeholder {
  position: absolute;
  inset: 0;
}

.cpc-v2__favorite {
  right: 8px;
  bottom: 8px;
  width: 34px;
  height: 34px;
  color: var(--cpc-navy);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(20, 35, 51, 0.08);
}

.cpc-v2__favorite svg { width: 18px; height: 18px; }

.cpc-v2__content {
  position: absolute;
  inset: 0;
  display: flex;
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
  padding: 0 0 0 12px;
}

.cpc-v2__info-top,
.cpc-v2__info-bottom {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
}

.cpc-v2__info-top {
  min-height: 0;
  overflow: hidden;
}

.cpc-v2__info-bottom {
  flex: 0 0 auto;
  margin-top: auto;
}

.cpc-v2__topline {
  display: flex;
  min-height: 17px;
  max-width: 100%;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.cpc-v2__badge,
.cpc-v2__customizable {
  display: block;
  overflow: hidden;
  color: #8e5b28;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cpc-v2__customizable { color: var(--cpc-gold); }

.cpc-v2__title {
  display: -webkit-box;
  min-width: 0;
  max-width: 100%;
  flex: 0 0 auto;
  margin: 2px 0;
  overflow: hidden;
  color: var(--cpc-navy);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.018em;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.cpc-v2__creator {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: var(--cpc-muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.25;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cpc-v2__verified {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.cpc-v2__verified svg { width: 10px; height: 10px; }

.cpc-v2__price {
  color: var(--cpc-navy);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.cpc-v2__colors {
  display: flex;
  min-height: 24px;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.cpc-v2__color {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background: var(--swatch);
  border: 1px solid var(--swatch-border);
  border-radius: 50%;
}

.cpc-v2__color-more {
  color: var(--cpc-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}

/* État développé Shopping : le rendu compact V2 reste inchangé. */
.cpc--expanded {
  display: block;
  min-height: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(20, 59, 99, 0.12);
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(20, 35, 51, 0.09);
}

.cpc-expanded__media {
  position: relative;
  aspect-ratio: var(--cpc-v2-image-ratio, 4 / 3);
  overflow: hidden;
  background: #eee9e2;
}

.cpc-expanded__media .cpc__image,
.cpc-expanded__media .cpc__image-placeholder {
  position: absolute;
  inset: 0;
}

.cpc-expanded__favorite { right: 12px; bottom: 12px; }

.cpc-expanded__content {
  display: grid;
  gap: 14px;
  padding: 18px 17px 17px;
}

.cpc-expanded__toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cpc-expanded__topline {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.cpc-expanded__badge,
.cpc-expanded__customizable {
  overflow: hidden;
  color: #8e5b28;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.cpc-expanded__customizable { color: var(--cpc-gold); }

.cpc-expanded__collapse {
  flex: 0 0 auto;
  padding: 5px 0 5px 8px;
  color: var(--cpc-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.cpc-expanded__title {
  margin: 0;
  color: var(--cpc-navy);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.cpc-expanded__creator {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  color: var(--cpc-muted);
  font-size: 13px;
  font-weight: 450;
  text-decoration: none;
}

.cpc-expanded__verified { width: 16px; height: 16px; }
.cpc-expanded__verified svg { width: 10px; height: 10px; }

.cpc-expanded__price {
  color: var(--cpc-navy);
  font-size: 26px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.035em;
}

.cpc-expanded__section {
  display: grid;
  gap: 9px;
  padding-top: 13px;
  border-top: 1px solid var(--cpc-border);
}

.cpc-expanded__section h3 {
  margin: 0;
  color: var(--cpc-navy);
  font-size: 13px;
  font-weight: 650;
}

.cpc-expanded__colors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.cpc-expanded__color {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--cpc-muted);
  font-size: 11px;
}

.cpc-expanded__swatch {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background: var(--swatch);
  border: 1px solid var(--swatch-border);
  border-radius: 50%;
}

.cpc-expanded__specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 16px;
  margin: 0;
}

.cpc-expanded__specs div { min-width: 0; }
.cpc-expanded__specs dt {
  color: var(--cpc-muted);
  font-size: 10px;
  line-height: 1.2;
}
.cpc-expanded__specs dd {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--cpc-ink);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.cpc-expanded__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 2px;
}

.cpc-expanded__action {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
}

.cpc-expanded__action--buy {
  color: #fff;
  background: var(--cpc-navy);
}

.cpc-expanded__action--adapt {
  color: #fff;
  background: var(--cpc-gold);
}

@keyframes cpc-expanded-reveal {
  from { opacity: 0.72; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.cpc--expanded .cpc-expanded__content {
  animation: cpc-expanded-reveal 180ms ease-out;
}

@container (max-width: 350px) {
  .cpc--dense {
    grid-template-columns: 48% minmax(0, 1fr);
  }
  .cpc-v2__content { padding-left: 10px; }
  .cpc-v2__title { font-size: 15px; }
  .cpc-v2__price { font-size: 15px; }
  .cpc-v2__color { width: 17px; height: 17px; flex-basis: 17px; }
}

@container (max-width: 330px) {
  .cpc-expanded__content { gap: 12px; padding: 15px 14px; }
  .cpc-expanded__title { font-size: 22px; }
  .cpc-expanded__price { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .cpc--expanded .cpc-expanded__content { animation: none; }
}

@container (max-width: 720px) {
  .cpc:not(.cpc--dense) { grid-template-columns: 38% 1fr; min-height: 285px; }
  .cpc:not(.cpc--dense) .cpc__media { min-height: 285px; }
  .cpc:not(.cpc--dense) .cpc__content { gap: 14px; padding: 22px; }
  .cpc__heading { display: block; }
  .cpc__colors { padding-top: 14px; }
  .cpc__purchase { align-items: flex-end; }
  .cpc__buy { min-width: 118px; min-height: 46px; padding-inline: 20px; }
  .cpc__stats { width: 100%; margin-left: 0; }
}

@container (max-width: 540px) {
  .cpc:not(.cpc--dense) { grid-template-columns: 1fr; }
  .cpc:not(.cpc--dense) .cpc__media {
    height: var(--cpc-mobile-media-height, 270px);
    min-height: var(--cpc-mobile-media-height, 230px);
    max-height: var(--cpc-mobile-media-height, 270px);
  }
  .cpc__content {
    gap: var(--cpc-mobile-content-gap, 14px);
    padding: var(--cpc-mobile-content-padding-block, 22px) var(--cpc-mobile-content-padding-inline, 20px);
  }
  .cpc__badge,
  .cpc__category { margin-bottom: var(--cpc-mobile-label-margin, 8px); }
  .cpc__title {
    margin-bottom: var(--cpc-mobile-title-margin, 8px);
    font-size: var(--cpc-mobile-title-size, 1.45rem);
  }
  .cpc__creator { gap: var(--cpc-mobile-creator-gap, 8px); }
  .cpc__avatar {
    width: var(--cpc-mobile-avatar-size, 30px);
    height: var(--cpc-mobile-avatar-size, 30px);
  }
  .cpc__colors {
    gap: var(--cpc-mobile-colors-gap, 10px);
    padding-top: var(--cpc-mobile-colors-padding, 14px);
  }
  .cpc__color {
    width: var(--cpc-mobile-swatch-size, 28px);
    height: var(--cpc-mobile-swatch-size, 28px);
  }
  .cpc__purchase {
    align-items: center;
    gap: var(--cpc-mobile-purchase-gap, 24px);
  }
  .cpc__price { font-size: var(--cpc-mobile-price-size, 1.7rem); }
  .cpc__buy { min-height: var(--cpc-mobile-buy-height, 46px); }
  .cpc__meta {
    gap: var(--cpc-mobile-meta-row-gap, 8px) var(--cpc-mobile-meta-column-gap, 18px);
    padding-top: var(--cpc-mobile-meta-padding, 14px);
    font-size: var(--cpc-mobile-meta-size, 0.86rem);
  }
  .cpc__dimensions,
  .cpc__stats { gap: var(--cpc-mobile-dimensions-gap, 12px); }
  .cpc:not(.cpc--dense) .cpc__media-action {
    right: var(--cpc-mobile-action-inset, 16px);
    width: var(--cpc-mobile-action-size, 44px);
    height: var(--cpc-mobile-action-size, 44px);
  }
  .cpc:not(.cpc--dense) .cpc__media-action--favorite { top: var(--cpc-mobile-action-inset, 16px); }
  .cpc:not(.cpc--dense) .cpc__media-action--reaction { bottom: var(--cpc-mobile-action-inset, 16px); }
}

/* Composition développée bornée par la hauteur relative calculée par le laboratoire. */
.cpc--expanded {
  display: grid;
  height: var(--cpc-expanded-height, 460px);
  grid-template-rows: minmax(150px, 48%) minmax(0, 1fr);
  overflow: hidden;
}

.cpc-expanded__media {
  min-height: 0;
  aspect-ratio: auto;
  overflow: hidden;
  background: #f3f1ed;
}

.cpc-expanded__media > .cpc__image-placeholder {
  position: absolute;
  inset: 0;
}

.cpc-expanded__favorite {
  z-index: 3;
  top: 10px;
  right: 10px;
  bottom: auto;
}

.cpc-expanded__carousel {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  border-radius: 14px;
}

.cpc-expanded__carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 28px;
  cursor: grab;
  scroll-padding-inline: 28px;
  scroll-snap-type: x mandatory;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.cpc-expanded__carousel-track::-webkit-scrollbar { display: none; }
.cpc-expanded__carousel-track.is-dragging { cursor: grabbing; scroll-snap-type: none; }

.cpc-expanded__slide {
  position: relative;
  height: 100%;
  flex: 0 0 calc(100% - 56px);
  overflow: hidden;
  margin: 0;
  background: #f3f1ed;
  border-radius: 14px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.cpc-expanded__slide img {
  width: 100%;
  height: 100%;
  padding: 5px;
  object-fit: contain;
  border-radius: inherit;
  pointer-events: none;
  user-select: none;
}

.cpc-expanded__slide.has-image-error::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--cpc-muted);
  content: "Image produit";
  font-size: 12px;
}

.cpc-expanded__slide.has-image-error img { visibility: hidden; }

.cpc-expanded__carousel.is-single .cpc-expanded__carousel-track {
  overflow: hidden;
  padding: 6px;
  cursor: default;
  scroll-snap-type: none;
}

.cpc-expanded__carousel.is-single .cpc-expanded__slide {
  flex-basis: 100%;
}

.cpc-expanded__content {
  display: grid;
  min-height: 0;
  grid-template-rows: auto auto auto auto auto;
  align-content: start;
  gap: 4px;
  overflow: hidden;
  padding: 9px 12px 11px;
  animation: none;
}

.cpc-expanded__toolbar { min-height: 12px; gap: 8px; }
.cpc-expanded__topline { min-height: 12px; gap: 6px; overflow: hidden; }
.cpc-expanded__badge,
.cpc-expanded__customizable { font-size: 9px; white-space: nowrap; }
.cpc-expanded__collapse { padding: 2px 0 2px 8px; font-size: 11px; }

.cpc-expanded__identity {
  display: grid;
  min-height: 0;
  gap: 2px;
}

.cpc-expanded__title {
  margin: 0;
  overflow: hidden;
  font-size: 19px;
  line-height: 1.08;
}

.cpc-expanded__creator { font-size: 11px; line-height: 1.2; }
.cpc-expanded__verified { width: 14px; height: 14px; }

.cpc-expanded__commerce {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cpc-expanded__price { flex: 0 0 auto; font-size: 19px; }
.cpc-expanded__colors { min-width: 0; flex-wrap: nowrap; gap: 5px; overflow: hidden; }
.cpc-expanded__swatch { width: 16px; height: 16px; flex: 0 0 16px; }
.cpc-expanded__color-more { color: var(--cpc-muted); font-size: 10px; font-weight: 600; }

.cpc-expanded__details {
  min-height: 0;
  overflow: hidden;
  padding-top: 5px;
  border-top: 1px solid var(--cpc-border);
}

.cpc-expanded__visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cpc-expanded__specs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px 10px;
  margin: 0;
}

.cpc-expanded__specs dt { font-size: 9px; }
.cpc-expanded__specs dd {
  margin-top: 1px;
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
}

.cpc-expanded__actions { gap: 8px; margin-top: 8px; padding-top: 0; }
.cpc-expanded__action {
  min-height: 38px;
  padding-inline: 10px;
  border-radius: 9px;
  font-size: 13px;
}

@container (max-width: 330px) {
  .cpc-expanded__content { gap: 4px; padding: 8px 10px 9px; }
  .cpc-expanded__title { font-size: 18px; }
  .cpc-expanded__price { font-size: 18px; }
  .cpc-expanded__specs { gap-inline: 7px; }
}
