/* ==========================================================================
   Family Support
   All selectors are prefixed with "fs" so they never clash with site styles.
   ========================================================================== */

/* ---- Design tokens ------------------------------------------------------ */
.fs {
  --fs-green: #b6ca82;        /* active (selected) figure — same as pills */
  --fs-lime: #b6ca82;         /* pills & accent bar — site's --color--lime-green */
  --fs-green-dark: #7e9c45;   /* source text, focus ring */
  --fs-sage: #e9ecdf;         /* inactive figures */
  --fs-sage-hover: #dbe1cb;   /* inactive figure on hover */
  --fs-ink: #424242;          /* headings & body text — site's --color--dark-gray */
  --fs-line: #c9c9c9;         /* dividers */
  --fs-arc: #b5c27a;          /* decorative arcs — matches the neighbouring green sections */

  /* Type scale — mirrors hatcherfoundation.org (Gotham 400/500/700/900) */
  --fs-text-h2: 3rem;         /* .heading-style-h2 → "Whole Family" */
  --fs-text-h3: 2.5rem;       /* .heading-style-h3 → panel title */
  --fs-text-stat: 1.125rem;   /* stat sentence under the panel title */
  --fs-text-regular: 1rem;    /* .text-size-regular → body copy, challenges */
  --fs-text-tiny: 0.75rem;    /* .text-size-tiny → source */
  --fs-text-label: 0.875rem;  /* uppercase column labels */
  --fs-text-pill: 0.8125rem;  /* pill labels */

  --fs-scale: 1;              /* figure size multiplier (smaller on mobile) */
  --fs-deco-h: clamp(24px, 3.5vw, 64px); /* arc height grows with screen width */

  position: relative;         /* anchor for the absolutely-positioned arcs */
  width: 100%;
  box-sizing: border-box;
  padding: calc(var(--fs-deco-h) + 1.5rem) 1.5rem calc(var(--fs-deco-h) + 2rem);
  font-family: inherit;
  color: var(--fs-ink);
}
.fs *,
.fs *::before,
.fs *::after {
  box-sizing: inherit;
}

/* ---- Decorative arcs ---------------------------------------------------- */
.fs-deco {
  position: absolute;
  left: 0;
  width: 100%;
  height: var(--fs-deco-h);
  fill: var(--fs-arc);
  pointer-events: none;
}
/* Bleed 1px past the edge so no sub-pixel seam shows between the arc and
   the neighbouring section (arc height is fractional because of vw). */
.fs-deco--top    { top: -1px; }
.fs-deco--bottom { bottom: -1px; }

/* ---- Stage: figures row (+ panel when open) ----------------------------- */
.fs-stage {
  display: flex;
  justify-content: center;
  align-items: flex-start;    /* figures line up with the top of the panel */
  gap: 0;
  max-width: 1080px;
  margin: 0 auto 2.75rem;
}
/* The family stands shoulder to shoulder, hands overlapping, exactly as
   spaced in the artwork — in every state, so figures never shift between
   tabs (offsets measured from the design). */
.fs-figure-btn--mom     { margin-left: calc(-8px * var(--fs-scale)); }
.fs-figure-btn--dad     { margin-left: calc(11px * var(--fs-scale)); }
.fs-figure-btn--sibling { margin-left: calc(-12px * var(--fs-scale)); }
.fs.is-open .fs-stage {
  margin-bottom: 0;
}

/* SVG silhouettes: color drives the fill (currentColor), height drives size;
   width follows automatically from each SVG's viewBox. */
.fs-figure {
  display: block;
  width: auto;
  color: var(--fs-sage);
  transition: color 0.25s ease;
}
.fs-figure--child   { height: calc(176px * var(--fs-scale)); }
.fs-figure--mom     { height: calc(300px * var(--fs-scale)); }
.fs-figure--dad     { height: calc(300px * var(--fs-scale)); }
.fs-figure--sibling { height: calc(176px * var(--fs-scale)); }

/* Reset browser button styles so only the silhouette is visible */
.fs-figure-btn {
  /* Every button is as tall as the tallest figure, with its figure pinned to
     the bottom — so all figures share one "floor" wherever the row sits. */
  order: var(--fs-order);
  display: flex;
  align-items: flex-end;
  height: calc(300px * var(--fs-scale));
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
}

