/*
 * GAMCA dark-theme migration v1.
 *
 * This bounded compatibility layer is loaded after the legacy high-contrast
 * bundle and every current component stylesheet. It is deliberately scoped to
 * data-theme="dark" so the default theme is untouched. Remove it after the
 * component styles consume the semantic tokens directly and the legacy
 * high-contrast stylesheet has been retired.
 */

:root[data-theme="dark"] {
  color-scheme: dark;

  --theme-page: #000000;
  --theme-surface: #000000;
  --theme-text: #ffffff;
  --theme-text-muted: #d8d8d8;
  --theme-border: #5a5a5a;
  --theme-border-muted: #333333;
  --theme-accent: #cda300;
  --theme-on-accent: #000000;
  --theme-info: #0aaff8;
  --theme-focus-ring: 0 0 0 3px rgba(205, 163, 0, 0.48);

  /* Legacy aliases retained for one release while components migrate. */
  --hc-bg: var(--theme-page);
  --hc-surface: var(--theme-surface);
  --hc-fg: var(--theme-text);
  --hc-text: var(--theme-text);
  --hc-muted: var(--theme-text-muted);
  --hc-link: var(--theme-accent);
  --hc-border: var(--theme-border);
  --hc-accent: var(--theme-accent);
  --hc-accent-strong: var(--theme-accent);
  --hc-accent-contrast: var(--theme-on-accent);
  --gamca-brand-yellow: var(--theme-accent);
  --gamca-brand-blue: var(--theme-accent);
  --gamca-brand-navy: var(--theme-page);
  --gamca-ink: var(--theme-text);
  --gamca-action-primary-bg: var(--theme-accent);
  --gamca-action-primary-text: var(--theme-on-accent);
  --gamca-footer-bg: var(--theme-page);
  --gamca-footer-text: var(--theme-text);
  --gamca-color-primary: var(--theme-accent);
  --gamca-color-secondary: var(--theme-accent);
  --gamca-color-ink: var(--theme-text);
  --gamca-color-text-strong: var(--theme-text);
  --gamca-color-muted: var(--theme-text-muted);
  --gamca-color-surface: var(--theme-surface);
  --gamca-color-surface-soft: var(--theme-surface);
  --gamca-color-border: var(--theme-border);
  --gamca-accessible-blue: var(--theme-accent);
  --gamca-focus-ring: var(--theme-focus-ring);
  --primary-color: var(--theme-accent);
  --secondary-color: var(--theme-accent);

  /* Daily-task and graph plug-ins read these aliases. */
  --gwt-color-bg: var(--theme-page);
  --gwt-color-surface: var(--theme-surface);
  --gwt-color-surface-soft: var(--theme-surface);
  --gwt-color-text: var(--theme-text);
  --gwt-color-muted: var(--theme-text-muted);
  --gwt-color-border: var(--theme-border);
  --gwt-color-primary: var(--theme-accent);
  --gwt-color-accent: var(--theme-accent);
}

html[data-theme="dark"],
html[data-theme="dark"] body.high-contrast,
html[data-theme="dark"] body.gamca-high-contrast,
html[data-theme="dark"] body.high-contrast .wrapper,
html[data-theme="dark"] body.high-contrast main,
html[data-theme="dark"] body.high-contrast .gamca-main,
html[data-theme="dark"] body.high-contrast section.page,
html[data-theme="dark"] body.high-contrast .gamca-page {
  background-color: var(--theme-page) !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] body.high-contrast :where(
  .gamca-surface,
  .gamca-card,
  .page-content,
  .gamca-content,
  .well,
  .panel,
  .panel-heading,
  .panel-body,
  .list-group-item,
  .alert,
  .popover,
  .popover-title,
  .tooltip-inner,
  .modal,
  .modal-content,
  .modal-header,
  .modal-body,
  .modal-footer
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body.high-contrast :where(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  li,
  dt,
  dd,
  label,
  legend,
  blockquote,
  figcaption,
  summary,
  address,
  time
) {
  color: var(--theme-text) !important;
}

html[data-theme="dark"] body.high-contrast :where(
  .text-muted,
  .help-block,
  .gamca-color-muted,
  .board-post-date,
  .board-article-date,
  .board-related-date,
  .gamca-archive-card__summary,
  .gwt-play__stats-note,
  .gwt-play__highlight-label
) {
  color: var(--theme-text-muted) !important;
}

html[data-theme="dark"] body.high-contrast .gamca-main a:not(.btn):not(.gamca-button):not(.gamca-chip):not(.board-post-card-link):not(.gamca-oh-action):not(.gamca-sm-action):not(.gamca-sm-resource),
html[data-theme="dark"] body.high-contrast .gamca-footer a {
  color: var(--theme-accent) !important;
  text-decoration-color: currentColor;
}

/* Control-styled anchors keep component state changes instead of prose decoration. */
html[data-theme="dark"] body.high-contrast a:is(
  .btn,
  [role="button"],
  .gamca-button,
  .gamca-quick-actions__link,
  .gamca-oh-action,
  .gamca-sm-action,
  .gamca-sm-resource,
  .gamca-chip,
  .board-archive-filter,
  .page-numbers
),
html[data-theme="dark"] body.high-contrast :is(
  .gamca-audience-links,
  .gamca-admissions-steps,
  .gamca-tab-list,
  .gamca-pagination,
  .bottom-navigation,
  .nav-tabs
) a,
html[data-theme="dark"] body.high-contrast a.gamca-quick-actions__link span {
  text-decoration: none !important;
}

html[data-theme="dark"] body.high-contrast a:hover,
html[data-theme="dark"] body.high-contrast a:focus-visible {
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

html[data-theme="dark"] body.high-contrast :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--theme-accent) !important;
  outline-offset: 3px !important;
  box-shadow: var(--theme-focus-ring) !important;
}

html[data-theme="dark"] body.high-contrast ::selection {
  background: var(--theme-accent);
  color: var(--theme-on-accent);
}

html[data-theme="dark"] body.high-contrast .gamca-content :where(a, code) {
  max-width: 100%;
  overflow-wrap: anywhere !important;
  word-break: break-word;
}

