/* Theme-aware global styles */

:root {
  /* Dark theme (default) */
  --bg: #080812;
  --surface: #0f0f1a;
  --surface-hover: #161626;
  --border: #1e1e32;
  --border-strong: #2a2a48;
  --text-primary: #f8f8fc;
  --text-body: #a0a0b8;
  --text-muted: #6b6b8a;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: #4f46e5;
  --selection-bg: rgba(99, 102, 241, 0.25);
}

[data-theme="light"] {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-hover: #f3f4f6;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text-primary: #111827;
  --text-body: #4b5563;
  --text-muted: #9ca3af;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #3730a3;
  --selection-bg: rgba(79, 70, 229, 0.2);
}

::selection {
  background: var(--selection-bg);
  color: var(--text-primary);
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

html {
  scroll-behavior: smooth;
}

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

  .nav-hidden {
    transform: none !important;
  }
}

/* Noise overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.025;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,%3Csvg viewBox=%220 0 200 200%22 xmlns=%22http://www.w3.org/2000/svg%22%3E%3Cfilter id=%22noise%22%3E%3CfeTurbulence type=%22fractalNoise%22 baseFrequency=%220.65%22 numOctaves=%223%22 stitchTiles=%22stitch%22/%3E%3C/filter%3E%3Crect width=%22100%25%22 height=%22100%25%22 filter=%22url(%23noise)%22/%3E%3C/svg%3E");
}

[data-theme="light"] .noise-overlay {
  opacity: 0.015;
  mix-blend-mode: multiply;
}

/* Touch target minimum */
.touch-min {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Nav transitions */
#main-nav {
  transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.nav-hidden {
  transform: translateY(-100%);
}

/* Active nav indicator */
.nav-active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1rem;
  right: 1rem;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* Hero entrance animations */
.animate-hero-name {
  opacity: 0;
  animation: heroName 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-fade-in {
  opacity: 0;
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-up {
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-150 { animation-delay: 150ms; }
.delay-250 { animation-delay: 250ms; }
.delay-350 { animation-delay: 350ms; }
.delay-450 { animation-delay: 450ms; }

@media (prefers-reduced-motion: reduce) {
  .animate-hero-name,
  .animate-fade-in,
  .animate-fade-up {
    opacity: 1 !important;
    animation: none !important;
    transform: none !important;
  }
}

/* Hero orb with accent glow */
.hero-orb {
  position: absolute;
  top: -220px;
  right: -120px;
  width: 650px;
  height: 650px;
  border-radius: 50%;
  opacity: 1;
  pointer-events: none;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(79, 70, 229, 0.04) 40%, transparent 70%);
  animation: orbFloat 24s linear infinite;
}

[data-theme="light"] .hero-orb {
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, rgba(79, 70, 229, 0.03) 40%, transparent 70%);
}

@media (prefers-reduced-motion: reduce) {
  .hero-orb {
    display: none;
  }
}

/* Section label accent rule */
.section-label-accent::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 2px;
  background: var(--accent);
  margin-right: 12px;
  vertical-align: middle;
  border-radius: 1px;
}

/* Project chevron rotation */
.project-chevron {
  transition: transform 0.2s ease;
}

/* Logo theme variants */
.logo-dark {
  display: none;
}
.logo-light {
  display: block;
}
[data-theme="dark"] .logo-dark {
  display: block;
}
[data-theme="dark"] .logo-light {
  display: none;
}

/* Reveal on scroll via CSS animation */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

@keyframes heroName {
  0% { opacity: 0; transform: translateY(40px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(24px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(40px, -30px); }
}
