/* ==========================================================================
   NEXIFY STUDIO: the language switch (js/i18n.js), Deutsch / English.
   The same liquid glass as the sun/moon switch beside it: a glass pill with a
   lens that slides under the chosen language (stretching a little as it
   travels) and two round flags. It sits in the hero header, in the floating
   bar, and on phones in the menu with the full language names.
   ========================================================================== */
.lswitch {
  --ls-h: 3.2rem;
  --ls-pad: 0.3rem;
  --ls-flag: 1.12rem;
  --ls-font: 0.78rem;
  --ls-gap: 0.42rem;
  --ls-x: 0.78rem;
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  flex: none;
  height: var(--ls-h);
  padding: var(--ls-pad);
  border-radius: 999px;
  color: #fff;
}
.lswitch__thumb {
  position: absolute;
  z-index: 1;
  top: var(--ls-pad);
  bottom: var(--ls-pad);
  left: var(--ls-pad);
  width: calc(50% - var(--ls-pad));
  border-radius: 999px;
  pointer-events: none;
  transform: translateX(0);
  transition: transform 0.62s var(--lg-spring), background 0.5s var(--lg-soft), box-shadow 0.5s var(--lg-soft);
  /* the smoked lens of the theme switch */
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 236, 190, 0.32), rgba(255, 236, 190, 0.06) 62%, rgba(255, 236, 190, 0) 100%),
    rgba(40, 33, 22, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 205, 0.5),
    inset 0 0 0 1px rgba(220, 180, 102, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.35),
    0 2px 6px -1px rgba(0, 0, 0, 0.5);
}
.lswitch[data-on="en"] .lswitch__thumb { transform: translateX(100%); }
html[data-theme="light"] .lswitch__thumb {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 252, 244, 0.78) 55%, rgba(246, 238, 222, 0.85) 100%);
  box-shadow:
    inset 0 1px 0 #fff,
    inset 0 0 0 1px rgba(190, 150, 80, 0.3),
    inset 0 -2px 4px rgba(120, 90, 40, 0.12),
    0 3px 8px -2px rgba(40, 28, 8, 0.45);
}
.lswitch.is-flip .lswitch__thumb { animation: ts-stretch 0.6s var(--lg-soft); }

.lswitch__opt {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ls-gap);
  min-width: 0;
  padding: 0 var(--ls-x);
  border: 0;
  border-radius: 999px;
  background: none;
  color: inherit;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: var(--ls-font);
  line-height: 1;
  letter-spacing: 0.08em;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0.58;
  transition: opacity 0.45s var(--lg-soft), color 0.45s var(--lg-soft);
  -webkit-tap-highlight-color: transparent;
}
.lswitch__opt[aria-pressed="true"] { opacity: 1; cursor: default; }
.lswitch__opt:focus-visible { outline: 2px solid var(--gold-1); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .lswitch__opt[aria-pressed="false"]:hover { opacity: 0.9; }
}
.lswitch__flag {
  display: block;
  flex: none;
  width: var(--ls-flag);
  height: var(--ls-flag);
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.38), 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: scale 0.6s var(--lg-spring), filter 0.45s var(--lg-soft);
}
.lswitch__opt[aria-pressed="false"] .lswitch__flag { scale: 0.86; filter: saturate(0.55); }
.lswitch__flag svg { display: block; width: 100%; height: 100%; }

/* light theme: ink on the milk lens and on the light glass of the bar */
html[data-theme="light"] .lswitch__opt[aria-pressed="true"],
html[data-theme="light"] .gnav .lswitch__opt { color: var(--c-fg, #17130d); }
html[data-theme="light"] .lswitch__flag { box-shadow: 0 0 0 1px rgba(122, 88, 32, 0.28), 0 1px 3px rgba(60, 40, 10, 0.25); }

/* hero header: on the same line as the theme switch and Book, scaled with the
   stage; its right edge sits a step before the theme switch (x 1272) */
.header .lswitch {
  --ls-h: calc(54 * var(--u));
  --ls-pad: calc(5 * var(--u));
  --ls-flag: calc(20 * var(--u));
  --ls-font: calc(13.5 * var(--u));
  --ls-gap: calc(7 * var(--u));
  --ls-x: calc(12 * var(--u));
  position: absolute;
  left: auto;
  right: calc(332 * var(--u));
  top: calc(25 * var(--u));
  transition: opacity 0.45s ease, translate 0.45s ease, visibility 0s linear 0s;
}
/* scrolled down: fades away (js/i18n.js); back at the top it returns */
.header .lswitch.is-away {
  opacity: 0;
  translate: 0 calc(-10 * var(--u));
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s ease, translate 0.45s ease, visibility 0s linear 0.45s;
}

/* the floating bar has no language switch (it ran into the links). Where the
   hero header is hidden (narrow or portrait windows) it lives in the menu. */
.gnav__lang { display: none; }
@media (max-width: 900px), (max-aspect-ratio: 4/5) {
  .gnav__lang {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0.55rem 0.55rem 1.1rem;
  }
  .gnav__lang .lswitch { --ls-h: 2.7rem; --ls-flag: 1.05rem; --ls-font: 0.8rem; --ls-x: 0.7rem; --ls-gap: 0.45rem; letter-spacing: 0; }
  .gnav__lang .lswitch__opt { letter-spacing: 0.02em; }
}
.lg-calm .lswitch.is-flip .lswitch__thumb { animation: none; }
.lg-calm .lswitch__thumb { transition-timing-function: var(--lg-soft); }
@media (prefers-reduced-motion: reduce) {
  html:not(.mo-full) .lswitch__thumb, html:not(.mo-full) .lswitch__flag { transition-duration: 0.01s; }
  html:not(.mo-full) .lswitch.is-flip .lswitch__thumb { animation: none; }
}

/* ---- German umlauts in the display face -------------------------------------
   BBH Bogle has no Ä, Ö or Ü (Google ships it as basic Latin only). The next font
   in the stack supplies just those letters (index.html loads only those six
   glyphs): Sofia Sans Extra Condensed Black, the closest condensed heavy
   grotesque. js/i18n.js writes them as capitals in Bogle text (the face is
   all-caps) and ß as SS, the German all-caps spelling. */
:root { --font-bogle: "BBH Bogle", "Sofia Sans Extra Condensed", "Arial Narrow", "Roboto Condensed", sans-serif; }

/* ---- German copy runs longer: small fits, the design stays the same ------- */
/* hero navigation pill: five German labels in the same 457-unit pill */
html[lang="de"] .nav a { letter-spacing: 0; font-size: calc(16.4 * var(--u)); }
