/* ==========================================================================
   Theme: Blue & Yellow —— 蓝黄主题美化层
   加载顺序在 gallery-style.css 之后，只做视觉增强，不改变布局结构。
   主色变量由 base.html 依据后台「站点配置-主题配色」动态注入：
     --primary / --primary-dark / --primary-light / --secondary / --accent
   ========================================================================== */

/* ---------- 全局细腻化 ---------- */
:root {
    --grad-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    --grad-primary-deep: linear-gradient(135deg, #0b1e4d 0%, var(--primary) 55%, var(--primary-light) 100%);
    --grad-second: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    --shadow-soft: 0 8px 30px rgba(29, 78, 216, 0.12);
    --shadow-hover: 0 16px 40px rgba(29, 78, 216, 0.18);
    --radius: 12px;
    --radius-lg: 18px;
}

::selection {
    background: var(--primary);
    color: #fff;
}

html {
    scrollbar-color: var(--primary-light) var(--bg-light);
}

::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg-light);
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 8px;
}

body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a {
    transition: color 0.25s ease;
}

/* ---------- Header ---------- */
#header {
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: saturate(180%) blur(12px);
}

[data-theme="dark"] #header {
    background: rgba(17, 24, 39, 0.92) !important;
}

#header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 45%, var(--secondary) 100%);
    opacity: 0.9;
    pointer-events: none;
}

.brand-text {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.4px;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navbar-nav .nav-link {
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
    position: relative;
    color: var(--text-dark);
}

.navbar-nav .nav-link::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: 0;
    height: 3px;
    border-radius: 3px;
    background: var(--grad-second);
    transition: all 0.28s ease;
    transform: translateX(-50%);
}

.navbar-nav .nav-link:hover {
    color: var(--primary);
}

.navbar-nav .nav-link:hover::after {
    width: 60%;
}

.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    padding: 8px;
}

.dropdown-item {
    border-radius: 8px;
    font-size: 14px;
    padding: 9px 14px;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary);
    transform: translateX(4px);
}

/* 搜索/主题按钮 */
#searchToggle,
#themeToggle {
    transition: all 0.25s ease;
}

#searchToggle:hover,
#themeToggle:hover {
    border-color: var(--secondary) !important;
    color: var(--secondary);
    transform: translateY(-1px);
}

#searchBox input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* ---------- Hero ---------- */
.hero-overlay {
    background: linear-gradient(120deg,
            rgba(11, 30, 77, 0.86) 0%,
            rgba(29, 78, 216, 0.62) 45%,
            rgba(15, 23, 42, 0.55) 100%);
}

.hero-title {
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.hero-tag {
    background: rgba(251, 191, 36, 0.22);
    border: 1px solid rgba(251, 191, 36, 0.75);
    color: #ffe9b3;
    letter-spacing: 1.6px;
}

.hero-desc {
    max-width: 620px;
    line-height: 1.75;
}

.swiper-pagination-bullet {
    background: #fff;
    opacity: 0.5;
}

.swiper-pagination-bullet-active {
    background: var(--secondary);
    opacity: 1;
    width: 22px;
    border-radius: 6px;
}

/* ---------- 按钮 ---------- */
.btn-primary {
    background: var(--grad-primary);
    border: none;
    box-shadow: 0 6px 18px rgba(29, 78, 216, 0.28);
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.28s ease;
}

.btn-primary:hover {
    background: var(--grad-primary);
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(29, 78, 216, 0.36);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
    font-weight: 600;
    transition: all 0.28s ease;
}

.btn-outline:hover {
    background: var(--grad-primary);
    color: #fff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(29, 78, 216, 0.3);
}

/* 黄色强调按钮（可在后台内容中使用 .btn-secondary 类） */
.btn-secondary {
    background: var(--grad-second);
    border: none;
    color: #1f2937;
    font-weight: 700;
}

/* ---------- Section 标题 ---------- */
.section-title {
    position: relative;
    padding-left: 18px;
}

.section-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 74%;
    border-radius: 4px;
    background: var(--grad-second);
}

