/* ==========================================================================
   站点 i18n：语言切换器 / 防闪烁 / 字体回退
   与 wolverineworldwide.com 设计令牌一致（#010101 + ABCDiatype）
   ========================================================================== */

/* 已保存非英文语言时，避免先闪现英文再切换 */
html[data-i18n-pending] body {
    visibility: hidden;
}

/* --------------------------------------------------------------------------
   语言切换器（固定左下）
   -------------------------------------------------------------------------- */
.ww-lang {
    position: fixed;
    inset-inline-start: 20px;
    inset-block-end: 20px;
    z-index: 900; /* 高于注册弹窗 800：弹窗打开时也要能切换语言 */
    font-family: var(--font-sans, "ABCDiatype", system-ui, sans-serif);
    font-size: 12px;
    line-height: 1;
}

.ww-lang_btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 14px;
    color: #fff;
    background: rgba(1, 1, 1, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}

.ww-lang_btn:hover,
.ww-lang_btn:focus-visible {
    background: #010101;
    border-color: rgba(255, 255, 255, 0.42);
    outline: none;
}

.ww-lang_globe svg {
    display: block;
    width: 15px;
    height: 15px;
}

.ww-lang_label {
    font-weight: 500;
    letter-spacing: 0.01em;
}

.ww-lang_chevron svg {
    display: block;
    width: 9px;
    height: 6px;
    opacity: 0.65;
    transition: transform 0.2s ease;
}

.ww-lang.is-open .ww-lang_chevron svg {
    transform: rotate(180deg);
}

.ww-lang_list {
    position: absolute;
    inset-inline-start: 0;
    bottom: calc(100% + 10px);
    width: 214px;
    max-height: min(60vh, 420px);
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #0b0b0b;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
}

.ww-lang_list[hidden] {
    display: none;
}

.ww-lang_option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    color: #d8d8d8;
    text-align: start;
    background: transparent;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    font: inherit;
}

.ww-lang_option:hover,
.ww-lang_option:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.ww-lang_option.is-active {
    color: #010101;
    background: #fff;
}

.ww-lang_code {
    font-family: var(--font-mono, "ABCDiatype-Mono", ui-monospace, monospace);
    font-size: 9.5px;
    letter-spacing: 0.1em;
    opacity: 0.55;
}

.ww-lang_option.is-active .ww-lang_code {
    opacity: 0.7;
}

/* 移动端：避让 cookie 条与底部安全区 */
@media (max-width: 639px) {
    .ww-lang {
        inset-inline-start: 12px;
        inset-block-end: max(12px, env(safe-area-inset-bottom));
    }

    .ww-lang_btn {
        padding: 9px 12px;
    }

    .ww-lang_list {
        width: min(72vw, 214px);
    }
}

/* --------------------------------------------------------------------------
   字体回退：ABCDiatype 不覆盖中日韩/西里尔
   -------------------------------------------------------------------------- */
html[lang="ja"] {
    --font-sans: "ABCDiatype", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", "Meiryo", sans-serif;
    --font-mono: "ABCDiatype-Mono", "Hiragino Sans", "Noto Sans JP", monospace;
}

html[lang="ko"] {
    --font-sans: "ABCDiatype", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
    --font-mono: "ABCDiatype-Mono", "Malgun Gothic", "Noto Sans KR", monospace;
}

html[lang="ja"] body,
html[lang="ko"] body {
    line-height: 1.75;
}

@media (prefers-reduced-motion: reduce) {
    .ww-lang_chevron svg,
    .ww-lang_btn {
        transition-duration: 0.01ms !important;
    }
}
