/* ==========================================================
   纸墨 · Personal Website
   纸白为底，浓墨为字，朱砂为印。
   ========================================================== */

:root {
  --paper: #f4efe6;
  --paper-deep: #ece5d6;
  --ink: #1c1a16;
  --ink-soft: #45403a;
  --muted: #877f70;
  --line: #d6cdba;
  --accent: #c8371e;
  --accent-deep: #a02a15;

  --serif: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --en: "Fraunces", "Georgia", serif;

  --maxw: 72rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

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

/* ---------- 纸张噪点 ---------- */
.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 999;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 页头 ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem var(--gutter);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}
.site-header.scrolled {
  background: rgba(244, 239, 230, 0.88);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--serif);
  font-weight: 700;
}
.brand-seal {
  display: grid;
  place-items: center;
  width: 2rem; height: 2rem;
  background: var(--accent);
  color: var(--paper);
  font-size: 1.1rem;
  border-radius: 0.3rem;
  transform: rotate(-4deg);
}
.brand-name { letter-spacing: 0.15em; }

.site-nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2.2rem);
  font-size: 0.92rem;
  letter-spacing: 0.12em;
}
.site-nav a {
  position: relative;
  padding: 0.2rem 0;
  color: var(--ink-soft);
  transition: color 0.25s;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-contact {
  color: var(--accent) !important;
  font-weight: 700;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7rem var(--gutter) 5rem;
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
}

.hero-kicker {
  font-family: var(--en);
  font-size: 0.85rem;
  letter-spacing: 0.35em;
  color: var(--muted);
  margin-bottom: 1.6rem;
}

.hero-name {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(2.8rem, 9vw, 6.5rem);
  line-height: 1.18;
  letter-spacing: 0.04em;
}
.hero-name .accent { color: var(--accent); }

.hero-sub {
  margin-top: 2rem;
  max-width: 34em;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2.6rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  border: 1.5px solid var(--ink);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s, color 0.25s;
}
.btn-solid {
  background: var(--ink);
  color: var(--paper);
}
.btn-solid:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}
.btn-ghost { color: var(--ink); }
.btn-ghost:hover {
  background: var(--paper);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--accent);
}

/* 竖排引言 + 印章 */
.hero-vertical {
  position: absolute;
  right: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-size: clamp(0.95rem, 1.4vw, 1.2rem);
  letter-spacing: 0.5em;
  color: var(--muted);
  border-right: 1px solid var(--line);
  padding-right: 1.2rem;
  height: min(60vh, 26rem);
}
.hero-stamp {
  position: absolute;
  right: calc(var(--gutter) + 1rem);
  bottom: 12%;
  writing-mode: vertical-rl;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.15rem;
  padding: 0.5rem;
  background: var(--accent);
  color: var(--paper);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
  border-radius: 0.35rem;
  transform: rotate(3deg);
  box-shadow: 0.35rem 0.35rem 0 rgba(28, 26, 22, 0.15);
}

/* ---------- 章节通用 ---------- */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(4rem, 10vh, 7rem) var(--gutter);
}
.section + .section { border-top: 1px solid var(--line); }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: clamp(2.5rem, 6vh, 4rem);
}
.section-no {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--accent);
}
.section-title {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  letter-spacing: 0.25em;
}
.section-rule {
  flex: 1;
  height: 1px;
  background: var(--line);
  align-self: center;
}
.section-en {
  font-family: var(--en);
  font-style: italic;
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- 关于 ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
}
.lead {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  font-weight: 600;
  line-height: 1.8;
  margin-bottom: 1.8rem;
}
.about-text p + p { margin-top: 1.2rem; color: var(--ink-soft); }
.about-text a {
  color: var(--accent);
  font-weight: 500;
  border-bottom: 1px solid var(--accent);
  transition: background 0.25s, color 0.25s;
}
.about-text a:hover { background: var(--accent); color: var(--paper); }

.side-title {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--muted);
  margin: 1.8rem 0 0.9rem;
}
.side-title:first-child { margin-top: 0.4rem; }

.now-list { list-style: none; }
.now-list li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.35rem 0;
  color: var(--ink-soft);
}
.dot {
  width: 0.5rem; height: 0.5rem;
  background: var(--accent);
  border-radius: 50%;
  flex: none;
  transform: translateY(-1px);
}

