:host {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/**
 * HowItWorks (Old) — process section with four layouts (sidebar-list,
 * cards-grid, icon-columns, numbered-timeline) + a background variant.
 *
 * Class naming: single-class, no BEM `__` separator. Base element rules are
 * nested under `.how-it-works-old`; the header title/description are nested under
 * `.info` so their selectors don't reach the slotted steps (which carry their
 * own `.title`/`.description`). The CTA is `.button` (not `.cta`) to avoid the
 * global `.cta` block from the Cta component. Layout-specific rules stay flat
 * top-level, scoped by the unique `.how-it-works-old.<layout>` modifier.
 *
 * Tokens inlined from @creditas-ui standard:
 *   colors.neutral.0=#ffffff neutral.10=#f1f3f2 neutral.90=#292929
 *   colors.primary.40=#8edb00
 *   heading.2xl 48/64/0.5 · heading.lg 32/40 · body.lg 18/26 · body.md 16/24
 *   breakpoints 2xl=600 3xl=768 5xl=1024
 */

:host,
.how-it-works-old {
  position: relative;
  display: block;
}

.how-it-works-old,
.how-it-works-old *,
.how-it-works-old *::before,
.how-it-works-old *::after {
  box-sizing: border-box;
}

.how-it-works-old {
  padding: 64px 0;
  font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
  color: #292929;

  @media (min-width: 1024px) {
    padding: 96px 0;
  }

  /* ---------- background variants ---------------------------------- */

  &.bg-white {
    background-color: #ffffff;
  }
  &.bg-gray {
    background-color: #f1f3f2;
  }
  &.bg-dark {
    background-color: #292929;
    color: #ffffff;
  }

  /* ---------- container -------------------------------------------- */

  .container {
    width: 100%;
    max-width: calc(1388px + 40px);
    margin: 0 auto;
    padding: 0 20px;
  }

  /* ---------- header (scoped to .info so it never reaches steps) ----
   * Legacy heading region was constrained to 495px (css-1n6lzzr). Centered
   * layouts override this below. */

  .info {
    max-width: 495px;

    /* creditas-site Title = <RichText variant="headingLgLight"> wrapping the
     * heading in <strong>, which RichText renders BOLD (700) — 32/40 at ALL
     * widths (no responsive jump). Shared by every layout variant. */
    .title {
      margin: 0 0 16px;
      font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
      font-weight: 700;
      font-size: 32px;
      line-height: 40px;
      letter-spacing: 0.5px;
    }

    .description {
      margin: 0;
      font-weight: 400;
      font-size: 18px;
      line-height: 26px;
      letter-spacing: 0.3px;
      opacity: 0.85;
    }
  }

  /* ---------- image (sidebar-list) -------------------------------- */

  .image {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    display: block;

    img {
      width: 100%;
      height: auto;
      display: block;
    }
  }

  /* ---------- steps ------------------------------------------------ */

  .steps {
    display: grid;
    gap: 24px;

    /* Flatten Webflow's slot wrapper so each child code-island becomes a
     * direct grid item of the steps container. */
    ::slotted(*) {
      display: contents;
    }

    /* Connector line for the numbered-timeline layout. 18px is the dot radius
     * (36px dot), so the line passes through the dot centres. */
    &.lined {
      /* Mobile: vertical line on the left */
      &::before {
        content: '';
        position: absolute;
        z-index: 0;
        background-color: #8edb00; /* primary.40 */
        left: 18px;
        top: 18px;
        bottom: 18px;
        width: 2px;
      }

      > * {
        position: relative;
        z-index: 1;
      }

      /* Desktop: horizontal line across the top, inset to first/last columns */
      @media (min-width: 768px) {
        &::before {
          left: calc(50% / var(--hiw-n, 1));
          right: calc(50% / var(--hiw-n, 1));
          top: 18px;
          bottom: auto;
          width: auto;
          height: 2px;
        }
      }
    }
  }

  /* ---------- CTA -------------------------------------------------- */

  .button {
    margin-top: 32px;
    display: inline-flex;
    align-items: center;
    gap: 32px;
    padding: 14px 24px;
    border-radius: 16px;
    background-color: #8edb00;
    color: #292929;
    font-weight: 500;
    font-size: 16px;
    line-height: 24px;
    letter-spacing: 0.3px;
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.2s ease;

    &:hover {
      opacity: 0.9;
      transform: translateY(-1px);
    }
  }
}

/* ====================================================================
 * Layout: Sidebar list — mobile stacked; desktop 2-col, image on the right.
 * ================================================================== */

.how-it-works-old.sidebar-list {
  .grid {
    display: grid;
    gap: 32px;

    @media (min-width: 1024px) {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      grid-template-areas:
        'info  image'
        'steps image'
        'cta   image';
      gap: 48px;
    }
  }

  @media (min-width: 1024px) {
    .info {
      grid-area: info;
    }
    .image {
      grid-area: image;
      align-self: start;
    }
    .steps {
      grid-area: steps;
    }
    .cta-wrap {
      grid-area: cta;
    }
  }
}

/* ====================================================================
 * Layout: Cards grid — centered intro + responsive card grid
 * ================================================================== */

.how-it-works-old.cards-grid {
  .info {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 32px;

    @media (min-width: 600px) {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    @media (min-width: 1024px) {
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 24px;
    }
  }
}

/* ====================================================================
 * Layout: Icon columns — centered intro + row of icon cards
 * ================================================================== */

.how-it-works-old.icon-columns {
  .info {
    max-width: 800px;
    margin: 0 auto 48px;
    text-align: center;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 24px;

    @media (min-width: 600px) {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    @media (min-width: 1024px) {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }
  }

  .cta-wrap {
    display: flex;
    justify-content: center;
    margin-top: 32px;
  }
}

/* ====================================================================
 * Layout: Numbered timeline — cards joined by a numbered connector line.
 * ================================================================== */

.how-it-works-old.numbered-timeline {
  .info {
    max-width: 800px;
    margin: 0 0 40px;
  }

  .steps {
    position: relative;
    grid-template-columns: 1fr;
    gap: 24px;

    @media (min-width: 768px) {
      grid-template-columns: none;
      grid-auto-flow: column;
      grid-auto-columns: minmax(0, 1fr);
      gap: 24px;
    }
  }

  .cta-wrap {
    margin-top: 40px;
  }
}

/* --- Legacy render (creditas-site) slot-row fix — PROJECT RULE ------ */
/* Steps form the numbered row/grid inside legacy .css-owjed5 <ul>; flatten the
   Webflow slot wrapper so the step islands become direct children. */
::slotted(*) {
  display: contents !important;
}

