/* ============================================================
   plan — "Your 3-Month Drainage Plan" (brief/plan.md)
   Desktop 3446:659 (1360 x 911) · Mobile 3446:1709 (335 x 1359.28)
   Pattern A: `.plan.container`, gutter only, no background, padding-block 0.
   Mobile-first: base = <768 · 768–1023 pseudo-tablet (split row, D-PL-2) · 1024+ desktop.
   Section-local tokens per slice §5.1 (fluid-formulas.md; values generated, not eyeballed).
   ============================================================ */

.plan {
  /* ---- section tokens: MOBILE (0–767) ---- */
  --plan-head-gap: clamp(13px, calc(15px + (var(--max-vw) - 375px) * 0.015), 20px);
  --plan-block-gap: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 40px);
  --plan-left-gap: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 40px);
  --plan-rail-w: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 10px);
  --plan-rail-gap: clamp(4px, calc(5px + (var(--max-vw) - 375px) * 0.015), 20px);
  --plan-step1-pt: clamp(3px, calc(4px + (var(--max-vw) - 375px) * 0.015), 4px);
  --plan-step-pt: clamp(26px, calc(30px + (var(--max-vw) - 375px) * 0.015), 30px);
  --plan-step-inner: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 20px);
  --plan-list-gap: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 10px);
  --plan-check-gap: clamp(4px, calc(5px + (var(--max-vw) - 375px) * 0.015), 5px);
  --plan-icon: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 20px);
  --plan-badge-w: clamp(94px, calc(110px + (var(--max-vw) - 375px) * 0.015), 124px);
  --plan-badge-px: clamp(5px, calc(6px + (var(--max-vw) - 375px) * 0.015), 12px);
  --plan-badge-py: clamp(5px, calc(6px + (var(--max-vw) - 375px) * 0.015), 6px);
  --plan-badge-gap: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 10px);
  --plan-dot: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 10px);
  --plan-dot1-top: clamp(14px, calc(16px + (var(--max-vw) - 375px) * 0.015), 16px);
  --plan-dot-top: clamp(36px, calc(42px + (var(--max-vw) - 375px) * 0.015), 42px);
  --plan-howto-pad: clamp(13px, calc(15px + (var(--max-vw) - 375px) * 0.015), 20px);
  --plan-howto-img-w: clamp(49px, calc(58px + (var(--max-vw) - 375px) * 0.015), 78px);
  --plan-media-gap: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 20px);
  --plan-cta-gap: clamp(14px, calc(16px + (var(--max-vw) - 375px) * 0.015), 16px);
  --plan-shield-gap: clamp(5px, calc(6px + (var(--max-vw) - 375px) * 0.015), 6px);
  /* mobile-only (stacked body, drawn fixed-height step rows — D-PL-9) */
  --plan-stack-gap: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 20px);
  --plan-step1-minh: clamp(119px, calc(139px + (var(--max-vw) - 375px) * 0.015), 139px);
  --plan-step-minh: clamp(177px, calc(208px + (var(--max-vw) - 375px) * 0.015), 208px);

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--plan-block-gap);
}

/* ---------- Heading block (5.2) ---------- */
.plan__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--plan-head-gap);
  width: 100%;
  text-align: center;
}
.plan__title {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-display);
  font-size: var(--text-title);
  font-weight: 400;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-heading);
  color: var(--color-brand);
}
.plan__intro {
  font-size: var(--text-lead);
  font-weight: 400;
  line-height: var(--lh-ui); /* plan lead = 1.25 (D-PL-14) */
  color: var(--color-text);
}

/* ---------- Body row (5.3) ---------- */
.plan__body {
  display: flex;
  flex-direction: column;
  gap: var(--plan-stack-gap);
  width: 100%;
}
.plan__main {
  display: flex;
  flex-direction: column;
  gap: var(--plan-left-gap);
  min-width: 0;
}

/* ---------- Timeline (5.4) ---------- */
.plan__step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--plan-rail-gap);
  min-height: var(--plan-step-minh);
}
.plan__step:first-child { min-height: var(--plan-step1-minh); }

