/* ========================================
   火毅盾Gravatar国内加速官网 - 样式文件
   ======================================== */

/* ========================================
   基础样式重置与全局配置
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
    line-height: 1.6;
    color: #1e293b;
    background-color: #f8fafc;
    overflow-x: hidden;
}

::selection {
    background-color: #2563eb;
    color: white;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========================================
   导航模块样式
   ======================================== */
#header {
    transition: all 0.3s ease;
}

#header.scrolled {
    background-color: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.nav-link {
    position: relative;
    padding-bottom: 2px;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link-mobile {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.nav-link-mobile:hover {
    background-color: #f1f5f9;
    color: #2563eb;
}

#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

#mobile-menu.open {
    max-height: 400px;
    padding-bottom: 1rem;
}

/* ========================================
   Banner模块样式
   ======================================== */
#home {
    position: relative;
    overflow: hidden;
}

#home::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 100%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

#home::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 40%;
    height: 80%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.counter {
    font-variant-numeric: tabular-nums;
}

/* ========================================
   核心优势模块样式
   ======================================== */
.advantage-card {
    position: relative;
    overflow: hidden;
}

.advantage-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.advantage-card:hover::before {
    transform: scaleX(1);
}

/* ========================================
   使用方法模块样式
   ======================================== */
.step-card {
    position: relative;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.step-card:hover {
    border-left-color: #2563eb;
}

.step-card::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    height: 0;
    width: 3px;
    background: linear-gradient(180deg, #2563eb, #3b82f6);
    transition: height 0.3s ease;
}

.step-card:hover::before {
    height: 100%;
}

/* ========================================
   效果对比模块样式
   ======================================== */
.compare-tab {
    font-weight: 500;
    cursor: pointer;
}

.compare-tab:hover:not(.active) {
    background-color: rgba(37, 99, 235, 0.1);
}

.comparison-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.comparison-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* ========================================
   FAQ模块样式
   ======================================== */
.faq-item {
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: #2563eb;
}

.faq-question {
    cursor: pointer;
    outline: none;
}

.faq-question:focus {
    outline: none;
}

.faq-question:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.faq-icon {
    transition: transform 0.3s ease;
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.faq-item.active .faq-answer {
    max-height: 500px;
    opacity: 1;
}

/* ========================================
   底部模块样式
   ======================================== */
footer a {
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ========================================
   返回顶部按钮样式
   ======================================== */
#back-to-top {
    cursor: pointer;
    outline: none;
}

#back-to-top:focus {
    outline: none;
}

#back-to-top:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   Toast提示样式
   ======================================== */
#toast {
    pointer-events: none;
}

#toast.show {
    transform: translateX(0);
    opacity: 1;
}

/* ========================================
   代码块样式
   ======================================== */
.code-block {
    position: relative;
    background-color: #1e293b;
    border-radius: 0.75rem;
    overflow: hidden;
}

.code-block pre {
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.7;
}

.code-block code {
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 0.5rem;
    color: #94a3b8;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.copy-btn.copied {
    background-color: #22c55e;
    color: white;
}

/* ========================================
   动画关键帧定义
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ========================================
   滚动动画类
   ======================================== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

.animate-on-scroll.delay-100 {
    transition-delay: 0.1s;
}

.animate-on-scroll.delay-200 {
    transition-delay: 0.2s;
}

.animate-on-scroll.delay-300 {
    transition-delay: 0.3s;
}

.animate-on-scroll.delay-400 {
    transition-delay: 0.4s;
}

/* ========================================
   响应式布局 - 平板端 (768px - 1199px)
   ======================================== */
@media (max-width: 1199px) {
    html {
        font-size: 15px;
    }

    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }

    #home {
        min-height: auto;
        padding-top: 8rem;
        padding-bottom: 4rem;
    }

    .advantage-card {
        padding: 1.5rem;
    }
}

/* ========================================
   响应式布局 - 手机端 (≤767px)
   ======================================== */
@media (max-width: 767px) {
    html {
        font-size: 14px;
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    #header {
        padding: 0.75rem 0;
    }

    #home {
        min-height: auto;
        padding-top: 6rem;
        padding-bottom: 3rem;
    }

    #home h1 {
        font-size: 2rem;
        line-height: 1.3;
    }

    #home p {
        font-size: 1rem;
    }

    .counter {
        font-size: 1.5rem;
    }

    section {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    section h2 {
        font-size: 1.75rem;
    }

    .advantage-card {
        padding: 1.25rem;
    }

    .step-card {
        padding: 1.25rem;
    }

    .step-card > div:first-child {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

    .comparison-card {
        padding: 1.25rem;
    }

    .comparison-card .text-5xl {
        font-size: 2rem;
    }

    .faq-question {
        padding: 1rem;
    }

    .faq-question span {
        font-size: 1rem;
    }

    footer {
        padding-top: 3rem;
        padding-bottom: 2rem;
    }

    footer .grid {
        gap: 2rem;
    }

    #back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
    }

    #toast {
        right: 1rem;
        left: 1rem;
        text-align: center;
    }
}

/* ========================================
   辅助工具类
   ======================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.transition-all {
    transition: all 0.3s ease;
}

/* ========================================
   打印样式
   ======================================== */
@media print {
    #header,
    #back-to-top,
    #toast,
    .copy-btn {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    a {
        text-decoration: underline;
    }
}

/* ========================================
   详情页侧边导航样式
   ======================================== */
.side-nav {
    position: sticky;
    top: 100px;
}

.side-nav-link {
    display: block;
    padding: 0.5rem 1rem;
    border-left: 2px solid #e2e8f0;
    color: #64748b;
    transition: all 0.3s ease;
}

.side-nav-link:hover,
.side-nav-link.active {
    border-left-color: #2563eb;
    color: #2563eb;
    background-color: #f8fafc;
}

/* ========================================
   代码高亮颜色
   ======================================== */
.hljs-keyword {
    color: #c678dd;
}

.hljs-string {
    color: #98c379;
}

.hljs-comment {
    color: #5c6370;
    font-style: italic;
}

.hljs-function {
    color: #61afef;
}

.hljs-number {
    color: #d19a66;
}

.hljs-variable {
    color: #e06c75;
}

/* ========================================
   加载动画
   ======================================== */
.loading-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ========================================
   图片懒加载占位
   ======================================== */
.img-placeholder {
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-placeholder::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
