/*
 * SPDX-FileCopyrightText: NONE
 * SPDX-License-Identifier: CC0-1.0
 * Written with Claude (Anthropic). No copyright is claimed, and any that exists is waived under
 * CC0 1.0, which also disclaims all warranties. Details: AI-PROVENANCE.md (repository root).
 */

/*
  Environment switcher, shared by works-in-staging.dev and works-in-production.dev.
  Keep this file identical on both sites. Everything is scoped to .env-switch / .env
  so it can be dropped into an existing stylesheet without touching anything else.
*/
.env-switch {
  --env-bg: #040b13;
  --env-line: #16263a;
  --env-text: #9fb0c3;
  --env-strong: #eef3f8;
  --env-staging: #5cc3ff;
  --env-production: #ffb224;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
  margin: 0;
  padding: 0.5rem 1rem;
  background: var(--env-bg);
  border-bottom: 1px solid var(--env-line);
  color: var(--env-text);
  font: 500 0.75rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0.02em;
}

.env-switch *,
.env-switch *::before,
.env-switch *::after {
  box-sizing: inherit;
}

.env-switch__neq {
  font-size: 0.95rem;
  opacity: 0.7;
}

.env {
  --env-c: var(--env-staging);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--env-line);
  border-radius: 999px;
  color: var(--env-text);
  text-decoration: none;
  white-space: nowrap;
}

.env--production {
  --env-c: var(--env-production);
}

.env__dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--env-c);
  opacity: 0.45;
}

.env__name {
  color: var(--env-strong);
  font-weight: 700;
}

.env__action {
  color: var(--env-c);
}

.env.is-current {
  border-color: color-mix(in srgb, var(--env-c) 55%, transparent);
  background: color-mix(in srgb, var(--env-c) 12%, transparent);
}

.env.is-current .env__dot {
  opacity: 1;
  animation: env-pulse 2.4s ease-out infinite;
}

a.env:hover,
a.env:focus-visible {
  border-color: var(--env-c);
  color: var(--env-strong);
}

a.env:hover .env__action {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

a.env:focus-visible {
  outline: 2px solid var(--env-c);
  outline-offset: 2px;
}

@keyframes env-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--env-c) 70%, transparent);
  }
  70%,
  100% {
    box-shadow: 0 0 0 0.45rem transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .env.is-current .env__dot {
    animation: none;
  }
}

@media (max-width: 36rem) {
  .env-switch {
    gap: 0.4rem;
    padding-inline: 0.5rem;
  }

  .env {
    gap: 0.4rem;
    padding: 0.3rem 0.55rem;
  }

  .env__claim,
  .env.is-current .env__action {
    display: none;
  }
}