/* States: hover = slightly darker sage, selected = brand green */
.fs-figure-btn:hover .fs-figure        { color: var(--fs-sage-hover); }
.fs-figure-btn.is-active .fs-figure    { color: var(--fs-green); }

/* Keyboard focus ring (only shows for keyboard users, not mouse clicks) */
.fs-figure-btn:focus-visible {
  outline: 2px solid var(--fs-green-dark);
  outline-offset: 6px;
  border-radius: 8px;
}

/* ---- Default info row --------------------------------------------------- */
.fs-info {
  display: grid;
  /* Title | What they may face | How we help (wider, so pills sit 2 per row) */
  grid-template-columns: auto 1fr 1.35fr;
  max-width: 860px;
  margin: 0 auto;
}

/* Title cell spans the full row height; the green bar is its right border
   and the title is vertically centred against it. */
.fs-info__title {
  display: flex;
  align-items: center;
  width: min-content;                       /* wraps at every space: "Whole / Family" */
  margin: 0;
  padding-right: 1.5rem;
  border-right: 4px solid var(--fs-lime);   /* green accent bar */
  font-size: var(--fs-text-h2);
  font-weight: 900;
  line-height: 1.05;
}

/* Columns have no inner padding at the divider, so the two label underlines
   meet and read as one continuous line. */
.fs-info__col {
  padding: 0 0 0 2rem;
}
.fs-info__col--help {
  padding: 0;
  border-left: 1px solid var(--fs-line);    /* full-height divider */
}
.fs-info .fs-info__col--help > * {
  padding-left: 2rem;
}

.fs-info__text {
  margin: 1rem 0 0;
  padding-right: 2rem;
  font-size: var(--fs-text-regular);
  font-weight: 500;
  line-height: 1.3;
}

/* ---- Shared: small uppercase label with underline ----------------------- */
.fs-label {
  margin: 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--fs-line);
  font-size: var(--fs-text-label);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---- Shared: service pills ---------------------------------------------- */
.fs-pills {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}
.fs-pills--row   { flex-wrap: wrap; }
.fs-pills--stack { flex-direction: column; align-items: flex-start; }

.fs-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--fs-lime);
  color: #fff;
  font-size: var(--fs-text-pill);
  /* Semi-bold look. The site loads Gotham at 400/500/700/900 only — 600
     would silently fall back to 700, so 500 (Gotham Medium) is used. */
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}

.fs-icon {
  flex-shrink: 0;
  width: 1.3em;
  height: 1.3em;
}

/* ---- Detail panel ------------------------------------------------------- */
.fs-panel {
  order: var(--fs-order);
  /* auto margins on both sides push the figures before the panel to the
     left edge and the figures after it to the right edge */
  margin-inline: auto;
  padding-inline: 2rem;       /* minimum breathing room next to the figures */
  flex: 0 1 540px;
  min-width: 0;
  animation: fs-fade-in 0.35s ease both;
}

.fs-panel__title {
  margin: 0 0 0.5rem;
  font-size: var(--fs-text-h3);
  font-weight: 900;
  line-height: 1.1;
}

.fs-panel__stat {
  margin: 0;
  font-size: var(--fs-text-stat);
  font-weight: 400;
  line-height: 1.3;
}

.fs-panel__source {
  margin: 0.75rem 0 2rem;
  color: var(--fs-lime);
  font-size: var(--fs-text-tiny);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---- Table: challenge (right-aligned) | divider | stacked pills -------- */
.fs-table__row {
  display: grid;
  grid-template-columns: 12rem 1fr;
  border-bottom: 1px solid var(--fs-line);
}
.fs-table__row:last-child {
  border-bottom: 0;
}

/* Vertical divider: border on the left cell of every row */
.fs-table__row > :first-child {
  border-right: 1px solid var(--fs-line);
}

.fs-table__row > * {
  padding: 1.25rem 1rem;
}

.fs-table__row--head > * {
  padding-top: 0;
  padding-bottom: 0.5rem;
  border-bottom: 0;                 /* the row itself draws the line */
}
.fs-table__row--head > :first-child {
  padding-left: 0;
}

.fs-table__challenge {
  margin: 0;
  font-size: var(--fs-text-regular);
  font-weight: 500;
  line-height: 1.3;
  text-align: right;
}

.fs-table .fs-pills {
  margin: 0;
}

/* ---- Animation ---------------------------------------------------------- */
@keyframes fs-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fs-panel,
  .fs-figure { animation: none; transition: none; }
}

