/*
 * Prism — Theme toggle + i18n affordances.
 *
 * The design system (design-system.css) already defines full light /
 * dark token sets under [data-theme="light"] and [data-theme="dark"].
 * This file adds the FLOATING TOGGLE BUTTON and its animation, plus a
 * few a11y niceties that belong at the top of the cascade regardless of
 * theme.
 *
 * Loaded AFTER design-system.css in base.html so overrides win.
 */

/* ── Floating theme toggle ─────────────────────────────────────── */

.sx-theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border, #e2e6ed);
  background: var(--bg-card, #ffffff);
  color: var(--text, #1a1d26);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 160ms ease,
    color 160ms ease;
}

.sx-theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.sx-theme-toggle:focus-visible {
  outline: 2px solid var(--ps-accent, #6C5CE7);
  outline-offset: 3px;
}

[data-theme="dark"] .sx-theme-toggle {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Show sun in dark mode (clicking switches to light), moon in light mode. */
.sx-theme-toggle .sx-theme-icon-sun,
.sx-theme-toggle .sx-theme-icon-moon {
  display: none;
}
[data-theme="dark"] .sx-theme-toggle .sx-theme-icon-sun { display: inline; }
:root:not([data-theme="dark"]) .sx-theme-toggle .sx-theme-icon-moon { display: inline; }

/* Reduced motion — respect. */
@media (prefers-reduced-motion: reduce) {
  .sx-theme-toggle { transition: none; }
  .sx-theme-toggle:hover { transform: none; }
}

/* ── Focus rings for custom buttons — a11y baseline ─────────────── */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ps-accent, #6C5CE7);
  outline-offset: 2px;
}

/* Screen-reader-only utility — used by i18n strings that should be read
 * but not shown. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
