/* ==========================================================================
   WitherMC · 全站设计系统 (Design System)
   仅承载：变量令牌 / 基础重置 / 通用组件（页头、按钮、卡片、页脚）
   页面私有样式请放到各自的页面样式表中。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 设计令牌
   -------------------------------------------------------------------------- */
:root {
  /* 背景层次 */
  --bg: #08090c;
  --bg-elev: #0e1015;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  /* 文本 */
  --text: #e9ecf1;
  --text-dim: #b6bec9;
  --text-muted: #8c95a3;

  /* 主色（MC 翡翠绿） */
  --accent: #3ddc84;
  --accent-strong: #2ec46f;
  --accent-soft: rgba(61, 220, 132, 0.12);
  --accent-glow: rgba(61, 220, 132, 0.28);

  /* 语义色 */
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);

  /* 形状与节奏 */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --gap: 24px;
  --section-y: clamp(56px, 8vw, 96px);
  /* 页头高度，供主视觉计算「视口 - 页头」用（窄屏在 nav.css 里覆盖为 56px） */
  --header-h: 64px;

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.85);
  --shadow-lg: 0 30px 60px -25px rgba(0, 0, 0, 0.9);

  /* 动效 */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 0.22s;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

/* --------------------------------------------------------------------------
   2. 基础重置
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 触屏点击反馈统一为品牌色，避免各浏览器默认的灰块 */
  -webkit-tap-highlight-color: rgba(61, 220, 132, 0.15);
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(
      60rem 30rem at 12% -8%,
      rgba(61, 220, 132, 0.07),
      transparent 60%
    ),
    radial-gradient(
      50rem 28rem at 92% 4%,
      rgba(88, 130, 255, 0.06),
      transparent 62%
    );
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

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

::selection {
  background: var(--accent-glow);
  color: #04140b;
}

/* 无障碍：仅在键盘导航时显示跳转链接 */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) 0;
  background: var(--accent);
  color: #04140b;
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
}

/* 无障碍：视觉上隐藏，但仍会被读屏软件朗读 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   3. 布局
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-left: 24px;
  padding-right: 24px;
  /* 刘海屏安全区；不支持 max()/env() 的浏览器沿用上面的固定内边距 */
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

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

.section-head {
  margin-bottom: clamp(24px, 4vw, 40px);
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section-title {
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.section-desc {
  max-width: 62ch;
  margin-top: 10px;
  color: var(--text-muted);
}

/* 子页面（下载中心 / 开源项目 / 项目管理）通用的页首说明 */
.page-hero {
  padding-block: clamp(44px, 7vw, 72px) clamp(20px, 3vw, 32px);
}

.page-title {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-lede {
  max-width: 68ch;
  margin-top: 14px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   4. 页头外壳
   导航与汉堡菜单在 static/css/nav.css，需在本文件之后引入。
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 9, 12, 0.72);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: opacity var(--dur) var(--ease);
}

.brand:hover {
  opacity: 0.8;
}

/* --------------------------------------------------------------------------
   5. 按钮
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur) var(--ease),
    background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--accent);
  color: #04140b;
  box-shadow: 0 12px 30px -14px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-strong);
  transform: translateY(-2px);
  box-shadow: 0 18px 36px -14px var(--accent-glow);
}

.btn-ghost {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 9px 18px;
  font-size: 0.9rem;
}

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

/* --------------------------------------------------------------------------
   6. 卡片
   -------------------------------------------------------------------------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease), transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.card-body {
  padding: 26px;
}

.card-title {
  font-size: 1.08rem;
  font-weight: 650;
}

.card-text {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* 图标容器 */
.icon-box {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-box svg {
  width: 22px;
  height: 22px;
}

/* 特性列表 */
.feature-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--text-dim);
  font-size: 0.93rem;
}

.feature-list li {
  display: flex;
  gap: 9px;
  align-items: baseline;
}

.feature-list li::before {
  content: "";
  flex-shrink: 0;
  width: 5px;
  height: 5px;
  margin-top: 0.55em;
  border-radius: 50%;
  background: var(--accent);
}

/* 网格：min() 让轨道在极窄屏也能收缩，不会撑出横向滚动 */
.grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}

/* --------------------------------------------------------------------------
   7. 徽标 / 提示条 / 加载
   -------------------------------------------------------------------------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spin {
  animation: spin 0.8s linear infinite;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 500;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: dot-pulse 2.4s var(--ease) infinite;
}

@keyframes dot-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--accent-glow);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(61, 220, 132, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(61, 220, 132, 0);
  }
}

/* --------------------------------------------------------------------------
   8. 页脚
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-block: 32px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-links a {
  transition: color var(--dur) var(--ease);
}

.footer-links a:hover {
  color: var(--accent);
}

/* 当前页在页脚里也高亮一下，跟顶栏保持一致 */
.footer-links a[aria-current="page"] {
  color: var(--text);
}

/* --------------------------------------------------------------------------
   9. 页面骨架（让页脚贴底）
   -------------------------------------------------------------------------- */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* 移动端浏览器地址栏伸缩时 100vh 会溢出，dvh 更准确 */
  min-height: 100dvh;
}

.page-main {
  flex: 1;
}

/* --------------------------------------------------------------------------
   10. 入场动画
   -------------------------------------------------------------------------- */
.rise {
  animation: rise 0.6s var(--ease) both;
}

.rise-2 {
  animation-delay: 0.08s;
}

.rise-3 {
  animation-delay: 0.16s;
}

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

/* --------------------------------------------------------------------------
   11. 响应式（页头 / 导航部分见 nav.css）
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .wrap {
    padding-left: 18px;
    padding-right: 18px;
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }

  .btn {
    padding: 12px 22px;
  }

  .card-body {
    padding: 22px;
  }
}

/* --------------------------------------------------------------------------
   12. 偏好设置
   -------------------------------------------------------------------------- */
@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;
  }
}