.section-header.text-center .section-title {
    padding-left: 0;
}

.section-header.text-center .section-title::after {
    content: "";
    display: block;
    width: 64px;
    height: 4px;
    margin: 14px auto 0;
    border-radius: 4px;
    background: var(--grad-second);
}

.section-link {
    font-weight: 600;
}

.section-link:hover {
    color: var(--secondary);
    gap: 8px;
}

/* ---------- 页头（栏目页） ---------- */
.page-header {
    background: var(--grad-primary-deep);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: "";
    position: absolute;
    right: -80px;
    top: -80px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.35) 0%, transparent 70%);
}

.page-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: var(--grad-second);
}

.page-title {
    position: relative;
    z-index: 1;
    letter-spacing: 0.5px;
    text-shadow: 0 3px 16px rgba(0, 0, 0, 0.25);
}

.page-desc {
    position: relative;
    z-index: 1;
    opacity: 0.92;
}

/* ---------- 卡片 ---------- */
.gallery-card {
    box-shadow: var(--shadow-sm);
}

.gallery-card:hover {
    border-color: var(--primary) !important;
    box-shadow: var(--shadow-hover);
}

.gallery-card-image {
    overflow: hidden;
}

.gallery-card-image img {
    transition: transform 0.5s ease;
}

.gallery-card:hover .gallery-card-image img {
    transform: scale(1.06);
}

.gallery-card-tag {
    background: var(--grad-second) !important;
    color: #1f2937 !important;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.gallery-item {
    box-shadow: var(--shadow-sm);
}

.gallery-item:hover {
    box-shadow: var(--shadow-hover);
}

/* 博客卡片 */
.blog-card:hover,
.blog-card-horizontal:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.blog-category {
    background: var(--grad-second) !important;
    color: #1f2937 !important;
    font-weight: 700;
}

.blog-meta .iconify {
    color: var(--primary);
}

.blog-read-more {
    color: var(--primary);
}

/* 新闻区 */
.news-item,
.news-list-item {
    transition: all 0.3s ease;
}

.news-list-item:hover {
    border-left-color: var(--secondary);
    background: var(--bg-light);
}

.news-category,
.news-category-sm {
    background: var(--grad-second) !important;
    color: #1f2937 !important;
    font-weight: 700;
}

/* ---------- 关于区 ---------- */
.about-label {
    background: var(--grad-second) !important;
    color: #1f2937 !important;
    font-weight: 800;
}

.about-stat-num {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.about-img-main {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-hover);
    border: 4px solid #fff;
    outline: 3px solid var(--secondary);
    outline-offset: -6px;
}

[data-theme="dark"] .about-img-main {
    border-color: #1f2937;
}

/* ---------- 侧栏 ---------- */
.widget-title {
    position: relative;
    padding-left: 14px;
}

.widget-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 70%;
    border-radius: 4px;
    background: var(--grad-second);
}

.category-item {
    border-radius: 8px;
    transition: all 0.22s ease;
}

.category-item:hover {
    background: var(--bg-light);
    transform: translateX(3px);
}

.category-item.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.12) 0%, rgba(251, 191, 36, 0.12) 100%);
    color: var(--primary);
    font-weight: 700;
    border-left: 4px solid var(--secondary);
}

.filter-chip,
.sidebar-tag {
    transition: all 0.22s ease;
}

.filter-chip:hover .sidebar-tag,
.sidebar-tag:hover {
    background: var(--grad-primary) !important;
    color: #fff !important;
    border-color: transparent !important;
}

.sidebar-post:hover {
    background: var(--bg-light);
}

/* ---------- 文章详情 ---------- */
.article-category {
    background: var(--grad-second) !important;
    color: #1f2937 !important;
    font-weight: 700;
}

.article-title {
    line-height: 1.35;
}

.article-meta .iconify {
    color: var(--primary);
}

