/* ==========================================================================
   个人主页 · 设计系统 v5「暖纸（初版定稿）」
   暖白纸底 + 衬线大标题 + 朱砂点缀
   ========================================================================== */

:root {
  /* ---- 浅色 ---- */
  --paper: #f7f5f0;
  --paper-2: #efece4;
  --ink: #17150f;
  --ink-soft: #4b4740;
  --muted: #8b8578;
  --line: rgba(23, 21, 15, 0.13);
  --line-strong: rgba(23, 21, 15, 0.22);
  --accent: #c4553a;
  --accent-soft: rgba(196, 85, 58, 0.09);
  --shadow: 0 1px 2px rgba(23, 21, 15, 0.04), 0 18px 40px -20px rgba(23, 21, 15, 0.18);

  /* 字体 —— 全部系统字体，零下载、离线可用、首屏最快 */
  --font-display: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', 'Songti SC',
    'Noto Serif SC', Georgia, serif;
  --font-sans: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;

  --wrap: 1040px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius: 14px;

  color-scheme: light;
}

[data-theme='dark'] {
  --paper: #121110;
  --paper-2: #1a1917;
  --ink: #f2efe8;
  --ink-soft: #b9b4a9;
  --muted: #807b72;
  --line: rgba(242, 239, 232, 0.14);
  --line-strong: rgba(242, 239, 232, 0.24);
  --accent: #e07a5f;
  --accent-soft: rgba(224, 122, 95, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 40px -20px rgba(0, 0, 0, 0.6);

  color-scheme: dark;
}

/* ---------- 基础 ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* 极淡的纸张颗粒，给纯色底一点质感 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

[data-theme='dark'] body::after {
  mix-blend-mode: screen;
  opacity: 0.035;
}

h1,
h2,
h3,
p,
ul,
figure {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

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

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

::selection {
  background: var(--accent);
  color: #fff;
}

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

/* ---------- 布局工具 ---------- */

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.85rem;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ---------- 顶栏 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 1.9rem);
}

.nav a {
  position: relative;
  font-size: 0.82rem;
  color: var(--ink-soft);
  padding-block: 0.35rem;
  transition: color 0.2s ease;
}

.nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav a.is-active {
  color: var(--ink);
}

.nav a.is-active::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* 主题切换按钮 */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  transform: rotate(-12deg);
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
}

.theme-toggle .icon-moon,
[data-theme='dark'] .theme-toggle .icon-sun {
  display: none;
}

[data-theme='dark'] .theme-toggle .icon-moon {
  display: block;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding-block: clamp(4rem, 11vh, 8.5rem) clamp(3rem, 7vw, 5.5rem);
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: end;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}

.eyebrow__line {
  display: block;
  width: 42px;
  height: 1px;
  background: var(--accent);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3rem, 9.5vw, 6.6rem);
  line-height: 0.94;
  letter-spacing: -0.028em;
  margin-bottom: 1.5rem;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.role {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--ink);
  letter-spacing: 0.01em;
  margin-bottom: 1rem;
}

.lede {
  max-width: 44ch;
  color: var(--ink-soft);
  font-size: 0.97rem;
  line-height: 1.85;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.78rem 1.35rem;
  border-radius: 999px;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--solid {
  background: var(--ink);
  color: var(--paper);
}

.btn--solid:hover {
  background: var(--accent);
  color: #fff;
}

.btn--ghost {
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--ink);
  background: var(--accent-soft);
}

.btn__arrow {
  transition: transform 0.24s ease;
}

.btn:hover .btn__arrow {
  transform: translateX(3px);
}

/* 状态卡 */
.status {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper-2) 55%, transparent);
  padding: 1.15rem 1.25rem 1.3rem;
  box-shadow: var(--shadow);
}

.status__live {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
  font-size: 0.82rem;
}

.status__pulse {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b9e7f;
}

.status__pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid #6b9e7f;
  opacity: 0.5;
  animation: pulse 2.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.65);
    opacity: 0.7;
  }
  70% {
    transform: scale(1.6);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

.status__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.6rem;
  border-bottom: 1px dashed var(--line);
  font-size: 0.82rem;
}

.status__row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.status__row dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.67rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status__row dd {
  margin: 0;
  text-align: right;
  color: var(--ink-soft);
}

/* ---------- 通用区块 ---------- */

.section {
  padding-block: clamp(3.5rem, 8vw, 6rem);
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: clamp(2rem, 4vw, 3.2rem);
}

.section-head__num {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--accent);
  letter-spacing: 0.12em;
}

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.section-head__note {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- 作品列表 ---------- */

.work-list {
  border-top: 1px solid var(--line);
}

.work-row {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto auto 1.6rem;
  align-items: start;
  gap: clamp(0.75rem, 2.5vw, 2rem);
  padding: 1.55rem 1rem;
  margin-inline: -1rem;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  transition: background 0.25s ease;
}

.work-row:hover {
  background: var(--accent-soft);
}

.work-row__title {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.1vw, 1.45rem);
  line-height: 1.35;
  letter-spacing: -0.005em;
  transition: color 0.25s ease;
}

.work-row__desc {
  display: block;
  margin-top: 0.4rem;
  max-width: 54ch;
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--ink-soft);
}

.work-row__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-top: 0.35rem;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.69rem;
  color: var(--muted);
  white-space: nowrap;
}

.work-row__arrow {
  font-size: 1.05rem;
  color: var(--muted);
  padding-top: 0.2rem;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), color 0.25s ease;
}

.work-row:hover .work-row__arrow {
  color: var(--accent);
  transform: translate(3px, -3px);
}

