

:root {

  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --bg-soft: #fbfbfd;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --accent: #0071e3;
  --accent-strong: #0066cc;
  --accent-soft: #e8f0fe;
  --border: #d2d2d7;
  --on-accent: #ffffff;

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

  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --radius-pill: 980px;
  --max: 1080px;
  --nav-h: 52px;

  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.55s;

  --z-nav: 50;
  --z-skip: 100;
  --z-modal: 1000;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47059;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff; padding: 10px 18px;
  border-radius: 0 0 8px 0; z-index: var(--z-skip);
}
.skip-link:focus { left: 0; }

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

.section { padding: 104px 0; }
.section[id] { content-visibility: auto; contain-intrinsic-size: 520px; scroll-margin-top: var(--nav-h); }
.section--alt { background: var(--bg-alt); }
#about { padding-bottom: 40px; }

.section__head { margin-bottom: 56px; }
.section__head--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.section__tag {
  display: block;
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}
.section__title {
  font-size: clamp(30px, 4.5vw, 44px);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.1;
}

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  height: var(--nav-h);
  background: transparent;
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease),
    background-color 0.3s var(--ease);
}
.nav.is-hidden {
  pointer-events: none;
  visibility: hidden;
}
.nav__inner {
  max-width: var(--max);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav__links a {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  padding: 8px 14px;
  margin: -8px -14px;
  border-radius: var(--radius-pill);
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.3);
}
.nav__links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  text-decoration: none;
}

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 24px;
  overflow: hidden;
  background: #0b0b0f;
}
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero__bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.hero__bg video.is-ready {
  opacity: 1;
}
.hero__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 90% 65% at 50% 38%, rgba(0, 113, 227, 0.28), transparent 70%),
    #0b0b0f;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  letter-spacing: 0.06em;
}
.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.35);
}
.hero__inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}
.hero__eyebrow {
  font-size: 17px;
  font-weight: 600;
  color: #2997ff;
  margin-bottom: 16px;
}
.hero__title {
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #fff;
}

.btn {
  display: inline-block;
  font-size: 17px;
  font-weight: 500;
  padding: 12px 26px;
  border-radius: var(--radius-pill);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease),
    transform 0.15s var(--ease);
}
.btn:active { transform: scale(0.96); }
.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn--primary:hover { background: var(--accent-strong); text-decoration: none; }
.btn--ghost {
  background: transparent;
  color: var(--accent);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.btn--ghost:hover { background: var(--accent-soft); text-decoration: none; }

.about__grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 48px;
  align-items: start;
}
.about__tags { display: flex; flex-direction: column; gap: 14px; }
.tag {
  position: relative;
  padding: 18px 20px;
  background: var(--bg);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text-2);
  box-shadow: 0 1px 0 var(--border);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}
.tag:hover {
  transform: translateY(-7px);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.11), 0 1px 0 var(--border);
}
.tag strong { display: block; font-size: 18px; color: var(--text); margin-bottom: 4px; }
.about__body p { color: var(--text-2); font-size: 17px; }
.about__body p + p { margin-top: 18px; }

.quote {
  --quote-shift: 72px;
  margin: 40px 0 0;
  padding: 28px 32px 22px;
  text-align: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.quote p {
  font-size: clamp(22px, 3.4vw, 30px);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--text);
  padding-right: calc(2 * var(--quote-shift));
}
.quote cite {
  display: block;
  margin-top: 14px;
  font-style: normal;
  font-size: 15px;
  color: var(--text-3);
  text-align: center;
  padding-left: calc(2 * var(--quote-shift));
}

.grid { display: grid; gap: 20px; }

