/* ============================================================================
   MINI RETIREMENT — COMPONENTS
   ----------------------------------------------------------------------------
   Reusable, on-brand component classes. Import AFTER tokens.css (and usually
   base.css). Copy the matching HTML from BRAND-GUIDE.md or examples/.

       <link rel="stylesheet" href="tokens.css">
       <link rel="stylesheet" href="base.css">
       <link rel="stylesheet" href="components.css">
   ============================================================================ */

/* ---------- BUTTONS ----------
   .btn is the base; add ONE variant. Terracotta is the single attention color —
   never put two filled-accent buttons competing in one viewport.            */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  line-height: 1;
  padding: 14px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              transform 80ms var(--ease-out);
}
.btn:active { transform: scale(0.985); }

/* Primary — the page's main action */
.btn--primary { background: var(--accent); color: var(--ink-on-dark); }
.btn--primary:hover { background: var(--accent-hover); color: var(--ink-on-dark); }

/* Dark — secondary emphasis (e.g. nav CTA) */
.btn--dark { background: var(--ink); color: var(--ink-on-dark); }
.btn--dark:hover { background: var(--brand-deep); }

/* Secondary — outlined, for the less-important of two actions */
.btn--secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--secondary:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }

/* Ghost — text-only, used with a trailing arrow (→) */
.btn--ghost { padding: 14px 8px; background: transparent; color: var(--ink-2); }
.btn--ghost:hover { color: var(--ink); }

/* Pill variant (status-y / compact) */
.btn--pill { border-radius: var(--radius-pill); }

/* ---------- TAG / OVERLINE WITH RULE ----------
   Small uppercase label with a short leading rule — used above section titles. */
.tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-overline);
  letter-spacing: var(--tracking-overline);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  color: var(--accent-hover);
}
.tag::before { content: ''; width: 22px; height: 1px; background: var(--accent); }

/* ---------- BADGE ---------- */
.badge {
  display: inline-block;
  font-size: 10px; letter-spacing: 0.08em; font-weight: var(--fw-medium);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-hover);
}
.badge--brand { background: var(--success-soft); color: var(--success); }

/* ---------- CARD ----------
   No shadow by default: cards sit on the page via --paper-2 on --paper + 1px line. */
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}
.card--compact { padding: var(--space-5); }
/* Only when the whole card is a link: */
a.card { display: block; color: inherit; transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); }
a.card:hover { border-color: var(--line-strong); transform: translateY(-3px); text-decoration: none; }

/* ---------- FORM FIELDS ---------- */
.field { display: grid; gap: var(--space-2); }
.field > .field-label {
  font-size: var(--fs-body-sm); font-weight: var(--fw-medium); color: var(--ink-2);
}

.input,
.select,
.textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  color: var(--ink);
  background: var(--paper-2);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  height: 48px;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.textarea { height: auto; padding: 12px 14px; line-height: var(--lh-body); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); }

/* numeric inputs / money fields read as data */
.input--num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.money-input {
  display: grid; grid-template-columns: auto 1fr; align-items: center;
  height: 48px; overflow: hidden;
  background: var(--paper-2);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color var(--dur-fast) var(--ease-out);
}
.money-input:focus-within { border-color: var(--accent); }
.money-input > .money-prefix { padding-left: 14px; color: var(--ink-3); font-family: var(--font-mono); }
.money-input > input { border: 0; background: transparent; height: 100%; padding: 0 14px 0 6px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.money-input > input:focus { outline: none; }

/* ---------- SEGMENTED CONTROL ----------
   2–3 short, mutually-exclusive options. Radios visually hidden inside labels. */
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 6px; padding: 5px;
  background: var(--paper-3);
  border-radius: var(--radius-md);
}
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: grid; place-items: center; min-height: 42px;
  border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: var(--fw-medium);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.segmented input:checked + span { background: var(--paper-2); color: var(--brand); box-shadow: var(--shadow-pop); }
.segmented label:focus-within span { outline: 3px solid color-mix(in srgb, var(--accent) 26%, transparent); outline-offset: 2px; }

/* ---------- CHOICE CARD ----------
   A selectable card (radio/checkbox) with a title + description. */
.choice {
  display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); align-items: start;
  padding: var(--space-4);
  background: var(--paper-2);
  border: 1px solid var(--line); border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.choice:hover { border-color: var(--line-strong); }
.choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--paper-2)); }
.choice input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.choice strong { display: block; margin-bottom: 4px; color: var(--ink); font-weight: var(--fw-semi); }
.choice .choice-desc { color: var(--ink-2); line-height: 1.45; }

/* ---------- INVERSE BLOCK ----------
   Dark section on --brand-deep (how-it-works, CTA, footer wells). */
.inverse { background: var(--brand-deep); color: var(--ink-on-dark); }
.inverse h1, .inverse h2, .inverse h3 { color: var(--ink-on-dark); }
.inverse .tag { color: var(--brand-soft); }
.inverse .tag::before { background: var(--brand-soft); }
.inverse p { color: color-mix(in srgb, var(--ink-on-dark) 70%, transparent); }
