/* ============================================================
   why-klar — "Why Klar Stands Apart" (brief/why-klar.md)
   Figma: desktop 3446:762 (1440, table 1126 centred) · mobile 3446:1808 (375, table 335)
   Pattern B-edge: #FFFFFF band on the section, content in the page gutter (.container).
   Comparison table via pipeline/templates/code/comparison-table.md — <table>, 3 equal
   columns, highlight = middle (brand) column.
   Row geometry (D-WK-2): every body row box is a FIXED 40 (overflowing 3-line mobile labels
   do not grow the row); cells pad (half-gap - 0.5) above/below, rows 2-6 draw the 1px
   divider as border-top → pitch exactly 60 on both layers.
   Fluid values per pipeline/components/fluid-formulas.md (brief §2 fluid table).
   ============================================================ */

/* ---------- MOBILE (base, anchor 375) ---------- */
.why-klar {
  /* section padding-block: M 40 (34..80) */
  --wk-pb: clamp(34px, calc(40px + (var(--max-vw) - 375px) * 0.015), 80px);
  /* heading → table: M 20 (17..40) */
  --wk-gap: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 40px);
  /* header cell padding-block: M 20 (17..20) */
  --wk-head-pb: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 20px);
  /* body row content box: M 40 (34..40) */
  --wk-box: clamp(34px, calc(40px + (var(--max-vw) - 375px) * 0.015), 40px);
  /* row box → divider: M 10 (9..10) */
  --wk-half: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 10px);
  /* ✓ / ✕ icon box: M 19 (16..19) */
  --wk-icon: clamp(16px, calc(19px + (var(--max-vw) - 375px) * 0.015), 19px);
  /* brand head inline padding: M 2.33 (2..2.33) → 107 text measure in a 111.67 column */
  --wk-brand-px: clamp(2px, calc(2.33px + (var(--max-vw) - 375px) * 0.015), 2.33px);
  /* label cell padding-right: M 4.67 (4..4.67) → 107 text box */
  --wk-label-pr: clamp(4px, calc(4.67px + (var(--max-vw) - 375px) * 0.015), 4.67px);
  /* table bottom padding: 0 below 1024 (mobile table frame FIXED 416, D-WK-12) */
  --wk-table-pb: 0px;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--wk-gap);
  padding-top: var(--wk-pb);
  padding-bottom: var(--wk-pb);
  background-color: var(--color-surface);
}

.why-klar__title {
  width: 100%;
  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);
  text-align: center;
}

/* ---------- Table ---------- */
.why-klar__table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;   /* cell radii on the brand column */
  border-spacing: 0;
  padding-bottom: var(--wk-table-pb);
  font-family: var(--font-body);
  color: var(--color-text);
}

/* Header row — all three heads top-aligned at padding-top 20 (D-WK-3) */
.why-klar__th {
  padding-top: var(--wk-head-pb);
  padding-bottom: var(--wk-head-pb);
  vertical-align: top;
  font-size: var(--text-label);
  font-weight: 500;
  line-height: var(--lh-ui);
  color: var(--color-text);
}

.why-klar__th-text {
  display: inline-block;
  max-width: 100%;
}

.why-klar__th--label {
  text-align: left;
  text-transform: capitalize;  /* Figma textCase TITLE */
}

.why-klar__th--brand {
  padding-left: var(--wk-brand-px);
  padding-right: var(--wk-brand-px);
  text-align: center;
  border-radius: 5px 5px 0 0;
  background-image: linear-gradient(116.86deg, #EEF0E5 1.65%, #D9E0C7 106.6%);
}

.why-klar__th--others {
  text-align: center;
}

/* Body cells */
.why-klar__cell {
  padding-top: calc(var(--wk-half) - 0.5px);
  padding-bottom: calc(var(--wk-half) - 0.5px);
  vertical-align: middle;
  font-weight: 400;
  text-align: left;
}

.why-klar__row:first-child .why-klar__cell { padding-top: 0; }
.why-klar__row:last-child .why-klar__cell { padding-bottom: 0; }

.why-klar__row + .why-klar__row .why-klar__cell {
  border-top: 1px solid var(--color-divider-table);
}

.why-klar__cell--label {
  padding-right: var(--wk-label-pr);
}

/* Brand column body: #FFFFFF + #D9DCC6 @ 20 % (= #F7F8F4), continuous under the dividers */
.why-klar__cell--brand {
  background-color: var(--color-surface);
  background-image: linear-gradient(rgba(217, 220, 198, 0.2), rgba(217, 220, 198, 0.2));
}

.why-klar__row:last-child .why-klar__cell--brand {
  border-radius: 0 0 5px 5px;
}

/* FIXED 40 row box; a taller label overflows it symmetrically (never clip — D-WK-2) */
.why-klar__box {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--wk-box);
}

.why-klar__cell--label .why-klar__box {
  justify-content: flex-start;
}

.why-klar__label {
  display: block;
  width: 100%;
  font-size: var(--text-body-sm);
  line-height: var(--lh-ui);
  color: var(--color-text);
}

.why-klar__icon {
  display: block;
  flex: 0 0 auto;
  width: var(--wk-icon);
  height: var(--wk-icon);
}

/* ---------- PSEUDO-TABLET 768–1023 (no Figma layer; FD-BL) ----------
   Heading: stack-centred, one line. Table: desktop-compressed — same 3 columns at 100 %
   of the content box; the extra width is shared by the columns (labels 1–2 lines inside the
   unchanged 40 box), icons stay centred. 1126 cap + 40 table padding start at 1024. */
@media (min-width: 768px) {
  .why-klar {
    --wk-pb: clamp(45.88px, calc(45.88px + (var(--max-vw) - 768px) * 0.025), 80px);
    --wk-gap: clamp(25.88px, calc(25.88px + (var(--max-vw) - 768px) * 0.025), 40px);
    --wk-head-pb: 20px;
    --wk-box: 40px;
    --wk-half: 10px;
    --wk-icon: 19px;
    --wk-brand-px: 2.33px;
    --wk-label-pr: 4.67px;
  }
}

/* ---------- DESKTOP 1024+ (scales from --vw-base 1440, capped at 1920) ---------- */
@media (min-width: 1024px) {
  .why-klar {
    --wk-pb: clamp(57px, calc(80px * (var(--max-vw) / var(--vw-base))), 107px);
    --wk-gap: clamp(28px, calc(40px * (var(--max-vw) / var(--vw-base))), 53px);
    --wk-head-pb: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --wk-box: clamp(28px, calc(40px * (var(--max-vw) / var(--vw-base))), 53px);
    --wk-half: clamp(7px, calc(10px * (var(--max-vw) / var(--vw-base))), 13px);
    --wk-icon: clamp(14px, calc(19px * (var(--max-vw) / var(--vw-base))), 25px);
    --wk-brand-px: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --wk-label-pr: 0px;
    --wk-table-pb: clamp(28px, calc(40px * (var(--max-vw) / var(--vw-base))), 53px);
  }

  .why-klar__title {
    max-width: clamp(395px, calc(555px * (var(--max-vw) / var(--vw-base))), 740px);
  }

  /* desktop-specific: 1126 table centred inside the 1360 content (D-WK-11) */
  .why-klar__table {
    width: clamp(801px, calc(1126px * (var(--max-vw) / var(--vw-base))), 1501px);
    max-width: 100%;
  }

  .why-klar__th--brand {
    background-image: linear-gradient(154.04deg, #EEF0E5 1.65%, #D9E0C7 106.6%);
  }
}