.plan__rail {
  position: relative;
  flex: none;
  align-self: stretch;
  width: var(--plan-rail-w);
}
/* connector: from this step's dot centre to the next step's dot centre (owned by the step it starts from) */
.plan__line {
  position: absolute;
  left: calc((var(--plan-rail-w) - 1.5px) / 2);
  width: 1.5px;
  top: calc(var(--plan-dot-top) + var(--plan-dot) / 2);
  bottom: calc(-1 * (var(--plan-dot-top) + var(--plan-dot) / 2));
  background: var(--color-stone);
}
.plan__step:first-child .plan__line { top: calc(var(--plan-dot1-top) + var(--plan-dot) / 2); }
.plan__dot {
  position: absolute;
  left: calc((var(--plan-rail-w) - var(--plan-dot)) / 2);
  top: var(--plan-dot-top);
  width: var(--plan-dot);
  height: var(--plan-dot);
  border-radius: var(--radius-round);
  background: var(--color-stone);
}
.plan__step:first-child .plan__dot { top: var(--plan-dot1-top); }

.plan__step-body {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--plan-step-inner);
  padding-top: var(--plan-step-pt);
}
.plan__step:first-child .plan__step-body { padding-top: var(--plan-step1-pt); }

.plan__step-head {
  display: flex;
  align-items: center;
  gap: var(--plan-badge-gap);
}
.plan__badge {
  flex: none;
  display: flex;
  justify-content: center;
  width: var(--plan-badge-w);
  padding: var(--plan-badge-py) var(--plan-badge-px);
  border-radius: var(--radius-pill);
  background: var(--color-stone);
  color: var(--color-white);
  font-size: var(--text-label);
  font-weight: 500;
  line-height: var(--lh-ui);
  white-space: nowrap; /* "Weeks 8–12" overhangs its padding box as drawn — never clip (D-PL-13) */
}
.plan__step-title {
  flex: 1 1 0;
  min-width: 0;
  font-size: var(--text-h4);
  font-weight: 500;
  line-height: var(--lh-ui);
  color: var(--color-ink);
}

.plan__checks {
  display: flex;
  flex-direction: column;
  gap: var(--plan-list-gap);
}
.plan__check {
  display: flex;
  align-items: flex-start;
  gap: var(--plan-check-gap);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--lh-ui);
  color: var(--color-text);
}
.plan__check > span { flex: 1 1 0; min-width: 0; }
.plan__check-icon {
  flex: none;
  width: var(--plan-icon);
  height: var(--plan-icon);
}

/* Mobile progress state (BA-PL-1 / D-PL-10). Only when js/plan.js armed it (<768, motion allowed):
   no-JS, >=768 and reduced-motion all render every step at full opacity. */
@media (max-width: 767px) {
  .plan.js-progress .plan__step:not(.is-active) .plan__step-body,
  .plan.js-progress .plan__step:not(.is-active) .plan__dot,
  .plan.js-progress .plan__step:not(.is-active) .plan__line {
    opacity: 0.2;
  }
  .plan.js-progress.is-ready .plan__step-body,
  .plan.js-progress.is-ready .plan__dot,
  .plan.js-progress.is-ready .plan__line {
    transition: opacity .4s ease;
  }
}

/* ---------- Directions card (5.5) ---------- */
.plan__howto {
  display: flex;
  align-items: center;
  gap: var(--plan-list-gap);
  padding: var(--plan-howto-pad);
  border-radius: var(--radius-card);
  background: rgba(177, 181, 165, 0.1); /* stone @10% (drawn #B1B5A51A) */
}
.plan__howto-img {
  flex: none;
  width: var(--plan-howto-img-w);
  height: auto;
  aspect-ratio: 78 / 79;
}
.plan__howto-body {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--plan-list-gap);
}
.plan__howto-title {
  font-size: var(--text-h4);
  font-weight: 500;
  line-height: var(--lh-ui);
  color: var(--color-ink);
}

/* ---------- Media column (5.6) ---------- */
.plan__media {
  display: flex;
  flex-direction: column;
  gap: var(--plan-media-gap);
  min-width: 0;
}
.plan__photo {
  width: 100%;
  height: auto;
  aspect-ratio: 651 / 366;
  object-fit: cover;
  border-radius: 2.573px; /* mobile radius as drawn (D-PL-5) */
}
.plan__collage,
.plan__collage img {
  display: block;
  width: 100%;
}
.plan__collage img {
  height: auto;
  aspect-ratio: 388 / 242;
  border-radius: 4.317px; /* baked into A3; kept honest on the box (D-PL-5) */
}
.plan__bottle { display: none; } /* desktop-only asset (D-PL-6) */

