/* ============================================
   威尔丹独立站 - 手机/平板自适应样式
   范围：max-width 1024px（覆盖小屏手机、大屏手机、平板）
   ============================================ */

/* PC 端（≥1025px）：强制隐藏所有 mobile-only 元素 */
@media (min-width: 1025px) {
    .mobile-nav-right,
    .mobile-menu-panel {
        display: none !important;
    }
}

/* ============ 手机 + 平板（≤1024px） ============ */
@media (max-width: 1024px) {
    .navbar .navbar-menu,
    .navbar .menu-toggle {
        display: none !important;
    }

    .navbar {
        position: static !important;  /* 不固定，跟随页面滚动 */
        top: auto !important;
        left: auto !important;
        right: auto !important;
        z-index: auto !important;
        background: var(--bg-cream);
        padding: clamp(8px, 2.2vw, 14px) clamp(10px, 3.5vw, 22px);
        box-shadow: 0 1px 4px rgba(0,0,0,0.04);
        height: auto;
        width: 100%;
        box-sizing: border-box;
    }
    .navbar-container {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: clamp(6px, 2vw, 14px);
        max-width: 100%;
        padding: 0;
        height: auto;
    }
    .navbar-logo {
        display: flex;
        align-items: center;
        gap: clamp(8px, 2.5vw, 14px);
        text-decoration: none;
        flex-shrink: 1;
        min-width: 0;
        overflow: hidden;
    }
    .navbar-logo-icon {
        width: clamp(44px, 12vw, 64px);
        height: clamp(44px, 12vw, 64px);
        background: var(--primary-light);
        color: white;
        font-weight: bold;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: clamp(15px, 4vw, 20px);
        border-radius: 8px;
        flex-shrink: 0;
    }
    .navbar-logo-text { 
        display: flex; 
        flex-direction: column; 
        line-height: 1.2;
        min-width: 0;
        overflow: hidden;
    }
    .navbar-logo-text .zh { 
        font-size: clamp(11px, 3.2vw, 16px);
        font-weight: bold; 
        color: var(--text-dark);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .navbar-logo-text .en { 
        font-size: clamp(7px, 1.8vw, 11px);
        color: var(--text-secondary); 
        letter-spacing: 0.5px;
        text-transform: uppercase;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-nav-right {
        display: flex !important;
        align-items: center;
        gap: clamp(4px, 1.5vw, 10px);
        flex-shrink: 0;
    }
    
    .mobile-lang-switch { position: relative; }
    .mobile-lang-btn {
        background: white;
        border: 1px solid var(--border-light);
        border-radius: 10px;
        padding: clamp(5px, 1.5vw, 9px) clamp(8px, 2.5vw, 14px);
        font-size: clamp(11px, 3.2vw, 15px);
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 4px;
        color: var(--text-secondary);
        min-height: clamp(34px, 9vw, 44px);
        font-family: inherit;
    }
    .mobile-lang-btn .arrow { font-size: clamp(7px, 2vw, 10px); }
    .mobile-lang-menu {
        position: absolute;
        top: calc(100% + 4px); right: 0;
        background: white;
        border: 1px solid var(--border-light);
        border-radius: 8px;
        min-width: clamp(120px, 32vw, 180px);
        box-shadow: 0 4px 16px rgba(0,0,0,0.12);
        display: none;
        z-index: 200;
        overflow: hidden;
    }
    .mobile-lang-switch.active .mobile-lang-menu { display: block; }
    .mobile-lang-option {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: clamp(8px, 2.5vw, 12px) clamp(10px, 3.5vw, 16px);
        background: transparent;
        border: 0;
        border-bottom: 1px solid var(--border-light);
        cursor: pointer;
        font-size: clamp(12px, 3.2vw, 15px);
        color: var(--text-dark);
        font-family: inherit;
    }
    .mobile-lang-option:last-child { border-bottom: 0; }
    .mobile-lang-option.active,
    .mobile-lang-option:hover { background: var(--bg-cream); }
    .mobile-lang-option .lang-code { color: var(--text-light); font-size: clamp(9px, 2.5vw, 12px); }

    .mobile-menu-btn {
        width: clamp(40px, 11vw, 52px);
        height: clamp(34px, 9vw, 44px);
        background: white;
        border: 1px solid var(--border-light);
        border-radius: 10px;
        display: flex; 
        flex-direction: column;
        align-items: center; 
        justify-content: center;
        gap: clamp(3px, 0.8vw, 5px);
        cursor: pointer;
        padding: 0;
    }
    .mobile-menu-btn span {
        display: block;
        width: clamp(16px, 4.5vw, 22px);
        height: 2px;
        background: var(--text-dark);
        border-radius: 2px;
    }

    .mobile-menu-panel {
        display: block !important;
        position: fixed;
        top: clamp(60px, 16vw, 84px); 
        left: 0; right: 0;
        background: white;
        border-bottom: 1px solid var(--border-light);
        box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        z-index: 99;
        padding: 8px 0;
        transform: translateY(-110%);
        transition: transform 0.3s ease, opacity 0.3s ease;
        opacity: 0;
        pointer-events: none;
    }
    .mobile-menu-panel.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
    .mobile-menu-panel a {
        display: block;
        padding: clamp(11px, 3vw, 16px) clamp(18px, 5vw, 28px);
        color: var(--text-dark);
        text-decoration: none;
        font-size: clamp(13px, 3.6vw, 16px);
        border-bottom: 1px solid var(--border-light);
    }
    .mobile-menu-panel a:last-child { border-bottom: 0; }
    .mobile-menu-panel a:hover,
    .mobile-menu-panel a:active { background: var(--bg-cream); }

    .main-content {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .video-section {
        background: var(--bg-cream);
        padding: clamp(12px, 3vw, 20px) clamp(10px, 3vw, 20px);
    }
    .video-container { max-width: 100%; padding: 0; }
    .video-carousel { 
        max-width: 100%;
        position: relative;
    }
    .video-carousel-track {
        position: relative;
        overflow: hidden;
        border-radius: clamp(12px, 3.5vw, 18px);
    }
    .video-carousel-slides {
        position: relative;
        width: 100%;
        aspect-ratio: 16 / 9;
        display: flex !important;          /* flex 子元素并排，配合父容器 translateX 切换 */
        transition: transform 0.5s ease !important;
    }
    .video-carousel-slide {
        position: relative !important;     /* 改回 relative：不再堆叠，按 flex 并排 */
        flex: 0 0 100% !important;
        width: 100% !important;
        height: 100% !important;
        transform: none !important;        /* 清除旧逻辑可能给 slide 自身设的 translate */
    }
    .video-card {
        width: 100% !important;
        height: 100% !important;
        border-radius: clamp(12px, 3.5vw, 18px);
        overflow: hidden;
        background: #000;
    }
    .video-card video,
    .video-card .banner-img,
    .video-card img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block;
    }
    .carousel-arrow {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: clamp(32px, 9vw, 42px) !important;
        height: clamp(32px, 9vw, 42px) !important;
        background: rgba(255,255,255,0.75) !important;
        border: 0;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 5;
        padding: 0;
        color: var(--text-dark);
    }
    .carousel-arrow svg { 
        width: clamp(12px, 3.5vw, 16px); 
        height: clamp(12px, 3.5vw, 16px); 
    }
    .carousel-arrow.prev { left: clamp(6px, 2vw, 12px) !important; }
    .carousel-arrow.next { right: clamp(6px, 2vw, 12px) !important; }
    .carousel-dots { 
        display: flex;
        justify-content: center;
        gap: 8px;
        margin-top: clamp(10px, 2.5vw, 16px);
    }
    .carousel-dot {
        width: clamp(8px, 2vw, 10px);
        height: clamp(8px, 2vw, 10px);
        border-radius: 50%;
        background: rgba(0,0,0,0.2);
        cursor: pointer;
    }
    .carousel-dot.active { background: var(--primary); }

    .category-section {
        padding: clamp(24px, 6vw, 40px) clamp(10px, 3vw, 20px) clamp(20px, 5vw, 32px);
        background: var(--bg-cream);
    }
    .section-title {
        font-size: clamp(18px, 5vw, 26px) !important;
        font-weight: 700;
        text-align: center;
        margin: 0 0 clamp(16px, 4vw, 24px);
        color: var(--text-dark);
    }
    .category-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: clamp(6px, 2vw, 14px) !important;
        max-width: 100%;
    }
    .category-card {
        background: #FBF7F0 !important;
        border-radius: clamp(8px, 2.5vw, 14px) !important;
        padding: clamp(8px, 2.5vw, 16px) clamp(4px, 1.5vw, 10px) !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: clamp(4px, 1.5vw, 10px) !important;
        text-decoration: none !important;
        aspect-ratio: 1 / 1;
        border: 0 !important;
        box-shadow: none !important;
        min-height: 0;
    }
    .category-icon {
        width: clamp(44px, 14vw, 80px) !important;
        height: clamp(44px, 14vw, 80px) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: transparent !important;
        border-radius: 0 !important;
    }
    .category-img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
    }
    .category-name {
        font-size: clamp(10px, 2.8vw, 14px) !important;
        color: var(--text-dark) !important;
        font-weight: 500 !important;
        margin: 0 !important;
        text-align: center;
        line-height: 1.2;
    }

    /* === footer：严格按用户原图，三栏顶对齐、紧凑、不超100~130px === */
    .footer {
        background: var(--primary-light);
        color: white;
        padding: 0;
        position: static !important;  /* 覆盖 PC 端的 fixed */
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        z-index: auto !important;
    }
    .footer-container {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1.4fr) !important;
        gap: clamp(7px, 2.2vw, 14px) !important;
        padding: clamp(5px, 1.5vw, 8px) clamp(9px, 2.6vw, 14px) !important;
        max-width: 100% !important;
        align-items: start !important;  /* 三栏顶部对齐 */
    }
    .footer-brand { display: none !important; }
    .footer-modules { display: contents !important; }
    .footer-modules .footer-module:nth-child(2) {
        /* WhatsApp 隐藏 */
        display: none !important;
    }
    .footer-modules .footer-module {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 3px !important;
        padding: 0;
        margin: 0;
        min-width: 0;
        height: auto;
    }
    .module-label { 
        font-size: clamp(9px, 2.3vw, 11px) !important; 
        color: white !important;
        opacity: 0.95;
        line-height: 1.2;
        margin: 0 !important;
        font-weight: normal;
    }
    .module-value { 
        font-size: clamp(8px, 2vw, 10px) !important; 
        color: white !important;
        word-break: break-all;
        line-height: 1.3;
        margin: 0 !important;
    }
    .qr-placeholder-small {
        width: clamp(34px, 9.5vw, 46px) !important;
        height: clamp(34px, 9.5vw, 46px) !important;
        background: white !important;
        border-radius: 3px !important;
        padding: 2px !important;
        margin: 0 !important;
    }
    .qr-placeholder-small img {
        border-radius: 2px !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: contain;
    }
    .footer-message {
        display: flex !important;
        flex-direction: column;
        gap: 3px !important;
        padding: 0 !important;
        margin: 0;
        text-align: left !important;
        min-width: 0;
        height: auto;
    }
    .message-label { 
        font-size: clamp(9px, 2.3vw, 11px) !important; 
        color: white !important;
        opacity: 0.95;
        line-height: 1.2;
        margin: 0 !important;
        font-weight: normal;
    }
    .message-form {
        display: flex !important;
        flex-direction: row !important;
        gap: 4px !important;
        margin: 0 !important;
        width: 100%;
        max-width: 100%;
    }
    .message-input {
        flex: 1 1 0;
        min-width: 0;
        width: auto !important;
        padding: 0 clamp(5px, 1.5vw, 8px) !important;
        font-size: clamp(9px, 2.2vw, 11px) !important;
        border-radius: 3px !important;
        border: 1px solid rgba(255,255,255,0.5) !important;
        background: white !important;
        height: clamp(19px, 5.2vw, 24px) !important;
        line-height: clamp(19px, 5.2vw, 24px) !important;
        box-sizing: border-box;
        margin: 0 !important;
    }
    .message-btn {
        flex-shrink: 0;
        padding: 0 clamp(7px, 2.2vw, 12px) !important;
        height: clamp(19px, 5.2vw, 24px) !important;
        font-size: clamp(9px, 2.2vw, 11px) !important;
        border-radius: 3px !important;
        background: var(--primary) !important;
        color: white !important;
        border: 0 !important;
        cursor: pointer;
        white-space: nowrap;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 !important;
        line-height: 1;
    }
    .footer-bottom {
        padding: clamp(3px, 1vw, 6px) clamp(9px, 2.6vw, 14px) !important;
        text-align: center;
        border-top: 1px solid rgba(255,255,255,0.2);
        margin: 0 !important;
    }
    .footer-bottom p { 
        font-size: clamp(8px, 2vw, 10px) !important; 
        color: white !important;
        margin: 0 !important;
        padding: 0 !important;
        opacity: 0.85;
        line-height: 1.3;
    }
}

