/* Marisole: Judge.me on the info pages (info pages plan 2026-10-30 Task 4; info-figma "Custom bouquet … Reviews",
   "Reviews 177:8721 / 177:9159", decision 9; ledger ruling 2026-10-31: on Reviews the owner placed the same featured
   carousel ("Reviews Carousel - Legacy") at the top of the Instagram section; All Reviews is not enabled in the app).
   Linked by sections/_blocks.liquid right before the section that holds the featured carousel app block, on Custom
   bouquet, Reviews and the Delivery template's pages (delivery plan 2026-10-31 Task 5; owner answer Q2: Judge.me in this
   style) (a stylesheet in the body holds back only what follows it: the carousel never paints unskinned, nothing above
   waits for it). The product page's skin (marisole-judgeme.css) is separate and untouched. Every rule is rooted at the
   app block on those pages' classes (R-C1). Class B: the app's own markup, no app setting changed. */

/* ---- Task 4: Custom bouquet, the featured carousel ----
   The app prints its cards in the HTML (the shop's judgeme.featured_carousel metafield) and its late script
   (third-party-deferral) turns them into a sliding carousel. This skin shows the printed cards from the first paint as
   a native rail instead (the script's slides and arrows are not used: its transform is cancelled), so the script
   moves nothing and a blocked script leaves the cards in place (smoke custom-bouquet-apps-slow).
   Desktop: Section header L (the app's title H2 in a row of at least 70, its stars + count at the row's end), 40 above
   the rail; 3 cards across the column (446 at 1512), 12 apart; under the rail at its end the app's two arrows as the
   48 Icon button Card (the products row's View all circle and arrow), 16 above: sections/_blocks.liquid
   (snippets/marisole-judgeme-rail) makes them scroll the rail by its width. Phones: Section header S (H4, the stars + count under
   it), 16 above; 290 cards 10 apart in a rail across the screen padded by the gutter (the product page's rail). Cards
   (the Reviews list's card): padding 24 / 20, radius 24 / 22 (no token), bg-card, 14 apart: the name (Body 2; the date
   is hidden by the app's own setting), the stars 16 / 14 (accent), the text Body 1 / Body 3 clamped to 4 lines (a review title, rare here, is not shown), so
   every card has the same height (--_card) and the box's reserve is close to the drawn rail (>= 250 by the smoke; --_res: kept from the first paint, given
   back by snippets/marisole-app-reserve when the app draws no card). Not shown (no place in Figma): the product strip
   under a review, the arrows. The avatar initial of Figma's card is not in the app's markup. */
