/* ==========================================
   i18n.css — Aspire Pharmaceuticals
   Devanagari self-hosted font + EN｜हिं toggle pill + no-flash cloak.

   SCOPED TO html[lang="hi"] ONLY. lang="en" is completely unaffected: the
   @font-face blocks define an unused family in EN (no download — browsers
   fetch a face only when a matching glyph is rendered), and every rule below
   is gated on html[lang="hi"]. The toggle pill itself is the sole EN-visible
   element, and it carries no layout/typography impact on page content.
   ========================================== */

/* --- Self-hosted Noto Sans Devanagari (weights 400 / 500 / 700) --- */
@font-face {
    font-family: 'Noto Sans Devanagari';
    src: url('../assets/fonts/NotoSansDevanagari-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Noto Sans Devanagari';
    src: url('../assets/fonts/NotoSansDevanagari-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Noto Sans Devanagari';
    src: url('../assets/fonts/NotoSansDevanagari-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* --- Hindi font stack ---
   Prepend Noto so Devanagari codepoints render in Noto; the woff2 subset has
   NO Latin glyphs, so any remaining Latin (GMP, CIN, mg, &, …) falls through to
   the existing brand fonts. font-SIZE / clamp() are untouched per brief — only
   the family changes. */
html[lang="hi"] body,
html[lang="hi"] body * {
    font-family: 'Noto Sans Devanagari', 'Proxima Nova', 'Space Grotesk', sans-serif;
}

/* --- No-flash-of-English cloak (Hindi only) ---
   The inline <head> snippet sets documentElement.lang from localStorage before
   body paint. While Hindi and not yet translated, hide the body; i18n.js adds
   html.i18n-ready right after the DOM is translated, revealing already-Hindi
   content. A keyframe failsafe reveals after 3s so a JS failure never leaves a
   blank page. EN never matches this selector -> no cloak in English. */
html[lang="hi"]:not(.i18n-ready) body {
    visibility: hidden;
}
html[lang="hi"].i18n-ready body {
    visibility: visible;
}
@keyframes aspire-i18n-failsafe-reveal { to { visibility: visible; } }
html[lang="hi"]:not(.i18n-ready) body {
    animation: aspire-i18n-failsafe-reveal 0s linear 3s forwards;
}

/* --- EN｜हिं language toggle pill ---
   Lives INSIDE the header action row (.header-actions, a flex container).
   order:-1 makes it the first flex item, so it renders left of <nav> on desktop
   (hence left of the Home icon) and left of #hamburger-btn on mobile (where
   <nav> is display:none). Visible only at scrollY===0; .scrolled-away fades it
   out on every device. The .lang-toggle--floating variant (404, no header)
   restores a fixed top-corner placement. */
.lang-toggle {
    order: -1; /* first flex item: left of <nav> (desktop) / left of hamburger (mobile) */
    display: inline-flex;
    align-items: stretch;
    flex-shrink: 0;
    padding: 2px;
    border-radius: 999px;
    background: rgba(0, 20, 58, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 14px rgba(0, 20, 58, 0.25);
    font-family: 'Noto Sans Devanagari', 'Space Grotesk', sans-serif;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    opacity: 1;
    visibility: visible;
}

/* 404 (no .header-actions): keep the original fixed top-corner pill. */
.lang-toggle--floating {
    position: fixed;
    top: 14px;
    left: 16px;
    z-index: 5000;
}

.lang-toggle.scrolled-away {
    /* Lift out of the .header-actions flex flow while hidden so it contributes
       no width AND no flex `gap` — otherwise its empty slot shows as a white gap
       before the Home icon when the pill expands on hover. Fade still applies. */
    position: absolute;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    pointer-events: none;
}

/* Portrait/mobile: the toggle is the first .header-actions item, landing flush
   against the logo's right edge (0px gap) with ~32px to the hamburger. Nudge it
   +16px right to sit midway in that gap (16px each side). A relative shift keeps
   its flow slot, so the hamburger does NOT move. Excluded when .scrolled-away so
   the out-of-flow hide (position:absolute) still wins; excluded on the 404
   --floating variant. */
@media (max-width: 768px), (orientation: portrait), (max-height: 479px) {
    .lang-toggle:not(.lang-toggle--floating):not(.scrolled-away) {
        position: relative;
        left: 16px;
    }
}

.lang-toggle__btn {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.02em;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease;
}

.lang-toggle__btn:hover {
    color: #fff;
}

.lang-toggle__btn[aria-pressed="true"] {
    background: var(--turquoise, #35CBCC);
    color: var(--dark-navy, #00143A);
    font-weight: 700;
    cursor: default;
}

.lang-toggle__sep {
    align-self: center;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.7rem;
    padding: 0 1px;
    user-select: none;
}
