/* 全局样式增强 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "KaiTi", "FangSong", "Microsoft YaHei", sans-serif;
    /* 使用楷体 */
    scroll-behavior: smooth;
}

/* 页面背景色 */
body {
    background-color: #f9e1c3;
    /* 宣纸米白背景色 */
}

/* 链接样式 */
a {
    text-decoration: none;
    color: #5a3e2a;
    position: relative;
}

/* 头部样式 */
header {
    background-color: #5a3e2a;
    color: #f9f5e9;
    padding: 1.5rem 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

/* 叶子飘落动画 */
@keyframes leaf-fall {
    0% {
        transform: translateY(0) rotate(0);
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
    }
}

.header-leaf {
    position: absolute;
    top: -20px;
    right: 20%;
    font-size: 1.5rem;
    animation: leaf-fall 8s infinite linear;
    animation-delay: 1s;
}

.header-leaf:nth-child(2) {
    top: -30px;
    left: 30%;
    font-size: 1.2rem;
    animation: leaf-fall 10s infinite linear;
    animation-delay: 3s;
}

.header-leaf:nth-child(3) {
    top: -40px;
    left: 60%;
    font-size: 1rem;
    animation: leaf-fall 12s infinite linear;
    animation-delay: 5s;
}

header h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    letter-spacing: 3px;
}

/* 导航栏样式 */
.navbar {
    background-color: #e4e4cb;
    padding: 10px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.navbar ul {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0;
}

.navbar li {
    margin: 5px 8px;
}

.navbar a {
    color: #281e0d;
    font-weight: bold;
    padding: 6px 10px;
    border-radius: 25px;
    display: inline-block;
    transition: all 0.3s ease;
}

.navbar a:hover,
.navbar a.active {
    background-color: #b8860b;
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* 主体容器 */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* 所有 h2 样式统一 */
h2 {
    color: #5a3e2a;
    font-size: 1.8rem;
    margin-bottom: 30px;
    margin-top: 30px;
    border-bottom: 2px solid #d4b78f;
    padding-bottom: 0.5rem;
    font-weight: normal;
    position: relative;
    padding-left: 25px;
}

h2::before {
    content: '🍃';
    position: absolute;
    left: 0;
    top: -2px;
    font-size: 0.8em;
    color: #8c6a4f;
}

/* 茶道简介样式 */
.tea-intro {
    display: flex;
    margin-bottom: 3rem;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.5s ease;
}

.tea-intro:hover {
    transform: perspective(1000px) rotateY(1deg);
}

.tea-image {
    flex: 1;
    min-width: 300px;
    overflow: hidden;
}

.tea-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.tea-intro:hover .tea-image img {
    transform: scale(1.05);
}

.tea-text {
    flex: 1;
    padding: 2rem;
}

/* 文章卡片样式 */
.articles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.article-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.article-content {
    padding: 1.5rem;
}

.article-content h3 {
    color: #5a3e2a;
    margin-bottom: 0.8rem;
    font-weight: normal;
    position: relative;
    padding-left: 25px;
}

.article-content h3::before {
    content: '📘';
    position: absolute;
    left: 0;
    top: -2px;
    font-size: 1.1em;
    color: #8c6a4f;
}

.article-content p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.read-more {
    display: inline-block;
    color: #8c6a4f;
    font-weight: bold;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.read-more:hover {
    color: #5a3e2a;
}


/* 图片网格样式 */
.image-grid {
    /* 使用CSS Grid布局，定义每行显示3列，自动填充容器宽度 */
    display: grid;
    /* 创建三等宽列，每列之间留有15px的间距 */
    grid-template-columns: repeat(3, 1fr);
    /* 设置网格项之间的水平和垂直间距为15像素 */
    gap: 15px;
}

.image-container {
    /* 设置容器的圆角边框 */
    border-radius: 8px;

    /* 添加过渡效果：当 transform 和 box-shadow 属性变化时，持续时间为0.6秒，使用 ease 时间函数 */
    transition: transform 0.6s ease, box-shadow 0.6s ease;

    /* 容器宽度占满父元素 */
    width: 100%;

    /* 固定容器高度为300像素 */
    height: 300px;

    /* 隐藏超出容器的内容（如图片裁剪） */
    overflow: hidden;
}

/* 鼠标悬停时，图片容器轻微上移并带有动画效果 */
.image-container:hover {
    /* 容器向上移动5像素，实现“浮起”效果 */
    transform: translateY(-5px);
}

.image-container img {
    width: 100%; /* 图片宽度填满父容器 */
    height: 100%; /* 图片高度也填满父容器 */
    object-fit: cover; /* 保持图片比例，同时覆盖整个容器，可能会裁剪图片边缘 */
    transition: transform 0.4s ease; /* 当图片的 transform 属性变化时，添加 0.4 秒的过渡动画 */
}

/* 当鼠标悬停在 .image-container 上时，其内部的 img 元素应用以下样式 */
.image-container:hover img {
    transform: scale(1.05); /* 图片放大到原来的 105%，实现轻微放大效果 */
}

/* 图文列表样式 */
.mixed-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.mixed-item {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    text-align: center;
}

.mixed-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.mixed-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
    transition: transform 0.4s ease;
}

.mixed-content h3 {
    color: #4d4d4d;
    font-size: 1.2em;
    margin-bottom: 10px;
    font-weight: normal;
    position: relative;
    padding-left: 25px;
}

.mixed-content h3::before {
    content: '📜';
    position: absolute;
    left: 0;
    top: -2px;
    font-size: 1.1em;
    color: #8c6a4f;
}

.mixed-content p {
    font-size: 0.95em;
    color: #666;
    line-height: 1.6;
}

/* 页脚样式 */
footer {
    background-color: #5a3e2a;
    color: #f9f5e9;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
    font-size: 0.95rem;
    position: relative;
}

footer::before {
    content: '🫖';
    position: absolute;
    left: 50%;
    top: -15px;
    transform: translateX(-50%);
    font-size: 1.2rem;
    background: #5a3e2a;
    padding: 0 5px;
    border-radius: 50%;
}


/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    nav ul {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    nav ul li {
        flex: 0 0 48%;
        /* 每行两个 */
        text-align: center;
        margin: 0;
    }

    .nav ul {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        grid-auto-rows: auto;
        gap: 5px 8px;
        padding: 5px 0;
    }

    .navbar li {
        width: 100%;
        text-align: center;
        margin: 0;
    }

    .navbar a {
        width: 100%;
        box-sizing: border-box;
        padding: 6px 4px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .tea-intro {
        flex-direction: column;
    }

    .tea-image {
        min-width: 100%;
    }

    .articles,
    .image-grid,
    .mixed-items {
        grid-template-columns: 1fr;
    }

    h2::before,
    .article-content h3::before,
    .mixed-content h3::before {
        left: -20px;
    }

    .mixed-list h2::before {
        content: '🍃';
        left: -25px;
    }
}


@scale-hover: 1.05;
@transition-time: 0.4s;

.image-container {
  overflow: hidden;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform @transition-time ease;

    &:hover {
      transform: scale(@scale-hover);
    }
  }
}