.article-preview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.article-preview {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 0;
  background: var(--bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 0 var(--border), 0 4px 14px rgba(0, 0, 0, 0.05);
  color: var(--text);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), opacity 0.4s var(--ease);
  animation: preview-fade 0.45s var(--ease-out);
}
.article-preview.is-leaving {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
a.article-preview,
a.article-preview:hover { color: inherit; text-decoration: none; }
.article-preview:hover {
  transform: translateY(-9px);
  box-shadow: 0 1px 0 var(--border), 0 24px 48px rgba(0, 0, 0, 0.13);
}
.article-preview:active { transform: translateY(-1px) scale(0.995); }
.article-preview__media {
  position: relative;
  width: 34%;
  min-height: 150px;
  background: var(--bg-alt);
  overflow: hidden;
  flex: none;
}
.article-preview__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease);
}
.article-preview:hover .article-preview__media img { transform: scale(1.03); }
.article-preview__ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}
.article-preview__ph svg { width: 36px; height: 36px; }
.article-preview__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 15px 18px;
  flex: 1 1 auto;
  min-width: 0;
}
.article-preview__title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-preview__date {
  margin-top: 0;
  font-size: 13px;
  color: var(--text-3);
}
.article-preview__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.article-preview__tag { padding: 3px 10px; font-size: 12px; border-radius: var(--radius-pill); background: var(--bg-alt); color: var(--text-2); }
.article-preview__excerpt { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.article-preview__body { min-height: 210px; }
.article-detail__body, .article-detail__body p, .md-editor__preview, .md-editor__preview p { white-space: pre-wrap; }
.article-preview__dots { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }
.article-preview__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.article-preview__dot:hover { background: var(--text-2); }
.article-preview__dot.is-active { background: var(--accent); transform: scale(1.25); }
.articles-more { flex: 0 0 auto; }
@keyframes preview-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.skills {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: 520px;
}
.skill-item__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.skill-item__name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.skill-item__pct {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.skill-item__track {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.skill-item__fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
}

.grid--projects { grid-template-columns: repeat(3, 1fr); }
.project {
  position: relative;
  display: block;
  height: 140px;
  padding: 22px 28px;
  overflow: hidden;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 0 var(--border), 0 4px 18px rgba(0, 0, 0, 0.04);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}
.project:hover {
  transform: translateY(-9px);
  box-shadow: 0 26px 54px rgba(0, 0, 0, 0.15), 0 1px 0 var(--border);
}
.project:active { transform: translateY(-1px) scale(0.995); }
.project--featured { background: var(--accent-soft); }
a.project,
a.project:hover { color: inherit; text-decoration: none; }

/* 卡片悬浮：流动的蓝色渐变描边（关于 / 文章 / 项目 / 相册共用） */
.gallery-item__media::after,
.project::after,
.article-card::after,
.article-preview::after,
.tag::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 3px;
  background: linear-gradient(135deg, #0a84ff 0%, #5ac8fa 35%, #0071e3 70%, #5ac8fa 100%);
  background-size: 220% 220%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  pointer-events: none;
  z-index: 3;
}
.gallery-item:hover .gallery-item__media::after,
.project:hover::after,
.article-card:hover::after,
.article-preview:hover::after,
.tag:hover::after {
  opacity: 1;
  animation: bian-kuang-liu-dong 3.2s linear infinite;
}
@keyframes bian-kuang-liu-dong {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.project h3 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 22px;
  font-weight: 600;
}
.project p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 10px;
  font-size: 16px;
  color: var(--text-2);
}

#contact { padding-top: 37px; padding-bottom: 37px; }
.contact-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 44px;
}
.contact-item-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.contact-item {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  transition: color 0.2s var(--ease), background 0.2s var(--ease),
    border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.contact-item:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 113, 227, 0.28);
  text-decoration: none;
}
.contact-item:active { transform: translateY(-1px) scale(0.94); }
.contact-item svg { width: 30px; height: 30px; display: block; }
.article-preview__dots { display: none !important; }

.footer {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
}
.footer__meta { font-size: 13px; color: var(--text-3); }

.reveal {
  opacity: 0;
}
.reveal.is-visible {
  opacity: 1;
  animation: reveal-up var(--dur) var(--ease);
}
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

