/* Language switcher. Flags crossfade with CSS only (~3 s per flag). Nothing re-renders, no timer.
   One clock: every flag box starts its animation at page load and never stops (the list is hidden with visibility,
   never with display:none), so the button and the list always show the same country for the same language — also
   while the menu is open; nothing re-renders. Static with prefers-reduced-motion. As on the BBB site (7.1.1). */
.langdd { position: relative; }
.lang-btn { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .9rem; border-radius: 999px;
  border: 1px solid rgba(18,18,18,.14); background: #FFFFFF; color: inherit; font: inherit; cursor: pointer; }
/* little room: code; more room: native name */
.lang-btn .name { display: none; }
@media (min-width: 64rem) { .lang-btn .code { display: none; } .lang-btn .name { display: inline; } }

.lang-list { position: absolute; inset-inline-end: 0; top: calc(100% + .5rem); z-index: 50; margin: 0; padding: .5rem; list-style: none;
  display: grid; grid-template-columns: 1fr; gap: .125rem; min-width: 15rem; max-width: calc(100vw - 32px); max-height: min(75vh, 40rem); overflow-y: auto;
  background: #FFFFFF; border: 1px solid rgba(18,18,18,.1); border-radius: 18px; box-shadow: 0 16px 40px rgba(18,18,18,.16); color: #121212;
  visibility: hidden; opacity: 0; transform: translateY(-4px); transition: opacity .15s, transform .15s, visibility 0s linear .15s; }
@media (min-width: 40rem) { .lang-list { grid-template-columns: repeat(2, minmax(13rem, 1fr)); } }
.langdd.open .lang-list, html:not(.js) .langdd:focus-within .lang-list { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
.lang-list a { display: flex; align-items: center; gap: .75rem; min-height: 44px; padding: 0 .9rem; border-radius: 10px; color: inherit; text-decoration: none; }
.lang-list a:hover, .lang-list a:focus-visible { background: #F4F1EA; }
.lang-list a[aria-current="page"] { background: #E5FFE5; font-weight: 600; }

/* flags: all flags of a language stacked in one fixed box; only opacity animates */
.flags { position: relative; flex: 0 0 auto; width: 22px; height: 16px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px rgba(18,18,18,.12); }
.flags img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.flags img:first-child { opacity: 1; }
.flags.n2 img { animation: flag2 6s infinite; }
.flags.n3 img { animation: flag3 9s infinite; }
.flags.n4 img { animation: flag4 12s infinite; }
.flags.n5 img { animation: flag5 15s infinite; }
.flags img:nth-child(2) { animation-delay: 3s; }
.flags img:nth-child(3) { animation-delay: 6s; }
.flags img:nth-child(4) { animation-delay: 9s; }
.flags img:nth-child(5) { animation-delay: 12s; }
/* each flag fully visible ~2.6 s of its 3 s slot, ~0.4 s fade; during its delay a later flag keeps opacity 0 */
@keyframes flag2 { 0%, 45% { opacity: 1 } 52%, 93% { opacity: 0 } 100% { opacity: 1 } }
@keyframes flag3 { 0%, 30% { opacity: 1 } 36%, 94% { opacity: 0 } 100% { opacity: 1 } }
@keyframes flag4 { 0%, 22% { opacity: 1 } 27%, 95% { opacity: 0 } 100% { opacity: 1 } }
@keyframes flag5 { 0%, 18% { opacity: 1 } 22%, 96% { opacity: 0 } 100% { opacity: 1 } }

/* No pause while the menu is open (owner, BBB 7.1.1): the flags keep cross-fading, in step with the button.
   If a project wants a pause, pause EVERY flag at once so they stay in step:
   :root:has(.langdd.open) .flags img { animation-play-state: paused; } */
/* no motion wanted: first flag only */
@media (prefers-reduced-motion: reduce) {
  .flags img { animation: none !important; }
  .flags img:not(:first-child) { opacity: 0 !important; }
}

/* the ring menu (z-index up to 12) must not draw over the open language list: lift the header while the list is open or has focus */
.top:has(.langdd.open), .top:has(.langdd:focus-within) { z-index: 30; }

/* P14 C1 language suggestion: a bar above the header (pushes the page down, never covers it); targets are at least 44 px */
.lang-hint { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .25rem .75rem; padding: .25rem 1rem; background: #F4F1EA; color: #121212; border-bottom: 1px solid rgba(18,18,18,.1); font-size: 15px; }
.lang-hint p { margin: 0; }
.lang-hint a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .9rem; border-radius: 999px; background: #121212; color: #FFFFFF; font-weight: 600; text-decoration: none; }
.lang-hint a:hover, .lang-hint a:focus-visible { outline: 2px solid #121212; outline-offset: 2px; }
.lang-hint button { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border: 0; border-radius: 50%; background: transparent; color: inherit; font: inherit; font-size: 24px; line-height: 1; cursor: pointer; }
.lang-hint button:hover, .lang-hint button:focus-visible { background: rgba(18,18,18,.1); }
