/* Marisole: the reviews (Entangle Google Reviews) and Instagram (Instafeed) app blocks of the redesign, on the home page
   (plans/2026-10-26-home.md Tasks 6-7; figma-reference §6.1 1:544 / 1:1317, §6.2 9:323 / 10:324) and the category page
   (plans/2026-10-27-category.md Task 8; §6.3 88:3628 / 91:5578, §6.4 90:3961 / 91:6231: the same look) and the product
   page (plans/2026-10-28-product.md Task 9, §b 23: as home). Linked render-blocking in layout/theme.liquid on the index
   and collection templates, async on the product template (ruling F15: the apps close that page): the boxes keep their
   reserved height while the deferred app scripts load (smokes home-apps-slow / collection-apps-slow / product-apps-slow).
   Rules are rooted at the page classes; Instagram is the three section instances (home 1757424100c9e6977c, category
   1764025112c4415349, product 1764025099ebb2a7c3, R-H7). Info pages plan Task 4: About (async, the apps close the page;
   Instagram 17636074769c2bf8a4) and Reviews (render-blocking, the apps are on its first screens; Instagram
   1784733696250e25ba, whose block has no title of its own: the section's text block is its title, so its box is the
   tiles alone) take the same look and reserves (smokes about-apps-slow / reviews-apps-slow). System pages plan Task 4: the
   articles' reviews (async; no Instagram section there; smoke article-apps-slow).
   Also home's View all (the same icon-button look as Write a Review) and --_arrow-mask, so neither has a second copy. */

