/* ============================================================
   Fonts — Inter
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500;600&display=swap');

/* ============================================================
   Variables
   ============================================================ */
:root {
  --white: #ffffff;
  --black: #0a0a0a;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e8e8e8;
  --gray-300: #d4d4d4;
  --gray-400: #a0a0a0;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-800: #262626;
  --header-h: 64px;
  --transition-smooth: cubic-bezier(0.65, 0, 0.35, 1);
  --transition-in: cubic-bezier(0.33, 1, 0.68, 1);
  --transition-out: cubic-bezier(0.32, 0, 0.67, 0);
}

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

html {
  -webkit-text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  width: 100%;
  min-height: 100vh;
  background: var(--white);
  color: var(--black);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  cursor: none;
  overflow: hidden;
}

a, button, [data-clickable], #header-contact, #pd-back, #pd-back-text, .carousel-item, .pd-gallery-item, .h-nav-link, .nav-item {
  cursor: none !important;
  color: inherit;
  text-decoration: none;
}
button { font-family: inherit; border: none; background: none; }

@media (min-width: 641px) {
  html, body, body * { cursor: none !important; }
}

::selection { background: var(--black); color: var(--white); }

/* ============================================================
   White overlay
   ============================================================ */
#preloader-bg {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--white);
  transition: opacity 0.8s var(--transition-smooth);
  pointer-events: none;
}
#preloader-bg.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   Logo — fixed center, mix-blend-mode: difference, scale(0.5)
   Compact gap: 5px → Expanded gap: 900px
   Animation: ~3s
   ============================================================ */
#logo-stage {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#logo-container {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  transform: scale(0.5);
  transform-origin: center center;
  transition: gap 1.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: gap;
}
#logo-container.expanded {
  gap: 900px;
}
#logo-stage.difference {
  mix-blend-mode: difference;
}

#logo-left,
#logo-right {
  flex-shrink: 0;
  width: 267px;
  height: 461px;
  background-image: url('logo-animation1.png');
  background-repeat: no-repeat;
  background-size: 514px 461px;
}
#logo-left  { background-position: 0 0; }
#logo-right {
  width: 247px;
  background-position: -267px 0;
}

#logo-stage.difference #logo-left,
#logo-stage.difference #logo-right {
  filter: invert(1);
}

/* ============================================================
   Header — 李明洋 + 右上导航
   ============================================================ */
#header {
  position: fixed;
  top: 15px;
  left: 15px;
  right: 15px;
  z-index: 200;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  mix-blend-mode: difference;
  color: var(--white);
  pointer-events: none;
}
#header > * { pointer-events: auto; }

#header-name {
  font-size: 14.4pt;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  position: relative;
  pointer-events: auto;
  cursor: pointer;
}

#header-right-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 18px;
}

#header-top-row {
  display: flex;
  align-items: center;
}

#header-nav {
  display: flex;
  gap: 5px;
}

.h-nav-link {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.01em;
  position: relative;
}
.h-nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.35s var(--transition-in);
}
.h-nav-link:hover::after {
  width: 100%;
}

.h-nav-link:first-child::after {
  width: 100%;
}

#header-time-module {
  margin-left: 100px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

#header-contact {
  margin-left: 100px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  position: relative;
  cursor: none;
}
#header-contact::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.35s var(--transition-in);
}
#header-contact:hover::after {
  width: 100%;
}

/* ============================================================
   Side Navigation
   ============================================================ */
#side-nav {
  position: fixed;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  height: 300px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 14px, black calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, black 14px, black calc(100% - 14px), transparent 100%);
  pointer-events: none;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#side-nav-track {
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-item {
  font-size: 14.4px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--gray-400);
  opacity: 0.49;
  white-space: nowrap;
  min-height: 1.6em;
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.5s cubic-bezier(0.33, 1, 0.68, 1);
  line-height: 1.6;
}
.nav-item.revealed {
  clip-path: inset(0 0 0 0);
}

.nav-item.active {
  color: var(--black);
  font-weight: 600;
  opacity: 1;
}

/* ============================================================
   Project Type Display — between nav and logo
   ============================================================ */
#project-type-display {
  position: fixed;
  left: calc(177px + 25pt);
  top: 50%;
  transform: translateY(-50%) translateX(-50%);
  z-index: 200;
  pointer-events: none;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#project-type-text {
  font-size: 14.4px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--black);
  opacity: 1;
}

/* ============================================================
   Project Counter — right side
   ============================================================ */
#project-counter {
  position: fixed;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  mix-blend-mode: difference;
  color: var(--white);
  font-variant-numeric: tabular-nums;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#counter-current {
  font-size: 28px;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1;
}

#counter-sep {
  font-size: 12px;
  font-weight: 300;
  color: var(--gray-500);
}

#counter-total {
  font-size: 12px;
  font-weight: 300;
  color: var(--gray-500);
  letter-spacing: 0.02em;
}

