/* Load Alibaba PuHuiTi via CDN */
@font-face {
  font-family: 'Alibaba PuHuiTi';
  src: url('https://at.alicdn.com/t/webfont_xj5tr162i1a.woff2') format('woff2'),
       url('https://at.alicdn.com/t/webfont_xj5tr162i1a.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Alibaba PuHuiTi';
  src: url('https://at.alicdn.com/t/webfont_xj5tr162i1a.woff2') format('woff2');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

/* Base resets & scroll behavior */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* Custom Cubic Bezier Transition (Spring dynamic) */
.transition-spring {
  transition: all 800ms cubic-bezier(0.32, 0.72, 0, 1);
}

/* Film Grain Noise Overlay */
.grain-overlay {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3e%3cfilter id='noiseFilter'%3e%3cturbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3e%3c/filter%3e%3crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3e%3c/svg%3e");
}

/* Double-Bezel Card Outer Shell & Concentric Radius Inner Core */
.double-bezel-outer {
  padding: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 2rem;
  transition: border-color 600ms cubic-bezier(0.32, 0.72, 0, 1);
}

.double-bezel-outer:hover {
  border-color: rgba(0, 240, 255, 0.25);
}

.double-bezel-inner {
  background: #0a0a0c;
  border-radius: calc(2rem - 6px);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

/* Glassmorphism utility */
.glass-island {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(10, 10, 12, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Accordion transition logic */
.accordion-content {
  transition: max-height 500ms cubic-bezier(0.32, 0.72, 0, 1), opacity 400ms ease;
  opacity: 0;
}

.accordion-content.active {
  opacity: 1;
}

.icon-rotate {
  transition: transform 500ms cubic-bezier(0.32, 0.72, 0, 1);
}

.icon-rotate.active {
  transform: rotate(45deg);
}

/* Hide Scrollbar helper classes */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* GSAP Horizontal Track Layout (Desktop only overrides) */
@media (min-width: 1024px) {
  #portfolio-track {
    will-change: transform;
  }
}

/* Custom inputs styling */
input::placeholder, textarea::placeholder {
  color: #555562;
  font-weight: 300;
}

/* Haptic active button states */
button:active, a:active {
  transform: scale(0.98);
}

/* Smooth fade-in scroll animation fallback if GSAP fails */
.fade-up-init {
  opacity: 0;
  transform: translateY(24px);
  filter: blur(4px);
  transition: all 800ms cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-up-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* Silk WebGL Background Styles */
#silk-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Sliding Navigation Hover Indicator Transition */
#nav-indicator {
  height: 31px;
  top: 0;
  border-radius: 18px; /* Perfect concentric geometry alignment: outer radius (22px) - margin gap (4px) = 18px */
  transition: left 320ms cubic-bezier(0.25, 1, 0.5, 1),
              width 320ms cubic-bezier(0.25, 1, 0.5, 1),
              opacity 200ms ease;
}

/* Cutout text responsive vertical spacing via CSS transform */
#resume-svg text {
  transform-origin: center;
  dominant-baseline: central;
  transition: transform 0.3s ease;
}

#mask-about text {
  transform: translateY(var(--about-y));
}
#mask-to text {
  transform: translateY(var(--to-y));
}
#mask-me text {
  transform: translateY(var(--me-y));
}

/* Default mobile: ABOUT top at 200px (center 270px), spacing = 10px */
:root {
  --about-y: 270px;
  --to-y: 420px;
  --me-y: 570px;
}

/* Tablet sm: ABOUT top at 200px (center 270px), spacing = 100px */
@media (min-width: 640px) {
  :root {
    --about-y: 270px;
    --to-y: 510px;
    --me-y: 750px;
  }
}

/* Desktop md: ABOUT top at 200px (center 270px), spacing = 50px */
@media (min-width: 768px) {
  :root {
    --about-y: 270px;
    --to-y: 460px;
    --me-y: 650px;
  }
}

/* Chinese Text Justification Helper */
.justify-text-block {
  text-align: justify;
  text-justify: inter-character;
}

