/*
 * Case study cards: the one shared card (site/snippets/cards/study.php) in
 * three variants, the lists that hold it, and the archive's header,
 * filters and empty state. Linked once per page by peanut_study_cards_css()
 * (the first list or card prints it), so pages without studies never load
 * it. Static styles in the "blocks" layer, movement in the "motion" layer
 * (both declared in tokens.css). Docs: docs/design/components.md, "Case
 * study cards".
 *
 * Lists (ul.study-list, one li per card; add `grid` so the shared scroll
 * reveal staggers the cards):
 *   .study-list--grid    standard cards: 1 column, 2 from 40rem, 3 from 64rem.
 *                        Fewer cards than columns keep a full row's width and
 *                        sit in the middle; a lone last card on a later row
 *                        takes the middle column.
 *   .study-list--uniform kept on the archive and hubs; every grid now shares
 *                        its rows, so cards in a row line up by part
 *   .study-list--pair    standard cards, at most 2 across (two related studies)
 *   .study-list--strip   compact rows: 1 column, 2 from 48rem
 *   .study-list--tiles   tiles (landing pages): 1 column, 2 from 40rem, 3 from
 *                        64rem; with --two at most 2 across; the full container
 *                        width (bulk fixes A3)
 *
 * Grids of standard cards share their rows through subgrid (image, label,
 * name, line, proof, link), so every card in a row has its proof line on the
 * same baseline, whatever the length of its line.
 *
 * Variants (article.study-card):
 *   --feature    wide: image beside the words from 64rem, stacked below
 *   --standard   image 4:5 on top, words below
 *   --compact    an 8rem thumbnail beside the client name
 *   --showcase   a landing page's lead study: the device mockup beside the
 *                facts from 64rem, above them on phones (section "Showcase")
 *   --tile       the secondary studies: a small desktop mockup, then the words
 * Images: --lifestyle (a mockup filling the frame), --device (the live site's
 * capture in a plain device frame), --logo (shown whole on cream).
 */

