/* ==========================================================================
   Great Trek -- the enrolment form
   Also used by /profile, which reuses the member-card component verbatim.
   ========================================================================== */

.enrol { max-width: 52rem; }

/* ---- Progress rail: survey ticks, never a percentage bar ------------------
   Percentages invite the question "how much is left?". Named steps answer it. */
.steps { display: flex; gap: 0; margin-bottom: var(--s-6); }
.steps__node {
  flex: 1;
  position: relative;
  border: 0;
  background: none;
  border-top: 2px solid var(--rule-strong);
  padding: var(--s-3) var(--s-2) 0;
  text-align: left;
  font: inherit;
  color: var(--on-surface-dim);
  cursor: default;
}
.steps__node::before {
  content: "";
  position: absolute;
  left: 0; top: -2px;
  width: 2px; height: 10px;
  background: var(--rule-strong);
}
.steps__node[data-state="done"] { cursor: pointer; color: var(--on-surface); border-top-color: var(--sunrise); }
.steps__node[data-state="done"]::before { background: var(--sunrise); }
.steps__node[data-state="current"] { color: var(--on-surface); border-top-color: var(--sunrise); }
.steps__node[data-state="current"]::before { background: var(--sunrise); height: 18px; }
.steps__n { display: block; font-size: var(--fs-micro); font-weight: var(--w-bold); letter-spacing: var(--tr-micro); }
.steps__name { display: block; font-size: var(--fs-micro); margin-top: 2px; }
@media (max-width: 38rem) { .steps__name { display: none; } }

.step-label { font-size: var(--fs-small); font-weight: var(--w-semi); color: var(--on-surface-dim); margin-bottom: var(--s-3); }

.enrol__panel { display: none; }
.enrol__panel.is-active { display: block; }
/* No JS: every panel is visible and the whole form posts at once. */
.no-js .enrol__panel { display: block; margin-bottom: var(--s-8); }

.enrol__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); align-items: center; }
.enrol__actions .btn--ghost { margin-right: auto; }

/* ==========================================================================
   Member cards

   The one pill radius in the system. Everything else on this site is square:
   plots are rectangular, people are not. The contrast is deliberate.
   ========================================================================== */
/* ==========================================================================
   The member list

   ROWS, not a card grid. The original pill-shaped cards in an auto-fill grid
   forced ~15rem columns, so a long occupation label ("Writer / Copywriter /
   Journalist") wrapped across three lines while most of the card sat empty.
   A list of rows reads faster, scans vertically the way a household actually
   does, and gives long labels the full width.

   The "plots are rectangular, people are not" idea survives where it is
   legible: as a small pill role-chip INSIDE each row, rather than deforming
   the whole card.

   Row order is numbered with a CSS counter so the server template and the
   script's buildCard() need no extra markup and stay byte-identical.
   ========================================================================== */
.members {
  display: grid;
  gap: var(--s-2);
  grid-template-columns: 1fr;
  counter-reset: member;
}

.member {
  position: relative;
  counter-increment: member;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
  border: var(--hair) solid var(--rule);
  border-radius: var(--r-2);
  transition: border-color var(--t), background-color var(--t);
}
.member:hover { border-color: var(--rule-strong); }
.member.is-new { animation: memberIn var(--t-slow) var(--ease-out); }
@keyframes memberIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.member.is-flash { border-color: var(--sunrise); }

.member__body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: var(--s-4);
  row-gap: var(--s-2);
  min-width: 0;
}

/* 01, 02, 03 — the same numbering used by the stage rail and the timeline.
   On .member rather than .member__body so it survives the confirm flip. */
.member::before {
  content: counter(member, decimal-leading-zero);
  font-size: var(--fs-micro);
  font-weight: var(--w-bold);
  letter-spacing: var(--tr-micro);
  font-variant-numeric: tabular-nums;
  color: var(--on-surface-dim);
}

