/* =========================================================
   鹧鸪天维修 · base.css
   设计 tokens（来自 design-spec §2–§4）+ reset + 全局排版 + 通用组件
   数值严格照 design-spec，不增不减、不改色值
   ========================================================= */

/* ---------- 2. 色彩系统 tokens ---------- */
:root {
  /* 主色：江水蓝 */
  --primary: #1a5f7a;
  --primary-600: #134a60;
  --primary-700: #0f3d5c;
  --primary-50: #e8f1f5;
  --primary-100: #cfe3ec;

  /* 强调色：赭橙 / 山鹧鸪暖橙 */
  --accent: #e07b39;
  --accent-hover: #cf6a2c;
  --accent-active: #b8541a;
  --accent-50: #fdf1dc;

  /* 辅助品牌色：竹绿 */
  --bamboo: #3f7d4f;
  --bamboo-50: #e9f2ea;
  --bamboo-700: #2e6b45;

  /* 中性色阶：暖灰 */
  --neutral-50: #faf8f5;
  --neutral-100: #f3efe9;
  --neutral-200: #e7e0d6;
  --neutral-300: #d6cdbf;
  --neutral-400: #a89e8e;
  --neutral-500: #7d7468;
  --neutral-600: #5c554c;
  --neutral-700: #423d36;
  --neutral-800: #2c2823;
  --neutral-900: #1c1916;

  /* 语义色 */
  --success-text: #1f5e3a;  --success-bg: #e6f4ea;  --success-border: #2e7d4f;
  --warning-text: #8a5a00;  --warning-bg: #fdf1dc;  --warning-border: #b9770a;
  --danger-text:  #922b21;  --danger-bg:  #fbe9e7;  --danger-border:  #c0392b;
  --info-text:    #1a5f7a;  --info-bg:    #e8f1f5;  --info-border:    #cfe3ec;

  --footer-bg: #11344a;

  /* ---------- 3. 字体阶梯 ---------- */
  --font-sans: "PingFang SC","Hiragino Sans GB","Microsoft YaHei","Source Han Sans SC","Noto Sans CJK SC",sans-serif;
  --font-display: "Yuanti SC","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;

  /* ---------- 4. 间距 / 栅格 / 圆角 / 阴影 ---------- */
  --maxw: 1200px;
  --prose: 720px;
  --nav-h: 64px;

  --r-card: 16px;
  --r-btn: 12px;
  --r-input: 10px;
  --r-chip: 999px;
  --r-hero: 24px;

  --shadow-card: 0 4px 16px rgba(28,25,22,0.06);
  --shadow-card-hover: 0 8px 28px rgba(28,25,22,0.10);
  --shadow-box: 0 16px 40px rgba(11,28,44,0.45);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--neutral-800);
  background: var(--neutral-50);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
ul { list-style: none; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }

/* ---------- 3. 标题阶梯（H1/H2 用 display 圆体）---------- */
h1, h2 { font-family: var(--font-display); color: var(--neutral-900); font-weight: 700; letter-spacing: 0; }
h1 { font-size: 48px; line-height: 1.15; }
h2 { font-size: 36px; line-height: 1.2; }
h3 { font-size: 24px; line-height: 1.3; font-weight: 600; color: var(--neutral-800); }
h4 { font-size: 20px; line-height: 1.4; font-weight: 600; color: var(--neutral-800); }
p { font-size: 16px; line-height: 1.75; }
.lead { font-size: 18px; line-height: 1.75; color: var(--neutral-600); }
small, .aux { font-size: 14px; line-height: 1.6; }
.tiny { font-size: 12px; line-height: 1.5; font-weight: 500; }

