/* when wrapped in section-level tabs */

.tabs-container .tabs .tabs-panel .cards {
  padding-top: var(--space-l);
}

/* Fallback styling when color detection fails */
.cards-color-fallback {
  color: var(--text-color, inherit);
}

/* cards */

.block.cards {
ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(257px, 1fr));
  gap: var(--space-l);
}

ul > li {
  display: flex;
  flex-direction: column;
  border: none;
  background-color: var(--digicert-neutral-100);
  border-radius: var(--border-radius-xl);
  padding: 0;
  overflow: hidden;
}

.cards-card-image {
  margin-bottom: 0;
  line-height: 0;
}

.cards-card-body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: var(--space-m);
  padding: var(--space-l);
  color: var(--text-color, inherit);

  h1, h2, h3, h4, h5, h6, p {
    margin: 0;
  }
}

/* Use the CSS variable set by utils/color.js; fall back to current color */
.cards-card-body,
.cards-card-body p,
.cards-card-body h1,
.cards-card-body h2,
.cards-card-body h3,
.cards-card-body h4,
.cards-card-body h5,
.cards-card-body h6 {
  color: var(--text-color, inherit);
}

.cards-card-body p {
  font-size: var(--body-font-size-s);
  line-height: var(--line-height-normal);
  color: var(--text-color, var(--digicert-neutral-700));
}

.cards-card-body h1,
.cards-card-body h2,
.cards-card-body h3,
.cards-card-body h4,
.cards-card-body h5,
.cards-card-body h6 {
  font-size: var(--heading-font-size-s);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-color, var(--digicert-black));
}

ul > li img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0;
}

.cards-card-body .button-container {
  margin-top: auto;
  padding-top: var(--space-xl);
}

.cards-card-body .button-container a {
  margin-top: 0;
}

@media (width >= 900px) {
  ul {
    grid-template-columns: repeat(auto-fill, minmax(342px, 1fr));
    gap: var(--space-l);
  }
}

/* Cards per row variants - limit the number of cards per row */
&.two-cards-per-row ul {
  grid-template-columns: 1fr;

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

&.four-cards-per-row ul {
  grid-template-columns: 1fr;

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

  @media (width >= 1200px) {
    grid-template-columns: repeat(4, 1fr);
  }
}

&.five-cards-per-row ul {
  grid-template-columns: 1fr;

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

  @media (width >= 900px) {
    grid-template-columns: repeat(3, 1fr);
  }

  @media (width >= 1200px) {
    grid-template-columns: repeat(5, 1fr);
  }
}

&.icon-top-card {
  ul > li {
    align-items: flex-start;
    padding: var(--space-l);
    min-height: 144px;
  }

  .cards-card-image {
    margin-bottom: var(--space-xl);
    pointer-events: none;
  }

  .cards-card-image picture,
  .cards-card-image img {
    width: var(--icon-size-xl);
    height: var(--icon-size-xl);
    border-radius: 0;
    aspect-ratio: 1 / 1;
  }

  .cards-card-body,
  .flip-card-back-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: flex-end;
    gap: var(--space-s);
    padding: 0;
    text-align: left;

    h1, h2, h3, h4, h5, h6 {
      margin: 0;
      font-size: var(--heading-font-size-s);
      font-weight: var(--font-weight-bold);
      line-height: var(--line-height-normal);
      color: var(--text-color, var(--digicert-black));
    }

    p {
      font-size: var(--body-font-size-xs);
      line-height: var(--line-height-relaxed);
      color: var(--text-color, var(--digicert-neutral-800));
    }
  }
}



&.icon-left-card {
  ul > li {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--space-xl);
    padding: var(--space-l) var(--space-l) var(--space-m);
  }

  .cards-card-image {
    width: auto;
    flex: 0 0 auto;
    padding: 0;
    margin-bottom: 0;
    align-self: flex-start;
  }

  .cards-card-image picture,
  .cards-card-image img {
    width: var(--icon-size-xxl);
    height: var(--icon-size-xxl);
  }

  .cards-card-body {
    flex: 1 1 auto;
    align-self: stretch;
    text-align: left;
    padding: 0;
    gap: var(--space-m);

    h1, h2, h3, h4, h5, h6 {
      font-size: var(--heading-font-size-s);
      font-weight: var(--font-weight-bold);
      line-height: var(--line-height-tight);
      color: var(--text-color, var(--digicert-black));
    }

    p {
      font-size: var(--body-font-size-s);
      line-height: var(--line-height-relaxed);
      color: var(--text-color, var(--digicert-neutral-800));
    }

    .button-container {
      padding-top: 0;
    }
  }
}

