/* ============================================================
   全站精修层（polish.css）
   - 保持现有暖白 + 蓝紫渐变风格，只统一排版节奏、卡片质感与交互细节
   - 颜色与圆角全部取自现有主题变量，兼容 light / dark / mecha / paper / neon / mint / pink
   - 加载顺序：style.css → mobile.css → page_css → ui-modal.css → 本文件
   ============================================================ */

:root {
    --pl-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --pl-gap: clamp(16px, 2.4vw, 28px);
    --pl-field-radius: calc(var(--radius) * 0.6);
    --pl-ring: 0 0 0 4px rgba(var(--mk-blue-1-rgb), 0.13);
}

/* ===== 基础排版 ===== */
html {
    scroll-padding-top: 92px;
}
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
img {
    max-width: 100%;
}
a {
    text-underline-offset: 3px;
}
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
    outline: 2px solid rgba(var(--mk-blue-1-rgb), 0.6);
    outline-offset: 2px;
}

/* ===== 布局节奏 ===== */
.container {
    width: 100%;
    padding-inline: clamp(16px, 4vw, 24px);
}
.main-layout {
    gap: var(--pl-gap);
    padding-block: clamp(22px, 3vw, 36px) clamp(42px, 5vw, 64px);
}
.section-head {
    gap: 14px;
    margin-bottom: 24px;
    padding-bottom: 14px;
}
.section-title {
    font-size: clamp(1.28rem, 2vw, 1.55rem);
    letter-spacing: 0.01em;
}
.section-title::after {
    width: 46px;
    height: 3px;
    bottom: -15px;
    opacity: 0.9;
}
.section-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(var(--mk-blue-1-rgb), 0.06);
    font-weight: 600;
}
.section-more:hover {
    background: rgba(var(--mk-blue-1-rgb), 0.12);
    transform: translateX(2px);
}

/* ===== 卡片质感统一 ===== */
.widget,
.user-panel,
.auth-card,
.article-detail,
.product-card,
.ticket-card,
.site-card,
.gb-card,
.mb-card,
.moment-panel,
.sc-panel,
.toc-panel,
.announce-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.widget,
.user-panel,
.article-detail,
.product-card,
.site-card,
.gb-card,
.moment-panel {
    box-shadow: var(--shadow);
}
.article-detail {
    padding: clamp(22px, 4vw, 46px);
    font-size: 1.02rem;
    line-height: 1.95;
}
.article-detail h1 {
    font-size: clamp(1.5rem, 3vw, 2.05rem);
    line-height: 1.4;
    letter-spacing: 0.01em;
}
.article-detail h2 {
    margin-top: 1.5em;
    margin-bottom: 0.65em;
}
.article-detail h3 {
    margin-top: 1.25em;
    margin-bottom: 0.55em;
}
.user-panel {
    padding: clamp(18px, 2.6vw, 28px);
}
.user-panel-head h2 {
    font-size: 1.16rem;
    letter-spacing: 0.01em;
}
.widget {
    padding: clamp(18px, 2.4vw, 26px);
}
.widget-title {
    font-size: 1.02rem;
    letter-spacing: 0.01em;
    padding-bottom: 14px;
}
.widget-title i {
    filter: drop-shadow(0 2px 8px rgba(var(--mk-blue-1-rgb), 0.25));
}

/* 可点击卡片：统一轻微悬浮反馈 */
@media (hover: hover) and (pointer: fine) {
    .product-card:hover,
    .site-card:hover,
    .tool-card:hover,
    .gallery-item:hover,
    .moment-card:hover,
    .life-moment:hover,
    .widget:hover {
        transform: translateY(-3px);
        box-shadow: 0 18px 42px rgba(var(--mk-blue-2-rgb), 0.16),
            0 4px 12px rgba(var(--mk-blue-1-rgb), 0.07);
    }
}

/* ===== 按钮 ===== */
.btn {
    line-height: 1.2;
    letter-spacing: 0.015em;
}
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== 表单：统一高度与聚焦反馈 ===== */
:is(.auth-form, .user-form, .gb-form, .gb-reply-form, .comment-form,
    .exchange-form, .lock-form, .love-bless-form, .ticket-form, .fl-form)
    :is(input[type="text"], input[type="email"], input[type="password"],
    input[type="url"], input[type="tel"], input[type="number"], input[type="search"], textarea, select) {
    border: 1px solid var(--border);
    border-radius: var(--pl-field-radius);
    padding: 11px 14px;
    min-height: 44px;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}
:is(.auth-form, .user-form, .gb-form, .gb-reply-form, .comment-form,
    .exchange-form, .lock-form, .love-bless-form, .ticket-form, .fl-form)
    :is(input, textarea, select):focus {
    border-color: var(--primary);
    box-shadow: var(--pl-ring);
    outline: none;
}
:is(.auth-form, .user-form, .gb-form, .comment-form, .fl-form) textarea {
    min-height: 108px;
    line-height: 1.75;
}

/* ===== 分页 ===== */
.pagination {
    gap: 8px;
    margin-top: clamp(24px, 3vw, 36px);
}
.page-btn {
    width: 40px;
    height: 40px;
    border-radius: calc(var(--radius) * 0.68);
    border: 1px solid var(--border);
    box-shadow: none;
    font-weight: 600;
}
.page-btn:hover {
    transform: translateY(-2px);
}

/* ===== 空状态 ===== */
.empty-state {
    padding: clamp(36px, 6vw, 56px) 20px;
}
.empty-state i {
    margin-bottom: 14px;
}
.empty-state p {
    font-size: 0.94rem;
}