/* ============================================================
   Carousel Stage
   ============================================================ */
#carousel-stage {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#carousel-track {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 20pt;
  will-change: transform;
}

.carousel-item {
  width: 300px;
  height: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: none;
}

.carousel-img {
  width: 100%;
  height: auto;
  border-radius: 0;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease-out;
  will-change: transform;
  box-shadow: none;
  background: none;
}

.carousel-img svg {
  width: 100%;
  height: 100%;
  display: block;
}

.carousel-img img,
.carousel-img video {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  background: none;
}

/* ============================================================
   Hover Preview Popup
   ============================================================ */
#hover-preview {
  position: fixed;
  z-index: 10002;
  pointer-events: none;
  opacity: 0;
  width: 480px;
  height: 320px;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  transform: translate(20px, -50%);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
#hover-preview.visible {
  opacity: 1;
  transform: translate(30px, -50%);
}

#hover-preview-track {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.hover-preview-item {
  min-width: 100%;
  height: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: hoverFadeIn 0.35s ease;
}

@keyframes hoverFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hover-preview-item svg,
.hover-preview-item img,
.hover-preview-item video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  background: none;
}

/* ============================================================
   Canvas Background
   ============================================================ */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.4;
  pointer-events: none;
}

/* ============================================================
   Custom Cursor
   ============================================================ */
#cursor {
  position: fixed;
  width: 28px;
  height: 30px;
  pointer-events: none;
  z-index: 10002;
  mix-blend-mode: difference;
  color: var(--white);
  transform: translate(-50%, -50%) rotate(-30deg) scale(0.8);
  transition: opacity 0.2s var(--transition-smooth),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
#cursor.active {
  transform: translate(-50%, -50%) rotate(-30deg) scale(0.7);
}
#cursor.hover {
  transform: translate(-50%, -50%) rotate(-30deg) scale(1);
}

#cursor-svg {
  display: block;
  position: relative;
  z-index: 2;
}

#cursor-fill {
  transform-box: fill-box;
  transform-origin: 50% 66.6667%;
  transform: scale(0);
  transition: transform 0.48s cubic-bezier(0.16, 1, 0.3, 1);
}

#cursor-dot {
  position: absolute;
  width: 3px;
  height: 3px;
  background: currentColor;
  border-radius: 50%;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}
#cursor.hover #cursor-fill {
  transform: scale(1);
}
#cursor.hover #cursor-dot {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
}
#cursor.active #cursor-dot {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
#cursor.active #cursor-fill {
  transform: scale(0);
}

/* ============================================================
   Project Detail Page
   ============================================================ */
#project-detail {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
#project-detail.visible {
  opacity: 1;
  pointer-events: auto;
}

#pd-back {
  position: fixed;
  bottom: 15px;
  left: 15px;
  z-index: 210;
  color: var(--black);
  pointer-events: none;
}
#pd-back.visible {
  pointer-events: auto;
}

#pd-back-text {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
  position: relative;
}

#copyright {
  position: fixed;
  right: 15px;
  bottom: calc(15px - 6pt);
  z-index: 200;
  color: var(--black);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
  opacity: 0.343;
  pointer-events: none;
}

#copyright-year {
  font-weight: 500;
}

/* ============================================================
   About Page
   ============================================================ */
#about-page {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--white);
  color: var(--black);
  overflow-y: auto;
  padding: 130px 48px 70px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#about-page.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#about-title {
  font-size: clamp(56px, 8vw, 120px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 60px;
}

#about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  max-width: 1180px;
}

.about-block h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 28px 0 10px;
}

.about-block p {
  font-size: 16px;
  font-weight: 300;
  line-height: 1.75;
  margin: 0 0 10px;
}

.about-intro p {
  font-size: 20px;
}
#pd-back-text::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform-origin: right;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
#pd-back-text:hover::after {
  transform: scaleX(0);
}

#detail-project-name,
#detail-project-category {
  position: fixed;
  top: 50%;
  z-index: 210;
  mix-blend-mode: normal;
  color: var(--black);
  font-size: 14.4px;
  font-weight: 600;
  letter-spacing: 0.02em;
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

#detail-project-name {
  left: 15px;
  transform: translateY(-50%);
}

#detail-project-category {
  left: calc(177px + 25pt);
  transform: translateY(-50%) translateX(-50%);
}

#detail-project-description {
  position: fixed;
  top: 50%;
  left: calc(420px - 60pt);
  transform: translateY(-50%);
  z-index: 210;
  max-width: calc(300px + 90pt);
  color: var(--black);
  font-size: 14.4px;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0.02em;
  text-align: justify;
  text-align-last: left;
  pointer-events: none;
}

#detail-project-name.revealed,
#detail-project-category.revealed {
  clip-path: inset(0 0 0 0);
}

