/* Campus colors inherit the shared dashboard palette. Layout and brand assets stay unchanged. */
html[data-theme="dark"] {
  --bg: var(--ui-canvas);
  --ink: var(--ui-text);
  --muted: var(--ui-text-muted);
  --line: var(--ui-border);
  --campus-accent: var(--ui-accent);
}

html[data-theme="dark"] .course-page {
  --course-ink: var(--ui-text);
  --course-muted: var(--ui-text-muted);
  --course-line: var(--ui-border);
}

/* Page surfaces, navigation and account controls. */
html[data-theme="dark"] :is(
  .campus-sidebar, .campus-card, .campus-dialog, .campus-auth-card,
  .course-content-card, .course-detail-outline, .course-outline-mobile-toggle,
  .campus-skip
) {
  background: var(--ui-surface);
  border-color: var(--ui-border);
  color: var(--ui-text);
}

html[data-theme="dark"] #campus-app .campus-auth-shell { background: transparent; }

html[data-theme="dark"] :is(.campus-nav, .campus-icon-button) { color: var(--ui-text-secondary); }
html[data-theme="dark"] :is(.campus-nav[aria-current="page"], .campus-profile) {
  background: var(--ui-accent-soft);
}
html[data-theme="dark"] .campus-nav[aria-current="page"] { color: var(--ui-accent); border-color: var(--ui-border); }
/* The account surface needs no permanent hairline; keyboard focus keeps its outline. */
html[data-theme="dark"] .campus-profile { border-color: transparent; }
html[data-theme="dark"] :is(.campus-nav:hover, .campus-nav[aria-current="page"]:hover, .campus-profile:hover) {
  background: var(--ui-accent-hover);
  color: var(--ui-accent);
}
html[data-theme="dark"] .campus-profile strong { color: var(--ui-text); }
html[data-theme="dark"] .campus-icon-button:hover { background: var(--ui-surface-hover); }
html[data-theme="dark"] .campus-avatar {
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
}
html[data-theme="dark"] :is(.campus-profile .campus-avatar, .campus-auth-photo .campus-auth-avatar-large) {
  background: var(--purple);
  color: #fff;
}
html[data-theme="dark"] :is(.campus-avatar:has(img), .campus-profile .campus-avatar:has(img), .campus-auth-photo .campus-auth-avatar-large:has(img)) {
  background: transparent;
}

/* Secondary text is brighter than the canvas without competing with titles. */
html[data-theme="dark"] :is(
  .campus-page-heading p, .campus-section-heading p, .campus-resume-info p,
  .campus-progress-details p, .campus-focus p, .campus-home-session p,
  .campus-home-job p, .campus-dialog-header p, .campus-dialog-body > p,
  .campus-dialog-body .campus-plain-list, .campus-field > label, .campus-field > span,
  .campus-auth-intro, .campus-auth-help, .campus-auth-loading, .campus-auth-field > label,
  .campus-auth-photo-details p, .campus-auth-photo-status,
  .course-homework-intro, .course-video-progress-hint,
  .coaching-session-description, .coaching-prepare > p, .coaching-checklist > div,
  .coaching-empty p, .coaching-questions-heading p, .coaching-question > p,
  .opportunities-gate p, .opportunities-preferences p, .opportunities-preference-summary,
  .opportunities-section-heading p, .opportunities-unlocked-intro p,
  .opportunities-description, .opportunities-empty p
) { color: var(--ui-text-secondary); }

html[data-theme="dark"] :is(
  .campus-kicker, .campus-date, .campus-profile small, .campus-profile > .icon,
  .campus-lesson-meta, .campus-session-time, .campus-source, .campus-home-job-footer,
  .campus-home-job .campus-example, .campus-home-lock-note, .campus-scenario small,
  .campus-auth-eyebrow, .campus-auth-note, .campus-auth-photo-details h3 span,
  .campus-auth-email span, .course-module-number, .course-module-status,
  .course-outline-mobile-toggle small, .course-quiz-question legend > span,
  .course-video-label, .course-video-content p,
  .coaching-timezone, .coaching-schedule-note, .coaching-sample, .coaching-session-meta,
  .coaching-coach > div > span, .coaching-join > span, .coaching-private-note,
  .coaching-next-heading > span, .coaching-question-session,
  .opportunities-progress-label, .opportunities-preview-label,
  .opportunities-company > span, .opportunities-lock-icon, .opportunities-meta,
  .opportunities-locked-footer, .opportunities-footnote, .opportunities-result-count
) { color: var(--ui-text-muted); }

