/**
 * Marketplace product ad cards (design ref: Figma marketplace promo)
 */

.marketplace-ad {
  --mp-accent: #6e4f95;
  --mp-accent-dark: #5a3f7a;
  --mp-border: #6e4f95;
  --mp-text: #2b1d4a;
  --mp-text-muted: #5c5570;
  position: relative;
  background: #ffffff;
  border: 2px solid var(--mp-border);
  border-radius: 20px;
  padding: 20px;
  overflow: hidden;
  isolation: isolate;
}

@media (min-width: 768px) {
  .marketplace-ad {
    padding: 28px 32px;
  }
}

/* ----------------------------------------------------------------------
 * Decorative leaves in top corners
 * ---------------------------------------------------------------------- */
.marketplace-ad__leaf {
  position: absolute;
  top: 0;
  pointer-events: none;
  opacity: 0.7;
  z-index: 0;
}

.marketplace-ad__leaf--left {
  left: 0;
  transform: translate(-10px, -8px) rotate(-15deg);
}

.marketplace-ad__leaf--right {
  right: 0;
  transform: translate(10px, -8px) rotate(15deg) scaleX(-1);
}

@media (max-width: 575.98px) {
  .marketplace-ad__leaf {
    width: 28px;
    height: 40px;
  }
}

/* ----------------------------------------------------------------------
 * Slides container
 * ---------------------------------------------------------------------- */
.marketplace-ad__slides {
  position: relative;
  z-index: 1;
}

.marketplace-ad__slide {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.marketplace-ad__slide.is-active {
  display: flex;
}

@media (min-width: 640px) {
  .marketplace-ad__slide {
    flex-direction: row;
    align-items: center;
    gap: 24px;
  }
}

/* ----------------------------------------------------------------------
 * Product image
 * ---------------------------------------------------------------------- */
.marketplace-ad__media {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  max-width: 240px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 640px) {
  .marketplace-ad__media {
    width: 220px;
    max-width: none;
    margin: 0;
  }
}

@media (min-width: 992px) {
  .marketplace-ad__media {
    width: 270px;
  }
}

.marketplace-ad__image-link {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: #f7f3fb;
}

.marketplace-ad__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.3s ease;
}

.marketplace-ad__image-link:hover .marketplace-ad__image {
  transform: scale(1.03);
}

/* ----------------------------------------------------------------------
 * Body / content
 * ---------------------------------------------------------------------- */
.marketplace-ad__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.marketplace-ad__title {
  margin: 0;
  font-family: var(--font-primary, 'Source Sans 3', sans-serif);
  font-size: 20px;
  font-weight: 500;
  line-height: 28px;
  color: var(--mp-accent);
}

.marketplace-ad__title a {
  color: inherit;
  text-decoration: none;
}

.marketplace-ad__title a:hover {
  color: var(--mp-accent-dark);
}

.marketplace-ad__description {
  margin: 0;
  font-family: var(--font-primary, 'Source Sans 3', sans-serif);
  font-size: 14px;
  line-height: 20px;
  color: var(--mp-text-muted);
}

@media (min-width: 768px) {
  .marketplace-ad__description {
    font-size: 15px;
    line-height: 22px;
  }
}

.marketplace-ad__price {
  margin: 0;
  font-family: var(--font-primary, 'Source Sans 3', sans-serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 28px;
  color: var(--mp-accent);
}

/* ----------------------------------------------------------------------
 * Footer: brand badge + CTA
 * ---------------------------------------------------------------------- */
.marketplace-ad__footer {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}

@media (min-width: 540px) {
  .marketplace-ad__footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }
}

.marketplace-ad__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--mp-text-muted);
  font-family: var(--font-primary, 'Source Sans 3', sans-serif);
  font-size: 13px;
  line-height: 16px;
  text-decoration: none;
}

.marketplace-ad__brand:hover .marketplace-ad__brand-word--marketplace {
  color: #257f7a;
}

