/* Header / top bar — mobile & tablet (<1024px); desktop unchanged in styles.css */

@media (max-width: 1023px) {
    html {
        scroll-padding-top: 80px;
    }

    .top-tips .container {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px 16px;
        padding: 6px 12px;
    }

    .top-tips-text {
        text-align: center;
        font-size: 12px;
        line-height: 1.4;
        flex: 1 1 100%;
    }

    .top-tips-lang {
        font-size: 13px;
    }

    .top-tips .top-tips-lang-desktop {
        display: none !important;
    }

    /* 吸顶条叠在正文之上；打开菜单时再抬高，避免被内页正文层盖住 */
    .header {
        z-index: 100;
    }

    .header.nav-open {
        z-index: 10050;
    }

    /* 紧随 header 的首个区块单独成层，避免子元素层叠与吸顶条错乱 */
    .header + section {
        position: relative;
        z-index: 0;
    }

    /* min-width:0 防止 flex 子项把整行撑出视口。
       勿对 .header-inner 设 overflow:hidden：会裁掉子级 #main-nav 侧栏（内页常见「只有遮罩无菜单」） */
    .header-inner {
        height: auto;
        min-height: 56px;
        min-width: 0;
        max-width: 100%;
        width: 100%;
        padding: 8px 12px;
        flex-wrap: nowrap;
        align-items: center;
        gap: 12px;
        position: relative;
        overflow: visible;
    }

    .logo-wrap {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
    }
    .about {
        padding: 20px 0;
    }

    .about-text p {
        padding-left: 30px;
        padding-bottom: 0;
        margin-bottom: 10px;
        line-height: 0.8;
    }

    .logo-link {
        max-width: 100%;
    }

    .logo-circle {
        height: auto;
        min-height: 48px;
        max-width: 100%;
        justify-content: flex-start;
    }

    .news-card-title{
        font-weight: 400;
    }


    .footer-logo-text {
        font-size: 17px;
        font-weight: 600;
        color: #333;
    }


    .logo-circle img {
        height: auto;
        max-height: 70px;
        width: auto;
        max-width: 100%;
        object-fit: contain;
        object-position: left center;
    }

    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        margin-left: auto;
        padding: 0;
        border: none;
        border-radius: 8px;
        background: #FFFBEB;
        color: #4A3728;
        cursor: pointer;
        flex-shrink: 0;
        position: relative;
        z-index: 10002;
        -webkit-tap-highlight-color: transparent;
    }

    .nav-toggle:focus-visible {
        outline: 2px solid #D4AF37;
        outline-offset: 2px;
    }

    .nav-toggle-bar {
        display: block;
        width: 22px;
        height: 2px;
        background: currentColor;
        border-radius: 1px;
        transition: transform 0.2s, opacity 0.2s;
    }

    .header.nav-open .nav-toggle-bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .header.nav-open .nav-toggle-bar:nth-child(2) {
        opacity: 0;
    }

    .header.nav-open .nav-toggle-bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 10000;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s;
    }

    .header.nav-open .nav-overlay {
        opacity: 1;
        visibility: visible;
    }

    /* fixed 抽屉：max-width 用 100vw 而非 100%，避免相对错误包含块撑宽页面；长文案不撑开宽度 */
    #main-nav.nav,
    .nav#main-nav {
        display: flex !important;
        position: fixed;
        top: 0;
        left: auto;
        right: 0;
        bottom: auto;
        width: min(88vw, 320px);
        max-width: min(100vw, 320px);
        min-width: 0;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        padding: max(12px, env(safe-area-inset-top, 0px)) 0 24px;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        box-sizing: border-box;
        background: #fff;
        box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
        z-index: 10001;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        word-wrap: break-word;
        overflow-wrap: anywhere;
        transform: translateX(100%);
        transition: transform 0.28s ease;
    }

    /* 必须带 #main-nav，否则优先级低于上一段 #main-nav.nav，菜单永远无法滑出 */
    .header.nav-open #main-nav.nav {
        transform: translateX(0);
    }

    .nav-lang-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 14px 18px 16px;
        margin: 0 0 4px;
        font-size: 15px;
        color: #666;
        border-bottom: 1px solid #f0e6d4;
        flex-shrink: 0;
    }

    .nav-lang-mobile a {
        color: #666;
        text-decoration: none;
        padding: 4px 8px;
    }

    .nav-lang-mobile a:hover,
    .nav-lang-mobile .lang-active {
        color: #D4AF37;
    }

    .nav-lang-sep {
        color: #999;
        user-select: none;
    }

    .nav-item {
        height: auto;
        flex-direction: column;
        align-items: stretch;
        border-bottom: 1px solid #f0e6d4;
    }

    .nav-item:last-child {
        border-bottom: none;
    }

    .nav-item a,
    .nav-item .nav-no-link {
        padding: 14px 18px;
        font-size: 16px;
        height: auto;
        min-height: 48px;
        justify-content: flex-start;
    }

    .nav-item.has-dropdown .dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        min-width: auto;
        padding: 0 0 8px;
        border-top: none;
        box-shadow: none;
        background: #FFFBEB;
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .nav-item.has-dropdown:hover .dropdown {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .dropdown a {
        padding: 10px 18px 10px 28px;
        font-size: 15px;
        white-space: normal;
    }

    /* 覆盖 CMS/内联里对 ul 的 flex，保证 logo 列表始终两列 */
    ul.logolist {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 12px;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    ul.logolist > li {
        flex: 0 0 calc((100% - 12px) / 2) !important;
        max-width: calc((100% - 12px) / 2) !important;
        min-width: 0;
        box-sizing: border-box;
        margin-bottom: 20px;
    }

    .media {
        max-width: 100vw;
        overflow-x: hidden;
    }

    .content-wrap {
        padding: 20px;
    }

    /* 文章详情 show.html：移动端排版（宽图仍走 styles 里 .entry-content 规则，勿用 width:100% 强压） */
    .page-content-detail .breadcrumb {
        font-size: 13px;
        line-height: 1.5;
        word-break: break-word;
        margin-bottom: 16px;
    }

    .detail-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .detail-wrap {
        padding: 20px 16px;
        min-width: 0;
    }

    .detail-title {
        font-size: clamp(18px, 5vw, 22px);
        margin-bottom: 12px;
    }

    .detail-meta {
        margin-bottom: 16px;
        padding-bottom: 12px;
        font-size: 13px;
    }

    .detail-body.entry-content {
        font-size: 15px;
    }

    .detail-sidebar {
        position: static;
        top: auto;
        padding: 16px;
    }

    .detail-nav {
        margin-top: 20px;
        padding-top: 16px;
    }

    .detail-nav .content-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .detail-nav .content-prev,
    .detail-nav .content-next {
        display: block;
        word-break: break-word;
        line-height: 1.45;
    }

    .detail-back {
        display: block;
        margin-top: 12px;
        padding: 12px 16px;
        background: #FFFBEB;
        border-radius: 8px;
        text-align: center;
        box-sizing: border-box;
    }

    .detail-sidebar .sidebar-list li {
        padding: 10px 0;
    }

    .allow_visitor {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .allow_visitor .layui-btn {
        width: 100%;
        box-sizing: border-box;
    }
}

@media (min-width: 1024px) {
    .nav-toggle,
    .nav-overlay {
        display: none !important;
    }

    .nav-lang-mobile {
        display: none !important;
    }
}

/* 正文图片全屏预览（仅 ≤1023px 由 entry-content-lightbox.js 打开；样式全局以便浮层盖住整页） */
.entry-img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 200000;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: 100dvh;
    touch-action: none;
}

.entry-img-lightbox__close {
    position: absolute;
    top: max(8px, env(safe-area-inset-top, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    z-index: 200002;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.entry-img-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
}

.entry-img-lightbox__stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 200001;
    touch-action: none;
}

.entry-img-lightbox__inner {
    will-change: transform;
    transform-origin: center center;
}

.entry-img-lightbox__inner img {
    max-width: none;
    width: auto;
    height: auto;
    max-height: none;
    display: block;
    vertical-align: middle;
    -webkit-user-drag: none;
    user-select: none;
}

@media (max-width: 1023px) {
    .entry-content img {
        -webkit-tap-highlight-color: transparent;
    }
}
