/* ========================================
   Art Showcase — Design System
   ======================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #f0f0f0;
  background-color: #080808;
  overflow-x: hidden;
  min-height: 100vh;
}

/* --- WebGL Canvas Background (untouched) --- */
canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* --- Fixed Social Links --- */
#social-links {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 50;
  display: flex;
  gap: 10px;
  opacity: 0;
  animation: headerReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.social-link:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.4);
}

.social-link:active {
  transform: translateY(0);
  transition-duration: 0.1s;
}

.social-link svg {
  width: 20px;
  height: 20px;
}

/* --- Header --- */
#site-header {
  text-align: center;
  padding: 100px 20px 40px;
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(20px);
  animation: headerReveal 1s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

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

#site-header h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 0%, #a0a0a0 50%, #ffffff 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 8s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.subtitle {
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* --- Projects Grid --- */
#projects-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 32px;
  padding: 40px 40px 120px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* --- Card --- */
.project {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.4s ease,
    box-shadow 0.4s ease,
    background 0.4s ease;
  will-change: transform;
  /* Initial state for scroll reveal */
  opacity: 0;
  transform: translateY(40px);
}

.project.revealed {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.4s ease,
    box-shadow 0.4s ease,
    background 0.4s ease;
}

/* --- Card Hover Glow --- */
.project::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0.02) 40%,
    rgba(120, 120, 255, 0.08) 60%,
    rgba(255, 255, 255, 0.1)
  );
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: -1;
  pointer-events: none;
}

.project:hover::before {
  opacity: 1;
}

.project:hover {
  transform: translateY(-6px) scale(1.01);
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  box-shadow:
    0 20px 60px -15px rgba(0, 0, 0, 0.6),
    0 0 40px -10px rgba(120, 120, 255, 0.08);
}

.project:active {
  transform: translateY(-2px) scale(0.99);
  transition-duration: 0.1s;
}

/* --- Thumbnail Container --- */
.preview-container {
  width: 100%;
  aspect-ratio: 16 / 10;
  position: relative;
  overflow: hidden;
  background: #111;
}

/* --- Thumbnail Image --- */
.project-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.project:hover .project-thumbnail {
  opacity: 0.15;
  transform: scale(1.08);
}

/* --- Iframe Preview --- */
.project-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity;
  pointer-events: none;
}

.project:hover .project-preview {
  opacity: 1;
}

/* --- Card Content --- */
.card-content {
  padding: 20px 20px 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.project h3 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  margin-bottom: 6px;
  transition: color 0.3s ease;
}

.project:hover h3 {
  background: linear-gradient(90deg, #e0e0ff, #ffffff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.project p {
  font-size: 0.875rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.6;
  flex-grow: 1;
}

/* --- Card Index Badge --- */
.card-index {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 20px;
  z-index: 2;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
}

/* --- View Arrow Indicator --- */
.card-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 12px;
  align-self: flex-end;
  transition: all 0.3s ease;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.8rem;
}

.project:hover .card-arrow {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  transform: translateX(3px);
}

/* --- Page Transition Overlay --- */
.page-exit-overlay {
  position: fixed;
  inset: 0;
  background: #080808;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.page-exit-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  #projects-container {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 30px 24px 80px;
  }
}

@media (max-width: 640px) {
  #site-header {
    padding: 80px 16px 24px;
  }

  #projects-container {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 16px 60px;
  }

  .project h3 {
    font-size: 1.05rem;
  }
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- Selection --- */
::selection {
  background: rgba(120, 120, 255, 0.3);
  color: #fff;
}
