/* ============================================================
   个人网站 · 共享设计系统 (Design Tokens + Base + Components)
   美学：温暖编辑感 · 单一珊瑚强调 · 浅/深双主题
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
  /* 暖中性灰（带极轻暖偏） */
  --bg:           oklch(98% 0.008 70);
  --surface-1:    oklch(100% 0 0);
  --surface-2:    oklch(97% 0.006 70);
  --surface-3:    oklch(94% 0.008 70);
  --text-1:       oklch(24% 0.02 55);
  --text-2:       oklch(45% 0.015 55);
  --text-3:       oklch(62% 0.012 55);
  --border:       oklch(90% 0.012 70);
  --border-strong:oklch(82% 0.014 70);

  /* 单一珊瑚强调色 */
  --accent:       oklch(64% 0.16 35);
  --accent-hover: oklch(57% 0.16 35);
  --accent-press: oklch(50% 0.15 35);
  --accent-soft:  oklch(94% 0.05 35);
  --accent-contrast: oklch(99% 0.01 70);

  /* 语义色 */
  --success: oklch(58% 0.13 150);
  --warning: oklch(72% 0.13 75);
  --danger:  oklch(56% 0.18 25);
  --info:    var(--accent);

  /* 字体 */
  --font-display: "Fraunces", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "PingFang SC",
               "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* 流式字号（标题用 clamp，正文固定 rem） */
  --fs-xs:   0.75rem;
  --fs-sm:   0.875rem;
  --fs-base: 1rem;
  --fs-lg:   1.125rem;
  --fs-xl:   clamp(1.35rem, 1rem + 1.6vw, 1.75rem);
  --fs-2xl:  clamp(1.9rem, 1.2rem + 3vw, 2.8rem);
  --fs-3xl:  clamp(2.6rem, 1.6rem + 5vw, 4.5rem);

  /* 间距（4pt 基准） */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 6rem;

  /* 圆角 */
  --r-sm: 0.5rem;
  --r-md: 0.875rem;
  --r-lg: 1.25rem;
  --r-xl: 1.75rem;
  --r-pill: 999px;

  /* 阴影（克制） */
  --shadow-sm: 0 1px 2px oklch(24% 0.02 55 / 0.06);
  --shadow-md: 0 6px 18px oklch(24% 0.02 55 / 0.08);
  --shadow-lg: 0 18px 48px oklch(24% 0.02 55 / 0.12);

  /* 缓动（指数缓出，非回弹） */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --dur-fast: 160ms;
  --dur: 300ms;

  --maxw: 72rem;
  --nav-h: 4rem;
}

[data-theme="dark"] {
  --bg:           oklch(17% 0.012 60);
  --surface-1:    oklch(21% 0.012 60);
  --surface-2:    oklch(25% 0.012 60);
  --surface-3:    oklch(29% 0.012 60);
  --text-1:       oklch(95% 0.01 70);
  --text-2:       oklch(74% 0.015 70);
  --text-3:       oklch(58% 0.012 70);
  --border:       oklch(32% 0.012 60);
  --border-strong:oklch(40% 0.012 60);

  --accent:       oklch(72% 0.15 35);
  --accent-hover: oklch(78% 0.15 35);
  --accent-press: oklch(66% 0.14 35);
  --accent-soft:  oklch(28% 0.06 35);

  --shadow-sm: 0 1px 2px oklch(0% 0 0 / 0.3);
  --shadow-md: 0 6px 18px oklch(0% 0 0 / 0.38);
  --shadow-lg: 0 18px 48px oklch(0% 0 0 / 0.5);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--text-1);
}

::selection { background: var(--accent-soft); color: var(--accent-press); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}
.section { padding-block: var(--sp-9); }
.section--tight { padding-block: var(--sp-7); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-5);
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: transform var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
  will-change: transform;
}
.btn:active { transform: translateY(1px) scale(0.99); }

.btn--primary {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); }

.btn--ghost {
  background: transparent;
  color: var(--text-1);
  border: 1px solid var(--border-strong);
}
.btn--ghost:hover { background: var(--surface-2); }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: color-mix(in oklch, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-lg);
  letter-spacing: -0.02em;
}
.brand__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.nav__links { display: flex; align-items: center; gap: var(--sp-5); }
.nav__link {
  position: relative;
  font-size: var(--fs-sm);
  color: var(--text-2);
  padding: var(--sp-2) 0;
  transition: color var(--dur-fast) var(--ease);
}
.nav__link:hover { color: var(--text-1); }
.nav__link::after {
  content: "";
  position: absolute; left: 0; bottom: -2px;
  width: 100%; height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.nav__link:hover::after { transform: scaleX(1); }

.nav__actions { display: flex; align-items: center; gap: var(--sp-3); }

.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill);
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--surface-1);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.icon-btn:hover { color: var(--text-1); background: var(--surface-2); }

.nav__toggle { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; padding-block: var(--sp-9) var(--sp-8); overflow: hidden; }
.hero__glow {
  position: absolute;
  top: -10%; right: -5%;
  width: 38rem; height: 38rem;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}
.hero__inner { position: relative; z-index: 1; max-width: 46rem; }
.hero__title {
  font-size: var(--fs-3xl);
  margin-top: var(--sp-4);
}
.hero__title em {
  font-style: italic;
  color: var(--accent);
}
.hero__lead {
  font-size: var(--fs-lg);
  color: var(--text-2);
  margin-top: var(--sp-5);
  max-width: 38rem;
  line-height: 1.65;
}
.hero__meta {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  margin-top: var(--sp-5);
}
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.chip svg { width: 16px; height: 16px; color: var(--accent); }
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-6); }