.skill-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.skill-tags li {
  padding: 0.25rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.35);
  transition: border-color 0.25s, color 0.25s, transform 0.25s;
}
.skill-tags li:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- 作品 ---------- */
.work-list { list-style: none; border-top: 1px solid var(--line); }
.work-item { border-bottom: 1px solid var(--line); }
.work-item a {
  display: grid;
  grid-template-columns: 3.5rem 14rem 1fr 4.5rem 2rem;
  align-items: center;
  gap: 1.2rem;
  padding: 1.6rem 0.8rem;
  transition: background 0.3s ease, color 0.3s ease, padding-left 0.3s ease;
}
.work-index {
  font-family: var(--en);
  font-style: italic;
  color: var(--muted);
  font-size: 0.95rem;
}
.work-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.work-name em {
  font-family: var(--en);
  font-style: italic;
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 0.7rem;
  letter-spacing: 0.05em;
}
.work-desc {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
}
.work-year {
  font-family: var(--en);
  color: var(--muted);
  text-align: right;
}
.work-arrow {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}
.work-item a:hover {
  background: var(--ink);
  color: var(--paper);
  padding-left: 1.6rem;
}
.work-item a:hover .work-index,
.work-item a:hover .work-desc,
.work-item a:hover .work-year,
.work-item a:hover .work-name em { color: rgba(244, 239, 230, 0.65); }
.work-item a:hover .work-arrow {
  color: var(--accent);
  transform: translateX(6px);
}

/* ---------- 经历 ---------- */
.timeline {
  list-style: none;
  max-width: 46rem;
}
.timeline li {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 2rem;
  padding: 1.8rem 0;
  border-bottom: 1px dashed var(--line);
}
.timeline li:last-child { border-bottom: none; }
.tl-year {
  font-family: var(--en);
  font-style: italic;
  color: var(--accent);
  font-size: 1rem;
  padding-top: 0.3rem;
  white-space: nowrap;
}
.tl-body h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.tl-body p { color: var(--ink-soft); font-size: 0.97rem; }

/* ---------- 联系 ---------- */
.section-contact { padding-bottom: 6rem; }
.contact-body { max-width: 46rem; }
.contact-big {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  line-height: 1.25;
  margin-bottom: 1.8rem;
}
.contact-note {
  color: var(--ink-soft);
  max-width: 32em;
  margin-bottom: 2.4rem;
}
.contact-mail {
  display: inline-block;
  font-family: var(--en);
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  font-weight: 600;
  color: var(--ink);
  border-bottom: 3px solid var(--accent);
  padding-bottom: 0.2rem;
  transition: color 0.25s, background 0.25s;
}
.contact-mail:hover { color: var(--accent); }
.contact-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  margin-top: 2.6rem;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
}
.contact-links a {
  color: var(--muted);
  border-bottom: 1px solid transparent;
  transition: color 0.25s, border-color 0.25s;
}
.contact-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem var(--gutter) 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.8rem;
  max-width: var(--maxw);
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.88rem;
}
.footer-meta a {
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  transition: color 0.25s, border-color 0.25s;
}
.footer-meta a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- 动画 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

.scroll-fade {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--d, 0s);
}
.scroll-fade.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .scroll-fade {
    opacity: 1;
    transform: none;
    animation: none;
    transition: none;
  }
  html { scroll-behavior: auto; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 56rem) {
  .about-grid { grid-template-columns: 1fr; }
  .work-item a {
    grid-template-columns: 2.5rem 1fr 3.2rem;
    grid-template-areas:
      "idx name year"
      ".   desc desc";
    row-gap: 0.4rem;
  }
  .work-index { grid-area: idx; }
  .work-name { grid-area: name; white-space: normal; }
  .work-desc { grid-area: desc; }
  .work-year { grid-area: year; }
  .work-arrow { display: none; }
  .hero-vertical, .hero-stamp { display: none; }
  .timeline li { grid-template-columns: 1fr; gap: 0.4rem; }
}

@media (max-width: 34rem) {
  .site-nav { gap: 0.9rem; font-size: 0.85rem; }
  .brand-name { display: none; }
  .section-en { display: none; }
  .work-item a { padding: 1.2rem 0.4rem; }
}
