/* =====================================================================
 * SI Appearance layer — shared.
 * Attribute-driven theming. Sites map their OWN variables to the --ap-*
 * contract in the per-site sections at the bottom. Never edit a site's
 * own stylesheet for theming; add/extend its map section here.
 *
 * Attributes set on <html> by appearance.js (always all six):
 *   data-theme="light|dark"        (resolved; "system" resolves in JS)
 *   data-accent="gold|teal|plum|forest"
 *   data-text="s|m|l|xl"
 *   data-font="default|dyslexic"
 *   data-contrast="standard|high"
 *   data-motion="full|reduced"
 * ===================================================================== */

/* ---- accent values (light defaults) ---- */
:root {
  --ap-accent: #17817d;
  --ap-accent-soft: rgba(23,129,125,.12);
  --ap-accent-ink: #ffffff;
}
html[data-accent="teal"]   { --ap-accent: #2c7a7b; --ap-accent-soft: #ddefef; }
html[data-accent="plum"]   { --ap-accent: #7c4a6e; --ap-accent-soft: #f3e6ef; }
html[data-accent="forest"] { --ap-accent: #3f6b4f; --ap-accent-soft: #e4efe7; }

/* ---- dark mode base ---- */
html[data-theme="dark"] {
  --ap-bg: #0a1f1e;
  --ap-card: #102828;
  --ap-ink: #f2f7f7;
  --ap-muted: rgba(242,247,247,.72);
  --ap-line: rgba(242,247,247,.14);
  --ap-head: #f2f7f7;
  /* accent stays readable on dark: teal tint */
  --ap-accent: #7fd1d0; --ap-accent-soft: #102828;
}
html[data-theme="dark"][data-accent="teal"]   { --ap-accent: #4aa8a9; --ap-accent-soft: #14302f; }
html[data-theme="dark"][data-accent="plum"]   { --ap-accent: #b07fa0; --ap-accent-soft: #2c1e28; }
html[data-theme="dark"][data-accent="forest"] { --ap-accent: #6fa287; --ap-accent-soft: #16281d; }

/* ---- text size (m = site default, untouched) ---- */
html[data-text="s"] body  { font-size: 15px; }
html[data-text="l"] body  { font-size: 19px; }
html[data-text="xl"] body { font-size: 21.5px; }

/* ---- dyslexia-friendly reading font (loaded on demand by appearance.js) ---- */
html[data-font="dyslexic"] body {
  font-family: "Atkinson Hyperlegible", Verdana, Geneva, sans-serif;
  letter-spacing: 0.01em;
  word-spacing: 0.04em;
}

/* ---- high contrast ---- */
html[data-contrast="high"] { --ap-ink: #000000; --ap-muted: #2b2b2b; }
html[data-theme="dark"][data-contrast="high"] {
  --ap-ink: #ffffff; --ap-muted: #d5d5d5; --ap-line: #5a5a5a;
}

/* ---- reduced motion ---- */
html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* =====================================================================
 * Appearance panel (modal). Injected by appearance.js.
 * ===================================================================== */
.si-ap-backdrop {
  position: fixed; inset: 0; background: rgba(10, 14, 22, 0.55);
  z-index: 9990; display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 16px;
}
.si-ap-panel {
  background: var(--ap-card, #fff); color: var(--ap-ink, #1c2b4a);
  border: 1px solid var(--ap-line, rgba(13,59,58,.16)); border-radius: 14px;
  max-width: 440px; width: 100%; max-height: 84vh; overflow-y: auto;
  padding: 20px 20px 16px; box-shadow: 0 24px 64px rgba(0,0,0,.35);
}
.si-ap-panel h3 { margin: 0 0 4px; font-size: 17px; }
.si-ap-panel .si-ap-sub { margin: 0 0 14px; font-size: 13px; color: var(--ap-muted, rgba(13,59,58,.70)); }
.si-ap-row { margin-bottom: 14px; }
.si-ap-row > span { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--ap-muted, rgba(13,59,58,.70)); }
.si-ap-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.si-ap-seg button {
  font: inherit; font-size: 13.5px; padding: 7px 13px; border-radius: 999px;
  border: 1.5px solid var(--ap-line, rgba(13,59,58,.16)); background: transparent;
  color: var(--ap-ink, #1c2b4a); cursor: pointer;
}
.si-ap-seg button[aria-pressed="true"] {
  border-color: var(--ap-accent, #b98a2f);
  background: var(--ap-accent-soft, #f4ead2);
  font-weight: 700;
}
.si-ap-swatches { display: flex; gap: 10px; }
.si-ap-sw {
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; padding: 0;
}
.si-ap-sw[aria-pressed="true"] { border-color: var(--ap-ink, #0d3b3a); }
.si-ap-close {
  float: right; font: inherit; border: none; background: none; cursor: pointer;
  font-size: 20px; line-height: 1; color: var(--ap-muted, rgba(13,59,58,.70)); padding: 4px;
}
.si-ap-note { font-size: 12.5px; color: var(--ap-muted, rgba(13,59,58,.70)); margin: 4px 0 0; }

/* =====================================================================
 * PER-SITE VARIABLE MAPS — each site maps its own variables to --ap-*.
 * Add a new section per site/port. Light-mode values must be identical
 * to the site's own :root (verified by the port's before/after check).
 * ===================================================================== */

/* ---- silcme (SI LCME hub) ---- */
html { --gold: var(--ap-accent); --gold-light: var(--ap-accent-soft); }
html[data-theme="dark"] {
  --paper: var(--ap-bg, #10151f);
  --card: var(--ap-card, #1a2233);
  --ink: var(--ap-ink, #e9ecf4);
  --muted: var(--ap-muted, #9aa5bc);
  --line: var(--ap-line, #2a3449);
  --head: var(--ap-head, #eef1f7);
}

/* ---- sinursingschool (SI Nursing hub, teal brand) ----
 * Default accent slot ("gold") is the teal brand. Swatches: Teal (brand) |
 * Gold | Plum | Navy. */
html { --gold: var(--ap-accent); --gold-light: var(--ap-accent-soft); }
html[data-accent="gold"] { --ap-accent: #17817d; --ap-accent-soft: rgba(23,129,125,.12); --gold-deep: #0d3b3a; }
html[data-accent="teal"] { --ap-accent: #1c2b4a; --ap-accent-soft: #e2e8f2; --gold-deep: #131e35; }
html[data-accent="forest"] { --ap-accent: #b98a2f; --ap-accent-soft: #f4ead2; --gold-deep: #7a5a1a; }
/* Plum slot keeps the shared #7c4a6e / #f3e6ef. */
html[data-theme="dark"] {
  --paper: var(--ap-bg, #0a1f1e);
  --card: var(--ap-card, #102828);
  --ink: var(--ap-ink, #f2f7f7);
  --muted: var(--ap-muted, rgba(242,247,247,.72));
  --line: var(--ap-line, rgba(242,247,247,.14));
  --head: var(--ap-head, #f2f7f7);
  --head-deep: var(--ap-head, #f2f7f7);
  --gold-deep: var(--ap-accent);
  --ap-accent: #7fd1d0; --ap-accent-soft: #102828;
}
html[data-theme="dark"][data-accent="teal"] { --ap-accent: #8fa3c8; --ap-accent-soft: #1c2740; }
html[data-theme="dark"][data-accent="forest"] { --ap-accent: #d4a94e; --ap-accent-soft: #2b2413; }
html[data-theme="dark"][data-accent="plum"] { --ap-accent: #b07fa0; --ap-accent-soft: #2c1e28; }
/* CTA button text on accent backgrounds: white on teal/navy/plum, dark on gold. */
/* CTA buttons are invariant teal + white in every accent and mode (3-hue system). */
.btn-gold, .btn-gold-nav,
html[data-theme="dark"] .btn-gold,
html[data-theme="dark"] .btn-gold-nav { color: #fff; }
/* ---- Button-visibility audit fixes (2026-10-02, all ratios computed) ----
 * CTA hover (light, teal/navy/plum slots): #fff on #8f6617 = 5.15:1
 * (2026-10-03 3-hue redo: CTA buttons are invariant teal #17817d + white 4.70:1,
 * hover pine #0d3b3a + white; accent slots no longer recolor CTAs.)
 * Brand mark "N" (light, teal/navy/plum slots): #fff on accents >= 4.7:1 */
html[data-accent="gold"]:not([data-theme="dark"]) .btn-gold:hover,
html[data-accent="gold"]:not([data-theme="dark"]) .btn-gold-nav:hover { background: var(--pine); color: #fff; }
html[data-accent="teal"]:not([data-theme="dark"]) .btn-gold:hover,
html[data-accent="teal"]:not([data-theme="dark"]) .btn-gold-nav:hover,
html[data-accent="plum"]:not([data-theme="dark"]) .btn-gold:hover,
html[data-accent="plum"]:not([data-theme="dark"]) .btn-gold-nav:hover { background: #8f6617; color: #fff; }
html[data-accent="gold"]:not([data-theme="dark"]) .brand-mark,
html[data-accent="teal"]:not([data-theme="dark"]) .brand-mark,
html[data-accent="plum"]:not([data-theme="dark"]) .brand-mark { color: #fff; }
/* Auth modal dark mode: inactive tab keeps its light mist chip with pine text
 * (11.4:1); demo-button hover goes pine-900. */
html[data-theme="dark"] .si-auth-tab { color: var(--pine); }
/* Contrast pass 2026-11-10: --pine/--gold-deep text on themed surfaces.
 * --pine never flips (it is also a background token), so text usages get
 * the brightened accent in dark; body-ish auth notes get themed ink. */
html[data-theme="dark"] .section .kicker { color: var(--ap-accent); }
html[data-theme="dark"] .card .site-tag { color: var(--ap-accent); }
html[data-theme="dark"][data-accent="plum"] .card .site-tag { color: #d9b0cd; }
html[data-theme="dark"] .si-auth-context,
html[data-theme="dark"] .si-auth-err,
html[data-theme="dark"] .si-auth-note { color: var(--ink); }
html[data-theme="dark"] ::placeholder { color: rgba(242,247,247,.62); }
html[data-theme="dark"] .callout a:not(.btn) { color: var(--ap-accent); }
html[data-theme="dark"] .si-auth-demo-btn:hover { background: var(--pine-900); }
