/* ============================================================
   fanshuyang.top — Design System v5.0
   Design language inspired by Luke Baffait (lukebaffait.fr)
   ============================================================ */

/* --- Google Fonts: Noto Serif SC (Chinese serif) --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700;900&display=swap');

/* ============================================================
   CSS Variables
   ============================================================ */
:root {
  --bg: #0a0a0a;
  --text: #f0f0f0;
  --text-dim: rgba(240,240,240,0.45);
  --text-muted: rgba(240,240,240,0.25);
  --accent: #e07340;
  --accent-glow: rgba(224,115,64,0.15);

  --font-body: 'Inter', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
  --font-heading: 'DM Serif Display', 'Noto Serif SC', 'Songti SC', serif;
  --font-chinese: 'Noto Serif SC', 'Songti SC', serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

  --ease-out: cubic-bezier(0.16,1,0.3,1);
  --ease-in-out: cubic-bezier(0.87,0,0.13,1);
}

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

html {
  width: 100%;
  max-width: 100vw;
  min-height: 100%;
  scrollbar-width: none;
  overflow-x: clip;
}

html::-webkit-scrollbar { display: none; }

body {
  width: 100%;
  max-width: 100vw;
  min-height: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html.lenis, html.lenis body { height: auto; }

.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul { list-style: none; }

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

/* ============================================================
   Chr-hover effect (split character slide)
   ============================================================ */
.chr-hover {
  display: inline-flex;
  gap: 0;
  cursor: default;
  text-decoration: none;
  color: inherit;
}
a.chr-hover { cursor: pointer; }

.ch-wrap {
  position: relative;
  overflow: hidden;
  display: inline-block;
}

.ch-top, .ch-bot {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0em;
  text-transform: uppercase;
  line-height: 1.2;
  color: rgba(255,255,255,0.8);
  transition: transform 0.6s cubic-bezier(0.87,0,0.13,1);
  transition-delay: calc(var(--i) * 28ms);
}
.ch-bot {
  position: absolute;
  top: 100%;
  left: 0;
}

.chr-hover:hover .ch-top { transform: translateY(-100%); }
.chr-hover:hover .ch-bot { transform: translateY(-100%); }

/* ============================================================
   Preloader
   ============================================================ */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  opacity: 0;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem;
  pointer-events: none;
}
.hero-content > * { pointer-events: auto; }

.hero-tagline {
  position: absolute;
  top: 3rem;
  left: 3rem;
  font-family: var(--font-chinese);
  font-size: clamp(1rem, 2.2vw, 2rem);
  line-height: 1.7;
  letter-spacing: 0.01em;
  color: var(--text);
  max-width: 42rem;
}

.hero-tagline .accent {
  font-family: var(--font-heading);
  color: var(--accent);
}

.hero-line {
  position: absolute;
  bottom: calc(3rem + 2.8rem);
  left: 3rem;
  right: 3rem;
  height: 1px;
  background: rgba(255,255,255,0.15);
  transform-origin: left center;
  opacity: 0;
}

.hero-bar {
  position: absolute;
  bottom: 3rem;
  left: 3rem;
  right: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.hero-bar-left {
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: rgba(255,255,255,0.35);
}

.hero-bar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.hero-bar-center .sep {
  font-size: 1.2rem;
  color: rgba(255,255,255,0.2);
  user-select: none;
}

.hero-bar-center a {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.6);
  transition: color 0.3s;
  text-transform: uppercase;
}
.hero-bar-center a:hover { color: var(--text); }

.hero-bar-right {
  display: flex;
  gap: 2rem;
}
.hero-bar-right a {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.6);
  transition: color 0.3s;
  text-transform: uppercase;
}
.hero-bar-right a:hover { color: var(--text); }

/* ============================================================
   About
   ============================================================ */
.about {
  position: relative;
  min-height: 100vh;
  padding: 20vh 4rem 30vh;
  background: var(--bg);
  z-index: 10;
}

.about-text {
  position: relative;
  z-index: 2;
  width: 66.6%;
  font-family: var(--font-chinese);
  font-size: clamp(1.8rem, 3.6vw, 3.4rem);
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--text);
}

.about-text .accent {
  font-family: var(--font-heading);
  color: var(--accent);
}

