/* ========== SHARED GALLERY STYLES ========== */
/* Enhanced animations, responsiveness, and thumbnails for all project pages */

:root {
  --bg: #0a0c14;
  --bg-light: #0f1420;
  --card-bg: rgba(15, 20, 40, 0.85);
  --muted: #9aa6b2;
  --muted-2: #77a0b3;
  --heading: #e6f1f9;
  --accent: #64ffda;
  --accent-2: #f77062;
  --accent-3: #7c5cff;
  --border: rgba(100, 255, 218, 0.1);
  --shadow: rgba(2, 6, 23, 0.6);
}

/* ========== BASE STYLES ========== */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #0a0c14 0%, #071826 50%, #0a0c14 100%);
  color: #e6eef6;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Animated Background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(100, 255, 218, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(247, 112, 98, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(124, 92, 255, 0.02) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ========== CONTAINER ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
}

/* ========== HEADER STYLES ========== */
header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
  animation: fadeSlideDown 0.6s ease forwards;
}

@keyframes fadeSlideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

header img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 8px 24px var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

header img:hover {
  transform: scale(1.05) rotate(2deg);
  box-shadow: 0 12px 32px var(--shadow), 0 0 20px rgba(100, 255, 218, 0.1);
}

header h1 {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  margin: 0;
  color: var(--heading);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lead {
  color: var(--muted);
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ========== BACK BUTTON ========== */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--muted);
  background: rgba(100, 255, 218, 0.05);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 25px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.back-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(100, 255, 218, 0.1), transparent);
  transition: left 0.5s ease;
}

.back-btn:hover::before {
  left: 100%;
}

.back-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateX(-4px);
  box-shadow: 0 4px 15px rgba(100, 255, 218, 0.15);
}

.back-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.back-btn:hover svg {
  transform: translateX(-4px);
}

/* ========== FEATURED VIDEO ========== */
.featured-video {
  position: relative;
  margin: 1.5rem 0 2.5rem;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-light), var(--bg));
  box-shadow: 0 20px 60px var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s ease;
  animation: fadeScaleIn 0.8s ease forwards;
  animation-delay: 0.2s;
  opacity: 0;
}

@keyframes fadeScaleIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.featured-video:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 30px 80px var(--shadow), 0 0 40px rgba(100, 255, 218, 0.1);
}

.featured-video video {
  width: 100%;
  height: auto;
  max-height: 65vh;
  object-fit: contain;
  display: block;
  transition: filter 0.3s ease;
}

.featured-video:hover video {
  filter: brightness(1.02);
}

/* Video Overlay */
.fv-overlay {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  color: var(--heading);
  background: rgba(10, 12, 20, 0.8);
  padding: 0.6rem 1rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.featured-video:hover .fv-overlay {
  background: rgba(100, 255, 218, 0.1);
  border-color: var(--accent);
}

/* Video Controls */
.fv-controls {
  position: absolute;
  right: 1rem;
  top: 1rem;
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}

.fv-btn {
  background: rgba(10, 12, 20, 0.8);
  border: 1px solid var(--border);
  color: #fff;
  padding: 0.6rem;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.fv-btn:hover {
  background: rgba(100, 255, 218, 0.15);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.fv-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Play Overlay */
.fv-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.fv-play-overlay .icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(10, 12, 20, 0.7);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s ease;
}

.fv-play-overlay .icon.show {
  opacity: 1;
  transform: scale(1);
}

.fv-play-overlay svg {
  width: 36px;
  height: 36px;
  fill: var(--accent);
  margin-left: 4px;
}

/* ========== GRID LAYOUT ========== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

/* ========== CARD STYLES ========== */
.card {
  background: var(--card-bg);
  padding: 0.875rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  pointer-events: auto;
}

/* Card entrance animation */
.card.pre-reveal {
  opacity: 0;
  transform: translateY(30px) scale(0.95);
}

.card.reveal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Card hover effects */
.card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(100, 255, 218, 0.1);
  border-color: rgba(100, 255, 218, 0.3);
}

/* Card glow effect */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2), var(--accent-3));
  -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;
}

.card:hover::before {
  opacity: 0.5;
}

/* Activity Card Button - ensures clicks work */
.activity-card {
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer !important;
  position: relative;
  z-index: 5;
  pointer-events: auto !important;
}

.activity-card * {
  pointer-events: none;
}

.activity-card:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Card Thumbnail */
.card .thumb {
  aspect-ratio: 16/10;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #0a0c14, #15192a);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Thumbnail gradient overlay */
.card .thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(10, 12, 20, 0.8) 100%);
  pointer-events: none;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.card:hover .thumb::after {
  opacity: 0.5;
}

.card .thumb img,
.card .thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), filter 0.3s ease;
}

.card:hover .thumb img,
.card:hover .thumb video {
  transform: scale(1.08);
  filter: brightness(1.1);
}

/* Play icon on video thumbnails */
.card .thumb .play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background: rgba(100, 255, 218, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 5;
}

.card:hover .thumb .play-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.card .thumb .play-icon svg {
  width: 20px;
  height: 20px;
  fill: #0a0c14;
  margin-left: 3px;
}