.album {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  height: 460px;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}
.album__main {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border), 0 4px 18px rgba(0, 0, 0, 0.04);
  height: 100%;
}
.album__track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.65s var(--ease-out);
  will-change: transform;
}
.album__slide {
  flex: 0 0 100%;
  min-width: 100%;
  position: relative;
}
.album__slide-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
.album__dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}
.album__dot {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
}
.album__dot::after {
  content: '';
  position: absolute;
  inset: -12px;
}
.album__dot.is-active { background: #fff; transform: scale(1.3); }

.album__thumbs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 18px;
  height: 100%;
}
.album__thumb {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  padding: 0;
  background: none;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}
.album__thumb:hover { opacity: 0.85; }
.album__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.album__more { flex: 0 0 auto; }

@media (max-width: 900px) {
  .about__grid { grid-template-columns: 1fr; gap: 32px; }
  .grid--projects { grid-template-columns: repeat(2, 1fr); }
  .album { grid-template-columns: 1fr; height: auto; padding: 0 24px; }
  .album__main { height: auto; aspect-ratio: 16 / 9; }
  .album__thumbs { grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr; height: 80px; }
}

@media (max-width: 640px) {
  .section { padding: 64px 0; }
  .hero { padding: 72px 20px 72px; }
  .section__head { margin-bottom: 40px; }
  .article-preview-grid { grid-template-columns: 1fr; }
  .article-preview { flex-direction: column; }
  .article-preview__media { width: 100%; min-height: 0; aspect-ratio: 16 / 9; }
  .article-preview__body { padding: 18px 20px 20px; }
  .grid--projects { grid-template-columns: 1fr; }
  .project { padding: 22px 20px; }
  .quote p { padding-right: 0; }
  .quote cite { padding-left: 0; }
  .contact-grid { gap: 28px; }
  .nav { background: rgba(13, 14, 17, 0.78); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px); }
  .nav__inner { padding: 0 16px; }
  .nav__links { gap: 18px; }
  .nav__links a { font-size: 13px; text-shadow: none; }
  .album { padding: 0 8px; gap: 8px; }
  .section__head--row { flex-direction: column; align-items: flex-start; gap: 16px; }
}

@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;
  }
  .reveal { opacity: 1; transform: none; }
}

.is-hidden { display: none !important; }

.empty {
  padding: 56px 24px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-3);
  font-size: 15px;
}

.projects-more { flex: 0 0 auto; }
.more-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--on-accent);
  background: var(--accent);
  padding: 12px 26px;
  border-radius: var(--radius-pill);
  transition: background-color 0.2s var(--ease), transform 0.15s var(--ease),
    box-shadow 0.2s var(--ease);
}
.more-link:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 113, 227, 0.28);
  text-decoration: none;
}
.more-link:active { transform: scale(0.96); }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: rgba(10, 10, 12, 0.92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.lightbox.is-open { display: flex; }
.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s var(--ease);
}
/* 新图还在下载时把旧的藏起来：否则会“先看到上一张”，等新图解码完才跳过去。 */
.lightbox.is-loading .lightbox__img { opacity: 0; }
.lightbox__spin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  pointer-events: none;
}
.lightbox.is-loading .lightbox__spin {
  display: block;
  animation: deng_xiang_zhuan 0.9s linear infinite;
}
@keyframes deng_xiang_zhuan { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .lightbox.is-loading .lightbox__spin { animation: none; }
}
.lightbox__close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.28); }
.lightbox__prev,
.lightbox__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.lightbox__prev:hover,
.lightbox__next:hover { background: rgba(255, 255, 255, 0.28); }
.lightbox__prev { left: 20px; }
.lightbox__next { right: 20px; }
.lightbox__caption {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 14px;
  text-align: center;
}
@media (max-width: 768px) {
  .lightbox__prev { left: 8px; width: 40px; height: 40px; font-size: 26px; }
  .lightbox__next { right: 8px; width: 40px; height: 40px; font-size: 26px; }
}
body.lightbox-open { overflow: hidden; }

.site-load-error {
  width: min(92vw, 560px);
  margin: 56px auto;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-2);
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.site-load-error p { margin: 0 0 14px; }
.btn--retry {
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.btn--retry:hover { border-color: var(--brand); color: var(--brand); }