/* ---------- 布局工具 ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.prose { max-width: var(--prose); }
.section { padding-top: 96px; padding-bottom: 96px; }
.section.alt { background: var(--neutral-100); }
.center { text-align: center; }
.section-title { text-align: center; margin-bottom: 16px; }
.section-intro { text-align: center; max-width: 720px; margin: 0 auto 48px; color: var(--neutral-600); font-size: 17px; }
.section-closing { text-align: center; font-family: var(--font-display); font-size: 26px; color: var(--neutral-900); margin-top: 32px; }

/* ---------- 9. 无障碍：skip-link / 焦点态 ---------- */
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 2000;
  background: var(--primary); color: #fff; padding: 10px 16px;
  border-radius: 8px; font-weight: 600; transition: top .2s ease;
}
.skip-link:focus { top: 16px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.btn-accent:focus-visible { outline-color: var(--accent); }
.btn-outline:focus-visible { outline-color: var(--primary); }

/* ---------- 5.1 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 28px; border-radius: var(--r-btn);
  font-size: 16px; font-weight: 600; line-height: 1; cursor: pointer;
  border: 1.5px solid transparent; transition: background .2s ease, transform .1s ease, box-shadow .2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 8px 16px; font-size: 14px; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-primary:active { background: var(--primary-700); }
.btn-primary:disabled { background: var(--primary-100); color: var(--neutral-500); cursor: not-allowed; }

.btn-accent { background: var(--accent); color: var(--neutral-900); min-height: 52px; padding: 14px 32px; font-size: 17px; font-weight: 700; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-accent:active { background: var(--accent-active); }
.btn-accent:disabled { background: #f0d9c4; color: #8a7a6a; cursor: not-allowed; }

.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-50); }
.btn-outline:active { background: var(--primary-100); }
.btn-outline:disabled { border-color: var(--neutral-300); color: var(--neutral-400); cursor: not-allowed; }

.btn-text { background: none; border: none; color: var(--primary); font-weight: 500; cursor: pointer; padding: 8px 4px; font-size: 16px; min-height: auto; }
.btn-text:hover { text-decoration: underline; }

/* ---------- 5.2 通用卡片 ---------- */
.card {
  background: #fff; border: 1px solid var(--neutral-200); border-radius: var(--r-card);
  padding: 24px; box-shadow: var(--shadow-card);
  transition: box-shadow .25s ease, transform .25s ease;
}
.card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-4px); }

/* ---------- 5.3 徽标 chip ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-chip); padding: 4px 12px; font-size: 13px; font-weight: 600; }
.chip-accent { background: var(--accent-50); color: var(--warning-text); }
.chip-blue { background: var(--primary-50); color: var(--primary); }
.chip-green { background: var(--bamboo-50); color: var(--bamboo); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

/* ---------- 5.4 输入框 / 文本域 ---------- */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.field > label { font-size: 14px; font-weight: 600; color: var(--neutral-700); }
.field .req { color: var(--danger-text); margin-left: 2px; }
input, textarea, select {
  width: 100%; background: #fff; border: 1px solid var(--neutral-300);
  border-radius: var(--r-input); padding: 12px 14px; font-size: 16px;
  color: var(--neutral-800); font-family: inherit; line-height: 1.4;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,95,122,0.18); }
textarea { min-height: 96px; resize: vertical; }
::placeholder { color: var(--neutral-500); }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--danger-border); box-shadow: 0 0 0 3px rgba(192,57,43,0.15); }
.field-error { display: none; color: var(--danger-text); font-size: 13px; line-height: 1.5; }
.field.invalid .field-error { display: flex; align-items: flex-start; gap: 4px; }
.field-error::before { content: "✕"; font-weight: 700; flex: none; }
.input-with-btn { display: flex; gap: 8px; align-items: stretch; }
.input-with-btn input { flex: 1; }

/* ---------- 5.10 提示 Alert ---------- */
.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px;
  border-radius: var(--r-input); font-size: 14px; line-height: 1.5;
  border-left: 4px solid; margin-bottom: 16px;
}
.alert::before { font-weight: 700; flex: none; }
.alert-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.alert-success::before { content: "✓"; }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-border); }
.alert-warning::before { content: "!"; }
.alert-danger { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-border); }
.alert-danger::before { content: "✕"; }
.alert-info { background: var(--info-bg); color: var(--info-text); border-color: var(--info-border); }
.alert-info::before { content: "i"; }
.alert[hidden] { display: none; }

/* ---------- 6. 吉祥物台词气泡 ---------- */
.mascot-bubble {
  display: inline-flex; align-items: center; gap: 12px; background: #fff;
  border: 1px solid var(--neutral-200); border-radius: var(--r-card);
  padding: 12px 16px; box-shadow: var(--shadow-card); max-width: 100%;
}
.mascot-bubble img { width: 48px; height: 48px; flex: none; }
.mascot-bubble p { margin: 0; font-size: 14px; color: var(--neutral-700); line-height: 1.5; }

/* ---------- 入场动画（reveal）---------- */
.js .reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- 9. reduced-motion 降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .js .reveal { opacity: 1 !important; transform: none !important; }
}
