/* 
 * CoreUI.cn - 编程新知 全局样式
 * 照明科技风：纯白 + 浅黄 + 深灰
 * 上下对撞错位布局
 */

:root {
    --color-white: #FFFFFF;
    --color-light-yellow: #FFF9E6;
    --color-pale-yellow: #FDF5D6;
    --color-dark-gray: #2C2C2C;
    --color-medium-gray: #6B6B6B;
    --color-light-gray: #E8E8E8;
    --color-accent: #FFD700;
    --gradient-line: linear-gradient(90deg, transparent, #FFD700, transparent);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background-color: var(--color-white);
    color: var(--color-dark-gray);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-smooth);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== 顶部导航栏 ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
    transition: var(--transition-smooth);
}

.header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-dark-gray);
}

.logo img {
    width: 45px;
    height: 45px;
    object-fit: contain;
}

.nav-menu {
    display: flex;
    gap: 30px;
}

.nav-menu a {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-dark-gray);
    padding: 8px 0;
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-accent);
    transition: var(--transition-smooth);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}

.nav-menu a:hover {
    color: var(--color-accent);
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 5px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--color-dark-gray);
    transition: var(--transition-smooth);
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ========== 页脚 ========== */
.footer {
    background: var(--color-dark-gray);
    color: var(--color-white);
    padding: 60px 0 30px;
    margin-top: 80px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--color-accent);
}

.footer-section p,
.footer-section a {
    color: var(--color-light-gray);
    font-size: 14px;
    line-height: 2;
}

.footer-section a:hover {
    color: var(--color-accent);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 30px;
    text-align: center;
    font-size: 14px;
    color: var(--color-medium-gray);
}

/* ========== 渐变分割线 ========== */
.gradient-divider {
    height: 2px;
    background: var(--gradient-line);
    margin: 60px 0;
    border: none;
}

/* ========== 通用卡片样式 ========== */
.card {
    background: var(--color-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: var(--transition-smooth);
    position: relative;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

.card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.card-content {
    padding: 25px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-dark-gray);
}

.card-excerpt {
    font-size: 14px;
    color: var(--color-medium-gray);
    line-height: 1.8;
    margin-bottom: 15px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--color-medium-gray);
}

.card-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ========== 按钮样式 ========== */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
}

.btn-primary {
    background: var(--color-accent);
    color: var(--color-dark-gray);
}

.btn-primary:hover {
    background: #FFC700;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--color-dark-gray);
    border: 2px solid var(--color-dark-gray);
}

.btn-secondary:hover {
    background: var(--color-dark-gray);
    color: var(--color-white);
}

/* ========== 动画效果 ========== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== 响应式设计 ========== */
@media (max-width: 992px) {
    .nav-menu {
        position: fixed;
        top: 70px;
        right: -100%;
        width: 280px;
        height: calc(100vh - 70px);
        background: var(--color-white);
        flex-direction: column;
        padding: 30px;
        gap: 20px;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
        transition: var(--transition-smooth);
    }

    .nav-menu.active {
        right: 0;
    }

    .hamburger {
        display: flex;
    }

    .container {
        padding: 0 15px;
    }
}

@media (max-width: 768px) {
    .logo span {
        font-size: 20px;
    }

    .logo img {
        width: 38px;
        height: 38px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* ========== 页面特定样式 ========== */
.page-header {
    padding: 140px 0 60px;
    background: linear-gradient(135deg, var(--color-light-yellow) 0%, var(--color-white) 100%);
    text-align: center;
}

.page-title {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--color-dark-gray);
}

.page-subtitle {
    font-size: 18px;
    color: var(--color-medium-gray);
    max-width: 700px;
    margin: 0 auto;
}

.section {
    padding: 80px 0;
}

.section-title {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--color-accent);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 40px;
}

/* 错位布局 */
.offset-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.offset-layout.reverse {
    direction: rtl;
}

.offset-layout.reverse > * {
    direction: ltr;
}

@media (max-width: 768px) {
    .offset-layout,
    .offset-layout.reverse {
        grid-template-columns: 1fr;
        direction: ltr;
    }
}
