.foundry-site-preferences {
  position: relative;
}

.foundry-site-preferences__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.5rem;
  padding: 0 0.9rem;
  border-radius: 9999px;
  border: 1px solid color-mix(in srgb, var(--foundry-border-strong, #cbd5e1) 92%, transparent);
  background: color-mix(in srgb, var(--foundry-surface, #ffffff) 94%, transparent);
  color: var(--foundry-text, #0f172a);
  box-shadow: var(--foundry-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
  cursor: pointer;
  transition:
    background var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    border-color var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    box-shadow var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease),
    transform var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-site-preferences__trigger:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--foundry-brand-accent, #3b82f6) 35%, var(--foundry-border-strong, #cbd5e1));
}

.foundry-site-preferences__trigger:focus-visible {
  outline: 2px solid var(--foundry-brand-accent, #3b82f6);
  outline-offset: 2px;
}

.foundry-site-preferences__meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.foundry-site-preferences__language-code {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.foundry-site-preferences__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--foundry-duration-base, 200ms) var(--foundry-ease-standard, ease);
}

.foundry-site-preferences.is-open .foundry-site-preferences__chevron {
  transform: rotate(180deg);
}

.foundry-site-preferences__chevron-svg {
  width: 0.95rem;
  height: 0.95rem;
}

.foundry-site-preferences__panel {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  z-index: 80;
  width: min(20rem, calc(100vw - 2rem));
  padding: 0.95rem;
  border-radius: 1rem;
  border: 1px solid color-mix(in srgb, var(--foundry-border, #e2e8f0) 90%, transparent);
  background: color-mix(in srgb, var(--foundry-surface, #ffffff) 98%, transparent);
  box-shadow: var(--foundry-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.1));
}

.foundry-site-preferences__panel[hidden] {
  display: none !important;
}

.foundry-site-preferences__section + .foundry-site-preferences__section {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid color-mix(in srgb, var(--foundry-border, #e2e8f0) 90%, transparent);
}

.foundry-site-preferences__section-title {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foundry-text-muted, #475569);
}

.foundry-site-preferences--mobile {
  display: grid;
  gap: 1rem;
}

.foundry-theme-mode-display {
  position: relative;
  display: inline-grid;
  width: 1rem;
  height: 1rem;
  place-items: center;
}

.foundry-theme-mode-display__icon {
  display: none;
  align-items: center;
  justify-content: center;
}

.foundry-theme-mode-display__svg {
  width: 1rem;
  height: 1rem;
}

.foundry-theme-mode-display[data-mode="light"] .foundry-theme-mode-display__icon[data-icon="light"],
.foundry-theme-mode-display[data-mode="dark"] .foundry-theme-mode-display__icon[data-icon="dark"] {
  display: inline-flex;
}

.foundry-theme-mode-display[data-mode="system"] .foundry-theme-mode-display__icon[data-icon="light"] {
  display: inline-flex;
}

:root.dark .foundry-theme-mode-display[data-mode="system"] .foundry-theme-mode-display__icon[data-icon="light"],
:root[data-theme="dark"] .foundry-theme-mode-display[data-mode="system"] .foundry-theme-mode-display__icon[data-icon="light"] {
  display: none;
}

:root.dark .foundry-theme-mode-display[data-mode="system"] .foundry-theme-mode-display__icon[data-icon="dark"],
:root[data-theme="dark"] .foundry-theme-mode-display[data-mode="system"] .foundry-theme-mode-display__icon[data-icon="dark"] {
  display: inline-flex;
}

.foundry-theme-mode-display__badge {
  display: none;
  position: absolute;
  right: -0.22rem;
  bottom: -0.16rem;
  align-items: center;
  justify-content: center;
  width: 0.68rem;
  height: 0.68rem;
  border: 1px solid color-mix(in srgb, var(--foundry-border-strong, #cbd5e1) 88%, transparent);
  border-radius: 9999px;
  background: color-mix(in srgb, var(--foundry-surface, #ffffff) 96%, transparent);
  color: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.foundry-theme-mode-display[data-mode="system"] .foundry-theme-mode-display__badge {
  display: inline-flex;
}

.foundry-theme-mode-display__badge-svg {
  width: 0.4rem;
  height: 0.4rem;
}
