/* ============================================================
   delivery — "Precise Delivery. No Mess." (brief/delivery.md)
   Figma: desktop 3446:549 (1440, 3 cols 440 / 441 / 440) · mobile 3446:1590 (375, stack)
   Pattern B-edge: #E6E8D8 fill on the section, content in the page gutter (.container).
   One DOM in desktop order (D-DL1): below 1024 .delivery__text is display:contents;
   mobile moves the CTA block to the end (order), tablet places blocks by grid areas.
   Fluid values per pipeline/components/fluid-formulas.md (section-scoped vars).
   ============================================================ */

/* ---------- MOBILE (base, anchor 375) ---------- */
.delivery {
  --dl-pt: clamp(34px, calc(40px + (var(--max-vw) - 375px) * 0.015), 80px);
  --dl-pb: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 80px);
  --dl-gap: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 20px);
  --dl-intro-gap: clamp(13px, calc(15px + (var(--max-vw) - 375px) * 0.015), 20px);
  --dl-cta-gap: clamp(14px, calc(16px + (var(--max-vw) - 375px) * 0.015), 16px);
  --dl-card-gap: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 20px);
  --dl-card-pad: clamp(13px, calc(15px + (var(--max-vw) - 375px) * 0.015), 20px);
  --dl-icon: clamp(38px, calc(44px + (var(--max-vw) - 375px) * 0.015), 44px);
  --dl-icon-gap: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 10px);
  --dl-text-gap: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 10px);
  --dl-refund-icon: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 20px);
  --dl-refund-gap: clamp(5px, calc(6px + (var(--max-vw) - 375px) * 0.015), 6px);
  --dl-refund-box: clamp(217px, calc(254px + (var(--max-vw) - 375px) * 0.015), 254px);

  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--dl-gap);
  margin-top: 0; /* touches clinical (shared wrapper 3446:548 / 3446:1589) */
  padding-top: var(--dl-pt);
  padding-bottom: var(--dl-pb);
  background-color: var(--color-sage);
}

.delivery__text { display: contents; }

/* Intro — heading + lead */
.delivery__intro {
  display: flex;
  flex-direction: column;
  gap: var(--dl-intro-gap);
  text-align: center;
}

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

.delivery__title-strong {
  font-weight: 600;
  font-variation-settings: var(--fv-display);
}

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

/* CTA block — pill + refund promise row (last stack item on mobile) */
.delivery__cta-block {
  order: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--dl-cta-gap);
}

.delivery__cta { width: 100%; }

.delivery__promise {
  display: flex;
  justify-content: center;
}

/* D-DL4: fixed 254 box centred in the row, content left-aligned inside it (as drawn) */
.delivery__promise-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--dl-refund-gap);
  width: var(--dl-refund-box);
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: 400;
  line-height: var(--lh-ui);
  color: var(--color-ink);
  white-space: nowrap;
}

.delivery__promise-icon {
  flex: 0 0 auto;
  width: var(--dl-refund-icon);
  height: var(--dl-refund-icon);
}

/* Photo */
.delivery__photo {
  width: 100%;
  aspect-ratio: 441 / 512;
}

.delivery__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Feature list — equal-height cards (D-DL2) */
.delivery__features {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: 1fr;
  gap: var(--dl-card-gap);
}

.delivery__feature {
  display: flex;
  align-items: center;
  gap: var(--dl-icon-gap);
  padding: var(--dl-card-pad);
  border-radius: var(--radius-card);
  background-color: rgba(251, 251, 251, 0.4);
}

.delivery__feature-icon {
  flex: 0 0 auto;
  width: var(--dl-icon);
  height: var(--dl-icon);
}

.delivery__feature-text {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--dl-text-gap);
}

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

.delivery__feature-desc {
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--lh-ui);
  color: var(--color-text);
}

/* D-DL3: Figma copy ends with a line break → 2-line box, text on line 1 */
.delivery__feature-desc--2l { min-height: calc(2 * 1.25em); }

