/* The language switcher that rewrites the greeting: a minimal piece on a white page. One greeting in a variable
   face, its soft shadow on the line, the name of the language and a row of five language codes with a pale pill
   behind the one chosen. One accent: the code chosen. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #141414;           /* the greeting */
  --muted: #8a8a86;         /* the brand, the name of the language, the codes not chosen */
  --accent: #e5432a;        /* the code chosen */
  --pill: #f1efea;          /* the pill behind the code chosen */
  --shadow: rgba(20, 20, 20, 0.12);   /* the shadow of the greeting on the line */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow: hidden;
}

.lang {
  display: grid;
  justify-items: center;
  gap: clamp(10px, 2.4vh, 22px);
  margin: 0;
  max-width: 100%;
}

.lang__brand {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  font-variation-settings: 'wdth' 112;
  font-weight: 600;
}

.lang__brand span {
  color: var(--muted);
  font-weight: 400;
  margin-left: 0.6em;
}

.lang__word {
  position: relative;
  height: 1.18em;
  font-size: clamp(48px, min(17vw, 19vh), 150px);
  line-height: 1;
  perspective: 600px;
}

.lang__letters {
  position: relative;
  display: block;
  height: 100%;
  white-space: nowrap;
  z-index: 1;
}

.lang__line {
  position: absolute;
  top: 0.06em;
  left: 50%;
  white-space: nowrap;
  font-weight: 640;
  letter-spacing: -0.02em;
}

.lang__letter {
  display: inline-block;
  transform-origin: 50% 100%;
  will-change: transform, opacity;
}

.lang__shadow {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 0;
  height: 0.08em;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--shadow), transparent);
  filter: blur(2px);
}

.lang__name {
  margin: 0;
  min-height: 1.4em;
  font-size: 15px;
  color: var(--muted);
  font-variation-settings: 'wdth' 100;
}

.lang__set {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.lang__legend,
.lang__status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.lang__row {
  position: relative;
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid #e6e4df;
  border-radius: 999px;
}

.lang__pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--pill);
  box-shadow: inset 0 0 0 1px rgba(20, 20, 20, 0.04), 0 1px 1px rgba(20, 20, 20, 0.04);
}

.lang__option {
  position: relative;
  display: block;
  cursor: pointer;
}

.lang__option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.lang__code {
  position: relative;
  display: block;
  padding: 9px clamp(10px, 3.4vw, 16px);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 500;
  font-variation-settings: 'wdth' var(--w, 100);
  transition: color 0.3s ease;
  z-index: 1;
}

.lang__option.is-on .lang__code {
  color: var(--accent);
  font-weight: 700;
}

.lang__option input:focus-visible + .lang__code {
  outline: 1px solid var(--ink);
  outline-offset: 1px;
  border-radius: 999px;
}

@media (hover: hover) {
  .lang__option:hover .lang__code {
    color: var(--ink);
  }
  .lang__option.is-on:hover .lang__code {
    color: var(--accent);
  }
}