/* Portfolio Stacking Card Base Styling (GSAP Pinning Enabled) */
#portfolio {
  position: relative;
  z-index: 5;
  background-color: #000000;
}

@media (min-width: 1024px) {
  .portfolio-stack-card {
    height: 100vh !important;
    width: 100% !important;
    position: relative;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.15);
    will-change: transform;
    background-color: #ffffff;
    overflow: hidden;
  }
}

/* --- Visual Design Interactive Text Roll & Hover System --- */
.visual-row-item {
  position: absolute;
  cursor: pointer;
  height: 50px;
  overflow: hidden;
  user-select: none;
  z-index: 15;
}

.text-roll-inner {
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.visual-row-item:hover .text-roll-inner,
.visual-row-item.is-active .text-roll-inner {
  transform: translateY(-50px);
}

.text-roll-primary {
  height: 50px;
  line-height: 50px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-size: 30px !important;
  color: #888888 !important;
  transition: color 0.3s ease;
}

.text-roll-hover {
  height: 50px;
  line-height: 50px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-size: 30px !important;
  color: #000000 !important;
  font-weight: 300 !important;
  transition: color 0.3s ease;
}

/* Category Horizontal Divider Lines Default State (Hidden) */
.category-divider-line {
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

#line-0,
.category-divider-line.is-visible {
  opacity: 1;
}

/* Floating View Project Glass Button Smooth Position & Opacity Transition */
#floating-view-project-btn {
  transition: top 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease, transform 0.35s ease;
  will-change: top, opacity, transform;
}

/* --- 3D Real Book Page & Shadow Design --- */
.book-page-sharp {
  border-radius: 0px !important; /* 直角边 */
  will-change: transform, opacity;
}

#modal-page-left {
  box-shadow: -15px 20px 45px rgba(0, 0, 0, 0.42), -3px 0 10px rgba(0, 0, 0, 0.2), inset -12px 0 25px rgba(0, 0, 0, 0.25) !important;
  transform-origin: right center;
}

#modal-page-right {
  box-shadow: 15px 20px 45px rgba(0, 0, 0, 0.42), 3px 0 10px rgba(0, 0, 0, 0.2), inset 12px 0 25px rgba(0, 0, 0, 0.25) !important;
  transform-origin: left center;
}

/* Hide scrollbar for web design container while keeping scrollability */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Match exact internal image curve & remove outer white frame corners */
.video-cover-card {
  border-radius: 28px !important;
  object-fit: cover;
}

/* --- 3D Curved Video Carousel & Heart Animation --- */
#video-showcase-container {
  perspective: 1200px;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
}

.curved-video-card {
  position: absolute;
  top: 237px;
  left: 50%;
  width: 540px;
  height: 720px;
  margin-left: -270px;
  border-radius: 28px !important;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1),
              opacity 0.5s ease,
              box-shadow 0.5s ease;
  transform-style: preserve-3d;
  background: #ffffff;
  object-fit: cover;
  will-change: transform, opacity;
}

.curved-video-card.active {
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(255, 255, 255, 0.6);
}

/* Floating Heart Animation */
.heart-float {
  position: absolute;
  font-size: 32px;
  pointer-events: none;
  animation: floatHeartUp 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  z-index: 9999;
  user-select: none;
}

@keyframes floatHeartUp {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
  30% {
    transform: translate(-50%, -80%) scale(1.3);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -160%) scale(1);
    opacity: 0;
  }
}

/* Remove white frame border & clean crop for grid video cards */
.grid-video-card {
  border-radius: 20px !important;
  object-fit: cover;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease, box-shadow 0.3s ease;
}

.grid-video-card:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.grid-video-card.shifting-left {
  animation: gridShiftLeft 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.grid-video-card.shifting-right {
  animation: gridShiftRight 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes gridShiftLeft {
  0% { transform: translateX(40px); opacity: 0.75; }
  100% { transform: translateX(0px); opacity: 1; }
}

@keyframes gridShiftRight {
  0% { transform: translateX(-40px); opacity: 0.75; }
  100% { transform: translateX(0px); opacity: 1; }
}
