/* ==========================================
   张俊龙 个人网站 — 样式表
   ========================================== */

/* ---------- CSS 变量 ---------- */
:root {
  --bg-primary: #080808;
  --bg-secondary: #0f0f0f;
  --bg-card: #141414;
  --text-primary: #f0f0f0;
  --text-secondary: #888888;
  --text-muted: #555555;
  --accent-red: #e63946;
  --accent-teal: #2ec4b6;
  --accent-red-dim: rgba(230, 57, 70, 0.15);
  --accent-teal-dim: rgba(46, 196, 182, 0.12);
  --border: rgba(255, 255, 255, 0.06);
  --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 1400px;
  --section-padding: clamp(80px, 12vw, 160px);
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg-primary);
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-teal);
  text-decoration-thickness: 1.5px;
}

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

.nav__link,
.nav__brand,
.contact__link,
.project-card {
  text-decoration: none;
  color: inherit;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ==========================================
   预加载动画
   ========================================== */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.preloader__bg {
  position: absolute;
  inset: 0;
  background: var(--bg-primary);
  pointer-events: none;
}

.preloader__overlay {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  animation-duration: 0.8s;
  animation-fill-mode: forwards;
  animation-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1);
}

.preloader__overlay--red {
  background: var(--accent-red);
  animation-name: overlayRedShift;
}

.preloader__overlay--teal {
  background: var(--accent-teal);
  animation-name: overlayTealShift;
}

@keyframes overlayRedShift {
  0%   { opacity: 0; transform: translateX(-5%); }
  30%  { opacity: 0.8; transform: translateX(0); }
  60%  { opacity: 0.6; transform: translateX(3%); }
  100% { opacity: 0; transform: translateX(5%); }
}

@keyframes overlayTealShift {
  0%   { opacity: 0; transform: translateX(5%); }
  30%  { opacity: 0.8; transform: translateX(0); }
  60%  { opacity: 0.6; transform: translateX(-3%); }
  100% { opacity: 0; transform: translateX(-5%); }
}

.preloader__text {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 0.08em;
  font-size: clamp(64px, 10vw, 120px);
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.preloader__char {
  display: block;
  opacity: 0;
  animation: charReveal 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.preloader__char--1 { animation-delay: 0.1s; }
.preloader__char--2 { animation-delay: 0.3s; }
.preloader__char--3 { animation-delay: 0.5s; }

@keyframes charReveal {
  0%   { opacity: 0; transform: translateY(40px); filter: blur(8px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* Preloader 退出 */
.preloader--exit {
  animation: preloaderFadeOut 0.7s cubic-bezier(0.7, 0, 0.84, 0) forwards;
  animation-delay: 0.2s;
}

@keyframes preloaderFadeOut {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05); visibility: hidden; }
}

/* ==========================================
   白天/夜间模式
   ========================================== */
[data-theme="light"] {
  --bg-primary: #f3f3f3;
  --bg-secondary: #eaeaea;
  --bg-card: #e0e0e0;
  --text-primary: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #999999;
  --border: rgba(0, 0, 0, 0.08);
  --accent-red-dim: rgba(230, 57, 70, 0.08);
  --accent-teal-dim: rgba(46, 196, 182, 0.08);
}

[data-theme="light"] .hero__title-line--accent {
  -webkit-text-stroke: 1px var(--text-primary);
}

/* ==========================================
   导航
   ========================================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px clamp(24px, 5vw, 60px);
  transition: background 0.3s, backdrop-filter 0.3s, border-bottom 0.3s;
}

.nav__brand {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.nav__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

.nav__name-en {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  font-style: italic;
  font-family: 'Georgia', 'Times New Roman', serif;
}

.nav__logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.nav__links {
  display: flex;
  gap: 32px;
}

.nav__link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.3s;
  position: relative;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--text-primary);
  transition: width 0.3s;
}

.nav__link:hover {
  color: var(--text-primary);
}

.nav__link:hover::after {
  width: 100%;
}

.nav__link--resume {
  border: 1px solid var(--accent-teal);
  padding: 6px 16px;
  border-radius: 100px;
  color: var(--accent-teal);
  transition: all 0.3s;
}

.nav__link--resume::after {
  display: none;
}

.nav__link--resume:hover {
  background: var(--accent-teal);
  color: #fff;
}

/* 主题切换按钮 */
.nav__theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.3s;
  background: transparent;
  cursor: pointer;
  margin-left: 8px;
  position: relative;
  overflow: hidden;
}

.nav__theme-toggle:hover {
  border-color: var(--accent-teal);
}

.theme-toggle__icon {
  position: absolute;
  transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.3s;
}

[data-theme="dark"] .theme-toggle__icon--sun {
  transform: translateY(30px);
  opacity: 0;
}

[data-theme="dark"] .theme-toggle__icon--moon {
  transform: translateY(0);
  opacity: 1;
}

[data-theme="light"] .theme-toggle__icon--moon {
  transform: translateY(-30px);
  opacity: 0;
}

[data-theme="light"] .theme-toggle__icon--sun {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================
   Hero
   ========================================== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 120px clamp(24px, 5vw, 60px) 40px;
  position: relative;
}

.hero__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
}

.hero__tag {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-teal);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero__title {
  font-size: clamp(56px, 8vw, 120px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.03em;
  margin-bottom: 32px;
}

.hero__title-line {
  display: block;
}

.hero__title-line--accent {
  color: transparent;
  -webkit-text-stroke: 1px var(--text-primary);
}

.hero__desc {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 400px;
}

/* 肖像占位 */
.hero__portrait {
  position: relative;
  width: clamp(280px, 35vw, 420px);
  height: clamp(280px, 35vw, 420px);
  margin-left: auto;
}

.hero__portrait-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  position: relative;
  z-index: 2;
  overflow: hidden;
}

.hero__portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.hero__glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 120%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-red-dim) 0%, transparent 70%);
  z-index: 1;
  animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 0.8; transform: translate(-50%, -50%) scale(1.08); }
}