/* The one pill left in the system, at the scale where it reads as a label. */
.member__role {
  justify-self: start;
  padding: 0.2rem 0.6rem;
  border: var(--hair) solid var(--rule-strong);
  border-radius: var(--r-human);
  font-size: var(--fs-micro);
  font-weight: var(--w-bold);
  letter-spacing: var(--tr-micro);
  text-transform: uppercase;
  color: var(--accent-text);
  white-space: nowrap;
}

.member__who {
  font-weight: var(--w-semi);
  font-size: var(--fs-body);
  min-width: 0;
  overflow-wrap: anywhere;
}

.member__meta {
  font-size: var(--fs-small);
  color: var(--on-surface-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.member__actions { display: flex; gap: var(--s-4); }
.member__actions button {
  background: none; border: 0; padding: 0;
  font: inherit; font-size: var(--fs-small); font-weight: var(--w-semi);
  color: var(--accent-text); cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}
.member__actions button.is-danger { color: var(--on-surface-dim); }
.member__actions button.is-danger:hover { color: var(--sunrise-deep); }
[data-surface="ink"] .member__actions button.is-danger:hover,
[data-surface="ink-sink"] .member__actions button.is-danger:hover { color: var(--sunrise); }

/* Narrow: two lines rather than five squeezed columns. */
@media (max-width: 44rem) {
  .member { align-items: start; }
  .member::before { padding-top: 0.2rem; }
  .member__body { grid-template-columns: minmax(0, 1fr); }
  .member__role { grid-column: 1; }
  .member__who  { grid-column: 1; }
  .member__meta { grid-column: 1; white-space: normal; }
  .member__actions { grid-column: 1; }
}

/* Removal flips the row in place -- no modal, no confirm(). */
.member__confirm {
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-3);
  min-width: 0;
}
.member.is-confirming { border-color: var(--sunrise); }
.member.is-confirming .member__body { display: none; }
.member.is-confirming .member__confirm { display: flex; }

/* The add control is the next row in the list, not a tile beside it. */
.member-add {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  min-height: 3.25rem;
  padding: var(--s-3) var(--s-4);
  border: var(--hair) dashed var(--rule-strong);
  border-radius: var(--r-2);
  background: none;
  color: var(--accent-text);
  font: inherit;
  font-weight: var(--w-bold);
  font-size: var(--fs-small);
  letter-spacing: var(--tr-micro);
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color var(--t), background-color var(--t);
}
.member-add:hover { border-color: var(--sunrise); background: var(--surface-2); }

/* Inline panel, NOT a modal. Modals on mobile without a framework are a
   focus-trap and scroll-lock problem this project does not need. */
.member-panel {
  margin-top: var(--s-5);
  padding: var(--s-6);
  border: var(--hair) solid var(--rule-strong);
  border-left: 3px solid var(--sunrise);
  border-radius: var(--r-2);
  background: var(--surface-2);
}
.member-panel legend {
  padding: 0 var(--s-2);
  font-size: var(--fs-micro);
  font-weight: var(--w-bold);
  letter-spacing: var(--tr-micro);
  text-transform: uppercase;
  color: var(--accent-text);
}
/* Gender and age used to sit side by side, which put age in a right-hand
   column that people's eyes skipped on the way down the panel -- and missing
   it is the one thing that sends the whole form backwards. They now stack, so
   the panel reads as a single column from top to bottom and nothing is
   off the path. */
.member-panel__grid { display: grid; gap: var(--s-5); }

/* Four short options fit on one line at any width worth having a row at. */
.segmented--row { flex-wrap: nowrap; }
@media (max-width: 34rem) { .segmented--row { flex-wrap: wrap; } }
.member-panel__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-5); align-items: center; }

/* The age field drives status, occupation eligibility and every age
   statistic on the site, and in a narrow box it read as an afterthought
   people skipped. It now gets the investment band's treatment: the number is
   the hero, the box announces itself, the unit sits beside it as a label
   rather than as more form furniture. */
.field--age { max-width: 14rem; }

.agebox {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
  border: var(--hair) solid var(--rule-strong);
  border-left: 3px solid var(--sunrise);
  transition: border-color var(--t);
}

