/* 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;
}

/**
 * BlogList — section that wraps a heading column and a horizontal rail
 * of BlogCard items. Mirrors
 * `creditas-site/src/sections/LatestBlogPosts/styles.js`.
 *
 * Class naming: single-class, no BEM `__` separator; element rules nested
 * under `.blog-list`. The CTA is `.button` (not `.cta`) to avoid the global
 * `.cta` block from the Cta component.
 *
 * Token values inlined from @creditas-ui/themes standard:
 *
 *   colors.neutral.0     = #ffffff
 *   colors.neutral.100   = #292929
 *   colors.primary.40    = #8edb00
 *   colors.primary.60    = #4f9e00
 *   colors.primary.100   = #1c4200
 *
 *   radius.lg            = 8px
 *
 *   breakpoints.2xl      = 600px
 *   breakpoints.4xl      = 880px
 *
 *   typography.heading.xl regular → 40px / 52px / 0.5px / Maison Neue Extended / 400
 *
 *   Background color hardcoded in source: #e9e9e1
 */

.blog-list,
.blog-list *,
.blog-list *::before,
.blog-list *::after {
  box-sizing: border-box;
}

.blog-list {
  position: relative;
  background-color: #e9e9e1;
  padding-block: 32px;
  font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
  color: #292929;

  @media (min-width: 600px) {
    padding-block: 80px;
  }

  .inner {
    width: 90%;
    max-width: 1600px;
    margin: 0 auto;
  }

  /* ----- grid (heading column + rail) ------------------------------ */

  .grid {
    display: grid;
    gap: 3rem;

    @media (min-width: 880px) {
      grid-template-columns: 305px 1fr;
      align-items: start;
    }
  }

  /* ----- heading column -------------------------------------------- */

  .header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }

  .title {
    margin: 32px 0;
    font-family: 'Maison Neue Extended', 'Maisonneueextended Book',
      'Maisonneueextended', 'Helvetica Now Display', 'Helveticanowdisplay',
      sans-serif;
    font-weight: 400;
    font-size: 40px;
    line-height: 52px;
    letter-spacing: 0.5px;
  }

  .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 12px 20px;
    background: #8edb00;
    color: #1c4200;
    border-radius: 8px;
    border: 0;
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 24px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;

    &:hover {
      background: #4f9e00;
      color: #ffffff;
    }

    &:focus-visible {
      outline: 2px solid #8edb00;
      outline-offset: 2px;
    }
  }

  /* ----- horizontal scroller --------------------------------------- */

  .scroller {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 16px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;

    &::-webkit-scrollbar {
      display: none;
    }
  }

  /* Rail. The sibling-shrink effect cascades custom properties down to every
   * BlogCard (custom props cross the code-island / slot boundary, unlike
   * `:has()`); each card reads them and the hovered card resets them to 1. */
  .rail {
    display: flex;
    gap: 1rem;
    padding-right: 5rem;
    align-items: flex-start;
    flex: 0 0 auto;

    > * {
      flex: 0 0 auto;
    }

    /* Flatten Webflow's slot wrapper so each BlogCard code-island becomes a
     * direct flex child of the rail. Same trick CardReveal uses. */
    ::slotted(*) {
      display: contents;
    }

    @media (pointer: fine) {
      --blog-card-target-scale: 1;
      --blog-card-target-opacity: 1;

      &[data-hover-effect='shrink']:hover,
      &[data-hover-effect='shrink']:focus-within {
        --blog-card-target-scale: 0.95;
        --blog-card-target-opacity: 0.5;
      }
    }
  }
}

