/* ============================================================
   Clarity — brief/clarity.md (desktop 3446:619 · mobile 3446:1669)
   Pattern A: .container on the section (gutter only); the photo + 40% brand
   overlay live on the inset card .clarity__card (r12). Mobile-first.
   Fluid values per pipeline/components/fluid-formulas.md (brief §2 table).
   ============================================================ */

/* ---------- MOBILE (base, anchor 375) ---------- */
.clarity {
  /* card padding-top + heading→panel gap: M 40 (34..80) */
  --clarity-pt: clamp(34px, calc(40px + (var(--max-vw) - 375px) * 0.015), 80px);
  /* card padding-inline + padding-bottom: M 20 (17..30) */
  --clarity-px: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 30px);
  /* badges panel padding: M 15 (13..30) */
  --clarity-panel-p: clamp(13px, calc(15px + (var(--max-vw) - 375px) * 0.015), 30px);
  /* between badges (column gap): M 10 (9..10) */
  --clarity-badge-gap: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 10px);
  /* icon → label: M 10 (9..10) */
  --clarity-icon-gap: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 10px);
  /* icon slot: M 44 (38..44) */
  --clarity-icon: clamp(38px, calc(44px + (var(--max-vw) - 375px) * 0.015), 44px);
}

.clarity__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--clarity-pt);
  padding: var(--clarity-pt) var(--clarity-px) var(--clarity-px);
  border-radius: var(--radius-card);
  /* Pre-load / photo-failure fill: the brand green of the overlay, so the white heading keeps its
     contrast without the photo (Figma's bottom paint #D9D9D9 left it at 2.94:1 — P0-1, Δ2b). */
  background-color: var(--color-brand);
  background-image:
    linear-gradient(var(--color-brand-40), var(--color-brand-40)),
    url("../../assets/images/clarity-bg.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.clarity__title {
  width: 100%;
  /* Figma: fixed 269 box on mobile → 2 lines, centred */
  max-width: clamp(230px, calc(269px + (var(--max-vw) - 375px) * 0.015), 269px);
  margin-inline: auto;
  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-white);
  text-align: center;
}

.clarity__badges {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: var(--clarity-badge-gap);
  padding: var(--clarity-panel-p);
  border-radius: var(--radius-card);
  background-color: var(--color-brand-50); /* flat fill — node has no effects (D-C5) */
}

.clarity__badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--clarity-icon-gap);
}

/* 44x44 slot; the glyph file keeps its own aspect and is scaled with the slot (§3) */
.clarity__icon {
  position: relative;
  flex: 0 0 auto;
  width: var(--clarity-icon);
  height: var(--clarity-icon);
  overflow: visible;
}

.clarity__icon img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  max-width: none;
}

/* Lab icon: 54x44 file in a 44x44 slot — glyph overflows right as drawn (D-C3) */
.clarity__icon--lab img {
  width: calc(54 / 44 * 100%);
}

.clarity__label {
  font-family: var(--font-body);
  font-size: var(--text-badge);
  font-weight: 400;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-heading);
  color: var(--color-white);
  text-align: center;
  white-space: nowrap; /* Figma whitespace-nowrap; every label is one line (checked at 320 / 1024) */
}

/* ---------- PSEUDO-TABLET 768–1023 (no Figma layer — FD-BL composition) ----------
   card stack-centred · heading stack-centred without the 269 cap · badges grid-2 */
@media (min-width: 768px) {
  .clarity {
    --clarity-pt: clamp(45.88px, calc(45.88px + (var(--max-vw) - 768px) * 0.025), 80px);
    --clarity-px: clamp(25.88px, calc(25.88px + (var(--max-vw) - 768px) * 0.025), 30px);
    --clarity-panel-p: clamp(20.88px, calc(20.88px + (var(--max-vw) - 768px) * 0.025), 30px);
    --clarity-badge-gap: clamp(10px, calc(10px + (var(--max-vw) - 768px) * 0.025), 10px);
    --clarity-icon-gap: clamp(10px, calc(10px + (var(--max-vw) - 768px) * 0.025), 10px);
    --clarity-icon: clamp(44px, calc(44px + (var(--max-vw) - 768px) * 0.025), 44px);
  }

  .clarity__title {
    max-width: none;
  }

  .clarity__badges {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--clarity-badge-gap);
  }
}

/* ---------- DESKTOP 1024+ (scaled from --vw-base 1440) ---------- */
@media (min-width: 1024px) {
  .clarity {
    --clarity-pt: clamp(57px, calc(80px * (var(--max-vw) / var(--vw-base))), 107px);
    --clarity-px: clamp(21px, calc(30px * (var(--max-vw) / var(--vw-base))), 40px);
    --clarity-panel-p: clamp(21px, calc(30px * (var(--max-vw) / var(--vw-base))), 40px);
    --clarity-icon-gap: clamp(7px, calc(10px * (var(--max-vw) / var(--vw-base))), 13px);
    --clarity-icon: clamp(31px, calc(44px * (var(--max-vw) / var(--vw-base))), 59px);
  }

  .clarity__card {
    align-items: flex-start;
  }

  /* Desktop: left-aligned, full content width, one line (D-C6) */
  .clarity__title {
    margin-inline: 0;
    text-align: left;
  }

  /* Row of 4 hugging badges, space-between, vertically centred */
  .clarity__badges {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: var(--clarity-icon-gap); /* Figma declares 10; space-between dominates */
  }
}
