/* 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 (Old) — individual card inside a CrossSell section.
 *
 * Class naming: single-class, no BEM `__` separator; element rules nested
 * under `.cross-sell-card-old`. The card's title/description/cta are prefixed
 * `card-*` so the parent section's `.cross-sell-old .title` etc. don't reach
 * them. The CTA keeps the source's split: the text link is `.card-cta` and the
 * (additive) button variant is the standalone `.card-cta--button`.
 *
 * Tokens inlined from @creditas-ui/themes standard:
 *   colors.neutral.0 #ffffff  .60 #52605a  .100 #292929
 *   colors.primary.40 #8edb00  .60 #4f9e00
 */

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

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

.cross-sell-card-old {
  display: flex;
  flex-direction: column;
  gap: var(--cross-sell-card-gap, 0);
  /* Old creditas-site: fixed 286px card that keeps its width inside the
     horizontal scroll row (flex-shrink:0 = no squeezing). */
  width: 286px;
  /* Shared card-sizing contract (--card-*). Defaults preserve the natural
     286px 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);
  flex-shrink: 0;
  min-width: 0;
  max-width: var(--card-max, none);
  background-color: #ffffff;
  /* Old creditas-site: 20px radius + layered soft shadow */
  border-radius: 20px;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.08), 0 2px 5px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
  color: #292929;
  transition: box-shadow 0.2s ease-in-out;

  &:hover {
    box-shadow: rgba(0, 0, 0, 0.08) 0px 12px 12px,
      rgba(0, 0, 0, 0.08) 0px 0px 8px;
  }

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

  &.icon {
    gap: 0;
  }

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

  .image-wrapper {
    /* Old creditas-site: 286x286 square cover image */
    width: 100%;
    height: 286px;
    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 (additive: mediaType = 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;
    /* Old creditas-site card Content padding: 24px */
    padding: 24px;
    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 {
    /* Old creditas-site: Helvetica Now Display 20/28 Bold, 0.5px tracking */
    margin: 0 0 8px;
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-weight: 700;
    font-size: 20px;
    line-height: 28px;
    letter-spacing: 0.5px;
    color: #292929;

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

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

  .card-description {
    /* Old creditas-site: 14/20 Neutral/Dark #52605a */
    margin: 0 0 16px;
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    color: #52605a;
    flex: 1;
  }

  /* ---------- CTA text link --------------------------------------- */

  .card-cta {
    /* Old creditas-site: plain green Helvetica Now Display 16, no arrow */
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 24px;
    color: #4f9e00;
    text-decoration: none;
    transition: color 0.2s ease;
    align-self: flex-start;

    &:focus-visible {
      outline: 2px solid #4f9e00;
      outline-offset: 2px;
      border-radius: 2px;
    }
  }

  .card-cta-arrow {
    /* Old creditas-site card CTA has no arrow */
    display: none;
  }

  /* ---------- CTA button (additive: ctaStyle = Button) ------------ */
  /* Full-width green button used by the dark product cards. Standalone class
     (the source button carries only this modifier, no shared cta base). */

  .card-cta--button {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    width: 100%;
    margin-top: auto;
    padding: 18px 20px;
    border-radius: 16px;
    background: #8edb00; /* primary.40 */
    color: #1f2d27; /* neutral.90 */
    font-weight: 500;
    font-size: 16px;
    line-height: 24px;
    letter-spacing: 0.3px;
    text-align: center;
    transition: background-color 0.2s ease, color 0.2s ease;

    &:hover {
      background: #4f9e00; /* primary.60 */
      color: #ffffff;
    }
  }
}