@layer blocks {
  /* ---------- Lists ---------- */

  .study-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .study-list > li {
    display: flex;
    min-width: 0;
  }

  .study-list--strip {
    gap: var(--space-2);
  }

  /* Columns of a fixed width (a full row's), auto-fit, centered: fewer cards
     than columns keep that width and sit in the middle, on every grid and
     whatever a filter leaves. The 0.01px keeps rounding from dropping a
     column on a full row. */
  @media (min-width: 40rem) {
    .study-list--grid,
    .study-list--pair {
      grid-template-columns: repeat(auto-fit, calc((100% - var(--space-4)) / 2 - 0.01px));
      justify-content: center;
      row-gap: var(--space-5);
    }
  }

  @media (min-width: 48rem) {
    .study-list--strip {
      grid-template-columns: repeat(auto-fit, calc((100% - var(--space-2)) / 2 - 0.01px));
      justify-content: center;
    }
  }

  @media (min-width: 64rem) {
    .study-list--grid {
      grid-template-columns: repeat(auto-fit, calc((100% - 2 * var(--space-4)) / 3 - 0.01px));
    }

    .study-list--grid > li:last-child:nth-child(3n + 4) {
      grid-column: 2;
    }
  }

  /* Swipe row (Results block): three columns from 640px; under it, on a touch
     screen, one row of cards 85 percent of the screen wide, the next one
     peeking in. A narrow window with a mouse stacks the cards instead (it has
     no way to swipe, and the row shows no scrollbar), and so does print:
     Chrome shrinks a whole printed page to fit a row wider than the page
     (the print layout check, site-rules.mjs rule 1) */
  @media (min-width: 40rem) and (max-width: 63.9375rem) {
    .study-list--swipe {
      grid-template-columns: repeat(auto-fit, calc((100% - 2 * var(--space-4)) / 3 - 0.01px));
    }
  }

  @media (max-width: 39.9375rem) and (pointer: coarse) {
    .study-list--swipe {
      grid-auto-flow: column;
      grid-auto-columns: 85vw;
      grid-template-columns: none;
      gap: var(--space-2);
      margin-inline: calc(-1 * var(--gutter));
      padding-inline: var(--gutter);
      overflow-x: auto;
      scroll-padding-inline: var(--gutter);
      scroll-snap-type: x mandatory;
      scrollbar-width: none;
    }

    .study-list--swipe > li {
      scroll-snap-align: start;
    }

    .study-list__count {
      margin: var(--space-2) 0 0;
      font-size: var(--step--1);
      font-variant-numeric: tabular-nums;
      text-align: center;
    }
  }

  @media (min-width: 40rem), (pointer: fine), (pointer: none) {
    .study-list__count {
      display: none;
    }
  }

  @media print {
    .study-list--swipe {
      grid-auto-flow: row;
      grid-auto-columns: auto;
      overflow: visible;
      margin-inline: 0;
      padding-inline: 0;
    }

    .study-list__count {
      display: none;
    }
  }

  /* Cards in a row share its tracks: image, label, name, line, proof, link */
  @supports (grid-template-rows: subgrid) {
    @media (min-width: 40rem) {
      :is(.study-list--grid, .study-list--pair) {
        row-gap: 0;
      }

      :is(.study-list--grid, .study-list--pair) > li {
        display: grid;
        grid-row: span 6;
        grid-template-rows: subgrid;
        margin-block-end: var(--space-5);
      }

      :is(.study-list--grid, .study-list--pair) > li:has(> .study-card--standard) > .study-card {
        display: grid;
        grid-row: 1 / -1;
        grid-template-rows: subgrid;
      }

      :is(.study-list--grid, .study-list--pair) .study-card--standard .study-card__body {
        display: grid;
        grid-row: 2 / -1;
        grid-template-rows: subgrid;
      }

      /* a label above each card (the block's "Label above each study"): one more row */
      .study-list--pair > li:has(> .study-list__label) {
        grid-row: span 7;
      }

      .study-list--pair > li:has(> .study-list__label) > .study-card {
        grid-row: 2 / -1;
      }
    }
  }

  /* the label above a card in a pair (casestudies block, pick source) */
  .study-list > li:has(> .study-list__label) {
    flex-direction: column;
    gap: var(--space-1);
  }

  .study-list__label {
    margin: 0;
  }

  /* ---------- The card ---------- */

  .study-card {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    width: 100%;
    color: var(--color-ink);
  }

  /* The image: 4:5 with the rounded 1px frame */
  .study-card__media {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border: var(--border);
    border-radius: var(--radius-sm);
    background: var(--color-paper);
  }

  .study-card__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* A capture in a plain device frame: no bar, no dots */
  .study-card--device .study-card__media {
    display: grid;
    place-items: center;
    padding: 8%;
  }

  .study-card__screen {
    width: 100%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border: var(--border);
    border-radius: var(--radius-sm);
    background: var(--color-white);
  }

  .study-card--logo .study-card__media {
    display: grid;
    place-items: center;
    padding: 14%;
    background: var(--color-paper);
  }

  /* multiply: a logo saved on white sits straight on the cream */
  .study-card--logo .study-card__image {
    height: auto;
    object-fit: contain;
    mix-blend-mode: multiply;
  }

  /* The hover capture sits over the image, hidden until it is shown */
  .study-card__hover {
    position: absolute;
    inset: 0;
    overflow: hidden;
    container-type: size;
    background: var(--color-white);
    opacity: 0;
    pointer-events: none;
    transition: opacity 600ms ease;
  }

  .study-card__pan {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
  }

  @media (hover: hover) and (pointer: fine) {
    .study-card:is(:hover, :has(.study-card__link:focus-visible)) .study-card__hover.is-ready {
      opacity: 1;
      transition: opacity 400ms ease;
    }
  }

  /* ---------- Words ---------- */

  .study-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    padding-block-start: var(--space-3);
  }

  .study-card__eyebrow {
    margin: 0 0 var(--space-1);
  }

  .study-card__label {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.18em;
    text-transform: uppercase;
  }

  .study-card__title {
    margin: var(--space-1) 0 0;
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: var(--weight-display);
    line-height: var(--leading-heading);
  }

  /* The name is the card's one link, stretched over all of it */
  .study-card__link {
    color: inherit;
    text-decoration: none;
  }

  .study-card__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: var(--radius-sm);
  }

  .study-card:has(.study-card__link:focus-visible) {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
  }

  .study-card__link:focus-visible {
    outline: none;
  }

  .study-card__text {
    max-width: var(--measure);
    margin: var(--space-1) 0 0;
    color: var(--color-muted);
    font-size: 0.9375rem;
    line-height: var(--leading-body);
  }

  .study-card__text > * {
    margin: 0;
  }

  .study-card__text > * + * {
    margin-block-start: var(--space-2);
  }

  /* Links inside a feature's text sit above the card link */
  .study-card__text a {
    position: relative;
    z-index: 2;
  }

  .study-card__proof {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: var(--space-2) 0 0;
  }

  .study-card__figure {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: var(--weight-display);
    line-height: 1.1;
  }

  .study-card__caption {
    font-size: 0.8125rem;
    line-height: 1.5;
  }

  /* A scope or quote proof is the caption alone */
  .study-card__proof:not(.study-card__proof--result) .study-card__caption {
    font-size: 0.9375rem;
  }

  .study-card__cta {
    justify-self: start;
    align-self: flex-start;
    margin-block-start: var(--space-2);
  }

  .study-card__arrow {
    display: inline-flex;
    align-items: center;
  }

  /* ---------- Feature ---------- */

  .study-card--feature .study-card__body {
    padding-block: var(--space-3) 0;
  }

  .study-card--feature .study-card__title {
    font-size: var(--step-4);
    line-height: var(--leading-tight);
  }

  /* A figure's source and period under its caption (the Search funnel pages, 2026-11-27, A8) */
  .study-card__source {
    display: block;
    margin-top: var(--space-1);
    font-size: 0.8125rem;
    font-weight: 400;
  }

  /* A pull quote in a feature card text (the Network page: the study's own line) */
  .study-card__text blockquote {
    margin: var(--space-3) 0;
    padding-inline-start: var(--space-3);
    border-inline-start: 1px solid var(--color-gold-soft);
  }

  .study-card__text blockquote > p:first-child {
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-weight: var(--weight-display);
    line-height: var(--leading-tight);
  }

  .study-card__text blockquote > p + p {
    margin-block-start: var(--space-1);
    font-size: 0.8125rem;
  }

  .study-card--feature .study-card__text {
    color: var(--color-ink);
    font-size: var(--step-0);
  }

  @media (min-width: 64rem) {
    .study-card--feature {
      display: grid;
      grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
      gap: var(--space-5);
      align-items: center;
    }

    .study-card--feature .study-card__body {
      padding-block: 0;
    }
  }

  /* ---------- Compact row ---------- */

  .study-card--compact {
    flex-direction: row;
    gap: var(--space-3);
    align-items: center;
  }

  .study-card--compact .study-card__media {
    flex: none;
    width: 8rem;
    aspect-ratio: 1;
  }

  .study-card--compact.study-card--device .study-card__media {
    padding: 0;
  }

  .study-card--compact .study-card__screen {
    aspect-ratio: 1;
    border: 0;
    border-radius: 0;
  }

  .study-card--compact .study-card__body {
    padding: 0;
  }

  .study-card--compact .study-card__title {
    margin-block-start: 0.25rem;
    font-size: var(--step-1);
  }

  .study-card--compact .study-card__cta {
    margin-block-start: 0.25rem;
  }

  /* The strip's proof line (the Case studies block): smaller, beside the thumbnail */
  .study-card--compact .study-card__proof {
    gap: 0;
    margin-block-start: 0.25rem;
  }

  .study-card--compact .study-card__figure {
    font-size: var(--step-2);
  }

  .study-card--compact .study-card__caption,
  .study-card--compact .study-card__proof:not(.study-card__proof--result) .study-card__caption {
    font-size: 0.8125rem;
  }

  /* ---------- Sections that hold cards ---------- */

  /* A feature followed by more cards (home, tier pages, the archive) */
  .study-feature + .study-more,
  .study-more + .study-more {
    margin-block-start: var(--space-6);
  }

  .study-more__title {
    margin: 0 0 var(--space-4);
    text-align: center;
  }

  .study-actions {
    margin-block-start: var(--space-5);
  }

  /* One compact card under a text column (the guide's related study) */
  .study-related {
    margin-block-start: var(--space-4);
  }

  /* ---------- Archive and hubs ---------- */

  /* The header: the hero gradient only behind the eyebrow and title (its
     band, site.css "Hero rule"), the intro and filters on cream below it
     (design review #71), a rule under it so the list below reads as the
     next part */
  .page-header--studies {
    background: var(--color-paper);
  }

  /* The client strip, slim so the cards start high: logos 40px tall, muted to
     ink at 60 percent, their own color on hover */
  .page-header--studies .logos__eyebrow {
    margin-block: var(--space-4) var(--space-2);
  }

  .page-header--studies .logos--row {
    margin-block-end: var(--space-3);
  }

  .page-header--studies .logos__list {
    gap: var(--space-2) var(--space-5);
  }

  .page-header--studies .logos--row .logos__logo {
    height: 2.5rem;
    filter: brightness(0);
    opacity: 0.6;
  }

  .page-header--studies .logos--row .logos__logo:hover {
    filter: none;
    opacity: 1;
  }

  @media (prefers-reduced-motion: no-preference) {
    .page-header--studies .logos--row .logos__logo {
      transition: filter var(--duration) ease, opacity var(--duration) ease;
    }
  }

  .page-header--studies .page-header__title {
    font-size: var(--step-6);
  }

  .page-header--studies .page-header__intro p {
    margin: 0;
  }

  .page-header--studies .page-header__intro p + p {
    margin-block-start: var(--space-2);
  }

  .study-filters {
    display: grid;
    gap: var(--space-3);
    justify-items: center;
    margin-block-start: var(--space-4);
  }

  .study-filters__group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    align-items: center;
    justify-content: center;
  }

  .study-filters__label {
    width: 100%;
    margin: 0 0 0.25rem;
    text-align: center;
  }

  .study-filters__list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    justify-content: center;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  /* The count rides in the shared filter link as a small disc */
  .study-filters__count {
    display: inline-grid;
    place-items: center;
    min-width: 1.5rem;
    height: 1.5rem;
    margin-inline-start: 0.5rem;
    padding-inline: 0.375rem;
    border-radius: var(--radius-pill);
    background: var(--color-paper);
    color: var(--color-ink);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1;
  }

  .filter__link:hover .study-filters__count {
    background: var(--color-white);
  }

  .filter__link[aria-current] .study-filters__count {
    background: var(--color-white);
  }

  .study-filters .filter__link {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
  }

  .study-empty {
    max-width: var(--measure);
    margin-inline: auto;
    padding: var(--space-5) var(--space-4);
    border: 1px dashed var(--color-ink);
    border-radius: var(--radius-sm);
    background: var(--color-white);
    text-align: center;
  }

  .study-empty__title {
    margin: 0 0 var(--space-2);
    font-family: var(--font-heading);
    font-size: var(--step-3);
    font-weight: var(--weight-heading);
    line-height: var(--leading-heading);
  }

  .study-empty p {
    margin: 0 0 var(--space-3);
  }
}

