/* ============================================================================
   FINMENTOR — lang.css
   Multilingual layer: premium language entry gate (root) + switcher helpers.
   Built entirely on the frozen design-token system; style.css is untouched.
   ========================================================================== */
/*
  FINMENTOR — proprietary website content and implementation.
  © 2026 FINMENTOR / Ghennadi Iacovlev. All rights reserved.
  Unauthorized copying, redistribution or commercial reuse is prohibited.
  Contact: cfo@finmentor.md
*/

/* ------------------------------------------------------------- ENTRY GATE */
.lang-gate {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-intro) + 1);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  padding-top: max(var(--sp-6), env(safe-area-inset-top));
  padding-bottom: max(var(--sp-6), env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 42%, var(--fm-navy-700) 0%, var(--navy-900) 55%, var(--black) 100%);
  opacity: 1;
  transition: opacity 0.55s var(--ease-inout), visibility 0.55s var(--ease-inout);
}

/* Shown pre-paint by the inline head guard; intro stays unrendered (its CSS
   animations therefore start only after the visitor's choice). */
html.lang-gate-pending .lang-gate { display: flex; }
html.lang-gate-pending .intro { display: none; }
html.lang-gate-pending body { overflow: hidden; }

.lang-gate.is-leaving { opacity: 0; visibility: hidden; pointer-events: none; }

.lang-gate__inner {
  position: relative;
  text-align: center;
  max-width: 640px;
  width: 100%;
}

.lang-gate__wordmark { display: flex; justify-content: center; line-height: 0; }
.lang-gate__wordmark .logo__mark { display: block; height: clamp(40px, 9vw, 64px); width: auto; }

.lang-gate__rule {
  width: 56px;
  height: 1px;
  margin: var(--sp-5) auto;
  background: linear-gradient(90deg, transparent, var(--gold-500), transparent);
}

.lang-gate__label {
  font-family: var(--font-mono);
  font-size: clamp(0.68rem, 1.5vw, 0.8rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--sp-6);
}

.lang-gate__choices {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: var(--sp-4);
}

.lang-gate__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 218px;
  padding: 18px 30px;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--dur-base) ease, color var(--dur-base) ease,
              background-color var(--dur-base) ease, transform var(--dur-base) ease;
}
.lang-gate__btn:hover,
.lang-gate__btn:focus-visible {
  border-color: var(--border-gold);
  color: var(--accent-bright);
  background: rgba(213, 155, 43, 0.06);
  transform: translateY(-1px);
}
.lang-gate__btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

.lang-gate__note {
  margin-top: var(--sp-6);
  font-size: 0.8rem;
  color: var(--text-muted);
}

@media (max-width: 560px) {
  .lang-gate__choices { flex-direction: column; align-items: stretch; }
  .lang-gate__btn { width: 100%; min-width: 0; padding: 16px 20px; }
}

/* ------------------------------------------------------- SWITCHER HELPERS */
/* .lang / .lang__btn components already exist in the frozen style.css.
   Below: placement-only helpers for the doc-bar and the mobile drawer. */

.doc-bar__nav .lang { flex-shrink: 0; }

.mobile-menu__lang {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 10px 2px 0;
  border-top: 1px solid var(--border-hairline);
  margin-top: var(--sp-4);
}
.mobile-menu__lang-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Placement helpers for non-doc headers */
.legal-bar__right { display: flex; align-items: center; gap: var(--sp-4); }
/* THE SWITCHER STAYS ON A PHONE.
   These two bars previously did `display: none` here. Unlike `.header`, neither carries a burger
   and neither opens a drawer, so below 640px the rule did not move the language control anywhere —
   it removed it. A Russian customer on the X-Ray questionnaire, the page the whole funnel points
   at, had no way to reach the Romanian edition, and vice versa; the legal pages had the same hole.
   The pill is kept and compacted instead, which is what the row actually needed. */
@media (max-width: 640px) {
  .q-bar__row { gap: var(--sp-3); }
  .q-bar .lang,
  .legal-bar .lang { padding: 2px; flex-shrink: 0; }
  .q-bar .lang__btn,
  .legal-bar .lang__btn { padding: 4px 8px; font-size: 0.66rem; }
  .q-back { font-size: 0.82rem; white-space: nowrap; }
}

/* Reduced motion: the gate remains a static choice, transitions become instant */
@media (prefers-reduced-motion: reduce) {
  .lang-gate { transition: none; }
  .lang-gate__btn { transition: none; }
}

/* ---------------------------------------------------------------------------
   Desktop header fit with the RU|RO switcher (typography adaptation only).
   The language pill added in the multilingual pass lengthens the header row;
   RO labels lengthen it further. Between 1025px and 1500px the row gets
   slightly tighter type so nothing clips. No layout or visual redesign.
   -------------------------------------------------------------------------- */
@media (min-width: 1025px) and (max-width: 1560px) {
  .header__inner { gap: var(--sp-4); }
  .header .nav { gap: var(--sp-4); }
  .header .nav__link { font-size: 0.85rem; letter-spacing: -0.005em; }
  .header__actions { gap: var(--sp-3); }
  .header__cta { --btn-px: 14px; font-size: 0.82rem; white-space: nowrap; }
}
@media (min-width: 1025px) and (max-width: 1280px) {
  .header .nav { gap: var(--sp-3); }
  .header .nav__link { font-size: 0.8rem; }
  .header__cta { --btn-px: 12px; font-size: 0.78rem; }
}
@media (min-width: 1025px) and (max-width: 1151px) {
  .header__inner { gap: 10px; }
  .header .nav { gap: 8px; }
  .header .nav__link { font-size: 0.72rem; }
  .header__actions { gap: 8px; }
  .header__cta { --btn-px: 9px; font-size: 0.72rem; }
  .header .lang__btn { padding: 5px 8px; font-size: 0.66rem; }
}

/* Homepage accessibility: improve small note contrast on light/dark surfaces. */
.sample-note { color: var(--text-secondary) !important; }
