/*========================================
Author Name:   Codebasket
Template Type: Bornona News Magazine HTML Template
Version:       v2.0 (Optimized)
-----------------------------
优化内容：
- 现代化CSS变量系统
- 响应式设计增强
- 性能优化
- 可访问性改进
- 深色模式支持
========================================*/

/* === 字体导入优化 === */
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Lobster+Two:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* === 重置与基础样式优化 === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === 现代化CSS变量系统 === */
:root {
    /* 主色彩系统 */
    --primary-color: #3775bb;
    --primary-dark: #2a5a8f;
    --primary-light: #4f8fd0;
    
    /* 中性色彩系统 */
    --neutral-50: #f8fafc;
    --neutral-100: #f1f5f9;
    --neutral-200: #e2e8f0;
    --neutral-300: #cbd5e1;
    --neutral-400: #94a3b8;
    --neutral-500: #64748b;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-800: #1e293b;
    --neutral-900: #0f172a;
    
    /* 语义色彩 */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    
    /* 字体系统 */
    --font-family-base: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-family-accent: 'Lobster Two', cursive, serif;
    
    /* 字体大小 - 响应式缩放 */
    --text-xs: 0.75rem;      /* 12px */
    --text-sm: 0.875rem;     /* 14px */
    --text-base: 1rem;       /* 16px */
    --text-lg: 1.125rem;     /* 18px */
    --text-xl: 1.25rem;      /* 20px */
    --text-2xl: 1.5rem;      /* 24px */
    --text-3xl: 1.875rem;    /* 30px */
    --text-4xl: 2.25rem;     /* 36px */
    
    /* 行高 */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.75;
    
    /* 字重 */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    
    /* 间距系统 */
    --space-1: 0.25rem;     /* 4px */
    --space-2: 0.5rem;      /* 8px */
    --space-3: 0.75rem;     /* 12px */
    --space-4: 1rem;        /* 16px */
    --space-5: 1.25rem;     /* 20px */
    --space-6: 1.5rem;      /* 24px */
    --space-8: 2rem;        /* 32px */
    --space-10: 2.5rem;     /* 40px */
    --space-12: 3rem;       /* 48px */
    --space-16: 4rem;       /* 64px */
    --space-20: 5rem;       /* 80px */
    
    /* 圆角 */
    --radius-sm: 0.25rem;
    --radius-base: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-base: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* 动效 */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 300ms ease-in-out;
    --transition-slow: 500ms ease-in-out;
    
    /* z-index 层级 */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal: 1040;
    --z-popover: 1050;
    --z-tooltip: 1060;
}

/* === 深色模式支持 === */
@media (prefers-color-scheme: dark) {
    :root {
        --neutral-50: #0f172a;
        --neutral-100: #1e293b;
        --neutral-200: #334155;
        --neutral-300: #475569;
        --neutral-400: #64748b;
        --neutral-500: #94a3b8;
        --neutral-600: #cbd5e1;
        --neutral-700: #e2e8f0;
        --neutral-800: #f1f5f9;
        --neutral-900: #f8fafc;
    }
}

/* === 基础样式优化 === */
html {
    scroll-behavior: smooth;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    color: var(--neutral-600);
    background-color: var(--neutral-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === 排版系统优化 === */
h1, h2, h3, h4, h5, h6 {
    color: var(--neutral-800);
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    margin-bottom: var(--space-4);
    line-height: var(--leading-relaxed);
}

/* === 链接样式优化 === */
a {
    color: var(--primary-color);
    text-decoration: none !important;
    transition: color var(--transition-fast);
    cursor: pointer;
}

a:hover,
a:focus {
    color: var(--primary-dark);
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* === 列表样式优化 === */
ul, ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-6);
}

ul { list-style-type: disc; }
ol { list-style-type: decimal; }

li {
    margin-bottom: var(--space-2);
    line-height: var(--leading-relaxed);
}

/* === 按钮样式优化 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    line-height: 1;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

/* === 表单元素优化 === */
.form-control {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--neutral-700);
    background-color: white;
    border: 1px solid var(--neutral-300);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(55 117 187 / 0.1);
}

.form-control::placeholder {
    color: var(--neutral-400);
}

/* === 布局容器优化 === */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* 响应式容器填充 */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-3);
    }
}

/* === 间距工具类优化 === */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* === 预加载器优化 === */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--neutral-50);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    backdrop-filter: blur(8px);
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid var(--neutral-200);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === 响应式字体大小调整 === */
@media (max-width: 768px) {
    :root {
        --text-xs: 0.7rem;
        --text-sm: 0.8rem;
        --text-base: 0.9rem;
        --text-lg: 1rem;
        --text-xl: 1.125rem;
        --text-2xl: 1.25rem;
        --text-3xl: 1.5rem;
        --text-4xl: 1.75rem;
    }
}

/* === 可访问性优化 === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0047ab;
        --neutral-300: #000000;
        --neutral-600: #000000;
        --neutral-800: #000000;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* === 打印样式优化 === */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a,
    a:visited {
        text-decoration: underline;
    }
    
    #preloader {
        display: none !important;
    }
}

/* === 性能优化 === */
.wrapper {
    overflow-x: hidden;
    contain: layout style paint;
}

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

/* === 工具类 === */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }

.w-full { width: 100%; }
.h-full { height: 100%; }

/* === 自定义间距类保持兼容性 === */
.cmy-5 { margin: var(--space-12) 0; }
.cmt-5 { margin-top: var(--space-12); }
.cmb-5 { margin-bottom: var(--space-12); }
.cpy-5 { padding: var(--space-12) 0; }
.cpt-5 { padding-top: var(--space-12); }
.cpb-5 { padding-bottom: var(--space-12); }

.cmy-6 { margin: var(--space-16) 0; }
.cmt-6 { margin-top: var(--space-16); }
.cmb-6 { margin-bottom: var(--space-16); }
.cpy-6 { padding: var(--space-16) 0; }
.cpt-6 { padding-top: var(--space-16); }
.cpb-6 { padding-bottom: var(--space-16); }

/* 响应式调整 */
@media (max-width: 768px) {
    .cmy-5, .cmy-6 { margin: var(--space-8) 0; }
    .cmt-5, .cmt-6 { margin-top: var(--space-8); }
    .cmb-5, .cmb-6 { margin-bottom: var(--space-8); }
    .cpy-5, .cpy-6 { padding: var(--space-8) 0; }
    .cpt-5, .cpt-6 { padding-top: var(--space-8); }
    .cpb-5, .cpb-6 { padding-bottom: var(--space-8); }
}