@layer motion {
  @media screen and (prefers-reduced-motion: no-preference) {
    /* The arrow nudges on hover or keyboard focus, where hover exists */
    .study-card__arrow {
      transition: transform var(--motion-base) var(--ease-out);
    }

    .study-card:has(.study-card__link:focus-visible) .study-card__arrow {
      transform: translateX(4px);
    }

    @media (hover: hover) and (pointer: fine) {
      .study-card:hover .study-card__arrow {
        transform: translateX(4px);
      }

      /* No capture: a slow zoom is enough */
      .study-card--still .study-card__image {
        transition: transform 900ms var(--ease-out);
      }

      .study-card--still:hover .study-card__image {
        transform: scale(1.03);
      }

      /* fx:devices ---- After the crossfade the capture pans top to bottom,
         linear, about a second per 1,000 px, and holds at the bottom. Leaving
         returns it to the top. Only transform moves, so nothing shifts. Keyboard
         focus does not pan. */
      html[data-fx~="devices"] .study-card__pan {
        transition: transform 600ms ease;
      }

      html[data-fx~="devices"] .study-card:hover .study-card__hover.is-ready .study-card__pan {
        transform: translateY(min(0px, calc(100cqh - 100%)));
        transition: transform var(--pan, 6s) linear 400ms;
      }
      /* /fx:devices */
    }
  }
}