.work-more {
  margin-top: 1.2rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.work-more a {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.work-more a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- 联系 ---------- */

.contact h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 5.5vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.022em;
  max-width: 20ch;
  margin-bottom: 1.2rem;
}

.contact__note {
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.85;
  margin-bottom: 2.2rem;
}

.mail-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3.4vw, 1.9rem);
  letter-spacing: -0.01em;
  padding-bottom: 0.25rem;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  transition: background-size 0.35s cubic-bezier(0.4, 0, 0.2, 1), color 0.25s ease;
}

.mail-link:hover {
  color: var(--accent);
  background-size: 100% 2px;
}

.mail-link svg {
  width: 0.62em;
  height: 0.62em;
  align-self: center;
}

.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
  margin-top: 2.4rem;
}

.contact__links a {
  font-size: 0.85rem;
  color: var(--muted);
  transition: color 0.2s ease;
}

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

/* ---------- 页脚 ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

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

/* ---------- 滚动入场（无 JS 时内容照常显示） ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .hero__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .status {
    max-width: 420px;
  }

  .work-row {
    grid-template-columns: 2rem minmax(0, 1fr) 1.4rem;
    row-gap: 0.5rem;
    padding-block: 1.3rem;
  }

  .work-row__tags {
    grid-column: 2 / -1;
    padding-top: 0.35rem;
  }

  /* 箭头固定在右上角，避免被自动排版挤到下一行 */
  .work-row__arrow {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }

  .work-row__year {
    display: none;
  }
}

@media (max-width: 560px) {
  .site-header__inner {
    height: 58px;
  }

  .nav {
    gap: 0.9rem;
  }

  .nav a {
    font-size: 0.78rem;
  }

  .section-head__note {
    display: none;
  }

  .hero {
    padding-block: 3.2rem 3rem;
  }
}

/* ---------- 无障碍：尊重「减少动态效果」 ---------- */

@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;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}

@media print {
  body::after,
  .site-header,
  .theme-toggle,
  .hero__actions {
    display: none;
  }
}

/* ==========================================================================
   v6 · 滚动进度 / 图文作品条目 / 页脚
   ========================================================================== */

/* ---------- 顶部滚动进度 ---------- */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  z-index: 60;
  background: var(--accent);
  transition: width 0.08s linear;
  pointer-events: none;
}

/* ---------- 图文作品条目 ---------- */

.work-list {
  border-top: 1px solid var(--line);
}

.work-row {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) 1.6rem;
  gap: clamp(1rem, 2.6vw, 2.2rem);
  align-items: center;
  padding: 1.9rem 1rem;
  margin-inline: -1rem;
  border-bottom: 1px solid var(--line);
  border-radius: 10px;
  transition: background 0.3s ease;
}

.work-row:hover {
  background: var(--accent-soft);
}

.work-figure {
  margin: 0;
  height: 104px;
  color: var(--muted);
  opacity: 0.85;
  transition: color 0.35s ease, opacity 0.35s ease, transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.work-figure svg {
  width: 100%;
  height: 100%;
}

.work-row:hover .work-figure {
  color: var(--accent);
  opacity: 1;
  transform: translateY(-3px);
}

.work-meta {
  display: flex;
  gap: 0.9rem;
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.work-body .work-row__title {
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
}

.work-body .work-row__desc {
  max-width: 54ch;
}

.work-body .work-row__tags {
  margin-top: 0.9rem;
  padding-top: 0;
}

.work-row__arrow {
  align-self: center;
  justify-self: end;
  padding-top: 0;
  font-size: 1.1rem;
}

/* ---------- 页脚 ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2.6rem 2rem;
  margin-top: 0;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--line);
}

.footer-name {
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1;
  letter-spacing: -0.01em;
}

.footer-name em {
  font-style: italic;
  color: var(--accent);
}

.footer-desc {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
}

.footer-links a {
  font-size: 0.84rem;
  color: var(--ink-soft);
  transition: color 0.2s ease;
}

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

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding-top: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

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

/* ---------- 纵向节奏 ---------- */

.section {
  padding-block: clamp(3.5rem, 9vw, 6.5rem);
}

.hero {
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .work-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem;
    align-items: start;
    padding: 1.5rem 0.9rem;
  }

  .work-figure {
    width: 124px;
    height: 84px;
  }

  .work-row__arrow {
    display: none;
  }
}

/* ---------- 技术栈 ---------- */

.stack {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.stack__col {
  padding: 1.6rem 1.4rem 1.7rem;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.stack__col:first-child {
  border-left: 0;
  padding-left: 0;
}

.stack__label {
  margin-bottom: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.stack__list li {
  font-size: 0.84rem;
  line-height: 2;
  color: var(--ink-soft);
}

@media (max-width: 900px) {
  .stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stack__col:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }

  .stack__col:nth-child(n + 3) {
    border-bottom: 0;
  }
}

/* ==========================================================================
   v7 · 首屏占满一屏，只放 Hero
   ========================================================================== */

.hero {
  display: flex;
  align-items: center;
  min-height: calc(100vh - 64px);
  min-height: calc(100svh - 64px);
  /* 上小下大的内边距：在垂直居中的基础上整体上提约 7vh，更接近视觉重心 */
  padding-top: clamp(2.4rem, 4.5vh, 3.5rem);
  padding-bottom: clamp(6.5rem, 20vh, 14rem);
}

.hero__grid {
  gap: clamp(2.5rem, 6vw, 5rem);
}

.eyebrow {
  margin-bottom: 1.9rem;
}

.hero h1 {
  margin-bottom: 1.8rem;
}

.role {
  margin-bottom: 0;
}

.hero__actions {
  margin-top: 2.8rem;
}

@media (max-width: 900px) {
  .hero {
    min-height: 0;
    padding-block: 3.4rem 3.6rem;
  }
}
