/* ═══ Language switcher ═══════════════════════════════════════════════════
   One component, three hosts: the homepage header (.header-cta) and drawer
   (.drawer-panel), the shared page header (nav.main) and the wiki top bar
   (.topbar). Mounted by /lang-switch.js. Flags are the flag-icons SVGs
   (MIT, lipis/flag-icons) served from /assets/flags/.
   Tokens fall back so the wiki, which has its own palette, still looks right. */
.lsw { position: relative; display: inline-flex; align-items: center; flex: none; }
.lsw-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 9px 0 8px; border-radius: 8px; cursor: pointer;
  background: rgba(8,5,14,.45);
  border: 1px solid var(--brd-steel, var(--line, rgba(204,209,224,.22)));
  color: var(--ink-dim, #97909f);
  font-family: var(--display, 'Cinzel', Georgia, serif); font-weight: 700;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; line-height: 1;
  transition: border-color .18s ease-out, color .18s ease-out, background .18s ease-out, transform .18s ease-out;
}
.lsw-btn:hover, .lsw.is-open .lsw-btn {
  color: var(--ink, #e8e4f0); border-color: var(--brd-am, rgba(160,107,255,.32));
  background: rgba(160,107,255,.10);
}
.lsw-btn:focus-visible { outline: 2px solid var(--amethyst, #a06bff); outline-offset: 2px; }
.lsw-flag {
  display: block; width: 22px; height: 16.5px; border-radius: 3px; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0,0,0,.55), inset 0 0 0 1px rgba(255,255,255,.08), 0 1px 2px rgba(0,0,0,.5);
}
.lsw-chev { width: 10px; height: 10px; opacity: .7; transition: transform .18s ease-out; }
.lsw.is-open .lsw-chev { transform: rotate(180deg); }

/* the menu */
.lsw-menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0; z-index: 400;
  min-width: 216px; padding: 6px; border-radius: 10px;
  background: linear-gradient(180deg, #191426, #0e0b18 70%, #0a0812);
  border: 1px solid var(--stone-brd, rgba(160,107,255,.22));
  box-shadow: inset 0 0 0 1px rgba(204,209,224,.08), 0 22px 50px rgba(0,0,0,.65), 0 0 40px rgba(160,107,255,.10);
  animation: lswIn .16s ease-out;
}
.lsw.is-open .lsw-menu { display: block; }
@keyframes lswIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .lsw-menu { animation: none; } }
.lsw-menu::before {
  content: ""; position: absolute; top: 8px; left: 8px; width: 4px; height: 4px; border-radius: 50%;
  background: var(--amethyst, #a06bff); opacity: .55;
}
.lsw-item, nav.main .lsw .lsw-item, .drawer-panel .lsw .lsw-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 7px; text-decoration: none;
  color: var(--ink, #e8e4f0); font-family: var(--body, 'Spectral', Georgia, serif);
  font-size: 14px; letter-spacing: 0; text-transform: none; font-weight: 400; line-height: 1.2;
  border: 1px solid transparent; margin: 0; white-space: nowrap;
  transition: background .15s ease-out, border-color .15s ease-out;
}
.lsw-item:hover, nav.main .lsw .lsw-item:hover, .drawer-panel .lsw .lsw-item:hover {
  background: rgba(160,107,255,.10); border-color: rgba(160,107,255,.18); color: #fff;
}
.lsw-item:focus-visible { outline: 2px solid var(--amethyst, #a06bff); outline-offset: -2px; }
.lsw-item .lsw-flag { width: 26px; height: 19.5px; flex: none; }
.lsw-item .lsw-name { display: block; }
.lsw-item .lsw-sub { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-dim, #97909f); letter-spacing: .02em; }
.lsw-item.is-current { background: rgba(160,107,255,.08); border-color: rgba(160,107,255,.22); }
.lsw-item.is-current::after {
  content: "\2726"; margin-left: auto; padding-left: 10px;
  color: var(--gold, #f0c75e); font-size: 12px;
}

/* ── row variant: a horizontal band of flag pills, used inside the mobile
      menus where a dropdown makes no sense ── */
.lsw--row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.lsw--row .lsw-btn { display: none; }
.lsw--row .lsw-menu {
  display: flex; flex-wrap: wrap; gap: 6px; position: static; min-width: 0; padding: 0;
  background: none; border: 0; box-shadow: none; animation: none;
}
.lsw--row .lsw-menu::before { display: none; }
.lsw--row .lsw-item, nav.main .lsw--row .lsw-item, .drawer-panel .lsw--row .lsw-item {
  padding: 7px 11px 7px 8px; gap: 8px; font-size: 13px;
  background: rgba(8,5,14,.5); border: 1px solid var(--brd, rgba(160,150,190,.14)); border-radius: 999px;
}
.lsw--row .lsw-item .lsw-flag { width: 20px; height: 15px; }
.lsw--row .lsw-item .lsw-sub { display: none; }
.lsw--row .lsw-item.is-current { border-color: var(--brd-am, rgba(160,107,255,.32)); background: rgba(160,107,255,.12); }
.lsw--row .lsw-item.is-current::after { padding-left: 6px; font-size: 10px; }
.lsw-row-label {
  flex: 0 0 100%; margin: 0 0 2px; font-family: var(--display, 'Cinzel', serif);
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold, #f0c75e);
}

/* ── host: the shared page header (every page but the homepage and the wiki) ── */
nav.main .lsw { margin: 0 4px 0 6px; }
@media (max-width: 940px) {
  /* the nav becomes a column behind the burger: show the flags as a row */
  nav.main .lsw { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 4px 2px; }
  nav.main .lsw .lsw-btn { display: none; }
  nav.main .lsw .lsw-menu {
    display: flex; flex-wrap: wrap; gap: 6px; position: static; min-width: 0; padding: 0;
    background: none; border: 0; box-shadow: none; animation: none;
  }
  nav.main .lsw .lsw-menu::before { display: none; }
  nav.main .lsw .lsw-item {
    padding: 8px 12px 8px 9px; gap: 8px; font-size: 13.5px; border-radius: 999px;
    background: rgba(8,5,14,.5); border: 1px solid var(--brd, rgba(160,150,190,.14));
  }
  nav.main .lsw .lsw-item .lsw-flag { width: 20px; height: 15px; }
  nav.main .lsw .lsw-item .lsw-sub { display: none; }
  nav.main .lsw .lsw-item.is-current { border-color: var(--brd-am, rgba(160,107,255,.32)); background: rgba(160,107,255,.12); }
}

/* ── host: the homepage header ── */
.header-cta .lsw { margin-right: 2px; }
/* ── host: the wiki top bar ── */
.topbar .lsw-btn { height: 2.3rem; border-radius: 100px; background: var(--panel, rgba(8,5,14,.45)); border-color: var(--line, rgba(204,209,224,.22)); }
.topbar .lsw-menu { font-family: inherit; }
.topbar .lsw-item { font-family: inherit; }
@media (max-width: 34rem) { .topbar .lsw-code { display: none; } .topbar .lsw-btn { padding: 0 8px; } }

/* ── the suggestion line under the header ── */
.lsw-hint {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 16px; font-family: var(--body, 'Spectral', Georgia, serif); font-size: 13.5px;
  color: var(--ink, #e8e4f0);
  background: linear-gradient(90deg, rgba(160,107,255,.10), rgba(123,63,242,.16), rgba(160,107,255,.10));
  border-bottom: 1px solid var(--brd-am, rgba(160,107,255,.32));
  animation: lswHint .35s ease-out;
}
@keyframes lswHint { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.lsw-hint .lsw-flag { width: 20px; height: 15px; }
.lsw-hint a { color: var(--gold, #f0c75e); font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(240,199,94,.4); }
.lsw-hint a:hover { color: var(--gold-hot, #fff0c6); border-bottom-color: currentColor; }
.lsw-hint-x {
  margin-left: 6px; width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--ink-dim, #97909f); font-size: 16px; line-height: 1;
}
.lsw-hint-x:hover { color: var(--ink, #e8e4f0); border-color: var(--brd-steel, rgba(204,209,224,.22)); }

/* ── the homepage header is the tightest host: twelve nav items and the gold
      Play. The button is flag-only there and the action cluster closes up.
      Below 1360 the Discord icon steps aside: the marquee right underneath
      carries a full Discord button, so nothing is lost. ── */
.site-header .header-cta { gap: 12px; }
.header-cta .lsw-code { display: none; }
.header-cta .lsw-btn { padding: 0 7px; gap: 5px; }
@media (max-width: 1360px) {
  .header-cta .lsw-chev { display: none; }
  .header-cta .lsw-btn { padding: 0 6px; }
  .header-cta .nav-discord { display: none; }
}
/* the header row itself: a little more room, so twelve items, the flag and
   the gold Play sit on one line from 1160 up */
.site-header .header-inner { max-width: min(1400px, calc(100% - 24px)); padding: 0 14px; gap: 16px; }
.site-nav a { padding: 9px 5px; }
@media (max-width: 1360px) {
  .site-header .header-inner { gap: 12px; }
  .site-nav a { padding: 9px 3px; letter-spacing: .04em; }
}
