/**
 * 导潮广州 - 基础样式表
 * CSS变量定义（广州专属配色）、全局reset、布局工具类、响应式断点
 * @author Kou (寇豆码)
 */

/* ===== CSS变量定义（广州专属配色） ===== */
:root {
  /* 主色系 */
  --color-primary: #1A6B8E;          /* 珠江青蓝（主色） */
  --color-primary-light: #2E94B0;    /* 珠江青蓝（浅） */
  --color-primary-dark: #0F4C66;     /* 珠江青蓝（深） */
  --color-bg: #F5F1E8;               /* 羊城米白（页面背景） */
  --color-bg-alt: #EDE8DC;           /* 羊城米白（次级背景） */
  --color-accent: #C23B22;           /* 岭南朱红（点缀） */
  --color-accent-light: #E55D3E;     /* 岭南朱红（浅） */
  --color-text: #2C3E50;             /* 云山墨青（正文） */
  --color-text-light: #7F8C8D;       /* 云山墨青（次要文字） */
  --color-link: #7FB3D5;             /* 珠水浅蓝（链接） */
  --color-border: #D5CDB8;           /* 边框色（米白系） */
  --color-white: #FFFFFF;
  --color-black: #000000;
  --color-success: #27AE60;
  --color-warning: #F39C12;
  --color-error: #E74C3C;

  /* 渐变 */
  --gradient-primary: linear-gradient(135deg, #1A6B8E 0%, #2E94B0 100%);
  --gradient-hero: linear-gradient(135deg, #1A6B8E 0%, #2E94B0 60%, #C23B22 100%);
  --gradient-accent: linear-gradient(135deg, #C23B22 0%, #E55D3E 100%);
  --gradient-bg: linear-gradient(180deg, #F5F1E8 0%, #EDE8DC 100%);

  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(26, 107, 142, 0.08);
  --shadow-md: 0 4px 12px rgba(26, 107, 142, 0.12);
  --shadow-lg: 0 8px 24px rgba(26, 107, 142, 0.16);
  --shadow-xl: 0 16px 48px rgba(26, 107, 142, 0.20);

  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* 间距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;
  --space-3xl: 96px;

  /* 字体 */
  --font-serif: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  --font-sans: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Fira Code', 'Consolas', 'Courier New', monospace;

  /* 字号 */
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-base: 16px;
  --fs-md: 18px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: 32px;
  --fs-3xl: 48px;
  --fs-4xl: 64px;

  /* 行高 */
  --lh-tight: 1.2;
  --lh-normal: 1.5;
  --lh-relaxed: 1.75;

  /* 过渡 */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* 布局 */
  --header-height: 64px;
  --footer-height: 200px;
  --container-max: 1200px;
  --sidebar-width: 280px;
}

/* ===== 全局Reset ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--color-primary-dark);
}

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

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary);
}

a:active {
  color: var(--color-primary-dark);
}

ul, ol {
  list-style: none;
}

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

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-alt);
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary-light);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* ===== 选中文本样式 ===== */
::selection {
  background: var(--color-primary);
  color: var(--color-white);
}

/* ===== 布局工具类 ===== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-fluid {
  width: 100%;
  padding: 0 var(--space-lg);
}

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.flex-start {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.flex-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-1 {
  flex: 1;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-start {
  justify-content: flex-start;
}

.justify-end {
  justify-content: flex-end;
}

.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

/* 间距工具类 */
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.pt-xs { padding-top: var(--space-xs); }
.pt-sm { padding-top: var(--space-sm); }
.pt-md { padding-top: var(--space-md); }
.pt-lg { padding-top: var(--space-lg); }
.pt-xl { padding-top: var(--space-xl); }
.pt-2xl { padding-top: var(--space-2xl); }

.pb-xs { padding-bottom: var(--space-xs); }
.pb-sm { padding-bottom: var(--space-sm); }
.pb-md { padding-bottom: var(--space-md); }
.pb-lg { padding-bottom: var(--space-lg); }
.pb-xl { padding-bottom: var(--space-xl); }
.pb-2xl { padding-bottom: var(--space-2xl); }

.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

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

.text-primary { color: var(--color-primary); }
.text-accent { color: var(--color-accent); }
.text-light { color: var(--color-text-light); }
.text-white { color: var(--color-white); }

.fs-xs { font-size: var(--fs-xs); }
.fs-sm { font-size: var(--fs-sm); }
.fs-base { font-size: var(--fs-base); }
.fs-md { font-size: var(--fs-md); }
.fs-lg { font-size: var(--fs-lg); }
.fs-xl { font-size: var(--fs-xl); }
.fs-2xl { font-size: var(--fs-2xl); }
.fs-3xl { font-size: var(--fs-3xl); }

.fw-normal { font-weight: 400; }
.fw-medium { font-weight: 500; }
.fw-bold { font-weight: 700; }

.font-serif { font-family: var(--font-serif); }
.font-sans { font-family: var(--font-sans); }

/* 显示/隐藏 */
.d-none { display: none !important; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }

/* 定位 */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* 圆角 */
.radius-sm { border-radius: var(--radius-sm); }
.radius-md { border-radius: var(--radius-md); }
.radius-lg { border-radius: var(--radius-lg); }
.radius-full { border-radius: var(--radius-full); }

/* 阴影 */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* 渐变背景 */
.bg-primary { background: var(--gradient-primary); }
.bg-hero { background: var(--gradient-hero); }
.bg-accent { background: var(--gradient-accent); }
.bg-white { background: var(--color-white); }
.bg-alt { background: var(--color-bg-alt); }

/* 溢出 */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

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

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

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

/* ===== 响应式断点 ===== */

/* 平板（≤1024px） */
@media (max-width: 1024px) {
  :root {
    --fs-3xl: 36px;
    --fs-2xl: 28px;
    --fs-xl: 22px;
    --space-2xl: 48px;
    --space-3xl: 72px;
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .container {
    padding: 0 var(--space-md);
  }

  .d-none-tablet { display: none !important; }
  .d-block-tablet { display: block !important; }
}

/* 手机（≤768px） */
@media (max-width: 768px) {
  :root {
    --fs-4xl: 40px;
    --fs-3xl: 28px;
    --fs-2xl: 24px;
    --fs-xl: 20px;
    --space-2xl: 32px;
    --space-3xl: 48px;
    --header-height: 56px;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 0 var(--space-md);
  }

  .container-fluid {
    padding: 0 var(--space-sm);
  }

  .flex-col-mobile {
    flex-direction: column;
  }

  .d-none-mobile { display: none !important; }
  .d-block-mobile { display: block !important; }
  .text-center-mobile { text-align: center; }

  h1 { font-size: var(--fs-2xl); }
  h2 { font-size: var(--fs-xl); }
}

/* 大屏（≥1200px） */
@media (min-width: 1200px) {
  .d-none-desktop { display: none !important; }
  .d-block-desktop { display: block !important; }
}

/* ===== 动画基础类 ===== */
.fade-in {
  animation: fadeIn var(--transition-normal) ease forwards;
}

.fade-in-up {
  animation: fadeInUp var(--transition-slow) ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== 通用按钮样式（基础） ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 24px;
  font-size: var(--fs-base);
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== 可访问性 ===== */
.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;
}

:focus-visible {
  outline: 2px solid var(--color-primary-light);
  outline-offset: 2px;
}
