/* ============================================
   Apple 风格设计系统
   "white room with a single blue switch"
   ============================================ */

:root {
  /* 颜色 Tokens */
  --apple-blue: #0071e3;   /* 填充按钮、选中状态（唯一彩色交互色） */
  --link-blue: #0066cc;    /* 描边按钮、内联链接 */
  --signal-blue: #2997ff;  /* 装饰：边框、图标描边 */
  --carbon: #1d1d1f;       /* 主文本 */
  --frost: #f5f5f7;        /* 页面画布 */
  --ice: #f4f8fb;          /* 提升表面 wash */
  --smoke: #333333;        /* 次级文本 */
  --graphite: #474747;     /* 导航文本 */
  --ash: #707070;          /* 页脚文本 */
  --mist: #858585;         /* 弱化文本 */
  --onyx: #000000;         /* 纯黑 */
  --pebble: #e2e2e5;       /* 按钮背景填充 */

  /* 语义变量 */
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --text: #1d1d1f;
  --text-secondary: #707070;
  --text-tertiary: #858585;
  --border: #d2d2d7;       /* hairline 边框 */

  /* 字体 */
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-text: "SF Pro Text", -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  /* 圆角（系统内仅两种值） */
  --radius-card: 8px;    /* 卡片、图片 */
  --radius-pill: 980px;  /* 按钮、标签 */

  /* 间距 */
  --section-gap: 64px;
  --card-padding: 24px;
  --element-gap: 12px;

  /* 布局 */
  --content-max: 980px;
  --page-max: 1440px;
}

/* 深色模式 */
[data-theme="dark"] {
  --bg: #000000;
  --bg-alt: #1d1d1f;
  --text: #f5f5f7;
  --text-secondary: #86868b;
  --text-tertiary: #86868b;
  --border: #424245;
  --ice: #1d1d1f;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-text);
  font-size: 17px;
  letter-spacing: -0.016em; /* Apple 负字距，让文字更精确 */
  line-height: 1.47;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

.content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ============ 导航栏 ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(20px);
}

.nav-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 8px 24px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text);
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
}

/* ============ Hero ============ */
.hero {
  background: transparent;
  padding: 60px 24px 48px;
  text-align: center;
}

.hero-content {
  max-width: var(--content-max);
  margin: 0 auto;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: 0.011em;
  /* 渐变流光（shimmer），参考 metasight 的渐变字 */
  background-image: linear-gradient(
    105deg,
    var(--text) 0%,
    var(--text) 30%,
    #0071e3 42%,
    #8d54ff 50%,
    #0071e3 58%,
    var(--text) 70%,
    var(--text) 100%
  );
  background-size: 250% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: name-shimmer 3.5s linear infinite;
}

.hero-subtitle {
  font-size: 17px;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 18px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 38px;
}

.hero .btn {
  font-size: 16px;
  padding: 13px 24px;
}

/* ============ 按钮（胶囊） ============ */
.btn {
  display: inline-block;
  font-size: 17px;
  font-weight: 400;
  padding: 11px 21px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: all 0.2s;
}

.btn-filled {
  background: var(--apple-blue);
  color: #f4f8fb;
}

.btn-filled:hover {
  background: #0077ed;
}

.btn-outlined {
  border: 1px solid var(--link-blue);
  color: var(--link-blue);
}

.btn-outlined:hover {
  background: var(--link-blue);
  color: #ffffff;
}

/* ============ 通用 Section ============ */
.section {
  padding: var(--section-gap) 24px;
}

.section-frost {
  background: rgba(245, 245, 247, 0.55);
}

.section-ice {
  background: rgba(244, 248, 251, 0.55);
}

.section-title {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: 0.011em;
  text-align: center;
}

/* 项目标题略小 */
#projects .section-title {
  font-size: 32px;
}

.section-subtitle {
  text-align: center;
  font-size: 21px;
  font-weight: 300;
  color: var(--text-secondary);
  margin-top: 8px;
}

.section-body {
  text-align: center;
  max-width: 680px;
  margin: 24px auto 0;
  color: var(--text-secondary);
}

/* ============ 关于我 ============ */
.info-list {
  max-width: 560px;
  margin: 48px auto 0;
  list-style: none;
}

.info-list li {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  font-size: 17px;
}

.info-list li:first-child {
  border-top: 1px solid var(--border);
}

.info-label {
  color: var(--text-tertiary);
}

