/* ========== MELTINGPIXELS SHARED STYLES ========== */
/* Included by all page templates. Page-specific overrides go in each template's <style>. */

/* ========== CSS CUSTOM PROPERTIES ========== */
:root {
  /* Core palette */
  --void: #030308;
  --void-light: #0a0a12;
  --purple-900: #1a0a2e;
  --purple-700: #4c1d95;
  --purple-500: #8b5cf6;
  --purple-400: #a78bfa;
  --purple-300: #c4b5fd;
  --violet-500: #7c3aed;
  --indigo-500: #6366f1;
  --fuchsia-500: #d946ef;
  --cyan-500: #06b6d4;
  --cyan-400: #22d3ee;
  --green-500: #22c55e;
  --green-400: #4ade80;
  --orange-500: #f97316;
  --red-500: #ef4444;
  --red-400: #f87171;
  --amber-400: #fbbf24;

  /* Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Typography */
  --font-sans: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Easing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);

  /* Accent — override per page */
  --accent: var(--purple-400);
  --accent-glow: rgba(139, 92, 246, 0.15);
}

/* ========== RESET & BASE ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--purple-500) var(--void);
}

body {
  font-family: var(--font-sans);
  background: var(--void);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

::selection { background: var(--purple-500); color: white; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ========== SKIP NAVIGATION ========== */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--purple-500);
  color: white;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  border-radius: 0 0 8px 8px;
  z-index: 100000;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ========== CONTAINER ========== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }

/* ========== NOISE OVERLAY ========== */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ========== NAVIGATION ========== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.5rem 0;
  background: rgba(3, 3, 8, 0.8);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}
.nav-content { display: flex; justify-content: space-between; align-items: center; }
.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
}
.nav-back {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.3s;
}
.nav-back:hover { color: var(--accent); }

/* ========== FOOTER ========== */
.footer {
  padding: 2rem 0;
  border-top: 1px solid rgba(139, 92, 246, 0.1);
  text-align: center;
}
.footer-text { font-size: 0.875rem; color: var(--text-muted); }
.footer-text a { color: var(--accent); transition: color 0.3s; }
.footer-text a:hover { color: var(--fuchsia-500); }
.footer-legal {
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}
.footer-legal a { color: var(--text-muted); transition: color 0.3s; }
.footer-legal a:hover { color: var(--accent); }
.footer-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 12px;
  transition: all 0.3s var(--ease-out-expo);
  border: none;
  cursor: pointer;
}
.btn-primary {
  background: linear-gradient(135deg, var(--purple-500), var(--fuchsia-500));
  color: white;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -10px rgba(139, 92, 246, 0.5);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary {
  background: transparent;
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--text-primary);
}
.btn-secondary:hover {
  border-color: var(--purple-500);
  background: rgba(139, 92, 246, 0.1);
}

/* ========== SECTION PATTERNS ========== */
.section-tag {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent);
  text-align: center;
  margin-bottom: 1rem;
}
.section-header {
  text-align: center;
  margin-bottom: 4rem;
}
.section-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ========== TECH BADGES ========== */
.tech-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}
.tech-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.4rem 1rem;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 50px;
  color: var(--text-secondary);
  transition: all 0.3s;
}
.tech-badge:hover {
  border-color: rgba(139, 92, 246, 0.4);
  color: var(--text-primary);
}

/* ========== LIGHTBOX ========== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(3, 3, 8, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  cursor: zoom-out;
}
.lightbox.active { opacity: 1; visibility: visible; }
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}
.lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  font-size: 2rem;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== CATEGORY HEADERS (Grouped Project Sections) ========== */
.category-header {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.15);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.category-header::before {
  content: '//';
  color: var(--text-muted);
}
.category-header + .projects-grid {
  margin-bottom: 4rem;
}

/* ========== GRADIENT TEXT HELPER ========== */
.gradient-text {
  color: var(--accent); /* fallback */
  background: linear-gradient(135deg, var(--purple-400), var(--fuchsia-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========== SAFARI FIXES ========== */
/* mask-image prefix for grid overlays */
.grid-overlay {
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black, transparent);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black, transparent);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .nav { padding: 1rem 0; }
}

/* ========== PRINT ========== */
@media print {
  .gradient-bg, .grid-overlay, .noise, .scan-line, .scan-lines,
  .cursor, .cursor-dot, .loading, .lightbox, .nav, .skip-link { display: none !important; }
  body { background: white !important; color: black !important; cursor: auto !important; }
  a { color: black !important; }
  .footer { border-top-color: #ccc !important; }
  .footer-text, .footer-text a, .footer-legal, .footer-legal a { color: #333 !important; }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
