/* ─────────────────────────────────────────────────────────────────────────
   Section: Feature Grid
   Page:    Features Overview
   Figma:   2001:2838 (Body) + 2001:2879 (decorative Vector) — canvas 1440

   Card internals (Figma, 360x650 card):
     title   y 40, x 30, width 300
     body    all bodies END at y 510 regardless of title height — i.e. the
             body is bottom-aligned, not stacked under the title.
     arrow   y 580, right-aligned (x 270..330)
     so: 70 below body → arrow, 70 below arrow → card bottom.

   Decorative "S" vector (page coords): x 1161, y 3004, 557x705.
     Page frame is 1440 wide and clips, so only the left ~279px of the
     shape is visible. Relative to the Body section (y 804..3724):
       left   1161/1440 = 80.625%
       width   557/1440 = 38.6806%
       bottom  3724-3709 = 15px
   ───────────────────────────────────────────────────────────────────────── */

.section-features-grid {
  position: relative;

  /* `clip`, not `hidden`. Both clip the decorative stage identically, but
     `hidden` creates a scroll container, and a scroll container captures any
     descendant's anonymous `view()` timeline — which left every card in this
     grid stuck at its animation's end state instead of revealing on scroll.
     `clip` does not create one. */
  overflow: clip;
}

.section-features-grid__stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

/* Figma places the shape at left 1161 of the 1440 frame, 557 wide:
     left  1161/1440 = 80.625%
     width  557/1440 = 38.6806%
   As shares of the viewport it holds Figma's position at every width, and
   80.625 + 38.6806 = 119.3% guarantees it always runs past the right edge,
   so it bleeds rather than stopping short and leaving a white gutter. */
.section-features-grid__decor {
  position: absolute;

  /* Anchored by its RIGHT edge, never its left. Figma shows only the left
     279 of the 557 shape — the rest bleeds past the frame edge:
       overhang = 557 - 279 = 278  (19.3056% of 1440)
     Capping the width while anchoring LEFT stops the right edge travelling
     once the cap bites, which leaves a white gutter and reveals the whole
     logo. Anchoring right keeps it bleeding at every width:
       right  -> max() of two negatives picks the SMALLER overhang, so it is
                 proportional below 1440 and frozen at 278 above.
       width  -> capped at Figma's 557 so it cannot balloon.
     Visible sliver = width - overhang: 279 at 1440 and above, proportional
     below. Never a gutter, never oversized. */
  right: max(-19.3056%, -17.375rem);
  bottom: 0.9375rem;
  display: none;
  width: min(38.6806%, 34.8125rem);
  height: auto;
  max-width: none;
}

@media (width >= 64rem) {
  .section-features-grid__decor {
    display: block;
  }
}

/* ── Desktop card: proportional, not pinned to 1440 ──────────────────────
   Figma's card is 360x650 with 30/40/70 padding, a 70 gap, a 40/45 title and
   a 22/31 body. Expressed as fixed px those numbers are only correct when the
   grid column happens to be exactly 360 — i.e. only at a 1440 viewport. At
   1190 the column is ~277, so the card is squeezed while the type stays at
   40px and the card reads as "too big".

   Fix: make the grid item a query container and express every card dimension
   as a share of the column width (cqw). Percentages of 360:
     padding   30 → 8.3333   40 → 11.1111   70 → 19.4444
     gap       70 → 19.4444
     title     40 → 11.1111  / line-height 45 → 12.5
     body      22 →  6.1111  / line-height 31 →  8.6111
     text col 300 → 83.3333
     arrow     60 → 16.6667
   The card also takes aspect-ratio 360/650, so height tracks width. At a 1440
   viewport every value resolves to its exact Figma pixel; at any other width
   the whole card scales as one piece. */
.section-features-grid__item {
  container-type: inline-size;
}

/* Figma gives the body `flex: 1 0 0` (Tailwind's flex-1 is `1 1 0%`) and the
   arrow `shrink-0`. Both matter on short viewports: with shrink allowed, the
   body can compress below its content and the zero-height arrow box can be
   squeezed out of the layout entirely. */
.section-features-grid__body {
  flex: 1 0 0;
}

.section-features-grid__arrow {
  flex-shrink: 0;
}

/* ── Mobile card (Figma mobile frame) ────────────────────────────────────
     display: flex; padding: 24px; align-items: center; gap: 10px;
   Note there is no width/height/min-height — the mobile card is sized by its
   content, unlike the fixed 360x650 desktop card. The Tailwind utilities on
   the element carry the desktop values, so they are overridden here for the
   sub-lg range only. */
@media (width < 64rem) {
  .section-features-grid__card {
    min-height: 0;
    padding: 1.5rem;
    gap: 0.625rem;
  }
}

@media (width >= 64rem) {
  .section-features-grid__card {
    width: 100%;
    height: auto;
    aspect-ratio: 360 / 650;
    padding: 11.1111cqw 8.3333cqw 19.4444cqw;
    gap: 19.4444cqw;
  }

  .section-features-grid__title {
    width: 83.3333cqw;
    font-size: 11.1111cqw;
    line-height: 12.5cqw;
  }

  .section-features-grid__body {
    width: 83.3333cqw;
    font-size: 6.1111cqw;
    line-height: 8.6111cqw;
  }

  .section-features-grid__arrow {
    width: 16.6667cqw;
    height: auto;
    margin-top: 0;
  }
}
