/* ==========================================================
   四季有节 文明有声 —— 邛崃“我们的节日”专题页样式
   中式国潮长页专题 · 网页端为主 · 兼容移动端
   ========================================================== */

/* ---------- 基础重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth; /* CSS 原生平滑滚动兜底 */
}

body {
    font-family: "微软雅黑", "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 16px;
    line-height: 1.9;
    color: #5a4632; /* 暖棕墨色，适配国潮底色 */
    background-color: #f7f3ea;
    overflow-x: hidden;
}

img {
    display: block;
    max-width: 100%;
}

a {
    text-decoration: none;
}

/* 版心容器：网页端固定宽度居中 */
.container {
    width: 1200px;
    max-width: 92%;
    margin: 0 auto;
}

/* ==========================================================
   1. 顶部卷轴山水 Banner
   ========================================================== */
.banner {
    width: 100%;
    line-height: 0;
}

.banner img {
    width: 100%;
    height: auto;
}

/* ==========================================================
   2. 导语区（#59afa4 青绿色通栏）
   ========================================================== */
.intro {
    background-color: #59afa4;
    padding:0 0 48px 0;
}

.intro p {
    color: #ffffff;
    font-size: 17px;
    line-height: 2.1;
    text-align: justify;
    text-indent: 2em;
    /* 文字加轻微阴影，保证浅底图片干扰下的可读性 */
    text-shadow: 0 1px 3px rgba(0, 60, 55, 0.25);
}

/* ==========================================================
   3. 节日板块通用样式（背景对应 bg1-bg5）
   ========================================================== */
.festival {
    padding: 70px 0 80px;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
}

/* 各板块指定背景图 */
.sec-yuanxiao  { background-image: url("../images/bg1.jpg"); }
.sec-qingming  { background-image: url("../images/bg2.jpg"); }
.sec-duanwu    { background-image: url("../images/bg3.jpg"); }
.sec-zhongqiu  { background-image: url("../images/bg4.jpg"); }
.sec-chongyang { background-image: url("../images/bg5.jpg"); }

/* 书法标题 */
.sec-title {
    text-align: center;
    line-height: 0;
    margin-bottom: 42px;
}

.sec-title img {
    display: inline-block;
    width: 620px;
    max-width: 80%;
    height: auto;
}

/* 板块小标题（金色渐变文字，呼应国潮配色） */
.sub-title {
    text-align: center;
    font-size: 21px;
    font-weight: bold;
    letter-spacing: 1px;
    margin: 40px auto 18px;
    color: #b45f2a;
}

/* 正文 */
.sec-text {
    font-size: 16px;
    line-height: 2.1;
    color: #6b543c;
    text-align: justify;
    text-indent: 2em;
}

/* 详情按钮 */
.detail-btn {
    display: block;
    width: 150px;
    margin: 28px auto 0;
    padding: 9px 0;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #c0392b;
    border: 1.5px solid #c0392b;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.55);
    transition: all 0.35s ease;
}

/* ==========================================================
   4. 2×4 方格图（元宵 / 清明 / 重阳）
   ========================================================== */
.grid-2x4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.grid-item {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 8px;
    border: 3px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 6px 18px rgba(120, 80, 40, 0.18);
    background: #fff;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.grid-item img {
    width: 100%;
    aspect-ratio: 4 / 3;      /* 方格统一比例 */
    object-fit: cover;
    transition: transform 0.5s ease;
}

/* ==========================================================
   5. 圆形图组（端午）
   ========================================================== */
.grid-circle {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 40px;
}

