/* Legacy-parity text rendering: the old Creditas site sets
 * -webkit-font-smoothing: antialiased globally, which renders type
 * lighter/thinner on macOS. Webflow Code Components live in isolated
 * shadow roots, so this must be declared per-component on :host to
 * inherit into the shadow tree (the property does not cross the
 * shadow boundary). Without it, Blink defaults to subpixel smoothing
 * and identical 400-weight text looks heavier than the old site. */
:host {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/**
 * CrossSellCard — individual card inside a CrossSell section.
 *
 * Class naming: single-class, no BEM `__` separator; element rules nested
 * under `.cross-sell-card`. The card's title/description/cta are prefixed
 * `card-*` so the parent section's `.cross-sell .title` / `.description` /
 * `.cta-link` selectors never reach these (both render in the same light DOM
 * in the playground); `card-cta` also avoids the global `.cta` block.
 *
 * Tokens inlined from @creditas-ui/themes standard:
 *   colors.neutral.0 #ffffff  .60 #52605a  .100 #292929
 *   colors.primary.40 #8edb00  .60 #4f9e00
 *   card: width ~240px, radius 16px, box-shadow 0 4px 12px rgba(0,0,0,0.08)
 *   image: height 209px, object-fit cover · body: padding 20px 16px
 */

:host,
.cross-sell-card {
  display: block;
}

.cross-sell-card,
.cross-sell-card *,
.cross-sell-card *::before,
.cross-sell-card *::after {
  box-sizing: border-box;
}

.cross-sell-card {
  display: flex;
  flex-direction: column;
  gap: var(--cross-sell-card-gap, 0);
  width: 240px;
  /* Shared card-sizing contract (--card-*). Defaults preserve the natural
     240px width (flex-basis:auto = "use my width"); a slot host can override
     --card-basis/-grow to reflow into a row. See components/README.md. */
  flex-basis: var(--card-basis, auto);
  flex-grow: var(--card-grow, 0);
  min-width: 0;
  max-width: var(--card-max, none);
  background-color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
  color: #292929;

  /* ---------- row variant (image beside body) --------------------- */

  &.row {
    flex-direction: row;
    width: min(100%, 520px);
  }

  /* ---------- icon variant (small top icon, no cover image) ------- */

  &.icon {
    gap: 0;
  }

  /* ---------- image ----------------------------------------------- */

  .image-wrapper {
    width: 100%;
    height: 209px;
    overflow: hidden;
    flex-shrink: 0;
  }

  &.row .image-wrapper {
    width: 42%;
    height: auto;
    min-height: 209px;
  }

  .image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* ---------- icon ------------------------------------------------ */

  .icon-wrapper {
    display: flex;
    padding: 24px 24px 0;
    flex-shrink: 0;
  }

  .icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
  }

  /* ---------- body ------------------------------------------------ */

  .body {
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    flex: 1;
  }

  &.row .body {
    min-width: 0;
  }

  &.icon .body {
    gap: 16px;
    padding: 16px 24px 24px;
  }

  /* In icon mode spacing is driven by the flex gap, so neutralize the
     default per-element margins to avoid double spacing. */
  &.icon .card-title,
  &.icon .card-description {
    margin: 0;
  }

  @media (max-width: 767px) {
    &.row {
      flex-direction: column;
      width: 240px;

      .image-wrapper {
        width: 100%;
        height: 209px;
        min-height: 0;
      }
    }
  }

  /* ---------- title ----------------------------------------------- */

  .card-title {
    margin: 0 0 8px;
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-weight: 500;
    font-size: 20px;
    line-height: 28px;
    color: #292929;

    /* Additive: green bold title used by the product cards (primary.80). */
    &.primary {
      font-weight: 700;
      color: #317500;
    }
  }

  /* ---------- description ----------------------------------------- */

  .card-description {
    margin: 0 0 16px;
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 24px;
    color: #52605a;
    flex: 1;
  }

  /* ---------- CTA -------------------------------------------------- */
  /* The CTA is now the shared <CardCtaButton>, which renders the real
     @creditas-ui primary button (styled by the DS theme inside its own
     ShadowEmotionProvider). The old hand-rolled `.card-cta` styles were
     removed so nothing competes with the design-system button. `.card-cta-slot`
     is CardCtaButton's positioning wrapper; keep the CTA pinned to the bottom
     of the card body and left-aligned. */
  .card-cta-slot {
    align-self: flex-start;
    margin-top: auto;
  }
}