.agebox:focus-within { border-color: var(--sunrise); }

.agebox__input {
  width: 3.2ch;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--fs-h3);
  font-weight: var(--w-bold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
  -moz-appearance: textfield;
  appearance: textfield;
}

/* The spinners are 20px targets nobody uses on a field with 100 valid
   values, and they crowd a number set at display size. */
.agebox__input::-webkit-outer-spin-button,
.agebox__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.agebox__input:focus { outline: none; }
.agebox__input::placeholder { color: var(--on-surface-dim); opacity: 0.5; }

.agebox__unit {
  font-size: var(--fs-micro);
  font-weight: var(--w-med);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-surface-dim);
}

.field--age.is-invalid .agebox { border-color: var(--sunrise); border-left-color: var(--sunrise); }

/* A radio group cannot carry the .input border treatment, so the invalid
   state has to land on the labels themselves. */
.segmented.is-invalid label { border-color: var(--sunrise); }
.select.is-invalid { border-color: var(--sunrise); }

/* ==========================================================================
   Occupation picker

   Status chips first, so a retiree never hunts through a list. Then search.
   Then browse-by-category for the third of people who do not know what to
   type. Then free text, so it never dead-ends.
   ========================================================================== */
/* A blocked option is shown, not removed: seeing that "Working" exists but is
   unavailable at this age explains the rule better than a vanishing button. */
.segmented input:disabled + label,
.segmented label.is-unavailable {
  opacity: 0.38;
  cursor: not-allowed;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.segmented input:disabled + label:hover { border-color: var(--rule-strong); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip {
  padding: 0.7rem 1.1rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: var(--hair) solid var(--rule-strong);
  border-radius: var(--r-2);
  background: none;
  font: inherit;
  font-size: var(--fs-small);
  font-weight: var(--w-med);
  color: inherit;
  cursor: pointer;
  transition: background-color var(--t), border-color var(--t), color var(--t);
}
.chip:hover { border-color: var(--accent-text); }
.chip[aria-pressed="true"] { background: var(--sunrise); border-color: var(--sunrise); color: var(--ink); font-weight: var(--w-bold); }

.combo { position: relative; }
.combo__list {
  position: absolute;
  z-index: 20;
  inset-inline: 0;
  top: 100%;
  max-height: 18rem;
  overflow-y: auto;
  margin: 0;
  background: var(--ink-raise);
  border: var(--hair) solid var(--sunrise);
  border-radius: var(--r-2);
  box-shadow: var(--shadow-lift);
}
[data-surface="bone"] .combo__list { background: var(--bone); }
.combo__list:empty, .combo__list[hidden] { display: none; }
.combo__opt {
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  font-size: var(--fs-small);
  border-bottom: var(--hair) solid var(--rule);
}
.combo__opt:last-child { border-bottom: 0; }
.combo__opt[aria-selected="true"], .combo__opt:hover { background: var(--sunrise); color: var(--ink); }
.combo__cat { font-size: var(--fs-micro); opacity: 0.65; white-space: nowrap; }

/* The no-JS path: a real <optgroup> select with every occupation in it.
   Inelegant and completely functional, including native type-ahead on
   mobile. JS hides it and mounts the combobox in its place. */
.js .occ-fallback { display: none; }
.occ-live { display: none; }
.js .occ-live { display: block; }

/* ==========================================================================
   Estimated Family Investment

   The client asked for this to be a highlight, so it is the single most
   visually dramatic control on the site: the band label is set at display
   size and the slider is small beneath it. The number is the hero; the
   control is incidental.
   ========================================================================== */
.invest { padding: var(--s-6) 0; }
.invest__value {
  font-size: clamp(2rem, 1.2rem + 4vw, 4.5rem);
  font-weight: var(--w-black);
  line-height: 1;
  letter-spacing: var(--tr-display);
  color: var(--sunrise);
  font-variant-numeric: tabular-nums;
  min-height: 1em;
}
.invest__fx { margin-top: var(--s-3); font-size: var(--fs-small); color: var(--on-surface-dim); font-variant-numeric: tabular-nums; }

.invest__slider { margin-top: var(--s-6); }
.invest__range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  background: transparent;
  cursor: pointer;
}
.invest__range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--r-1);
  background: linear-gradient(to right, var(--sunrise) 0 var(--pct, 0%), var(--rule-strong) var(--pct, 0%) 100%);
}
.invest__range::-moz-range-track { height: 6px; border-radius: var(--r-1); background: var(--rule-strong); }
.invest__range::-moz-range-progress { height: 6px; border-radius: var(--r-1); background: var(--sunrise); }
.invest__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px; height: 28px;
  margin-top: -11px;
  border-radius: var(--r-human);
  background: var(--bone);
  border: 3px solid var(--sunrise);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.3);
}
.invest__range::-moz-range-thumb {
  width: 28px; height: 28px;
  border-radius: var(--r-human);
  background: var(--bone);
  border: 3px solid var(--sunrise);
}
.invest__range:disabled { opacity: 0.35; cursor: not-allowed; }

