/* ============================================================
   Ingredients — brief/ingredients.md (D 3446:420 · M 3446:1468)
   Pattern A: .container on the section, no background (fill hidden in Figma).
   Mobile (base): intro → 2-up grid of 6 items, no bottle, no leaders.
   Pseudo-tablet 768–1023: intro stack-centred → grid-3, items stack-centred (FD-BL).
   Desktop 1024+: 3 columns — intro + 2 items · bottle · 4 items, dashed leaders.
   Fluid formulas: pipeline/components/fluid-formulas.md
   ============================================================ */

/* ---------- MOBILE (base, anchor 375) ---------- */
.ingredients {
  /* product → ingredients 60 (M) / 157 (D); ingredients → difference = --section-gap */
  --ing-margin-top: clamp(51px, calc(60px + (var(--max-vw) - 375px) * 0.015), 157px);
  --ing-img: clamp(60px, calc(70px + (var(--max-vw) - 375px) * 0.015), 130px);
  --ing-check: clamp(13px, calc(15px + (var(--max-vw) - 375px) * 0.015), 20px);
  --ing-intro-gap: clamp(13px, calc(15px + (var(--max-vw) - 375px) * 0.015), 20px);
  --ing-intro-mb: clamp(39px, calc(46px + (var(--max-vw) - 375px) * 0.015), 46px);
  --ing-grid-gap: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 20px);
  --ing-img-gap: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 20px);
  --ing-name-gap: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 10px);
  --ing-benefit-gap: clamp(4px, calc(5px + (var(--max-vw) - 375px) * 0.015), 10px);
  --ing-check-gap: clamp(4px, calc(5px + (var(--max-vw) - 375px) * 0.015), 5px);

  margin-top: var(--ing-margin-top);
  margin-bottom: var(--section-gap);
}

.ingredients__layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--ing-grid-gap);
  row-gap: var(--ing-grid-gap);
  align-items: start;
}

/* Desktop column wrappers dissolve: their children join the grid */
.ingredients__left,
.ingredients__items {
  display: contents;
}

.ingredients__intro {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: var(--ing-intro-gap);
  margin-bottom: var(--ing-intro-mb);
  color: var(--color-heading);
}

.ingredients__title {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-display);
  font-size: var(--text-h2);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-heading);
  color: var(--color-heading);
}

.ingredients__lead {
  font-family: var(--font-body);
  font-size: var(--text-lead);
  font-weight: 400;
  line-height: var(--lh-lead);
  color: var(--color-heading);
}

.ingredients__bottle {
  display: none;
}

/* ---------- Ingredient item ---------- */
.ingredient {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--ing-img-gap);
  min-width: 0;
}

.ingredient__img {
  flex: 0 0 auto;
  width: var(--ing-img);
  height: var(--ing-img);
  border-radius: 50%;
  object-fit: cover;
}

.ingredient__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--ing-name-gap);
  min-width: 0;
}

.ingredient__name {
  font-family: var(--font-body);
  font-size: var(--text-h4);
  font-weight: 500;
  line-height: var(--lh-ui);
  color: var(--color-ink);
}

.ingredient__benefits {
  display: flex;
  flex-direction: column;
  gap: var(--ing-benefit-gap);
}

.ingredient__benefit {
  display: flex;
  align-items: flex-start;
  gap: var(--ing-check-gap);
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--lh-ui);
  color: var(--color-text);
}

.ingredient__check {
  flex: 0 0 auto;
  width: var(--ing-check);
  height: var(--ing-check);
}

.ingredient__benefit-text {
  flex: 1 1 0;
  min-width: 0;
}

.ingredient__leader {
  display: none;
}

