/* ================================================================
   RAVEN3 — PREMIUM LANGUAGE SWITCHER  v1.0
   Segmented capsule control for ES / EN toggle
   Namespace: .r3-lang-*
   ----------------------------------------------------------------
   .r3-lang-switcher         Shared base (capsule shell + indicator)
   .r3-lang-switcher--bar    Topbar instance  — desktop only
   .r3-lang-switcher--nav    Overlay instance — mobile only
   .r3-lang-indicator        Sliding background pill
   .r3-lang-option           Individual language anchor
   .r3-lang--es / --en       Active language state on the switcher
================================================================ */

/* ── BASE CAPSULE ─────────────────────────────────────────── */
.r3-lang-switcher {
  position: relative;
  align-items: center;
  height: 30px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(0, 229, 200, 0.14);
  background: rgba(3, 9, 15, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
  transition:
    border-color 0.28s ease,
    box-shadow   0.28s ease;
  text-decoration: none;
  outline: none;
  cursor: default;
}

/* Glassmorphic top-left highlight */
.r3-lang-switcher::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    rgba(0, 229, 200, 0.06) 0%,
    rgba(0, 229, 200, 0)    65%
  );
  pointer-events: none;
}

.r3-lang-switcher:hover {
  border-color: rgba(0, 229, 200, 0.28);
  box-shadow:
    0 0 20px rgba(0, 229, 200, 0.1),
    inset 0 0 12px rgba(0, 229, 200, 0.03);
}

/* ── SLIDING INDICATOR ────────────────────────────────────── */
.r3-lang-indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    rgba(0, 229, 200, 0.16) 0%,
    rgba(0, 229, 200, 0.07) 100%
  );
  border: 1px solid rgba(0, 229, 200, 0.28);
  box-shadow:
    0 0 10px rgba(0, 229, 200, 0.12),
    inset 0 1px 0 rgba(0, 229, 200, 0.18);
  transform: translateX(0);
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  will-change: transform;
}

/* Slide to EN (second slot) */
.r3-lang-switcher.r3-lang--en .r3-lang-indicator {
  transform: translateX(100%);
}

/* ── LANGUAGE OPTION LINKS ────────────────────────────────── */
.r3-lang-option {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 100%;
  padding: 0 6px;
  font-family: var(--font-mono, 'Share Tech Mono', monospace);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(178, 206, 222, 0.4);
  border-radius: 999px;
  transition: color 0.2s ease;
  user-select: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.r3-lang-option:hover {
  color: rgba(0, 229, 200, 0.78);
}

/* Active language — driven by .r3-lang--es / .r3-lang--en on wrapper */
.r3-lang-switcher.r3-lang--es .r3-lang-option[hreflang="es"],
.r3-lang-switcher.r3-lang--en .r3-lang-option[hreflang="en"] {
  color: #00e5c8;
  letter-spacing: 0.15em;
}

/* ── ACCESSIBILITY ────────────────────────────────────────── */
.r3-lang-option:focus-visible {
  outline: none;
  color: #00e5c8;
}

.r3-lang-switcher:focus-within {
  border-color: rgba(0, 229, 200, 0.44);
  box-shadow:
    0 0 0 2px rgba(0, 229, 200, 0.12),
    0 0 20px rgba(0, 229, 200, 0.08);
}

/* ── DESKTOP: TOPBAR INSTANCE ─────────────────────────────── */
.r3-lang-switcher--bar {
  display: inline-flex;
}

@media (max-width: 820px) {
  .r3-lang-switcher--bar {
    display: none;
  }
}

/* ── MOBILE: NAV OVERLAY INSTANCE ────────────────────────── */
.r3-lang-switcher--nav {
  display: none;
}

@media (max-width: 820px) {
  .r3-lang-switcher--nav {
    display: inline-flex;
    height: 44px;
    padding: 4px;
  }

  /* Recalculate indicator for taller height */
  .r3-lang-switcher--nav .r3-lang-indicator {
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
  }

  .r3-lang-switcher--nav .r3-lang-option {
    font-size: 12px;
    letter-spacing: 0.15em;
    min-width: 44px;
    padding: 0 10px;
  }
}

/* ── REDUCED MOTION ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .r3-lang-indicator {
    transition: none;
  }

  .r3-lang-switcher,
  .r3-lang-option {
    transition: none;
  }
}
