/* ==========================================================================
   NOVACares design system — components (spec §5)
   Brand: NOVACares Brand Package v1.0 · every value comes from tokens.css.

   RULE (enforced by setup/check-tokens.sh): this file contains NO hex
   colours, NO font-family declarations, NO literal radii. If a component
   needs something new, add a token/alias in tokens.css first.

   Two visual languages, never mixed on one page (§5.1):
     .t-editorial  — Stories, About: large type, whitespace, 720px
     .t-app        — Apps, Community, My account: compact, badges, 960px
   Mobile-first: base rules target 360px and widen from there (§5.4).
   ========================================================================== */

/* --- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  color: var(--text-primary);
  background: var(--bg-page);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--text-link); }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* --- Skip link (a11y) ----------------------------------------------------- */
.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: var(--sp-3); top: var(--sp-3); z-index: 100;
  background: var(--bg-surface); color: var(--text-primary);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-raised);
}

/* --- Masthead + nav (5 items max, §4.2) ----------------------------------- */
.masthead { background: var(--bg-inverse); color: var(--text-inverse); }
.masthead-inner {
  max-width: var(--width-nav); margin: 0 auto;
  padding: var(--sp-3) var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-3);
}
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { height: 40px; width: auto; }   /* Horizontal Reversed lockup */