.marketplace-ad__brand-logo {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.marketplace-ad__brand-text {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}

.marketplace-ad__brand-word--marketplace {
  color: #2e9d96;
  font-weight: 600;
}

.marketplace-ad__brand-word--by {
  color: #c97f42;
}

.marketplace-ad__brand-word--mamaspedia {
  color: #ae276a;
  font-weight: 700;
}

.marketplace-ad__brand-badge {
  display: inline-flex;
  width: 16px;
  height: 16px;
}

.marketplace-ad__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--mp-accent);
  color: #ffffff;
  font-family: var(--font-primary, 'Source Sans 3', sans-serif);
  font-size: 14px;
  font-weight: 600;
  line-height: 16px;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.marketplace-ad__cta:hover,
.marketplace-ad__cta:focus-visible {
  background: var(--mp-accent-dark);
  color: #ffffff;
}

.marketplace-ad__cta svg {
  transition: transform 0.2s ease;
}

.marketplace-ad__cta:hover svg {
  transform: translateX(2px);
}

/* ----------------------------------------------------------------------
 * Carousel arrows (only when multiple products)
 * ---------------------------------------------------------------------- */
.marketplace-ad__arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 34px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transform: translateY(-50%);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.marketplace-ad__arrow svg {
  display: block;
  transition: filter 0.2s ease;
}

.marketplace-ad__arrow:hover svg circle {
  fill: #e6def0;
}

.marketplace-ad__arrow:hover svg path {
  stroke: var(--mp-accent);
}

.marketplace-ad__arrow:focus-visible {
  outline: 2px solid var(--mp-accent);
  outline-offset: 2px;
}

/* Arrows live inside .marketplace-ad__media and stick to the image edges
   regardless of breakpoint or media width. */
.marketplace-ad__arrow--prev {
  left: -6px;
}

.marketplace-ad__arrow--next {
  right: -6px;
}

/* ----------------------------------------------------------------------
 * Sidebar variant (stacked, compact)
 * ---------------------------------------------------------------------- */
.marketplace-ad--sidebar {
	padding: 18px;
}

.marketplace-ad--sidebar .marketplace-ad__leaf {
	display: none;
}

/* ----------------------------------------------------------------------
 * Archive variant (category pages): footer stacks vertically with CTA on
 * top and brand label beneath it, right-aligned. Used on /category/* pages.
 * ---------------------------------------------------------------------- */
.marketplace-ad--archive .marketplace-ad__footer {
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
}

.marketplace-ad--archive .marketplace-ad__cta {
	padding: 12px 26px;
}

.marketplace-ad--sidebar .marketplace-ad__slide {
  flex-direction: column;
  gap: 12px;
}

.marketplace-ad--sidebar .marketplace-ad__media {
  width: 100%;
}

.marketplace-ad--sidebar .marketplace-ad__image-link {
  max-width: 100%;
  aspect-ratio: 4 / 3;
}

.marketplace-ad--sidebar .marketplace-ad__title {
  font-size: 18px;
  line-height: 24px;
}

.marketplace-ad--sidebar .marketplace-ad__description {
  font-size: 13px;
  line-height: 18px;
}

.marketplace-ad--sidebar .marketplace-ad__price {
  font-size: 18px;
  line-height: 24px;
}

.marketplace-ad--sidebar .marketplace-ad__footer {
  flex-direction: column-reverse;
  align-items: stretch;
  gap: 12px;
  margin-top: 4px;
}

.marketplace-ad--sidebar .marketplace-ad__cta {
  justify-content: center;
  padding: 12px 16px;
  font-size: 15px;
}

.marketplace-ad--sidebar .marketplace-ad__brand {
  justify-content: center;
  font-size: 12px;
}

.marketplace-ad--sidebar .marketplace-ad__arrow--next {
  left: auto;
  right: 8px;
}

/* ----------------------------------------------------------------------
 * Visibility helpers for placement variants
 * ---------------------------------------------------------------------- */
.marketplace-ad--below-article {
  margin: 24px 0;
}

@media (min-width: 992px) {
  .marketplace-ad--below-article {
    display: none;
  }
}

@media (max-width: 991.98px) {
  .marketplace-ad--sidebar-only {
    display: none;
  }
}

@media (min-width: 992px) {
  .marketplace-ad--sidebar-only {
    margin-bottom: 24px;
  }
}