/* ==========================================================================
   Before and after bar (2026-11-23, the Regional tier page's proof card)
   The Case studies block's optional "Before and after" fields print it
   inside a feature card's text (site/snippets/blocks/casestudies.php): a
   caption with the study's Early results label, two rows (label, a bar
   drawn to scale from --share, the number as text) and the source line.
   The bars are decoration (aria-hidden); the labels and numbers are a <dl>.
   Finished in the HTML: the bars grow once only when motion.js tells the
   figure it is in view (data-play, key "map"), never under reduced motion
   or in print.
   ========================================================================== */

@layer blocks {
  .study-bar {
    max-width: 30rem;
    margin: var(--space-3) 0 0;
    padding: var(--space-2) var(--space-3);
    background: var(--color-paper);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .study-bar__head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem var(--space-1);
    align-items: center;
    justify-content: space-between;
    margin: 0 0 var(--space-1);
  }

  .study-bar__caption {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.4;
  }

  .study-bar__early {
    padding: 0.0625rem 0.5rem;
    background: var(--color-butter);
    border: var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    line-height: 1.6;
    text-transform: uppercase;
  }

  .study-bar__rows {
    display: grid;
    gap: var(--space-1);
    margin: 0;
  }

  .study-bar__row {
    display: grid;
    gap: 0.125rem;
  }

  .study-bar__label {
    font-size: 0.8125rem;
    line-height: 1.4;
  }

  .study-bar__value {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(3.75rem, max-content);
    gap: var(--space-1);
    align-items: center;
    margin: 0;
  }

  .study-bar__track {
    display: block;
    height: 0.75rem;
  }

  .study-bar__fill {
    display: block;
    width: calc(var(--share, 1) * 100%);
    height: 100%;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-pill);
    transform-origin: left center;
  }

  .study-bar__row--after .study-bar__fill {
    background: var(--color-brand);
  }

  .study-bar__number {
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-weight: var(--weight-display);
    line-height: 1.1;
    text-align: end;
    font-variant-numeric: tabular-nums;
  }

  .study-bar__source {
    margin: var(--space-1) 0 0;
    font-size: 0.75rem;
    line-height: 1.5;
  }
}