.nav { margin-left: auto; display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.nav a {
  color: var(--text-inverse); opacity: .85;
  text-decoration: none;
  font-size: var(--fs-small); font-weight: var(--fw-bold);
  padding: var(--sp-2) var(--sp-3);
  min-height: var(--tap-target); display: inline-flex; align-items: center;
  border-radius: var(--radius-pill);
  transition: background var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.nav a:hover  { background: var(--c-care-teal); opacity: 1; }
.nav a.is-on  { background: var(--bg-surface); color: var(--c-deep-teal); opacity: 1; }

/* Account entry point (accounts layer, §9) — NOT a nav item (§4.2 caps nav
   at five); a quiet outlined pill at the masthead's far edge. */
.account-link {
  color: var(--text-inverse); opacity: .85;
  text-decoration: none;
  font-size: var(--fs-caption); font-weight: var(--fw-bold);
  padding: var(--sp-1) var(--sp-3);
  min-height: var(--tap-target); display: inline-flex; align-items: center;
  border: 1px solid var(--c-care-teal); border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.account-link:hover { background: var(--c-care-teal); opacity: 1; }

/* --- Committee strip (visible only to signed-in AJK) ----------------------- */
.committee-bar { background: var(--bg-subtle); border-bottom: 1px solid var(--border-subtle); }
.committee-bar-inner {
  max-width: var(--width-nav); margin: 0 auto;
  padding: var(--sp-2) var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  font-size: var(--fs-small);
}
.committee-bar a {
  color: var(--c-deep-teal); font-weight: var(--fw-bold); text-decoration: none;
}
.committee-bar a:hover { text-decoration: underline; }

/* --- Admin carpool: ride cards --------------------------------------------
   Replaced a 9-column table that forced horizontal scrolling and buried the
   join requests behind a toggle. One card per ride, requests inline. */
.cpa-ride { margin-bottom: var(--sp-4); }
.cpa-past { opacity: .62; }

.cpa-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--sp-3); flex-wrap: wrap;
  padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border-subtle);
}
.cpa-when  { font-weight: var(--fw-bold); color: var(--text-heading); }
.cpa-route { font-size: var(--fs-small); color: var(--text-muted); }
.cpa-head-right { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.cpa-select {
  font-family: inherit; font-size: var(--fs-caption);
  color: var(--text-primary); background: var(--bg-surface);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  padding: var(--sp-1) var(--sp-2);
}

/* Host / child / seats / posted — wraps to one column on narrow screens. */
.cpa-meta {
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  padding: var(--sp-3) 0; font-size: var(--fs-small);
}
.cpa-meta a { color: var(--c-care-teal); }
.cpa-label {
  display: block; font-size: var(--fs-caption); font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
  margin-bottom: var(--sp-1);
}
.cpa-notes {
  font-size: var(--fs-small); font-style: italic; color: var(--text-muted);
  padding-bottom: var(--sp-3);
}

.cpa-reqs { border-top: 1px solid var(--border-subtle); padding-top: var(--sp-3); }
.cpa-req {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--sp-3); flex-wrap: wrap;
  background: var(--bg-page); border-radius: var(--radius-md);
  padding: var(--sp-3); margin-bottom: var(--sp-2);
}
.cpa-req-main { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: var(--sp-1); }
.cpa-req-main a { color: var(--c-care-teal); }
.cpa-kids { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.cpa-req-actions { display: flex; gap: var(--sp-1); flex-wrap: wrap; align-items: flex-start; }

.cpa-btn { padding: var(--sp-1) var(--sp-3); font-size: var(--fs-caption); white-space: nowrap; }
.cpa-ok     { color: var(--status-ok); }
.cpa-danger { color: var(--status-error); }

.cpa-foot {
  display: flex; gap: var(--sp-2); flex-wrap: wrap;
  border-top: 1px solid var(--border-subtle); padding-top: var(--sp-3);
}

/* --- Leaderboard tables (challenges module, §10.3) ------------------------- */
.lb-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.lb-table th {
  text-align: left; font-weight: var(--fw-bold); color: var(--text-muted);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 2px solid var(--border-subtle);
  white-space: nowrap;
}
.lb-table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.lb-table tbody tr:last-child td { border-bottom: none; }
.lb-table.lb-podium tbody tr:nth-child(-n+3) td { background: var(--bg-page); }  /* podium wash — ranked tables only (opt-in) */

@media (max-width: 560px) {
  .masthead-inner { flex-wrap: wrap; }
  .brand img { height: 32px; }              /* NoTagline territory <280px width */
  .nav { margin-left: 0; width: 100%; justify-content: space-between; }
  .nav a { padding: var(--sp-2); font-size: var(--fs-caption); }
  .account-link { margin-left: auto; }
}

/* --- Page frame ------------------------------------------------------------ */
.page { flex: 1; width: 100%; margin: 0 auto; padding: var(--sp-5) var(--sp-4) var(--sp-8); }
.t-app       .page { max-width: var(--width-app); }
.t-editorial .page { max-width: var(--width-editorial); }

.site-foot {
  border-top: 1px solid var(--border-subtle);
  padding: var(--sp-5) var(--sp-4);
  text-align: center; color: var(--text-muted); font-size: var(--fs-small);
}

/* --- Page headers (editorial + app variants, §5.3) ------------------------- */
.ph { margin-bottom: var(--sp-5); }
.ph h1 { font-size: var(--fs-h1); line-height: var(--lh-tight);
         color: var(--text-heading); font-weight: var(--fw-bold); }
.ph p  { color: var(--text-muted); margin-top: var(--sp-2); }

.t-editorial .ph h1 { font-size: var(--fs-display); font-weight: var(--fw-black); }
.t-editorial .ph    { margin-bottom: var(--sp-6); }

/* --- Cards (module / story / event variants, §5.3) -------------------------- */
.card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: var(--sp-3); }

