/* ============================================================
   Helio Design System - 应用到 helio-redesign 目录
   基于 helio-design-system.md 规范
   原则：间距保持原版不变，只换配色 / 字体 / 圆角 / 阴影 / 边框样式
   ============================================================ */

/* ---------- 1. 设计令牌 (Design Tokens) ---------- */
:root {
  /* 核心色彩 - 浅色模式 */
  --canvas: #f5f3ee;
  --ink: #14110e;
  --accent: #f87500;
  --accent-rgb: 249, 115, 22;

  /* 语义色 */
  --info: #739dc5;
  --success: #6aa97b;
  --warning: #e48c4a;
  --destructive: #ff654a;

  /* 文字层级（基于 ink 的不透明度） */
  --text-primary: var(--ink);
  --text-secondary: rgba(20, 17, 14, 0.70);
  --text-tertiary: rgba(20, 17, 14, 0.50);
  --text-placeholder: rgba(20, 17, 14, 0.30);
  --text-on-accent: #fcfaf6;
  --text-on-destructive: #fcfaf6;

  /* 边框与表面 */
  --border: rgba(20, 17, 14, 0.12);
  --border-strong: rgba(20, 17, 14, 0.20);
  --paper: rgba(20, 17, 14, 0.03);
  --paper-mid: rgba(20, 17, 14, 0.06);
  --hover: rgba(20, 17, 14, 0.04);

  /* 标签柔和背景（用于嘌呤交通灯徽章） */
  --label-red-soft: #4d2526;
  --label-amber-soft: #443210;
  --label-green-soft: #1c3d2c;

  /* 营销页专属色 */
  --marketing-border-subtle: rgba(0, 0, 0, 0.06);
  --marketing-nav-backdrop: rgba(245, 243, 238, 0.85);
  --marketing-shadow-card: 0 14px 40px rgba(0, 0, 0, 0.12);
  --marketing-shadow-card-hover: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 10px -4px rgba(0, 0, 0, 0.08);

  /* 字体家族（Helio 风格） */
  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;

  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-pill: 9999px;

  /* 阴影 */
  --shadow-minimal: 0 0 0 1px rgba(20, 17, 14, 0.09), 0 1px 1px -0.5px rgba(0, 0, 0, 0.14);
  --shadow-panel: 0 0 0 1px rgba(20, 17, 14, 0.12), 0 1px 1px -0.5px rgba(0, 0, 0, 0.14), 0 3px 3px -1.5px rgba(0, 0, 0, 0.14);
  --shadow-drop-panel: 0 1px 2px 0 rgba(0, 0, 0, 0.11), 0 4px 12px -4px rgba(0, 0, 0, 0.13);

  /* 动效 */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 0.1s;
  --dur-base: 0.15s;
}

/* ---------- 2. 全局基础：只换色，不改布局 ---------- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
}

body {
  background-color: var(--canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 覆盖原 Tailwind 冷色调 body 类 */
body.bg-white { background-color: var(--canvas) !important; }
body.text-gray-900 { color: var(--text-primary) !important; }

/* ---------- 3. 排版：换字族和颜色，不改间距 ---------- */
.helio-display,
h1.helio-h1,
h2.helio-h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.helio-eyebrow {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.helio-lead {
  color: var(--text-secondary);
}

.helio-text-secondary { color: var(--text-secondary); }
.helio-text-tertiary  { color: var(--text-tertiary); }

/* ---------- 4. 导航栏：换色 + 毛玻璃，间距沿用原版 py-5 ---------- */
.helio-header {
  background-color: var(--marketing-nav-backdrop);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--marketing-border-subtle);
  position: sticky;
  top: 0;
  z-index: 30;
}

/* 覆盖原版 header 的 border-gray-100 */
.helio-redesign header.border-b.border-gray-100 {
  border-color: var(--marketing-border-subtle) !important;
}

/* 导航栏间距 - 与原版 gap-6 一致 */
.helio-nav {
  gap: 24px;
}

.helio-logo-mark {
  width: 36px;
  height: 36px;
  background: var(--ink);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--canvas);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  position: relative;
}

.helio-logo-mark::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: var(--radius-pill);
  border: 2px solid var(--canvas);
}

.helio-brand-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.helio-brand-subtitle {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

.helio-nav-link {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--dur-fast) var(--ease-standard);
  position: relative;
  padding: 4px 0;
  display: inline-block;
}