&.minimal-card {
  /* Minimal visual variant: clean profile/bio cards */
  ul > li {
    border: none;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: var(--border-radius-l);
    overflow: hidden;
  }

  .cards-card-image {
    margin-bottom: 0;
  }

  .flip-card-front-body {
    padding: 0 var(--space-l);
  }


  .cards-card-image img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 0;
  }

  .cards-card-body {
    /* padding: var(--space-l); */
    gap: var(--space-xs);

    h1, h2, h3, h4, h5, h6 {
      font-size: var(--heading-font-size-s);
      font-weight: var(--font-weight-bold);
      line-height: var(--line-height-tight);
      color: var(--digicert-black);
    }

    p {
      font-size: var(--body-font-size-s);
      font-weight: var(--font-weight-normal);
      line-height: var(--line-height-normal);
      color: var(--digicert-neutral-700);
    }
  }
}

&.align-center {
  ul > li {
    text-align: center;
    align-items: center;
  }

  .cards-card-image,
  .cards-card-body,
  .flip-card-inner div:not(.pseudo-list) {
    align-items: center;
    justify-content: center;
  }

  .cards-card-body h1,
  .cards-card-body h2,
  .cards-card-body h3,
  .cards-card-body h4,
  .cards-card-body h5,
  .cards-card-body h6,
  .cards-card-body p {
    text-align: center;
  }
}

&.icon-small-card {
  .cards-card-image picture,
  .cards-card-image img {
    display: block;
    margin-inline: auto;
    width: var(--icon-size-s);
    height: var(--icon-size-s);
  }
}

&.icon-large-card {
  .cards-card-image {
    padding-bottom: var(--space-xs);
  }

  .cards-card-image picture,
  .cards-card-image img {
    display: block;
    margin-inline: auto;
    width: 72px;
    height: 72px;
  }
}

/* Avatar modifier: turn the card image box into a circular headshot, for speaker line-ups on
   event and webinar pages. Composes with a layout variant rather than replacing one — the same
   relationship icon-small-card / icon-large-card have to the icon layouts, so `Cards
   (icon-top-card, avatar)` is the authored form. Purely additive: every selector below is
   gated on `.avatar`, so no card that doesn't opt in can be reached by any of it.

   POSITION IS LOAD-BEARING. `&.avatar .cards-card-image img` and
   `&.icon-top-card .cards-card-image img` both compute to (0,4,1), so source order decides and
   this block must stay AFTER icon-top-card. Sitting here also puts it after minimal-card, whose
   image rules are at the same specificity — deliberate, so `minimal-card avatar` reads as the
   author intends. Verified against a real engine in test/browser/cards-avatar.browser.html. */
&.avatar {
  --avatar-size: 96px;      /* headshot box, square (tunable) */
  --avatar-radius: 50%;     /* set to 0 for a squared-off portrait */
  --avatar-focus: 50% 30%;  /* crop anchor — biased up so heads aren't cropped */

  .cards-card-image {
    /* icon-top-card's --space-xl is spacing tuned for a 48px icon, not a 96px portrait. */
    margin-bottom: var(--space-m);
  }

  .cards-card-image picture {
    display: block;
    width: var(--avatar-size);
    height: var(--avatar-size);
  }

  /* All five properties set explicitly, following logo-card rather than icon-left-card. The
     latter sets only width/height and leaves aspect-ratio: 16/9 and border-radius: 0 inherited
     from the base rule — that renders correctly today only because an explicit height happens to
     beat aspect-ratio, which is not a thing to copy. */
  .cards-card-image img {
    width: var(--avatar-size);
    height: var(--avatar-size);
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: var(--avatar-focus);
    border-radius: var(--avatar-radius);
  }

  /* icon-top-card packs the body to flex-end, which sinks the name to the bottom of the card and
     opens a gap under the headshot. The name belongs directly under the photo. */
  .cards-card-body {
    justify-content: flex-start;
  }
}

/* Logo variant: fit any provided logo (SVG or PNG, arbitrary aspect ratio) into a fixed
   bounding box WITHOUT cropping — the automated version of a designer manually fitting each
   logo into a known-ratio box. object-fit:contain scales the logo down until it fits both
   dimensions (wide logos bind on width, tall ones on height) and centers it; the box's own
   padding is the safe area. Mechanical contain covers ~80%; optical edge cases get a hand-made
   SVG authored to the box spec — see blocks/cards/README-logo-card.md. Contrast with the default
   card image rule (object-fit:cover), which is a photo-thumbnail frame that crops wide logos. */
