/* ========================================
   一个曾经的小码农 · 个人主页
   ======================================== */

/* ===== CSS 变量 ===== */
:root {
  --void:       #08080c;
  --void-warm:  #0d0c0a;
  --phosphor:   #c8963e;
  --phosphor-dim: rgba(200, 150, 62, 0.18);
  --phosphor-glow: rgba(200, 150, 62, 0.35);
  --text-primary:   #e2dcc8;
  --text-secondary: #8a8070;
  --text-tertiary:  #4a4440;
  --radius: 2px;
  --mono: "Cascadia Code", "Fira Code", "JetBrains Mono", "Consolas", "Courier New", monospace;
  --serif: "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, serif;
}

/* ===== 亮色主题：纸金（暗金的对偶，与 azenv 一致） ===== */
[data-theme="light"] {
  --void:        #f7f2e8;
  --void-warm:   #efe9db;
  --phosphor:    #a67c26;
  --phosphor-dim: rgba(166, 124, 38, 0.14);
  --phosphor-glow: rgba(166, 124, 38, 0.30);
  --text-primary:   #2b2418;
  --text-secondary: #57503f;
  --text-tertiary:  #7d7461;
}
[data-theme="light"] .scanlines,
[data-theme="light"] .vignette,
[data-theme="light"] .phosphor-dust { display: none; }
[data-theme="light"] .avatar { filter: brightness(1) contrast(1) saturate(0.9); }
/* 纸金下：去掉发光脉冲光圈，改为柔和的暖色投影，融入纸面 */
[data-theme="light"] .avatar-glow {
  animation: none;
  inset: -4px;
  box-shadow:
    0 6px 22px rgba(166, 124, 38, 0.16),
    0 2px 8px rgba(43, 36, 24, 0.08);
}

/* ===== 主题切换按钮（右上角固定） ===== */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1001;
  background: none;
  border: 1px solid var(--phosphor);
  color: var(--phosphor);
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}
.theme-toggle:hover { background: var(--phosphor-dim); color: var(--text-primary); }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-theme="light"] .theme-toggle .icon-moon { display: inline; }

/* ===== 重置 ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--void);
}

body {
  color: var(--text-primary);
  font-family: var(--mono);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== CRT 扫描线 ===== */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.02) 3px,
    rgba(0, 0, 0, 0.02) 4px
  );
}

/* ===== 暗角 ===== */
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 998;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(8, 8, 12, 0.6) 85%,
    rgba(8, 8, 12, 0.95) 100%
  );
}

/* ===== 光晕粒子 ===== */
.phosphor-dust {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.dust-speck {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--phosphor);
  border-radius: 50%;
  opacity: 0;
  animation: dust-float 8s ease-in-out infinite;
}

@keyframes dust-float {
  0%, 100% { opacity: 0;   transform: translateY(0)    translateX(0); }
  20%      { opacity: 0.6; }
  50%      { opacity: 0.3; }
  80%      { opacity: 0.7; transform: translateY(-40px) translateX(8px); }
}

/* ===== 单屏容器 ===== */
.shell {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 4vh, 48px);
  padding: clamp(12px, 2vh, 24px) clamp(16px, 4vw, 40px) 60px;
}