html[data-theme="dark"] .campus-form-note { color: var(--ui-text-muted) !important; }

html[data-theme="dark"] :is(
  .campus-progress-details strong, .campus-home-job h3, .campus-day-tile strong,
  .campus-auth-card h1, .campus-auth-photo-details h3, .course-quiz-question legend,
  .coaching-date > strong, .coaching-coach strong,
  .opportunities-company strong, .opportunities-card h3, .opportunities-card-footer > strong
) { color: var(--ui-text); }

/* Primary pink buttons retain their brand gradient and white labels. */
html[data-theme="dark"] .campus-button.secondary {
  background: var(--ui-surface-raised);
  border-color: var(--ui-border);
  color: var(--ui-text-secondary);
}
html[data-theme="dark"] .campus-button.secondary:not(:disabled):hover {
  background: var(--ui-surface-hover);
  border-color: var(--ui-border-strong);
  color: var(--ui-text);
}
html[data-theme="dark"] .campus-button.quiet { color: var(--ui-text-secondary); }
html[data-theme="dark"] .campus-button.quiet:not(:disabled):hover {
  background: var(--ui-surface-hover);
  color: var(--ui-text);
}

html[data-theme="dark"] :is(
  .campus-pill, .campus-focus-icon, .course-resource-icon,
  .coaching-kind, .coaching-prepare-icon, .opportunities-gate-symbol,
  .opportunities-unlocked-symbol, .opportunities-preferences-icon, .opportunities-company-mark
) {
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
}