/* ==========================================================================
   Mobile (≤ 800px)
   - Figures shrink and always stay together in one row on top.
   - The panel drops below the figures at full width.
   - The default info row stacks into one column.
   ========================================================================== */
@media (max-width: 800px) {
  .fs {
    --fs-scale: 0.65;          /* bigger tap targets on phones */
    padding-inline: 1rem;
  }

  .fs-stage {
    flex-wrap: wrap;
    align-items: flex-end;
  }

  /* Panel: last in the row, full width → wraps onto its own line */
  .fs-panel {
    order: 99;
    flex: 1 1 100%;
    margin: 1.5rem 0 0;
    padding-inline: 0;
  }

  /* Info row: Title / What they may face / How we help, stacked */
  .fs-info {
    grid-template-columns: 1fr;
    row-gap: 1.25rem;
  }
  .fs-info__title {
    width: auto;
    padding: 0 0 0 0.75rem;
    border-right: 0;
    border-left: 4px solid var(--fs-lime);    /* accent bar moves to the left */
  }
  .fs-info__col,
  .fs-info .fs-info__col--help > * {
    padding: 0;
  }
  .fs-info__col--help {
    border-left: 0;
  }
  .fs-info__text {
    padding-right: 0;
  }


  /* Table: narrower left column, pills may wrap their text */
  .fs-table__row {
    grid-template-columns: 40% 1fr;
  }
  .fs-table__row > * {
    padding: 0.85rem 0.6rem;
  }
  .fs-table__row--head > * {
    padding-top: 0;
    padding-bottom: 0.5rem;
  }
  .fs-pill {
    white-space: normal;
  }
}

/* ==========================================================================
   Type scale at the site's breakpoints (same as hatcherfoundation.org)
   ========================================================================== */
@media (max-width: 767px) {
  .fs {
    --fs-text-h2: 2rem;
    --fs-text-h3: 1.75rem;
    --fs-text-stat: 1rem;
    --fs-text-regular: 0.875rem;
    /* small/tiny stay at 0.875/0.75rem — the site drops to 0.6/0.55rem here,
       which is too small for pill labels to stay readable */
  }
}
@media (max-width: 479px) {
  .fs { --fs-text-h2: 1.75rem; }
}

/* Keeps hyphenated words like "go-between" together (see DetailPanel.tsx) */
.fs-nowrap {
  white-space: nowrap;
}

/* ==========================================================================
   Mobile panel (≤ 800px): stacked cards instead of a squeezed 2-col table.
   Each row = challenge (left-aligned, bold) with its pills flowing below at
   full width. The two column headings become one legend line on top:
   "WHAT THEY MAY FACE → HOW WE HELP", matching how each card reads.
   ========================================================================== */
@media (max-width: 800px) {
  .fs-table__row.fs-table__row--head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0 0 0.75rem;
  }
  .fs-table__row--head .fs-label {
    padding: 0;
    border: 0;
  }
  .fs-table__row--head .fs-label + .fs-label::before {
    content: "→";
    margin-right: 0.5rem;
    color: var(--fs-lime);
  }
  .fs-table__row {
    grid-template-columns: 1fr;
    padding: 1.1rem 0;
  }
  .fs-table__row > *,
  .fs-table__row > :first-child {
    padding: 0;
    border-right: 0;
  }
  .fs-table__challenge {
    margin-bottom: 0.65rem;
    font-weight: 700;
    text-align: left;
  }
  .fs-table .fs-pills {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.45rem;
  }
  .fs-pill {
    padding: 0.3rem 0.75rem;
    white-space: nowrap;      /* each pill stays on one line */
  }
}

/* ---- Mobile "← Whole family" link + scroll offset ----------------------- */
.fs-back {
  display: none;                     /* desktop: clicking the figure again is enough */
}
@media (max-width: 800px) {
  .fs-panel {
    scroll-margin-top: 5rem;         /* keep the title clear of a sticky site nav */
  }
  .fs {
    scroll-margin-top: 4rem;
  }
  .fs-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    margin: 0 0 0.75rem;
    padding: 0.5rem 0;               /* comfortable tap height */
    border: 0;
    background: none;
    color: var(--fs-green-dark);
    font: inherit;
    font-size: var(--fs-text-label);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .fs-back:focus-visible {
    outline: 2px solid var(--fs-green-dark);
    outline-offset: 2px;
    border-radius: 4px;
  }
}