&.logo-card {
  --logo-box-ratio: 3 / 1;         /* bounding-box aspect ratio (tunable) */
  --logo-box-pad: var(--space-m);  /* safe-area padding inside the box */
  --logo-box-bg: transparent;      /* set to a color for a plate behind logos */

  .cards-card-image picture {
    display: block;
    width: 100%;
  }

  .cards-card-image img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: var(--logo-box-ratio);
    object-fit: contain;           /* fit inside the box, never crop */
    object-position: center;
    padding: var(--logo-box-pad);
    background: var(--logo-box-bg);
    box-sizing: border-box;        /* padding stays inside the box — no overflow/clip */
    border-radius: 0;
  }
}

&.no-background-card {
  ul > li {
  background: none;
  border-radius: 0;
}
}

&.no-border-card {
  ul > li {
  border: none;
  padding: 0;
}
}

/* Hero variant: use the image as the full background of the card */
&.hero-card {
  ul {
    gap: var(--space-l);
  }

  ul > li {
    color: var(--text-color, var(--digicert-white));
    padding: var(--space-l);
    background-size: 30px 30px, 100% 100%;
    border: none;
    border-radius: var(--border-radius-l);
    position: relative;
    overflow: hidden;
  }

  .cards-card-image {
    display: none;
  }

  .cards-card-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
    padding: 0;
    text-align: left;

    h1, h2, h3, h4, h5, h6 {
      margin: 0;
      font-size: var(--heading-font-size-m);
      font-weight: var(--font-weight-bold);
      line-height: var(--line-height-tight);
      color: var(--text-color, var(--digicert-white));
    }

    p {
      font-size: var(--body-font-size-s);
      line-height: var(--line-height-normal);
      color: var(--text-color, var(--digicert-white));
    }
  }

  /* helper class applied from JS when using background-image */
  .cards-card-hero {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: var(--border-radius-l);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }

  /* No overlay when no modifier class is present.
     Overlay type is controlled by modifier classes on parent:
     none (default), gradient, or solid */
  .cards-card-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
  }

  /* ensure body content sits above the overlay */
  .cards-card-hero > .cards-card-body {
    position: relative;
    z-index: 1;
    padding: var(--space-l);
  }
}

/* Overlay modifier classes can be on the card or outer block */
.overlay-gradient-card .cards-card-hero::before,
.cards-card-hero.overlay-gradient-card::before {
  background-image: linear-gradient(
    to bottom,
    transparent 0%,
    color-mix(in srgb, var(--overlay-light) 60%, transparent 90%) 40%,
    color-mix(in srgb, var(--overlay-dark) 40%, transparent 10%) 100%
  );
}

.overlay-solid-card .cards-card-hero::before,
.cards-card-hero.overlay-solid-card::before {
  background-color: var(--overlay-solid, rgb(0 0 0 / 60%));
}

&.primary-bg-card {
  ul > li {
  border: 1px solid var(--border-color);
  background-color: var(--digicert-blue);
  background-image: linear-gradient(45deg, var(--digicert-blue) 5%, color-mix(in srgb, var(--digicert-blue), var(--digicert-white) 10%) 100%);
  background-repeat: no-repeat;
}
}

&.secondary-bg-card {
  ul > li {
  border: 1px solid var(--border-color);
  background-color: var(--digicert-dark-blue);
  background-image: linear-gradient(45deg, var(--digicert-dark-blue) 5%, color-mix(in srgb, var(--digicert-dark-blue), var(--digicert-white) 10%) 100%);
  background-repeat: no-repeat;
}
}

&.white-bg-card {
  ul > li {
  border: 1px solid var(--border-color);
  background-color: var(--digicert-white, #fff);
}
}

&.grouped-cards {
  ul {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  ul > li {
    border-radius: 0;
    position: relative;
  }

  ul > li:first-of-type {
    border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
  }

  ul > li:last-of-type {
    border-radius: 0 0 var(--border-radius-xl) var(--border-radius-xl);
  }

  /* Divider between cards */
  ul > li:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: var(--space-l);
    right: var(--space-l);
    height: 1px;
    background-color: var(--digicert-neutral-300, #c1cbd3);
  }

  @media (width >= 900px) {
    ul {
      flex-direction: row;
      align-items: stretch;
    }

    ul > li {
      flex: 1 1 0;
    }

    ul > li:first-of-type {
      border-radius: var(--border-radius-xl) 0 0 var(--border-radius-xl);
    }

    ul > li:last-of-type {
      border-radius: 0 var(--border-radius-xl) var(--border-radius-xl) 0;
    }

    /* Divider between cards */
    ul > li:not(:last-child)::after {
      inset: var(--space-xl) 0 var(--space-xl) auto;
      width: 1px;
      height: auto;
    }
  }
}

.flip-card {
  perspective: 1000px;
  position: relative;
}

.flip-card-body {
  padding: 0;
  background: transparent;
  width: 100%;
  flex-grow: 1;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.flip-card-front {
  position: relative;
  cursor: pointer;
}

.flip-card-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  padding: 0;
}

.flip-card-back-arrow {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: var(--space-s) 0 0 var(--space-s);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-size: var(--body-font-size-m);
  background: none;
  color: inherit;
  transition: color 0.2s ease;
}

.flip-card-back-arrow:hover {
  color: var(--digicert-black);
}

/* stylelint-disable-next-line no-descending-specificity */
.flip-card-back-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-s) var(--space-l) var(--space-l);
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
}

