/*
 * DHV Experience 13.78.3 — Reader Commerce Product Media.
 * Scope: presentation of the existing Core-owned article Commerce block only.
 * No Commerce eligibility, relation, disclosure, tracking, CTA destination,
 * product selection, reaction, conversation or Story Continuity behavior changes.
 * 13.78.3 may add trusted Core-owned product media to already-public rows.
 */
:root {
  --dhvx-reader-commerce-bg: #f6f7f8;
  --dhvx-reader-commerce-edge: #e3e6e8;
  --dhvx-reader-commerce-ink: #202124;
  --dhvx-reader-commerce-muted: #6b7077;
  --dhvx-reader-commerce-accent: #d82831;
}

/* Let Commerce read as an editorial attachment to the story instead of a
 * generic system module. Core keeps full ownership of the markup and truth. */
.dhvx-reader__body > .dhv-commerce-article {
  width: min(var(--dhvx-reader-stage, 692px), calc(100vw - 48px));
  max-width: none;
  margin: 3.15em 0 3.3em 50%;
  padding: 22px 24px 18px;
  transform: translateX(-50%);
  border: 1px solid var(--dhvx-reader-commerce-edge);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.46), transparent 44%),
    var(--dhvx-reader-commerce-bg);
  box-shadow: 0 12px 32px rgba(82,65,45,.055);
  color: var(--dhvx-reader-commerce-ink);
  font-family: var(--dhvx-platform-ui-font, var(--dhv-sans));
  overflow-wrap: anywhere;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-article__head {
  display: grid;
  gap: 5px;
  margin: 0 0 15px;
  padding: 0 0 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--dhvx-reader-commerce-edge) 86%, transparent);
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-article__eyebrow {
  color: var(--dhvx-reader-commerce-muted);
  font-size: 10.75px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: .035em;
  text-transform: none;
  opacity: 1;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-article__title {
  color: var(--dhvx-reader-commerce-ink);
  font-size: 20.5px;
  font-weight: 800;
  line-height: 1.28;
  letter-spacing: -.018em;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-article__summary {
  max-width: 62ch;
  margin: 1px 0 0 !important;
  color: var(--dhvx-reader-commerce-muted);
  font-family: inherit;
  font-size: 12.5px !important;
  line-height: 1.52 !important;
  opacity: 1;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-article__products {
  display: grid;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 15px 0;
  border-top: 1px solid color-mix(in srgb, var(--dhvx-reader-commerce-edge) 78%, transparent);
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product:first-child {
  padding-top: 2px;
  border-top: 0;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product:last-child {
  padding-bottom: 5px;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__relation {
  width: max-content;
  max-width: 100%;
  color: var(--dhvx-reader-commerce-accent);
  font-size: 10.75px;
  font-weight: 700;
  line-height: 1.35;
  opacity: 1;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__relation::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 7px 1px 0;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
  opacity: .78;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__name {
  color: var(--dhvx-reader-commerce-ink);
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.38;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__description,
.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__brand {
  display: block;
  max-width: 54ch;
  margin-top: 0;
  color: var(--dhvx-reader-commerce-muted);
  font-size: 12.25px;
  line-height: 1.5;
  opacity: 1;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  max-width: 340px;
}

/* Commerce remains clearly actionable without becoming louder than the story. */
.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid color-mix(in srgb, var(--dhvx-reader-commerce-accent) 30%, var(--dhvx-reader-commerce-edge));
  border-radius: 10px;
  background: color-mix(in srgb, #fff 74%, var(--dhvx-reader-commerce-bg));
  color: var(--dhvx-reader-commerce-accent) !important;
  font-size: 12.75px;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none !important;
  box-shadow: none;
  transition: background-color var(--dhvx-motion-fast) var(--dhvx-ease-standard), border-color var(--dhvx-motion-fast) var(--dhvx-ease-standard), color var(--dhvx-motion-fast) var(--dhvx-ease-standard);
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__actions .dhv-commerce-product__cta:not(:first-child) {
  background: transparent;
  color: var(--dhvx-reader-commerce-ink) !important;
  border-color: var(--dhvx-reader-commerce-edge);
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__cta:hover,
.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__cta:focus-visible {
  transform: none;
  filter: none;
  border-color: color-mix(in srgb, var(--dhvx-reader-commerce-accent) 54%, var(--dhvx-reader-commerce-edge));
  background: #fff;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__cta:focus-visible {
  outline: 2px solid var(--dhvx-reader-commerce-accent);
  outline-offset: 3px;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-article__disclosure {
  margin: 12px 0 0 !important;
  padding: 12px 0 0;
  border-top: 1px solid color-mix(in srgb, var(--dhvx-reader-commerce-edge) 84%, transparent);
  color: var(--dhvx-reader-commerce-muted);
  font-family: inherit;
  font-size: 10.75px !important;
  line-height: 1.55 !important;
  opacity: 1;
}

html[data-theme="dark"] {
  --dhvx-reader-commerce-bg: #2b2f34;
  --dhvx-reader-commerce-edge: #3a3f45;
  --dhvx-reader-commerce-ink: #f1f3f4;
  --dhvx-reader-commerce-muted: #a8adb3;
  --dhvx-reader-commerce-accent: #d82831;
}

html[data-theme="dark"] .dhvx-reader__body > .dhv-commerce-article {
  background:
    linear-gradient(135deg, rgba(255,255,255,.025), transparent 46%),
    var(--dhvx-reader-commerce-bg);
  box-shadow: none;
}

html[data-theme="dark"] .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__cta {
  background: #303134;
}

html[data-theme="dark"] .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__cta:hover,
html[data-theme="dark"] .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__cta:focus-visible {
  background: #34383d;
}

@media (max-width: 767px) {
  .dhvx-reader__body > .dhv-commerce-article {
    width: auto;
    max-width: 100%;
    margin: 2.35em 0 2.55em;
    padding: 18px 16px 15px;
    transform: none;
    border-radius: 14px;
    box-shadow: none;
  }

  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-article__head {
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-article__title {
    font-size: 18.5px;
  }

  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product {
    grid-template-columns: 1fr;
    gap: 11px;
    padding: 14px 0;
  }

  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product:first-child {
    padding-top: 1px;
  }

  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__name {
    font-size: 15px;
  }

  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__actions {
    justify-content: stretch;
    max-width: none;
  }

  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__cta {
    width: 100%;
    min-height: 44px;
    justify-content: space-between;
    padding-inline: 12px;
  }
}

@media (max-width: 359px) {
  .dhvx-reader__body > .dhv-commerce-article {
    padding-inline: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__cta {
    transition: none;
  }
}

@media (forced-colors: active) {
  .dhvx-reader__body > .dhv-commerce-article {
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
    box-shadow: none;
  }
  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__cta {
    border: 1px solid LinkText;
    background: Canvas;
    color: LinkText !important;
  }
  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__relation::before {
    background: CanvasText;
  }
}

/* 13.78.3 — trusted Product Library media. Rows without a Core-owned image keep
 * the 13.78.2 two-column contract unchanged. */
.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product.has-product-media {
  grid-template-columns: 84px minmax(0, 1fr) auto;
  column-gap: 16px;
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__media {
  width: 84px;
  aspect-ratio: 1;
  margin: 0;
  align-self: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--dhvx-reader-commerce-edge) 86%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, #fff 58%, var(--dhvx-reader-commerce-bg));
}

.dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__media img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  object-fit: cover;
  object-position: center;
}

html[data-theme="dark"] .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__media {
  background: #303134;
}

@media (max-width: 767px) {
  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product.has-product-media {
    grid-template-columns: 72px minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 11px;
    align-items: center;
  }

  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product.has-product-media .dhv-commerce-product__media {
    width: 72px;
    grid-column: 1;
    grid-row: 1;
  }

  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product.has-product-media .dhv-commerce-product__info {
    grid-column: 2;
    grid-row: 1;
  }

  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product.has-product-media .dhv-commerce-product__actions {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 359px) {
  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product.has-product-media {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product.has-product-media .dhv-commerce-product__media {
    width: 64px;
  }
}

@media (forced-colors: active) {
  .dhvx-reader__body > .dhv-commerce-article .dhv-commerce-product__media {
    border: 1px solid CanvasText;
    background: Canvas;
  }
}
