/* Foundations (05 · Foundations, RD2) — prefix: fnd-
   Section order: hero → the problem + calculator → what this is (endowment comparison) → the gift (two options)
   → why not cash → three ways in → Brightwell Society → trust → lead form.
   Sizes are the Figma values at 1440; spacing scales with the viewport (N = figmaPx / 14.4 vw)
   and keeps growing a little past 1440 like the rest of the site. */

.page-foundations {
  --fnd-pt: calc(var(--section-pt) * 0.833);             /* 90 @1440 */
  --fnd-head-gap: min(clamp(48px, 7.083vw, 136px), max(48px, 10.2svh));           /* 102 @1440: section head → content */
  --fnd-gap-90: min(clamp(48px, 6.25vw, 120px), max(48px, 9.0svh));              /* 90 @1440 */
  --fnd-col: calc((100% - 11 * var(--grid-gap)) / 12);   /* one column of the 12-col grid */
}

/* Shared: heading left (6 cols), copy right (5 cols from col 8) */
.fnd-head { --a-span: 6; --b-start: 8; --b-span: 5; }

/* Small blue label: "01", "Option 1" */
.fnd-tag {
  display: inline-block; align-self: flex-start; padding: 6px 9px; border-radius: 3px;
  background: var(--accent); color: var(--white);
  font-size: var(--fs-sm); font-weight: 600; line-height: 1; letter-spacing: 0.14em; text-transform: uppercase;
}

/* ---------- 01 · Hero (shared .hero-panel) ---------- */
.fnd-hero__head { max-width: min(clamp(612px, 42.5vw, 820px), max(612px, 61.2svh)); }
.fnd-hero__title { color: var(--cream); }
.fnd-hero__body { display: grid; justify-items: start; gap: 42px; max-width: min(clamp(546px, 37.9vw, 730px), max(546px, 54.6svh)); }
.fnd-hero__lede { color: var(--cream); line-height: var(--lh-ui); }
@media (max-width: 640px) {
  .fnd-hero__body { gap: 32px; }
  .fnd-hero .btn { width: 100%; }
}