/* ===== 身份 ===== */
.identity-group {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.avatar-wrapper {
  position: relative;
  width: 96px;
  height: 96px;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  filter: brightness(0.85) contrast(1.1) saturate(0.5);
  transition: filter 0.8s ease, transform 0.8s ease;
  position: relative;
  z-index: 1;
}

.avatar:hover {
  filter: brightness(1) contrast(1.05) saturate(0.7);
  transform: scale(1.05);
}

.avatar-glow {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  animation: avatar-pulse 4s ease-in-out infinite;
}

@keyframes avatar-pulse {
  0%, 100% {
    box-shadow:
      0 0 16px var(--phosphor-dim),
      0 0 48px var(--phosphor-dim),
      0 0 80px var(--phosphor-dim);
  }
  50% {
    box-shadow:
      0 0 28px var(--phosphor-glow),
      0 0 64px var(--phosphor-dim),
      0 0 100px var(--phosphor-dim);
  }
}

/* ===== 打字机 ===== */
.bio {
  font-family: var(--serif);
  font-size: clamp(18px, 2.2vw, 26px);
  color: var(--text-primary);
  letter-spacing: 0.15em;
  font-weight: 400;
  min-height: 1.6em;
  text-shadow: 0 0 24px var(--phosphor-dim);
}



/* ===== 时间 ===== */
.time-group {
  text-align: center;
}

.time-display {
  position: relative;
  display: inline-block;
}

.time-digits {
  font-family: var(--mono);
  font-size: clamp(36px, 5.5vw, 64px);
  font-weight: 300;
  color: var(--text-primary);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  position: relative;
  z-index: 1;
}

.time-glow {
  position: absolute;
  inset: -20px -40px;
  background: radial-gradient(ellipse at center, var(--phosphor-dim) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.date-text {
  font-size: clamp(11px, 1.3vw, 13px);
  color: var(--text-tertiary);
  margin-top: 8px;
  letter-spacing: 0.06em;
}

.time-digits.flicker {
  animation: time-flicker 0.15s ease-out;
}

@keyframes time-flicker {
  0%   { opacity: 0.4; text-shadow: 0 0 12px var(--phosphor); }
  50%  { opacity: 1;   text-shadow: none; }
  100% { opacity: 0.7; text-shadow: 0 0 4px var(--phosphor-dim); }
}

/* ===== 一言 ===== */
.quote-group {
  text-align: center;
}

.quote-text {
  font-family: var(--serif);
  font-size: clamp(14px, 1.8vw, 20px);
  line-height: 2;
  color: var(--text-secondary);
  font-style: italic;
  transition: opacity 0.4s ease;
}

.quote-text.fade {
  opacity: 0.2;
}

/* ===== 链接 — Grid 三列对齐 ===== */
.links-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;        /* 让每行等宽，grid才能对齐 */
  gap: clamp(10px, 2vh, 20px);
}

.cmd-link {
  display: grid;
  /* 列定义：$ | open target | → | 链接地址 */
  grid-template-columns: 1em 6.5em 1.5em 1fr;
  align-items: baseline;
  column-gap: 0.5em;
  text-decoration: none;
  font-family: var(--mono);
  font-size: clamp(13px, 1.5vw, 16px);
  color: var(--text-tertiary);
  transition: color 0.3s ease;
  line-height: 1.8;
  padding: 4px 10px;
  border-radius: 2px;
}

.cmd-link:hover,
.cmd-link:focus-visible {
  color: var(--text-primary);
  background: rgba(200, 150, 62, 0.04);
}

/* $ */
.cmd-prompt {
  color: var(--phosphor);
  text-align: right;
}

/* open target — 合并为一列内的两段文字 */
.cmd-action {
  color: var(--text-secondary);
}

.cmd-link:hover .cmd-action {
  color: var(--text-primary);
}

.cmd-target {
  color: var(--phosphor);
  transition: text-shadow 0.3s ease;
}

.cmd-link:hover .cmd-target {
  text-shadow: 0 0 12px var(--phosphor-dim);
}

/* → */
.cmd-arrow {
  color: var(--text-tertiary);
  text-align: center;
  transition: transform 0.3s ease, color 0.3s ease;
}

.cmd-link:hover .cmd-arrow {
  color: var(--text-secondary);
  transform: translateX(3px);
}

/* 链接地址 */
.cmd-result {
  color: var(--text-tertiary);
  transition: color 0.3s ease;
}

.cmd-link:hover .cmd-result {
  color: var(--text-secondary);
}

/* action 和 target 共享第二列，用 span 包裹 */
/* 实际上它们是两个独立 span，需要合并到同一格 */
/* 解决方案：.cmd-action + .cmd-target 用 inline 紧靠，外包一个 div 作为 grid cell */
.cmd-middle {
  display: flex;
  gap: 0.5em;
}

/* ===== 备案（固定底部） ===== */
.beian-fixed {
  position: fixed;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 1000;
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 4px 12px;
}

.beian-fixed a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.beian-fixed a:hover {
  color: var(--text-secondary);
}

.beian-sep {
  margin: 0 8px;
}

.gov-icon {
  width: auto;
  height: 10px;
  vertical-align: middle;
  opacity: 0.5;
}

/* ===== 无障碍 ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

a:focus-visible {
  outline: 1px solid var(--phosphor);
  outline-offset: 4px;
  border-radius: var(--radius);
}

::selection {
  background: var(--phosphor-dim);
  color: var(--text-primary);
}

/* ===== 移动端 ===== */
@media (max-width: 640px) {
  .cmd-link {
    font-size: 13px;
    grid-template-columns: 1em 6em 1.2em 1fr;
    column-gap: 0.4em;
  }
}