/* Card Title */
.card h3 {
  margin: 0.875rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--heading);
  transition: color 0.3s ease;
}

.card:hover h3 {
  color: var(--accent);
}

/* Card Meta */
.card .meta,
.card .count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  background: rgba(100, 255, 218, 0.05);
  border-radius: 20px;
  border: 1px solid rgba(100, 255, 218, 0.1);
}

/* ========== LIGHTBOX ========== */
.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 20, 0.95);
  z-index: 9999;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox.open {
  display: flex;
}

.lightbox .frame {
  max-width: 95%;
  max-height: 95%;
  background: var(--card-bg);
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  position: relative;
  animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lightbox img,
.lightbox video {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 12px;
  display: block;
}

.close-btn {
  position: absolute;
  right: -12px;
  top: -12px;
  width: 36px;
  height: 36px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: #0a0c14;
  font-size: 1.25rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-btn:hover {
  transform: scale(1.1) rotate(90deg);
  background: var(--accent-2);
}

/* Lightbox Navigation */
.lb-controls {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.75rem;
}

.lb-controls button {
  background: rgba(100, 255, 218, 0.1);
  border: 1px solid var(--border);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 25px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.lb-controls button:hover {
  background: var(--accent);
  color: #0a0c14;
  transform: translateY(-2px);
}

/* ========== THUMBNAIL ROW ========== */
.thumb-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  overflow-x: auto;
  padding: 0.5rem 0;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

.thumb-row::-webkit-scrollbar {
  height: 6px;
}

.thumb-row::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.thumb-row::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

.thumb-row button {
  flex: 0 0 auto;
  border: 2px solid transparent;
  background: transparent;
  padding: 0;
  cursor: pointer !important;
  border-radius: 10px;
  scroll-snap-align: center;
  transition: all 0.3s ease;
  overflow: hidden;
  position: relative;
  z-index: 10;
  pointer-events: auto !important;
}

.thumb-row button:hover,
.thumb-row button.active {
  border-color: var(--accent);
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(100, 255, 218, 0.2);
}

.thumb-row img,
.thumb-row video {
  height: 80px;
  width: auto;
  min-width: 100px;
  border-radius: 8px;
  display: block;
  object-fit: cover;
  transition: transform 0.3s ease;
  pointer-events: none;
}

.thumb-row button:hover img,
.thumb-row button:hover video {
  transform: scale(1.05);
}

/* ========== ACTIVITY VIEW ========== */
.activity-view {
  display: none;
  margin-top: 2rem;
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.activity-view.open {
  display: block;
}

.activity-shell {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.5rem;
  width: 100%;
  max-width: 100%;
}

.activity-shell > * {
  min-width: 0;
}

.activity-shell > div:first-child {
  overflow: hidden;
}

/* Code Pane */
.code-pane {
  background: rgba(10, 12, 20, 0.9);
  border-radius: 12px;
  padding: 1rem;
  height: min(70vh, 600px);
  overflow: auto;
  color: #e6eef6;
  border: 1px solid var(--border);
}

.code-pane pre {
  white-space: pre-wrap;
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

#media-main {
  background: rgba(10, 12, 20, 0.5);
  border-radius: 12px;
  padding: 1rem;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

#media-main img,
#media-main video {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 8px;
}

/* ========== SCROLL ANIMATIONS ========== */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered animations for cards */
.card:nth-child(1) { transition-delay: 0.05s; }
.card:nth-child(2) { transition-delay: 0.1s; }
.card:nth-child(3) { transition-delay: 0.15s; }
.card:nth-child(4) { transition-delay: 0.2s; }
.card:nth-child(5) { transition-delay: 0.25s; }
.card:nth-child(6) { transition-delay: 0.3s; }
.card:nth-child(7) { transition-delay: 0.35s; }
.card:nth-child(8) { transition-delay: 0.4s; }

/* ========== RESPONSIVE STYLES ========== */
@media (max-width: 1024px) {
  .activity-shell {
    grid-template-columns: 1fr;
  }
  
  .code-pane {
    height: auto;
    max-height: 400px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  
  header {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  
  header img {
    width: 64px;
    height: 64px;
  }
  
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
  }
  
  .featured-video {
    margin: 1rem 0 2rem;
    border-radius: 16px;
  }
  
  .back-btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
  }
  
  .thumb-row img,
  .thumb-row video {
    height: 60px;
    min-width: 80px;
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: 1fr;
  }
  
  .card .thumb {
    aspect-ratio: 16/9;
  }
  
  .featured-video video {
    max-height: 50vh;
  }
  
  header h1 {
    font-size: 1.1rem;
  }
  
  .lead {
    font-size: 0.85rem;
  }
}

/* ========== TOUCH DEVICE OPTIMIZATIONS ========== */
@media (hover: none) and (pointer: coarse) {
  .card:hover {
    transform: none;
  }
  
  .card:active {
    transform: scale(0.98);
  }
  
  .back-btn:hover {
    transform: none;
  }
  
  .thumb-row button:hover {
    transform: none;
  }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========== UTILITY CLASSES ========== */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