.marisole-info--custom-bouquet .shopify-app-block[id*='__judge_me_reviews_featured_carousel'],
.marisole-info--reviews .shopify-app-block[id*='__judge_me_reviews_featured_carousel'],
.marisole-info--delivery .shopify-app-block[id*='__judge_me_reviews_featured_carousel'] {
  --_pad: 20px;
  --_radius: 22px; /* no token */
  --_gap: 14px;
  --_star: 14px;
  --_text-size: var(--ds-body-3-size);
  --_text-lh: var(--ds-body-3-line-height);
  --_lines: 4;
  --_head: 70px;
  --_name: calc(var(--ds-body-2-size) * var(--ds-body-2-line-height));
  --_body: calc(var(--_text-size) * var(--_text-lh) * var(--_lines));
  --_card: calc(2 * var(--_pad) + var(--_name) + 2 * var(--_gap) + var(--_star) + var(--_body));
  --_arrows: 0px; /* the arrows' row with its gap (desktop) */
  --_res: calc(var(--_head) + var(--space-heading-gap) + var(--_card) + var(--_arrows));
  --_w: 290px;
  --_title-size: var(--ds-h4-size);
  --_title-lh: var(--ds-h4-line-height);
  --_title-ls: var(--ds-h4-letter-spacing);
  inline-size: 100%; /* a flex item of the section: never as wide as its rail */
  min-inline-size: 0;
  min-block-size: var(--_res);
  color: var(--color-text-primary);

  &[data-marisole-empty]:not(:has(.jdgm-carousel-item)) {
    min-block-size: 0;
  }
  & > div {
    max-width: none !important; /* the block's Max width (inline, 1440) is wider than the column anyway */
  }
  & :is(.jdgm-carousel-wrapper, .jdgm-carousel, .jdgm-carousel__item-container, .jdgm-carousel__item-wrapper) {
    width: auto !important; /* the app's 80 % column; the rail's 100 % (its negative margins widen it on phones) */
    max-width: none !important;
  }
  & .jdgm-carousel-wrapper {
    margin: 0;
    padding: 0;
  }

  /* the header row: title, then the stars + count (the script draws the stars into their fixed row: nothing moves) */
  & .jdgm-carousel-title-and-link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 16px;
    min-block-size: var(--_head);
    margin: 0;
    padding: 0;
    text-align: start;
  }
  & .jdgm-carousel-title {
    flex: 1 1 100%;
    margin: 0;
    color: var(--color-text-primary);
    text-align: start;
    overflow-wrap: anywhere;
    font: var(--ds-h4-weight) var(--_title-size) / var(--_title-lh) var(--font-heading--family) !important; /* the app's own title size */
    letter-spacing: var(--_title-ls) !important;
  }
  & .jdgm-all-reviews-rating-wrapper {
    display: flex !important;
    align-items: center;
    gap: 8px;
    block-size: 24px;
    margin: 0;
    color: var(--color-text-primary);
    font: var(--ds-body-3-weight) var(--ds-body-3-size) / 1 var(--font-body--family);
  }
  & .jdgm-all-reviews-rating {
    display: flex !important;
    flex: none;
    column-gap: 2px;
    inline-size: calc(5 * 16px + 4 * 2px); /* the 5 stars the script draws later: their width kept, the title wraps the same */
    --_star: 16px;
  }
  & .jdgm-carousel-number-of-reviews > svg {
    display: none; /* the script's verified mark: not in Figma, and it would widen the row after the first paint */
  }
  & .jdgm-carousel-number-of-reviews {
    display: flex !important;
    align-items: center;
    gap: 4px;
    margin: 0;
    color: var(--color-text-primary);
    font: inherit;
  }

  /* the rail */
  & .jdgm-carousel {
    display: block !important; /* the app hides it until its script runs */
    margin: var(--space-heading-gap) 0 0;
    padding: 0;
  }
  & :is(.jdgm-carousel__item-container, .jdgm-carousel__item-wrapper) {
    height: auto !important; /* the app's fixed carousel height */
    min-height: 0 !important;
    max-height: none !important;
  }
  & .jdgm-carousel__item-container {
    overflow: visible;
    margin: 0;
    padding: 0;
  }
  & .jdgm-carousel__item-wrapper {
    display: flex;
    column-gap: var(--space-grid-gap);
    margin-inline: calc(var(--page-margin) * -1);
    padding-inline: var(--page-margin);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--page-margin);
    scrollbar-width: none;
    white-space: normal;
    font-size: inherit !important; /* the script's inline 0 */
    transform: none !important; /* the script's slides */
    transition: none !important;
  }
  /* delivery plan Task 5 fix round 1: the rail takes keyboard focus (snippets/marisole-judgeme-rail): the ring inside its box
     (the box reaches the screen's edges on phones); border-strong: 7.8:1 on a card, 7.2:1 on the page */
  & .jdgm-carousel__item-wrapper:focus-visible {
    outline: var(--focus-outline-width) solid var(--color-border-strong);
    outline-offset: calc(var(--focus-outline-width) * -1);
  }
  & .jdgm-carousel__arrows {
    display: none;
    justify-content: flex-end;
    gap: 8px;
    block-size: 48px;
    margin: 16px 0 0;
    padding: 0;
  }
  & :is(.jdgm-carousel__left-arrow, .jdgm-carousel__right-arrow) {
    display: grid;
    place-items: center;
    inline-size: 48px;
    block-size: 48px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-full);
    background: var(--color-bg-card);
    opacity: 1;
    transform: none; /* the app turns its chevron by rotating the arrow */
    rotate: none;
    cursor: pointer;
    font-size: 0;
    transition: background-color var(--animation-speed) var(--animation-easing);

    &::before {
      content: '';
      inline-size: 20px;
      block-size: 20px;
      margin: 0;
      border: 0;
      background-color: var(--color-icon-primary);
      transform: none;
      mask: var(--_arrow-mask);
    }
    &::after {
      content: none;
    }
    &:focus-visible {
      outline: var(--focus-outline-width) solid var(--color-border-strong);
      outline-offset: var(--focus-outline-offset);
    }
  }
  & .jdgm-carousel__status {
    position: absolute; /* the app's 1 px live region: out of the arrows' row */
  }
  & .jdgm-carousel__left-arrow::before {
    rotate: 180deg;
  }
  @media (hover: hover) {
    & :is(.jdgm-carousel__left-arrow, .jdgm-carousel__right-arrow):hover {
      background-color: var(--color-bg-accent-soft);
    }
  }

  /* the cards */
  & .jdgm-carousel-item {
    display: flex !important;
    flex-direction: column;
    flex: 0 0 var(--_w);
    row-gap: var(--_gap);
    box-sizing: border-box;
    width: auto !important;
    min-width: 0;
    height: var(--_card) !important;
    margin: 0 !important;
    padding: var(--_pad);
    overflow: hidden;
    border: 0;
    border-radius: var(--_radius);
    background-color: var(--color-bg-card);
    box-shadow: none;
    text-align: start; /* the app centres the card */
    vertical-align: top;
    white-space: normal;
    scroll-snap-align: start;
  }
  & :is(.jdgm-carousel-item__review, .jdgm-carousel-item__review-content, .jdgm-carousel-item__reviewer-name-wrapper) {
    display: contents;
  }
  & :is(.jdgm-carousel-item__product, .jdgm-carousel-item__review-title) {
    display: none !important; /* not in Figma's card; the title would break the equal heights */
  }
  & :is(.jdgm-carousel-item__reviewer-name, .jdgm-carousel-item__review-rating, .jdgm-carousel-item__review-body) {
    flex: none;
    text-align: start; /* the app centres them */
  }
  & .jdgm-carousel-item__reviewer-name {
    order: -1;
    block-size: var(--_name);
    opacity: 1; /* the app fades the name */
    overflow: hidden;
    margin: 0;
    color: var(--color-text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    font: var(--ds-body-2-weight) var(--ds-body-2-size) / var(--ds-body-2-line-height) var(--font-heading--family);
    letter-spacing: var(--ds-body-2-letter-spacing);
  }
  & .jdgm-carousel-item__review-rating {
    display: flex;
    column-gap: 2px;
    block-size: var(--_star);
    margin: 0;
    line-height: 1;
  }
  & .jdgm-star {
    inline-size: var(--_star);
    padding: 0 !important; /* the app pads stars with !important */
    color: var(--color-bg-accent);
    font-size: var(--_star);
    line-height: 1;
  }
  & .jdgm-carousel-item__review-body {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--_lines) !important; /* the script's inline clamp */
    block-size: var(--_body);
    max-block-size: none;
    margin: 0;
    overflow: hidden;
    color: var(--color-text-primary);
    overflow-wrap: anywhere;
    font: var(--ds-body-1-weight) var(--_text-size) / var(--_text-lh) var(--font-body--family);
  }
  & .jdgm-carousel-item__review-body * {
    display: inline;
    margin: 0;
    font: inherit;
  }
  & .jdgm-carousel-item__review-body > * + *::before {
    content: ' ';
  }

  /* delivery plan Task 5: the English H2 title and the stars + count share the row only from 1234 (measured 2026-11-01 in
     Chrome, 1 px steps 990-1620): below it the title takes 2 lines and the row 128, widened 2 px as the bands below */
  @media screen and (min-width: 990px) and (max-width: 1235px) { --_head: 128px; }

  /* the script swaps the printed English title and count for the page's language: its rows reserved where they break
     into more lines than the English (measured 2026-10-31 in Chrome, 1 px steps 320-1600, widened 2 px towards the
     taller row, as marisole-apps.css's Instagram bands) */
  &:lang(es) {
    @media screen and (min-width: 406px) and (max-width: 606px) { --_head: 84px; }
    @media screen and (min-width: 990px) { --_head: 128px; }
    @media screen and (min-width: 990px) and (max-width: 1020px) { --_head: 192px; }
  }
  &:lang(ru) {
    @media screen and (min-width: 406px) and (max-width: 535px) { --_head: 84px; }
    @media screen and (min-width: 990px) and (max-width: 1504px) { --_head: 128px; }
    @media screen and (min-width: 990px) and (max-width: 1012px) { --_head: 192px; }
  }
  &:lang(fr) {
    @media screen and (min-width: 406px) and (max-width: 544px) { --_head: 84px; }
    @media screen and (min-width: 990px) and (max-width: 1499px) { --_head: 128px; }
  }

  @media screen and (min-width: 990px) {
    --_pad: 24px;
    --_radius: 24px; /* no token */
    --_star: 16px;
    --_text-size: var(--ds-body-1-size);
    --_text-lh: var(--ds-body-1-line-height);
    --_w: calc((100% - 2 * var(--space-grid-gap)) / 3);
    --_arrows: 64px; /* 16 + 48 */
    --_title-size: var(--ds-h2-size);
    --_title-lh: var(--ds-h2-line-height);
    --_title-ls: var(--ds-h2-letter-spacing);

    & .jdgm-carousel-title-and-link {
      flex-wrap: nowrap;
      align-items: flex-end;
    }
    & .jdgm-carousel-title {
      flex: 1 1 auto;
    }
    & .jdgm-all-reviews-rating-wrapper {
      flex: none;
      font-size: var(--ds-body-2-size);
    }
    & .jdgm-carousel__item-wrapper {
      margin-inline: 0;
      padding-inline: 0;
      scroll-padding-inline: 0;
    }
    & .jdgm-carousel__arrows {
      display: flex;
    }
  }
}