.article-content {
    line-height: 1.85;
}

.article-content img {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 12px 0;
}

.article-content a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-color: rgba(251, 191, 36, 0.7);
    text-underline-offset: 3px;
}

.article-content a:hover {
    color: var(--secondary);
}

.article-content blockquote {
    border-left: 4px solid var(--secondary);
    background: var(--bg-light);
    padding: 14px 20px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 16px 0;
}

.article-content h1, .article-content h2, .article-content h3 {
    margin-top: 1.2em;
    color: var(--text-dark);
}

/* ---------- 表单 ---------- */
.contact-form input,
.contact-form select,
.contact-form textarea,
.sidebar-input {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    transition: all 0.25s ease;
    width: 100%;
    font-family: inherit;
    font-size: 15px;
    background: var(--bg-white);
    color: var(--text-dark);
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus,
.sidebar-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.contact-icon {
    background: var(--grad-primary) !important;
    color: #fff;
}

.social-link:hover {
    background: var(--grad-second) !important;
    color: #1f2937 !important;
    transform: translateY(-3px);
}

.form-success {
    text-align: center;
    padding: 48px 24px;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--secondary);
}

/* 表单校验提示（服务端回显 / AJAX 错误） */
.form-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 14px;
}

.field-error {
    display: block;
    color: #dc2626;
    font-size: 12.5px;
    margin-top: 6px;
}

.form-group.has-error input,
.form-group.has-error textarea,
.form-group.has-error select {
    border-color: #dc2626;
}

[data-theme="dark"] .form-alert {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(220, 38, 38, 0.35);
    color: #fca5a5;
}

.form-success h3 {
    margin: 14px 0 8px;
    color: var(--text-dark);
}

/* ---------- FAQ / 评价 ---------- */
.faq-item {
    transition: all 0.28s ease;
    border-top: 3px solid transparent;
}

.faq-item:hover {
    transform: translateY(-4px);
    border-top-color: var(--secondary);
    box-shadow: var(--shadow-hover);
}

.faq-question {
    color: var(--primary);
}

/* ---------- 下载区 ---------- */
.download-section,
.bg-primary-gradient {
    background: var(--grad-primary-deep) !important;
    position: relative;
    overflow: hidden;
}

.bg-primary-gradient::after {
    content: "";
    position: absolute;
    right: -60px;
    bottom: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.3) 0%, transparent 70%);
}

.download-btn {
    transition: all 0.28s ease;
}

.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
}

/* ---------- Footer ---------- */
.footer {
    background: linear-gradient(160deg, #0b1e4d 0%, #111827 70%) !important;
    position: relative;
}

.footer::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--grad-second);
}

.footer h4 {
    color: #fff !important;
    position: relative;
    padding-bottom: 10px;
    letter-spacing: 0.6px;
}

.footer h4::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 32px;
    height: 3px;
    border-radius: 3px;
    background: var(--grad-second);
}

.footer-links a {
    transition: all 0.25s ease;
    display: inline-block;
}

.footer-links a:hover {
    color: var(--accent) !important;
    transform: translateX(4px);
}

.footer .logo span {
    color: #fff;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.footer-bottom p {
    opacity: 0.85;
}

/* ---------- WhatsApp 浮动按钮 ---------- */
.whatsapp-float {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%) !important;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45) !important;
}

.whatsapp-float:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 14px 30px rgba(37, 211, 102, 0.55) !important;
}

/* ---------- 深色模式微调 ---------- */
[data-theme="dark"] .btn-primary {
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.35);
}

[data-theme="dark"] .hero-overlay {
    background: linear-gradient(120deg,
            rgba(2, 8, 28, 0.92) 0%,
            rgba(29, 78, 216, 0.5) 55%,
            rgba(2, 8, 28, 0.75) 100%);
}

[data-theme="dark"] .form-success {
    background: #1f2937;
    color: #f9fafb;
}

[data-theme="dark"] .form-success h3 {
    color: #f9fafb;
}

