/* Minimal full-screen language selector and persistent language switch. */

:root {
  --prive-gate-milk: #f4f1eb;
  --prive-gate-ink: #1b1a18;
  --prive-gate-line: rgba(27, 26, 24, 0.34);
}

html.prive-language-pending #prive-presentation {
  visibility: hidden;
}

html[data-prive-language-gate="open"] #prive-presentation *,
html[data-prive-language-gate="open"] #prive-presentation *::before,
html[data-prive-language-gate="open"] #prive-presentation *::after {
  animation-play-state: paused !important;
}

html.prive-language-scroll-locked,
html.prive-language-scroll-locked body {
  overscroll-behavior: none;
}

html[data-prive-language="en"] #prive-presentation {
  --prive-ru-tracking: 0.025em;
}

.prive-language-gate {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--prive-gate-ink);
  background: var(--prive-gate-milk);
  font-family: "Prive Deck Text", "Prive Display", Arial, sans-serif;
  font-synthesis: none;
  opacity: 1;
  transition:
    opacity 1050ms cubic-bezier(0.45, 0, 0.55, 1),
    background-color 850ms cubic-bezier(0.45, 0, 0.55, 1);
}

.prive-language-gate[hidden] {
  display: none;
}

.prive-language-gate.is-leaving {
  opacity: 0;
  pointer-events: none;
}

.prive-language-gate__main {
  opacity: 1;
  transform: scale(1);
  transition:
    opacity 520ms cubic-bezier(0.45, 0, 0.55, 1),
    transform 850ms cubic-bezier(0.45, 0, 0.55, 1);
}

.prive-language-gate.is-switching {
  color: #f4f1eb;
  background-color: #050404;
  pointer-events: none;
}

.prive-language-gate.is-switching .prive-language-gate__main {
  opacity: 0;
  transform: scale(0.992);
}

.prive-language-gate__layout {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100%;
  padding:
    max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
}

.prive-language-gate__main {
  width: 100%;
  text-align: center;
}

.prive-language-gate__title {
  margin: 0;
  color: var(--prive-gate-ink);
  font-family: "Prive Display", "Prive Deck Text", Arial, sans-serif;
  font-size: clamp(2rem, 4.4vw, 3.8rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0.025em;
  text-wrap: balance;
}

.prive-language-gate__options {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: clamp(28px, 4vh, 40px);
}

.prive-language-gate__option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(132px, 15vw, 156px);
  min-height: 64px;
  padding: 12px 18px;
  color: var(--prive-gate-ink);
  background: transparent;
  border: 1px solid var(--prive-gate-line);
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.prive-language-gate__name {
  font-family: "Prive Deck Text", "Prive Display", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.025em;
}

.prive-language-gate__option[aria-pressed="true"] {
  color: var(--prive-gate-milk);
  background: var(--prive-gate-ink);
  border-color: var(--prive-gate-ink);
}

.prive-language-gate__option:focus-visible {
  outline: 2px solid var(--prive-gate-ink);
  outline-offset: 4px;
}

.prive-language-switch {
  position: fixed;
  inset-block-start: max(16px, env(safe-area-inset-top));
  inset-inline-end: max(16px, env(safe-area-inset-right));
  z-index: 120;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 68px;
  min-height: 44px;
  padding: 9px 14px;
  color: #f4f1eb;
  background: rgba(8, 8, 8, 0.78);
  border: 1px solid rgba(244, 241, 235, 0.34);
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: "Prive Deck Personal", Arial, sans-serif;
  font-size: 0.72rem;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}

.prive-language-switch[hidden],
html[data-prive-language-gate="open"] .prive-language-switch {
  display: none;
}

.prive-language-switch::after {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: 0.7;
}

.prive-language-switch:focus-visible {
  outline: 2px solid #c9ad7e;
  outline-offset: 4px;
}

.prive-language-announcer {
  position: fixed;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Latin letters traced from the user's matching English alphabet. */
.prive-language-gate[lang="en"] .prive-language-gate__title,
html[data-prive-language="en"] body :is(#prive-presentation, .unit-plan-dialog) :is(h1, h2, h3, h4, dt) {
  font-family: "Prive Display Latin", "Prive Deck Personal", Arial, sans-serif;
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: 0.025em;
}

html[data-prive-language="en"] #prive-presentation .architecture-introduction-label {
  font-family: "Prive Deck Text", "Prive Display Latin", "Prive Deck Personal", Arial, sans-serif;
}

@media (hover: hover) and (pointer: fine) {
  .prive-language-gate__option:hover {
    color: var(--prive-gate-milk);
    background: var(--prive-gate-ink);
    border-color: var(--prive-gate-ink);
  }

  .prive-language-switch:hover {
    background: rgba(26, 22, 18, 0.92);
    border-color: rgba(201, 173, 126, 0.75);
  }
}

@media (max-width: 900px) {
  .prive-language-switch {
    background: rgba(8, 8, 8, 0.94);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (max-width: 360px) {
  .prive-language-gate__layout {
    padding-inline: max(16px, env(safe-area-inset-left));
  }

  .prive-language-gate__options {
    gap: 8px;
  }

  .prive-language-gate__option {
    width: min(132px, calc(50vw - 20px));
    padding-inline: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .prive-language-gate,
  .prive-language-gate__main,
  .prive-language-gate__option {
    transition: none;
  }
}

@media (forced-colors: active) {
  .prive-language-gate,
  .prive-language-switch {
    forced-color-adjust: auto;
    color: CanvasText;
    background: Canvas;
  }

  .prive-language-gate__option,
  .prive-language-switch {
    border-color: CanvasText;
  }

  .prive-language-gate__option[aria-pressed="true"] {
    color: HighlightText;
    background: Highlight;
  }
}
