/* Light / dark theme tokens. The theme is selected by html[data-theme="light"|"dark"] (see dbim-a11y.js).
   - New components use these tokens directly.
   - Legacy stylesheets with hard-coded colours get their dark counterparts from dbim-dark.css, which is generated
     from them (node gendark.js) and loaded only while the dark theme is active. */

:root {
  --page-bg: #ffffff;
  --surface-bg: #ffffff;
  --surface-alt-bg: #ebeaea;
  --text-color: #150202;
  --text-muted: #606060;
  --border-color: #c6c6c6;
  --link-color: #214aab;
  --key-color: #162f6a;
  --focus-color: #0d6efd;
  --icon-color: #162f6a;
  color-scheme: light;
}
html[data-theme="dark"] {
  --page-bg: #121b3a;
  --surface-bg: #19244a;
  --surface-alt-bg: #1f2f66;
  --text-color: #ebeaea;
  --text-muted: #c6c6c6;
  --border-color: #3a4670;
  --link-color: #a3bbf3;
  --focus-color: #6ea8fe;
  --icon-color: #d2dfff;
  color-scheme: dark;
}

body { background-color: var(--page-bg); color: var(--text-color); }
.a11y-panel, .dbim-lang__menu { background-color: var(--surface-bg); color: var(--text-color); border-color: var(--border-color); }
.a11y-btn, .a11y-panel__foot a, .a11y-panel__foot button { border-color: var(--border-color); }
.a11y-panel a:focus-visible, .a11y-panel button:focus-visible, .dbim-header a:focus-visible, .dbim-header button:focus-visible,
.dbim-header input:focus-visible { outline-color: var(--focus-color); }

/* Theme choice (inside the accessibility panel) */
.a11y-theme { margin: 0 0 16px; padding: 0; border: 0; }
.a11y-theme legend { padding: 0; margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--text-color); }
.a11y-theme__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.a11y-theme .a11y-btn { min-height: 64px; flex-direction: row; justify-content: center; gap: 10px; }
.a11y-theme .a11y-btn[aria-pressed="true"] { background: #d2dfff; border-color: var(--key-color); box-shadow: inset 0 0 0 1px var(--key-color); color: var(--key-color); }
html[data-theme="dark"] .a11y-theme .a11y-btn[aria-pressed="true"] { background: #2a3f80; border-color: #a3bbf3; box-shadow: inset 0 0 0 1px #a3bbf3; color: #fff; }

@media (max-width: 479px) { .a11y-theme__row { grid-template-columns: 1fr 1fr; } }

/* Header components use the tokens (their colours are variables, so the generated dark layer cannot map them). */
.dbim-header { background: var(--surface-bg); color: var(--text-color); border-bottom-color: var(--border-color); }
.dbim-utils__item { color: var(--icon-color); }
.dbim-utils__item:hover { background: var(--surface-alt-bg); }
.dbim-sep { background: var(--icon-color); }
.dbim-search .dbim-search__input { background: var(--surface-bg); color: var(--text-color); border-color: var(--icon-color); }
.dbim-search__input::placeholder { color: var(--text-muted); }
.dbim-search .dbim-search__btn { background: var(--surface-bg); color: var(--icon-color); border-color: var(--icon-color); }
.dbim-search .dbim-search__btn:hover { background: var(--surface-alt-bg); }
.dbim-lang__menu button { color: var(--text-color); }
.dbim-lang__menu button:hover { background: var(--surface-alt-bg); }
.dbim-lang__menu button[aria-current="true"] { color: var(--link-color); }
.a11y-panel, .a11y-panel__title, .a11y-btn, .a11y-panel__close, .a11y-panel__foot a, .a11y-panel__foot button { color: var(--icon-color); }
.a11y-panel__title { color: var(--text-color); }