/* ============================================================
   兑鸭惠家 · 公共增强样式
   由各页面 <link> 引入，配合 main.js 使用。
   设计原则：不覆盖页面已有内联样式，只补充移动菜单 /
   回到顶部 / 暗色模式 / 滚动动画 / hover 微交互。
   暗色模式对页面硬编码颜色使用 !important 强制覆盖。
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
    --surface: #fff;
    --surface-2: #f8f9fa;
    --footer-bg: #1A1E24;
    --shadow: 0 4px 16px rgba(0, 0, 0, .06);
    --shadow-hover: 0 10px 28px rgba(0, 160, 240, .18);
}
[data-theme="dark"] {
    --blue: #33B5FF;
    --blue-dark: #0088CC;
    --blue-light: #0E2A3A;
    --text: #E6E6E6;
    --text2: #A8A8A8;
    --text3: #777;
    --border: #2A2E35;
    --bg: #121417;
    --yellow: #FFD300;
    --surface: #1C2026;
    --surface-2: #171A1F;
    --footer-bg: #0E1013;
    --shadow: 0 4px 16px rgba(0, 0, 0, .35);
    --shadow-hover: 0 10px 30px rgba(51, 181, 255, .25);
}

body { transition: background .3s ease, color .3s ease; }

/* ---------- 导航右侧：主题切换 + 汉堡 ---------- */
.nav-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.theme-toggle {
    width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text2); cursor: pointer; font-size: 15px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: color .2s, border-color .2s;
}
.theme-toggle:hover { color: var(--blue); border-color: var(--blue); }
.hamburger {
    display: none; flex-direction: column; justify-content: center; gap: 5px;
    width: 34px; height: 34px; padding: 6px; background: none; border: none; cursor: pointer;
}
.hamburger span {
    display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: .3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 移动端菜单面板 ---------- */
.mobile-menu {
    position: fixed; top: 56px; left: 0; right: 0; z-index: 99;
    background: var(--surface); border-bottom: 1px solid var(--border);
    transform: translateY(-130%); transition: transform .3s ease;
    padding: 8px 20px 16px; box-shadow: var(--shadow);
}
.mobile-menu.open { transform: translateY(0); }
.mobile-menu a {
    display: block; padding: 14px 4px; color: var(--text2);
    text-decoration: none; font-size: 15px; border-bottom: 1px solid var(--border);
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a.active { color: var(--blue); }
.mobile-menu .m-cta {
    margin-top: 12px; text-align: center; background: var(--blue); color: #fff !important;
    border-radius: 4px; border-bottom: none; padding: 12px; font-size: 14px;
}

/* ---------- 滚动揭示动画 ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.show { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1 !important; transform: none !important; transition: none; }
}

/* ---------- 卡片 hover 微交互 ---------- */
.card, .feature-card, .value-item, .news-item {
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card:hover, .feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--blue);
}
.news-item:hover { border-color: var(--blue); }

/* ---------- 回到顶部 ---------- */
.back-to-top {
    position: fixed; right: 20px; bottom: 24px; z-index: 90;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--blue); color: #fff; border: none; cursor: pointer;
    font-size: 18px; line-height: 1; box-shadow: var(--shadow);
    opacity: 0; visibility: hidden; transform: translateY(12px);
    transition: opacity .3s, transform .3s, visibility .3s, background .2s;
}
.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--blue-dark); }

/* ---------- 暗色模式：覆盖页面硬编码颜色 ---------- */
[data-theme="dark"] .nav { background: var(--surface) !important; }
[data-theme="dark"] body { background: var(--surface) !important; color: var(--text) !important; }
[data-theme="dark"] .hero,
[data-theme="dark"] .page-hero {
    background: linear-gradient(180deg, var(--blue-light), var(--surface)) !important;
}
[data-theme="dark"] .card,
[data-theme="dark"] .feature-card,
[data-theme="dark"] .form-card,
[data-theme="dark"] .contact-box,
[data-theme="dark"] .info-card { background: var(--surface) !important; }
[data-theme="dark"] .footer { background: var(--footer-bg) !important; }
[data-theme="dark"] .sol-visual-box { background: var(--blue-light) !important; }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--surface-2) !important; color: var(--text) !important; border-color: var(--border) !important;
}
[data-theme="dark"] .news-item { border-color: var(--border) !important; }

/* ---------- 浅色模式增强：更明亮通透、对比更清晰 ---------- */
:root:not([data-theme="dark"]) body { background: #fff !important; color: #1F2329 !important; }
:root:not([data-theme="dark"]) .hero,
:root:not([data-theme="dark"]) .page-hero {
    background: linear-gradient(180deg, #EAF6FE 0%, #F5FBFF 55%, #fff 100%) !important;
}
:root:not([data-theme="dark"]) .sec-gray { background: #F2F8FD !important; }
:root:not([data-theme="dark"]) .card,
:root:not([data-theme="dark"]) .feature-card,
:root:not([data-theme="dark"]) .form-card,
:root:not([data-theme="dark"]) .contact-box,
:root:not([data-theme="dark"]) .info-card {
    background: #fff !important; border-color: #E8F0F5 !important;
    box-shadow: 0 6px 20px rgba(0, 160, 240, .07) !important;
}
:root:not([data-theme="dark"]) .sec-head h2,
:root:not([data-theme="dark"]) .hero h1,
:root:not([data-theme="dark"]) .card h3,
:root:not([data-theme="dark"]) .feature-card h4 { color: #16242E !important; }
:root:not([data-theme="dark"]) .sec-head p,
:root:not([data-theme="dark"]) .card p,
:root:not([data-theme="dark"]) .desc,
:root:not([data-theme="dark"]) .hero .desc { color: #5C6B77 !important; }

/* ---------- 暗色模式提亮：舒适通透、不再压抑 ---------- */
[data-theme="dark"] body { background: #1E232B !important; }
[data-theme="dark"] .hero,
[data-theme="dark"] .page-hero { background: linear-gradient(180deg, #1A4A66, #1E232B) !important; }
[data-theme="dark"] .sec-gray { background: #191D24 !important; }
[data-theme="dark"] .card,
[data-theme="dark"] .feature-card,
[data-theme="dark"] .form-card,
[data-theme="dark"] .contact-box,
[data-theme="dark"] .info-card { background: #272E38 !important; border-color: #313945 !important; }
[data-theme="dark"] .news-item { background: #272E38 !important; }
[data-theme="dark"] .sol-visual-box { background: #1A4A66 !important; }

/* ---------- 响应式：移动端显示汉堡、隐藏桌面导航 ---------- */
@media (max-width: 768px) {
    .hamburger { display: flex; }
    .nav-links { display: none; }
}