/* ---------- PSEUDO-TABLET 768–1023 (no Figma layer — FD-BL composition) ---------- */
@media (min-width: 768px) {
  .ingredients {
    --ing-margin-top: clamp(65.88px, calc(65.88px + (var(--max-vw) - 768px) * 0.025), 157px);
    --ing-img: clamp(75.88px, calc(75.88px + (var(--max-vw) - 768px) * 0.025), 130px);
    --ing-check: clamp(20px, calc(20px + (var(--max-vw) - 768px) * 0.025), 20px);
    --ing-intro-gap: clamp(20px, calc(20px + (var(--max-vw) - 768px) * 0.025), 20px);
    --ing-intro-mb: clamp(46px, calc(46px + (var(--max-vw) - 768px) * 0.025), 46px);
    --ing-grid-gap: clamp(20px, calc(20px + (var(--max-vw) - 768px) * 0.025), 20px);
    --ing-img-gap: clamp(15.88px, calc(15.88px + (var(--max-vw) - 768px) * 0.025), 20px);
    --ing-name-gap: clamp(10px, calc(10px + (var(--max-vw) - 768px) * 0.025), 10px);
    --ing-benefit-gap: clamp(10px, calc(10px + (var(--max-vw) - 768px) * 0.025), 10px);
    --ing-check-gap: clamp(5px, calc(5px + (var(--max-vw) - 768px) * 0.025), 5px);
  }

  /* items: grid-3 (2 rows of 3) */
  .ingredients__layout {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* intro: stack-centred, measure-limited */
  .ingredients__intro {
    justify-self: center;
    max-width: 80%;
    text-align: center;
  }

  /* item: stack-centred — image + name centred, benefit list a centred block with left-aligned rows */
  .ingredient {
    align-items: center;
  }

  .ingredient__body {
    align-items: center;
  }

  .ingredient__name {
    text-align: center;
  }

  .ingredient__benefits {
    width: fit-content;
    max-width: 100%;
  }
}

/* ---------- DESKTOP 1024+ (scales from --vw-base 1440) ---------- */
@media (min-width: 1024px) {
  .ingredients {
    --ing-margin-top: clamp(112px, calc(157px * (var(--max-vw) / var(--vw-base))), 209px);
    --ing-img: clamp(92px, calc(130px * (var(--max-vw) / var(--vw-base))), 173px);
    --ing-check: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --ing-intro-gap: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --ing-img-gap: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --ing-name-gap: clamp(7px, calc(10px * (var(--max-vw) / var(--vw-base))), 13px);
    --ing-benefit-gap: clamp(7px, calc(10px * (var(--max-vw) / var(--vw-base))), 13px);
    --ing-check-gap: clamp(4px, calc(5px * (var(--max-vw) / var(--vw-base))), 7px);
    --ing-bottle-w: clamp(199px, calc(280px * (var(--max-vw) / var(--vw-base))), 373px);
    --ing-leader-w: clamp(58px, calc(81px * (var(--max-vw) / var(--vw-base))), 108px);
    --ing-col-gap: clamp(24px, calc(34px * (var(--max-vw) / var(--vw-base))), 45px);
    --ing-left-gap: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --ing-right-gap: clamp(21px, calc(30px * (var(--max-vw) / var(--vw-base))), 40px);
  }

  /* 3 columns: 506 / 280 / 506 at 1440 (+ 2 x 34 = 1360) */
  .ingredients__layout {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--ing-col-gap);
  }

  /* left column: intro on top, the 2 items at the bottom (space-between);
     row height comes from the right column */
  .ingredients__left {
    flex: 1 1 0;
    min-width: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--ing-col-gap);
  }

  .ingredients__intro {
    justify-self: auto;
    max-width: none;
    margin-bottom: 0;
    text-align: left;
  }

  .ingredients__items {
    display: flex;
    flex-direction: column;
  }

  .ingredients__items--left {
    gap: var(--ing-left-gap);
  }

  .ingredients__items--right {
    flex: 1 1 0;
    min-width: 0;
    gap: var(--ing-right-gap);
  }

  .ingredients__bottle {
    display: block;
    flex: 0 0 var(--ing-bottle-w);
    width: var(--ing-bottle-w);
  }

  .ingredients__bottle img {
    width: 100%;
    height: auto;
  }

  /* item row: image 130 high, body vertically centred, leader touches the image */
  .ingredient {
    flex-direction: row;
    align-items: center;
    gap: 0;
  }

  .ingredient__body {
    flex: 1 1 0;
    align-items: stretch;
  }

  .ingredient__name {
    text-align: left;
  }

  .ingredient__benefits {
    width: auto;
  }

  .ingredient__leader {
    display: block;
    flex: 0 0 var(--ing-leader-w);
    width: var(--ing-leader-w);
    height: 1px;
    background: repeating-linear-gradient(90deg, var(--color-divider) 0 6px, transparent 6px 12px);
    position: relative;
  }

  /* Round terminal Ø5.33 on the BOTTLE-side end (Figma absoluteRenderBounds 84.17 x 5.33 on an
     81 x 0 vector — per-vertex cap; ING-A1). Left items: right end; right items: left end. */
  .ingredient__leader::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    width: clamp(3.79px, calc(5.33px * (var(--max-vw) / var(--vw-base))), 7.11px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--color-divider);
    transform: translate(50%, -50%);
  }
  .ingredients__items--right .ingredient__leader::after {
    right: auto;
    left: 0;
    transform: translate(-50%, -50%);
  }

  /* LEFT items: body → image → leader (text on the outside, leader pointing right at the bottle) */
  .ingredients__items--left .ingredient__body { order: 1; margin-right: var(--ing-img-gap); }
  .ingredients__items--left .ingredient__img { order: 2; }
  .ingredients__items--left .ingredient__leader { order: 3; }

  /* RIGHT items: leader → image → body (mirror; the dash pattern starts at the image edge) */
  .ingredients__items--right .ingredient__leader {
    order: 1;
    background: repeating-linear-gradient(270deg, var(--color-divider) 0 6px, transparent 6px 12px);
  }
  .ingredients__items--right .ingredient__img { order: 2; }
  .ingredients__items--right .ingredient__body { order: 3; margin-left: var(--ing-img-gap); }
}
