/* =====================================================================
 * 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: #b98a2f;
  --ap-accent-soft: #f4ead2;
  --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: #10151f;
  --ap-card: #1a2233;
  --ap-ink: #e9ecf4;
  --ap-muted: #9aa5bc;
  --ap-line: #2a3449;
  --ap-head: #eef1f7;
  /* accent stays readable on dark */
  --ap-accent: #d4a94e; --ap-accent-soft: #2b2413;
}
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(31,15,20, 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, var(--card)); color:var(--ap-ink, var(--ink));
  border:1px solid var(--ap-line, var(--line)); 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, var(--muted)); }
.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, var(--muted)); }
.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, var(--line)); background:transparent;
  color:var(--ap-ink, var(--ink)); cursor:pointer;
}
.si-ap-seg button[aria-pressed="true"] {
  border-color:var(--ap-accent, var(--gold));
  background:var(--ap-accent-soft, var(--gold-soft));
  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, #1c2b4a); }
.si-ap-close {
  float:right; font:inherit; border:none; background:none; cursor:pointer;
  font-size:20px; line-height:1; color:var(--ap-muted, var(--muted)); padding:4px;
}
.si-ap-note { font-size:12.5px; color:var(--ap-muted, var(--muted)); 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);
}

/* ---- sibarexam (SI Bar Exam) ---- */
/* --gold is defined in this site's :root (brand gold for the Sign-up button).
   Neutralize only --gold-light, which this site never defined. */
