/* ==========================================================================
   Dark mode for the public site (html[data-theme="dark"]). Loaded after styles.css.
   Set by assets/js/theme.js. Default theme is dark; the header button switches it.
   Part 1: colour variables. Part 2: fixed-colour fixes. Part 3: generated from the
   hard-coded light colours found in styles.css / blog-extras.css / ebooks.css / library.css.
   ========================================================================== */
html[data-theme="dark"] {
  color-scheme: dark;
  --brand-ink: #e7f0ed; --brand-paper: #0e1517; --surface: #161f22;
  --ink-soft: #a9bcb8; --line: #2a3a40; --line-strong: #3a4e55;
  --brand-primary-dark: #2fd6b4;
  --ok: #6fe0a4; --ok-tint: #16372b; --warn: #f2c46b; --warn-tint: #3b3114;
  --mark: #ff9a94; --bad-tint: #3d1d1d; --info: #7cc4f0; --info-tint: #15303f;
}
html[data-theme="dark"] body { background: var(--brand-paper); color: var(--brand-ink); }

/* dark panels that were "ink" in light mode stay dark */
html[data-theme="dark"] .hero, html[data-theme="dark"] .section-dark, html[data-theme="dark"] .site-footer { background: #0a1214; }
html[data-theme="dark"] .skip-link { background: #0a1214; color: #fff; }

/* things that use the brand colour as a background need dark text on top of it */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .site-nav a.nav-cta:hover,
html[data-theme="dark"] .req-badge,
html[data-theme="dark"] .chat-launcher,
html[data-theme="dark"] .site-footer a.foot-cta,
html[data-theme="dark"] .consult-banner,
html[data-theme="dark"] .consult-banner p,
html[data-theme="dark"] .pf-nav:hover,
html[data-theme="dark"] .pf-nav:focus-visible,
html[data-theme="dark"] .portfolio-cats button[aria-pressed="true"] .pf-tab-num { color: #10191b; }
html[data-theme="dark"] .btn-primary:hover, html[data-theme="dark"] .btn-primary:focus-visible { background: var(--brand-primary); color: #10191b; filter: brightness(1.1); }
html[data-theme="dark"] .svc-step-n { background: var(--brand-primary); color: #10191b; }
html[data-theme="dark"] .portfolio-cats button[aria-pressed="true"],
html[data-theme="dark"] .pf-topic.is-active { background: var(--brand-primary); border-color: var(--brand-primary); color: #10191b; }

/* form fields */
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: #0f1719; color: #e4eeeb; border-color: #33454c; }
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: #6f817c; }

/* grey school logos need a light chip to stay visible */
html[data-theme="dark"] .logo-track img { background: #f3f5f1; border-radius: 8px; padding: 6px 10px; opacity: .9; }

/* generated from styles.css */
html[data-theme="dark"] .badge { background: #1d2b2b !important; }
html[data-theme="dark"] .portfolio-item img { background: #151e1a !important; }
html[data-theme="dark"] .blog-card { background: #141f1f !important; }
html[data-theme="dark"] .blog-card-media-fallback { background: linear-gradient(135deg, var(--brand-paper), #141f1f) !important; }
html[data-theme="dark"] .blog-card-category { background: rgba(22,31,34,.92) !important; }
html[data-theme="dark"] .quick-reply-chip:hover { background: #141f1f !important; }
html[data-theme="dark"] .order-tracker-dot { background: #141f1f !important; }
html[data-theme="dark"] textarea { background: #141f1f !important; }
html[data-theme="dark"] .chat-msg-mine { background: color-mix(in srgb, var(--brand-primary) 30%, #141f1f) !important; }
html[data-theme="dark"] .svc-group-ico { background: color-mix(in srgb, var(--brand-primary) 22%, #141f1f) !important; }
html[data-theme="dark"] .pf-section::after { background: #1c2b28 !important; }
html[data-theme="dark"] .pf-shot { background: linear-gradient(135deg, #151e1a, #1c2b26) !important; }
html[data-theme="dark"] .pf-shot::after { background: linear-gradient(110deg, transparent 35%, rgba(22,31,34,.55) 50%, transparent 65%) !important; }
/* generated from blog-extras.css */
/* generated from ebooks.css */
html[data-theme="dark"] .eb-owned { color: #97d8c5 !important; }
/* generated from library.css */
html[data-theme="dark"] .lib-chip-new { background: #221e11 !important; color: #d8c397 !important; }
html[data-theme="dark"] .lib-cover { background: #151e1a !important; }
html[data-theme="dark"] .ebs-cover { background: #151e1a !important; }
html[data-theme="dark"] .ebs-flag { background: #141f1f !important; color: #e4eef1 !important; }
html[data-theme="dark"] .ebs-flag-hot { background: #221e11 !important; color: #d8c397 !important; }
html[data-theme="dark"] .lib-prog-bar { background: #1e2a25 !important; }

/* ==========================================================================
   Dark-mode colour fixes (audit of Oct 2026).
   In dark mode --brand-ink turns LIGHT, so anything that used it as a background with fixed white text, or as text on the
   teal brand colour, became light-on-light. And hard-coded light boxes kept light text. These rules fix those.
   ========================================================================== */

/* 1) selected / "ink" buttons: teal with dark text, like the other primary buttons */
html[data-theme="dark"] .eb-chip.on, html[data-theme="dark"] .eb-chip:hover,
html[data-theme="dark"] .lib-cat-pill.is-on { background: var(--brand-primary); color: #10191b; border-color: var(--brand-primary); }
html[data-theme="dark"] .rf-native { background: #2f4a50; color: #fff; }

/* 2) things on the teal brand colour need dark text */
html[data-theme="dark"] .be-staff, html[data-theme="dark"] .cm-send, html[data-theme="dark"] .cm-ico,
html[data-theme="dark"] .rf-copy, html[data-theme="dark"] .eb-flag, html[data-theme="dark"] .av.nf-av-named,
html[data-theme="dark"] button.ap-vbtn.ap-on { color: #10191b !important; }

/* 3) hard-coded light boxes become dark boxes */
html[data-theme="dark"] .tool-lock, html[data-theme="dark"] .tool-lock-inline,
html[data-theme="dark"] .pdfx-note, html[data-theme="dark"] .pdfx-msg-warn { background: var(--warn-tint); border-color: #5c4a1d; color: var(--brand-ink); }
html[data-theme="dark"] .pdfx-msg { background: var(--surface); color: var(--brand-ink); }
html[data-theme="dark"] .cg-mini, html[data-theme="dark"] .cg-x { background: var(--surface); color: var(--brand-ink); border-color: var(--line-strong); }
html[data-theme="dark"] .cg-mini-del { background: var(--bad-tint); border-color: #6a2f2f; color: var(--mark); }
html[data-theme="dark"] .cg-df, html[data-theme="dark"] .cite-out, html[data-theme="dark"] .cc-badge, html[data-theme="dark"] .cg-pvref, html[data-theme="dark"] .cg-pvin { background: var(--surface); color: var(--brand-ink); border-color: var(--line); }

/* 4) dark text on the dark page: lighter versions */
html[data-theme="dark"] .cg-ann, html[data-theme="dark"] .cc-meta, html[data-theme="dark"] .nfc-status { color: var(--ink-soft); }
html[data-theme="dark"] .pdfx-preview.is-bad, html[data-theme="dark"] .pdfx-pdfico,
html[data-theme="dark"] .nfc-status.nfc-err, html[data-theme="dark"] .nfc-err { color: var(--mark); }
html[data-theme="dark"] .nfc-status.nfc-ok { color: var(--ok); }
html[data-theme="dark"] .w2p-below { color: var(--warn); border-color: #5c4a1d; }