/* ---------- PSEUDO-TABLET 768–1023 (no Figma layer — FD-BL composition) ---------- */
@media (min-width: 768px) {
  .delivery {
    --dl-pt: clamp(45.88px, calc(45.88px + (var(--max-vw) - 768px) * 0.025), 80px);
    --dl-pb: clamp(25.88px, calc(25.88px + (var(--max-vw) - 768px) * 0.025), 80px);
    --dl-gap: 20px;
    --dl-intro-gap: clamp(20px, calc(20px + (var(--max-vw) - 768px) * 0.025), 20px);
    --dl-cta-gap: 16px;
    --dl-card-gap: clamp(15.88px, calc(15.88px + (var(--max-vw) - 768px) * 0.025), 20px);
    --dl-card-pad: clamp(20px, calc(20px + (var(--max-vw) - 768px) * 0.025), 20px);
    --dl-icon: 44px;
    --dl-icon-gap: 10px;
    --dl-text-gap: 10px;
    --dl-refund-icon: 20px;
    --dl-refund-gap: 6px;
    --dl-refund-box: 254px;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "intro intro"
      "photo features"
      "cta   cta";
    align-items: start;
    gap: var(--dl-gap);
  }

  /* stack-centred intro, relative measure (M2) */
  .delivery__intro {
    grid-area: intro;
    width: 75%;
    margin-inline: auto;
  }

  /* row-top: photo fills the (taller) feature-stack height instead of sagging (M4) */
  .delivery__photo {
    grid-area: photo;
    align-self: stretch;
    aspect-ratio: auto;
    position: relative; /* the image must not size the row: row height = feature stack */
    min-height: 0;
  }

  .delivery__photo img {
    position: absolute;
    inset: 0;
  }

  .delivery__features { grid-area: features; }

  /* stack-centred CTA in its own row, centred pill as on desktop */
  .delivery__cta-block {
    grid-area: cta;
    order: 0;
    width: 50%;
    margin-inline: auto;
  }
}

/* ---------- DESKTOP 1024+ (frame 1440 → --vw-base) ---------- */
@media (min-width: 1024px) {
  .delivery {
    --dl-pt: clamp(57px, calc(80px * (var(--max-vw) / var(--vw-base))), 107px);
    --dl-pb: clamp(57px, calc(80px * (var(--max-vw) / var(--vw-base))), 107px);
    --dl-gap: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --dl-intro-gap: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --dl-text-col-gap: clamp(28px, calc(40px * (var(--max-vw) / var(--vw-base))), 53px);
    --dl-cta-gap: clamp(11px, calc(16px * (var(--max-vw) / var(--vw-base))), 21px);
    --dl-card-gap: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --dl-card-pad: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --dl-icon: clamp(31px, calc(44px * (var(--max-vw) / var(--vw-base))), 59px);
    --dl-icon-gap: clamp(7px, calc(10px * (var(--max-vw) / var(--vw-base))), 13px);
    --dl-text-gap: clamp(7px, calc(10px * (var(--max-vw) / var(--vw-base))), 13px);
    --dl-refund-icon: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --dl-refund-gap: clamp(4px, calc(6px * (var(--max-vw) / var(--vw-base))), 8px);
    --dl-refund-box: clamp(181px, calc(254px * (var(--max-vw) / var(--vw-base))), 339px);

    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas: none;
    column-gap: var(--dl-gap);
    row-gap: 0;
    align-items: center; /* Figma 3446:549 alignItems CENTER */
  }

  /* Col 1 — real flex column: intro → CTA block, vertically centred in the row */
  .delivery__text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--dl-text-col-gap);
  }

  .delivery__intro {
    grid-area: auto;
    width: 100%;
    margin-inline: 0;
  }

  .delivery__cta-block {
    grid-area: auto;
    width: calc(420 / 440 * 100%); /* 420 pill block in the 440 column */
    margin-inline: 0;
  }

  /* Col 2 — photo 441 x 512 */
  .delivery__photo {
    grid-area: auto;
    align-self: center;
    aspect-ratio: 441 / 512;
  }

  .delivery__photo img { position: static; }

  /* Col 3 — 4 equal-height cards */
  .delivery__features { grid-area: auto; }
}