/* ---------- CTA block (5.7) ---------- */
.plan__cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--plan-cta-gap);
  width: 100%;
}
.plan__cta-btn { width: 100%; }
.plan__refund {
  /* F-PL-1: as drawn — fixed 254 box centred under the CTA, content left-aligned inside it
     (icon + text sit 18px left of the button axis), same construction as delivery/difference. */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: clamp(217px, calc(254px + (var(--max-vw) - 375px) * 0.015), 254px);
  gap: var(--plan-shield-gap);
  font-size: var(--text-small);
  font-weight: 400;
  line-height: var(--lh-ui);
  color: var(--color-ink);
  white-space: nowrap;
}
.plan__refund img {
  flex: none;
  width: var(--plan-icon);
  height: var(--plan-icon);
}

/* ============================================================
   PSEUDO-TABLET 768–1023 — desktop structure from 768 (split-row rule, D-PL-2)
   ============================================================ */
@media (min-width: 768px) {
  .plan {
    --plan-head-gap: clamp(20px, calc(20px + (var(--max-vw) - 768px) * 0.025), 20px);
    --plan-block-gap: clamp(25.88px, calc(25.88px + (var(--max-vw) - 768px) * 0.025), 40px);
    --plan-left-gap: clamp(25.88px, calc(25.88px + (var(--max-vw) - 768px) * 0.025), 40px);
    --plan-rail-w: clamp(10px, calc(10px + (var(--max-vw) - 768px) * 0.025), 10px);
    --plan-rail-gap: clamp(10.88px, calc(10.88px + (var(--max-vw) - 768px) * 0.025), 20px);
    --plan-step1-pt: clamp(4px, calc(4px + (var(--max-vw) - 768px) * 0.025), 4px);
    --plan-step-pt: clamp(30px, calc(30px + (var(--max-vw) - 768px) * 0.025), 30px);
    --plan-step-inner: clamp(20px, calc(20px + (var(--max-vw) - 768px) * 0.025), 20px);
    --plan-list-gap: clamp(10px, calc(10px + (var(--max-vw) - 768px) * 0.025), 10px);
    --plan-check-gap: clamp(5px, calc(5px + (var(--max-vw) - 768px) * 0.025), 5px);
    --plan-icon: clamp(20px, calc(20px + (var(--max-vw) - 768px) * 0.025), 20px);
    --plan-badge-w: clamp(115.88px, calc(115.88px + (var(--max-vw) - 768px) * 0.025), 124px);
    --plan-badge-px: clamp(11.88px, calc(11.88px + (var(--max-vw) - 768px) * 0.025), 12px);
    --plan-badge-py: clamp(6px, calc(6px + (var(--max-vw) - 768px) * 0.025), 6px);
    --plan-badge-gap: clamp(10px, calc(10px + (var(--max-vw) - 768px) * 0.025), 10px);
    --plan-dot: clamp(10px, calc(10px + (var(--max-vw) - 768px) * 0.025), 10px);
    --plan-dot1-top: clamp(16px, calc(16px + (var(--max-vw) - 768px) * 0.025), 16px);
    --plan-dot-top: clamp(42px, calc(42px + (var(--max-vw) - 768px) * 0.025), 42px);
    --plan-howto-pad: clamp(20px, calc(20px + (var(--max-vw) - 768px) * 0.025), 20px);
    --plan-howto-img-w: clamp(63.88px, calc(63.88px + (var(--max-vw) - 768px) * 0.025), 78px);
    --plan-media-gap: clamp(15.88px, calc(15.88px + (var(--max-vw) - 768px) * 0.025), 20px);
    --plan-cta-gap: clamp(16px, calc(16px + (var(--max-vw) - 768px) * 0.025), 16px);
    --plan-shield-gap: clamp(6px, calc(6px + (var(--max-vw) - 768px) * 0.025), 6px);
    /* desktop-structure tokens in the band (no mobile counterpart: continue from the stacked values) */
    --plan-head-max: 962px;
    --plan-col-gap: clamp(25.88px, calc(25.88px + (var(--max-vw) - 768px) * 0.025), 39px);
    --plan-gallery-gap: clamp(15.88px, calc(15.88px + (var(--max-vw) - 768px) * 0.025), 20px);
    --plan-cta-w: clamp(340.88px, calc(340.88px + (var(--max-vw) - 768px) * 0.025), 440px);
  }

  .plan__head { max-width: min(var(--plan-head-max), 85%); }

  .plan__body {
    display: grid;
    grid-template-columns: minmax(0, 670fr) minmax(0, 651fr); /* D-PL-1 */
    column-gap: var(--plan-col-gap);
    align-items: stretch;
  }

  /* desktop rows = content height; all steps active */
  .plan__step,
  .plan__step:first-child { min-height: 0; }

  /* media column stretches; the photo absorbs any extra height so both columns end flush */
  .plan__photo {
    flex: 1 0 auto;
    border-radius: var(--radius-card);
  }
  .plan__gallery {
    display: grid;
    grid-template-columns: minmax(0, 388fr) minmax(0, 242fr);
    column-gap: var(--plan-gallery-gap);
    align-items: center;
  }
  .plan__collage img { border-radius: var(--radius-card); }
  .plan__bottle {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-round);
  }

  .plan__cta { width: var(--plan-cta-w); }
}