.helio-nav-link:hover {
  color: var(--text-primary);
}

.helio-nav-link.is-active {
  color: var(--text-primary);
}

.helio-nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: var(--accent);
  border-radius: var(--radius-pill);
}

/* 覆盖原 i18n.js 添加的 text-green-600 类（保持 Helio 橙色调性） */
.helio-header [data-lang].text-green-600,
.helio-header .text-green-600 {
  color: var(--accent) !important;
}

.helio-lang-toggle {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  transition: all var(--dur-fast) var(--ease-standard);
}

.helio-lang-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.helio-lang-menu {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-drop-panel);
  padding: 6px;
  min-width: 180px;
}

.helio-lang-menu a {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--dur-fast) var(--ease-standard);
}

.helio-lang-menu a:hover {
  background: var(--hover);
  color: var(--text-primary);
}

.helio-lang-menu .border-t {
  border-color: var(--border) !important;
  margin: 4px 0 !important;
}

/* ---------- 5. 按钮：换色 + pill 形状，高度与原版相近 ---------- */
.helio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-standard);
  white-space: nowrap;
  text-decoration: none;
}

.helio-btn-primary {
  background: var(--ink);
  color: var(--canvas);
}

.helio-btn-primary:hover {
  background: var(--accent);
  color: var(--text-on-accent);
}

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

.helio-btn-secondary:hover {
  background: var(--hover);
  border-color: var(--ink);
}

.helio-btn-accent {
  background: var(--accent);
  color: var(--text-on-accent);
}

.helio-btn-accent:hover {
  background: #d96500;
}

/* ---------- 6. 卡片：换圆角/阴影/色，padding 沿用原版 ---------- */
.helio-card {
  background: var(--canvas);
  border: 1px solid var(--marketing-border-subtle);
  border-radius: var(--radius-xl);
  transition: all var(--dur-base) var(--ease-standard);
}

.helio-card-interactive:hover {
  box-shadow: var(--marketing-shadow-card-hover);
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.helio-card-soft {
  background: var(--paper);
  border-color: var(--border);
}

.helio-card-accent {
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.06) 0%, rgba(249, 115, 22, 0.02) 100%);
  border: 1px solid rgba(249, 115, 22, 0.18);
}

.helio-feature-card .helio-feature-emoji {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 8px;
}

.helio-feature-card .helio-feature-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.005em;
}

.helio-card-arrow {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform var(--dur-base) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}

.helio-card-interactive:hover .helio-card-arrow {
  color: var(--accent);
  transform: translateX(2px);
}

/* ---------- 7. 搜索框：换色，高度沿用原版（~50px） ---------- */
.helio-search-wrap {
  position: relative;
}

.helio-search-input {
  width: 100%;
  background: var(--canvas);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  color: var(--text-primary);
  transition: all var(--dur-base) var(--ease-standard);
  box-shadow: var(--shadow-minimal);
  padding: 12px 20px 12px 56px;
  font-size: 16px;
  line-height: 1.5;
}

.helio-search-input::placeholder {
  color: var(--text-placeholder);
}

.helio-search-input:focus {
  outline: none;
  border-color: var(--ink) !important;
  box-shadow: 0 0 0 4px rgba(20, 17, 14, 0.06) !important;
}

.helio-search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.helio-search-results {
  position: absolute;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-drop-panel);
  overflow: hidden;
  z-index: 50;
}

.helio-search-results a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease-standard);
}

.helio-search-results a:last-child {
  border-bottom: none;
}

.helio-search-results a:hover {
  background: var(--hover);
}

.helio-search-results .helio-result-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ---------- 8. 交通灯徽章：换色，尺寸沿用原版 ---------- */
.helio-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  letter-spacing: 0.01em;
}

.helio-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
}

.helio-badge-low {
  background: var(--label-green-soft);
  color: #a8d4b8;
}

.helio-badge-low .helio-badge-dot { background: var(--success); }

.helio-badge-medium {
  background: var(--label-amber-soft);
  color: #e8c89a;
}

.helio-badge-medium .helio-badge-dot { background: var(--warning); }

.helio-badge-high {
  background: var(--label-red-soft);
  color: #e8a59c;
}

.helio-badge-high .helio-badge-dot { background: var(--destructive); }

/* ---------- 9. 全局颜色覆盖（helio-redesign 上下文） ---------- */
/* 覆盖 JS 动态生成和静态 Tailwind 类的冷色调
   间距/尺寸完全不动，只换颜色 */