.about-sub {
  position: relative;
  z-index: 2;
  width: 36%;
  margin-top: 6vh;
  margin-left: 14%;
  font-family: var(--font-chinese);
  font-size: clamp(0.9rem, 1.5vw, 1.35rem);
  line-height: 1.8;
  color: var(--text-dim);
}

.about-version {
  position: relative;
  z-index: 2;
  width: 66.6%;
  margin-top: 16vh;
  text-align: right;
  font-family: var(--font-chinese);
  font-size: clamp(1.8rem, 3.6vw, 3.4rem);
  color: var(--text);
}

.about-version svg {
  width: 1.25em;
  height: 1.25em;
  vertical-align: -0.25em;
  color: var(--accent);
}

/* ============================================================
   Projects (deep dive section)
   ============================================================ */
.projects {
  position: relative;
  padding: 10vh 4rem 20vh;
  background: var(--bg);
  z-index: 10;
}

.projects-title {
  font-family: var(--font-chinese);
  font-size: clamp(2rem, 4vw, 3.5rem);
  color: var(--text);
  margin-bottom: 4rem;
  letter-spacing: -0.02em;
}

.project-segments {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.project-segment {
  display: grid;
  grid-template-columns: 200px 1fr 3fr;
  gap: 2rem;
  padding: 4rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  align-items: start;
}

.segment-index {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  padding-top: 0.3rem;
}

.segment-label {
  font-family: var(--font-chinese);
  font-size: clamp(1.5rem, 2.5vw, 2.2rem);
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.segment-body {
  font-family: var(--font-chinese);
  font-size: clamp(0.9rem, 1.2vw, 1.1rem);
  line-height: 1.9;
  color: var(--text-dim);
}

.segment-body p + p { margin-top: 1.2rem; }

.segment-body .accent {
  font-family: var(--font-heading);
  color: var(--accent);
}

/* ============================================================
   Skills (accordion)
   ============================================================ */
.skills {
  position: relative;
  min-height: 100vh;
  padding-bottom: 20vh;
  background: var(--bg);
  z-index: 10;
}

.skills-inner {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

.skills-left {
  position: sticky;
  top: 0;
  width: 48%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 18vh;
  padding-left: 4rem;
  padding-right: 3rem;
  flex-shrink: 0;
}

.skills-subtitle {
  font-family: var(--font-chinese);
  font-size: clamp(0.9rem, 1.3vw, 1.1rem);
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 2.5rem;
}

.skills-text {
  font-family: var(--font-chinese);
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 2rem;
}

.skills-separator {
  width: 100%;
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 2rem 0;
}

.skills-arrow {
  font-size: clamp(6rem, 12vw, 10rem);
  color: var(--accent);
  line-height: 1;
  user-select: none;
  pointer-events: none;
}

.skills-right {
  width: 52%;
  padding: 18vh 4rem 40vh 2rem;
  flex-shrink: 0;
}

.skill-group {
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.skill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 0;
  cursor: pointer;
  user-select: none;
}

.skill-header-title {
  font-family: var(--font-chinese);
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  letter-spacing: -0.01em;
  color: rgba(255,255,255,0.5);
  transition: color 0.4s ease;
}

.skill-group.open .skill-header-title { color: var(--text); }

.skill-header-icon {
  width: 20px;
  height: 20px;
  position: relative;
  flex-shrink: 0;
}

.skill-header-icon::before,
.skill-header-icon::after {
  content: '';
  position: absolute;
  background: rgba(255,255,255,0.5);
  transition: transform 0.4s var(--ease-in-out), background 0.4s;
}

.skill-header-icon::before {
  top: 50%;
  left: 2px;
  right: 2px;
  height: 1px;
  transform: translateY(-50%);
}

.skill-header-icon::after {
  left: 50%;
  top: 2px;
  bottom: 2px;
  width: 1px;
  transform: translateX(-50%);
}

.skill-group.open .skill-header-icon::after {
  transform: translateX(-50%) rotate(90deg);
}
.skill-group.open .skill-header-icon::before,
.skill-group.open .skill-header-icon::after {
  background: var(--accent);
}

.skill-body {
  overflow: hidden;
  height: 0;
}

.skill-body-inner {
  padding: 0 0 1.6rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-body-inner li {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 0.4em 1em;
  border: 1px solid rgba(255,255,255,0.08);
}

/* ============================================================
   Contact (white blob transition)
   ============================================================ */
.contact-section {
  position: relative;
  height: 180vh;
  z-index: 10;
  overflow: hidden;
}

.contact-blob-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.contact-blob {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 300vmax;
  height: 300vmax;
  background: #f0f0f0;
  border-radius: 50%;
  transform: translate(-50%, 50%);
  will-change: transform;
}

.contact-inner {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem;
  pointer-events: none;
}

.contact-inner > * { pointer-events: auto; }

.contact-title {
  font-family: var(--font-chinese);
  font-size: clamp(4rem, 12vw, 10rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 0.9;
  color: #0a0a0a;
  margin-bottom: 3rem;
}

.contact-info {
  font-family: var(--font-chinese);
  font-size: clamp(1rem, 1.8vw, 1.5rem);
  line-height: 1.8;
  color: #0a0a0a;
  max-width: 500px;
  margin-bottom: 2rem;
}

.contact-info .accent {
  font-family: var(--font-heading);
  font-weight: 400;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.contact-links a {
  font-family: var(--font-chinese);
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  color: #0a0a0a;
  transition: opacity 0.3s;
}
.contact-links a:hover { opacity: 0.5; }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  position: relative;
  height: 100vh;
  background: var(--bg);
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.footer-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding: 2.5rem 3rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
}

.footer-top a {
  transition: color 0.3s;
}
.footer-top a:hover { color: var(--text); }

.footer-name {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  padding: 0 1.5vw;
  font-family: var(--font-chinese);
  font-size: 17vw;
  font-weight: 900;
  line-height: 0.8;
  letter-spacing: -0.04em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
}

.footer-sub {
  position: absolute;
  bottom: 3rem;
  left: 3rem;
  z-index: 2;
  font-family: var(--font-chinese);
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ============================================================
   Mobile (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Hero */
  .hero-content { padding: 1.5rem; }
  .hero-tagline {
    top: 1.5rem;
    left: 1.5rem;
    font-size: 0.95rem;
    max-width: calc(100vw - 3rem);
  }
  .hero-line {
    bottom: calc(1.5rem + 2.5rem);
    left: 1.5rem;
    right: 1.5rem;
  }
  .hero-bar { bottom: 1.5rem; left: 1.5rem; right: 1.5rem; }
  .hero-bar-left, .hero-bar-right { display: none; }
  .hero-bar-center {
    position: static;
    transform: none;
    margin: 0 auto;
  }
  .hero-bar-center a { font-size: 0.7rem; }
  .hero-canvas { display: none; }

  /* About */
  .about { padding: 12vh 1.5rem 20vh; }
  .about-text { width: 100%; font-size: clamp(1.4rem, 6vw, 2rem); }
  .about-sub { width: 100%; margin-left: 0; margin-top: 4vh; }
  .about-version { width: 100%; margin-top: 8vh; }

  /* Projects */
  .projects { padding: 8vh 1.5rem 15vh; }
  .project-segment {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 2.5rem 0;
  }
  .segment-index { order: 1; }
  .segment-label { order: 2; font-size: clamp(1.2rem, 5vw, 1.6rem); }
  .segment-body { order: 3; }

  /* Skills */
  .skills-inner { flex-direction: column; }
  .skills-left {
    position: relative;
    width: 100%;
    height: auto;
    padding: 8vh 1.5rem 3vh;
  }
  .skills-right { width: 100%; padding: 0 1.5rem 12vh; }
  .skills-arrow { font-size: clamp(3rem, 16vw, 5rem); }

  /* Contact */
  .contact-inner { padding: 2rem 1.5rem; }
  .contact-title {
    font-size: clamp(2.5rem, 12vw, 5rem);
    color: var(--text);
  }
  .contact-info { color: var(--text-dim); }
  .contact-links a { color: var(--text); }
  .contact-blob-wrap { display: none; }

  /* Footer */
  .footer-name { font-size: 20vw; }
  .footer-sub { left: 1.5rem; bottom: 2rem; font-size: 0.7rem; }
  .footer-top { padding: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
