/**
 * base.css — 全局重置 + 排版 + 通用类
 * 所有元素消费 tokens.css 中的 CSS 变量
 */

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  letter-spacing: var(--region-letter);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 全站宣纸肌理底 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--texture-rice-paper);
  background-size: 160px;
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--region-accent);
}

ul, ol {
  list-style: none;
}

/* ========== 排版 ========== */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-light);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

h1 {
  font-size: var(--text-3xl);
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-xl);
}

h4 {
  font-size: var(--text-lg);
  font-weight: var(--weight-normal);
}

h5 {
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
}

h6 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

p {
  margin-bottom: var(--space-4);
}

p:last-child {
  margin-bottom: 0;
}

strong, b {
  font-weight: var(--weight-semibold);
}

em, i {
  font-style: italic;
}

small {
  font-size: var(--text-sm);
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ========== 通用类 ========== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
  position: relative;
  z-index: 1;
}

.container-full {
  width: 100%;
  padding-inline: var(--container-padding);
}

.eyebrow {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--region-accent);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-4);
  display: block;
}

.section {
  position: relative;
  padding-block: var(--space-9);
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-8);
  max-width: 720px;
  margin-inline: auto;
}

.section-label {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--region-accent);
  margin-bottom: var(--space-3);
  display: block;
}

.section-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-light);
  margin-bottom: var(--space-4);
  line-height: 1.15;
  color: var(--color-text);
  text-shadow: var(--shadow-text-warm);
}

.section-header::after {
  content: '';
  display: block;
  width: 64px;
  height: 1px;
  margin: var(--space-5) auto 0;
  background: var(--metallic-divider);
}

.section-subtitle {
  font-size: var(--text-md);
  color: var(--color-text-soft);
  font-weight: var(--weight-light);
}

/* ========== 区块层次：浅色交替 ========== */
.section-alt {
  background: var(--color-beige);
  position: relative;
}
.section-alt::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--texture-frosted-metal);
  background-size: 200px;
  opacity: 0.5;
  pointer-events: none;
}
.section-alt > * { position: relative; z-index: 1; }

/* 兼容旧 .section-dark：浅色方案下改为浅灰咖底 */
.section-dark {
  background: var(--color-beige);
  color: var(--color-text);
  position: relative;
}
.section-dark::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--texture-frosted-metal);
  background-size: 200px;
  opacity: 0.5;
  pointer-events: none;
}
.section-dark > * { position: relative; z-index: 1; }

.section-dark .section-title {
  color: var(--color-text);
}

.section-dark .section-subtitle {
  color: var(--color-text-soft);
}

/* ========== 可访问性 ========== */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  background: var(--color-ivory-soft);
  clip: auto !important;
  clip-path: none;
  color: var(--color-text);
  display: block;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  height: auto;
  left: var(--space-4);
  top: var(--space-4);
  width: auto;
  z-index: var(--z-overlay);
}

:focus-visible {
  outline: 2px solid var(--region-accent);
  outline-offset: 2px;
}

/* ========== 响应式排版 ========== */
@media (max-width: 767px) {
  :root { --space-9: 80px; }
  html { font-size: 93.75%; } /* 15px */
  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }
  .section { padding-block: var(--space-9); }
}