.helio-redesign .bg-green-100 { background-color: var(--label-green-soft) !important; }
.helio-redesign .bg-green-50  { background-color: rgba(106, 169, 123, 0.10) !important; }
.helio-redesign .text-green-700,
.helio-redesign .text-green-600 { color: var(--success) !important; }
.helio-redesign .hover\:bg-green-100:hover { background-color: rgba(106, 169, 123, 0.18) !important; }
.helio-redesign .hover\:bg-green-200:hover { background-color: rgba(106, 169, 123, 0.22) !important; }
.helio-redesign .hover\:text-green-600:hover { color: var(--success) !important; }
.helio-redesign .hover\:text-green-700:hover { color: var(--success) !important; }
.helio-redesign .hover\:border-green-500:hover { border-color: var(--success) !important; }
.helio-redesign .focus\:border-green-500:focus { border-color: var(--ink) !important; }
.helio-redesign .focus\:ring-green-500:focus { box-shadow: 0 0 0 3px rgba(20, 17, 14, 0.06) !important; }

.helio-redesign .bg-yellow-100 { background-color: var(--label-amber-soft) !important; }
.helio-redesign .text-yellow-700,
.helio-redesign .text-yellow-800 { color: #e8c89a !important; }
.helio-redesign .hover\:bg-yellow-200:hover { background-color: rgba(228, 140, 74, 0.22) !important; }

.helio-redesign .bg-red-100 { background-color: var(--label-red-soft) !important; }
.helio-redesign .text-red-700 { color: #e8a59c !important; }
.helio-redesign .hover\:bg-red-200:hover { background-color: rgba(255, 101, 74, 0.22) !important; }

.helio-redesign .bg-blue-50  { background-color: rgba(115, 157, 197, 0.10) !important; }
.helio-redesign .hover\:bg-blue-100:hover { background-color: rgba(115, 157, 197, 0.18) !important; }

.helio-redesign .bg-amber-50 { background-color: rgba(248, 117, 0, 0.06) !important; }
.helio-redesign .border-amber-200 { border-color: rgba(248, 117, 0, 0.20) !important; }
.helio-redesign .text-amber-900 { color: var(--text-primary) !important; }
.helio-redesign .text-amber-700 { color: var(--accent) !important; }
.helio-redesign .bg-amber-600 { background-color: var(--accent) !important; }
.helio-redesign .hover\:bg-amber-700:hover { background-color: #d96500 !important; }

.helio-redesign .bg-blue-600 { background-color: var(--ink) !important; }
.helio-redesign .text-blue-600 { color: var(--accent) !important; }

.helio-redesign .bg-gray-50 { background-color: var(--paper) !important; }
.helio-redesign .bg-gray-100 { background-color: var(--paper-mid) !important; }
.helio-redesign .border-gray-100 { border-color: var(--border) !important; }
.helio-redesign .border-gray-200 { border-color: var(--border-strong) !important; }
.helio-redesign .divide-gray-100 > * + * { border-color: var(--border) !important; }
.helio-redesign .text-gray-900 { color: var(--text-primary) !important; }
.helio-redesign .text-gray-700 { color: var(--text-secondary) !important; }
.helio-redesign .text-gray-600 { color: var(--text-secondary) !important; }
.helio-redesign .text-gray-500 { color: var(--text-secondary) !important; }
.helio-redesign .text-gray-400 { color: var(--text-tertiary) !important; }
.helio-redesign .placeholder-gray-400::placeholder { color: var(--text-placeholder) !important; }
.helio-redesign .hover\:text-gray-900:hover { color: var(--text-primary) !important; }
.helio-redesign .hover\:bg-gray-50:hover { background-color: var(--hover) !important; }
.helio-redesign .hover\:border-gray-200:hover { border-color: var(--border-strong) !important; }

/* ---------- 10. 图例：只换色，间距沿用原版 ---------- */
.helio-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.helio-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
}

/* ---------- 11. 表格：只换色，padding 沿用原版 ---------- */
.helio-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.helio-table thead th {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  text-align: left;
}

.helio-table tbody td {
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  padding-top: 16px;
  padding-bottom: 16px;
}

.helio-table tbody tr {
  transition: background var(--dur-fast) var(--ease-standard);
}

.helio-table tbody tr:hover {
  background: var(--hover);
}

.helio-table a {
  color: var(--text-primary);
  font-weight: 500;
  transition: color var(--dur-fast) var(--ease-standard);
}

.helio-table a:hover {
  color: var(--accent);
}

/* ---------- 12. 表单控件：只换色，高度沿用原版 ---------- */
.helio-input {
  background: var(--canvas);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  color: var(--text-primary);
  transition: all var(--dur-fast) var(--ease-standard);
}

.helio-input::placeholder { color: var(--text-placeholder); }

.helio-input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20, 17, 14, 0.06);
}