.card-grid { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; }
@media (min-width: 620px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
.card-grid-3 { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; }
@media (min-width: 620px) { .card-grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* Module card */
.mod {
  display: flex; flex-direction: column; gap: var(--sp-2);
  text-decoration: none; color: inherit;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: var(--sp-5);
  box-shadow: var(--shadow-card);
  transition: border-color var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}
.mod:hover { border-color: var(--action-primary); transform: translateY(-1px); }
.mod-icon  { font-size: var(--fs-h2); line-height: var(--lh-tight); }
.mod-name  { font-weight: var(--fw-bold); color: var(--text-heading); font-size: var(--fs-h3); }
.mod-desc  { color: var(--text-muted); font-size: var(--fs-small); }
.mod.is-off { opacity: .62; pointer-events: none; }
/* External app-card — forwards off-site, opens a new tab (§5.3 ↗ convention). */
/* Uploaded app-card logo — sized to sit where the emoji would, so a card with
   a logo and a card with an emoji line up. object-fit keeps a non-square logo
   from stretching. */
.mod-icon-img { width: 2.25rem; height: 2.25rem; object-fit: contain; display: block; }
.mod--external { border-left: 3px solid var(--action-accent); }
.mod-ext-mark  { color: var(--text-muted); font-weight: var(--fw-regular); }
/* Inline form feedback (JS toggles the state class — keeps colour out of JS). */
.form-note.is-ok  { color: var(--action-primary); }
.form-note.is-err { color: var(--status-error); }

/* ── NOVA Assistant help-chat widget (assets/js/nova-chat.js) ─────────────────
   All styling lives here (tokenised) so the JS injects DOM only, no colour. */
#ncBtn { position: fixed; bottom: 18px; right: 18px; z-index: 9998; width: 54px; height: 54px;
  border-radius: var(--radius-pill); background: var(--action-primary); color: var(--bg-surface);
  border: none; cursor: pointer; box-shadow: var(--shadow-card); display: flex; align-items: center;
  justify-content: center; font-size: 24px; transition: transform .15s; }
#ncBtn:hover { transform: scale(1.06); }
#ncPanel { position: fixed; bottom: 84px; right: 18px; z-index: 9998; width: min(370px, calc(100vw - 24px));
  height: min(520px, calc(100vh - 110px)); background: var(--bg-surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle); box-shadow: var(--shadow-card); display: none;
  flex-direction: column; overflow: hidden; font-family: inherit; }
#ncPanel.open { display: flex; }
#ncHead { background: var(--action-primary); color: var(--bg-surface); padding: 13px 16px; display: flex;
  align-items: center; gap: 10px; flex-shrink: 0; }
#ncHead .t { font-weight: var(--fw-bold); font-size: 15px; }
#ncHead .s { font-size: 11px; opacity: .7; }
#ncClose { margin-left: auto; background: none; border: none; color: var(--bg-surface); opacity: .85;
  font-size: 20px; cursor: pointer; line-height: 1; padding: 4px; }
#ncMsgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-page); }
.ncM { max-width: 85%; padding: 9px 13px; border-radius: var(--radius-md); font-size: var(--fs-small);
  line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.ncM.u { align-self: flex-end; background: var(--action-primary); color: var(--bg-surface);
  border-bottom-right-radius: var(--radius-sm); }
.ncM.a { align-self: flex-start; background: var(--bg-surface); border: 1px solid var(--border-subtle);
  color: var(--text-primary); border-bottom-left-radius: var(--radius-sm); }
.ncM.a a { color: var(--action-primary); font-weight: var(--fw-bold); text-decoration: underline; word-break: break-all; }
.ncM.typing { color: var(--text-muted); font-style: italic; }
#ncChips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; background: var(--bg-page); flex-shrink: 0; }
.ncChip { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
  padding: 6px 12px; font-size: 12px; cursor: pointer; color: var(--action-primary); font-family: inherit; }
.ncChip:hover { border-color: var(--action-accent); }
#ncForm { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface); flex-shrink: 0; }
#ncIn { flex: 1; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 9px 12px;
  font-size: 16px; font-family: inherit; outline: none; }
#ncIn:focus { border-color: var(--action-primary); }
#ncSend { background: var(--action-primary); color: var(--bg-surface); border: none; border-radius: var(--radius-md);
  padding: 0 16px; font-weight: var(--fw-bold); font-size: 14px; cursor: pointer; font-family: inherit; }