/* Visible scrollbar styling */
.flip-card-back-content::-webkit-scrollbar {
  width: 6px;
}

.flip-card-back-content::-webkit-scrollbar-track {
  background: var(--digicert-neutral-200);
  border-radius: 3px;
}

.flip-card-back-content::-webkit-scrollbar-thumb {
  background: var(--digicert-neutral-400);
  border-radius: 3px;
}

.flip-card-back-content::-webkit-scrollbar-thumb:hover {
  background: var(--digicert-neutral-500);
}

/* Pseudo-list: bullet points converted to paragraphs with • character */
.flip-card-back-content .pseudo-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  text-align: left;
}

.flip-card-back-content .pseudo-list p {
  margin: 0;
  line-height: var(--line-height-tight);
  text-align: left;
}

.flip-card-front-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: var(--space-s);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: var(--body-font-size-m);
  color: inherit;
    background: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.flip-card-front-arrow:hover {
  color: var(--digicert-black);
}

.flip-card-back > *:not(.flip-card-back-arrow) {
  opacity: 0;
  transition: opacity 0.3s ease 0.3s;
}

.flipped .flip-card-back > *:not(.flip-card-back-arrow) {
  opacity: 1;
}
}

/* Avatar modifier, flip-card half. Split from the `&.avatar` block above and placed here — after
   the flip rules it overrides — for the same reason .block.cards.icon-left-card.icon-large-card
   below sits outside the nest: a variant override that targets a later-declared base rule belongs
   after it. Keeping these inside the nest left three lower-specificity base selectors trailing
   higher-specificity ones, which is a real cascade smell, not just a lint complaint.

   Scoped through `.flip-card-body` rather than written as a bare `.block.cards.avatar` block
   because the nested `&.avatar` above desugars to exactly that selector, and two blocks with the
   same selector in one file is its own smell. Every target here is a descendant of
   .flip-card-body, so the extra hop costs nothing and makes the pairing explicit. */
.block.cards.avatar .flip-card-body {
  /* The front face is content-height by default — .flip-card-inner is a plain block container, so
     .cards-card-body's flex-grow has no free space and the justify-content above distributes
     nothing. In a grid row stretched by a taller sibling, the slack lands BELOW the front face
     rather than inside it, leaving the flip affordance stranded mid-card. */
  .flip-card-front {
    height: 100%;
  }

  /* Consequence of .cards-card-body's flex-start: without this the flip affordance rides up under
     the job title instead of sitting at the card's bottom edge. */
  .flip-card-front-arrow {
    margin-top: auto;
  }

  /* icon-top-card styles .flip-card-back-content alongside .cards-card-body, which hands the bio
     scroll container justify-content: flex-end. A flex column packed to flex-end puts its overflow
     on the START side, which is not scrollable — the top of any bio taller than the box would be
     clipped and unreachable. That is the exact case this variant exists for. */
  .flip-card-back-content {
    justify-content: flex-start;
  }
}

/* avatar + align-center. align-center's `.flip-card-inner div:not(.pseudo-list)` is (0,5,1) and
   centres the bio's scroll container, which beats the (0,5,0) flex-start above on specificity —
   source order cannot save it. A centre-packed flex column puts half its overflow on the START
   side, which is not scrollable, so the top of a long bio becomes unreachable. Same defect as the
   one the flex-start rule exists to prevent, arriving by a different route. (0,6,0) settles it.
   Still gated on .avatar; a plain icon-top-card + align-center flip card is untouched, and its
   pre-existing version of this is out of scope here. */
.block.cards.avatar.align-center .flip-card-body .flip-card-back-content {
  justify-content: flex-start;
}

/* special cases for icons */

.block.cards.icon-left-card.icon-large-card {
  .cards-card-body {
    padding: 0 var(--space-m);
  }

  @media (width >= 900px) {
    ul > li {
      gap: 0;
      padding-bottom: var(--space-l);
    }

  .cards-card-body {
    padding: var(--space-m) var(--space-m) 0;
  }
}

}

/* "Load more" footer for the initial-count pagination (Show first | N). It's a sibling AFTER
   the <ul>, so it sits outside the card grid. Mirrors the dynamic-cards footer, cards-scoped. */
