/* ═══════════════════════════════════════════
   Theme — 共享 CSS 变量与基础样式
   用于 xoyo168.com 全站统一视觉
   ═══════════════════════════════════════════ */

/* ── CSS 自定义属性 ──────────── */
:root {
  /* 品牌色 */
  --primary: #2563eb;
  --primary-light: #eff6ff;
  --primary-dark: #1d4ed8;
  --primary-bg: #eff6ff;

  /* 辅助色 */
  --accent: #f59e0b;
  --accent-light: #fef3c7;
  --success: #10b981;
  --success-light: #ecfdf5;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --info: #6366f1;
  --info-light: #eef2ff;

  /* 中性色 */
  --white: #ffffff;
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --body-bg: #e0e4ec;
  --card-bg: #ffffff;

  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-input: #cbd5e1;

  /* 间距 */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.12);

  /* 字体 */
  --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* ── 暗色主题 ──────────── */
[data-theme='dark'] {
  --primary: #818cf8;
  --primary-light: #1e1b4b;
  --primary-dark: #6366f1;
  --primary-bg: #1e1b4b;

  --accent: #fbbf24;
  --accent-light: #422006;
  --success: #34d399;
  --success-light: #064e3b;
  --danger: #f87171;
  --danger-light: #450a0a;
  --info: #a5b4fc;
  --info-light: #1e1b4b;

  --white: #1e293b;
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --body-bg: #020617;
  --card-bg: #1e293b;

  --text: #e2e8f0;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;

  --border: #334155;
  --border-light: #1e293b;
  --border-input: #475569;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.6);
}

/* ── 基础重置 ──────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-system);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover {
  color: var(--primary-dark);
}

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

/* ── 共享卡片基础 ──────────── */
.theme-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: transform 0.2s, box-shadow 0.2s;
  height: 100%;
}
.theme-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.theme-card--clickable {
  cursor: pointer;
  display: block;
  color: inherit;
  text-decoration: none;
}
.theme-card--clickable:hover {
  color: inherit;
  border-color: var(--primary);
}

.theme-card__cover {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.theme-card__title {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--text);
  margin: 0;
}

.theme-card__desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 0.35rem 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.theme-card__meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
}

.theme-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.theme-card__tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-alt);
  color: var(--text-muted);
}

/* ── 共享按钮 ──────────── */
.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.theme-btn--primary {
  background: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}
.theme-btn--primary:hover {
  background: var(--primary-dark);
  color: var(--text-inverse);
}

.theme-btn--outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.theme-btn--outline:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.theme-btn--sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
}

.theme-btn--block {
  width: 100%;
}

/* ── 共享标签/徽章 ──────────── */
.theme-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  line-height: 1.4;
}

.theme-badge--primary {
  background: var(--primary-light);
  color: var(--primary);
}

.theme-badge--accent {
  background: var(--accent-light);
  color: var(--accent);
}

.theme-badge--success {
  background: var(--success-light);
  color: var(--success);
}

.theme-badge--danger {
  background: var(--danger-light);
  color: var(--danger);
}

/* ── 共享表格基础 ──────────── */
.theme-table {
  width: 100%;
  border-collapse: collapse;
}
.theme-table th,
.theme-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.theme-table th {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.theme-table tbody tr:hover {
  background: var(--bg-alt);
}

/* ── 节标题 ──────────── */
.theme-section-title {
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.theme-section-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ── 工具提示 ──────────── */
.theme-tooltip {
  position: relative;
}
.theme-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.3rem 0.6rem;
  background: var(--text);
  color: var(--text-inverse);
  font-size: 0.75rem;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.theme-tooltip:hover::after {
  opacity: 1;
}

/* ── 辅助工具类 ──────────── */
.theme-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.theme-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