/* Header, navigation, utilities, search, and breadcrumbs. */
html[data-theme="dark"] body.high-contrast :where(
  .gamca-header-shell,
  .header,
  .gamca-header,
  .navbar,
  .navbar-header,
  .navbar-collapse,
  .header-menu,
  .gamca-header__menu,
  .gamca-header__tools,
  .gamca-header__dropdown,
  .dropdown-menu,
  .mobile-menu,

  .mobile-sub-menu,
  .header-search-form,
  .header-login-form,
  .breadcrumbs,
  .gamca-breadcrumbs
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body.high-contrast :where(
  .gamca-header-shell,
  section.header,
  section.header .header-inner,
  section.header .navbar,
  section.header .navbar-header,
  section.header .navbar-collapse,
  .gamca-breadcrumbs,
  .breadcrumbs
) {
  border-color: transparent !important;
}

html[data-theme="dark"] body.high-contrast :where(.gamca-breadcrumbs, .breadcrumbs) {
  border-bottom: 0 !important;
}

html[data-theme="dark"] body.high-contrast section.header .header-inner::after,
html[data-theme="dark"] body.high-contrast section.header .header-bottom {
  display: none !important;
  content: none !important;
  background: none !important;
}

html[data-theme="dark"] body.high-contrast .header :where(a, button),
html[data-theme="dark"] body.high-contrast .gamca-breadcrumbs :where(a, span),
html[data-theme="dark"] body.high-contrast .breadcrumbs :where(a, span) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: transparent !important;
}

html[data-theme="dark"] body.high-contrast .header :where(a, button):hover,
html[data-theme="dark"] body.high-contrast .header :where(a, button):focus-visible,
html[data-theme="dark"] body.high-contrast .header li.active > a,
html[data-theme="dark"] body.high-contrast .header .open > a,
html[data-theme="dark"] body.high-contrast .gamca-breadcrumbs a:hover,
html[data-theme="dark"] body.high-contrast .gamca-breadcrumbs a:focus-visible {
  background-color: var(--theme-surface) !important;
  color: var(--theme-accent) !important;
  border-color: var(--theme-accent) !important;
}

html[data-theme="dark"] body.high-contrast .header li.active > a {
  box-shadow: inset 0 -3px 0 var(--theme-accent) !important;
}