@layer motion {
  @media screen and (prefers-reduced-motion: no-preference) {
    html[data-fx~="map"].js-motion .study-bar:not(.is-in) .study-bar__fill {
      transform: scaleX(0);
    }

    html[data-fx~="map"] .study-bar__fill {
      transition: transform 900ms var(--ease-out, ease-out);
    }

    html[data-fx~="map"] .study-bar__row--after .study-bar__fill {
      transition-delay: 250ms;
    }
  }
}

/* ==========================================================================
   Showcase and tiles (final uplift 1.1, 2026-11-28)
   The landing pages' Case studies block (site/snippets/blocks/casestudies.php):
   the lead study as a showcase (cards/study, variant showcase) and the other
   studies as tiles (variant tile), both with the device mockup of
   site/snippets/cards/devices.php. The showcase sits on mint: the section's
   own background when the block's is mint, else a mint panel of its own
   (--panel). Docs: docs/design/components.md, "Case study showcase on
   landing pages".
   ========================================================================== */

@layer blocks {
  /* ---------- Devices: a desktop frame, a phone over its corner ---------- */

  .devices {
    position: relative;
    width: 100%;
  }

  /* room for the phone: it sits over the desktop's lower right corner */
  .devices--large:not(.devices--solo) {
    padding: 0 10% 7% 0;
  }

  .devices__desktop {
    overflow: hidden;
    border: var(--border);
    border-radius: var(--radius-sm);
    background: var(--color-white);
  }

  .devices--large .devices__desktop {
    box-shadow: var(--shadow-hard);
  }

  .devices__bar {
    display: flex;
    gap: 0.375rem;
    align-items: center;
    height: 1.5rem;
    padding-inline: 0.75rem;
    border-block-end: var(--border);
    background: var(--color-paper);
  }

  .devices--small .devices__bar {
    gap: 0.25rem;
    height: 1rem;
    padding-inline: 0.5rem;
  }

  .devices__dot {
    width: 0.5rem;
    height: 0.5rem;
    border: var(--border);
    border-radius: var(--radius-pill);
    background: var(--color-brand);
  }

  .devices--small .devices__dot {
    width: 0.375rem;
    height: 0.375rem;
  }

  .devices__dot:nth-child(2) {
    background: var(--color-accent-2);
  }

  .devices__dot:nth-child(3) {
    background: var(--color-butter);
  }

  .devices__screen {
    overflow: hidden;
    background: var(--color-white);
  }

  /* the captures show from their top edge, in a box of a fixed ratio (no shift) */
  .devices__shot {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: top;
  }

  .devices__phone {
    position: absolute;
    inset-block-end: 0;
    inset-inline-end: 0;
    width: 21%;
    padding: 0.25rem;
    border: var(--border);
    border-radius: var(--radius-sm);
    background: var(--color-ink);
  }

  .devices__phone .devices__screen {
    border-radius: calc(var(--radius-sm) - 0.25rem);
  }

  .devices__phone .devices__shot {
    aspect-ratio: 9 / 19.5;
  }

  /* One image as it is, no device: a logo project's logo, a drawn image */
  .devices--image {
    overflow: hidden;
    border: var(--border);
    border-radius: var(--radius-sm);
    background: var(--color-paper);
  }

  .devices--large.devices--image {
    max-width: 28rem;
    margin-inline: auto;
  }

  .devices__image {
    display: block;
    width: 100%;
    height: auto;
  }

  .devices--small.devices--image {
    aspect-ratio: 16 / 11;
  }

  .devices--small.devices--image .devices__image {
    height: 100%;
    object-fit: cover;
    object-position: top;
  }

  /* multiply: a logo saved on white sits straight on the cream */
  .devices--logo {
    display: grid;
    place-items: center;
    padding: 12%;
  }

  .devices--logo .devices__image,
  .devices--small.devices--logo .devices__image {
    height: auto;
    object-fit: contain;
    mix-blend-mode: multiply;
  }

  /* ---------- The media box of a showcase or tile holds the devices ---------- */

  :is(.study-card--showcase, .study-card--tile) .study-card__media {
    aspect-ratio: auto;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: none;
  }

  /* ---------- Showcase ---------- */

  .study-card--showcase {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
    align-items: center;
  }

  .study-card--panel {
    padding: var(--space-4) var(--space-3);
    border: var(--border);
    border-radius: var(--radius-lg);
    background: var(--color-brand);
  }

  .study-card--showcase .study-card__body {
    padding: 0;
  }

  .study-card--showcase .study-card__title {
    font-size: var(--step-4);
    line-height: var(--leading-tight);
  }

  .study-card__name {
    color: inherit;
    text-decoration: none;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
  }

  .study-card--showcase .study-card__text {
    color: var(--color-ink);
    font-size: var(--step-0);
  }

  .study-card--showcase .study-card__proof {
    margin-block-start: var(--space-3);
  }

  .study-card__action {
    margin: var(--space-3) 0 0;
  }

  @media (min-width: 48rem) {
    .study-card--panel {
      padding: var(--space-5);
    }
  }

  @media (min-width: 64rem) {
    .study-card--showcase {
      grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
      gap: var(--space-6);
    }

    /* an SEO-only study without an image: the facts alone, centered */
    .study-card--showcase.study-card--nomedia {
      grid-template-columns: minmax(0, 1fr);
      max-width: 44rem;
      margin-inline: auto;
    }
  }

  /* ---------- Tiles ---------- */

  .study-list--tiles {
    gap: var(--space-3);
  }

  @media (min-width: 40rem) {
    .study-list--tiles {
      grid-template-columns: repeat(auto-fit, calc((100% - var(--space-3)) / 2 - 0.01px));
      justify-content: center;
    }
  }

  @media (min-width: 64rem) {
    .study-list--tiles:not(.study-list--two) {
      grid-template-columns: repeat(auto-fit, calc((100% - 2 * var(--space-3)) / 3 - 0.01px));
    }

    /* a lone last tile on a later row takes the middle column */
    .study-list--tiles:not(.study-list--two) > li:last-child:nth-child(3n + 4) {
      grid-column: 2;
    }

  }

  /* mint inside, a 2px ink line (bulk fixes A3, 2026-11-29) */
  .study-card--tile {
    padding: var(--space-3);
    border: var(--border);
    border-width: 2px;
    border-radius: var(--radius-sm);
    background: var(--color-brand);
  }

  .study-card--tile .study-card__title {
    font-size: var(--step-2);
  }

  .study-card--tile .study-card__figure {
    font-size: var(--step-3);
  }

  /* the decorative "Read case study" at the foot of a tile (the name is the link) */
  .study-card__more {
    margin-block-start: auto;
    padding-block-start: var(--space-2);
    font-size: var(--btn-font-size);
    font-weight: var(--btn-weight);
    letter-spacing: var(--btn-tracking);
    text-transform: uppercase;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 0.35em;
  }

  .study-card--tile .study-card__proof {
    margin-block-end: var(--space-1);
  }

  /* ---------- Case study links: underline on hover and keyboard focus ---------- */

  .study-card:is(:hover, :has(.study-card__link:focus-visible)) :is(.study-card__link, .study-card__more, .study-card__cta.btn--link) {
    text-decoration: underline;
    text-decoration-color: currentColor;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
  }

  .study-card:is(:hover, :has(.study-card__link:focus-visible)) :is(.study-card__more, .study-card__cta.btn--link) {
    text-underline-offset: 0.35em;
  }

  .study-card__name:is(:hover, :focus-visible) {
    text-decoration-line: underline;
  }

  /* the showcase's one button underlines its label too */
  .study-card__cta:is(:hover, :focus-visible) .btn__label {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.35em;
  }

  /* "See all case studies" under a showcase: a text link, so the showcase keeps its one button */
  .study-actions--text {
    margin-block: var(--space-4) 0;
    text-align: center;
  }

  .study-actions__link {
    font-size: var(--btn-font-size);
    font-weight: var(--btn-weight);
    letter-spacing: var(--btn-tracking);
    text-transform: uppercase;
    text-decoration-color: transparent;
    text-underline-offset: 0.35em;
  }

  .study-actions__link:is(:hover, :focus-visible) {
    text-decoration-color: currentColor;
  }

  .study-showcase + .study-more {
    margin-block-start: var(--space-5);
  }
}

