@tailwind base;
@tailwind components;
@tailwind utilities;

@layer utilities {
    .content-auto {
        content-visibility: auto;
    }
    .text-balance {
        text-wrap: balance;
    }
    .safe-top {
        padding-top: env(safe-area-inset-top);
    }
    .safe-bottom {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .safe-bottom-margin {
        margin-bottom: env(safe-area-inset-bottom);
    }
    .cert-gold-border {
        border-image: linear-gradient(135deg, #FCD34D, #D97706, #FCD34D) 1;
    }
    .text-shadow {
        text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    .backdrop-blur-nav {
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
    .tap-highlight-none {
        -webkit-tap-highlight-color: transparent;
    }
    .scroll-smooth {
        scroll-behavior: smooth;
    }
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}
body {
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}
/* 证书装饰边框 - 绿金风 */
.cert-frame {
    position: relative;
}
.cert-frame::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 2px solid currentColor;
    pointer-events: none;
    opacity: 0.6;
}
/* 滚动入场动画 */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
    will-change: opacity, transform;
}
.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== 导航栏 ========== */
#navbar {
    transition: background-color 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}
#navbar.scrolled {
    background-color: rgba(255,255,255,0.98);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(5,150,105,0.05);
}
.nav-link {
    position: relative;
}
.nav-link.active {
    color: #047857;
    background-color: #ECFDF5;
}
.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: linear-gradient(90deg, #059669, #D97706);
    border-radius: 2px;
}

/* 汉堡按钮动画 */
.hamburger span {
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.hamburger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
}
.hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* 移动端菜单滑入 */
.mobile-menu {
    transform: translateX(100%);
    transition: transform 0.3s ease;
}
.mobile-menu.open {
    transform: translateX(0);
}
.menu-overlay.show {
    display: block;
}

/* ========== 按钮通用 ========== */
.btn-press {
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn-press:active {
    transform: scale(0.97);
}

/* ========== 产品卡片 ========== */
.product-card {
    border: 1px solid #f1f5f9;
}
.product-card img {
    transition: transform 0.5s ease;
}
.product-card:hover img {
    transform: scale(1.05);
}

/* ========== 流程步骤连接线 ========== */
.process-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 36px;
    right: -20px;
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, #059669, transparent);
    z-index: 0;
}
@media (max-width: 1279px) {
    .process-step:nth-child(3n):not(:last-child)::after { display: none; }
}
@media (max-width: 639px) {
    .process-step::after { display: none !important; }
}

/* ========== FAQ ========== */
.faq-question {
    cursor: pointer;
}
.faq-item .faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.3s ease;
}
.faq-item.open .faq-answer {
    max-height: 500px;
}
.faq-item.open .faq-arrow {
    transform: rotate(180deg);
}
.faq-arrow {
    transition: transform 0.3s ease;
}

/* ========== 筛选标签 ========== */
.filter-btn.active {
    background: linear-gradient(135deg, #047857, #059669) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(5,150,105,0.3);
}

/* ========== Hero背景装饰 - 清新绿 ========== */
.hero-pattern {
    background-image:
        radial-gradient(circle at 20% 20%, rgba(16,185,129,0.08), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(217,119,6,0.06), transparent 40%);
}

/* ========== 区块装饰线条 ========== */
.section-divider {
    width: 64px;
    height: 4px;
    background: linear-gradient(90deg, #059669, #D97706);
    margin: 0 auto;
    border-radius: 999px;
}

/* ========== 滚动条隐藏 ========== */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ========== 文章区块点状背景 ========== */
.dots-bg {
    background-image: radial-gradient(#059669 1px, transparent 1px);
    background-size: 24px 24px;
}

/* ========== 弹窗动画 ========== */
.modal-backdrop {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}
.modal-box {
    transform: scale(0.95);
    transition: transform 0.25s ease;
}
.modal-backdrop.show .modal-box {
    transform: scale(1);
}

/* ========== 悬浮栏动画 ========== */
.fab-show {
    transform: translateY(0) !important;
}
.pc-footer-hidden {
    transform: translateY(100%);
}
#pcFooterBar {
    transition: transform 0.3s ease;
}

/* ========== 联系卡片悬浮 ========== */
.contact-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(5,150,105,0.12);
}

/* ========== 文字截断 ========== */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== 移动端额外优化 ========== */
@media (max-width: 767px) {
    /* 优化移动端行高 */
    body {
        line-height: 1.6;
    }
    /* 移动端卡片间距优化 */
    .grid {
        gap: 0.875rem !important;
    }
    /* 移动端文字大小优化 */
    h1 {
        letter-spacing: -0.02em;
    }
    /* 移动端按钮padding优化 */
    button, a.btn-press {
        min-height: 44px;
    }
    /* 移动端输入框优化 */
    input, select, textarea {
        min-height: 48px;
    }
    /* 移动端弹窗优化 */
    .modal-box {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    /* 移动端菜单滚动优化 */
    .mobile-menu {
        -webkit-overflow-scrolling: touch;
    }
    /* 移动端筛选标签padding优化 */
    .filter-btn {
        padding: 0.625rem 1rem;
    }
}

/* 修复移动端100vh问题 */
@supports (-webkit-touch-callout: none) {
    .min-h-screen {
        min-height: -webkit-fill-available;
    }
}

/* 图片懒加载占位优化 */
img {
    content-visibility: auto;
}

/* 选择文本颜色优化 - 清新绿 */
::selection {
    background: #059669;
    color: #fff;
}

/* ========== 文章正文样式（文章页使用） ========== */
.prose-article h2 {
    font-size: clamp(1.3rem, 2.5vw, 1.6rem);
    font-weight: 700;
    color: #064E3B;
    margin: 2.2rem 0 1rem;
    padding-left: 0.8rem;
    border-left: 4px solid #059669;
}
.prose-article h3 {
    font-size: clamp(1.1rem, 2vw, 1.25rem);
    font-weight: 600;
    color: #047857;
    margin: 1.5rem 0 0.75rem;
}
.prose-article p {
    font-size: clamp(0.95rem, 1.8vw, 1.05rem);
    line-height: 1.8;
    color: #374151;
    margin-bottom: 1rem;
}
.prose-article ul, .prose-article ol {
    margin: 1rem 0 1.2rem 1.5rem;
    line-height: 1.8;
    color: #4b5563;
}
.prose-article li {
    margin-bottom: 0.5rem;
}
.prose-article strong {
    color: #065F46;
    font-weight: 600;
}
.prose-article .tip-box {
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
    border-left: 4px solid #059669;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin: 1.25rem 0;
}
.prose-article .tip-box p {
    margin-bottom: 0;
    color: #064E3B;
    font-size: 0.95rem;
}
.prose-article .compare-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 0.95rem;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(5,150,105,0.08);
}
.prose-article .compare-table th {
    background: #059669;
    color: white;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}
.prose-article .compare-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    color: #4b5563;
}
.prose-article .compare-table tr:nth-child(even) td {
    background: #fafafa;
}
.prose-article .compare-table tr:last-child td {
    border-bottom: none;
}
.prose-article .img-box {
    margin: 1.5rem 0;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(5,150,105,0.1);
}
.prose-article .img-box img {
    width: 100%;
    height: auto;
    display: block;
}
.prose-article .img-box figcaption {
    text-align: center;
    font-size: 0.85rem;
    color: #6b7280;
    padding: 0.75rem;
    background: #f9fafb;
}
