/* ============================================================
   知循教育 - 移动端响应式CSS (Responsive Mobile CSS)
   适用于所有页面: index.html, landing.html, news.html, pricing.html
   ============================================================ */

/* === CSS Custom Properties (移动端覆盖) === */
:root {
    /* 触摸友好的最小点击区域 */
    --touch-target-min: 44px;
    /* 安全区域(适配刘海屏) */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    /* 字体缩放 */
    --font-scale-mobile: 0.92;
}

/* === 全局移动端基础 === */
@media (max-width: 768px) {
    html {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        touch-action: manipulation;
    }

    body {
        font-size: calc(16px * var(--font-scale-mobile, 0.92));
        padding-top: 60px; /* 为固定导航栏留空间 */
        -webkit-tap-highlight-color: transparent;
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }

    /* 防止iOS橡皮筋效果导致的意外导航 */
    body.modal-open {
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    /* 安全区域适配 */
    .navbar {
        padding-top: var(--safe-top);
    }

    .footer {
        padding-bottom: var(--safe-bottom);
    }

    /* 表单元素放大(避免iOS自动缩放) */
    input, textarea, select, button {
        font-size: 16px !important;
    }
}

/* ===== 平板设备 (768px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    .section {
        padding: 60px 32px;
    }

    .navbar-inner {
        padding: 0 32px;
    }

    .hero {
        min-height: 500px;
        padding: 120px 32px 80px;
    }

    .hero h1 {
        font-size: 40px;
    }

    /* 三列变两列 */
    .service-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .expert-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .geo-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .footer-main {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}

/* ===== 手机设备 (≤768px) ===== */
@media (max-width: 768px) {
    /* --- 导航栏 --- */
    .navbar {
        height: auto;
        min-height: 56px;
    }

    .navbar-inner {
        height: 56px;
        padding: 0 16px;
    }

    .navbar-brand img {
        width: 60px;
        max-height: 48px;
    }

    .navbar-brand span {
        font-size: 17px;
    }

    .btn-login {
        padding: 6px 14px;
        font-size: 13px;
    }

    /* 汉堡菜单 */
    .navbar-toggle {
        display: flex;
        padding: 8px;
        min-width: var(--touch-target-min);
        min-height: var(--touch-target-min);
    }

    .navbar-menu {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(10, 14, 23, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 0;
        padding: 20px 0;
        z-index: 999;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        opacity: 0;
        transform: translateY(-10px);
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    .navbar-menu.show {
        display: flex;
        opacity: 1;
        transform: translateY(0);
    }

    .navbar-menu li {
        width: 100%;
        text-align: center;
    }

    .navbar-menu a {
        display: block;
        padding: 16px 24px;
        font-size: 17px;
        min-height: var(--touch-target-min);
        line-height: calc(var(--touch-target-min) - 32px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        transition: background 0.2s;
    }

    .navbar-menu a:active {
        background: rgba(212, 168, 83, 0.1);
    }

    .navbar-menu a.active::after {
        display: none;
    }

    /* --- Hero区域 --- */
    .hero {
        min-height: auto;
        padding: 80px 16px 60px;
    }

    .hero-badge {
        font-size: 13px;
        padding: 6px 18px;
        margin-bottom: 20px;
        letter-spacing: 2px;
    }

    .hero h1 {
        font-size: 26px;
        line-height: 1.4;
        margin-bottom: 12px;
    }

    .hero-subtitle {
        font-size: 15px;
        margin-bottom: 8px;
    }

    .hero-geo {
        font-size: 13px;
        margin-bottom: 24px;
        letter-spacing: 1px;
    }

    .hero-tags {
        gap: 8px;
        margin-bottom: 32px;
    }

    .hero-tag {
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 6px;
    }

    .hero-cta {
        padding: 14px 28px;
        font-size: 16px;
        display: block;
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
        text-align: center;
    }

    /* --- 统计数据栏 --- */
    .stats-bar {
        gap: 16px;
        padding: 32px 16px;
        flex-wrap: wrap;
        justify-content: space-around;
    }

    .stat-item {
        flex: 1 1 40%;
        min-width: 120px;
    }

    .stat-number {
        font-size: 28px;
    }

    .stat-label {
        font-size: 13px;
        margin-top: 6px;
    }

    /* --- Section通用 --- */
    .section {
        padding: 48px 16px;
    }

    .section-title {
        font-size: 24px;
    }

    .section-subtitle {
        font-size: 14px;
        margin-bottom: 32px;
    }

    /* --- 关于我们 --- */
    .about-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .about-text h3 {
        font-size: 20px;
    }

    .about-text p {
        font-size: 15px;
    }

    .about-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .about-stat-card {
        padding: 20px 12px;
    }

    .about-stat-card .num {
        font-size: 28px;
    }

    .about-stat-card .label {
        font-size: 12px;
    }

    /* --- 优势卡片 --- */
    .adv-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .adv-card {
        padding: 24px;
    }

    .adv-card h3 {
        font-size: 18px;
    }

    .adv-card p {
        font-size: 14px;
    }

    /* --- 服务卡片 --- */
    .service-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .service-col {
        padding: 24px;
    }

    .service-col h3 {
        font-size: 18px;
    }

    .service-list li {
        font-size: 14px;
        padding: 8px 0;
    }

    /* --- 专家团队 --- */
    .expert-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .expert-card {
        padding: 24px;
    }

    .expert-avatar {
        width: 100px;
        height: 100px;
        font-size: 36px;
    }

    /* --- 城市卡片 --- */
    .geo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 32px 16px;
    }

    .geo-card {
        padding: 20px 12px;
    }

    .geo-card .city {
        font-size: 17px;
    }

    .geo-card .desc {
        font-size: 12px;
    }

    /* --- 资讯卡片 --- */
    .news-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .news-card {
        padding: 20px;
    }

    .news-card h4 {
        font-size: 15px;
    }

    /* --- FAQ --- */
    .faq-item {
        padding: 20px;
    }

    .faq-item h3 {
        font-size: 16px;
    }

    .faq-item p {
        font-size: 14px;
    }

    /* --- Footer --- */
    .footer-main {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 40px 16px 32px;
    }

    .footer-col h4 {
        font-size: 15px;
        margin-bottom: 14px;
    }

    .footer-brand p,
    .footer-links a,
    .footer-contact p {
        font-size: 13px;
    }

    .footer-bottom {
        font-size: 12px;
        padding: 16px;
    }
}

/* ===== 小屏手机 (≤375px) ===== */
@media (max-width: 375px) {
    .hero h1 {
        font-size: 22px;
    }

    .hero-tag {
        font-size: 12px;
        padding: 6px 10px;
    }

    .stats-bar {
        gap: 10px;
    }

    .stat-number {
        font-size: 24px;
    }

    .stat-item {
        flex: 1 1 45%;
    }

    .section-title {
        font-size: 21px;
    }

    .about-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .geo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .navbar-inner {
        padding: 0 12px;
    }
}

/* ===== 大屏手机 / 折叠屏 (376px - 430px) ===== */
@media (min-width: 376px) and (max-width: 430px) {
    .hero h1 {
        font-size: 28px;
    }
}

/* ===== 横屏手机模式 ===== */
@media (max-width: 900px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 60px 24px 40px;
    }

    .navbar-menu.show {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        padding: 10px;
    }

    .navbar-menu li {
        width: auto;
    }

    .navbar-menu a {
        border-bottom: none;
        padding: 12px 16px;
    }

    .service-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .expert-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== 触摸优先的悬停替代 ===== */
@media (hover: none) and (pointer: coarse) {
    /* 移除所有hover效果，改用active */
    .adv-card:hover,
    .service-col:hover,
    .expert-card:hover,
    .news-card:hover,
    .geo-card:hover {
        transform: none !important;
        box-shadow: none !important;
        border-color: rgba(255, 255, 255, 0.06) !important;
    }

    .adv-card:active,
    .service-col:active,
    .expert-card:active,
    .news-card:active,
    .geo-card:active {
        transform: scale(0.98) !important;
        background: rgba(212, 168, 83, 0.05) !important;
    }

    .hero-cta:hover {
        transform: none !important;
    }

    .hero-cta:active {
        transform: scale(0.96) !important;
        box-shadow: 0 4px 12px rgba(212, 168, 83, 0.2) !important;
    }
}

/* ===== 打印样式 ===== */
@media print {
    .navbar, .hero, .footer, .stats-bar {
        display: none;
    }

    body {
        color: #000;
        background: #fff;
    }

    .section {
        padding: 20px 0;
    }
}

/* ===== 暗色模式支持 ===== */
@media (prefers-color-scheme: dark) {
    /* 当前站点已是暗色主题，保持兼容 */
}

/* ===== 减少动画偏好 ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ===== 高对比度模式 ===== */
@media (prefers-contrast: high) {
    :root {
        --gold: #B8922E;
        --text: #FFFFFF;
        --text-muted: #CCCCCC;
    }

    .navbar {
        background: #0A0E17;
    }

    .adv-card, .service-col, .expert-card, .news-card {
        border: 1px solid rgba(255, 255, 255, 0.15);
    }
}

/* ===== 修复iOS输入框问题 ===== */
@supports (-webkit-touch-callout: none) {
    input, textarea, select {
        font-size: 16px;
    }

    /* 修复iOS Safari底部固定元素问题 */
    .navbar {
        position: -webkit-sticky;
        position: sticky;
    }
}

/* ===== 滚动条美化(Webkit) ===== */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 4px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: rgba(212, 168, 83, 0.3);
        border-radius: 2px;
    }
}
