/* ── Palette Games · css/main.css ───────────────────────────── */

/* ═══════════════════════════════════════════════════════════════
   TABLE OF CONTENTS
   1.  Base & Typography
   2.  Layout Helpers
   3.  Navigation
   4.  Gradient Text Utility
   5.  Hero Section
   6.  Projects Grid & Cards
   7.  Project Detail Page
   8.  Screenshot Gallery
   9.  Video Section
   10. WebGL Embed
   11. Links Section
   12. Palette Panel
   13. Lightbox
   14. Page Transition
   15. Footer
   16. Not-Found Page
   17. Chips & Badges
   18. Animations / Keyframes
   19. Responsive
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Base & Typography ─────────────────────────────────────── */
body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

h1, h2, h3, .hero-title, .section-title, .project-title {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
}

code {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  color: var(--c2);
}

/* ── 2. Layout Helpers ────────────────────────────────────────── */
.section-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
}

.app {
  padding-top: 64px; /* nav height */
  min-height: 100vh;
}

/* ── 3. Navigation ────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 64px;
  background: var(--nav-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.nav.scrolled {
  box-shadow: 0 4px 32px rgba(0,0,0,0.4);
  border-bottom-color: var(--border-strong);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  height: 100%;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.nav-logo:hover { opacity: 0.8; }
.nav-logo-img {
  height: 100%;
  width: auto;
  object-fit: contain;
}
.logo-light { display: none; }
.logo-dark { display: block; }
[data-theme="light"] .logo-dark { display: none; }
[data-theme="light"] .logo-light { display: block; }
.nav-logo-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
  position: relative;
}
.nav-link:hover {
  color: var(--text);
  background: var(--surface2);
}
.nav-link.active {
  color: var(--text);
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad-h);
}

/* Nav actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Theme toggle button */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.theme-toggle-btn:hover {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border-strong);
}
.theme-toggle-btn svg {
  width: 16px;
  height: 16px;
}
#icon-moon { display: none; }

/* Palette button */
.palette-btn {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.palette-btn:hover {
  background: var(--surface2);
  border-color: var(--border-strong);
  transform: scale(1.05);
}
.palette-btn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: background 0.3s ease;
}

/* ── 4. Gradient Text Utility ─────────────────────────────────── */
.gradient-text {
  background: var(--grad-h);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* Allow gradient to update with CSS vars */
  background-size: 200% auto;
}

/* ── 5. Hero Section ──────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4rem 2rem 6rem;
}

/* Animated orb background */
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
  opacity: 0.4;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}
.orb-1 {
  width: 500px; height: 500px;
  background: var(--c1);
  opacity: 0.18;
  top: -120px; left: -100px;
  animation: orbFloat1 10s ease-in-out infinite;
}
.orb-2 {
  width: 420px; height: 420px;
  background: var(--c2);
  opacity: 0.16;
  top: 20%; right: -80px;
  animation: orbFloat2 13s ease-in-out infinite;
}
.orb-3 {
  width: 380px; height: 380px;
  background: var(--c3);
  opacity: 0.13;
  bottom: 0; left: 20%;
  animation: orbFloat3 11s ease-in-out infinite;
}
.orb-4 {
  width: 300px; height: 300px;
  background: var(--c4);
  opacity: 0.15;
  top: 40%; left: 50%;
  animation: orbFloat1 14s ease-in-out infinite reverse;
}

/* Hero content */
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 800px;
  animation: heroEnter 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  padding: 0.35rem 1rem;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(3.5rem, 9vw, 7.5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 1.25rem;
}

.hero-title-palette {
  display: inline-block;
  background: var(--grad-h);
  background-size: 300% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 6s ease infinite;
}

.hero-title-plain {
  color: var(--text);
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.5;
  margin-bottom: 2.5rem;
  letter-spacing: 0.01em;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.85rem 2rem;
  border-radius: 12px;
  background: var(--grad-h);
  background-size: 200% auto;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-position 0.4s ease;
  animation: gradientShift 5s ease infinite;
}
.hero-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.hero-cta:active { transform: translateY(0); }