[data-theme="dark"] .category-item.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.22) 0%, rgba(251, 191, 36, 0.14) 100%);
}

/* ---------- 响应式微调 ---------- */
@media (max-width: 768px) {
    .section-title {
        font-size: 1.35rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .navbar-collapse {
        background: var(--bg-white);
        border-radius: var(--radius);
        box-shadow: var(--shadow-md);
        padding: 12px;
        margin-top: 10px;
        border: 1px solid var(--border);
    }

    [data-theme="dark"] .navbar-collapse {
        background: #1f2937;
    }
}

/* ---------- 滚动渐显（修复原站 fill-mode 依赖问题） ---------- */
/* [FIX] 原站 .animate-fade-in 使用 animation forwards，动画结束后 transform 被锁定，
   导致 .gallery-item / .blog-card 等的 hover 上浮失效。
   这里覆盖为无 fill-mode 版本：动画结束后回到元素常规样式，hover 正常。 */
.animate-fade-in {
    animation: fadeIn 0.6s ease;
}

/* 滚动渐显的初始轻微下移（保持视觉层次），由 JS 观察器在进入视口时播放 */
.reveal-ready {
    opacity: 0;
}

.reveal-ready.animate-fade-in {
    opacity: 1;
}

/* ---------- 图片加载占位（静态渐变底，图片加载完成后自然遮盖） ---------- */
.gallery-card-image img,
.blog-image img,
.news-image img,
.gallery-item img {
    background: linear-gradient(110deg, var(--bg-light) 0%, var(--bg-gray) 100%);
}

/* ---------- Header 滚动状态 ---------- */
/* [FIX] 原站样式选择器为 .header.scrolled（元素并无该类名，效果从未生效），
   此处以正确选择器实现：滚动后加深阴影并稍微收紧 */
#header.scrolled {
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14) !important;
}

#header.scrolled::after {
    opacity: 1;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
}

/* ---------- 搜索框（桌面常显 / 移动端点击展开） ---------- */
.site-search {
    display: flex;
}

@media (max-width: 991.98px) {
    .site-search {
        display: none;
    }

    .site-search.search-open {
        display: flex !important;
        position: fixed;
        top: 68px;
        left: 12px;
        right: 12px;
        z-index: 9990;
        background: var(--bg-white);
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 10px;
        box-shadow: var(--shadow-lg);
        animation: searchDrop 0.22s ease;
    }

    .site-search.search-open input {
        width: 100% !important;
    }
}

@keyframes searchDrop {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

[data-theme="dark"] .site-search.search-open {
    background: #1f2937;
}

/* ---------- 导航当前页高亮 ---------- */
.navbar-nav .nav-link.active {
    color: var(--primary) !important;
    font-weight: 700;
}

.navbar-nav .nav-link.active::after {
    width: 60%;
}

.nav-item.active > .dropdown-toggle {
    color: var(--primary);
}

/* ---------- 移动端菜单细节 ---------- */
@media (max-width: 991.98px) {
    .navbar-collapse.show {
        animation: searchDrop 0.25s ease;
        max-height: calc(100vh - 90px);
        overflow-y: auto;
    }

    .navbar-nav .nav-link {
        padding: 10px 4px;
    }

    .navbar-nav .nav-item {
        border-bottom: 1px solid var(--border);
    }

    .navbar-nav .nav-item:last-child {
        border-bottom: none;
    }

    .dropdown-menu {
        position: static !important;
        border-radius: 10px;
        margin: 4px 0 12px;
    }

    .dropdown-menu .dropdown-item {
        padding: 10px 14px;
    }
}

/* ---------- 灯箱（Fancybox）细节 ---------- */
.fancybox__caption {
    font-size: 15px;
    line-height: 1.6;
}

/* ---------- 打印 ---------- */
@media print {
    #header, .footer, .whatsapp-float, .sidebar, .article-sidebar-left {
        display: none !important;
    }
}