.block.cards .cards-footer {
  display: flex;
  justify-content: center;
  padding-top: var(--space-l);
}

.block.cards .cards-footer .load-more {
  appearance: none;
  border: 1px solid var(--digicert-blue);
  background: var(--btn-primary-bg, var(--digicert-blue));
  color: var(--btn-primary-fg, var(--digicert-white));
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
}

/* Empty-state shown when a filter leaves no visible cards (see cards.js setEmpty). */
.block.cards .cards-empty {
  margin: 0;
  padding: var(--space-l) 0;
  color: var(--text-muted);
  text-align: center;
}

/* ============================================
   .cards.rail — per-card horizontal scroll-snap rail (authored "Cards (rail)").
   Overrides the grid with a Netflix-style rail: N items-per-view + a peek of the next card.
   Mirrors the carousel rail math; self-contained (imports nothing from carousel-iterated).
   ============================================ */
.block.cards.rail {
  /* Mobile base: one card fills the view fully — no peek hint of adjacent cards. */
  --cards-rail-items: 1;
  --cards-rail-peek: 0px;
  --cards-rail-gap: var(--space-l);
}

@media (width >= 600px) {
  .block.cards.rail {
    --cards-rail-items: 2;
    --cards-rail-peek: var(--space-5xl); /* 80px sliver of the next card */
  }
}

@media (width >= 900px) {
  .block.cards.rail {
    --cards-rail-items: 3;
  }

  /* A column-count variant on a rail sets how many cards show per view (desktop). */
  .block.cards.rail.two-cards-per-row {
    --cards-rail-items: 2;
  }

  .block.cards.rail.four-cards-per-row {
    --cards-rail-items: 4;
  }

  .block.cards.rail.five-cards-per-row {
    --cards-rail-items: 5;
  }
}

.block.cards.rail ul {
  display: flex;
  flex-wrap: nowrap;
  grid-template-columns: none;
  gap: var(--cards-rail-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  padding-bottom: var(--space-s);
}

/* Respect a reduced-motion preference: no smooth scroll-snap animation, and no delayed reveal of
   the back face.

   The flip ROTATION needs no rule here — the site-wide reset in styles/animations.css (loaded on
   every page via head.html) forces `transition-duration: 0.01ms !important` on everything, which is
   instant to a viewer.

   The back-face fade DOES need one, and this is the trap: that reset overrides `transition-duration`
   only. It never touches `transition-delay`. The fade is declared as `opacity 0.3s ease 0.3s`, with
   the delay tuned to land at the midpoint of a 0.6s rotation that no longer happens — so without the
   rule below, a reduced-motion viewer flips the card, focus moves to the back arrow, and the bio sits
   at opacity 0 for 300ms before appearing. Measured, not inferred: `delay=0.3s duration=1e-05s`.

   Only the delay is reset; the global handles the duration. Matches the specificity (0,4,0) of the
   base `.flip-card-back > *:not(.flip-card-back-arrow)` rule inside the `.block.cards` nest, and
   sits later in source, so it wins. (Named rather than cited by line — line numbers rot.) */
@media (prefers-reduced-motion: reduce) {
  .block.cards.rail ul {
    scroll-behavior: auto;
  }

  .block.cards .flip-card-back > *:not(.flip-card-back-arrow) {
    transition-delay: 0s;
  }
}

/* stylelint-disable-next-line no-descending-specificity -- rail li vs grouped-cards :first-of-type target different blocks */
.block.cards.rail ul > li {
  /* border-box so variants that pad the li (icon-top/left, hero) keep the card within its
     flex-basis width instead of overflowing the rail by the padding amount. */
  box-sizing: border-box;
  flex: 0 0 max(0px, calc((100% - var(--cards-rail-peek) - (var(--cards-rail-items) - 1) * var(--cards-rail-gap)) / var(--cards-rail-items)));
  scroll-snap-align: start;
}

.block.cards.rail .cards-rail-nav {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-s);
  margin-top: var(--space-m);
}

.block.cards.rail .cards-rail-prev,
.block.cards.rail .cards-rail-next {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-pill);
  background: var(--digicert-white, #fff);
  cursor: pointer;
}

.block.cards.rail .cards-rail-prev::after,
.block.cards.rail .cards-rail-next::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-color);
  border-bottom: 2px solid var(--text-color);
}

.block.cards.rail .cards-rail-prev::after {
  transform: translate(-30%, -50%) rotate(135deg);
}

.block.cards.rail .cards-rail-next::after {
  transform: translate(-70%, -50%) rotate(-45deg);
}

/* Visual end state only — the buttons stay clickable (no `disabled` attribute), so a stale
   measurement at decorate time can never permanently block the rail. */