/* ============================================================
   DESKTOP 1024+ — scales from --vw-base 1440
   ============================================================ */
@media (min-width: 1024px) {
  .plan {
    --plan-head-gap: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --plan-block-gap: clamp(28px, calc(40px * (var(--max-vw) / var(--vw-base))), 53px);
    --plan-left-gap: clamp(28px, calc(40px * (var(--max-vw) / var(--vw-base))), 53px);
    --plan-rail-w: clamp(7px, calc(10px * (var(--max-vw) / var(--vw-base))), 13px);
    --plan-rail-gap: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --plan-step1-pt: clamp(3px, calc(4px * (var(--max-vw) / var(--vw-base))), 5px);
    --plan-step-pt: clamp(21px, calc(30px * (var(--max-vw) / var(--vw-base))), 40px);
    --plan-step-inner: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --plan-list-gap: clamp(7px, calc(10px * (var(--max-vw) / var(--vw-base))), 13px);
    --plan-check-gap: clamp(4px, calc(5px * (var(--max-vw) / var(--vw-base))), 7px);
    --plan-icon: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --plan-badge-w: clamp(88px, calc(124px * (var(--max-vw) / var(--vw-base))), 165px);
    --plan-badge-px: clamp(9px, calc(12px * (var(--max-vw) / var(--vw-base))), 16px);
    --plan-badge-py: clamp(4px, calc(6px * (var(--max-vw) / var(--vw-base))), 8px);
    --plan-badge-gap: clamp(7px, calc(10px * (var(--max-vw) / var(--vw-base))), 13px);
    --plan-dot: clamp(7px, calc(10px * (var(--max-vw) / var(--vw-base))), 13px);
    --plan-dot1-top: clamp(11px, calc(16px * (var(--max-vw) / var(--vw-base))), 21px);
    --plan-dot-top: clamp(30px, calc(42px * (var(--max-vw) / var(--vw-base))), 56px);
    --plan-howto-pad: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --plan-howto-img-w: clamp(55px, calc(78px * (var(--max-vw) / var(--vw-base))), 104px);
    --plan-media-gap: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --plan-cta-gap: clamp(11px, calc(16px * (var(--max-vw) / var(--vw-base))), 21px);
    --plan-shield-gap: clamp(4px, calc(6px * (var(--max-vw) / var(--vw-base))), 8px);
    --plan-head-max: clamp(684px, calc(962px * (var(--max-vw) / var(--vw-base))), 1283px);
    --plan-col-gap: clamp(28px, calc(39px * (var(--max-vw) / var(--vw-base))), 52px);
    --plan-gallery-gap: clamp(14px, calc(20px * (var(--max-vw) / var(--vw-base))), 27px);
    --plan-cta-w: clamp(313px, calc(440px * (var(--max-vw) / var(--vw-base))), 587px);
  }

  .plan__head { max-width: var(--plan-head-max); }
}

/* F-PL-1 refund box width per band (matches delivery's --dl-refund-box) */
@media (min-width: 768px) {
  .plan__refund { width: 254px; }
}
@media (min-width: 1024px) {
  .plan__refund { width: clamp(181px, calc(254px * (var(--max-vw) / var(--vw-base))), 339px); }
}