/* ==========================================================================
   Showcase and tiles, second pass (bulk fixes A3 and B1, 2026-11-29)
   - Scroll in the frame: a full-page capture (cards/devices: --shift, the
     share of the image below the frame; --scroll, the time) shows its top,
     and on hover or keyboard focus of its card scrolls slowly to the bottom,
     then back when the pointer or focus leaves. Transform only: nothing
     shifts. Only where hover exists, never under reduced motion, never on
     touch screens (hover: none).
   - Lift: on hover or keyboard focus a tile (and a showcase in its own
     panel) rises with the brand shadow (--shadow-hard); a showcase flat on a
     mint section lifts its frames. The shadow shows without the movement
     under reduced motion.
   - Arrangements of the showcase from 64rem: --second (the frames and a
     second page of the site beside the facts), --stacked (the frames above
     the facts, centered). Below 64rem every showcase stacks as before.
   - The "Client since" pill on a tile.
   ========================================================================== */

@layer blocks {
  /* a full-page capture: the screen keeps the frame's ratio and clips it */
  .devices__screen--scroll {
    aspect-ratio: 16 / 10;
  }

  .devices__phone .devices__screen--scroll {
    aspect-ratio: 9 / 19.5;
  }

  .devices__screen--scroll .devices__shot,
  .devices__phone .devices__screen--scroll .devices__shot {
    height: auto;
    aspect-ratio: auto;
    object-fit: fill;
  }

  /* the lift's shadow (no movement here; the movement is in the motion layer) */
  .study-card--tile,
  .study-card--showcase.study-card--panel,
  .study-card--showcase:not(.study-card--panel) .devices {
    transition: box-shadow var(--motion-base, 320ms) var(--ease-out, ease-out);
  }

  .study-card--tile:has(:focus-visible),
  .study-card--showcase.study-card--panel:has(:focus-visible) {
    box-shadow: var(--shadow-hard);
  }

  @media (hover: hover) {
    .study-card--tile:hover,
    .study-card--showcase.study-card--panel:hover {
      box-shadow: var(--shadow-hard);
    }
  }

  /* ---------- Client since ---------- */

  .study-card__since {
    align-self: flex-start;
    margin: 0 0 var(--space-1);
    padding: 0.125rem 0.625rem;
    border: var(--border);
    border-radius: var(--radius-pill);
    background: var(--color-butter);
    font-size: var(--pill-font-size);
    font-weight: var(--pill-weight);
    letter-spacing: var(--pill-tracking);
    line-height: 1.6;
    text-transform: uppercase;
  }

  /* ---------- Arrangements from 64rem ---------- */

  .devices-stack {
    display: grid;
    gap: var(--space-4);
  }

  /* the second page under the frames: a little narrower, from the left */
  .devices--second {
    width: 86%;
  }

  @media (max-width: 47.9375rem) {
    .devices--second {
      display: none;
    }
  }

  @media (min-width: 64rem) {
    .study-card--showcase.study-card--second {
      align-items: start;
    }

    .study-card--showcase.study-card--stacked {
      grid-template-columns: minmax(0, 1fr);
      gap: var(--space-5);
      justify-items: center;
    }

    .study-card--stacked .study-card__media {
      width: 100%;
      max-width: 54rem;
    }

    .study-card--stacked .study-card__body {
      display: flex;
      flex-direction: column;
      align-items: center;
      max-width: 46rem;
      text-align: center;
    }

    /* paragraphs longer than three lines stay left-aligned in the centered column */
    .study-card--stacked .study-card__text {
      align-self: stretch;
      text-align: start;
    }

    .study-card--stacked .study-bar {
      width: 100%;
      text-align: start;
    }
  }
}

