/* Legacy-parity text rendering: the old Creditas site sets
 * -webkit-font-smoothing: antialiased globally. 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). */
:host,
div.blog-list-old {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Flatten Webflow's slot wrapper so each slotted BlogCard code-island
 * becomes a direct child of the legacy rail (.rail).
 * PROJECT RULE: this selector MUST be UNPREFIXED — the ancestor-prefixed
 * `.rail ::slotted(*)` form never matches in Webflow's shadow DOM. */
::slotted(*) {
  display: contents !important;
}

/* ------------------------------------------------------------------ *
 * Semantic port of creditas-site/src/sections/LatestBlogPosts.
 *
 * Class naming: single-class, no BEM `__` separator; element rules nested
 * under `.blog-list-old`. The section title stays `.title`; the post-card
 * title (inside the slotted BlogCardOld) is `.title-link`, so the parent's
 * `.blog-list-old .title` never reaches the cards.
 * ------------------------------------------------------------------ */

/* ── Section ── LatestBlogPosts `Section` styled.section */
.blog-list-old {
  background-color: #e9e9e1;
  padding-block: 2rem;

  /* media.up('2xl') => min-width 600px */
  @media (min-width: 600px) {
    padding-block: 5rem;
  }

  /* ── Container ── components/Container (max calc(1388px + 40px), centered) */
  .container {
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
    max-width: calc(1388px + 40px);
    padding-left: 16px;
    padding-right: 16px;
    width: 100%;

    /* media.up('xs') => min-width 320px */
    @media (min-width: 320px) {
      padding-left: 20px;
      padding-right: 20px;
    }
  }

  /* ── Grid ── LatestBlogPosts `Grid` styled.div */
  .grid {
    display: grid;
    gap: 3rem;

    /* media.up('4xl') => min-width 880px */
    @media (min-width: 880px) {
      grid-template-columns: 305px 1fr;
    }
  }

  /* ── Title ── Typography headingXlRegular, mt/mb 2rem. */
  .title {
    margin: 2rem 0;
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-weight: 400;
    font-size: 40px;
    line-height: 52px;
    letter-spacing: 0.5px;
    color: #292929;
  }

  /* ── HorizontalScroller ── components/HorizontalScroller `Container` */
  .scroller {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding: 50px;

    > * > * {
      scroll-snap-align: start;
    }

    @media (pointer: fine) {
      padding-bottom: 0.5rem;

      &::-webkit-scrollbar {
        width: 8px;
        height: 8px;
      }

      &::-webkit-scrollbar-track {
        margin-top: 2rem;
        background: rgba(255, 255, 255, 0.2);
      }

      &::-webkit-scrollbar-thumb {
        background-color: rgba(0, 0, 0, 0.05);
        border-radius: 10px;
        border: 2px solid transparent;
      }

      /* primary.40 = #8edb00 */
      &::-webkit-scrollbar-thumb:hover {
        background-color: #8edb00;
      }

      &::-webkit-scrollbar-corner {
        background: transparent;
      }
    }
  }

  /* ── ListPosts (rail) ── LatestBlogPosts `ListPosts` styled.ul */
  .rail {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
    padding-right: 5rem;
    align-items: flex-start;
    margin: 0;
    list-style: none;

    /* Sibling-shrink hover, driven by custom properties (the legacy `:has()`
     * rule can't cross the code-island / slot boundary between the rail and
     * each BlogCard; custom properties inherit through it). */
    @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;
      }
    }
  }

  /* ── CTA ── LatestBlogPosts `BlogCta` = ButtonCta (width: fit-content).
   * PLACEHOLDER: ButtonCta's full variant styling lives outside this section's
   * styles.js; kept as a semantic placeholder (only `width: fit-content` is
   * guaranteed from source). */
  .cta-old {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin-top: 8px;
    padding: 12px 20px;
    background: #8edb00;
    color: #292929;
    border: 0;
    border-radius: 8px;
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease,
      box-shadow 0.2s ease;

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

    &:focus {
      box-shadow: 0px 16px 12px -8px rgba(0, 0, 0, 0.16),
        0px 16px 8px -12px rgba(0, 0, 0, 0.12);
      outline: 0;
    }
  }
}