.circle-item {
    display: block;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    overflow: hidden;
    border: 5px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 22px rgba(40, 110, 90, 0.25);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.circle-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

/* ==========================================================
   6. 六边形蜂巢图（中秋）
   实际样式见文件末尾「.hex-grid / .ling」蜂窝排版区块
   ========================================================== */

/* ==========================================================
   7. 底部青绿色通栏页脚
   ========================================================== */
.footer {
    background-color: #59afa4;
    padding: 40px 0;
    text-align: center;
}

.footer p {
    color: #eefaf7;
    font-size: 15px;
    line-height: 2.2;
    letter-spacing: 1px;
}

/* ==========================================================
   8. 返回顶部浮动按钮
   ========================================================== */
.back-top {
    position: fixed;
    right: 30px;
    bottom: 50px;
    width: 48px;
    height: 48px;
    line-height: 44px;
    text-align: center;
    font-size: 22px;
    color: #ffffff;
    background: linear-gradient(135deg, #67bdb1, #4b9e93);
    border-radius: 50%;
    box-shadow: 0 6px 18px rgba(0, 90, 80, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: all 0.35s ease;
    z-index: 99;
}

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

/* ==========================================================
   9. 滚动入场动画（由 jQuery 添加 .in-view 触发）
   ========================================================== */
.festival .sec-title,
.festival .grid-box,
.festival .hex-grid,
.festival .sub-title,
.festival .sec-text,
.festival .detail-btn {
    opacity: 0;
    transform: translateY(36px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.festival.in-view .sec-title,
.festival.in-view .grid-box,
.festival.in-view .hex-grid,
.festival.in-view .sub-title,
.festival.in-view .sec-text,
.festival.in-view .detail-btn {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================
   10. 平板过渡（≤ 940px）
   蜂巢图由 .ling 的 --hw: min(220px, 19.5vw) 自动等比缩放，
   咬合排列关系在任意视口下保持一致，无需额外覆盖
   ========================================================== */

/* ==========================================================
   11. 移动端自适应排版（≤ 768px）
   ========================================================== */
@media screen and (max-width: 768px) {
    body {
        font-size: 15px;
    }

    .container {
        max-width: 90%;
    }

    /* 导语 */
    .intro {
        padding: 30px 0;
    }

    .intro p {
        font-size: 15px;
        line-height: 2;
    }

    /* 板块 */
    .festival {
        padding: 44px 0 50px;
        background-attachment: scroll;
    }

    .sec-title {
        margin-bottom: 28px;
    }

    .sec-title img {
        width: 100%;
        max-width: 96%;
    }

    .sub-title {
        font-size: 17px;
        margin: 28px auto 14px;
        line-height: 1.7;
    }

    .sec-text {
        font-size: 15px;
        line-height: 2;
    }

    /* 2×4 方格 → 2 列 × 4 行 */
    .grid-2x4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .grid-item {
        border-width: 2px;
    }

    /* 圆形图两列排布：每行固定 2 个圆 */
    .grid-circle {
        gap: 18px 12px;
    }

    .circle-item {
        width: calc((100% - 12px) / 2);
        height: auto;
        aspect-ratio: 1 / 1;
        border-width: 3px;
    }

    /* 详情按钮 */
    .detail-btn {
        width: 130px;
        font-size: 15px;
        padding: 8px 0;
    }

    /* 页脚 */
    .footer {
        padding: 28px 0;
    }

    .footer p {
        font-size: 13px;
        line-height: 2;
    }

    /* 返回顶部 */
    .back-top {
        right: 16px;
        bottom: 24px;
        width: 42px;
        height: 42px;
        line-height: 38px;
        font-size: 20px;
    }
}

/* 小屏手机（≤ 400px）细节微调 */
@media screen and (max-width: 400px) {
    .sub-title {
        font-size: 16px;
    }
}
/* ========== 六边形蜂窝图片排版 .hex-grid（中秋模块） ==========
   7 张圆角尖顶六边形：上2(x2,x5) · 中3(x1,x4,x7) · 下2(x3,x6)
   相邻行纵向重叠半高、水平错位半个间距，深度咬合还原设计图排列。

   PC 端兼容核心：全部坐标以 --u（单格宽度的 1/10）为基准单位，
   --hw 取 min(220px, 19.5vw) ——
   · 视口 ≥ 1130px：固定 220px，PC 大屏布局稳定不散架；
   · 视口 < 1130px：按 19.5vw 等比缩小，平板/手机自动适配，
   任意宽度下七格间距比例完全一致，不再出现 max-width 与
   vw 坐标脱节导致的错位。
   ======================================================== */
.hex-grid {
    display: flex;
    justify-content: center;
    margin: 0 auto;
    padding: 10px 0;
}

.ling {
    /* 单格宽度：PC 端固定像素，窄屏按视口等比缩放 */
    --hw: min(220px, 19.5vw);
    --u: calc(var(--hw) / 10);        /* 布局基准单位 = 单格宽 / 10 */
    --hh: calc(var(--hw) * 1.02);   /* 尖顶六边形高 = 宽 × 2/√3 */
    position: relative;
    width: calc(var(--u) * 46);       /* 最右格左边距 36u + 单格宽 10u */
    height: calc(var(--u) * 22.55);   /* 最下格顶边 11u + 单格高 11.55u */
}

/* <a> 包裹层仅作链接容器，不干扰内部绝对定位 */
.ling a {
    display: block;
    line-height: 0;
}

/* 六边形图片通用样式：圆角六边形 mask（六个角圆润过渡） */
.ling img {
    display: block;
    position: absolute;
    width: var(--hw);
    height: var(--hh);
    object-fit: cover;
    /* 圆角六边形 mask：SVG path 在 100×115.47 viewBox 中绘制，
       每个顶点处用 Q 二次贝塞尔曲线做圆角过渡 */
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 115.47'><path d='M44.8 3 Q50 0 55.2 3 L94.8 25.87 Q100 28.87 100 34.87 L100 80.6 Q100 86.6 94.8 89.6 L55.2 112.47 Q50 115.47 44.8 112.47 L5.2 89.6 Q0 86.6 0 80.6 L0 34.87 Q0 28.87 5.2 25.87 Z' fill='black'/></svg>") no-repeat center / contain;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 115.47'><path d='M44.8 3 Q50 0 55.2 3 L94.8 25.87 Q100 28.87 100 34.87 L100 80.6 Q100 86.6 94.8 89.6 L55.2 112.47 Q50 115.47 44.8 112.47 L5.2 89.6 Q0 86.6 0 80.6 L0 34.87 Q0 28.87 5.2 25.87 Z' fill='black'/></svg>") no-repeat center / contain;
    /* 不支持 mask 的浏览器降级为直角六边形 */
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    /* 阴影跟随 mask 形状，增强立体感 */
    filter: drop-shadow(0 3px 8px rgba(13, 92, 62, 0.18));
    transition: transform 0.35s ease, filter 0.35s ease;
}

/* 支持 mask 时移除直角 clip-path，避免直角边切掉圆角 */
@supports ((-webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1 1'></svg>")) or (mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1 1'></svg>"))) {
    .ling img {
        clip-path: none;
    }
}

/* —— 七格坐标（单位 --u，比例与设计图一致）：上2 · 中3 · 下2 —— */
img.x1 { left: 0;                   top: calc(var(--u) * 5.5); }  /* 中·左 */
img.x2 { left: calc(var(--u) * 9);  top: 0; }                     /* 上·左 */
img.x3 { left: calc(var(--u) * 9);  top: calc(var(--u) * 11); }   /* 下·左 */
img.x4 { left: calc(var(--u) * 18); top: calc(var(--u) * 5.5); }  /* 中·中 */
img.x5 { left: calc(var(--u) * 27); top: 0; }                     /* 上·右 */
img.x6 { left: calc(var(--u) * 27); top: calc(var(--u) * 11); }   /* 下·右 */
img.x7 { left: calc(var(--u) * 36); top: calc(var(--u) * 5.5); }  /* 中·右 */