/* 向下滚动 */
.hero__scroll {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hero__scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--text-muted), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* ==========================================
   Section 通用
   ========================================== */
.section__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 60px);
}

.section__label {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 60px;
}

.section__number {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-red);
  letter-spacing: 0.1em;
}

.section__heading {
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ==========================================
   关于我
   ========================================== */
.about {
  padding: var(--section-padding) 0;
}

.about__content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
}

.about__text {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.8;
}

.about__text--large {
  font-size: clamp(20px, 2.5vw, 28px);
  line-height: 1.5;
  color: var(--text-primary);
  font-weight: 500;
}

.about__skills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.about__education {
  border-left: 2px solid var(--accent-teal);
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.about__edu-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-teal);
  letter-spacing: 0.08em;
}

.about__edu-school {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.about__edu-link {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--accent-teal);
  text-decoration-thickness: 2px;
  transition: color 0.3s;
}

.about__edu-link:hover {
  color: var(--accent-teal);
}

.about__edu-degree {
  font-weight: 400;
  color: var(--text-secondary);
}

.about__edu-date {
  font-size: 13px;
  color: var(--text-muted);
}

.skill-tag {
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.3s;
}

.skill-tag:hover {
  border-color: var(--accent-teal);
  color: var(--accent-teal);
  background: var(--accent-teal-dim);
}

/* ==========================================
   作品展示
   ========================================== */
.projects {
  padding: var(--section-padding) 0;
}

.projects__list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.project-card {
  display: grid;
  grid-template-columns: 40px 1fr 1fr;
  gap: 40px;
  padding: 50px 0;
  border-top: 1px solid var(--border);
  align-items: center;
  cursor: pointer;
  transition: background 0.3s;
}

.project-card:last-child {
  border-bottom: 1px solid var(--border);
}

.project-card:hover {
  background: var(--bg-secondary);
  margin: 0 -30px;
  padding-left: 30px;
  padding-right: 30px;
  border-radius: 8px;
  border-color: transparent;
}

.project-card:hover + .project-card {
  border-top-color: transparent;
}

.project-card__number {
  font-size: 13px;
  color: var(--accent-red);
  font-weight: 500;
}

.project-card__info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card__title {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a.project-card .project-card__title {
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: var(--accent-teal);
  text-decoration-thickness: 1.5px;
}

a.project-card:hover .project-card__title {
  color: var(--accent-teal);
}

.project-card__desc {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  max-width: 460px;
}

.project-card__tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.project-card__tags span {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--bg-card);
  color: var(--text-muted);
}

.project-card__image {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  transition: transform 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.project-card:hover .project-card__image {
  transform: scale(1.03);
}

.project-card__date {
  font-size: 0.45em;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.5em;
  vertical-align: middle;
}

.project-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.project-card__placeholder {
  aspect-ratio: 4/3;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ==========================================
   联系方式
   ========================================== */
.contact {
  padding: var(--section-padding) 0;
}

.contact__text {
  font-size: clamp(24px, 3.5vw, 40px);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.02em;
  margin-bottom: 60px;
}

.contact__links {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.contact__link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  font-size: clamp(20px, 3vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  transition: all 0.3s;
}

.contact__link:last-child {
  border-bottom: 1px solid var(--border);
}

.contact__link--static {
  cursor: default;
  color: var(--text-secondary);
}

.contact__link--static:hover {
  color: var(--text-secondary);
  padding-left: 0;
}

.contact__link:hover {
  color: var(--accent-teal);
  padding-left: 16px;
}

.contact__link-arrow {
  font-size: 0.6em;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s;
}

.contact__link:hover .contact__link-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ==========================================
   Footer
   ========================================== */
.footer {
  padding: 40px clamp(24px, 5vw, 60px);
}

.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer__copy {
  color: var(--text-muted);
  font-size: 13px;
}

.footer__top {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  transition: all 0.3s;
}

.footer__top:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

/* ==========================================
   滚动渐显动画
   ========================================== */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.reveal--visible {
  opacity: 1;
  transform: translateY(0);
}

/* 交错延迟 */
.reveal:nth-child(2) { transition-delay: 0.1s; }
.reveal:nth-child(3) { transition-delay: 0.2s; }
.reveal:nth-child(4) { transition-delay: 0.3s; }

/* ==========================================
   响应式
   ========================================== */

/* 平板 */
@media (max-width: 1024px) {
  .hero__inner {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .hero__portrait {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    order: -1;
  }

  .about__content {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .project-card {
    grid-template-columns: 30px 1fr;
    gap: 20px;
    padding: 36px 0;
  }

  .project-card__image {
    grid-column: 1 / -1;
    margin-top: 8px;
  }

  .project-card:hover {
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* 手机 */
@media (max-width: 640px) {
  .nav {
    padding: 16px 20px;
  }

  .nav__links {
    gap: 20px;
  }

  .preloader__text {
    font-size: clamp(48px, 14vw, 72px);
  }

  .hero {
    padding: 100px 20px 40px;
  }

  .hero__title {
    font-size: clamp(44px, 12vw, 64px);
  }

  .section__inner {
    padding: 0 20px;
  }

  .section__label {
    margin-bottom: 40px;
  }

  .about,
  .projects,
  .contact {
    padding: 80px 0;
  }

  .contact__link {
    padding: 20px 0;
  }

  .footer {
    padding: 32px 20px;
  }
}