.invest__scale { display: flex; justify-content: space-between; margin-top: var(--s-2); font-size: var(--fs-micro); color: var(--on-surface-dim); }
.invest__optout { margin-top: var(--s-5); }

/* ---- Checkboxes ----------------------------------------------------------- */
.check { display: flex; gap: var(--s-3); align-items: flex-start; cursor: pointer; font-size: var(--fs-small); padding-block: var(--s-2); }
.check input {
  flex: none;
  width: 22px; height: 22px;
  margin: 1px 0 0;
  accent-color: var(--sunrise);
  cursor: pointer;
}
.check span { line-height: 1.5; }

/* ---- Country ranking ------------------------------------------------------ */
.rank { display: grid; gap: var(--s-2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); }
.rank__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: var(--hair) solid var(--rule-strong);
  border-radius: var(--r-2);
  background: none;
  font: inherit;
  font-size: var(--fs-small);
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t), background-color var(--t);
}
.rank__item:hover { border-color: var(--accent-text); }
.rank__item[aria-pressed="true"] { border-color: var(--sunrise); background: var(--surface-2); }
.rank__badge {
  flex: none;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: var(--r-human);
  border: var(--hair) solid var(--rule-strong);
  font-size: var(--fs-micro);
  font-weight: var(--w-bold);
  font-variant-numeric: tabular-nums;
}
.rank__item[aria-pressed="true"] .rank__badge { background: var(--sunrise); border-color: var(--sunrise); color: var(--ink); }

/* ---- Review (step 5) ------------------------------------------------------ */
.review { display: grid; gap: var(--s-4); }
.review__row { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: var(--s-4); padding-block: var(--s-3); border-bottom: var(--hair) solid var(--rule); }
.review__k { font-size: var(--fs-micro); font-weight: var(--w-bold); letter-spacing: var(--tr-micro); text-transform: uppercase; color: var(--on-surface-dim); }
.review__v { font-weight: var(--w-semi); }
@media (max-width: 34rem) { .review__row { grid-template-columns: 1fr; gap: var(--s-1); } }

/* ---- Success takeover ----------------------------------------------------- */
.success { text-align: center; padding-block: var(--s-8); }
.success__n {
  font-size: var(--fs-stat);
  font-weight: var(--w-black);
  line-height: 0.9;
  letter-spacing: var(--tr-display);
  color: var(--sunrise);
  font-variant-numeric: tabular-nums;
}
.success__actions { display: grid; gap: var(--s-3); max-width: 26rem; margin: var(--s-7) auto 0; }

/* ---- Toast ---------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%; bottom: var(--s-5);
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-5);
  background: var(--ink);
  color: var(--bone);
  border: var(--hair) solid var(--sunrise);
  border-radius: var(--r-2);
  font-size: var(--fs-small);
  box-shadow: var(--shadow-lift);
}
.toast button { background: none; border: 0; color: var(--sunrise); font: inherit; font-weight: var(--w-bold); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
