/* ============================================================================
   FAMILY OBSERVATORY : PRODUCTION COMPONENT BASE
   Reusable primitives shared by the public site and demonstrated in the labs.
   Depends on tokens.css. v1.0.0 : 2026-07-10
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --- Typography --------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text);
  line-height: var(--lh-tight);
  font-weight: 600;
  margin: 0 0 var(--space-4);
  letter-spacing: -0.01em;
}
h1 { font-size: var(--fs-5xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); font-family: var(--font-sans); font-weight: 700; letter-spacing: 0; }
p  { margin: 0 0 var(--space-4); max-width: 68ch; }
a  { color: var(--brand-strong); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand); }

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 var(--space-3);
}
.lead { font-size: var(--fs-lg); color: var(--text-2); line-height: var(--lh-snug); }
.muted { color: var(--muted); }

/* --- Layout ------------------------------------------------------------- */
.container { width: 100%; max-width: var(--container-lg); margin-inline: auto; padding-inline: var(--gutter); }
.container-md { max-width: var(--container-md); }
.container-sm { max-width: var(--container-sm); }
.section { padding-block: clamp(var(--space-7), 8vw, var(--space-9)); }
.section--tint { background: var(--surface-2); }
.section--brand { background: var(--brand-soft); }

/* --- Skip link (accessibility) ----------------------------------------- */
.skip-link {
  position: absolute; left: var(--space-3); top: -60px;
  background: var(--brand); color: #fff; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm); z-index: 1000; transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--space-3); color: #fff; }

/* --- Focus (never removed, always visible) ----------------------------- */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* --- Buttons ------------------------------------------------------------ */
.btn {
  --_bg: var(--brand); --_fg: #fff; --_bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--touch-min);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-sans); font-size: var(--fs-base); font-weight: 600;
  line-height: 1; text-decoration: none; cursor: pointer;
  background: var(--_bg); color: var(--_fg); white-space: nowrap;
  border: 1.5px solid var(--_bd); border-radius: var(--radius-pill);
  transition: transform var(--dur-fast) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:hover { background: var(--brand-strong); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn--secondary { --_bg: transparent; --_fg: var(--brand-strong); --_bd: var(--border-strong); }
.btn--secondary:hover { --_bg: var(--surface); color: var(--brand-strong); border-color: var(--brand); }
.btn--accent { --_bg: var(--accent); --_fg: #3a2a09; }
.btn--accent:hover { background: var(--accent-strong); color: #3a2a09; }
.btn--lg { min-height: var(--touch-senior); font-size: var(--fs-lg); padding: 1rem 2rem; }
.btn--ghost { --_bg: transparent; --_fg: var(--brand-strong); --_bd: transparent; }

/* --- Forms -------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-5); }
.field label { font-weight: 600; font-size: var(--fs-sm); color: var(--text); }
.field .hint { font-size: var(--fs-sm); color: var(--muted); }
.input, .select, .textarea {
  min-height: var(--touch-min);
  padding: 0.7rem 0.9rem;
  font: inherit; font-size: var(--fs-base);
  color: var(--text); background: var(--surface);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { min-height: 7rem; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); }
.field--error .input, .field--error .textarea { border-color: var(--help); }
.field--error .error-text { color: var(--help); font-size: var(--fs-sm); font-weight: 600; }
.checkbox-row { display: flex; gap: var(--space-3); align-items: flex-start; }
.checkbox-row input[type="checkbox"] { width: 24px; height: 24px; margin-top: 2px; accent-color: var(--brand); }

/* --- Cards -------------------------------------------------------------- */
.card {
  background: var(--surface); border: var(--border-hair); border-radius: var(--radius-lg);
  padding: var(--space-6); box-shadow: var(--shadow-sm);
}
.card--link { display: block; text-decoration: none; color: inherit; position: relative; overflow: hidden;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out); }
.card--link::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transform: scaleX(0); transform-origin: left; transition: transform var(--dur) var(--ease-out);
}
.card--link:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card--link:hover::before { transform: scaleX(1); }

/* --- Status pills (plain language; icon + label, never color alone) ----- */
.status {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 0.35rem 0.8rem; border-radius: var(--radius-pill);
  font-size: var(--fs-sm); font-weight: 700; line-height: 1;
  border: 1.5px solid transparent;
}
.status .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.status--ok       { background: var(--ok-soft);       color: #1c5a3f; border-color: #bfe0cf; }
.status--ok .dot       { background: var(--ok); }
.status--due      { background: var(--due-soft);      color: #8a5b12; border-color: #eccf95; }
.status--due .dot      { background: var(--due); }
.status--waiting  { background: var(--waiting-soft);  color: #4c3d78; border-color: #cfc5e6; }
.status--waiting .dot  { background: var(--waiting); }
.status--help     { background: var(--help-soft);     color: #96331f; border-color: #e6b3a5; }
.status--help .dot     { background: var(--help); }
.status--notified { background: var(--notified-soft); color: #244758; border-color: #b6ccd7; }
.status--notified .dot { background: var(--notified); }

/* --- Utilities ---------------------------------------------------------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.stack > * + * { margin-top: var(--space-4); }
.grid { display: grid; gap: var(--space-5); }
.text-center { text-align: center; }