/* ===== 侧栏导航 / 子菜单 ===== */
.navbar .nav-menu .sub-menu {
    border-radius: calc(var(--radius) * 0.75);
    padding: 8px;
}
.navbar .nav-menu .sub-menu a {
    border-radius: calc(var(--radius) * 0.5);
    padding: 9px 12px;
}

/* ===== 页脚 ===== */
.footer {
    padding: clamp(48px, 6vw, 70px) clamp(16px, 4vw, 24px) 24px;
}
.footer-main {
    gap: clamp(26px, 4vw, 44px);
}
.footer-col h4 {
    letter-spacing: 0.02em;
}
.footer-social a {
    width: 40px;
    height: 40px;
}
.footer-list {
    gap: 12px;
}

/* ============================================================
   移动端精修（<= 820px）
   ============================================================ */
@media screen and (max-width: 820px) {
    html {
        scroll-padding-top: 74px;
    }
    .container {
        padding-inline: 14px;
    }
    .main-layout {
        gap: 18px;
        padding-block: 16px 40px;
    }
    .section-head {
        gap: 10px;
        margin-bottom: 18px;
        padding-bottom: 10px;
    }
    .section-title {
        font-size: 1.24rem;
    }
    .section-title::after {
        width: 38px;
        bottom: -12px;
    }
    .article-detail {
        padding: 20px 16px;
        font-size: 0.98rem;
        line-height: 1.9;
    }
    .article-body {
        padding: 18px;
    }
    .user-panel {
        padding: 18px 16px;
    }
    .widget {
        padding: 18px 16px;
    }
    .auth-card {
        padding: 30px 20px 26px;
    }
    .page-btn {
        width: 38px;
        height: 38px;
    }
    .btn {
        min-height: 44px;
    }

    /* 防止 iOS 聚焦输入框时自动放大 */
    :is(.auth-form, .user-form, .gb-form, .gb-reply-form, .comment-form,
        .exchange-form, .lock-form, .love-bless-form, .ticket-form, .fl-form)
        :is(input[type="text"], input[type="email"], input[type="password"],
        input[type="url"], input[type="tel"], input[type="number"], input[type="search"], textarea, select) {
        font-size: 16px;
    }

    /* 首页 Hero 按钮不换行 */
    .hero-buttons .btn {
        white-space: nowrap;
        padding-inline: 14px;
    }
    /* 分类标签横向滚动，避免被裁切 */
    .article-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }
    .article-tabs::-webkit-scrollbar {
        display: none;
    }
    .article-tab {
        flex: 0 0 auto;
    }

    /* 页脚：两列导航 + 联系卡整行，并预留底部 tabbar 高度 */
    .footer {
        padding: 38px 16px calc(104px + env(safe-area-inset-bottom));
    }
    .footer-main {
        grid-template-columns: 1fr 1fr;
        gap: 22px 18px;
    }
    .footer-about {
        grid-column: 1 / -1;
    }
    .footer-contact {
        grid-column: 1 / -1;
    }
    /* 导航两列做成轻卡片，平衡高度差 */
    .footer-col:not(.footer-about):not(.footer-contact) {
        padding: 14px 14px 16px;
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.09);
        background: rgba(255, 255, 255, 0.05);
    }
    /* 二维码缺失时，联系信息两列铺满，避免右侧空洞 */
    .footer-contact.no-qr .footer-contact-info {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 16px;
    }
    .footer-contact.no-qr .footer-contact-info p {
        margin-bottom: 0;
    }
    .footer-col h4 {
        margin-bottom: 12px;
    }
    .footer-list {
        gap: 7px;
    }
    .footer-list a {
        line-height: 1.55;
    }
    .footer-desc {
        margin-bottom: 14px;
    }
    .footer-friends {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .footer-friends-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 8px;
    }
    .footer-friend {
        width: 100%;
        justify-content: flex-start;
    }
    /* 悬浮按钮让开底部 tabbar */
    .back-to-top {
        display: none !important;
    }
    .side-fab {
        bottom: calc(92px + env(safe-area-inset-bottom));
    }
}

@media screen and (max-width: 640px) {
    /* 文章元信息改为两列栅格，避免“评论”单独掉行 */
    .article-meta {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px 10px;
    }
    .article-meta > span {
        min-width: 0;
    }
    .hero-buttons .btn {
        font-size: 0.84rem;
        padding-inline: 10px;
    }
}

@media screen and (max-width: 480px) {
    .section-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .footer-main {
        gap: 20px 14px;
    }
    .footer-social {
        gap: 8px;
    }
    .footer-stats {
        gap: 6px;
    }
    .footer-stats span {
        padding: 7px 2px;
        font-size: 0.66rem;
        white-space: nowrap;
    }
    .hero-buttons .btn {
        font-size: 0.82rem;
        padding-inline: 8px;
    }
}

/* 触摸设备不保留悬浮位移，避免点击后卡片"抖动" */
@media (hover: none) {
    .product-card:hover,
    .site-card:hover,
    .tool-card:hover,
    .gallery-item:hover,
    .moment-card:hover,
    .life-moment:hover,
    .widget:hover {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    .product-card:hover,
    .site-card:hover,
    .tool-card:hover,
    .gallery-item:hover,
    .moment-card:hover,
    .life-moment:hover,
    .widget:hover,
    .page-btn:hover,
    .section-more:hover {
        transform: none;
    }
}