/* arrow-up-right: icon-arrow turned -45deg (also used by template-index.css) */
:is(.marisole-home, .marisole-collection, .marisole-product, .marisole-info--about, .marisole-info--reviews, .marisole-info--article) {
  --_arrow-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.25 10h11.5m0 0-4-4m4 4-4 4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* View all of home's heading rows (70:1482; the circle alone below 990, 70:1488), Write a Review and Instagram's profile link:
   Body 2 + 48 Icon button Card with the arrow; one rule for the three (fix round 1: no copy in template-index.css).
   Specificity (0,4,1), as home's original rule (the View-all selector sets it for the whole :is()): an override of
   these links needs at least that (the reviews block's `& .grp-entangle-badge-button` below is (0,3,0): it wins only
   with !important or on properties this rule does not set; Instagram's link rule below is (0,4,1) and later) */
:is(.marisole-home, .marisole-collection, .marisole-product, .marisole-info--about, .marisole-info--reviews, .marisole-info--article) :is(.section-resource-list__header .group-block-content > a[href*="/collections/"], .grp-entangle--root .grp-entangle-badge-button, :is([id$='__1757424100c9e6977c'], [id$='__1764025112c4415349'], [id$='__1764025099ebb2a7c3'], [id$='__17636074769c2bf8a4'], [id$='__1784733696250e25ba']) .instafeed-bottom-link-wrapper > a) {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: visible;
  color: var(--color-text-primary);
  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);
  text-decoration: none;

  &::after {
    content: '';
    flex: none;
    inline-size: 48px;
    block-size: 48px;
    border-radius: var(--radius-full);
    background-color: var(--color-bg-card);
    transition: background-color var(--animation-speed) var(--animation-easing);
  }
  &::before {
    content: '';
    position: absolute;
    z-index: 1;
    inset-inline-end: 14px;
    inset-block-start: calc(50% - 10px);
    inline-size: 20px;
    block-size: 20px;
    background-color: var(--color-icon-primary);
    rotate: -45deg;
    mask: var(--_arrow-mask);
  }
}
/* below 990 the round arrow alone (Section header S 70:1488; owner QA round 1 r10): the label stays the link's name */
@media screen and (max-width: 989px) {
  :is(.marisole-home, .marisole-collection, .marisole-product, .marisole-info--about, .marisole-info--reviews, .marisole-info--article) .section-resource-list__header .group-block-content > a[href*="/collections/"] { gap: 0; font-size: 0; }
}
@media (hover: hover) {
  :is(.marisole-home, .marisole-collection, .marisole-product, .marisole-info--about, .marisole-info--reviews, .marisole-info--article) :is(.section-resource-list__header .group-block-content > a[href*="/collections/"], .grp-entangle--root .grp-entangle-badge-button, :is([id$='__1757424100c9e6977c'], [id$='__1764025112c4415349'], [id$='__1764025099ebb2a7c3'], [id$='__17636074769c2bf8a4'], [id$='__1784733696250e25ba']) .instafeed-bottom-link-wrapper > a):hover {
    color: var(--color-text-primary);

    &::after {
      background-color: var(--color-bg-accent-soft);
    }
  }
}

/* reviews app (horizon-upstream.md; !important vs its inline styles): fixed slider --_s, box --_res kept while it loads */
:is(.marisole-home, .marisole-collection, .marisole-product, .marisole-info--about, .marisole-info--reviews, .marisole-info--article) .grp-entangle--root {
  --_t: var(--ds-h4-weight) var(--ds-h4-size)/1 var(--font-heading--family); --_ts: var(--ds-h4-letter-spacing);
  display: flex !important; flex-wrap: wrap; align-items: center; gap: var(--space-heading-gap) 16px;
  --_s: 290px; --_res: calc(var(--_s) + 294px);
  min-block-size: var(--_res); padding: 0; background-color: transparent !important;

  & > * { flex: 0 0 100%; min-inline-size: 0; margin: 0; }
  & > .grp_custom_heading_continer { flex: 1 1 0; min-block-size: 70px; padding: 0; align-items: center; justify-content: flex-start; }
  & .grp_custom_heading { margin: 0; text-align: start; font: var(--_t); letter-spacing: var(--_ts); color: var(--color-text-primary) !important; }
  & > .grp-entangle-write-div:has(.grp-entangle-badge-button) { flex: none; padding: 0; }
  & .grp-entangle-write { margin: 0; }
  & .grp-entangle-badge-button { padding: 0; border-radius: 0 !important; background-color: transparent !important; color: var(--color-text-primary) !important; }
  /* the totals and "Show all Reviews" links: the app paints them #303030 inline and its orange on hover (QA round 1
     Task 6): text-primary, underlined on hover */
  & :is(a.grp-total-reviews, .grp-entangle-all-review) { color: var(--color-text-primary) !important; }
  @media (hover: hover) { & :is(a.grp-total-reviews, .grp-entangle-all-review):hover { text-decoration: underline; } }
  & [id^='new-rocket-slider'] { height: var(--_s) !important; }
  /* an opened Read more grows the slider (a tap, no layout-shift cost). QA round 2 Task 17 (Home r35): home, category,
     product (the info pages are .marisole-info) do not clip the slider (its inline overflow: hidden): its track stays
     in the flow, the cards past its width show up to the box's clip (marisole-sections.css), and any opened card (the
     peek too) grows it */
  &:not(.marisole-info *) [id^='new-rocket-slider'] { overflow: visible !important; }
  & [id^='new-rocket-slider']:has([aria-expanded='true']) { height: auto !important; }
  @media screen and (max-width: 749px) { & .grp-entangle-swipper-badge-wrapper { align-items: flex-start; } }
  @media screen and (min-width: 360px) { --_s: 270px; }
  @media screen and (min-width: 430px) { --_s: 230px; }
  @media screen and (min-width: 769px) { --_res: calc(var(--_s) + 160px); }
  @media screen and (max-width: 989px) { & .grp-entangle-badge-button { gap: 0 !important; font-size: 0 !important; } }
  @media screen and (min-width: 990px) {
    --_t: var(--ds-h2-weight) var(--ds-h2-size)/1 var(--font-heading--family); --_ts: var(--ds-h2-letter-spacing);
    --_res: calc(var(--_s) + 266px); align-items: flex-end;
  }
  @media screen and (min-width: 1332px) { --_res: calc(var(--_s) + 208px); }
}

/* Instagram (Instafeed app, horizon-upstream.md; !important vs its own): title + 3 x 2 / 4 x 2 tiles; ::before / ::after keep both while it loads */
:is(.marisole-home, .marisole-collection, .marisole-product, .marisole-info--about, .marisole-info--reviews, .marisole-info--article) > :is([id$='__1757424100c9e6977c'], [id$='__1764025112c4415349'], [id$='__1764025099ebb2a7c3'], [id$='__17636074769c2bf8a4'], [id$='__1784733696250e25ba']) {
  --_c: 3; --_g: 6px; --_k: 1; --_r: var(--radius-sm); --_lw: 48px; --_tr: 112px;
  --_t: var(--ds-h4-weight) var(--ds-h4-size)/var(--ds-h4-line-height) var(--font-heading--family); --_ts: var(--ds-h4-letter-spacing);

  & .shopify-app-block { position: relative; }
  & #insta-feed {
    display: grid !important; grid-template-columns: minmax(0, 1fr) var(--_lw); gap: var(--space-heading-gap) 16px; margin: 0 !important;
    &::before { content: ''; grid-area: 1 / 1; min-block-size: var(--_tr); }
    &::after { content: ''; grid-area: 2 / 1 / 3 / 3; padding-block-start: calc((100% - (var(--_c) - 1) * var(--_g)) / var(--_c) * var(--_k) * 2 + var(--_g)); }
    & > h2 { grid-area: 1 / 1; display: flex; align-items: center; min-block-size: 70px; margin: 0; text-align: start; color: var(--color-text-primary); font: var(--_t) !important; letter-spacing: var(--_ts); overflow-wrap: anywhere; }
    & > .instafeed-new-layout-container { grid-area: 2 / 1 / 3 / 3; width: auto !important; }
  }
  & .instafeed-new-layout-wrapper { grid-template-columns: repeat(var(--_c), minmax(0, 1fr)) !important; gap: var(--_g) !important; }
  & .instafeed-new-layout-item { width: auto !important; height: auto !important; aspect-ratio: 1 / var(--_k); clip-path: inset(0 round var(--_r)) !important; }
  & .instafeed-new-layout-item:nth-child(n + 9) { display: none; }
  /* the profile link = View all, at the title row's end; shown by the app once loaded */
  & .instafeed-bottom-link-wrapper { position: absolute; inset: 0 0 auto auto; inline-size: auto; block-size: var(--_tr); align-items: center; }
  & .instafeed-bottom-link-wrapper > a[href*='instagram.com'] { display: inline-flex !important; margin: 0 !important; padding: 0; gap: 0; font-size: 0; }
  & .instafeed-bottom-link-wrapper > a::after { position: static; border: 0; transform: none; }
  @media screen and (max-width: 749px) { & .instafeed-new-layout-item:nth-child(n + 7) { display: none; } }
  @media screen and (min-width: 331px) { --_tr: 84px; }
  @media screen and (min-width: 456px) { --_tr: 70px; }
  @media screen and (min-width: 750px) { --_c: 4; --_g: 8px; --_k: calc(350 / 334.5); --_r: 18px; }
  @media screen and (min-width: 990px) {
    --_lw: 224px; --_tr: 192px;
    --_t: var(--ds-h2-weight) var(--ds-h2-size)/var(--ds-h2-line-height) var(--font-heading--family); --_ts: var(--ds-h2-letter-spacing);
    & #insta-feed > h2 { align-items: flex-end; }
    & .instafeed-bottom-link-wrapper { align-items: flex-end; }
    & .instafeed-bottom-link-wrapper > a[href*='instagram.com'] { gap: 10px; font-size: var(--ds-body-2-size); }
  }
  @media screen and (min-width: 1196px) { --_tr: 128px; }
  /* translated titles (Translate & Adapt) break elsewhere: measured 2026-10-27, 2 px towards the taller row */
  &:lang(es) {
    @media screen and (min-width: 456px) and (max-width: 467px) { --_tr: 84px; }
    @media screen and (min-width: 1196px) and (max-width: 1221px) { --_tr: 192px; }
  }
  &:lang(ru) {
    @media screen and (max-width: 330px), screen and (min-width: 456px) and (max-width: 530px) { --_tr: 84px; }
    @media screen and (min-width: 1196px) and (max-width: 1363px) { --_tr: 192px; }
  }
  &:lang(fr) {
    @media screen and (min-width: 331px) and (max-width: 332px) { --_tr: 112px; }
    @media screen and (min-width: 1192px) and (max-width: 1195px) { --_tr: 128px; }
  }
  /* Reviews: the app's title is empty (the section's text block is the title): no title row, no gap above the tiles */
  &[id$='__1784733696250e25ba'] { & #insta-feed { row-gap: 0; &::before { content: none; } } }
}
