/* Explain: Styles for language switcher and Chinese typography. */
/* Bilingual proof of concept — language switch, Chinese typography and test panel */

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    flex: none;
    white-space: nowrap;
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2.5rem;
    min-height: 2.75rem;
    padding: 0;
    border: 0;
    border-bottom: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
    word-break: keep-all;
    cursor: pointer;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.lang-btn:hover { color: var(--secondary-hover); }

.lang-btn.is-active {
    color: var(--secondary-hover);
    border-bottom-color: var(--secondary-color);
}

.lang-sep {
    color: var(--border-color);
    font-size: 0.75rem;
    line-height: 1;
    flex: none;
    width: 0.5rem;
    text-align: center;
}

/* Narrow-viewport header fit: keep EN | 繁中 horizontal and prevent overflow */
@media (max-width: 420px) {
    .lang-switch { gap: 0.05rem; }

    .lang-btn {
        width: 2.25rem;
        letter-spacing: 0.08em;
    }

    header .wordmark {
        font-size: 1.15rem;
        letter-spacing: 0.2em;
    }
}

@media (max-width: 340px) {
    header .wordmark {
        font-size: 1.05rem;
        letter-spacing: 0.14em;
    }
}

/* Traditional Chinese typography */
html[data-lang="zh-HK"] body {
    font-family: var(--font-body-zh);
}

html[data-lang="zh-HK"] h1,
html[data-lang="zh-HK"] h2,
html[data-lang="zh-HK"] h3,
html[data-lang="zh-HK"] h4 {
    font-family: var(--font-heading-zh);
}

html[data-lang="zh-HK"] .eyebrow,
html[data-lang="zh-HK"] .nav-link,
html[data-lang="zh-HK"] .mobile-link,
html[data-lang="zh-HK"] .product-cat,
html[data-lang="zh-HK"] .footer-head,
html[data-lang="zh-HK"] .lang-btn {
    letter-spacing: 0.06em;
}

/* Language content toggle for rich text descriptions */
html[data-lang="zh-HK"] [data-lang-content="en"] {
    display: none !important;
}
html:not([data-lang="zh-HK"]) [data-lang-content="zh-HK"] {
    display: none !important;
}

/* Prevent a flash of the default-language content on first paint.
   The early bootstrap in global/head.html adds .i18n-pending to <html> when the
   saved preference is zh-HK; js/i18n.js removes it the moment the initial
   translation is applied. visibility (not display) keeps the elements in flow,
   so there is no layout shift, and because the class is never added when
   JavaScript is unavailable, content stays visible without it. */
html.i18n-pending [data-i18n],
html.i18n-pending [data-i18n-en],
html.i18n-pending [data-i18n-zh],
html.i18n-pending [data-i18n-alt-en],
html.i18n-pending [data-i18n-alt-zh],
html.i18n-pending [data-i18n-aria],
html.i18n-pending [data-i18n-aria-en],
html.i18n-pending [data-i18n-aria-zh],
html.i18n-pending [data-i18n-placeholder] {
    visibility: hidden;
}