/* ============================================================
   public.css — 全局基础样式
   ============================================================ */

/* ---- 1. 盒模型重置 ---- */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ---- 2. 元素重置 ---- */
html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  padding: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color: #1a1a1a;
  background-color: #faf7f2;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  padding: 0;
  font-weight: 700;
  line-height: 1.2;
}

p {
  margin: 0 0 1em;
  padding: 0;
}

p:last-child {
  margin-bottom: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
}

blockquote {
  margin: 0;
  padding: 0;
}

/* ---- 3. 布局容器 ---- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
}

.container--narrow {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 48px;
}

.container--wide {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 48px;
}

/* ---- 4. Flex 工具 ---- */
.flex {
  display: flex;
}

.flex--center {
  align-items: center;
  justify-content: center;
}

.flex--between {
  align-items: center;
  justify-content: space-between;
}

.flex--gap-sm { gap: 16px; }
.flex--gap-md { gap: 32px; }
.flex--gap-lg { gap: 48px; }

/* ---- 5. Grid 工具 ---- */
.grid { display: grid; }

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.grid--gap-sm { gap: 16px; }
.grid--gap-md { gap: 32px; }
.grid--gap-lg { gap: 48px; }

/* ---- 6. 间距工具 ---- */
.mt-sm { margin-top: 16px; }
.mt-md { margin-top: 32px; }
.mt-lg { margin-top: 64px; }
.mt-xl { margin-top: 96px; }

.mb-sm { margin-bottom: 16px; }
.mb-md { margin-bottom: 32px; }
.mb-lg { margin-bottom: 64px; }
.mb-xl { margin-bottom: 96px; }

/* ---- 7. 文字工具 ---- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

.text-sm  { font-size: 13px; }
.text-md  { font-size: 16px; }
.text-lg  { font-size: 20px; }
.text-xl  { font-size: 28px; }

.text-muted   { color: #888888; }
.text-navy    { color: #1b3252; }
.text-gold    { color: #b8941a; }

.font-serif {
  font-family: Georgia, "Source Han Serif SC", "Noto Serif SC", "STSong", "SimSun", serif;
}

.font-mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: 0.08em;
}

/* ---- 8. 可见性 / 动画基础 ---- */
.fade-in {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in--delay-1 { transition-delay: 0.1s; }
.fade-in--delay-2 { transition-delay: 0.2s; }
.fade-in--delay-3 { transition-delay: 0.3s; }
.fade-in--delay-4 { transition-delay: 0.4s; }

/* ---- 9. 细节元素 ---- */
.rule {
  border: none;
  border-top: 1px solid #d0c5b5;
  margin: 0;
}

.rule--navy {
  border-top-color: #1b3252;
}

.rule--thick {
  border-top-width: 3px;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid currentColor;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---- 10. 无障碍 ---- */
:focus-visible {
  outline: 3px solid #1b3252;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ---- 11. 响应式基础 ---- */
@media (max-width: 768px) {
  .container,
  .container--narrow,
  .container--wide {
    padding: 0 20px;
  }

  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }
}