/* Home illustrations remain colored, with dark inset surfaces. */
html[data-theme="dark"] .campus-cover {
  background: linear-gradient(135deg, var(--ui-accent-soft), var(--ui-surface-raised));
  color: var(--ui-text);
}
html[data-theme="dark"] .campus-cover::before,
html[data-theme="dark"] .campus-cover::after { border-color: var(--ui-border-strong); }
html[data-theme="dark"] .campus-browser-art {
  background: var(--ui-surface-raised);
  border-color: var(--ui-border-strong);
}
html[data-theme="dark"] .campus-browser-body { background: var(--ui-surface); }
html[data-theme="dark"] :is(.campus-browser-dots i, .campus-browser-lines i) { background: var(--ui-border-strong); }
html[data-theme="dark"] .campus-browser-lines i:last-child { background: var(--ui-accent); }
html[data-theme="dark"] .campus-browser-shape {
  background: linear-gradient(135deg, var(--ui-accent-soft), var(--ui-accent-hover));
  color: var(--ui-accent);
}
html[data-theme="dark"] .campus-progress-ring {
  background: conic-gradient(var(--ui-accent) var(--progress), var(--ui-border) 0);
}
html[data-theme="dark"] .campus-progress-ring::before { background: var(--ui-surface); }
html[data-theme="dark"] :is(.campus-progress-title .icon, .campus-unlock-line .icon) { color: var(--ui-accent); }
html[data-theme="dark"] :is(.campus-unlock-line, .campus-home-job, .campus-day-tile, .campus-auth-email) {
  background: var(--ui-surface-muted);
  border-color: var(--ui-border);
}
html[data-theme="dark"] .campus-unlock-line { color: var(--ui-text-secondary); }
html[data-theme="dark"] .campus-day-tile small {
  background: var(--ui-accent-soft);
  color: var(--ui-text-secondary);
}
html[data-theme="dark"] :is(.campus-focus, .coaching-prepare, .opportunities-gate, .opportunities-unlocked-intro) {
  background: linear-gradient(135deg, var(--ui-surface), var(--ui-surface-muted));
}
html[data-theme="dark"] .campus-storage-warning {
  background: var(--ui-warning-soft, #352a1f);
  color: var(--ui-warning, #e9c185);
}

/* Forms and dialogs use the same input, border and feedback palette. */
html[data-theme="dark"] .campus-overlay { background: rgb(6 4 10 / .7); }
html[data-theme="dark"] :is(
  .campus-home-session, .campus-home-lock-note, .campus-dialog-header,
  .coaching-date, .coaching-join, .coaching-question-session,
  .opportunities-locked-footer, .opportunities-card-footer
) { border-color: var(--ui-border); }
html[data-theme="dark"] .opportunities-gate::after { border-color: var(--ui-border); }

html[data-theme="dark"] :is(.campus-field input, .campus-field textarea, .campus-auth-field input) {
  background: var(--ui-input);
  border-color: var(--ui-border);
  color: var(--ui-text);
  caret-color: var(--ui-accent);
}
html[data-theme="dark"] :is(.campus-field input, .campus-field textarea, .campus-auth-field input, .opportunities-search input)::placeholder {
  color: var(--ui-text-muted);
  opacity: 1;
}
html[data-theme="dark"] :is(.campus-field input:focus, .campus-field textarea:focus, .campus-auth-field input:focus) {
  background: var(--ui-input);
  border-color: var(--ui-accent);
  box-shadow: inset 0 0 0 1px var(--ui-accent);
}
html[data-theme="dark"] .campus-auth-password .campus-icon-button { color: var(--ui-text-muted); }
html[data-theme="dark"] :is(.campus-choice, .campus-scenario) {
  background: var(--ui-surface-raised);
  border-color: var(--ui-border);
  color: var(--ui-text-secondary);
}
html[data-theme="dark"] .campus-scenario:hover {
  background: var(--ui-surface-hover);
  border-color: var(--ui-border-strong);
}
html[data-theme="dark"] .campus-choice[aria-pressed="true"] {
  background: var(--ui-accent-soft);
  border-color: var(--ui-border-strong);
  color: var(--ui-accent);
}
html[data-theme="dark"] .campus-scenario > .icon { color: var(--ui-accent); }
html[data-theme="dark"] #campus-toast {
  background: var(--ui-surface-raised);
  border-color: var(--ui-border-strong);
  color: var(--ui-text);
}
html[data-theme="dark"] .campus-auth-error {
  background: var(--ui-danger-soft);
  color: var(--ui-danger);
}

/* Course progress and quiz states remain distinct at every stage. */
html[data-theme="dark"] .course-video-preview { background: var(--ui-input); color: var(--ui-text); }
html[data-theme="dark"] .course-video-mark { border-color: var(--ui-border); color: var(--ui-text-secondary); }
html[data-theme="dark"] :is(.course-video-progress-track, .course-progress-track, .opportunities-progress) { background: var(--ui-border); }
html[data-theme="dark"] .opportunities-progress > span { background: var(--ui-accent); }
html[data-theme="dark"] .course-page .course-video-progress-hint { color: var(--ui-text-secondary); }
html[data-theme="dark"] .course-module-link.is-current {
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
}
html[data-theme="dark"] .course-module-link:not(.is-locked):hover {
  background: var(--ui-accent-hover);
  color: var(--ui-accent);
}
html[data-theme="dark"] :is(.course-module-link.is-locked, .course-module-link.is-locked .course-module-status) { color: var(--ui-text-muted); }
html[data-theme="dark"] .course-module-link.is-complete .course-module-status { color: var(--ui-success, #8cceaa); }
html[data-theme="dark"] .course-module-link.is-current :is(.course-module-number, .course-module-status) { color: var(--ui-accent); }
html[data-theme="dark"] .course-lesson-pagination a { color: var(--ui-text-secondary); }
html[data-theme="dark"] .course-lesson-pagination a:hover { color: var(--ui-accent); }
html[data-theme="dark"] .course-lesson-pagination [aria-disabled="true"] { color: var(--ui-text-muted); }
html[data-theme="dark"] .course-quiz-option {
  background: var(--ui-surface-raised);
  border-color: var(--ui-border);
  color: var(--ui-text-secondary);
}
html[data-theme="dark"] .course-quiz-option:hover {
  background: var(--ui-surface-hover);
  border-color: var(--ui-border-strong);
}
html[data-theme="dark"] .course-quiz-option:has(input:checked) {
  background: var(--ui-accent-soft);
  border-color: var(--ui-accent);
  color: var(--ui-text);
}
html[data-theme="dark"] .course-question-feedback.is-incorrect { color: var(--ui-danger); }
html[data-theme="dark"] .course-quiz-feedback {
  background: var(--ui-danger-soft);
  border-color: var(--ui-danger-soft);
  color: var(--ui-danger);
}
html[data-theme="dark"] .course-quiz-feedback.is-correct {
  background: var(--ui-success-soft, #1d3029);
  border-color: var(--ui-success-soft, #1d3029);
  color: var(--ui-success, #8cceaa);
}
html[data-theme="dark"] :is(.course-question-feedback.is-correct, .course-quiz-success) { color: var(--ui-success, #8cceaa); }

/* Coaching and opportunities share filter and tag treatments. */
html[data-theme="dark"] :is(.opportunities-filter) {
  background: var(--ui-surface);
  border-color: var(--ui-border);
  color: var(--ui-text-secondary);
}
html[data-theme="dark"] :is(.opportunities-filter:hover) {
  background: var(--ui-surface-hover);
  border-color: var(--ui-border-strong);
}
html[data-theme="dark"] :is(.opportunities-filter.is-active) {
  background: var(--ui-accent-soft);
  border-color: var(--ui-border-strong);
  color: var(--ui-accent);
}
html[data-theme="dark"] :is(.coaching-date, .opportunities-skills > span) {
  background: var(--ui-surface-muted);
  color: var(--ui-text-secondary);
}
html[data-theme="dark"] .coaching-avatar {
  background: linear-gradient(135deg, var(--ui-accent-soft), var(--ui-accent-hover));
  color: var(--ui-accent);
}
html[data-theme="dark"] .coaching-join > button { background: var(--ui-surface-muted); color: var(--ui-text-muted); }
html[data-theme="dark"] .coaching-session-meta > span + span::before,
html[data-theme="dark"] .opportunities-meta span + span::before { background: var(--ui-border-strong); }
html[data-theme="dark"] :is(
  .coaching-checklist .icon, .coaching-empty > .icon, .coaching-question-label,
  .opportunities-progress-label strong, .opportunities-preference-summary .icon,
  .opportunities-footnote .icon, .opportunities-empty > .icon, .opportunities-details
) { color: var(--ui-accent); }
html[data-theme="dark"] :is(.coaching-question-actions button, .opportunities-save) { color: var(--ui-text-muted); }
html[data-theme="dark"] :is(.coaching-question-actions button:hover, .opportunities-save:hover, .opportunities-save.is-saved) {
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
}
html[data-theme="dark"] .coaching-question-actions button[data-action="delete-question"]:hover {
  background: var(--ui-danger-soft);
  color: var(--ui-danger);
}
html[data-theme="dark"] .opportunities-search {
  background: var(--ui-input);
  border-color: var(--ui-border);
  color: var(--ui-text-muted);
}
html[data-theme="dark"] .opportunities-search input { color: var(--ui-text); }
html[data-theme="dark"] .opportunities-save.is-saved .icon { stroke: currentColor; }
html[data-theme="dark"] .opportunities-details:hover { color: var(--ui-text); }

html[data-theme="dark"] :is(button, a, input, textarea, summary):focus-visible,
html[data-theme="dark"] :is(.opportunities-search, .course-quiz-option):focus-within {
  outline-color: var(--ui-accent);
}

/* Mobile keeps the existing transparent nav items and the active top marker. */
@media (max-width: 760px) {
  html[data-theme="dark"] .campus-navigation {
    background: var(--ui-surface);
    border-color: var(--ui-border);
  }
  html[data-theme="dark"] .campus-profile { background: var(--ui-surface); }
  html[data-theme="dark"] .campus-profile:hover { background: var(--ui-surface-hover); }
  html[data-theme="dark"] :is(.campus-nav, .campus-nav:hover, .campus-nav[aria-current="page"], .campus-nav[aria-current="page"]:hover) {
    background: transparent;
    color: var(--ui-text-secondary);
  }
  html[data-theme="dark"] .campus-nav[aria-current="page"] > .icon { color: var(--ui-accent); }
}