@layer motion {
  @media screen and (hover: hover) and (prefers-reduced-motion: no-preference) {
    /* the lift */
    .study-card--tile,
    .study-card--showcase.study-card--panel,
    .study-card--showcase:not(.study-card--panel) .devices {
      transition: transform var(--motion-base, 320ms) var(--ease-out, ease-out), box-shadow var(--motion-base, 320ms) var(--ease-out, ease-out);
    }

    .study-card--tile:is(:hover, :has(:focus-visible)),
    .study-card--showcase.study-card--panel:is(:hover, :has(:focus-visible)),
    .study-card--showcase:not(.study-card--panel):is(:hover, :has(:focus-visible)) .devices {
      transform: translate(-4px, -4px);
    }

    /* fx:devices ---- the full-page capture scrolls to its bottom, slowly
       (--scroll, linear, after a short pause), and goes back faster on leave */
    html[data-fx~="devices"] .devices__screen--scroll .devices__shot {
      transition: transform 1200ms var(--ease-out, ease-out);
    }

    html[data-fx~="devices"] .study-card:is(:hover, :has(:focus-visible)) .devices__screen--scroll .devices__shot {
      transform: translateY(calc(var(--shift, 0) * -100%));
      transition: transform var(--scroll, 6s) linear 300ms;
    }
    /* /fx:devices */
  }
}
