/* ==========================================================================
   1. CSS 变量规范
   ========================================================================== */

:root {
  /* --------------------------------------------------------------------
     1.1 颜色变量
     -------------------------------------------------------------------- */
  /* 主色调 */
  --color-primary: #c41e3a;
  --color-primary--dark: #a01830;
  --color-primary--light: #e63950;
  
  /* 中性色 */
  --color-neutral--white: #ffffff;
  --color-neutral--gray-100: #f5f5f5;
  --color-neutral--gray-200: #eeeeee;
  --color-neutral--gray-300: #dddddd;
  --color-neutral--gray-400: #999999;
  --color-neutral--gray-500: #666666;
  --color-neutral--gray-600: #333333;
  --color-neutral--black: #000000;
  
  /* 功能色 */
  --color-functional--success: #28a745;
  --color-functional--warning: #ffc107;
  --color-functional--danger: #dc3545;
  --color-functional--info: #17a2b8;
  
  /* 背景色 */
  --color-bg--body: #f8f8f8;
  --color-bg--card: #ffffff;
  --color-bg--header: #c41e3a;
  --color-bg--footer: #333333;
  
  /* 文本色 */
  --color-text--primary: #333333;
  --color-text--secondary: #666666;
  --color-text--muted: #999999;
  --color-text--inverse: #ffffff;
  
  /* 边框色 */
  --color-border--light: #eeeeee;
  --color-border--default: #dddddd;
  --color-border--dark: #cccccc;
  
  /* 序号背景色 */
  --color-rank--1: #c41e3a;
  --color-rank--2: #e74c3c;
  --color-rank--3: #f39c12;
  --color-rank--default: #999999;

  /* --------------------------------------------------------------------
     1.2 排版变量
     -------------------------------------------------------------------- */
  /* 字体族 */
  --font-family--base: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-family--heading: var(--font-family--base);
  --font-family--mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  
  /* 字号 */
  --font-size--xs: 0.75rem;      /* 12px */
  --font-size--sm: 0.875rem;     /* 14px */
  --font-size--base: 1rem;       /* 16px */
  --font-size--md: 1.125rem;     /* 18px */
  --font-size--lg: 1.25rem;      /* 20px */
  --font-size--xl: 1.5rem;       /* 24px */
  --font-size--2xl: 1.875rem;    /* 30px */
  --font-size--3xl: 2.25rem;     /* 36px */
  
  /* 字重 */
  --font-weight--normal: 400;
  --font-weight--medium: 500;
  --font-weight--semibold: 600;
  --font-weight--bold: 700;
  
  /* 行高 */
  --line-height--tight: 1.25;
  --line-height--base: 1.5;
  --line-height--relaxed: 1.75;

  /* --------------------------------------------------------------------
     1.3 间距变量
     -------------------------------------------------------------------- */
  --space-0: 0;
  --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-7: 2rem;      /* 32px */
  --space-8: 2.5rem;    /* 40px */
  --space-9: 3rem;      /* 48px */
  --space-10: 4rem;     /* 64px */

  /* --------------------------------------------------------------------
     1.4 断点变量
     -------------------------------------------------------------------- */
  --breakpoint-sm: 576px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 992px;
  --breakpoint-xl: 1200px;

  /* --------------------------------------------------------------------
     1.5 容器变量
     -------------------------------------------------------------------- */
  --container-max-width: 1536px;
  --container-padding: var(--space-4);
  --sidebar-width: 450px;

  /* --------------------------------------------------------------------
     1.6 层级变量
     -------------------------------------------------------------------- */
  --z-index--dropdown: 100;
  --z-index--sticky: 200;
  --z-index--fixed: 300;
  --z-index--modal-backdrop: 400;
  --z-index--modal: 500;
  --z-index--tooltip: 600;

  /* --------------------------------------------------------------------
     1.7 效果变量
     -------------------------------------------------------------------- */
  /* 圆角 */
  --radius-sm: 2px;
  --radius-base: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 50%;
  
  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-base: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
  
  /* 过渡 - 仅用于轮播图 */
  --transition-base: 0.3s ease;
}

/* ==========================================================================
   2. CSS 重置规范
   ========================================================================== */

/* 盒模型 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 内外边距重置 */
html,
body,
h1, h2, h3, h4, h5, h6,
p,
blockquote,
pre,
dl, dd,
ol, ul,
figure,
fieldset,
legend,
menu {
  margin: var(--space-0);
  padding: var(--space-0);
}

