/* 全局重置与基础 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.7;
    color: #1a1a2e;
    background-color: #f0f4f8;
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
}

body.dark-mode {
    background-color: #0a1628;
    color: #d0d8e0;
}

a {
    color: #f0c040;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #ffd966;
    text-decoration: underline;
}

img, svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 滚动动画初始状态 */
section {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease forwards;
}

section:nth-child(2) { animation-delay: 0.1s; }
section:nth-child(3) { animation-delay: 0.2s; }
section:nth-child(4) { animation-delay: 0.3s; }
section:nth-child(5) { animation-delay: 0.4s; }
section:nth-child(6) { animation-delay: 0.5s; }
section:nth-child(7) { animation-delay: 0.6s; }
section:nth-child(8) { animation-delay: 0.7s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 头部导航 */
header {
    background: linear-gradient(135deg, #0b1a2e 0%, #1a2d4a 100%);
    color: #fff;
    padding: 0.75rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

nav ul {
    display: flex;
    gap: 2.5rem;
    list-style: none;
    align-items: center;
}

nav ul li a {
    color: #b0c4de;
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s ease;
}

nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #f0c040;
    transition: width 0.3s ease;
}

nav ul li a:hover::after,
nav ul li a[aria-current="page"]::after {
    width: 100%;
}

nav ul li a[aria-current="page"] {
    color: #f0c040;
}

nav ul li a:hover {
    color: #f0c040;
}

#darkModeToggle,
#mobileMenuToggle {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f0c040;
    transition: background 0.3s, transform 0.3s;
    cursor: pointer;
}

#darkModeToggle:hover,
#mobileMenuToggle:hover {
    background: rgba(240,192,64,0.2);
    transform: scale(1.1);
}

#mobileMenuToggle {
    display: none;
}

/* 移动端菜单 */
@media (max-width: 768px) {
    nav ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: rgba(11,26,46,0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding: 1.5rem 2rem;
        gap: 1.5rem;
        border-bottom: 2px solid #f0c040;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    }

    nav ul.open {
        display: flex;
    }

    #mobileMenuToggle {
        display: flex;
    }

    nav ul li a {
        font-size: 1.1rem;
    }
}

/* 主内容 */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 通用标题 */
h1, h2, h3 {
    color: #0b1a2e;
    transition: color 0.3s ease;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
    color: #f0c040;
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h2 {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid #f0c040;
    padding-bottom: 0.5rem;
    display: inline-block;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    color: inherit;
}

/* 英雄区 - 渐变Banner */
#hero {
    display: flex;
    align-items: center;
    gap: 3rem;
    flex-wrap: wrap;
    background: linear-gradient(145deg, #0b1a2e 0%, #1a2d4a 40%, #0f2a4a 100%);
    color: #fff;
    padding: 4rem 3rem;
    border-radius: 24px;
    margin-bottom: 4rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

#hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(240,192,64,0.08) 0%, transparent 60%);
    pointer-events: none;
}

#hero h1 {
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

#hero p {
    color: #c0d0e0;
    font-size: 1.2rem;
    max-width: 600px;
}

#hero a[role="button"] {
    display: inline-block;
    padding: 0.85rem 2.5rem;
    background: linear-gradient(135deg, #f0c040, #e0b030);
    color: #0b1a2e;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    margin-right: 1rem;
    margin-top: 0.5rem;
    box-shadow: 0 4px 15px rgba(240,192,64,0.4);
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
    border: none;
    cursor: pointer;
}

#hero a[role="button"]:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(240,192,64,0.5);
    background: linear-gradient(135deg, #ffd966, #f0c040);
    text-decoration: none;
}

#hero div:last-child svg {
    filter: drop-shadow(0 10px 30px rgba(240,192,64,0.3));
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* 卡片通用 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

/* 毛玻璃卡片 */
article {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.06);
    border: 1px solid rgba(255,255,255,0.2);
    transition: transform 0.4s ease, box-shadow 0.4s ease, background 0.3s ease;
}

body.dark-mode article {
    background: rgba(26,45,74,0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

article:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 16px 48px rgba(0,0,0,0.12);
}

body.dark-mode article:hover {
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

article a {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.5rem 1.2rem;
    background: #f0c040;
    color: #0b1a2e;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.3s, transform 0.3s;
}

article a:hover {
    background: #ffd966;
    transform: translateY(-2px);
    text-decoration: none;
}

/* 关于、产品、服务、资源区 */
#about > div,
#products > div,
#services > div,
#resources > div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

#resources > div {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* FAQ 手风琴 */
#faq article {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    padding: 0;
    border: none;
    margin-bottom: 0.5rem;
}

#faq article:hover {
    transform: none;
    box-shadow: none;
}

#faq article h3 {
    margin: 0;
}

