@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400;1,500&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

/* Reset and Core Variables */
:root {
  --color-bg-light: #fcfbf9;
  --color-bg-dark: #121212;
  --color-primary-stone: #1c1917;
  --color-secondary-stone: #78716c;
  --color-accent-red: #ED2024;
  --color-accent-green: #04733B;
  --color-border: #e7e5e4;
  --font-sans: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'Space Mono', monospace;
}

/* Custom Tailwind Config overrides dynamically handled inside files, but styled globally here too */
body {
  font-family: var(--font-sans);
  background-color: var(--color-bg-light);
  color: var(--color-primary-stone);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Grain Noise Overlay for High-End Texture */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3联%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.015'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* Custom Utilities for 8px Grid Alignment */
.grid-cell-padding {
  padding: 1.5rem; /* 24px = 3 * 8px */
}

@media (min-width: 768px) {
  .grid-cell-padding {
    padding: 2.5rem; /* 40px = 5 * 8px */
  }
}

/* Editorial Typography */
h1, h2, h3, h4 {
  font-family: var(--font-sans);
  letter-spacing: -0.025em;
}

.font-monospace {
  font-family: var(--font-mono);
}

/* Elegant Scroll Reveal Animation (Driven by IntersectionObserver) */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

.reveal-on-scroll.active {
  opacity: 1;
  transform: translateY(0);
}

/* Sequential Stagger delays */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--color-bg-light);
}
::-webkit-scrollbar-thumb {
  background: #d6d3d1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #a8a29e;
}

/* Tactile Push State for Interactive Components */
.tactile-btn {
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s ease;
}

.tactile-btn:active {
  transform: scale(0.98) translateY(1px);
}

/* Asymmetric Bento Grid Highlight Card */
.bento-card-highlight {
  position: relative;
  overflow: hidden;
}

.bento-card-highlight::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(0, 75, 135, 0.1);
  border-radius: inherit;
  pointer-events: none;
}

/* Interactive Navigation Underline Effect */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--color-accent-red);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Italic descender baseline adjustment */
.italic-title {
  font-style: italic;
  padding-bottom: 0.15em;
  margin-bottom: -0.15em;
}

/* Filter Tab Highlight Animation */
.filter-tab {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ========================================
   PREMIUM ANIMATION SYSTEM
   ======================================== */

/* Page Load Progress Bar */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--color-accent-red);
  z-index: 10001;
  width: 0%;
  animation: progressFill 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes progressFill {
  0% { width: 0%; }
  40% { width: 70%; }
  100% { width: 100%; }
}

/* Scroll Progress Indicator */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--color-accent-red);
  z-index: 10002;
  width: 0%;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* Hero Character Reveal */
.hero-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(40px) rotateX(-40deg);
  transform-origin: bottom center;
  animation: charReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes charReveal {
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
  }
}

/* Hero Subtitle Fade */
.hero-subtitle-reveal {
  opacity: 0;
  transform: translateY(20px);
  animation: subtitleReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes subtitleReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Image Reveal on Scroll */
.img-reveal {
  overflow: hidden;
}

.img-reveal img {
  transform: scale(1.15);
  filter: blur(6px);
  transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), filter 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.img-reveal.active img {
  transform: scale(1);
  filter: blur(0px);
}

/* Card 3D Tilt */
.tilt-card {
  transform-style: preserve-3d;
  perspective: 800px;
  will-change: transform;
}

.tilt-card-inner {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transform-style: preserve-3d;
}

.tilt-card:hover .tilt-card-inner {
  transform: translateZ(10px);
}

/* Magnetic Button */
.magnetic-btn {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Counter Animation */
.counter-value {
  display: inline-block;
  min-width: 1.5ch;
}

/* Parallax Container */
.parallax-container {
  overflow: hidden;
  will-change: transform;
}

.parallax-img {
  will-change: transform;
  transform: scale(1.2);
}

/* Enhanced Stagger Delays */
.delay-50 { transition-delay: 50ms; }
.delay-150 { transition-delay: 150ms; }
.delay-250 { transition-delay: 250ms; }
.delay-350 { transition-delay: 350ms; }
.delay-450 { transition-delay: 450ms; }
.delay-500 { transition-delay: 500ms; }
.delay-600 { transition-delay: 600ms; }
.delay-700 { transition-delay: 700ms; }
.delay-800 { transition-delay: 800ms; }
.delay-900 { transition-delay: 900ms; }
.delay-1000 { transition-delay: 1000ms; }

/* Pulse Dot Animation */
.pulse-dot {
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
}

/* Smooth Gradient Border on Hover */
.gradient-border-hover {
  position: relative;
}

.gradient-border-hover::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--color-accent-red), var(--color-accent-green));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.gradient-border-hover:hover::before {
  opacity: 1;
}

/* ========================================
   PRODUCT LIGHTBOX MODAL
   ======================================== */

.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 10010;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.lightbox-modal.hidden {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.92);
  backdrop-filter: blur(6px);
  animation: lightboxFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-figure {
  position: relative;
  z-index: 1;
  max-width: min(90vw, 980px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  animation: lightboxScaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-image {
  max-width: 100%;
  max-height: 68vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  background: #fcfbf9;
}

.lightbox-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
  color: #fcfbf9;
}

.lightbox-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.lightbox-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-accent-red);
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fcfbf9;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  transition: background-color 0.2s ease, transform 0.15s ease;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(237, 32, 36, 0.85);
  border-color: transparent;
}

.lightbox-close:active,
.lightbox-nav:active {
  transform: scale(0.94);
}

.lightbox-close {
  top: 1.5rem;
  right: 1.5rem;
  width: 2.75rem;
  height: 2.75rem;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
}

.lightbox-nav:active {
  transform: translateY(-50%) scale(0.94);
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

@media (min-width: 768px) {
  .lightbox-prev {
    left: 2rem;
  }
  .lightbox-next {
    right: 2rem;
  }
}

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

@keyframes lightboxScaleIn {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