#ncSend:disabled { opacity: .5; cursor: default; }
@media (max-width: 480px) { #ncPanel { right: 12px; bottom: 80px; } }

/* Story card (home recent-stories slot + Stories index) */
.story-card {
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit; overflow: hidden;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); box-shadow: var(--shadow-card);
  transition: border-color var(--dur-base) var(--ease);
}
.story-card:hover { border-color: var(--action-primary); }
.story-cover { aspect-ratio: 16 / 9; background: var(--bg-subtle); object-fit: cover; width: 100%; }
.story-body  { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); }
.story-title { font-weight: var(--fw-bold); color: var(--text-heading); font-size: var(--fs-h3);
               line-height: var(--lh-tight); }
.story-excerpt { color: var(--text-muted); font-size: var(--fs-small); }

/* --- Status badges (app template only, §5.1) -------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: var(--fs-caption); font-weight: var(--fw-bold);
  padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-pill);
  white-space: nowrap;
}
.badge-ok   { background: var(--bg-subtle);   color: var(--c-deep-teal); }
.badge-warn { background: var(--bg-surface);  color: var(--text-heading);
              border: 1px solid var(--status-warn); }   /* gold = border only:
              gold text on white is ~2.2:1 and fails contrast; §5.4 wants gold
              as punctuation anyway */
.badge-stop { background: var(--bg-surface);  color: var(--status-error);
              border: 1px solid var(--status-error); }
.badge-mute { background: var(--bg-page);     color: var(--text-muted);
              border: 1px solid var(--border-subtle); }
.badge-ev   { background: var(--bg-subtle);   color: var(--c-deep-teal);
              border: 1px solid var(--ev-accent); }   /* events activity/holiday:
              seafoam like badge-ok, care-teal ring keeps it distinct */

/* --- Notice banner (info / action / external variants, §6.3) ---------------- */
.notices { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.notice {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--action-primary);           /* info variant */
  border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4);
}
.notice--action   { border-left-color: var(--action-accent); }   /* gold = punctuation */
.notice--external { border-left-color: var(--text-muted); }
.notice-text { flex: 1; min-width: 180px; font-size: var(--fs-small); }
.notice-x {
  background: none; border: 0; color: var(--text-muted); cursor: pointer;
  font-size: var(--fs-h3); line-height: 1; padding: var(--sp-2);
  min-width: var(--tap-target); min-height: var(--tap-target);
}

/* --- Buttons (§5.3) --------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-1);
  min-height: var(--tap-target); padding: var(--sp-2) var(--sp-5);
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: inherit; font-size: var(--fs-small); font-weight: var(--fw-bold);
  text-decoration: none; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.btn-primary { background: var(--action-primary); color: var(--bg-surface); }
.btn-primary:hover { background: var(--action-primary-hover); }
.btn-secondary { background: var(--bg-surface); color: var(--text-heading);
                 border-color: var(--border-subtle); }
.btn-secondary:hover { border-color: var(--action-primary); }
/* External links open a new tab and say so (§5.3) */
.btn-external::after { content: ' ↗'; font-weight: var(--fw-regular); }

/* --- Quick-action tiles (home slot 3, §5.2) --------------------------------- */
.tiles { display: grid; gap: var(--sp-3); grid-template-columns: repeat(2, 1fr); }
@media (min-width: 620px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2); text-align: center; text-decoration: none;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: var(--sp-4) var(--sp-3);
  min-height: calc(var(--tap-target) * 2);
  color: var(--text-heading); font-weight: var(--fw-bold); font-size: var(--fs-small);
  box-shadow: var(--shadow-card);
  transition: border-color var(--dur-base) var(--ease);
}
.tile:hover { border-color: var(--action-primary); }
.tile-icon { font-size: var(--fs-h2); }