.helio-select {
  background: var(--canvas);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2314110e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.helio-filter-btn {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-standard);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.helio-filter-btn:hover {
  border-color: var(--ink);
  color: var(--text-primary);
}

.helio-filter-btn.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--canvas);
}

/* ---------- 13. Footer：换色，间距沿用原版 ---------- */
.helio-footer {
  background: var(--canvas);
  border-top: 1px solid var(--border);
  padding-top: 32px;
  padding-bottom: 32px;
  padding-left: 24px;
  padding-right: 24px;
}

.helio-footer .max-w-4xl {
  max-width: 56rem;
  margin-left: auto;
  margin-right: auto;
}

.helio-footer-link {
  font-size: 14px;
  color: var(--text-secondary);
  transition: color var(--dur-fast) var(--ease-standard);
}

.helio-footer-link:hover {
  color: var(--accent);
}

.helio-footer-notice {
  font-size: 14px;
  color: var(--text-tertiary);
  text-align: center;
}

/* ---------- 14. 圆角统一（helio-redesign 上下文） ---------- */
/* 只覆盖圆角，不改尺寸 */
.helio-redesign .rounded-full { border-radius: var(--radius-pill) !important; }
.helio-redesign .rounded-lg { border-radius: var(--radius-lg) !important; }
.helio-redesign .rounded-md { border-radius: var(--radius-md) !important; }

/* 原 card 类（rounded-xl）用更大的 16px 圆角（Helio 风格） */
.helio-redesign .rounded-xl { border-radius: var(--radius-2xl) !important; }

/* ---------- 15. Breadcrumb 面包屑导航 ---------- */
.helio-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}
.helio-breadcrumb a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.15s ease;
}
.helio-breadcrumb a:hover {
  color: var(--accent);
}
.helio-breadcrumb-sep {
  color: var(--text-tertiary);
  opacity: 0.5;
  user-select: none;
}
.helio-breadcrumb-current {
  color: var(--text-secondary);
  font-weight: 500;
}

/* ---------- 16. 白色主题配色（Pure White Theme） ---------- */
/* 切换方式：给 html 添加 data-theme="white" 属性 */
:root[data-theme="white"],
html[data-theme="white"] {
  /* 核心色 - 纯白背景 */
  --canvas: #ffffff;
  --ink: #14110e;
  --accent: #f87500;
  --accent-rgb: 249, 115, 22;

  /* 语义色 - 适配白底 */
  --info: #3b82f6;
  --success: #22c55e;
  --warning: #f59e0b;
  --destructive: #ef4444;

  /* 文字层级 */
  --text-primary: var(--ink);
  --text-secondary: rgba(20, 17, 14, 0.70);
  --text-tertiary: rgba(20, 17, 14, 0.50);
  --text-placeholder: rgba(20, 17, 14, 0.35);
  --text-on-accent: #ffffff;
  --text-on-destructive: #ffffff;

  /* 边框与表面 */
  --border: rgba(20, 17, 14, 0.10);
  --border-strong: rgba(20, 17, 14, 0.20);
  --paper: rgba(20, 17, 14, 0.02);
  --paper-mid: rgba(20, 17, 14, 0.05);
  --hover: rgba(20, 17, 14, 0.04);

  /* 营销页专属色 - 白色主题微调 */
  --marketing-border-subtle: rgba(0, 0, 0, 0.05);
  --marketing-nav-backdrop: rgba(255, 255, 255, 0.90);
}

/* 白色主题下直接强制覆盖 body 背景色，防止变量覆盖失效 */
html[data-theme="white"] body,
html[data-theme="white"] body.bg-white {
  background-color: #ffffff !important;
}

/* ---------- 17. 主题切换按钮 ---------- */
.helio-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--dur-fast), border-color var(--dur-fast), background-color var(--dur-fast);
}
.helio-theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--hover);
}
.helio-theme-toggle svg {
  width: 16px;
  height: 16px;
}