/* 大屏手机/平板（≥600px）：banner 更扁 */
@media (min-width: 600px) and (max-width: 1024px) {
    .video-carousel-slides {
        aspect-ratio: 21 / 9;
        max-height: 50vh;
    }
}


/* ============================================
   首页 "固定屏幕" 布局（仅 body.is-home + 手机/平板生效）
   - 整页填满视口，不滚动
   - navbar / 视频 / 分类 / footer 按 flex 自适应分配空间
   ============================================ */
@media (max-width: 1024px) {
    body.is-home {
        margin: 0 !important;
        padding: 0 !important;
        height: 100vh;
        height: 100dvh;  /* iOS Safari 动态视口高度 */
        overflow: hidden !important;
        display: flex;
        flex-direction: column;
    }
    body.is-home .navbar {
        position: relative !important;
        top: auto !important;
        flex: 0 0 auto;
    }
    body.is-home .main-content {
        flex: 1 1 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding: 0 !important;
        overflow: hidden;
    }
    /* 视频区按比例（不强制 flex 占满，自然高） */
    body.is-home .video-section {
        flex: 0 0 auto;
        padding: clamp(8px, 2.2vw, 14px) clamp(10px, 3vw, 18px) !important;
    }
    body.is-home .video-carousel-slides {
        aspect-ratio: 16 / 9;
        max-height: 30vh;  /* 视频区不超过视口高度 30% */
    }
    body.is-home .carousel-dots {
        margin-top: clamp(6px, 1.5vw, 10px) !important;
    }
    /* 分类区撑满剩余空间 */
    body.is-home .category-section {
        flex: 1 1 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding: clamp(12px, 3vw, 20px) clamp(10px, 3vw, 16px) clamp(10px, 2.5vw, 16px) !important;
        overflow: hidden;
    }
    body.is-home .section-title {
        flex: 0 0 auto;
        margin: 0 0 clamp(10px, 2.5vw, 16px) !important;
    }
    body.is-home .category-grid {
        flex: 1 1 0;
        min-height: 0;
        align-content: start;    /* 卡片紧跟标题顶对齐，避免大空白 */
        justify-content: center;
    }
    body.is-home .category-card {
        aspect-ratio: 1 / 1 !important;   /* 强制正方形 */
        height: auto !important;
        min-height: 0;
    }
    body.is-home .footer {
        position: relative !important;
        flex: 0 0 auto;
    }
}


