/* common.css - 网站公共样式 */

/* 定义CSS变量 */
:root {
    /* 颜色变量 */
    --primary-color: #333;
    --secondary-color: #666;
    --accent-color: #3498db;
    --background-color: #f8f9fa;
    --footer-background: #f5f5f5;
    --light-gray: #eee;
    --dark-gray: #444;
    --white: #fff;
    --black: #000;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;

    /* 间距变量 */
    --grid-gap: 20px;
    --section-spacing: 60px;
    --content-padding: 40px;

    /* 字体变量 */
    --font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    --heading-font: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    --body-font: 'Microsoft YaHei', sans-serif;

    /* 尺寸变量 */
    --container-width: 1200px;
    --header-height: 70px;
    --footer-height: 100px;
    --border-radius: 4px;

    /* 动画变量 */
    --transition-speed: 0.3s;
}

/* 通用容器 */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 15px;
}

/* 通用按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--accent-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color var(--transition-speed) ease;
    font-size: 16px;
    text-align: center;
}

.btn:hover {
    background-color: #2980b9;
    color: var(--white);
}

.btn-secondary {
    background-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: var(--dark-gray);
}

/* 通用标题样式 */
.section-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* 通用卡片样式 */
.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 通用图片样式 */
.responsive-image {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* 通用文本样式 */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.text-bold {
    font-weight: bold;
}

/* 通用边距样式 */
.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-30 {
    margin-bottom: 30px;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mt-30 {
    margin-top: 30px;
}

/* 通用显示样式 */
.hidden {
    display: none;
}

.visible {
    display: block;
}

/* 通用过渡效果 */
.transition {
    transition: all 0.3s ease;
}

/* 基础样式 */
body {
    font-family: var(--font-family);
    color: var(--primary-color);
    background-color: var(--background-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* 当菜单打开时禁止滚动 */
body.menu-open {
    overflow: hidden;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 滚动动画 */
.scroll-animation {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animation.scrolled {
    opacity: 1;
    transform: translateY(0);
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--accent-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: #2980b9;
    transform: translateY(-3px);
}

.back-to-top svg {
    fill: var(--white);
}

/* 图片模态框 */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-modal.open {
    display: flex;
    opacity: 1;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.modal-image {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    color: var(--white);
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--accent-color);
}

/* 导航栏滚动效果 */
.site-header {
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 卡片悬停效果 */
.work-card,
.article-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.work-card:hover,
.article-card:hover,
.work-card.hover,
.article-card.hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 备案号样式 */
.beian a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.beian a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}