html { --gold-light: initial; --head: #1c2b4a; }
/* Accent: the "gold" slot keeps law's brand burgundy (light-mode identical);
   picking another accent re-themes the burgundy family. */
html[data-accent="teal"]   { --burgundy: #2c7a7b; --burgundy-dark: #1e5a5b; --burgundy-light: #ddefef; --burgundy-border: #bcdcdc; --burgundy-hover: #2a7c7d; --banner: #1e5a5b; }
html[data-accent="plum"]   { --burgundy: #7c4a6e; --burgundy-dark: #5c3653; --burgundy-light: #f3e6ef; --burgundy-border: #ddc4d4; --burgundy-hover: #8f5c80; --banner: #5c3653; }
html[data-accent="forest"] { --burgundy: #3f6b4f; --burgundy-dark: #2c4c38; --burgundy-light: #e4efe7; --burgundy-border: #c2d8c9; --burgundy-hover: #4d7d5e; --banner: #2c4c38; }
html[data-theme="dark"] {
  --paper: #10151f; --card: #1a2233; --ink: #e9ecf4; --muted: #9aa5bc;
  --line: #2a3449; --head: #eef1f7;
  --banner: #2c1a1e;
  --burgundy: #b07a86; --burgundy-dark: #d0a3ad; --burgundy-light: #2c1a1e;
  --burgundy-border: #4a2a32; --burgundy-hover: #c08f9a;
  --card-hover: #232d42; --tab-bg: #232d42;
  --info-bg: #16283a; --info-ink: #dbe4f0;
  --note-bg: #16283a; --note-ink: #a9c8e8; --note-border: #2a4a6b;
  --input-border: #2a3449; --or-text: #9aa5bc; --or-line: #2a3449;
  --passage-bg: #1a2233; --passage-border: #2a3449; --code-bg: #1a2233;
}
html[data-theme="dark"][data-accent="teal"]   { --burgundy: #4aa8a9; --burgundy-dark: #8fd0d0; --burgundy-light: #14302f; --burgundy-border: #1e4a49; --burgundy-hover: #63b8b8; --banner: #14302f; }
html[data-theme="dark"][data-accent="plum"]   { --burgundy: #b07fa0; --burgundy-dark: #cfa3c2; --burgundy-light: #2c1e28; --burgundy-border: #4a2f42; --burgundy-hover: #c092b3; --banner: #2c1e28; }
html[data-theme="dark"][data-accent="forest"] { --burgundy: #6fa287; --burgundy-dark: #9cc8ab; --burgundy-light: #16281d; --burgundy-border: #2c4c38; --burgundy-hover: #84b396; --banner: #16281d; }

/* Button-visibility audit (2026-10-02): dark mode brightens the burgundy
 * family past the point where white text passes, so buttons and the brand
 * mark switch to dark ink on dark theme. */
html[data-theme="dark"] .btn-green,
html[data-theme="dark"] .brand-mark,
html[data-theme="dark"] .btn-green:hover { color:var(--cream); }
html[data-theme="dark"][data-accent="teal"] .btn-green,
html[data-theme="dark"][data-accent="teal"] .brand-mark,
html[data-theme="dark"][data-accent="plum"] .btn-green,
html[data-theme="dark"][data-accent="plum"] .brand-mark,
html[data-theme="dark"][data-accent="forest"] .btn-green,
html[data-theme="dark"][data-accent="forest"] .brand-mark { color:#10151f; }

/* ---- highlight tints + near-white surfaces: readable in both themes ---- */
:root { --note-bg: #fff8e1; --row-flag: #fff7f7; }
html[data-theme="dark"] { --note-bg: #2b2413; --row-flag: #2c1e28; }
html[data-theme="dark"] .oc-tag.prelim { background:#2b2413; color:var(--kicker); border-color:#5a4a1a; }
html[data-theme="dark"] .gap { background:#2b2413; border-color:#5a4a1a; }
html[data-theme="dark"] .qcard { background:var(--card); border-color:#5a4a1a; }
html[data-theme="dark"] .lib-stat,
html[data-theme="dark"] .consent-box,
html[data-theme="dark"] .bill-box,
html[data-theme="dark"] .acad-opts button,
html[data-theme="dark"] .placement-cat button,
html[data-theme="dark"] #study-answer,
html[data-theme="dark"] .px-explain,
html[data-theme="dark"] .px-format,
html[data-theme="dark"] .px-passage,
html[data-theme="dark"] .lib-table th,
html[data-theme="dark"] .rev-q .qpassage { background:var(--card); }

::placeholder{color:var(--muted);opacity:1;}

/* ==== 2026-10-03: 3-color simplification (burgundy #7a2230 / gold #c39a3b / cream #faf6f1). Canonical tokens + legacy aliases; later definitions win. ==== */
:root{
  --burgundy:#7a2230; --burgundy-dark:#571824; --gold:#c39a3b; --cream:#faf6f1;
  --paper:#faf6f1; --card:#faf6f1; --ink:#571824;
  --muted:rgba(87,24,36,.72); --line:rgba(122,34,48,.16); --head:#571824;
  --ink-on-dark:#faf6f1; --muted-on-dark:rgba(250,246,241,.78);
  --link-dark:#faf6f1; --kicker:#7a2230;
  --gold-soft:rgba(195,154,59,.14); --burgundy-soft:rgba(122,34,48,.08);
  --err-ink:#571824; --err-bg:rgba(122,34,48,.08);
  --ok-ink:#571824; --ok-bg:rgba(195,154,59,.14);
  --shadow:0 4px 18px rgba(87,24,36,.10);
  --navy:#571824; --navy-dark:#571824;
  --burgundy-light:rgba(122,34,48,.08); --burgundy-hover:#7a2230;
  --gold-light:rgba(195,154,59,.14); --gold-hover:#c39a3b;
  --tag-bg:rgba(195,154,59,.14); --zebra:rgba(122,34,48,.04);
  --read-border:rgba(195,154,59,.45); --read-ink:#571824;
  --faq-hover:rgba(122,34,48,.04); --std-hover:rgba(122,34,48,.04);
  --mark:rgba(195,154,59,.35); --tab-bg:rgba(122,34,48,.06);
  --info-bg:rgba(195,154,59,.14); --info-ink:#571824;
  --note-bg:rgba(195,154,59,.14); --note-ink:#571824; --note-border:rgba(195,154,59,.45);
  --input-border:rgba(122,34,48,.30);
  --or-text:rgba(87,24,36,.72); --or-line:rgba(122,34,48,.16);
  --progress-track:rgba(122,34,48,.12);
  --ube-green:#7a2230; --ube-bg:rgba(195,154,59,.14); --ube-ink:#571824;
  --nextgen-purple:#c39a3b; --nextgen-bg:rgba(195,154,59,.14); --nextgen-ink:#571824;
  --green:#7a2230; --green-dark:#571824;
  --banner:#571824; --burgundy-border:rgba(122,34,48,.20);
  --card-hover:rgba(122,34,48,.04);
  --passage-bg:rgba(195,154,59,.10); --passage-border:rgba(195,154,59,.45);
  --code-bg:rgba(122,34,48,.05);
  --row-flag:rgba(195,154,59,.10);
}
html[data-theme="dark"]{
  --paper:#1f0f14; --card:#2a141b; --ink:#faf6f1;
  --muted:rgba(250,246,241,.72); --line:rgba(250,246,241,.16); --head:#faf6f1;
  --kicker:#c39a3b; --link-dark:#faf6f1;
  --gold:#c39a3b; --gold-hover:#c39a3b;
  --gold-soft:rgba(195,154,59,.16); --burgundy-soft:rgba(250,246,241,.06);
  --err-ink:#faf6f1; --err-bg:rgba(195,154,59,.16);
  --ok-ink:#faf6f1; --ok-bg:rgba(195,154,59,.16);
  --shadow:0 4px 18px rgba(0,0,0,.35);
  --navy:#2a141b; --navy-dark:#2a141b;
  --tag-bg:rgba(195,154,59,.16); --zebra:rgba(250,246,241,.04);
  --read-border:rgba(195,154,59,.40); --read-ink:#c39a3b;
  --faq-hover:rgba(250,246,241,.05); --std-hover:rgba(250,246,241,.05);
  --tab-bg:rgba(250,246,241,.06);
  --info-bg:rgba(195,154,59,.16); --info-ink:#faf6f1;
  --note-bg:rgba(195,154,59,.16); --note-ink:#faf6f1; --note-border:rgba(195,154,59,.40);
  --input-border:rgba(250,246,241,.28);
  --or-text:rgba(250,246,241,.72); --or-line:rgba(250,246,241,.16);
  --progress-track:rgba(250,246,241,.12);
  --mark:rgba(195,154,59,.30);
  --muted-on-dark:rgba(250,246,241,.78);
  --banner:#2a141b; --burgundy-border:rgba(250,246,241,.16);
  --card-hover:rgba(250,246,241,.05);
  --passage-bg:rgba(195,154,59,.12); --passage-border:rgba(195,154,59,.40);
  --code-bg:rgba(250,246,241,.06);
  --row-flag:rgba(195,154,59,.12);
  --gold-light:rgba(195,154,59,.16);
  --burgundy-light:rgba(250,246,241,.06); --burgundy-hover:#7a2230;
  --ube-green:#c39a3b; --ube-bg:rgba(195,154,59,.16); --ube-ink:#faf6f1;
  --nextgen-purple:#c39a3b; --nextgen-bg:rgba(195,154,59,.16); --nextgen-ink:#faf6f1;
  --green:#c39a3b; --green-dark:#c39a3b;
}
:root{
  --ap-bg:#faf6f1; --ap-card:#faf6f1; --ap-ink:#571824;
  --ap-muted:rgba(87,24,36,.72); --ap-line:rgba(122,34,48,.16); --ap-head:#571824;
  --ap-accent:#c39a3b; --ap-accent-soft:rgba(195,154,59,.14); --ap-accent-ink:#571824;
}
html[data-theme="dark"]{
  --ap-bg:#1f0f14; --ap-card:#2a141b; --ap-ink:#faf6f1;
  --ap-muted:rgba(250,246,241,.72); --ap-line:rgba(250,246,241,.16); --ap-head:#faf6f1;
  --ap-accent:#c39a3b; --ap-accent-soft:rgba(195,154,59,.18); --ap-accent-ink:#571824;
}
