/* ============================================================
   鼎力机械 · 设计系统底座
   Design tokens / reset / typography / primitives
   ============================================================ */

:root {
  /* 品牌色：工程机械黄 */
  --brand: #FFB020;
  --brand-600: #E39600;
  --brand-050: #FFF7E6;
  --brand-ink: #3D2A00;

  /* 中性色 */
  --ink: #14161A;
  --ink-700: #3D424A;
  --ink-500: #6B7280;
  --ink-400: #8A919B;
  --ink-300: #A9AFB8;
  --line: #E5E8EC;
  --line-strong: #D2D7DE;
  --surface: #FFFFFF;
  --surface-2: #F6F7F9;
  --surface-3: #EDEFF2;

  /* 语义色 */
  --danger: #D93B3B;
  --danger-050: #FDEDED;
  --success: #1F8A5B;
  --success-050: #EAF6F0;
  --info: #2C6FD1;
  --info-050: #EBF2FC;

  /* 圆角 */
  --r-sm: 4px;
  --r: 8px;
  --r-lg: 12px;

  /* 阴影 */
  --sh-1: 0 1px 2px rgba(20, 22, 26, .06);
  --sh-2: 0 8px 24px rgba(20, 22, 26, .08);
  --sh-3: 0 18px 48px rgba(20, 22, 26, .14);

  /* 布局 */
  --wrap: 1280px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 64px;

  /* 节奏 */
  --ease: cubic-bezier(.22, .68, .32, 1);
  --dur: .28s;

  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC",
    system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-num: "SF Mono", "JetBrains Mono", Consolas, "Roboto Mono", monospace;
}

/* ---------- reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, video, svg { display: block; max-width: 100%; }

/* hidden 属性优先级高于作者样式中的 display 值 */
[hidden] { display: none !important; }
img { height: auto; background: var(--surface-3); }

h1, h2, h3, h4, h5, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }

:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ---------- 排版 ---------- */
.h1 {
  font-size: clamp(28px, 4.4vw, 54px);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -.02em;
}
.h2 {
  font-size: clamp(24px, 2.6vw, 36px);
  font-weight: 700;
  line-height: 1.26;
  letter-spacing: -.01em;
}
.h3 {
  font-size: clamp(19px, 1.5vw, 22px);
  font-weight: 600;
  line-height: 1.4;
}
.h4 { font-size: 17px; font-weight: 600; line-height: 1.45; }

.lead {
  font-size: clamp(15px, 1.15vw, 17px);
  line-height: 1.75;
  color: var(--ink-700);
}
.muted { color: var(--ink-500); }
.tiny { font-size: 12px; line-height: 1.6; color: var(--ink-500); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand-600);
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--brand);
}

/* ---------- 布局 ---------- */
.container {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: clamp(48px, 7vw, 96px); }
.section--tight { padding-block: clamp(36px, 4.5vw, 64px); }
.section--grey { background: var(--surface-2); }
.section--dark { background: var(--ink); color: #fff; }
.section--dark .lead,
.section--dark .muted { color: rgba(255, 255, 255, .68); }
.section--dark .eyebrow { color: var(--brand); }

.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(24px, 3vw, 40px);
}
.section__head .h2 { max-width: 22ch; }
@media (max-width: 767px) {
  .section__head { flex-direction: column; align-items: flex-start; gap: 14px; }
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
  border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--brand); color: var(--ink); }
.btn--primary:hover { background: var(--brand-600); }

.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: #000; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn--ghost:hover { border-color: var(--ink); background: rgba(20, 22, 26, .03); }

.btn--light {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .32);
  color: #fff;
  backdrop-filter: blur(6px);
}
.btn--light:hover { background: rgba(255, 255, 255, .18); }

.btn--sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn--lg { min-height: 52px; padding: 0 30px; font-size: 16px; }
.btn--block { width: 100%; }

.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- 标签 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  background: var(--surface-3);
  color: var(--ink-700);
  white-space: nowrap;
}
.badge--brand { background: var(--brand); color: var(--ink); }
.badge--new { background: var(--info-050); color: var(--info); }
.badge--used { background: var(--success-050); color: var(--success); }
.badge--danger { background: var(--danger-050); color: var(--danger); }
.badge--outline {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-500);
}

/* ---------- 表单 ---------- */
.field { display: grid; gap: 7px; }
.field > label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
}
.field .hint { font-size: 12px; color: var(--ink-400); }

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 15px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-300); }
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(255, 176, 32, .22);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 34px;
}
.field--error .input { border-color: var(--danger); }
.err-msg { font-size: 12px; color: var(--danger); display: none; }
.field--error .err-msg { display: block; }

/* ---------- 通用 ---------- */
.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;
}

.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* 进场动画 */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* 图片骨架占位 */
.ph {
  background: linear-gradient(100deg, var(--surface-3) 30%, #F3F5F7 50%, var(--surface-3) 70%);
  background-size: 300% 100%;
  animation: ph-shine 1.4s infinite linear;
}
@keyframes ph-shine {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