html[data-theme="dark"] body.high-contrast [data-gamca-theme-toggle][aria-pressed="true"] {
  color: var(--theme-text) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast section.header.gamca-header :is(.gamca-header__dropdown .category, .mobile-menu .category) {
  color: var(--theme-text-muted) !important;
  -webkit-text-fill-color: currentColor;
}

/* Buttons, chips, pagination, and status controls. The component prefix must
 * outrank legacy high-contrast white-button rules. Set text-fill explicitly:
 * inherited prose text-fill otherwise paints white over a white control. */
html[data-theme="dark"] body.high-contrast :where(
  .btn,
  .gamca-button,
  button[type="submit"],
  input[type="submit"],
  input[type="button"],
  .cmplz-btn
),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content :where(
  .btn,
  .gamca-button,
  button[type="submit"],
  input[type="submit"],
  input[type="button"],
  .cmplz-btn
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body.high-contrast :where(
  .btn-primary,
  .btn-ocher,
  .gamca-button--primary,
  button[type="submit"],
  input[type="submit"],
  .cmplz-cookiebanner .cmplz-btn.cmplz-accept
),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content :where(
  .btn-primary,
  .btn-ocher,
  .gamca-button--primary,
  button[type="submit"],
  input[type="submit"],
  .cmplz-cookiebanner .cmplz-btn.cmplz-accept
) {
  background-color: var(--theme-accent) !important;
  color: var(--theme-on-accent) !important;
  -webkit-text-fill-color: var(--theme-on-accent) !important;
  border-color: var(--theme-accent) !important;
}

html[data-theme="dark"] body.high-contrast :where(
  .btn,
  .gamca-button,
  button[type="submit"],
  input[type="submit"],
  input[type="button"],
  .cmplz-btn
):hover,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content :where(
  .btn,
  .gamca-button,
  button[type="submit"],
  input[type="submit"],
  input[type="button"],
  .cmplz-btn
):hover,
html[data-theme="dark"] body.high-contrast :where(
  .btn,
  .gamca-button,
  button[type="submit"],
  input[type="submit"],
  input[type="button"],
  .cmplz-btn
):focus-visible,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content :where(
  .btn,
  .gamca-button,
  button[type="submit"],
  input[type="submit"],
  input[type="button"],
  .cmplz-btn
):focus-visible {
  background-color: var(--theme-accent) !important;
  color: var(--theme-on-accent) !important;
  -webkit-text-fill-color: var(--theme-on-accent) !important;
  border-color: var(--theme-accent) !important;
  transform: translateY(-2px);
}

html[data-theme="dark"] body.high-contrast :where(
  .gamca-chip,
  .board-archive-filter,
  .gamca-pagination .page-numbers,
  .gwt-play__status-chip,
  .gamca-badge
) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body.high-contrast :where(
  .gamca-chip.active,
  .board-archive-filter.active,
  .gamca-pagination .page-numbers.current,
  .gwt-play__status-chip
),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content :where(
  .gamca-chip.active,
  .board-archive-filter.active,
  .gamca-pagination .page-numbers.current,
  .gwt-play__status-chip
) {
  background-color: var(--theme-accent) !important;
  color: var(--theme-on-accent) !important;
  -webkit-text-fill-color: var(--theme-on-accent) !important;
  border-color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .gamca-main :where(
  .gamca-admissions-steps a,
  .gamca-tab-list a,
  .nav-tabs > li > a,
  .gamca-pagination a.page-numbers
):hover,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .gamca-main :where(
  .gamca-admissions-steps a,
  .gamca-tab-list a,
  .nav-tabs > li > a,
  .gamca-pagination a.page-numbers
):focus-visible,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .gamca-main :where(
  .gamca-admissions-steps a.active,
  .gamca-admissions-steps .active > a,
  .gamca-tab-list a.active,
  .gamca-tab-list .active > a,
  .nav-tabs > li.active > a
) {
  background-color: var(--theme-accent) !important;
  color: var(--theme-on-accent) !important;
  border-color: var(--theme-accent) !important;
}

/* Forms, native controls, autofill, and tables. */
/* Shared page controls must outrank the legacy white high-contrast input.
 * Keep submit/action controls in their separate component owner above. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content :is(input:not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]), select, textarea),
html[data-theme="dark"] body.high-contrast :where(
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea,
  .form-control,
  .input-group-addon
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
  caret-color: var(--theme-accent);
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content :is(input, textarea)::placeholder,
html[data-theme="dark"] body.high-contrast :where(input, select, textarea)::placeholder {
  color: var(--theme-text-muted) !important;
  -webkit-text-fill-color: var(--theme-text-muted) !important;
  opacity: 1;
}

html[data-theme="dark"] body.high-contrast :where(input, select, textarea):-webkit-autofill,
html[data-theme="dark"] body.high-contrast :where(input, select, textarea):-webkit-autofill:hover,
html[data-theme="dark"] body.high-contrast :where(input, select, textarea):-webkit-autofill:focus {
  -webkit-text-fill-color: var(--theme-text) !important;
  box-shadow: 0 0 0 1000px var(--theme-surface) inset !important;
  caret-color: var(--theme-accent);
}

html[data-theme="dark"] body.high-contrast :where(input[type="checkbox"], input[type="radio"], progress) {
  accent-color: var(--theme-accent);
}

html[data-theme="dark"] body.high-contrast :where(table, thead, tbody, tfoot, tr, th, td, caption) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

html[data-theme="dark"] body.high-contrast .table-hover > tbody > tr:hover > :where(th, td) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-accent) !important;
}

/* Homepage: keep photographs natural and make all interface panels black. */
html[data-theme="dark"] body.high-contrast :where(
  .gamca-home,
  .gamca-home-entry__surface,
  .gamca-home-slider,
  .home-intro,
  .quick-links,
  section.board .box.light,
  .home-task-card,
  .home-task-card__header,
  .home-task-card__content,
  .home-task-card__actions,
  .right-col,
  .right-col > .sidebar-card,
  .quick-link-group,
  .gamca-audience-links,
  .gamca-quick-actions--compact
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body.high-contrast .gamca-home-entry__eyebrow {
  color: var(--theme-accent) !important;
}

html[data-theme="dark"] body.high-contrast .gamca-home-slider::after {
  background-color: transparent !important;
}

html[data-theme="dark"] body.high-contrast .gamca-home-slider > .gamca-home-entry,
html[data-theme="dark"] body.high-contrast .gamca-home-slider > .gamca-home-slider__arrows {
  background-color: transparent !important;
  background-image: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body.high-contrast .gamca-home-slider .slides > li.flex-active-slide img {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

html[data-theme="dark"] body.high-contrast .separator.blue,
html[data-theme="dark"] body.high-contrast .separator.orange {
  background-color: var(--theme-accent) !important;
  border-color: var(--theme-accent) !important;
}

html[data-theme="dark"] body.high-contrast :where(
  .gamca-audience-links a,
  .gamca-quick-actions__link,
  .home-task-card__link
) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

html[data-theme="dark"] body.high-contrast :where(
  .gamca-audience-links a,
  .gamca-quick-actions__link,
  .home-task-card__link
):hover,
html[data-theme="dark"] body.high-contrast :where(
  .gamca-audience-links a,
  .gamca-quick-actions__link,
  .home-task-card__link
):focus-visible {
  color: var(--theme-accent) !important;
  border-color: var(--theme-accent) !important;
}

html[data-theme="dark"] body.high-contrast .gamca-home-slider > .gamca-home-founder-link {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body.high-contrast :where(
  .gamca-home-slider > .gamca-home-founder-link .logo-box,
  .gamca-home .right-col > .sidebar-card .logo-box,
  .sponsor a,
  .partner-logo
) {
  background-color: #ffffff !important;
  border-color: var(--theme-border-muted) !important;
}

/* Noticeboard: hover and focus reinforce structure without inverting cards. */
html[data-theme="dark"] body.high-contrast :where(
  .board-archive-hero-inner,
  .board-archive-meta,
  .board-archive-current,
  .board-archive-count,
  .board-post,
  .board-post-card,
  .board-post-card-link,
  .board-post-card-body,
  .board-post-image.no-image,
  .board-empty-state,
  .board-article,
  .board-article-header,
  .board-article-content,
  .board-article-nav-item,
  .board-related-post > a,
  .board-single-back-nav
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body.high-contrast .board-post-card :where(.board-post-title, .board-post-excerpt, .board-post-readmore),
html[data-theme="dark"] body.high-contrast .board-related-post :where(strong, span) {
  color: var(--theme-text) !important;
}

html[data-theme="dark"] body.high-contrast .board-post-card:hover,
html[data-theme="dark"] body.high-contrast .board-post-card:focus-within,
html[data-theme="dark"] body.high-contrast .board-related-post > a:hover,
html[data-theme="dark"] body.high-contrast .board-related-post > a:focus-visible {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-accent) !important;
  box-shadow: 0 0 0 2px var(--theme-accent) !important;
  transform: none !important;
}

html[data-theme="dark"] body.high-contrast .board-post-card:hover :where(.board-post-title, .board-post-readmore),
html[data-theme="dark"] body.high-contrast .board-post-card:focus-within :where(.board-post-title, .board-post-readmore),
html[data-theme="dark"] body.high-contrast .board-related-post > a:hover strong,
html[data-theme="dark"] body.high-contrast .board-related-post > a:focus-visible strong {
  color: var(--theme-accent) !important;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

/* Daily task, graph, archives, and interactive puzzle surfaces. */
html[data-theme="dark"] body.high-contrast :where(
  .gamca-page-header,
  .gamca-archive-card,
  .gamca-archive-card__header,
  .gamca-archive-card__preview-lite,
  .gamca-empty-state,
  .task-single__content,
  .graph-single__content,
  .gwt-play,
  .gwt-play__hero,
  .gwt-play__hero-status,
  .gwt-play__surface,
  .gwt-play-grid-wrap,
  .gwt-play-grid,
  .gwt-play__feedback,
  .gwt-play__confirm-dialog,
  .gwt-play__meta-grid,
  .gwt-play__meta-card,
  .gwt-play__stats,
  .gwt-play__aggregate,
  .gwt-play__stats-card,
  .gwt-play__highlight,
  .gwt-play__results-card,
  .gwt-play__session,
  .gwt-play__session-status,
  .gwt-play__session-grid > div,
  .gwt-play__leaderboard-empty,
  .gwt-graph-detail,
  .gwt-graph-wrap,
  .gwt-graph-intro,
  .gwt-graph-facts,
  .gwt-graph-inference,
  .gwt-graph-points-wrap,
  .gwt-graph-summary,
  .gwt-graph-summary__item
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

:root[data-theme="dark"].high-contrast body.high-contrast section.page.gamca-page.task-single :where(
  .gwt-play__session-grid > div,
  .gwt-play__leaderboard-empty,
  .gwt-play__surface,
  .gwt-play-grid-wrap
),
:root[data-theme="dark"].high-contrast body.high-contrast section.page.gamca-page.graph-single :where(
  .graph-single__content,
  .gwt-graph-detail,
  .gwt-graph-wrap,
  .gwt-graph-facts,
  .gwt-graph-inference,
  .gwt-graph-summary
) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

html[data-theme="dark"] body.high-contrast .gwt-graph-svg {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] body.high-contrast .gwt-graph-svg :where(text, .gwt-graph-svg__tick, .gwt-graph-svg__axis-name, .gwt-graph-svg__guide-label, .gwt-graph-point__label) {
  fill: var(--theme-text) !important;
  color: var(--theme-text) !important;
}

html[data-theme="dark"] body.high-contrast .gwt-graph-svg :where(.gwt-graph-svg__axis, .gwt-graph-svg__guide) {
  stroke: var(--theme-text) !important;
}

html[data-theme="dark"] body.high-contrast .gwt-graph-svg .gwt-graph-svg__grid-line {
  stroke: var(--theme-border-muted) !important;
}

html[data-theme="dark"] body.high-contrast .gwt-graph-svg :where(.gwt-graph-svg__curves, .gwt-graph-svg__curve, .gwt-graph-point__dot, .gwt-graph-svg__plot-dots) {
  fill: var(--theme-accent) !important;
  stroke: var(--theme-accent) !important;
}

/* Footer, dialogs, and cookie controls. */
html[data-theme="dark"] body.high-contrast :where(
  .gamca-footer,
  .gamca-footer__decoration,
  .gamca-footer__widgets,
  .gamca-footer__copyright,
  .gamca-footer-legal,
  .footer-widget-area,
  .cmplz-cookiebanner,
  .cmplz-manage-consent,
  #cmplz-manage-consent
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body.high-contrast .gamca-footer {
  max-width: 100%;
  overflow-x: hidden;
}

html[data-theme="dark"] body.high-contrast .gamca-footer .owl-stage-outer {
  max-width: 100%;
  overflow: hidden !important;
}

html[data-theme="dark"] body.high-contrast :where(.gamca-footer, .cmplz-cookiebanner) :where(h1, h2, h3, h4, p, li, span, label) {
  color: var(--theme-text) !important;
}

html[data-theme="dark"] body.high-contrast #scroll-to-top {
  background-color: var(--theme-accent) !important;
  color: var(--theme-on-accent) !important;
  border: 2px solid var(--theme-accent) !important;
}

/* Media is never inverted. White mats are opt-in above for logos only. */
html[data-theme="dark"] body.high-contrast :where(img, picture, video, canvas, iframe, object, embed) {
  filter: none !important;
  mix-blend-mode: normal !important;
}

html[data-theme="dark"] body.high-contrast :where(.board-post-image, .board-article-figure, .metaslider, .nivoSlider) {
  background-color: var(--theme-surface) !important;
}

/*
 * Legacy authority boundary.
 *
 * Several historical rules combine html/body/page/component selectors with
 * !important. This one high-specificity boundary is the only place the
 * migration layer competes with those selectors; component rules above stay
 * readable and can move into their owners before this block is deleted.
 */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast :where(
  .gamca-surface,
  .gamca-card,
  .gamca-admissions-card,
  .gamca-contact-card,
  .gamca-document-card,
  .gamca-home .home-intro,
  .gamca-home .quick-links,
  .gamca-home section.board .box.light,
  .board-archive-hero-inner,
  .board-post-card,
  .board-post-card-link,
  .board-post-card-body,
  .board-article,
  .board-article-content,
  .board-article-nav-item,
  .gamca-archive-card,
  .gamca-archive-card__preview-lite,
  .task-single__content,
  .graph-single__content,
  .gwt-play__hero,
  .gwt-play__hero-status,
  .gwt-play__surface,
  .gwt-play-grid-wrap,
  .gwt-play-grid,
  .gwt-play__feedback,
  .gwt-play__meta-grid,
  .gwt-play__meta-card,
  .gwt-play__stats,
  .gwt-play__aggregate,
  .gwt-play__stats-card,
  .gwt-play__highlight,
  .gwt-play__results-card,
  .gwt-play__session,
  .gwt-play__session-status,
  .gwt-play__session-grid > div,
  .gwt-play__leaderboard-empty,
  .gwt-graph-detail,
  .gwt-graph-wrap,
  .gwt-graph-facts,
  .gwt-graph-inference,
  .gwt-graph-summary
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast :where(
  .gamca-admissions-card,
  .gamca-contact-card,
  .gamca-document-card,
  .gamca-home .home-intro,
  .gamca-home .quick-links,
  .gamca-home section.board .box.light,
  .board-post-card,
  .board-article,
  .gamca-archive-card,
  .gamca-archive-card__preview-lite,
  .task-single__content,
  .graph-single__content,
  .gwt-play__hero,
  .gwt-play__meta-grid,
  .gwt-play__stats,
  .gwt-play__results-grid
) :where(h1, h2, h3, h4, p, span, strong, small, li, dt, dd, label) {
  color: var(--theme-text) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .gamca-main :where(
  .home-intro,
  .quick-links,
  section.board .box.light
) a:not(.btn):not(.gamca-button),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .gamca-main :where(
  .home-intro,
  .quick-links,
  section.board .box.light
) a:not(.btn):not(.gamca-button) :where(span, strong, small) {
  color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast body.high-contrast #main-content section.page.gamca-page.task-single .page-content .gwt-play :where(
  .gwt-play__hero,
  .gwt-play__hero-status,
  .gwt-play__surface,
  .gwt-play-grid-wrap,
  .gwt-play-grid,
  .gwt-play__feedback,
  .gwt-play__meta-grid,
  .gwt-play__meta-card,
  .gwt-play__stats,
  .gwt-play__aggregate,
  .gwt-play__stats-card,
  .gwt-play__highlight,
  .gwt-play__results-card,
  .gwt-play__session,
  .gwt-play__session-status,
  .gwt-play__session-grid > div,
  .gwt-play__leaderboard-empty
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

:root[data-theme="dark"].high-contrast body.high-contrast #main-content section.page.gamca-page.task-single .page-content .gwt-play :where(
  h1,
  h2,
  h3,
  h4,
  p,
  span,
  strong,
  small,
  li,
  dt,
  dd,
  label
),
:root[data-theme="dark"].high-contrast body.high-contrast #main-content section.page.gamca-page.task-single .page-content .gwt-play .gwt-play__button:not([data-gwt-check]) {
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
}

:root[data-theme="dark"].high-contrast body.high-contrast #main-content section.page.gamca-page.task-single .page-content .gwt-play :where(
  .gwt-play-grid,
  .gwt-play-grid__cell,
  .gwt-play-grid__input,
  .gwt-play-grid__given
) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

:root[data-theme="dark"].high-contrast body.high-contrast #main-content section.page.gamca-page.task-single .page-content .gwt-play [data-gwt-cell-wrap].is-wrong {
  box-shadow: inset 0 0 0 3px var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast body.high-contrast #main-content section.page.gamca-page.task-single .page-content .gwt-play .gwt-play__button:not([data-gwt-check]) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

:root[data-theme="dark"].high-contrast body.high-contrast #main-content section.page.gamca-page.task-single .page-content .gwt-play :where(
  .gwt-play__status-chip,
  .gwt-play__status-chip span,
  .gwt-play__status-chip strong
) {
  color: var(--theme-on-accent) !important;
  -webkit-text-fill-color: var(--theme-on-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast :where(
  .gamca-button--primary,
  .task-archive__cta,
  .graph-archive__cta,
  .gwt-play__button[data-gwt-check]
) {
  background-color: var(--theme-accent) !important;
  background-image: none !important;
  color: var(--theme-on-accent) !important;
  border-color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast :where(
  .gamca-audience-links,
  .gamca-quick-actions,
  .gamca-contact-card
) .fa,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .gamca-archive-card__preview-lite::before {
  color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page--wall .board-post-card:hover,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page--wall .board-post-card:focus-within {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-accent) !important;
  box-shadow: 0 0 0 2px var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page--wall .board-post-card:hover :where(.board-post-title, .board-post-readmore),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page--wall .board-post-card:focus-within :where(.board-post-title, .board-post-readmore) {
  color: var(--theme-accent) !important;
}

/*
 * Whole-site audit closure.
 *
 * The production audit covers legacy database-authored markup as well as the
 * maintained templates. Historical high-contrast declarations use long
 * selector chains plus !important, so these rules intentionally share one
 * explicit authority prefix. Component owners can absorb them incrementally;
 * until then this block guarantees black surfaces, readable text, gold links,
 * and muted structural borders without changing the default theme or media.
 */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-page__main .page-content.gamca-content :where(
  div:not(.gwt-play__confirm-dialog),
  section,
  article,
  aside,
  header,
  footer,
  nav,
  blockquote,
  figure,
  figcaption,
  details,
  summary,
  table,
  thead,
  tbody,
  tfoot,
  tr,
  th,
  td,
  caption,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  ul,
  ol,
  li,
  span,
  strong,
  b,
  em,
  i,
  q,
  cite,
  small
) {
  background-color: var(--theme-table-header, transparent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-page__main .page-content.gamca-content :where(
  div,
  section,
  article,
  aside,
  header,
  footer,
  nav,
  blockquote,
  figure,
  figcaption,
  details,
  summary,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  ul,
  ol,
  li,
  dt,
  dd,
  span,
  strong,
  b,
  em,
  i,
  q,
  cite,
  del,
  ins,
  small,
  time,
  label,
  legend,
  address,
  caption
) {
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-page__main .page-content.gamca-content :where([class*="-pill"], [class*="-badge"]) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-page__main .page-content.gamca-content .text-ocher {
  color: var(--theme-accent) !important;
  -webkit-text-fill-color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page :where(
  .gamca-content,
  .page-content,
  .gamca-note,
  .page-note,
  table,
  thead,
  tbody,
  tfoot,
  tr,
  th,
  td,
  caption,
  .owl-carousel-gallery,
  .owl-carousel-gallery2,
  .mosaic,
  .instagram-media,
  .instagram-media div,
  .instagram-media p,
  .instagram-media-registered,
  .instagram-media-registered div,
  .instagram-media-registered p,
  .youtube-player,
  .wp-video
) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page :where(
  .gamca-content,
  .board-article-content,
  .meal-post-content
) :where(h1, h2, h3, h4, h5, h6, p, li, dt, dd, strong, b, em, i, q, del, ins, small, span, time, label, legend, summary, address, figcaption, blockquote, caption) {
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page :where(
  .text-muted,
  .gamca-color-muted,
  .help-block,
  .wp-caption-text,
  .caption,
  .board-article-date,
  .board-related-date
) {
  color: var(--theme-text-muted) !important;
  -webkit-text-fill-color: var(--theme-text-muted) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content a:where(:not(.btn):not([role="button"]):not(.gamca-button):not(.gamca-chip):not(.nav-tabs a):not(.gamca-tab-list a):not(.gamca-admissions-steps a)),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content a:where(:not(.btn):not([role="button"]):not(.gamca-button):not(.gamca-chip):not(.nav-tabs a):not(.gamca-tab-list a):not(.gamca-admissions-steps a)) :where(span, strong, small, em, i),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .board-article-content a,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .board-article-content a :where(span, strong, small, em, i) {
  background-color: transparent !important;
  color: var(--theme-accent) !important;
  -webkit-text-fill-color: var(--theme-accent) !important;
}

/* Shared header panels, desktop/mobile menus, search, and the theme control. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast section.header.gamca-header :where(
  #bs-example-navbar-collapse-1,
  #bs-example-navbar-collapse-2,
  #bs-example-navbar-collapse-3,
  #bs-example-navbar-collapse-mobile,
  .gamca-header__mobile-panel,
  .gamca-header__utility-panel,
  .gamca-header__dropdown,
  .gamca-header__dropdown .category,
  .dropdown-menu,
  .mobile-menu,
  .mobile-sub-menu,
  .mobile-sub-sub-menu,
  .mobile-sub-sub-sub-menu,
  .header-search-form,
  .search-mobile,
  .header-login-form
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast section.header.gamca-header :where(
  .gamca-header__dropdown a,
  .mobile-main-items > button,
  .mobile-sub-menu a,
  .mobile-sub-sub-menu a,
  .mobile-sub-sub-sub-menu a,
  .gamca-header__mobile-back
) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast section.header.gamca-header :where(
  .gamca-header__dropdown a,
  .mobile-main-items > button,
  .mobile-sub-menu a,
  .mobile-sub-sub-menu a,
  .mobile-sub-sub-sub-menu a,
  .gamca-header__mobile-back
):is(:hover, :focus-visible),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast section.header.gamca-header :where(
  .gamca-header__dropdown li.active > a,
  .mobile-sub-menu li.active > a,
  .mobile-sub-sub-menu li.active > a,
  .mobile-sub-sub-sub-menu li.active > a
) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-accent) !important;
  border-color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast section.header.gamca-header :where(
  .header-search-form input,
  .search-mobile input,
  .gamca-header__utility-panel input,
  .header-login-form input
) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast section.header.gamca-header [data-gamca-theme-toggle] {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast section.header.gamca-header [data-gamca-theme-toggle]:is(:hover, :focus-visible) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: transparent !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast section.header.gamca-header [data-gamca-theme-toggle][aria-pressed="true"] > i.fa-sun-o {
  display: block;
  font-size: 24px;
  line-height: 1;
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
  background: none;
  text-shadow: none;
  transform: scale(1);
  transform-origin: center;
  transition: color 160ms ease, text-shadow 160ms ease, transform 160ms ease;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast section.header.gamca-header [data-gamca-theme-toggle][aria-pressed="true"]:is(:hover, :focus-visible) > i.fa-sun-o {
  color: var(--theme-accent) !important;
  -webkit-text-fill-color: var(--theme-accent) !important;
  text-shadow: 0 0 4px rgba(255, 210, 74, 0.72), 0 0 10px rgba(205, 163, 0, 0.38);
  transform: scale(1.06);
}

/* Homepage cards, quick links, feeds, and audience links all stay black. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gamca-home :where(
  .quick-links,
  .quick-links-grid,
  .quick-link-group,
  [data-gamca-home-practical-links],
  .sidebar-card,
  section.board .box.light,
  section.task .box.light,
  section.feed .box,
  .board-post,
  .feed-item,
  .feed-item--detail,
  .home-task-card,
  .home-task-card__header,
  .home-task-card__content,
  .home-task-card__actions,
  .home-task-card__preview,
  .meal-feed-item,
  .meal-feed-item__head,
  .meal-feed-item__content,
  .meal-feed-item__empty-state,
  .meal-feed-item__empty-message,
  .gamca-audience-links a
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gamca-home :where(
  .feed-item-description,
  .feed-item__description,
  .meal-feed-item__eyebrow,
  .home-sidebar-title,
  .home-signature
) {
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gamca-home :where(
  .quick-links,
  .quick-link-group,
  .home-task-card,
  .meal-feed-item,
  .feed-item,
  .board-post,
  .gamca-audience-links
) :where(h1, h2, h3, h4, p, li, span, strong, small, time) {
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gamca-home :where(
  .quick-link-group,
  [data-gamca-home-practical-links],
  .home-task-card,
  .meal-feed-item,
  .feed-item,
  .board-post
) a:not(.btn):not(.gamca-button):not([role="button"]),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gamca-home :where(
  .quick-link-group,
  [data-gamca-home-practical-links],
  .home-task-card,
  .meal-feed-item,
  .feed-item,
  .board-post
) a:not(.btn):not(.gamca-button):not([role="button"]) :where(span, strong, small, i) {
  color: var(--theme-accent) !important;
  -webkit-text-fill-color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gamca-home .gamca-audience-links a strong,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gamca-home .gamca-audience-links a small {
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content nav.gamca-audience-links.gamca-audience-links--home a strong,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content nav.gamca-audience-links.gamca-audience-links--home a small {
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content a.board-archive-link {
  background-color: var(--theme-accent) !important;
  background-image: none !important;
  color: var(--theme-on-accent) !important;
  -webkit-text-fill-color: var(--theme-on-accent) !important;
  border-color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gamca-home .gamca-audience-links a i {
  background-color: var(--theme-surface) !important;
  color: var(--theme-accent) !important;
  -webkit-text-fill-color: var(--theme-accent) !important;
}

/* Search cards share the dark page surface; inherited text-fill and the
 * legacy white high-contrast card must be normalized together. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page--search :where(.search-page__intro-card, .search-toolbar__card, .search-result-card, .search-result-card__link, .search-no-results--card) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  border-color: var(--theme-border) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page--search :where(.search-page__eyebrow, .search-page__summary, .search-result-card__title, .search-result-card__date, .search-result-card__excerpt, .search-result-card__cta, .search-result-card__link > p) {
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
}

/* Noticeboard, meal, task, graph, notes, tables, and privacy placeholders. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page :where(
  .board-archive-hero,
  .board-archive-hero-inner,
  .board-archive-current,
  .board-archive-count,
  .board-article,
  .board-article-header,
  .board-article-content,
  .board-article-nav-item,
  .board-article-note,
  .meal-page__intro,
  .meal-post,
  .meal-post-content,
  .meal-post--empty,
  .meal-page__note,
  .allergen-list,
  .gwt-play__hero,
  .gwt-play__hero-status,
  .gwt-play__meta-grid,
  .gwt-play__meta-card,
  .gwt-play__stats,
  .gwt-play__stats-card,
  .gwt-play__highlight,
  .gwt-play__aggregate,
  .gwt-play__results-card,
  .gwt-play__session,
  .gwt-play__session-status,
  .gwt-play__session-grid > div,
  .gamca-private-embed__placeholder,
  .contact-map-card,
  .contact-map-card__embed,
  .contact-map-card__actions
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page :where(
  .board-archive-current-label,
  .board-archive-count-label,
  .board-archive-count-number,
  .board-article-date,
  .board-article-nav-label,
  .board-related-date,
  .meal-post h2,
  .meal-post-content,
  .meal-post-empty-message,
  .allergen-list,
  .gwt-play__meta-label,
  .gwt-play__meta-value,
  .gwt-play__section-heading,
  .gwt-play__activity-heading,
  .contact-map-card,
  .gamca-private-embed__placeholder
) {
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gwt-play__status-chip.is-neutral,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gwt-play__status-chip.is-neutral :where(span, strong) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
  border-color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page :where(.board-article-nav-item, .board-related-post) > :is(a, span),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page :where(.board-article-nav-item, .board-related-post) > :is(a, span) :where(span, strong, small, time) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

/* Page notes are siblings of the main article on several legacy templates. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-page__main .gamca-note :where(
  div,
  section,
  article,
  .gamca-accessibility-statement,
  header,
  footer,
  aside,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  ul,
  ol,
  li,
  span,
  strong,
  b,
  em,
  i,
  q,
  cite,
  small
) {
  background-color: transparent !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-page__main .gamca-note a:not(.btn):not([role="button"]) {
  background-color: transparent !important;
  color: var(--theme-accent) !important;
  -webkit-text-fill-color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page :where(
  .gmcz_tb_card,
  .gmcz_tb_aprob_item,
  .gmcz_tb_subjects,
  .gmcz_tb_aprob_name,
  .pdf-card
) {
  border-color: var(--theme-border) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page :where(.pdf-card, .pdf-actions) a {
  border-color: var(--theme-accent) !important;
}

/* Complianz policy and consent UI use the same black/gold contract. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content :where(
  #cmplz-document,
  .cmplz-document,
  .cmplz-dropdown,
  .cmplz-service-desc,
  .cookies-per-purpose,
  .cookies-per-purpose > div,
  .cmplz-manage-consent-container,
  .cmplz-categories,
  .cmplz-category,
  .cmplz-category-header,
  .cmplz-description,
  .cmplz-document details,
  .cmplz-document summary,
  .cmplz-document summary > div
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content :where(
  #cmplz-document,
  .cmplz-document,
  .cookies-per-purpose,
  .cmplz-category,
  .cmplz-category-title,
  .cmplz-description
) :where(h1, h2, h3, h4, p, span, strong, em, i, li, dt, dd, summary),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content :where(.cmplz-category-title, .cmplz-description) {
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content #cmplz-document .cmplz-always-active,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .cmplz-document .cmplz-always-active {
  color: var(--theme-accent) !important;
  -webkit-text-fill-color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .cmplz-cookiebanner :where(.cmplz-title, .cmplz-message, p, span, strong) {
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
}

/* Shared accent action paint; pagination, footer and consent share the pair. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gamca-pagination a.page-numbers:is(:hover, :focus-visible),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .gamca-footer .gamca-quick-actions__link:is(:hover, :focus, :focus-visible),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .cmplz-cookiebanner .cmplz-btn.cmplz-accept {
  background-color: var(--theme-accent) !important;
  color: var(--theme-on-accent) !important;
  -webkit-text-fill-color: var(--theme-on-accent) !important;
  border-color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .gamca-footer .gamca-quick-actions__link:is(:hover, :focus, :focus-visible) :where(span, i),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .cmplz-cookiebanner .cmplz-btn.cmplz-accept :where(span, strong, small, em, i) {
  color: var(--theme-on-accent) !important;
  -webkit-text-fill-color: var(--theme-on-accent) !important;
}

/* The close path is a necessary consent control icon; the legacy dark icon
 * fill is invisible on the maintained black consent surface. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .cmplz-cookiebanner .cmplz-close svg path {
  fill: var(--theme-text) !important;
}

/* Database-authored collection components. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gp-post,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gp-post :where(
  .gp-hero-inner,
  .gp-section,
  .gp-card,
  .gp-badge,
  .gp-tag,
  .gp-stat,
  .gp-accordion,
  .gp-accordion-content,
  .gp-bank-box,
  details,
  summary
) {
  background-color: var(--theme-surface) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  box-shadow: none !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gp-post :where(h1, h2, h3, h4, p, li, div, span, strong, small, summary) {
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content :where(.nav-tabs > li.active > a, .gamca-tab-list a.active, .gamca-tab-list .active > a, .gamca-tab-list a[aria-current="page"], .gamca-admissions-steps a.active) {
  background-color: var(--theme-accent) !important;
  color: var(--theme-on-accent) !important;
  -webkit-text-fill-color: var(--theme-on-accent) !important;
  border-color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content :where(.nav-tabs > li:not(.active) > a, .gamca-tab-list a:not(.active):not([aria-current="page"]), .gamca-admissions-steps a:not(.active)) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

/* Gold actions need black text-fill too; legacy prose rules set it separately. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content :where(
  .gamca-button--primary,
  .task-archive__cta,
  .graph-archive__cta,
  .gwt-play__button[data-gwt-check],
  [data-gamca-load-map],
  .contact-map-card__button,
  .board-archive-link,
  .cmplz-btn.cmplz-accept
),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content .nav-tabs > li.active > a,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content .gamca-tab-list a.active,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content .gamca-tab-list .active > a,
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content .gamca-tab-list a[aria-current="page"] {
  background-color: var(--theme-accent) !important;
  background-image: none !important;
  color: var(--theme-on-accent) !important;
  -webkit-text-fill-color: var(--theme-on-accent) !important;
  border-color: var(--theme-accent) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content :where(
  .gamca-button--primary,
  .task-archive__cta,
  .graph-archive__cta,
  .gwt-play__button[data-gwt-check],
  [data-gamca-load-map],
  .contact-map-card__button,
  .board-archive-link,
  .cmplz-btn.cmplz-accept
) :where(span, strong, small, em, i),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content .nav-tabs > li.active > a :where(span, strong, small, em, i),
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content .gamca-tab-list :where(a.active, .active > a, a[aria-current="page"]) :where(span, strong, small, em, i) {
  color: var(--theme-on-accent) !important;
  -webkit-text-fill-color: var(--theme-on-accent) !important;
}

/* Muted borders replace pure-white dividers without flattening active gold. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content :where(
  .gamca-note,
  .page-note,
  .board-article-nav-item,
  .gamca-content-status__item,
  .navigation.pagination .nav-links,
  .gwt-play-grid,
  .gwt-play-grid__cell,
  .gwt-play-grid__input,
  .gwt-graph-header__info,
  .gwt-graph-facts li,
  .gwt-graph-points,
  .gwt-graph-points th,
  .gwt-graph-points td,
  .gwt-graph-caption__formula,
  iframe
) {
  border-color: var(--theme-border) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content :where(
  .gwt-graph-facts code,
  .gwt-graph-caption__formula,
  code,
  kbd,
  pre,
  samp
) {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  -webkit-text-fill-color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .gamca-quick-actions {
  border-color: var(--theme-border) !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content #cmplz-document input[type="checkbox"] {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
  accent-color: var(--theme-accent);
  color-scheme: dark;
}

/* A site footer copied into article markup is invalid and creates overflow. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content .gamca-footer-legal {
  display: none !important;
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast .gamca-footer {
  width: 100% !important;
  max-width: 100% !important;
  margin-inline: 0 !important;
  clear: both;
}

@media (max-width: 479px) {
  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page--wall-single .board-article-title,
  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page--wall-single .board-article-content :where(p, a, span, strong, em, li),
  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page--wall-single .board-related-posts :where(h2, h3, p, a, span, strong, time) {
    min-width: 0;
    max-width: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gamca-content .chem-skin .nav.nav-tabs {
    flex-wrap: wrap;
  }

  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gamca-content .chem-skin .nav.nav-tabs > li {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 0;
  }

  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gamca-content .chem-skin #tabs-content .tab {
    grid-template-columns: minmax(0, 1fr) !important;
    min-width: 0;
    max-width: 100%;
  }

  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .gamca-content .chem-skin :where(.window, em) {
    min-width: 0;
    max-width: 100%;
    white-space: normal !important;
  }

  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page :where(
    .meal-page__note,
    .allergen-list,
    .allergen-list li
  ) {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content :where(
    #cmplz-document,
    .cmplz-document,
    .cmplz-service-desc,
    .cookies-per-purpose
  ) {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .cookies-per-purpose {
    display: block;
    grid-template-columns: minmax(0, 1fr);
  }

  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .cookies-per-purpose > div {
    box-sizing: border-box;
    display: block;
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content #cmplz-document {
    overflow-x: hidden;
  }

  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content #cmplz-document :where(
    h1,
    h2,
    h3,
    h4,
    h5,
    p,
    a
  ) {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content #cmplz-document .screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  :root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content .board-article-content iframe[id^="instagram-embed-"] {
    box-sizing: border-box;
    min-width: 0 !important;
    width: 100%;
    max-width: 100%;
  }
}

/* Palette components override semantic tokens at their owning boundary. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast section.header.gamca-header .gamca-header__dropdown .category {
  --theme-text-muted: var(--theme-text);
  --theme-border: var(--theme-accent);
  border-bottom: 2px solid var(--theme-accent);
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content table.table-blue {
  --theme-table-palette: var(--theme-info);
  --theme-border: var(--theme-table-palette);
}

:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content table.table-ocher {
  --theme-table-palette: var(--theme-accent);
  --theme-border: var(--theme-table-palette);
}

/* Header tokens inherit through nested editorial markup; body links keep gold. */
:root[data-theme="dark"].high-contrast.gamca-high-contrast body.high-contrast.gamca-high-contrast #main-content section.page.gamca-page .gamca-content table:is(.table-blue, .table-ocher) > thead > tr > th {
  --theme-table-header: var(--theme-table-palette);
  --theme-text: var(--theme-on-accent);
  --theme-text-muted: var(--theme-on-accent);
  --theme-accent: var(--theme-on-accent);
  -webkit-text-fill-color: currentColor;
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme="dark"] body.high-contrast *,
  html[data-theme="dark"] body.high-contrast *::before,
  html[data-theme="dark"] body.high-contrast *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html[data-theme="dark"] body.high-contrast :where(
    .btn,
    .gamca-button,
    button[type="submit"],
    input[type="submit"],
    input[type="button"],
    .cmplz-btn
  ):is(:hover, :focus-visible) {
    transform: none;
  }
}

@media (forced-colors: active) {
  :root[data-theme="dark"] {
    --theme-page: Canvas;
    --theme-surface: Canvas;
    --theme-text: CanvasText;
    --theme-text-muted: CanvasText;
    --theme-border: CanvasText;
    --theme-border-muted: GrayText;
    --theme-accent: LinkText;
    --theme-on-accent: Canvas;
  }

  html[data-theme="dark"] body.high-contrast :where(a, button, input, select, textarea, summary):focus-visible {
    outline-color: Highlight !important;
  }
}

@media print {
  html[data-theme="dark"],
  html[data-theme="dark"] body.high-contrast,
  html[data-theme="dark"] body.high-contrast :where(main, section, article, .gamca-surface, .gamca-card, table, th, td) {
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
  }

  html[data-theme="dark"] body.high-contrast a {
    color: #000000 !important;
    text-decoration: underline !important;
  }
}
