/*
 * The language switcher (the header's nav) and the language suggestion card.
 * Markup: template-parts/language-switcher.php and
 * language-suggestion-banner.php; behaviour: assets/js/lang.js. The CJK type
 * stacks are in critical.css, since they change the first paint.
 *
 * Ported from the cameragrid theme and dressed as the rest of this site: the
 * switcher is a mono tag on the ink glass with a gold check, and the
 * suggestion is a small certificate (ivory paper, the gold double rule, the
 * foil button).
 */

/* ── Switcher ────────────────────────────────────────────── */
.lang { position: relative; }
.lang-toggle { display: inline-flex; align-items: center; gap: 7px; margin: 0; cursor: pointer;
  background: transparent; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 7px 11px 7px 10px; font: 500 12px/1 var(--mono); letter-spacing: .14em;
  transition: color .2s, border-color .2s; }
.lang-toggle:hover, .lang-toggle[aria-expanded="true"] { color: var(--text); border-color: var(--gold); }
.lang-globe { flex: none; }
.lang-chevron { flex: none; transition: transform .2s var(--ease-out); }
.lang-toggle[aria-expanded="true"] .lang-chevron { transform: rotate(180deg); }
.lang-menu[hidden] { display: none; }
.lang-menu { list-style: none; margin: 0; padding: 0; }
.lang-menu a { display: flex; align-items: center; justify-content: space-between; gap: 16px; text-decoration: none; }
.lang-check { flex: none; color: var(--gold); visibility: hidden; }
.lang-menu a[aria-current="page"] { color: var(--text); }
.lang-menu a[aria-current="page"] .lang-check { visibility: visible; }

@media (min-width: 820px) {
  .nav { align-items: center; }
  /* The button shows the code alone; "Language" and the name are still its accessible name. */
  .lang-label, .lang-name { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; }
  .lang-menu { position: absolute; top: calc(100% + 14px); right: 0; z-index: 60; min-width: 210px; padding: 6px;
    background: var(--ink-2); border: 1px solid var(--line-2); border-radius: 12px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .5); }
  .nav .lang-menu a { padding: 9px 12px; border-radius: 8px; font-size: 15px; color: var(--muted); }
  .nav .lang-menu a:hover { background: var(--ink-3); color: var(--text); }
  .nav .lang-menu a[aria-current="page"] { color: var(--text); }
}

@media (max-width: 819.98px) {
  /* The foot of the menu panel: one full row, its list opening in place. */
  .lang-toggle { display: flex; width: 100%; gap: 10px; padding: 16px 0; border: 0; border-radius: 0;
    color: var(--text); font: 500 12px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
  .lang-code { display: none; }
  .lang-name { margin-left: auto; color: var(--gold-hi); font: 400 16px/1.4 var(--sans); letter-spacing: 0; text-transform: none; }
  .lang-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; padding: 2px 0 10px; }
  /* li a: outranks the panel's .nav a:last-child, which every link here is. */
  .nav .lang-menu li a { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: 400 15px/1.3 var(--sans);
    letter-spacing: 0; color: var(--muted); }
  .nav .lang-menu li a[aria-current="page"] { color: var(--text); border-color: var(--gold); }
}

/* ── Suggestion card: a small certificate ────────────────── */
.lang-suggest { position: fixed; z-index: 60; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); width: min(380px, calc(100% - 40px)); }
.lang-suggest-body { position: relative; display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 12px 12px; padding: 22px 24px;
  background: var(--paper); color: var(--paper-ink); border-radius: 6px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, .55); animation: lang-in .35s var(--ease-out) both; }
.lang-suggest-body::before { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(176, 138, 60, .5); border-radius: 3px; pointer-events: none; }
.lang-suggest-body::after { content: ""; position: absolute; inset: 10px; border: 1px dashed rgba(176, 138, 60, .35); border-radius: 2px; pointer-events: none; }
.lang-suggest-body .lang-globe { color: var(--gold-deep); margin-top: 3px; }
.lang-suggest-msg { position: relative; margin: 0; font: 600 17px/1.35 var(--serif); letter-spacing: -.005em; color: var(--paper-ink); }
.lang-suggest-actions { position: relative; z-index: 1; grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.lang-suggest-go { padding: 11px 16px; font-size: 14px; }
.lang-suggest-go:hover { transform: none; }
.lang-suggest-no { background: none; border: 0; padding: 10px 2px; cursor: pointer; font: 500 14px/1 var(--sans); color: var(--paper-muted);
  text-decoration: underline dashed rgba(110, 103, 90, .6); text-underline-offset: 4px; }
.lang-suggest-no:hover { color: var(--paper-ink); }
.lang-suggest :focus-visible { outline-color: var(--gold-deep); }
@keyframes lang-in { from { opacity: 0; transform: translateY(10px); } }
@media (max-width: 559.98px) {
  .lang-suggest { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .lang-suggest-body { animation: none; }
  .lang-chevron { transition: none; }
}
