/*
 * The language and theme switches (D-195): each shows the CURRENT choice, the
 * same on every page. Markup from src/infra/ui/prefs.js; behaviour in
 * public/ui/prefs.js.
 *
 * Only the tokens every theme defines (public/brand/tokens.css, and each theme's
 * complete copy), as public/ui/feedback.css: no colour is chosen here, so the
 * switches read in every theme, light and dark, on the console and the agency's
 * pages alike. The current choice is marked by its state attribute - pressed, or
 * current - never by colour alone: it is also filled, or ticked.
 */

/* ── Language: EN | DE, the current one filled ─────────────────────────────── */
.ui-switch {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px; flex: none;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
}
.ui-switch > a, .ui-switch > span, .ui-switch > button {
  display: inline-grid; place-items: center; min-width: 32px; height: 30px; padding: 0 var(--sp-2);
  margin: 0; width: auto; min-height: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-soft);
  font: inherit; font-size: var(--text-sm); font-weight: 600; line-height: 1; text-decoration: none; cursor: pointer;
}
.ui-switch > a:hover, .ui-switch > button:hover { background: var(--paper-tint); color: var(--ink); filter: none; }
.ui-switch > a:focus-visible, .ui-switch > button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.ui-switch > [aria-current='true'], .ui-switch > [aria-pressed='true'] { background: var(--gold-wash); color: var(--gold-deep); box-shadow: inset 0 0 0 1px var(--gold); cursor: default; }

/* ── Theme: one button showing the current choice; it opens the three ──────── */
.ui-theme-menu { position: relative; flex: none; }
.ui-theme-menu > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 var(--sp-2);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink-soft); cursor: pointer;
}
.ui-theme-menu > summary::-webkit-details-marker { display: none; }
.ui-theme-menu > summary::after { content: '▾'; font-size: 0.75em; color: var(--ink-muted); }
.ui-theme-menu[open] > summary::after { content: '▴'; }
.ui-theme-menu > summary:hover { background: var(--paper-tint); color: var(--ink); }
.ui-theme-menu > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.ui-theme-menu svg { width: 16px; height: 16px; fill: currentColor; display: block; flex: none; }
/* The icon of the choice - set before the first paint by theme-boot.js; Auto until it is known. */
.ui-theme-menu__icon { display: none; }
:root[data-theme-pref='light'] .ui-theme-menu__icon[data-show='light'],
:root[data-theme-pref='dark'] .ui-theme-menu__icon[data-show='dark'],
:root[data-theme-pref='auto'] .ui-theme-menu__icon[data-show='auto'],
:root:not([data-theme-pref]) .ui-theme-menu__icon[data-show='auto'] { display: block; }

.ui-theme-menu__list {
  /* Never wider than the screen: a long name ("Automatisch (wie dieses Gerät eingestellt ist)") wraps instead. */
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 13rem; width: max-content;
  max-width: min(18rem, calc(100vw - 2rem));
  display: grid; gap: 2px; padding: 4px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.ui-theme-menu__list > button {
  display: flex; align-items: center; gap: var(--sp-2); margin: 0; width: 100%; min-height: 36px; padding: var(--sp-2) var(--sp-3);
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink);
  font: inherit; font-size: var(--text-sm); line-height: 1.3; text-align: left; cursor: pointer;
}
.ui-theme-menu__list > button:hover { background: var(--paper-tint); }
.ui-theme-menu__list > button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.ui-theme-menu__list > button[aria-pressed='true'] { background: var(--gold-wash); color: var(--gold-deep); font-weight: 600; }
.ui-theme-menu__list > button[aria-pressed='true']::after { content: '✓'; margin-left: auto; padding-left: var(--sp-3); }