/* Scroll indicator */
.hero-scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  z-index: 2;
}
.scroll-line {
  width: 2px;
  height: 40px;
  background: var(--grad-h);
  border-radius: 2px;
  animation: scrollPulse 2s ease-in-out infinite;
}
.scroll-label {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ── 6. Projects Grid & Cards ─────────────────────────────────── */
.projects-section {
  padding: 6rem 0 8rem;
  position: relative;
}

.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

/* ── Project Card ─────────────────────────────────────────────── */
.project-card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s ease,
              border-color 0.35s ease;
  opacity: 0;
}
.project-card.card-enter {
  animation: cardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.project-card:hover {
  transform: translateY(-8px);
  border-color: var(--border-strong);
  box-shadow: 0 24px 64px rgba(0,0,0,0.4), 0 0 0 1px var(--border-strong);
}
.project-card:hover .card-glow {
  opacity: 1;
}
.project-card:hover .card-arrow {
  transform: translateX(4px);
}
.project-card:hover .card-img {
  transform: scale(1.04);
}

.card-link-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

/* Card image */
.card-img-wrap {
  position: relative;
  height: 220px;
  overflow: hidden;
  background: var(--bg3);
}
.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.card-img-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,0.7) 100%);
}
.card-img-wrap.no-img {
  background: linear-gradient(135deg, var(--bg3), var(--bg2));
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-img-wrap.no-img::before {
  content: '🎮';
  font-size: 3rem;
  opacity: 0.3;
}

.card-genre-chips {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* Card body */
.card-body {
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.5rem;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-engine {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.card-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.card-tagline {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.card-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.card-year {
  font-size: 0.8rem;
  color: var(--text-faint);
}

.card-cta {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--c1);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.card-arrow {
  display: inline-block;
  transition: transform 0.25s ease;
}

/* Glow effect (uses c1 + c2) */
.card-glow {
  position: absolute;
  inset: -1px;
  border-radius: 18px;
  background: var(--grad);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.35s ease;
  padding: 1px;
  mask-image: linear-gradient(black, black);
  -webkit-mask-image: linear-gradient(black, black);
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.empty-icon { font-size: 3rem; }

/* ── 7. Project Detail Page ───────────────────────────────────── */

/* Hero banner */
.project-hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding-bottom: 4rem;
}

.project-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.project-hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
}
.project-hero-orb-1 {
  width: 600px; height: 600px;
  background: var(--c1);
  opacity: 0.15;
  top: -200px; left: -100px;
  animation: orbFloat1 12s ease-in-out infinite;
}
.project-hero-orb-2 {
  width: 500px; height: 500px;
  background: var(--c2);
  opacity: 0.12;
  bottom: -100px; right: -100px;
  animation: orbFloat2 15s ease-in-out infinite;
}

/* Cover image fills the hero */
.project-cover-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.project-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.project-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(9,9,12,0.2) 0%,
    rgba(9,9,12,0.5) 40%,
    rgba(9,9,12,0.92) 100%
  );
}
[data-theme="light"] .project-cover-overlay {
  background: linear-gradient(
    to bottom,
    rgba(244,243,248,0.1) 0%,
    rgba(244,243,248,0.4) 40%,
    rgba(244,243,248,0.93) 100%
  );
}

/* Hero text content */
.project-hero-content {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 2rem 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  animation: heroEnter 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.2s;
  margin-bottom: 0.5rem;
}
.back-btn:hover {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border-strong);
  transform: translateX(-3px);
}

.project-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.project-title {
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
}

.project-tagline {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 300;
  max-width: 600px;
}

.project-hero-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.project-year {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Project body */
.project-body {
  background: var(--bg);
  position: relative;
  z-index: 1;
  padding: 1rem 0 6rem;
}

.project-body-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
}

.project-section {
  padding: 3rem 0 0;
}

.section-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 3rem;
}

