/* ═══════════════════════════════════════════════════════════════
   aceworld.top — 全局样式 (Global Styles)
   版本: v2.0
   包含: Reset / 字体引入 / 排版 / 滚动条 / 响应式 / Utility
   ═══════════════════════════════════════════════════════════════ */

/* ─── 0. 外部字体引入 ─── */
/* Inter Variable: 可变字体，支持 100–900 连续字重 */
@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&display=swap');

/* 中文字体备用 (已内联到 token 的 --font-cjk) */

/* ─── 1. Reset / Normalize ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + var(--space-9));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  color: var(--text-secondary);
  background-color: var(--bg-deep);
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  /* 全局 Inter 特性 */
  font-feature-settings: "cv01", "ss03";
}

/* ─── 块级元素 ─── */
article, aside, details, figcaption, figure,
footer, header, hgroup, main, nav, section {
  display: block;
}

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

img {
  height: auto;
}

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

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

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

ul, ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ─── 2. 中文混排字体回退栈 ─── */
/* 正文包含中文时，通过 class .zh-cn 或全局应用 */
h1, h2, h3, h4, h5, h6,
p, span, a, li, td, th, label,
blockquote, figcaption, cite {
  font-family: var(--font-sans), var(--font-cjk);
}

/* 标题的 Inter Variable 特性保留 */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: var(--weight-regular);
  font-feature-settings: "cv01", "ss03";
}

h1 { font-size: var(--text-h1); line-height: var(--leading-h1); letter-spacing: var(--tracking-h1); }
h2 { font-size: var(--text-h2); line-height: var(--leading-h2); letter-spacing: var(--tracking-h2); }
h3 { font-size: var(--text-h3); line-height: var(--leading-h3); letter-spacing: var(--tracking-h3); font-weight: var(--weight-semibold); }

p {
  margin-bottom: var(--space-6);
}

p:last-child {
  margin-bottom: 0;
}

/* ─── 3. 全局排版基础 ─── */
.display-text {
  font-size: var(--text-display);
  font-weight: var(--weight-medium);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  color: var(--text-primary);
}

.body-sm {
  font-size: var(--text-body-sm);
  line-height: var(--leading-sm);
  letter-spacing: var(--tracking-sm);
}

.caption {
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
  line-height: var(--leading-caption);
  letter-spacing: var(--tracking-caption);
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.label {
  font-size: var(--text-label);
  font-weight: var(--weight-medium);
  line-height: var(--leading-label);
  text-transform: uppercase;
}

.section-label {
  display: inline-block;
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caption);
  color: var(--brand-primary);
  text-transform: uppercase;
  margin-bottom: var(--space-4);
}

.text-gradient {
  background: linear-gradient(
    135deg,
    var(--brand-primary) 0%,
    var(--brand-accent) 50%,
    #a78bfa 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── 4. ::selection 样式 ─── */
::selection {
  background-color: rgba(94, 106, 210, 0.35);
  color: var(--text-primary);
}

::-moz-selection {
  background-color: rgba(94, 106, 210, 0.35);
  color: var(--text-primary);
}

/* ─── 5. 滚动条样式 ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Firefox 滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

/* ─── 6. 响应式断点工具 ─── */
/* Mobile First 原则：基础样式为 mobile，逐步增强 */

/* >= 480px — 小平板 */
@media (min-width: 480px) {
  .hide-mobile { display: initial; }
}

/* >= 768px — 平板 */
@media (min-width: 768px) {
  .hide-tablet { display: initial; }
}

/* >= 1024px — 桌面 */
@media (min-width: 1024px) {
  .hide-desktop { display: none; }
  .show-desktop { display: initial; }
}

/* 默认：移动端隐藏 */
.hide-mobile,
.hide-tablet {
  display: none;
}

.show-desktop {
  display: none;
}

/* ─── 7. 容器 / 布局 Utility ─── */
.container {
  width: 100%;
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}

@media (min-width: 768px) {
  .container {
    padding-left: var(--space-9);
    padding-right: var(--space-9);
  }
}

.container-narrow {
  max-width: var(--content-narrow);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}

/* Section 通用 */
.section {
  padding-top: var(--section-gap);
  padding-bottom: var(--section-gap);
  position: relative;
  z-index: var(--z-content);
}

.section-sm {
  padding-top: var(--section-gap-sm);
  padding-bottom: var(--section-gap-sm);
}

/* ─── 8. 网格 Utility ─── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--card-gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--card-gap);
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ─── 9. 卡片基础 ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-lg);
  padding: var(--card-padding);
  transition:
    transform var(--duration-fast) var(--ease-spring),
    border-color var(--duration-fast) var(--ease-spring),
    box-shadow var(--duration-fast) var(--ease-spring);
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-elevated);
}

/* ─── 10. 微动效 ─── */
.fade-in-up {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeInUp var(--duration-slow) var(--ease-spring) forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  opacity: 0;
  animation: fadeIn var(--duration-normal) var(--ease-out) forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* 错开载入 (配合 JS 添加 style="animation-delay: Nms") */
.stagger-item {
  opacity: 0;
}

/* ─── 11. 占位 / 骨架 ─── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--border-subtle) 25%,
    var(--border-standard) 50%,
    var(--border-subtle) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── 12. 链接样式 ─── */
a.link {
  color: var(--brand-accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a.link:hover {
  color: var(--brand-hover);
}

/* ─── 13. 焦点环 ─── */
:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ─── 14. 减少动效 ─── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ─── 15. 核心成果私有标记 ─── */
.achievement-private {
  position: relative;
  cursor: default;
}
.achievement-private:hover {
  border-color: var(--border-default);
  transform: none;
  box-shadow: none;
}
.achievement-badge {
  display: inline-block;
  margin-top: var(--space-4);
  padding: var(--space-1) var(--space-3);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-sm);
  font-size: var(--text-caption);
  color: var(--brand-warm);
  letter-spacing: 0.03em;
}

/* ─── 16. Utility 工具类 (提取自内联样式，Cici审查修复) ─── */
.text-body-sm-tertiary {
  font-size: var(--text-body-sm);
  color: var(--text-tertiary);
}
.text-body-sm-quaternary {
  font-size: var(--text-body-sm);
  color: var(--text-quaternary);
}
.text-body-mb2 {
  font-size: var(--text-body);
  margin-bottom: var(--space-2);
}
.text-body-mb4 {
  font-size: var(--text-body);
  margin-bottom: var(--space-4);
}
.mt-6 { margin-top: var(--space-6); }
.mt-9 { margin-top: var(--space-9); }
.mb-4 { margin-bottom: var(--space-4); }
.p-9 { padding: var(--space-9); }
.bg-panel { background: var(--bg-panel); }
.bg-surface { background: var(--bg-surface); }
.flex-wrap-gap4 {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* ─── 17. Canvas 背景层 (含粒子降级，Cici审查修复) ─── */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-particles);
  pointer-events: none;
  /* 降级：纯色渐变背景（Three.js未加载时后备） */
  background: radial-gradient(ellipse at 50% 30%, rgba(94,106,210,0.08) 0%, transparent 70%);
}

/* ─── 18. Skip-to-Content 无障碍链接 ─── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--brand-primary);
  color: #fff;
  border-radius: 0 0 8px 8px;
}
.skip-link:focus {
  top: 0;
}

/* ─── 19. nav-link.active 滚动高亮 ─── */
.nav-link.active {
  opacity: 1;
  color: var(--text-primary);
}
.nav-link.active::after {
  transform: scaleX(1) !important;
}
