/* Bouton thème (clair + sombre) — réversible */

.theme-toggle {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.theme-toggle:hover {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: var(--shadow);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-sun,
.theme-icon-moon,
.theme-icon-auto {
  position: absolute;
  transition: opacity 0.2s, transform 0.2s;
}

.theme-icon-sun { opacity: 0; transform: scale(0.7) rotate(-30deg); }
.theme-icon-moon { opacity: 0; transform: scale(0.7) rotate(30deg); }
.theme-icon-auto { opacity: 0; transform: scale(0.7); }

[data-theme-pref="light"] .theme-toggle .theme-icon-sun,
[data-theme-pref="dark"] .theme-toggle .theme-icon-moon,
[data-theme-pref="auto"] .theme-toggle .theme-icon-auto {
  opacity: 1;
  transform: scale(1) rotate(0);
}

[data-theme-pref="auto"] .theme-toggle::after {
  content: "";
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 1px var(--card);
}

@media (max-width: 720px) {
  .header-actions {
    gap: 4px;
    padding-left: 6px;
  }

  .header-actions .lang-pills {
    order: 1;
  }

  .header-actions .theme-toggle {
    order: 2;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .header-actions .theme-toggle svg {
    width: 16px;
    height: 16px;
  }

  .header-actions .menu-toggle {
    order: 3;
    flex-shrink: 0;
    position: relative;
    z-index: 6;
    padding: 6px 7px;
    border-radius: 7px;
  }

  .header-actions .menu-toggle span {
    width: 18px;
    height: 2px;
    margin: 3.5px 0;
  }

  .brand img {
    max-width: 130px;
    height: 32px;
    width: auto;
    object-fit: contain;
    object-position: left center;
  }

  .lang-pills button {
    padding: 4px 6px;
    font-size: 0.65rem;
  }

  .nav-mobile.open {
    display: flex;
    flex-direction: column;
  }
}