/* ---------- Now Playing widget ---------- */
.now-playing {
  margin-top: var(--sp-7);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5) var(--sp-3) var(--sp-3);
  border-radius: var(--r-pill);
  background: var(--surface-1);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  max-width: 100%;
}
.now-playing__art {
  width: 44px; height: 44px; flex: none;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: grid; place-items: center;
  color: var(--accent-contrast);
}
.eq { display: flex; align-items: flex-end; gap: 2px; height: 18px; }
.eq span {
  width: 3px; border-radius: 2px;
  background: var(--accent-contrast);
  animation: eq 900ms var(--ease) infinite alternate;
}
.eq span:nth-child(1){ height: 40%; animation-delay: 0ms; }
.eq span:nth-child(2){ height: 80%; animation-delay: 150ms; }
.eq span:nth-child(3){ height: 55%; animation-delay: 300ms; }
.eq span:nth-child(4){ height: 100%; animation-delay: 450ms; }
.is-paused .eq span { animation-play-state: paused; }
@keyframes eq { from { transform: scaleY(0.4); } to { transform: scaleY(1); } }

.now-playing__meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.now-playing__label { font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-3); }
.now-playing__title { font-size: var(--fs-sm); font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-playing__play {
  width: 36px; height: 36px; flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  transition: background var(--dur-fast) var(--ease);
}
.now-playing__play:hover { background: var(--accent); color: var(--accent-contrast); }

/* ---------- Section heading ---------- */
.sec-head { max-width: 38rem; margin-bottom: var(--sp-6); }
.sec-head h2 { font-size: var(--fs-2xl); margin-top: var(--sp-3); }
.sec-head p { color: var(--text-2); margin-top: var(--sp-3); }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1fr; gap: var(--sp-6); align-items: start; }
@media (min-width: 860px) { .about { grid-template-columns: 1.4fr 1fr; } }
.about__body p { color: var(--text-2); margin-bottom: var(--sp-4); }
.about__body p strong { color: var(--text-1); font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.stat {
  padding: var(--sp-5);
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid var(--border);
}
.stat__num { font-family: var(--font-display); font-size: var(--fs-2xl); color: var(--accent); line-height: 1; }
.stat__label { font-size: var(--fs-sm); color: var(--text-2); margin-top: var(--sp-2); }

/* ---------- Cards grid (作品/动态) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: var(--sp-5);
}
.card {
  display: flex; flex-direction: column;
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card__tag {
  align-self: flex-start;
  font-family: var(--font-mono); font-size: var(--fs-xs);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: var(--sp-1) var(--sp-3); border-radius: var(--r-pill);
}
.card__title { font-size: var(--fs-xl); margin-top: var(--sp-4); }
.card__desc { color: var(--text-2); font-size: var(--fs-sm); margin-top: var(--sp-2); flex: 1; }
.card__foot { margin-top: var(--sp-5); display: flex; align-items: center; justify-content: space-between; }
.card__date { font-size: var(--fs-xs); color: var(--text-3); font-family: var(--font-mono); }
.card__arrow { color: var(--accent); transition: transform var(--dur) var(--ease); }
.card:hover .card__arrow { transform: translateX(4px); }

/* ---------- Contact ---------- */
.contact {
  border-radius: var(--r-xl);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
}
.contact h2 { font-size: var(--fs-2xl); }
.contact p { color: var(--text-2); margin-top: var(--sp-3); max-width: 32rem; margin-inline: auto; }
.contact__links { display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: center; margin-top: var(--sp-6); }

/* ---------- Footer ---------- */
.footer {
  margin-top: var(--sp-8);
  border-top: 1px solid var(--border);
  background: var(--surface-1);
}
.footer__inner {
  max-width: var(--maxw); margin-inline: auto;
  padding: var(--sp-7) var(--sp-5) var(--sp-5);
  display: grid; gap: var(--sp-6);
  grid-template-columns: 1fr;
}
@media (min-width: 760px) { .footer__inner { grid-template-columns: 1.5fr 1fr; } }
.footer__brand { font-family: var(--font-display); font-size: var(--fs-xl); }
.footer__tag { color: var(--text-2); margin-top: var(--sp-3); max-width: 26rem; font-size: var(--fs-sm); }
.footer__links { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-top: var(--sp-4); }
.footer__links a { font-size: var(--fs-sm); color: var(--text-2); transition: color var(--dur-fast) var(--ease); }
.footer__links a:hover { color: var(--accent); }

.filing {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  font-size: var(--fs-sm);
}
.filing__title { font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); margin-bottom: var(--sp-3); }
.filing__row { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); }
.filing__item { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text-2); }
.filing__item b { color: var(--text-1); font-weight: 600; }
.filing__item a { color: var(--accent); }
.filing__item a:hover { text-decoration: underline; }
.filing__sep { color: var(--border-strong); }

.footer__bar {
  max-width: var(--maxw); margin-inline: auto;
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  justify-content: space-between; align-items: center;
  font-size: var(--fs-xs); color: var(--text-3);
}
.to-top {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  color: var(--text-2); font-size: var(--fs-sm);
}
.to-top:hover { color: var(--accent); }

/* ---------- Utilities ---------- */
.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;
}
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 600ms var(--ease), transform 600ms var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Responsive Nav ---------- */
@media (max-width: 720px) {
  .nav__links {
    position: fixed; inset: var(--nav-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface-1);
    border-bottom: 1px solid var(--border);
    padding: var(--sp-3);
    transform: translateY(-120%);
    transition: transform var(--dur) var(--ease);
    box-shadow: var(--shadow-md);
  }
  .nav__links.is-open { transform: translateY(0); }
  .nav__link { padding: var(--sp-3) var(--sp-2); }
  .nav__link::after { display: none; }
  .nav__toggle { display: inline-flex; }
}

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