/* 列表样式 */
ol,
ul,
menu {
  list-style: none;
}

/* 字体重置 */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family--base);
  font-size: var(--font-size--base);
  font-weight: var(--font-weight--normal);
  line-height: var(--line-height--base);
  color: var(--color-text--primary);
  background-color: var(--color-bg--body);
}

/* 表单元素 */
button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: inherit;
  margin: var(--space-0);
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
  cursor: pointer;
}

/* 图片 */
img,
video,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* 链接 */
a {
  color: inherit;
  text-decoration: none;
}

/* 表格 */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ==========================================================================
   3. 基础样式规范
   ========================================================================== */

/* 全局样式 */
html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

/* 通用语义标签样式 */
h1 {
  font-size: var(--font-size--3xl);
  font-weight: var(--font-weight--bold);
  line-height: var(--line-height--tight);
}

h2 {
  font-size: var(--font-size--2xl);
  font-weight: var(--font-weight--bold);
  line-height: var(--line-height--tight);
}

h3 {
  font-size: var(--font-size--xl);
  font-weight: var(--font-weight--semibold);
  line-height: var(--line-height--tight);
}

h4 {
  font-size: var(--font-size--lg);
  font-weight: var(--font-weight--semibold);
  line-height: var(--line-height--tight);
}

h5 {
  font-size: var(--font-size--md);
  font-weight: var(--font-weight--medium);
  line-height: var(--line-height--tight);
}

h6 {
  font-size: var(--font-size--base);
  font-weight: var(--font-weight--medium);
  line-height: var(--line-height--tight);
}

p {
  margin-bottom: var(--space-4);
}

p:last-child {
  margin-bottom: var(--space-0);
}

strong,
b {
  font-weight: var(--font-weight--bold);
}

em,
i {
  font-style: italic;
}

small {
  font-size: var(--font-size--sm);
}

/* 容器样式 */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

/* 主内容区域 */
.main-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
}

@media (min-width: 992px) {
  .main-wrapper {
    flex-direction: row;
  }
  
  .main-wrapper__content {
    flex: 1;
    min-width: 0;
  }
  
  .main-wrapper__sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
  }
}

/* ==========================================================================
   4. 响应式工具类规范
   ========================================================================== */

/* 显示隐藏类 */
.u-hidden {
  display: none !important;
}

.u-visible {
  display: block !important;
}

/* 移动端显示，桌面端隐藏 */
.u-hidden--lg {
  display: block;
}

@media (min-width: 992px) {
  .u-hidden--lg {
    display: none !important;
  }
}

/* 桌面端显示，移动端隐藏 */
.u-visible--lg {
  display: none;
}

@media (min-width: 992px) {
  .u-visible--lg {
    display: block !important;
  }
}

/* 中屏以下隐藏 */
.u-hidden--md {
  display: block;
}

@media (min-width: 768px) {
  .u-hidden--md {
    display: none !important;
  }
}

/* 中屏以上显示 */
.u-visible--md {
  display: none;
}

@media (min-width: 768px) {
  .u-visible--md {
    display: block !important;
  }
}

/* 文本对齐类 */
.u-text-left {
  text-align: left !important;
}

.u-text-center {
  text-align: center !important;
}

.u-text-right {
  text-align: right !important;
}

/* 间距工具类 */
.u-mt-0 { margin-top: var(--space-0) !important; }
.u-mt-4 { margin-top: var(--space-4) !important; }
.u-mt-6 { margin-top: var(--space-6) !important; }
.u-mt-8 { margin-top: var(--space-8) !important; }

.u-mb-0 { margin-bottom: var(--space-0) !important; }
.u-mb-4 { margin-bottom: var(--space-4) !important; }
.u-mb-6 { margin-bottom: var(--space-6) !important; }
.u-mb-8 { margin-bottom: var(--space-8) !important; }

.u-pt-0 { padding-top: var(--space-0) !important; }
.u-pt-4 { padding-top: var(--space-4) !important; }
.u-pt-6 { padding-top: var(--space-6) !important; }

.u-pb-0 { padding-bottom: var(--space-0) !important; }
.u-pb-4 { padding-bottom: var(--space-4) !important; }
.u-pb-6 { padding-bottom: var(--space-6) !important; }

/* 浮动清除类 */
.u-clearfix::after {
  content: "";
  display: table;
  clear: both;
}

/* 文本截断 */
.u-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.u-line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.u-line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.u-line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 图片裁剪 */
.u-img-cover {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* 屏幕阅读器专用 */
.u-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;
}
