/*
 * lang-picker.css — globe language picker, extracted from mahjong.craven.fr
 * (source: american-mahjong/src/style.css, .lang-picker* + :root).
 *
 * Standalone & theme-neutral: every colour/size reads from --lp-* custom props
 * with sensible fallbacks, so it inherits whatever the host page sets on :root.
 * To fuse with latin-reading.css, override these on :root (one block):
 *     :root { --lp-bone: var(--color-bg, #f6f1e7);
 *             --lp-ink: var(--color-text, #2a2a28);
 *             --lp-gold: var(--color-link, #3f4f46); }
 */

:root {
  --lp-bone: #f6f1e7;    /* light theme text on dark menu (fallback)        */
  --lp-ink:  #1f2a24;    /* menu background / control ink                   */
  --lp-mut:  #5e5a54;    /* muted text (labels, globe tint)                 */
  --lp-gold: #3f4f46;    /* selection / border / highlight                  */
  --lp-size: 2.25rem;    /* globe size                                      */
  --lp-radius: 12px;
  --lp-min-w: 12.5rem;
  --lp-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  --lp-transition: 120ms ease;
}

/* The picker wrapper sits inline next to its sibling (e.g. the "Latine" link). */
.lang-picker {
  position: relative;
  display: inline-block;
  /* KO round (t_37648b10): must paint above the sticky .section-nav
     (latin-reading.css z-index:10) and the tooltip family (z-index:20),
     otherwise the nav bar slices through the open menu. */
  z-index: 50;
  vertical-align: middle;
  font: inherit;
}

/* Globe control ------------------------------------------------------------- */
.lang-picker-globe {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--lp-mut);
  font: inherit;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Globe SVG */
.lang-picker-icon {
  width: var(--lp-size, 1.5rem);
  height: var(--lp-size, 1.5rem);
  flex: 0 0 auto;
  color: var(--lp-gold);
}

/* Currently selected language shown to the right of the globe */
.lang-picker-current {
  font-size: 0.85em;
  color: inherit;
  white-space: nowrap;
}

.lang-picker:hover .lang-picker-globe,
.lang-picker:focus-within .lang-picker-globe {
  color: var(--lp-ink);
  border-color: var(--lp-gold);
}

/* Menu -------------------------------------------------------------------- */
.lang-picker-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  min-width: var(--lp-min-w);
  background: var(--lp-ink);
  border: 1px solid var(--lp-gold);
  border-radius: var(--lp-radius);
  box-shadow: var(--lp-shadow);
  z-index: 11;
  grid-gap: 2px;
}

/* Open states: click (.is-open) and hover/focus fallbacks, mirroring mahjong. */
.lang-picker.is-open .lang-picker-menu,
.lang-picker:hover .lang-picker-menu,
.lang-picker:focus-within .lang-picker-menu {
  display: grid;
  gap: 2px;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--lp-bone);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.lang-option:hover,
.lang-option:focus {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  color: #fff;
}

.lang-option.is-current {
  outline: 1px solid var(--lp-gold);
  color: #fff;
}

.lang-flag {
  font-size: 1.1em;
  flex: 0 0 auto;
  line-height: 1;
}

.lang-name {
  line-height: 1.2;
}

/* Variant knobs (mahjong ships three; discrete hides on touch-only phones) */
.lang-picker--prominent .lang-picker-globe { --lp-size: 1.7rem; }
.lang-picker--prominent .lang-picker-icon { --lp-size: 1.7rem; }
.lang-picker--settings .lang-picker-menu { right: auto; left: 0; }

/* No layout shift on <768px: the globe stays inline & menu floats above content */
@media (max-width: 768px) {
  .lang-picker-globe { min-height: 2rem; padding: 0.2rem 0.45rem; gap: 0.3rem; }
  .lang-picker-icon  { --lp-size: 1.25rem; }
  .lang-picker-menu  { right: 0; min-width: 11rem; }
  .lang-picker-current { display: none; /* keep the globe tight on small screens */ }
}

/* latin.craven.fr theme fusion (t_f6f1efd9, per extract README §4): the menu
   fuses with the house beige/ink palette from latin-reading.css :root tokens
   (--color-bg / --color-text / --color-muted / --color-link). */
:root {
  --lp-bone: var(--color-bg,    #f6f1e7);
  --lp-ink:  var(--color-text,  #2a2a28);
  --lp-mut:  var(--color-muted, #5e5a54);
  --lp-gold: var(--color-link,  #3f4f46);
}

/* The picker sits inline to the right of the "Latine"/"English" switch link. */
.lang-switch { white-space: nowrap; }
.lang-switch .lang-picker { margin-left: 0.35rem; }