#pd-info {
  position: fixed;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 210;
  pointer-events: none;
  mix-blend-mode: difference;
  color: var(--white);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 280px;
  display: none;
}

#pd-title {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

#pd-title.revealed {
  clip-path: inset(0 0 0 0);
}

#pd-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#pd-category {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--gray-300);
  display: none;
}

#pd-link {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--white);
  position: relative;
  width: fit-content;
}
#pd-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform-origin: right;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
#pd-link:hover::after {
  transform: scaleX(0);
}

#pd-gallery {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 58vw;
  overflow: hidden;
  z-index: 105;
}

#pd-gallery-track {
  position: absolute;
  right: 15px;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
}

.pd-gallery-item {
  width: 50vw;
  height: auto;
  flex-shrink: 0;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  transform: translateX(calc(100% + 50px));
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}
.pd-gallery-item.slide-in {
  transform: translateX(0);
}

.pd-gallery-item.pd-gallery-empty {
  background: var(--gray-100);
}

.pd-gallery-item svg,
.pd-gallery-item img,
.pd-gallery-item video {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  background: none;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  #logo-container {
    transform: scale(0.21);
    margin-left: 18pt;
  }
  #logo-container.expanded {
    gap: 336px;
  }

  #header {
    top: 12px;
    left: 10px;
    right: 12px;
  }
  #header-name { font-size: 9pt; }
  #header-time-module { margin-left: 60px; font-size: 12px; }
  #header-contact { margin-left: 60px; }

  #side-nav { left: 10px; height: 240px; }
  #project-type-display { left: 10px; top: 31%; transform: none; }
  #project-type-text { font-size: 11px; }
  #project-counter { right: 10px; }
  #counter-current { font-size: 22px; }

  .carousel-item {
    width: 144px;
    height: 320px;
  }

  #cursor, #cursor-dot { display: none; }
  body { cursor: auto; }

  #pd-gallery { width: 60vw; }
  #pd-title { font-size: 24px; }
  .pd-gallery-item { width: 52vw; }

  .nav-item { font-size: 12px; }
  .h-nav-link { font-size: 12px; }
  #header-time-module { margin-left: 28px; font-size: 10px; }
  #header-contact { margin-left: 28px; font-size: 12px; }
  #header-right-wrap { margin-left: auto; }

  .carousel-item { height: auto; }
  .carousel-img video {
    min-height: 160px;
    background: var(--gray-100);
  }

  #hover-preview {
    display: none;
  }
  #carousel-track { left: calc(50% + 18pt); }
  #pd-back-text { font-size: 14.4px; }

  #about-page { padding: 100px 20px 48px; }
  #about-title { font-size: 42px; margin-bottom: 30px; }
  #about-grid { grid-template-columns: 1fr; gap: 8px; }
  .about-block p { font-size: 14px; }
  .about-intro p { font-size: 16px; }

  #copyright {
    right: 10px;
    bottom: calc(10px - 6pt);
    font-size: 10px;
  }

  #detail-project-name,
  #detail-project-category { font-size: 12px; }
  #detail-project-name { left: 10px; top: 20%; }
  #detail-project-category {
    left: 10px;
    top: 31%;
    transform: none;
  }
  #detail-project-description {
    left: 10px;
    top: calc(35% + 10pt);
    transform: none;
    max-width: calc(70vw - 35pt);
    font-size: 12px;
    line-height: 1.55;
  }
}

@media (max-width: 480px) {
  #logo-container {
    transform: scale(0.15);
    margin-left: 18pt;
  }
  #logo-container.expanded {
    gap: 216px;
  }

  #header-name { font-size: 8pt; }
  #side-nav { height: 200px; }
  #project-type-display { left: 10px; top: 27%; transform: none; }
  #project-counter { right: 8px; }
  #counter-current { font-size: 18px; }

  .carousel-item {
    width: 120px;
    height: 280px;
  }

  #pd-gallery { width: 62vw; }
  #pd-title { font-size: 20px; }
  .pd-gallery-item { width: 55vw; }

  #header-name { font-size: 7pt; }
  #header-time-module { margin-left: 16px; font-size: 9px; }
  #header-contact { margin-left: 16px; font-size: 11px; }
  .h-nav-link { font-size: 11px; }
  .nav-item { font-size: 11px; }
  .carousel-item { height: auto; }

  #hover-preview {
    display: none;
  }
  #carousel-track { left: calc(50% + 18pt); }
  #pd-back-text { font-size: 14.4px; }

  #about-title { font-size: 34px; }
  #about-grid { gap: 0; }
  .about-block p { font-size: 13px; }
  .about-intro p { font-size: 15px; }

  #copyright { font-size: 9px; }

  #detail-project-name { top: 17%; }
  #detail-project-category { top: 27%; }
  #detail-project-description { top: calc(32% + 10pt); font-size: 11px; max-width: calc(72vw - 35pt); }
}