#faq article button {
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 1.2rem 1.5rem;
    width: 100%;
    text-align: left;
    font-size: 1.05rem;
    font-weight: 600;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s, border-radius 0.3s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #1a1a2e;
}

body.dark-mode #faq article button {
    background: rgba(26,45,74,0.6);
    border-color: rgba(255,255,255,0.1);
    color: #d0d8e0;
}

#faq article button::after {
    content: '+';
    font-size: 1.5rem;
    font-weight: 300;
    transition: transform 0.3s;
    color: #f0c040;
}

#faq article button[aria-expanded="true"]::after {
    content: '−';
    transform: rotate(180deg);
}

#faq article button[aria-expanded="true"] {
    background: #f0c040;
    color: #0b1a2e;
    border-color: #f0c040;
    border-radius: 16px 16px 0 0;
}

body.dark-mode #faq article button[aria-expanded="true"] {
    background: #f0c040;
    color: #0b1a2e;
}

#faq article button:hover {
    border-color: #f0c040;
}

#faq article div[role="region"] {
    padding: 1.5rem;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0,0,0,0.06);
    border-top: none;
    border-radius: 0 0 16px 16px;
    transition: background 0.3s;
}

body.dark-mode #faq article div[role="region"] {
    background: rgba(26,45,74,0.8);
    border-color: rgba(255,255,255,0.05);
}

/* 使用指南 */
#howto {
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.04);
}

body.dark-mode #howto {
    background: rgba(26,45,74,0.4);
}

#howto ol {
    padding-left: 2rem;
    list-style: none;
    counter-reset: step-counter;
}

#howto ol li {
    counter-increment: step-counter;
    margin-bottom: 1rem;
    padding-left: 2.5rem;
    position: relative;
    font-size: 1.05rem;
}

#howto ol li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    background: #f0c040;
    color: #0b1a2e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

#howto ol li strong {
    color: #f0c040;
}

/* 联系方式 */
#contact address {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.2);
    font-style: normal;
}

body.dark-mode #contact address {
    background: rgba(26,45,74,0.5);
    border-color: rgba(255,255,255,0.05);
}

#contact address p {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#contact address p::before {
    content: '•';
    color: #f0c040;
    font-size: 1.5rem;
}

/* 页脚 */
footer {
    background: linear-gradient(135deg, #0b1a2e 0%, #0f2240 100%);
    color: #b0c4de;
    padding: 3rem 2rem 1.5rem;
    margin-top: 5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

footer > div:first-child {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

footer h3 {
    color: #f0c040;
    margin-bottom: 1.2rem;
    font-size: 1.2rem;
}

footer ul {
    list-style: none;
}

footer ul li {
    margin-bottom: 0.6rem;
}

footer ul li a {
    color: #8899aa;
    transition: color 0.3s, padding-left 0.3s;
}

footer ul li a:hover {
    color: #f0c040;
    padding-left: 5px;
    text-decoration: none;
}

footer > div:last-child {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    font-size: 0.9rem;
    color: #667788;
}

/* 回到顶部按钮（由JS创建，但样式在此定义） */
button[aria-label="回到顶部"] {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    z-index: 999 !important;
    padding: 12px 18px !important;
    background: linear-gradient(135deg, #f0c040, #e0b030) !important;
    color: #0b1a2e !important;
    border: none !important;
    border-radius: 50px !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    font-size: 0.9rem !important;
    box-shadow: 0 4px 20px rgba(240,192,64,0.4) !important;
    transition: transform 0.3s, box-shadow 0.3s !important;
    display: none !important;
}

button[aria-label="回到顶部"]:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 30px rgba(240,192,64,0.5) !important;
}

/* 响应式 */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.7rem; }
    #hero { padding: 2.5rem 1.5rem; flex-direction: column; text-align: center; }
    #hero div:last-child { display: none; }
    #hero a[role="button"] { margin-right: 0.5rem; margin-bottom: 0.5rem; }
    main { padding: 1.5rem; }
    #about > div, #products > div, #services > div, #resources > div { grid-template-columns: 1fr; }
    article { padding: 1.5rem; }
    footer > div:first-child { grid-template-columns: 1fr; }
    #howto { padding: 1.5rem; }
    #contact address { padding: 1.5rem; }
}

@media (max-width: 480px) {
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.4rem; }
    #hero { padding: 2rem 1rem; }
    nav { padding: 0 0.5rem; }
    header { padding: 0.5rem 1rem; }
    #hero a[role="button"] { display: block; width: 100%; margin-right: 0; text-align: center; }
}

/* 暗色模式下的微调 */
body.dark-mode #howto,
body.dark-mode #contact address {
    border-color: rgba(255,255,255,0.05);
}

body.dark-mode #faq article button::after {
    color: #f0c040;
}

/* 性能优化：减少重排 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}