/* ==========================================================================
   基础重置 · 排版 · 通用工具类
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

body.is-locked {
  overflow: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

::selection {
  background-color: var(--text);
  color: var(--bg);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   标题 —— 一级标题使用衬线字体
   ========================================================================== */
h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--text);
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(2rem, 1.3rem + 3vw, var(--text-6xl));
  letter-spacing: 0.005em;
}

h2 {
  font-size: clamp(1.625rem, 1.2rem + 1.8vw, var(--text-4xl));
}

h3 {
  font-size: clamp(1.25rem, 1.05rem + 0.9vw, var(--text-2xl));
}

h4 {
  font-size: var(--text-xl);
}

/* ==========================================================================
   布局容器 —— 大留白 + 受控版心
   ========================================================================== */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--wide {
  max-width: calc(var(--container-wide) + var(--gutter) * 2);
}

.container--narrow {
  max-width: calc(var(--container-narrow) + var(--gutter) * 2);
}

.section {
  padding-block: var(--space-24);
}

.section--soft {
  background-color: var(--bg-soft);
}

@media (max-width: 900px) {
  .section {
    padding-block: var(--space-16);
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: var(--space-5);
  }
  .section {
    padding-block: var(--space-12);
  }
}

/* ==========================================================================
   按钮 —— 黑色 / 深炭灰 + 白色文字
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.8125rem 1.5rem;
  border-radius: var(--radius-sm);
  background-color: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease),
    opacity var(--dur) var(--ease), transform var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.btn:hover {
  background-color: var(--btn-bg-hover);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn svg {
  flex: none;
}

/* 次级按钮：靠背景色与留白区分，不依赖重边框 */
.btn--ghost {
  background-color: transparent;
  color: var(--btn-ghost-fg);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.btn--ghost:hover {
  background-color: var(--btn-ghost-hover);
}

.btn--sm {
  padding: 0.5625rem 1.125rem;
  font-size: var(--text-sm);
}

/* ==========================================================================
   文字链接式行动点
   ========================================================================== */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
  transition: opacity var(--dur) var(--ease), gap var(--dur) var(--ease);
}

.link-arrow:hover {
  opacity: 0.6;
  gap: var(--space-3);
}

.link-arrow svg {
  flex: none;
}

/* ==========================================================================
   图片 —— 统一较大横向比例 + object-fit: cover
   ========================================================================== */
.media {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background-color: var(--img-placeholder);
}

.media--16x9 {
  aspect-ratio: 16 / 9;
}

.media--3x2 {
  aspect-ratio: 3 / 2;
}

.media > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease);
}

/* ==========================================================================
   通用文字工具
   ========================================================================== */
.eyebrow {
  display: block;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.lede {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  color: var(--text-soft);
}

.text-mute {
  color: var(--text-mute);
}

.clamp-1,
.clamp-2,
.clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clamp-1 {
  -webkit-line-clamp: 1;
  line-clamp: 1;
}

.clamp-2 {
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.clamp-3 {
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.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;
}

.skip-link {
  position: absolute;
  top: -120px;
  left: var(--gutter);
  z-index: calc(var(--z-header) + 10);
  padding: var(--space-3) var(--space-5);
  background-color: var(--btn-bg);
  color: var(--btn-fg);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  transition: top var(--dur) var(--ease);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ==========================================================================
   正文排版（文章详情 / 关于页）
   ========================================================================== */
.prose {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  line-height: var(--leading-loose);
  color: var(--text-soft);
}

.prose > * + * {
  margin-top: var(--space-6);
}

.prose h2 {
  margin-top: var(--space-12);
  font-size: var(--text-3xl);
  color: var(--text);
}

.prose h3 {
  margin-top: var(--space-10);
  font-size: var(--text-2xl);
  color: var(--text);
}

.prose > h2:first-child,
.prose > h3:first-child {
  margin-top: 0;
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

.prose blockquote {
  margin-block: var(--space-10);
  padding-left: var(--space-6);
  border-left: 2px solid var(--hairline);
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  line-height: var(--leading-snug);
  color: var(--text);
}

.prose ul {
  padding-left: 0;
}

.prose ul li {
  position: relative;
  padding-left: var(--space-6);
}

.prose ul li + li {
  margin-top: var(--space-3);
}

.prose ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.9em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--text-mute);
}

/* ==========================================================================
   页面淡入
   ========================================================================== */
.page-fade {
  animation: pageFade var(--dur-slow) var(--ease) both;
}

@keyframes pageFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
