/* Treze413 — language switcher (globe + popover)
   Styled to match the round social icons in the nav. */

/* ------------------------------------------------------------
 * Block-level language swap for dense content (CV, case studies)
 * Wrap content in <div class="i18n-en"> / "i18n-pt" / "i18n-es" /
 * "i18n-ca" and only the matching block will render.
 * ------------------------------------------------------------ */
html[data-lang="en"] .i18n-pt,
html[data-lang="en"] .i18n-es,
html[data-lang="en"] .i18n-ca,
html[data-lang="pt"] .i18n-en,
html[data-lang="pt"] .i18n-es,
html[data-lang="pt"] .i18n-ca,
html[data-lang="es"] .i18n-en,
html[data-lang="es"] .i18n-pt,
html[data-lang="es"] .i18n-ca,
html[data-lang="ca"] .i18n-en,
html[data-lang="ca"] .i18n-pt,
html[data-lang="ca"] .i18n-es { display: none !important; }

/* When no data-lang is set yet (very brief, before i18n.js runs),
   show only the English block to avoid a flash of all four. */
html:not([data-lang]) .i18n-pt,
html:not([data-lang]) .i18n-es,
html:not([data-lang]) .i18n-ca { display: none !important; }

.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-switch__btn {
  height: 36px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--ink-faint, rgba(237, 238, 240, 0.14));
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft, rgba(237, 238, 240, 0.55));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  cursor: pointer;
  transition: color .35s var(--ease, cubic-bezier(.52, 0, 0, 1)),
              border-color .35s var(--ease, cubic-bezier(.52, 0, 0, 1)),
              background .35s var(--ease, cubic-bezier(.52, 0, 0, 1));
}
.lang-switch__btn:hover,
.lang-switch__btn[aria-expanded="true"] {
  color: var(--ink, #EDEEF0);
  border-color: var(--ink, #EDEEF0);
}
.lang-switch__btn svg {
  width: 16px;
  height: 16px;
  display: block;
  flex: 0 0 auto;
}
.lang-switch__code {
  display: inline-flex;
  align-items: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: inherit;
  pointer-events: none;
}

/* Popover list */
.lang-switch__menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 160px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--ground-2, #13131A);
  border: 1px solid var(--ink-faint, rgba(237, 238, 240, 0.14));
  border-radius: 10px;
  box-shadow: 0 18px 50px -14px rgba(0, 0, 0, .7),
              0 0 0 1px rgba(237, 238, 240, 0.04);
  z-index: 250;
}
.lang-switch__menu::before {
  content: '';
  position: absolute;
  top: -5px;
  right: 13px;
  width: 8px;
  height: 8px;
  background: var(--ground-2, #13131A);
  border-left: 1px solid var(--ink-faint, rgba(237, 238, 240, 0.14));
  border-top:  1px solid var(--ink-faint, rgba(237, 238, 240, 0.14));
  transform: rotate(45deg);
}
.lang-switch__menu li { margin: 0; }
.lang-switch__menu button {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: transparent;
  border: 0;
  color: var(--ink-soft, rgba(237, 238, 240, 0.55));
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background .25s, color .25s;
}
.lang-switch__menu button b {
  color: var(--ink, #EDEEF0);
  font-weight: 500;
  letter-spacing: 0.06em;
}
.lang-switch__menu button:hover,
.lang-switch__menu button:focus-visible {
  background: rgba(237, 238, 240, 0.06);
  color: var(--ink, #EDEEF0);
  outline: none;
}
.lang-switch__menu button.is-current {
  color: var(--accent, #F50537);
}
.lang-switch__menu button.is-current b {
  color: var(--accent, #F50537);
}

/* Mobile — keep the button in the nav, make the menu align flush to
   the right edge so it doesn't clip off the viewport. */
@media (max-width: 820px) {
  .lang-switch__menu {
    right: -10px;
    min-width: 150px;
  }
}
