/* Satuller Cobalt. Shared tokens are also consumed by every page stylesheet. */
:root {
  color-scheme: light;
  --sat-bg: #f4f7fc;
  --sat-surface: #ffffff;
  --sat-elevated: #edf2fa;
  --sat-text: #14213b;
  --sat-muted: #56647a;
  --sat-border: #dce2ed;
  --sat-primary: #315cfd;
  --sat-on-primary: #ffffff;
  --sat-soft: #e8eeff;
  --sat-link: #2247bc;
  --sat-success-bg: #e4f4ed;
  --sat-success: #13764b;
  --sat-warning-bg: #fff2d7;
  --sat-warning: #825400;
  --sat-danger-bg: #fce9ee;
  --sat-danger: #ad244a;
  --sat-shadow: 0 12px 36px #14213b0d;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --sat-bg: #0e1525;
  --sat-surface: #172135;
  --sat-elevated: #1e2b43;
  --sat-text: #edf2ff;
  --sat-muted: #a7b5ce;
  --sat-border: #303e56;
  --sat-primary: #6e8fff;
  --sat-on-primary: #071127;
  --sat-soft: #233258;
  --sat-link: #a9bfff;
  --sat-success-bg: #193b32;
  --sat-success: #7bd9ad;
  --sat-warning-bg: #43351d;
  --sat-warning: #f0cb7a;
  --sat-danger-bg: #422636;
  --sat-danger: #ffa8bb;
  --sat-shadow: 0 12px 36px #00000029;
}
/* OS appearance remains useful even when JavaScript is unavailable. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --sat-bg: #0e1525;
    --sat-surface: #172135;
    --sat-elevated: #1e2b43;
    --sat-text: #edf2ff;
    --sat-muted: #a7b5ce;
    --sat-border: #303e56;
    --sat-primary: #6e8fff;
    --sat-on-primary: #071127;
    --sat-soft: #233258;
    --sat-link: #a9bfff;
    --sat-success-bg: #193b32;
    --sat-success: #7bd9ad;
    --sat-warning-bg: #43351d;
    --sat-warning: #f0cb7a;
    --sat-danger-bg: #422636;
    --sat-danger: #ffa8bb;
    --sat-shadow: 0 12px 36px #00000029;
  }
}
.appearance-controls {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 24px);
  padding: 5px;
  border: 1px solid var(--sat-border);
  border-radius: 13px;
  color: var(--sat-text);
  background: var(--sat-surface);
  box-shadow: var(--sat-shadow);
  font: 600 12px/1.2 'Segoe UI', Arial, sans-serif;
}
.theme-control {
  /* Anchor the popover to the whole dock so language links do not push it
     beyond the left edge on narrow phones. */
  position: static;
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding-right: 5px;
  border-right: 1px solid var(--sat-border);
  font: inherit;
}
/* Reset page-level form buttons so this control stays consistent everywhere. */
.appearance-controls .theme-toggle,
.appearance-controls .theme-option {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  min-width: 0;
  min-height: 42px;
  margin: 0;
  padding: 10px;
  border: 0;
  border-radius: 9px;
  color: var(--sat-text);
  background: transparent;
  box-shadow: none;
  font: inherit;
  text-align: left;
  text-decoration: none;
  line-height: 1.2;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
  transform: none;
  filter: none;
  transition: background-color .15s, color .15s;
  touch-action: manipulation;
}
.appearance-controls .theme-toggle {width: auto;max-width: 190px;white-space: nowrap}
.appearance-controls .theme-toggle:hover,
.appearance-controls .theme-option:hover {
  color: var(--sat-text);
  background: var(--sat-elevated);
  box-shadow: none;
  text-decoration: none;
  transform: none;
  filter: none;
}
.appearance-controls .theme-toggle[aria-expanded="true"] {background: var(--sat-soft);color: var(--sat-link)}
.appearance-controls .theme-toggle:disabled {color: var(--sat-muted);background: transparent;cursor: default;opacity: .7;transform: none;filter: none}
.appearance-controls .theme-toggle:focus-visible,
.appearance-controls .theme-option:focus-visible {outline: 2px solid var(--sat-primary);outline-offset: 2px}
.theme-control svg {width: 18px;height: 18px;flex: 0 0 18px;color: var(--sat-muted);stroke-linecap: round;stroke-linejoin: round}
.theme-control .theme-chevron {width: 13px;height: 13px;flex-basis: 13px;margin-left: 2px;transition: transform .15s}
.theme-toggle[aria-expanded="true"] .theme-chevron {transform: rotate(180deg)}
.appearance-controls .theme-menu {
  position: absolute;
  right: 5px;
  bottom: calc(100% + 12px);
  z-index: 1;
  display: grid;
  gap: 3px;
  width: 218px;
  max-width: calc(100vw - 48px);
  padding: 6px;
  box-sizing: border-box;
  border: 1px solid var(--sat-border);
  border-radius: 14px;
  background: var(--sat-surface);
  color: var(--sat-text);
  box-shadow: 0 14px 40px #14213b1a, var(--sat-shadow);
}
:root[data-theme="dark"] .appearance-controls .theme-menu {box-shadow: 0 14px 40px #00000040, var(--sat-shadow)}
.appearance-controls .theme-option {width: 100%;min-height: 44px;padding: 11px;font-weight: 600}
.theme-option-label {flex: 1;min-width: 0}
.appearance-controls .theme-option[aria-checked="true"] {background: var(--sat-soft);color: var(--sat-link)}
.theme-option[aria-checked="true"] svg {color: var(--sat-link)}
.theme-control .theme-option-check {width: 16px;height: 16px;flex-basis: 16px;visibility: hidden}
.theme-option[aria-checked="true"] .theme-option-check {visibility: visible}
.appearance-controls [hidden] {display: none !important}
.appearance-label {position: absolute;width: 1px;height: 1px;padding: 0;margin: -1px;overflow: hidden;clip: rect(0,0,0,0);white-space: nowrap;border: 0}
@media (max-width: 640px) {
  .appearance-controls {right: max(12px, env(safe-area-inset-right));bottom: max(12px, env(safe-area-inset-bottom));gap: 5px}
  .appearance-controls .theme-toggle {max-width: 185px;padding: 10px 8px;gap: 6px}
}
@media (prefers-reduced-motion: reduce) {
  .appearance-controls .theme-toggle,
  .appearance-controls .theme-option,
  .theme-control .theme-chevron {transition: none}
}
