/* ===== 多彩贵州 图文页面样式（自适应 + 双主题） ===== */

/* ---------- 主题变量 ---------- */
:root {
    --primary: #1f7a4d;
    --primary-dark: #17603c;
    --bg: #f4f6f5;
    --card-bg: #ffffff;
    --text: #333333;
    --text-sub: #555555;
    --nav-bg: #1f7a4d;
    --nav-text: #ffffff;
    --footer-bg: #2c3e35;
    --footer-text: #cfd8d3;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 10px 26px rgba(0, 0, 0, 0.14);
    --tag-bg: #e6f4ec;
    --tag-text: #1f7a4d;
}

[data-theme="dark"] {
    --primary: #3cb87f;
    --primary-dark: #2f9a68;
    --bg: #131917;
    --card-bg: #1d2521;
    --text: #dde6e1;
    --text-sub: #a8b6af;
    --nav-bg: #16241d;
    --nav-text: #d8e6de;
    --footer-bg: #0e1512;
    --footer-text: #9fb3a8;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 10px 26px rgba(0, 0, 0, 0.55);
    --tag-bg: #244033;
    --tag-text: #6fd3a5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    scroll-behavior: smooth;
    /* 锚点跳转时避开吸顶导航 */
    scroll-padding-top: 60px;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.7;
    overflow-x: hidden;
    transition: background-color 0.4s, color 0.4s;
}

img {
    max-width: 100%;
}

/* ---------- 头部横幅 ---------- */
.header {
    position: relative;
    width: 100%;
    height: clamp(220px, 34vw, 440px);
    overflow: hidden;
}

.header-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 渐变遮罩提升标题可读性 */
.header::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.45));
}

.header-title {
    position: absolute;
    z-index: 1;
    left: 50%;
    bottom: clamp(18px, 4vw, 36px);
    transform: translateX(-50%);
    width: 92%;
    text-align: center;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
    animation: fade-up 0.9s ease both;
}

.header-title h1 {
    font-size: clamp(26px, 5vw, 44px);
    letter-spacing: clamp(4px, 1.5vw, 12px);
}

.header-title p {
    font-size: clamp(12px, 2vw, 16px);
    letter-spacing: clamp(1px, 0.6vw, 4px);
}

@keyframes fade-up {
    from { opacity: 0; transform: translate(-50%, 16px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 导航栏 ---------- */
.nav {
    background-color: var(--nav-bg);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: background-color 0.4s;
}

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

.nav ul {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    list-style: none;
}

.nav a {
    display: block;
    padding: 14px clamp(10px, 2vw, 22px);
    color: var(--nav-text);
    text-decoration: none;
    font-size: clamp(13px, 1.6vw, 15px);
    letter-spacing: 1px;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: background-color 0.3s, border-color 0.3s;
}

.nav a:hover {
    background-color: rgba(0, 0, 0, 0.18);
}

.nav a.active {
    border-bottom-color: #ffd866;
    background-color: rgba(0, 0, 0, 0.12);
}

/* 主题切换按钮 */
#theme-toggle {
    flex: 0 0 auto;
    margin-left: auto;
    margin-right: 10px;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, transform 0.3s;
}

#theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: rotate(20deg);
}

#theme-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

#theme-toggle .icon-sun { display: none; }
[data-theme="dark"] #theme-toggle .icon-sun { display: block; }
[data-theme="dark"] #theme-toggle .icon-moon { display: none; }

/* ---------- 景点卡片 ---------- */
.container {
    max-width: 1100px;
    margin: clamp(24px, 4vw, 44px) auto;
    padding: 0 clamp(12px, 3vw, 20px);
    display: flex;
    flex-direction: column;
    gap: clamp(22px, 4vw, 40px);
}

.section-heading {
    text-align: center;
    color: var(--primary);
    font-size: clamp(20px, 3vw, 28px);
    letter-spacing: 6px;
}

.section-heading::after {
    content: "";
    display: block;
    width: 56px;
    height: 3px;
    margin: 10px auto 0;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--primary), #8fd4ae);
}

.card {
    display: flex;
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.4s;
}

/* 交错排版：偶数卡片图片在右 */
.card:nth-child(even) {
    flex-direction: row-reverse;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.card > img {
    width: 45%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
    transition: transform 0.5s;
}

.card:hover > img {
    transform: scale(1.04);
}

.card-body {
    width: 55%;
    padding: clamp(18px, 3vw, 30px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.card-tags span {
    padding: 2px 12px;
    border-radius: 12px;
    background-color: var(--tag-bg);
    color: var(--tag-text);
    font-size: 12px;
    letter-spacing: 1px;
}

.card-body h2 {
    color: var(--primary);
    font-size: clamp(19px, 2.6vw, 26px);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.card-body p {
    font-size: clamp(13px, 1.6vw, 15px);
    color: var(--text-sub);
    text-indent: 2em;
    margin-bottom: 18px;
}

.btn {
    align-self: flex-start;
    padding: 8px 22px;
    background-color: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: 20px;
    font-size: 14px;
    transition: background-color 0.3s, transform 0.3s;
}

.btn:hover {
    background-color: var(--primary-dark);
    transform: translateX(4px);
}

/* ---------- 滚动显现动画 ---------- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- 返回顶部 ---------- */
#back-to-top {
    position: fixed;
    right: 22px;
    bottom: 26px;
    z-index: 200;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background-color: var(--primary);
    color: #fff;
    cursor: pointer;
    box-shadow: var(--shadow-hover);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s, background-color 0.3s;
}

#back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top:hover {
    background-color: var(--primary-dark);
}

#back-to-top svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    vertical-align: middle;
}

/* ---------- 图片灯箱 ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 4vw;
    background-color: rgba(0, 0, 0, 0.88);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    cursor: zoom-out;
}

.lightbox.open {
    opacity: 1;
    visibility: visible;
}

.lightbox img {
    max-width: 92vw;
    max-height: 82vh;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.lightbox p {
    color: #ddd;
    font-size: 14px;
    text-align: center;
}

/* ---------- 页脚 ---------- */
.footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    text-align: center;
    padding: 26px 12px;
    font-size: 14px;
    letter-spacing: 2px;
    transition: background-color 0.4s;
}

.footer p + p {
    margin-top: 6px;
    font-size: 12px;
    opacity: 0.7;
}

/* =========================================================
   自适应断点
   ========================================================= */

/* ---------- 笔记本 / 平板横屏 (≤1199px) ---------- */
@media (max-width: 1199px) {
    .container {
        max-width: 960px;
    }
}

/* ---------- 平板竖屏 / 大屏手机 (≤768px) ---------- */
@media (max-width: 768px) {
    .card,
    .card:nth-child(even) {
        flex-direction: column;
    }

    .card > img,
    .card-body {
        width: 100%;
    }

    .card > img {
        aspect-ratio: 16 / 10;
    }

    .card-body p {
        text-indent: 0;
    }
}

/* ---------- 手机 (≤480px) ---------- */
@media (max-width: 480px) {
    .nav-inner {
        justify-content: flex-start;
    }

    .nav ul {
        justify-content: flex-start;
    }

    .nav a {
        padding: 10px 12px;
    }

    .btn {
        align-self: stretch;
        text-align: center;
        padding: 10px 22px;
    }

    #back-to-top {
        right: 14px;
        bottom: 18px;
    }
}

/* ---------- 减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .reveal,
    .header-title {
        opacity: 1;
        transform: none;
        animation: none;
        transition: none;
    }

    .card,
    .card > img,
    .btn {
        transition: none;
    }
}