/* ---------- 02 · The problem + calculator ---------- */
.fnd-problem { padding-block: calc(var(--fnd-pt) - 1vw) var(--section-pb); } /* the hero panel hangs ~15px into this section in the Figma */
@media (min-width: 1024px) { .fnd-problem .h2 { text-wrap: wrap; } }
.fnd-calc {
  display: grid; grid-template-columns: minmax(0, 432fr) minmax(0, 816fr); gap: 24px;
  margin-top: var(--fnd-head-gap); padding: clamp(20px, 2.5vw, 48px); background: var(--cream);
}
.fnd-calc__inputs { display: flex; flex-direction: column; justify-content: space-between; gap: 48px; }
.fnd-calc__controls { display: grid; gap: 48px; }
.fnd-calc__title {
  padding-top: 30px; font-family: var(--font-serif); font-weight: 400;
  font-size: clamp(1.5rem, 1.368rem + 0.5634vw, 2rem); line-height: var(--lh-tight); letter-spacing: -0.01em;
}
.fnd-calc__title em { font-style: italic; }
.fnd-calc__form { display: grid; gap: 36px; padding-right: 30px; }
.fnd-calc .field { border-bottom-color: rgba(16, 34, 57, 0.35); }
.fnd-calc .field:focus-within { border-bottom-color: var(--accent); }
.fnd-calc .field input { font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.fnd-calc .field input::-webkit-outer-spin-button,
.fnd-calc .field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fnd-calc__note { max-width: 400px; color: var(--slate); font-size: var(--fs-sm); line-height: var(--lh-body); }

.fnd-calc__panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 30px; background: var(--white); }
.fnd-calc__panel-title {
  padding-bottom: 12px; border-bottom: 1px solid rgba(190, 190, 190, 0.2);
  font-weight: 600; font-size: var(--fs-md); line-height: var(--lh-ui);
}
.fnd-calc__plot { position: relative; display: flex; flex-direction: column; padding-top: 24px; }
.fnd-calc__result { position: absolute; left: 0; top: 29px; z-index: 1; display: grid; gap: 6px; pointer-events: none; }
.fnd-calc__total {
  color: var(--accent); font-size: clamp(2.25rem, 1.854rem + 1.69vw, 3.625rem); line-height: 1; letter-spacing: -0.044em;
  font-variant-numeric: tabular-nums;
}
.fnd-calc__total-label, .fnd-calc__years { color: var(--slate); font-size: var(--fs-md); line-height: var(--lh-body); }
.fnd-calc__badge {
  align-self: flex-end; margin-bottom: 12px; padding: 9px 15px; border-radius: 6px;
  background: var(--accent); color: var(--white); font-size: var(--fs-lg); line-height: 1; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.fnd-calc__chart { position: relative; aspect-ratio: 756 / 333; }
.fnd-calc__svg { width: 100%; height: 100%; overflow: visible; }
.fnd-calc__area { fill: rgba(71, 116, 254, 0.14); }
.fnd-calc__line { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.fnd-calc__base { stroke: var(--line); stroke-width: 2; vector-effect: non-scaling-stroke; }
.fnd-calc__dot {
  position: absolute; left: 100%; top: 0; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--white); transform: translate(-50%, -50%);
}
.fnd-calc__years { display: flex; justify-content: space-between; margin-top: 24px; font-weight: 700; }
.fnd-calc__caption { color: var(--slate); font-size: var(--fs-sm); line-height: var(--lh-body); }

@media (max-width: 1100px) {
  .fnd-calc { grid-template-columns: minmax(0, 1fr); }
  .fnd-calc__form { padding-right: 0; }
}
@media (max-width: 640px) {
  .fnd-calc__panel { padding: 20px 16px; }
  .fnd-calc__result { position: static; margin-bottom: 16px; }
  .fnd-calc__badge { align-self: flex-start; white-space: normal; }
  .fnd-calc__title { padding-top: 8px; }
}

/* ---------- 03 · What this is / endowment comparison ---------- */
.fnd-what { padding-block: var(--fnd-pt) calc(var(--section-pb) * 0.9); }
/* Two cards share one row grid (subgrid) so the title, step list, bar and note line up across both
   cards, and the bar sits right under the steps instead of being pushed to the bottom of a tall card.
   Card 02 (Energy Endowment) is the one we want people drawn to: accent border, lighter surface, glow.
   Card 01 is quieter: hairline border, muted text, dimmed bar. */
.fnd-compare {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto auto auto;
  column-gap: var(--grid-gap); row-gap: 0; margin-top: var(--fnd-gap-90); align-items: start;
}
.fnd-compare__card {
  display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: clamp(28px, 2.6vw, 44px);
  padding: clamp(24px, 2.2vw, 40px); background: #14263D; border: 1px solid rgba(255, 255, 255, 0.14);
  transition: border-color .3s ease, box-shadow .3s ease, transform .3s ease;
}
.fnd-compare__card > * { min-width: 0; }
.fnd-compare__card--new {
  background: #1A3252; border-color: rgba(71, 116, 254, 0.7);
  box-shadow: 0 0 0 1px rgba(71, 116, 254, 0.25), 0 18px 60px -12px rgba(71, 116, 254, 0.35);
}
.fnd-compare__card--new:hover { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(71, 116, 254, 0.4), 0 24px 70px -12px rgba(71, 116, 254, 0.45); }
.fnd-compare__card--old .fnd-steps li { color: var(--slate-light); }
.fnd-compare__card--old .fnd-steps li.is-end { color: var(--white); }
.fnd-compare__card--old .fnd-bar { opacity: .78; }
.fnd-compare__card--old .fnd-tag { background: #2A4466; color: var(--slate-light); }
.fnd-compare__top { display: grid; align-content: start; gap: clamp(28px, 2.6vw, 44px); }
.fnd-compare__head { display: flex; flex-direction: column; gap: 18px; }
.fnd-compare__card--old .fnd-compare__title { color: var(--slate-light); }
/* The two lists are different lengths; this keeps the bars aligned on desktop (first subgrid row grows). */
.fnd-compare__bottom { display: contents; }

.fnd-steps { position: relative; display: grid; gap: 24px; margin: 0; padding: 0; list-style: none; }
.fnd-steps::before { /* the track */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 18px; border-radius: 8px; background: #1E3859;
}
.fnd-steps li { position: relative; padding-left: 36px; font-size: var(--fs-lg); line-height: 1.3; }
.fnd-steps li::before {
  content: ""; position: absolute; left: 0; top: 0.17em; width: 18px; height: 18px; box-sizing: border-box;
  border-radius: 50%; border: 4px solid #1E3859; background: var(--accent);
}
.fnd-steps li.is-end { font-weight: 600; }
.fnd-steps li.is-end::before { background: var(--white); }

.fnd-bar { display: flex; min-height: 66px; padding: 2px; border: 1px solid #1E3859; border-radius: 6px; background: #254267; }
.fnd-compare__card--new .fnd-bar { border-color: #254267; }
.fnd-bar span {
  display: flex; align-items: center; justify-content: center; padding: 16px 8px;
  font-size: var(--fs-sm); font-weight: 700; line-height: 1; letter-spacing: 0.06em; text-transform: uppercase;
}
.fnd-bar__mission { flex: 1 1 100%; background: var(--accent); color: var(--white); }
.fnd-bar__mission--part { flex: 0 0 64%; }
.fnd-bar__meter { flex: 1 1 auto; color: var(--slate-light); }
.fnd-compare__note { font-size: var(--fs-md); line-height: var(--lh-body); }
.fnd-compare__card--old .fnd-compare__note { color: var(--slate-light); }

@media (max-width: 900px) {
  .fnd-compare { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: 24px; }
  .fnd-compare__card { grid-row: auto; grid-template-rows: none; }
}

/* ---------- 04 · The gift / two options ---------- */
.fnd-gift { padding-block: var(--fnd-pt) var(--section-pb); }
.fnd-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: var(--fnd-head-gap); }
.fnd-option { display: flex; flex-direction: column; justify-content: space-between; gap: 47px; padding: 24px; background: var(--white); }
.fnd-option__head { display: flex; flex-direction: column; gap: 18px; }
.fnd-option__stats { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 35px; min-height: 132px; margin-top: 33px; }
.fnd-stat { display: grid; align-content: end; gap: 5px; width: 200px; max-width: 100%; }
.fnd-stat__pre {
  margin-bottom: 1px; color: var(--slate);
  font-size: var(--fs-sm); font-weight: 600; line-height: 1; letter-spacing: 0.12em; text-transform: uppercase;
}
.fnd-stat__num {
  color: var(--accent); font-size: clamp(2.75rem, 2.046rem + 3.005vw, 5.25rem); line-height: 0.9; letter-spacing: -0.035em;
}
.fnd-stat__label { color: var(--slate); font-size: var(--fs-sm); font-weight: 500; line-height: 1.35; }
.fnd-option__plus { align-self: center; color: var(--line); font-size: 40px; font-weight: 300; line-height: 1; }
.fnd-gift__notes { display: grid; gap: 18px; margin-top: 60px; }
.fnd-guard {
  max-width: calc(var(--fnd-col) * 8 + 7 * var(--grid-gap)); padding-left: 20px; border-left: 2px solid var(--accent);
  font-size: var(--fs-md); line-height: var(--lh-body);
}

@media (min-width: 1024px) {
  .fnd-option { min-height: min(29.86vw, 540px); }
}
@media (max-width: 900px) {
  .fnd-options { grid-template-columns: minmax(0, 1fr); }
  .fnd-gift__notes { margin-top: 40px; }
  .fnd-guard, .fnd-portfolio p { max-width: var(--measure); }
}
@media (max-width: 640px) {
  .fnd-option__stats { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; min-height: 0; gap: 12px 16px; }
  .fnd-stat { width: auto; }
}

/* ---------- 05 · Why not cash ---------- */
.fnd-cash { padding-block: var(--fnd-pt) var(--section-pb); }
.fnd-cash__grid { --a-span: 5; --b-start: 7; --b-span: 6; }
.fnd-cash__copy { display: grid; gap: 30px; }
.fnd-cash__image { aspect-ratio: 660 / 710; }
@media (max-width: 900px) {
  .fnd-cash__grid { row-gap: 40px; }
  .fnd-cash__image { aspect-ratio: 4 / 3; }
}

/* ---------- 06 · Three ways in ---------- */
.fnd-ways { padding-block: min(clamp(64px, 7.083vw, 136px), max(64px, 10.2svh)) var(--section-pb); }
.fnd-ways__grid { margin-top: var(--fnd-gap-90); }
.fnd-way { --card-h: 0px; aspect-ratio: 432 / 469; padding: 24px 42px 18px 18px; }
.fnd-way__panel { display: flex; flex-direction: column; gap: 36px; min-height: min(300px, 100%); }
.fnd-way__icon { display: grid; place-items: center; width: 42px; height: 42px; background: var(--accent-light); color: var(--white); }
.fnd-way__icon svg { width: 24px; height: 24px; fill: currentColor; }
.fnd-way__copy { display: grid; gap: 12px; padding-right: 30px; }
.fnd-portfolio {
  display: grid; gap: 15px; margin-top: var(--fnd-gap-90); padding-top: 43px;
  border-top: 1px solid var(--line);
}
.fnd-portfolio p { max-width: calc(var(--fnd-col) * 8 + 7 * var(--grid-gap)); }

@media (max-width: 1279px) {
  .fnd-ways__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .fnd-way { aspect-ratio: auto; padding: 140px 18px 18px; }
  .fnd-way__panel { min-height: 0; gap: 24px; }
  .fnd-way__copy { padding-right: 0; }
}
@media (max-width: 640px) {
  .fnd-ways__grid { grid-template-columns: minmax(0, 1fr); }
  .fnd-way { padding: 160px 12px 12px; }
}

/* ---------- 07 · The Brightwell Society ---------- */
.fnd-society { padding-block: var(--fnd-pt); }
.fnd-society__list { margin: var(--fnd-gap-90) 0 0; padding: 0; list-style: none; row-gap: 48px; }
.fnd-society__item { display: flex; flex-direction: column; gap: 60px; padding: 0 36px 0 18px; border-left: 1px solid rgba(255, 255, 255, 0.18); }
.fnd-society__head { display: grid; gap: 9px; }
.fnd-society__num { color: var(--accent-light); font-size: var(--fs-md); line-height: var(--lh-body); }
.fnd-society__title {
  min-height: 2.48em; font-family: var(--font-sans); font-weight: 400;
  font-size: clamp(1.25rem, 1.162rem + 0.3756vw, 1.625rem); line-height: var(--lh-snug); letter-spacing: -0.01em;
}
@media (max-width: 1279px) {
  .fnd-society__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fnd-society__item { gap: 24px; }
  .fnd-society__title { min-height: 0; }
}
@media (max-width: 640px) {
  .fnd-society__list { grid-template-columns: minmax(0, 1fr); row-gap: 36px; }
  .fnd-society__item { padding-right: 0; }
}

/* ---------- 08 · Trust ---------- */
.fnd-trust { padding-block: var(--fnd-pt) var(--section-pb); }
.fnd-trust__grid { --a-span: 5; --b-start: 7; --b-span: 6; }
.fnd-trust__image { aspect-ratio: 546 / 710; }
.fnd-trust__image img { object-position: 30% 50%; }
.fnd-trust__copy { display: grid; justify-items: start; gap: 30px; }
@media (max-width: 900px) {
  .fnd-trust__grid { row-gap: 40px; }
  .fnd-trust__image { aspect-ratio: 4 / 3; }
}
@media (max-width: 640px) {
  .fnd-trust__copy .btn { width: 100%; }
}

/* ---------- 09 · Lead form (shared .contact) ---------- */
.page-foundations .contact .form__note { color: var(--white); }