/* ============ 技能 ============ */
.skills {
  max-width: 720px;
  margin: 48px auto 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.skill-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.skill-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.skill-percent {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.skill-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin: 0 0 14px;
  padding-left: 12px;
  border-left: 2px solid var(--signal-blue);
}

.skill-track {
  height: 5px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.skill-fill {
  height: 100%;
  background: linear-gradient(90deg, #3080ff, #8d54ff);
  border-radius: var(--radius-pill);
  transition: width 1s ease;
}

/* ============ 项目 ============ */
.projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 48px;
}

.card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
  border-color: var(--mist);
  transform: translateY(-4px);
}

.card-cover {
  height: 140px;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  overflow: hidden;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.card:hover .card-cover img {
  transform: scale(1.08);
}

/* 第一张项目图片：轻微持续动效 */
.card:first-child .card-cover img {
  animation: cover-drift 14s ease-in-out infinite alternate;
}

@keyframes cover-drift {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(1.08) translateY(-8px); }
}

.card-body {
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.card-body h3 {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.011em;
  margin-bottom: 12px;
}

.card-link {
  align-self: flex-start;
  margin-top: auto;
  color: var(--link-blue);
  text-decoration: none;
  font-size: 14px;
}

.card-link:hover {
  text-decoration: underline;
}

/* ============ 联系 ============ */
.contact-block {
  text-align: center;
}

.contact-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 40px;
}

/* ============ 页脚 ============ */
.footer {
  background: rgba(245, 245, 247, 0.55);
  border-top: 1px solid var(--border);
  padding: 40px 24px;
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  text-align: center;
}

.footer p {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .hero {
    padding: 80px 24px 64px;
  }

  .hero-title {
    font-size: 44px;
  }

  .hero-subtitle {
    font-size: 21px;
  }

  .section-title {
    font-size: 32px;
  }

  #projects .section-title {
    font-size: 28px;
  }

  .projects {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   极光背景 + 纸张触感（参考 metasight.cloud）
   ============================================ */
.aurora-bg {
  position: fixed;
  inset: -20px;
  z-index: -1;
  pointer-events: none;
  background-image:
    /* 纸张纹理（触感） */
    repeating-linear-gradient(100deg,
      rgba(0, 0, 0, 0.035) 0%,
      rgba(0, 0, 0, 0.035) 7%,
      rgba(0, 0, 0, 0) 10%,
      rgba(0, 0, 0, 0) 12%,
      rgba(0, 0, 0, 0.035) 16%),
    /* 极光渐变 */
    repeating-linear-gradient(100deg,
      rgba(48, 128, 255, 0.30) 10%,
      rgba(164, 179, 255, 0.30) 15%,
      rgba(144, 197, 253, 0.30) 20%,
      rgba(221, 214, 254, 0.30) 25%,
      rgba(84, 165, 250, 0.30) 30%);
  background-size: 300%, 200%;
  background-position: 50% 50%, 50% 50%;
  animation: aurora 60s linear infinite;
  filter: blur(9px);
}

@keyframes aurora {
  0% { background-position: 50% 50%, 50% 50%; }
  100% { background-position: 350% 50%, 350% 50%; }
}

@keyframes name-shimmer {
  0% { background-position: 250% center; }
  100% { background-position: -150% center; }
}

/* 只在精确指针且用户允许动效时启用机器人光标 */
@media (pointer: fine) and (prefers-reduced-motion: no-preference) {
  html, body, a, button, input, textarea, select, label, summary,
  [role="button"], [role="link"], [contenteditable="true"] {
    cursor: none !important;
  }
}

/* 深色模式下的极光与半透明面板 */
[data-theme="dark"] .aurora-bg {
  background-image:
    repeating-linear-gradient(100deg,
      rgba(255, 255, 255, 0.05) 0%,
      rgba(255, 255, 255, 0.05) 7%,
      rgba(0, 0, 0, 0) 10%,
      rgba(0, 0, 0, 0) 12%,
      rgba(255, 255, 255, 0.05) 16%),
    repeating-linear-gradient(100deg,
      rgba(48, 128, 255, 0.22) 10%,
      rgba(164, 179, 255, 0.22) 15%,
      rgba(144, 197, 253, 0.22) 20%,
      rgba(221, 214, 254, 0.22) 25%,
      rgba(84, 165, 250, 0.22) 30%);
}
[data-theme="dark"] .nav { background: rgba(0, 0, 0, 0.55); }
[data-theme="dark"] .section-frost,
[data-theme="dark"] .footer { background: rgba(29, 29, 31, 0.6); }
[data-theme="dark"] .section-ice { background: rgba(29, 29, 31, 0.6); }
[data-theme="dark"] .card { background: rgba(29, 29, 31, 0.9); }

/* ============================================
   机器人鼠标
   ============================================ */
.robot-cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 2147483647;
  font-size: 30px;
  line-height: 1;
  will-change: transform;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.25));
}

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

/* 超小屏：项目单列 */
@media (max-width: 480px) {
  .projects {
    grid-template-columns: repeat(1, 1fr);
  }
}

/* ============================================
   最近在写（参考 rui.juzi.bot 的排版）
   ============================================ */
.writing-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 22px;
}

.writing-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.09px;
  color: #222222;
}

.writing-more {
  font-size: 13px;
  color: #444444;
  text-decoration: none;
}

.writing-more:hover {
  color: #d26911;
}

.writing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.writing-card {
  display: flex;
  flex-direction: column;
  padding-bottom: 24px;
  border-bottom: 1px solid #e6e4dd;
}

.writing-card-title {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.24px;
  margin: 0 0 8px;
}

.writing-card-title a {
  color: #222222;
  text-decoration: none;
}

.writing-card-title a:hover {
  color: #d26911;
}

.writing-meta {
  font-size: 13px;
  color: #777777;
  margin: 0 0 14px;
}

.writing-cat {
  font-size: 12px;
  color: #444444;
  background: #f6f6f3;
  padding: 1px 8px;
  border-radius: 3px;
}

.writing-excerpt {
  font-size: 15px;
  line-height: 1.85;
  color: #444444;
  margin: 0 0 14px;
  flex: 1;
}

.writing-more-link a {
  color: #d26911;
  text-decoration: none;
  font-size: 15px;
}

.writing-more-link a:hover {
  text-decoration: underline;
}

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

@media (max-width: 480px) {
  .writing-grid {
    grid-template-columns: repeat(1, 1fr);
  }
}