.project-section-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}

.project-description {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text-muted);
  max-width: 720px;
}
.project-description p { margin-bottom: 1rem; }
.project-description p:last-child { margin-bottom: 0; }
.project-description strong { color: var(--text); font-weight: 600; }

/* ── 8. Screenshot Gallery ────────────────────────────────────── */
.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.screenshot-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16/9;
  background: var(--bg3);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.screenshot-item:hover {
  transform: scale(1.02);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.screenshot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.screenshot-item:hover .screenshot-img {
  transform: scale(1.06);
}
.screenshot-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.screenshot-item:hover .screenshot-overlay {
  opacity: 1;
}
.screenshot-zoom-icon {
  font-size: 1.5rem;
  color: white;
}

/* ── 9. Video Section ─────────────────────────────────────────── */
.videos-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.video-wrap {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.video-title {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.video-frame-wrap {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
}
.video-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.video-native {
  width: 100%;
  max-height: 520px;
  background: #000;
}

/* ── 10. WebGL Embed ──────────────────────────────────────────── */
.webgl-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 600px;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.webgl-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: var(--surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.webgl-play-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  background: var(--grad-h);
  background-size: 200% auto;
  padding: 1.25rem 2.5rem;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: gradientShift 4s ease infinite;
}
.webgl-play-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}
.webgl-play-icon {
  font-size: 2rem;
  display: block;
}

.webgl-note {
  font-size: 0.8rem;
  color: var(--text-faint);
}

.webgl-iframe {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.webgl-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
  padding: 4rem 2rem;
  border-radius: 14px;
  border: 2px dashed var(--border-strong);
  background: var(--surface);
}
.webgl-placeholder-icon { font-size: 2.5rem; }
.webgl-placeholder-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}
.webgl-placeholder-hint {
  font-size: 0.85rem;
  color: var(--text-faint);
  max-width: 480px;
  line-height: 1.6;
}

/* ── 11. Links Section ────────────────────────────────────────── */
.links-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.link-btn:hover {
  background: var(--surface-hover);
  border-color: var(--c1);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.link-btn-arrow {
  font-size: 0.8rem;
  color: var(--text-faint);
  transition: color 0.2s;
}
.link-btn:hover .link-btn-arrow { color: var(--c1); }
.link-btn-icon { font-size: 1.1rem; }

/* ── 12. Palette Panel ────────────────────────────────────────── */
.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.palette-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.palette-panel {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  width: 290px;
  background: var(--bg2);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transform: translateY(20px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease;
}
.palette-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.palette-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.palette-panel-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.palette-panel-close {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.palette-panel-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.palette-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: -0.4rem;
}

/* Presets */
.palette-presets {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.preset-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 9px;
  border: 1px solid transparent;
  background: var(--surface);
  transition: background 0.2s, border-color 0.2s;
  width: 100%;
  text-align: left;
}
.preset-btn:hover {
  background: var(--surface2);
  border-color: var(--border);
}
.preset-btn.active {
  background: var(--surface2);
  border-color: var(--c1);
}
.preset-dots {
  display: flex;
  gap: 4px;
}
.preset-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.preset-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Custom colour rows */
.palette-colors {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.color-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}
.color-swatch-wrap {
  position: relative;
}
.color-swatch {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 2px solid var(--border-strong);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}
.color-swatch:hover {
  transform: scale(1.1);
  border-color: var(--text-faint);
}
.color-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Mode toggle */
.mode-toggle-group {
  display: flex;
  gap: 0.4rem;
}
.mode-btn {
  flex: 1;
  padding: 0.5rem;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.mode-btn:hover {
  background: var(--surface2);
  color: var(--text);
}
.mode-btn.active {
  background: var(--surface-active);
  border-color: var(--c1);
  color: var(--text);
}

/* ── 13. Lightbox ─────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.lightbox-img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
  animation: lightboxIn 0.25s ease both;
}
.lightbox-caption {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  text-align: center;
}

.lightbox-close {
  position: fixed;
  top: 1.5rem; right: 1.5rem;
  z-index: 2;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}
.lightbox-close:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.1);
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}
.lightbox-nav:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-50%) scale(1.1);
}
.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }

/* ── 14. Page Transition Veil ─────────────────────────────────── */
.page-veil {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.page-veil.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── 15. Footer ───────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  background: var(--bg2);
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.footer-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
}
.footer-sep { color: var(--text-faint); }

/* ── 16. Not-Found ────────────────────────────────────────────── */
.not-found {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
}
.not-found-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.not-found-code {
  font-family: 'Outfit', sans-serif;
  font-size: 8rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.05em;
}
.not-found-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
}
.not-found-subtitle {
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ── 17. Chips & Badges ───────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.15);
}
[data-theme="light"] .chip {
  background: rgba(0,0,0,0.07);
  color: rgba(0,0,0,0.7);
  border-color: rgba(0,0,0,0.12);
}
.chip-sm {
  font-size: 0.65rem;
  padding: 0.18rem 0.5rem;
}
.chip-engine {
  background: color-mix(in srgb, var(--c1) 15%, transparent);
  color: var(--c1);
  border-color: color-mix(in srgb, var(--c1) 30%, transparent);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.22rem 0.6rem;
  border-radius: 100px;
}
.status-released {
  background: color-mix(in srgb, var(--c3) 18%, transparent);
  color: var(--c3);
  border: 1px solid color-mix(in srgb, var(--c3) 35%, transparent);
}
.status-in-development {
  background: color-mix(in srgb, var(--c4) 18%, transparent);
  color: var(--c4);
  border: 1px solid color-mix(in srgb, var(--c4) 35%, transparent);
}
.status-prototype {
  background: color-mix(in srgb, var(--c1) 18%, transparent);
  color: var(--c1);
  border: 1px solid color-mix(in srgb, var(--c1) 35%, transparent);
}
.status-cancelled {
  background: color-mix(in srgb, var(--c2) 18%, transparent);
  color: var(--c2);
  border: 1px solid color-mix(in srgb, var(--c2) 35%, transparent);
}

/* ── 18. Keyframe Animations ──────────────────────────────────── */
@keyframes orbFloat1 {
  0%, 100% { transform: translate(0,   0  ) scale(1);    }
  33%       { transform: translate(30px,-25px) scale(1.04); }
  66%       { transform: translate(-15px, 20px) scale(0.97); }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translate(0,   0  ) scale(1);    }
  40%       { transform: translate(-20px, 30px) scale(1.05); }
  70%       { transform: translate(25px, -15px) scale(0.96); }
}
@keyframes orbFloat3 {
  0%, 100% { transform: translate(0,   0  ) scale(1);    }
  50%       { transform: translate(20px, -20px) scale(1.06); }
}

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

@keyframes heroEnter {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(32px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

@keyframes scrollPulse {
  0%, 100% { transform: scaleY(1);   opacity: 0.7; }
  50%       { transform: scaleY(0.6); opacity: 0.3; }
}

@keyframes lightboxIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1);    }
}

/* ── 19. Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }

  .hero { padding: 3rem 1.25rem 5rem; }
  .hero-title { font-size: clamp(2.8rem, 12vw, 4.5rem); }
  .hero-subtitle { font-size: 1rem; }

  .section-inner { padding: 0 1.25rem; }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .project-hero { min-height: 55vh; }
  .project-hero-content { padding: 1.25rem 1.25rem 0; }
  .project-title { font-size: clamp(2rem, 9vw, 3rem); }

  .project-body-inner { padding: 0 1.25rem; }

  .screenshot-grid { grid-template-columns: 1fr 1fr; }

  .palette-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 85vh;
    overflow-y: auto;
  }

  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }

  .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .screenshot-grid { grid-template-columns: 1fr; }
  .links-grid { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