/* === 2026-05-26 18:10 补丁：图标白底融入 === */
@media (max-width: 992px) {
    .category-img {
        mix-blend-mode: multiply !important;
        background: transparent !important;
    }
    .category-icon {
        background: transparent !important;
    }
}


/* === 2026-05-26 19:20 修复：所有语种统一英文版布局 === */
@media (max-width: 992px) {
    /* 关键修复：section 在中文短字符下会被 flex column 收缩到内容宽度，
       配合 style.css 670 行 .category-section { margin: 0 auto } 居中，
       导致两侧出现 75px 空白。强制 100% 宽 + 0 margin 即可恢复满屏 */
    .category-section,
    body.is-home .category-section {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        align-self: stretch !important;
    }
    .category-grid,
    body.is-home .category-grid {
        width: 100% !important;
    }
    /* 卡片：用 vw fallback 保证老 webview 没 aspect-ratio 也是正方形 */
    .category-card,
    body.is-home .category-card {
        aspect-ratio: 1 / 1 !important;
        min-height: calc((100vw - 60px) / 3) !important;
    }
    /* 文字：限制 2 行，避免过长导致卡片变高 */
    .category-name {
        display: -webkit-box !important;
        -webkit-line-clamp: 3 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        font-size: clamp(11px, 3vw, 14px) !important;
        line-height: 1.25 !important;
        word-break: break-word !important;
    }
}
