/* ========================================
   PORTFOLIO — Dark Split-Card Editorial
   ======================================== */

/* ---- Custom Properties ---- */
:root {
  --bg-primary: #08080D;
  --bg-secondary: #0E0E17;
  --text-primary: #F5F5F7;
  --text-secondary: rgba(245,245,247,0.45);
  --text-tertiary: rgba(245,245,247,0.25);
  --accent: #5B8AF7;
  --accent-dim: rgba(91,138,247,0.15);
  --border-subtle: rgba(255,255,255,0.05);

  --nav-height: 56px;
  --max-width: 1400px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-primary);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) var(--bg-primary);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(91,138,247,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 20% 70%, rgba(120,90,240,0.04) 0%, transparent 50%),
    var(--bg-primary);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text-primary);
  line-height: 1.6;
}

/* ---- Loading Screen ---- */
.loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-primary);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-bg {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 24px 24px;
}

.loader-inner {
  position: relative; z-index: 2;
  text-align: center;
}

.loader-text {
  font-size: 11px; font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.loader-track {
  width: 180px; height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 0 auto 16px;
  overflow: hidden;
}

.loader-fill {
  width: 0%; height: 100%;
  background: var(--accent);
  transition: width 0.1s linear;
}

.loader-percent {
  font-size: 12px; font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.loader.fade-out {
  opacity: 0; visibility: hidden;
  pointer-events: none;
}

/* ---- Main Hidden State ---- */
.main-hidden {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.main-hidden.visible {
  opacity: 1;
}

/* ---- Navigation ---- */
.nav {
  position: fixed; top:0; left:0; right:0; z-index:100;
  height: var(--nav-height);
  background: rgba(8,8,13,0.70);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-inner {
  max-width: var(--max-width); margin:0 auto;
  padding: 0 40px; height:100%;
  display: flex; align-items: center; justify-content: space-between;
}

.nav-logo {
  font-size: 16px; font-weight: 600;
  color: var(--text-primary); text-decoration: none;
  letter-spacing: 0.03em;
}

.nav-links { display: flex; list-style: none; gap: 36px; }

.nav-links a {
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary); text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text-primary); }

/* ---- Hero ---- */
.hero {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; height: 100dvh;
  overflow: hidden;
}

/* 模板图片（不可见，供 JS 复制用） */
.hero-medias img {
  width: 1px; height: 1px;
  position: absolute; top: 0; left: 0;
  visibility: hidden; pointer-events: none;
}

/* JS 动态创建的坠落图片 */
.hero img {
  width: 15vw; height: 15vw;
  position: absolute;
  object-fit: cover;
  border-radius: 4%;
  z-index: 5;
  pointer-events: none;
}

@media (max-width: 768px) {
  .hero img { width: 30vw; height: 30vw; }
}

/* Hero 文字叠加层 */
.hero-content {
  position: relative; z-index: 10;
  text-align: center; max-width: 900px;
  pointer-events: none;
}

.hero-greeting {
  font-size: clamp(13px, 1.5vw, 15px);
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.hero-title {
  font-size: clamp(72px, 12vw, 150px);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.9;
  color: #FFFFFF;
  user-select: none;
}

.hero-line {
  width: 60px; height: 1px;
  background: var(--accent);
  margin: 32px auto 0;
}

.hero-sub {
  margin-top: 24px;
  font-size: clamp(15px, 1.8vw, 18px);
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
}

.hero-desc {
  margin-top: 12px;
  max-width: 500px; margin-left: auto; margin-right: auto;
  font-size: 14px; line-height: 1.8;
  color: var(--text-tertiary);
}

/* ---- Works Section ---- */
.works-section {
  padding: 80px 0 120px;
}

.works-label {
  font-size: 13px; font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  max-width: var(--max-width);
  margin: 0 0 72px;
  padding: 0 80px;
}

/* ---- Split Cards ---- */
.split-card {
  max-width: var(--max-width);
  margin: 0 0 64px;
  padding: 0 80px;
}

.split-card-link {
  display: flex; align-items: center;
  text-decoration: none; color: inherit;
  gap: 0;
}

.split-panel {
  flex: 0 0 300px;
  padding-right: 48px;
  text-align: left;
}

.split-num {
  display: block;
  font-size: 14px; font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.split-title {
  font-size: 28px; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 10px;
}

.split-cat {
  font-size: 13px; font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.split-image {
  flex: 1;
  overflow: hidden;
  border-radius: 4px;
  aspect-ratio: 16 / 9;
}

.split-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}

/* 双图布局：上下等分 */
.split-image.multi {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.split-image.multi img {
  height: calc(50% - 3px);
}

/* ---- Alternating ---- */
.split-card.alt .split-card-link {
  flex-direction: row-reverse;
}

.split-card.alt .split-panel {
  padding-right: 0;
  padding-left: 48px;
}

/* ---- Reveal Animation ---- */
.split-card .split-panel {
  opacity: 0;
  transform: translateX(-24px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.split-card .split-image img {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.8s var(--ease-out-expo) 0.1s, transform 0.8s var(--ease-out-expo) 0.1s;
}

.split-card.alt .split-panel {
  transform: translateX(24px);
}

.split-card.alt .split-image img {
  transform: translateX(-40px);
}

.split-card.visible .split-panel {
  opacity: 1;
  transform: translateX(0);
}

.split-card.visible .split-image img {
  opacity: 1;
  transform: translateX(0);
}

/* ---- Hover ---- */
.split-card-link:hover .split-image img {
  transform: scale(1.015);
  filter: brightness(1.05);
}

.split-card-link:hover .split-title {
  color: var(--accent);
}

.split-card-link:hover .split-num {
  opacity: 0.8;
}

/* ---- Works More ---- */
.works-more {
  text-align: center;
  padding-top: 20px;
}

.works-more-link {
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}

.works-more-link:hover { color: var(--text-primary); }

/* ---- Footer ---- */
.footer {
  padding: 80px 40px 48px;
  text-align: center;
  font-size: 12px; color: var(--text-tertiary);
  border-top: 1px solid var(--border-subtle);
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ================================================
   Works Page — Gallery + Lightbox
   ================================================ */

.works-page {
  padding: 120px 0 80px;
}

.works-header {
  padding: 0 40px 32px;
  max-width: var(--max-width); margin: 0 auto;
}

.works-header h2 {
  font-size: 48px; font-weight: 700; letter-spacing: -0.04em;
}

.works-header p {
  margin-top: 10px; font-size: 16px; color: var(--text-secondary);
}

.tabs {
  display: flex; gap: 8px; margin: 44px auto 36px; flex-wrap: wrap;
  max-width: var(--max-width); padding: 0 40px;
}

.tab-btn {
  padding: 8px 20px;
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: all 0.2s ease;
}
.tab-btn:hover { border-color: rgba(255,255,255,0.12); color: var(--text-primary); }
.tab-btn.active {
  background: #3B6DE6; border-color: #3B6DE6; color: #fff;
  font-weight: 700;
  box-shadow: 0 0 16px rgba(59,109,230,0.35);
}

.gallery {
  padding: 0 40px 96px;
  max-width: var(--max-width); margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: center;
}

.gallery-item {
  position: relative;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-secondary);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 0 1px rgba(91,138,247,0.2), 0 16px 48px rgba(0,0,0,0.5);
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
}

.gallery-caption {
  position: absolute; bottom:0; left:0; right:0;
  padding: 24px 16px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  opacity: 0; transition: opacity 0.3s ease;
}
.gallery-item:hover .gallery-caption { opacity:1; }

.gallery-caption span { font-size:14px; font-weight:600; color:#fff; display:block; }
.gallery-caption small { font-size:12px; color:rgba(255,255,255,0.72); }

/* Lightbox */
.lightbox {
  position: fixed; inset:0; z-index:200;
  background: rgba(0,0,0,0.94);
  backdrop-filter: blur(24px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.lightbox.active { opacity:1; pointer-events: auto; }

.lightbox-content { max-width:90vw; max-height:90vh; position:relative; }
.lightbox-content img {
  max-width:100%; max-height:85vh; border-radius: 4px;
  box-shadow: 0 0 80px rgba(0,0,0,0.6);
}
.lightbox-info { text-align:center; margin-top:16px; }
.lightbox-info h4 { font-size:16px; font-weight:600; }
.lightbox-info span { font-size:13px; color:var(--text-secondary); }

.lightbox-close {
  position: absolute; top:24px; right:24px;
  width:44px; height:44px; border-radius:50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: #fff; font-size:20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.12); }

/* ---- About Page ---- */
.about-hero {
  position: relative;
  padding: calc(var(--nav-height) + 80px) 80px 80px;
  overflow: hidden;
}

.about-glow {
  position: absolute; top: 0; right: 0; width: 50%; height: 100%;
  background: radial-gradient(ellipse at center, rgba(91,138,247,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.about-hero-inner {
  display: flex; align-items: center; gap: 80px;
  max-width: var(--max-width);
}

.about-hero-photo {
  flex: 0 0 42%;
  position: relative;
}

.about-hero-photo img {
  width: 100%; height: auto;
  display: block;
  filter: grayscale(15%) brightness(0.92);
}

.about-photo-mask {
  position: absolute; inset: 0; z-index: 1;
  background:
    radial-gradient(ellipse at 30% 50%, transparent 40%, rgba(8,8,13,0.6) 100%);
  pointer-events: none;
}

.about-hero-text { flex: 1; min-width: 0; position: relative; z-index: 2; }

.about-label {
  font-size: 12px; font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.about-name {
  font-size: clamp(56px, 8vw, 96px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #FFFFFF;
}

.about-line {
  width: 60px; height: 1px;
  background: var(--accent);
  margin: 32px 0;
}

.about-intro {
  max-width: 520px;
  font-size: 16px; line-height: 1.9;
  color: var(--text-secondary);
}

.about-body {
  max-width: var(--max-width);
  margin: 0 0 120px;
  padding: 0 80px;
}

.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; }

.about-section h3 {
  font-size: 11px; font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 24px;
}

.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tag {
  padding: 8px 18px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 100px;
  font-size: 13px; color: var(--text-secondary);
  transition: border-color 0.2s, color 0.2s;
}
.skill-tag:hover { border-color: rgba(255,255,255,0.2); color: var(--text-primary); }

.contact-list { list-style: none; display: flex; flex-direction: column; gap: 16px; }
.contact-list li { font-size: 15px; color: var(--text-secondary); }
.contact-list li span {
  display: inline-block; width: 48px;
  font-size: 12px; color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 0 40px; }
  .works-label { padding: 0 40px; }
  .split-card { padding: 0 40px; }
  .split-panel { flex: 0 0 240px; padding-right: 36px; }
  .split-card.alt .split-panel { padding-left: 36px; padding-right: 0; }
  .split-title { font-size: 24px; }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 768px) {
  .hero-title { font-size: clamp(48px, 12vw, 64px); }
  .hero { padding: 0 24px; min-height: 90vh; }
  .nav-links { gap: 20px; }

  .gallery { grid-template-columns: repeat(2, 1fr); padding: 0 16px 64px; gap: 10px; }

  .works-label { padding: 0 24px; margin-bottom: 48px; }
  .split-card { padding: 0 24px; margin-bottom: 64px; }
  .split-card-link { flex-direction: column !important; align-items: flex-start !important; }
  .split-panel { flex: auto; padding: 0 0 20px 0 !important; }
  .split-image img { opacity: 1; transform: none; }
  .split-panel { opacity: 1; transform: none; }
  .split-title { font-size: 22px; }

  .works-header { padding: 0 20px 24px; }
  .works-header h2 { font-size: 36px; }
  .tabs { padding: 0 20px; }
  .about-hero { padding: calc(var(--nav-height) + 48px) 24px 48px; }
  .about-hero-inner { flex-direction: column; gap: 32px; }
  .about-hero-photo { flex: auto; width: 80%; max-width: 360px; margin: 0 auto; }
  .about-hero-photo img { width: 100%; }
  .about-hero-text { padding: 0; }
  .about-name { font-size: clamp(42px, 10vw, 56px); }
  .about-body { padding: 0 24px; margin-bottom: 72px; }
  .about-grid { grid-template-columns: 1fr; gap: 48px; }
  .nav-inner { padding: 0 20px; }
}

@media (max-width: 480px) {
  .gallery { grid-template-columns: 1fr; }
  .tabs { gap: 6px; }
  .tab-btn { padding: 6px 14px; font-size: 12px; }
  .hero-greeting { font-size: 12px; }
  .hero-title { font-size: clamp(40px, 14vw, 56px); }
}