/* --- Form field set (§5.3) --------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-4); }
.field label { font-size: var(--fs-small); font-weight: var(--fw-bold); color: var(--text-heading); }
.field input, .field select, .field textarea {
  font-family: inherit; font-size: var(--fs-body); color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3); min-height: var(--tap-target);
}
.field-hint  { font-size: var(--fs-caption); color: var(--text-muted); }
.field-error { font-size: var(--fs-caption); color: var(--status-error); }

/* --- Empty state (§5.3) ------------------------------------------------------ */
.empty {
  border: 1px dashed var(--border-subtle); border-radius: var(--radius-md);
  padding: var(--sp-6) var(--sp-4); text-align: center;
  color: var(--text-muted); font-size: var(--fs-small);
  background: var(--bg-surface);
}
.empty-icon { font-size: var(--fs-h1); margin-bottom: var(--sp-2); }

/* --- Section blocks ----------------------------------------------------------- */
.sec { margin-bottom: var(--sp-6); }
.sec-head { display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.sec-head h2 { font-size: var(--fs-h3); color: var(--text-heading); font-weight: var(--fw-bold); }
.sec-head a  { margin-left: auto; font-size: var(--fs-small); font-weight: var(--fw-bold);
               text-decoration: none; }
.sec-head a:hover { text-decoration: underline; }

/* --- Share-kit block (§6.6 — committee-only UI) ------------------------------- */
.sharekit {
  background: var(--bg-subtle); border-radius: var(--radius-md);
  padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3);
}
.sharekit textarea {
  font-family: inherit; font-size: var(--fs-small); color: var(--text-primary);
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); padding: var(--sp-3); resize: vertical;
}

/* --- Editorial body (Stories, About) ------------------------------------------ */
.prose { font-size: var(--fs-body-lg); line-height: var(--lh-loose); }
.prose h2 { font-size: var(--fs-h2); color: var(--text-heading);
            font-weight: var(--fw-bold); margin: var(--sp-6) 0 var(--sp-3); }
.prose h3 { font-size: var(--fs-h3); color: var(--text-heading);
            font-weight: var(--fw-bold); margin: var(--sp-5) 0 var(--sp-2); }
.prose p, .prose ul, .prose ol { margin-bottom: var(--sp-4); }
.prose ul, .prose ol { padding-left: var(--sp-5); }
.prose blockquote {
  border-left: 4px solid var(--action-accent);   /* gold as punctuation */
  padding-left: var(--sp-4);
  color: var(--text-muted); font-style: italic; margin: var(--sp-5) 0;
}
.byline { color: var(--text-muted); font-size: var(--fs-small); }

/* Story media (rendered blocks, §6.2) */
.prose figure { margin: var(--sp-5) auto; }
.prose figure img { border-radius: var(--radius-md); width: 100%; }
.prose figcaption { margin-top: var(--sp-2); text-align: center; }
/* Per-image display size (imgSize tune) — three presets, centred. Ratios are
   layout, not brand values, so they live here rather than in tokens. */
.prose figure.img-small  { max-width: 45%; }
.prose figure.img-medium { max-width: 72%; }
.prose figure.img-full   { max-width: 100%; }
/* On phones a "small" image is unreadable — everything goes full width. */
@media (max-width: 560px) {
  .prose figure.img-small, .prose figure.img-medium { max-width: 100%; }
}
.embed { aspect-ratio: 16 / 9; margin: var(--sp-5) 0; }
.embed iframe { width: 100%; height: 100%; border: 0; border-radius: var(--radius-md); }

/* Callout — the brand's own component (docs/brand/novacares-tokens.css) */
.callout {
  padding: var(--sp-5);
  border-left: 4px solid var(--action-accent);
  border-radius: var(--radius-md);
  background: var(--bg-page);
}

/* --- Utilities ------------------------------------------------------------------ */
.muted   { color: var(--text-muted); }
.small   { font-size: var(--fs-small); }
.stack-2 > * + * { margin-top: var(--sp-2); }
.stack-3 > * + * { margin-top: var(--sp-3); }
.row     { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; }