.block.cards.rail .cards-rail-prev.is-disabled,
.block.cards.rail .cards-rail-next.is-disabled {
  opacity: 0.4;
}

/* grouped-cards is a vertical stack (opposite axis) — out of rail scope. When both classes are
   authored, neutralize the rail layout so it renders as a clean grouped stack (JS skips the nav). */
.block.cards.rail.grouped-cards ul {
  gap: 0;
  overflow-x: visible;
  padding-bottom: 0;
}

.block.cards.rail.grouped-cards ul > li {
  flex: initial;
}

/* ============================================
   .cards.horizontal — one row per card: a square image (or a logo tile) beside the text, rows
   separated by a divider. Built to look like the dynamic-cards horizontal rows; the values are
   copied from the dynamic-cards horizontal rows (blocks/dynamic-cards/dynamic-cards.css), with the
   row type sizes 18px heading and 16px text, and kept under the same token names with a cards-
   prefix. cards.js moves the line authored above the
   headline under it (.cards-card-eyebrow) and, with link-card, makes the row's one link cover the
   row. Authoring: blocks/cards/cards-horizontal-authoring.md.

   POSITION MATTERS. This section sits after every other rule in the file. Many of the rules it
   overrides have the same specificity — the per-row counts, white-bg-card, and the image rules of
   icon-small-card, icon-large-card, logo-card, avatar and minimal-card — so it wins by coming last.
   Nothing here applies without `horizontal`.
   ============================================ */
.block.cards.horizontal {
  --cards-row-pad-block: 12px;                /* the divider gap allows for it */
  --cards-row-pad-inline: var(--space-s);     /* 8px below 600px, 24px from 600px */
  --cards-row-radius: var(--border-radius-l); /* 16px below 600px, 24px from 600px */
  --cards-row-hover: var(--digicert-neutral-50);
  --cards-row-hover-dark: var(--digicert-black);
  --cards-divider-space: 20px;                /* content to divider, on each side */
  --cards-row-text-gap: calc(var(--space-xs) / 2); /* 2px; with the 4px margin, lines sit 6px apart */
  --cards-title-line: 1.2;
  --cards-body-line: 1.22;
  --cards-image-size: 96px;                   /* the square image box (Figma 2001:18464) */
  --cards-image-radius: 6px;
  --cards-logo-tile-pad: var(--space-s);      /* logo-card: the tile's inside padding */
  --cards-logo-tile-radius: 12px;
  --cards-label-tracking: 0.1px;              /* eyebrow and heading letter spacing (Figma) */
  --cards-text-tracking: 0.2px;               /* paragraph letter spacing (Figma) */
}

/* The smaller square, 48×48. Rows only. */
.block.cards.horizontal.icon-medium-card {
  --cards-image-size: 48px;
}

/* One column at every width, whatever the base grid or a per-row class would give. */
/* stylelint-disable-next-line no-descending-specificity -- rows vs the rail + grouped-cards ul; never combined */
.block.cards.horizontal ul {
  grid-template-columns: 1fr;
  gap: 0;
}

/* The row. overflow: visible, because the divider is drawn above the row's box (the base li clips).
   The background and border reset is also what makes white-bg-card do nothing on a row, and
   text-align is what makes align-center do nothing on it. */
/* stylelint-disable-next-line no-descending-specificity -- rows vs the grouped-cards and rail li rules; never combined */
.block.cards.horizontal ul > li {
  position: relative;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-l);
  margin: 0;
  padding: var(--cards-row-pad-block) var(--cards-row-pad-inline);
  overflow: visible;
  border: none;
  border-radius: var(--cards-row-radius);
  background: transparent;
  text-align: start;
}

/* Dividers: a 1px line in the gap above every row but the first. The line sits outside the row, so
   a row's hover background and focus outline leave it out. The gap is the divider space on each
   side, less the rows' own padding. */
/* stylelint-disable-next-line no-descending-specificity -- rows vs the grouped-cards li rules; never combined */
.block.cards.horizontal ul > li + li {
  margin-top: calc(2 * (var(--cards-divider-space) - var(--cards-row-pad-block)) + 1px);
}

/* stylelint-disable-next-line no-descending-specificity -- rows vs the grouped-cards divider; never combined */
.block.cards.horizontal ul > li + li::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: calc(var(--cards-row-pad-block) - var(--cards-divider-space) - 1px);
  border-top: 1px solid var(--digicert-neutral-200);
  pointer-events: none;
}

.block.cards.horizontal.image-left ul > li {
  flex-direction: row;
}

@media (width >= 600px) {
  .block.cards.horizontal {
    --cards-row-pad-inline: var(--space-l);
    --cards-row-radius: var(--border-radius-xl);
  }

  .block.cards.horizontal ul > li {
    flex-direction: row;
    align-items: center;
  }
}

