/* =====================================================================
 * 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(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, #e2e0d8); 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, #5b6472); }
.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, #5b6472); }
.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, #e2e0d8); 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, #1c2b4a); }
.si-ap-close {
  float: right; font: inherit; border: none; background: none; cursor: pointer;
  font-size: 20px; line-height: 1; color: var(--ap-muted, #5b6472); padding: 4px;
}
.si-ap-note { font-size: 12.5px; color: var(--ap-muted, #5b6472); 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 { color: #10151f; }
html[data-theme="dark"] .btn-green:hover { 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: #e8cf6a; border-color: #5a4a1a; }
html[data-theme="dark"] .gap { background: #2b2413; border-color: #5a4a1a; }
html[data-theme="dark"] .qcard { background: #1a2233; 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); }