/* Cards per row. The one-column rule above cancels every base count, so each is restated here.
   One per row is the design; two is supported from 900px, as dynamic-cards does; four and five
   render as asked and get a preview badge (cards.js). Rows in the first line have no divider and
   no top margin. */
@media (width >= 600px) {
  .block.cards.horizontal.four-cards-per-row ul,
  .block.cards.horizontal.five-cards-per-row ul {
    grid-template-columns: repeat(2, 1fr);
    column-gap: var(--space-2xl);
  }

  .block.cards.horizontal.four-cards-per-row ul > li:nth-child(-n+2),
  .block.cards.horizontal.five-cards-per-row ul > li:nth-child(-n+2) {
    margin-top: 0;
  }

  .block.cards.horizontal.four-cards-per-row ul > li:nth-child(-n+2)::after,
  .block.cards.horizontal.five-cards-per-row ul > li:nth-child(-n+2)::after {
    content: none;
  }
}

@media (width >= 900px) {
  .block.cards.horizontal.two-cards-per-row ul {
    grid-template-columns: repeat(2, 1fr);
    column-gap: var(--space-2xl);
  }

  .block.cards.horizontal.five-cards-per-row ul {
    grid-template-columns: repeat(3, 1fr);
  }

  .block.cards.horizontal.two-cards-per-row ul > li:nth-child(2),
  .block.cards.horizontal.five-cards-per-row ul > li:nth-child(-n+3) {
    margin-top: 0;
  }

  .block.cards.horizontal.two-cards-per-row ul > li:nth-child(2)::after,
  .block.cards.horizontal.five-cards-per-row ul > li:nth-child(-n+3)::after {
    content: none;
  }
}

@media (width >= 1200px) {
  .block.cards.horizontal.four-cards-per-row ul {
    grid-template-columns: repeat(4, 1fr);
  }

  .block.cards.horizontal.five-cards-per-row ul {
    grid-template-columns: repeat(5, 1fr);
  }

  .block.cards.horizontal.four-cards-per-row ul > li:nth-child(-n+4),
  .block.cards.horizontal.five-cards-per-row ul > li:nth-child(-n+5) {
    margin-top: 0;
  }

  .block.cards.horizontal.four-cards-per-row ul > li:nth-child(-n+4)::after,
  .block.cards.horizontal.five-cards-per-row ul > li:nth-child(-n+5)::after {
    content: none;
  }
}

/* The square image box. padding: 0 because icon-large-card pads the box; overflow: hidden for the
   corners, since the row no longer clips. */
.block.cards.horizontal .cards-card-image {
  flex: 0 0 auto;
  width: var(--cards-image-size);
  height: var(--cards-image-size);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--cards-image-radius);
  line-height: 0;
}

/* picture and img together, so the variant sizes on either (icon-small-card 20px, icon-large-card
   72px, logo-card's 3:1, avatar, minimal-card) give way. The image fills the square and is cropped
   if it is not square; cards.js marks that on preview. */
.block.cards.horizontal .cards-card-image picture,
.block.cards.horizontal .cards-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
}

/* logo-card in a row: the box is a white tile and the logo fits inside it, uncropped (Figma
   2001:18464). border-box keeps the padding and border inside the square. */
.block.cards.horizontal.logo-card .cards-card-image {
  box-sizing: border-box;
  padding: var(--cards-logo-tile-pad);
  border: 1px solid var(--digicert-neutral-200);
  border-radius: var(--cards-logo-tile-radius);
  background: var(--digicert-white);
}

.block.cards.horizontal.logo-card .cards-card-image img {
  padding: 0;
  object-fit: contain;
}

/* The text. Every line sits 6px below the one above: the 2px gap and a 4px margin. align-items
   undoes align-center's centring of the lines in the text cell. */
/* stylelint-disable-next-line no-descending-specificity -- rows vs the variant body rules; position decides */
.block.cards.horizontal .cards-card-body {
  flex: 1 1 0;
  align-items: stretch;
  min-width: 0;
  gap: var(--cards-row-text-gap);
  padding: 0;
}

/* stylelint-disable-next-line no-descending-specificity -- rows vs the flip-card back face; never combined */
.block.cards.horizontal .cards-card-body > * + * {
  margin-top: var(--space-xs);
}

/* The headline, at every heading level. The colour restates the base rule's form, so minimal-card's
   fixed black does not reach a row on a fill or a dark section; text-align undoes align-center. */
.block.cards.horizontal .cards-card-body h1,
.block.cards.horizontal .cards-card-body h2,
.block.cards.horizontal .cards-card-body h3,
.block.cards.horizontal .cards-card-body h4,
.block.cards.horizontal .cards-card-body h5,
.block.cards.horizontal .cards-card-body h6 {
  font-family: var(--body-font-family);
  font-size: var(--heading-font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: var(--cards-title-line);
  letter-spacing: var(--cards-label-tracking);
  text-align: start;
  color: var(--text-color, var(--digicert-black));
}

/* The eyebrow: the line authored above the headline, shown under it. Grey; a link inside it keeps
   the link colour. */
.block.cards.horizontal .cards-card-body .cards-card-eyebrow {
  font-size: var(--body-font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
  letter-spacing: var(--cards-label-tracking);
  text-transform: uppercase;
  text-align: start;
  color: var(--digicert-neutral-700);
}

/* A fixed grey: the base rule's var(--text-color, …) never reaches its fallback, because the colour
   utility always sets --text-color on the row. */
.block.cards.horizontal .cards-card-body > p:not([class]) {
  font-size: var(--body-font-size-s);
  line-height: var(--cards-body-line);
  letter-spacing: var(--cards-text-tracking);
  text-align: start;
  color: var(--digicert-neutral-700);
}

/* On a dark backdrop (a fill or a dark section) the colour utility marks the row
   .text-light-on-dark, and the grey lines take the light text colour. */
.block.cards.horizontal li.text-light-on-dark .cards-card-body > p:not([class]),
.block.cards.horizontal li.text-light-on-dark .cards-card-body .cards-card-eyebrow {
  color: var(--text-light-on-dark);
}

/* Without link-card, the link sits under the text at its own width. The base rule puts 32px above
   it and pushes it to the bottom of a grid card. */
.block.cards.horizontal .cards-card-body .button-container {
  align-self: flex-start;
  padding-top: 0;
  text-align: start;
}

/* link-card: the row's own authored link, moved by cards.js, covers the row. Its text is hidden;
   its aria-label is the headline and the link text. */
.block.cards.horizontal li.card-link {
  cursor: pointer;
}

.block.cards.horizontal a.card-link-anchor {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.block.cards.horizontal li.card-link:hover {
  background-color: var(--cards-row-hover);
}

.block.cards.horizontal li.card-link:focus-within {
  outline: 3px solid color-mix(in srgb, var(--digicert-blue) 60%, transparent 40%);
  outline-offset: 4px;
}

/* On a dark backdrop, a dark hover that keeps the light text readable. */
.block.cards.horizontal li.card-link.text-light-on-dark:hover {
  background-color: var(--cards-row-hover-dark);
}

/* On a light grey section (light, highlight, theme-light paint --light-color, about #f4f7f8) the
   grey hover would match the section, so the row lightens to white instead. */
main .section.light .block.cards.horizontal,
main .section.highlight .block.cards.horizontal,
main .section.theme-light .block.cards.horizontal {
  --cards-row-hover: var(--digicert-white);
}

/* Forced colours replace the hover background, so an outline is the hover cue there. A row with
   focus keeps the focus outline. */
@media (forced-colors: active) {
  .block.cards.horizontal li.card-link:hover:not(:focus-within) {
    outline: 2px solid;
  }
}

/* Fills on a row: each row is painted with the block's fill (the same values as the primary- and
   secondary-bg-card rules above) and keeps the row's padding and corners. No divider line between
   filled rows; the spacing stays. The text colour comes from the colour utility, so it shares
   PROTO-721: if cards.css arrives after the utility reads the row, the text stays dark. */
.block.cards.horizontal.primary-bg-card ul > li {
  border: 1px solid var(--border-color);
  background-color: var(--digicert-blue);
  background-image: linear-gradient(45deg, var(--digicert-blue) 5%, color-mix(in srgb, var(--digicert-blue), var(--digicert-white) 10%) 100%);
  background-repeat: no-repeat;
}

.block.cards.horizontal.secondary-bg-card ul > li {
  border: 1px solid var(--border-color);
  background-color: var(--digicert-dark-blue);
  background-image: linear-gradient(45deg, var(--digicert-dark-blue) 5%, color-mix(in srgb, var(--digicert-dark-blue), var(--digicert-white) 10%) 100%);
  background-repeat: no-repeat;
}

.block.cards.horizontal.primary-bg-card ul > li + li::after,
.block.cards.horizontal.secondary-bg-card ul > li + li::after {
  content: none;
}

/* A filled row keeps its fill on hover (the gradient covers any hover colour) and shows an outline
   in its text colour. Not while it has focus: the focus outline stays. */
.block.cards.horizontal.primary-bg-card ul > li.card-link:hover:not(:focus-within),
.block.cards.horizontal.secondary-bg-card ul > li.card-link:hover:not(:focus-within) {
  outline: 2px solid currentcolor;
}
