/* Base styles */
html { scroll-behavior: smooth; overflow-x: clip; }
body { font-family: 'DM Sans', system-ui, -apple-system, sans-serif; }
.font-display { font-family: 'Outfit', system-ui, sans-serif; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }

/* Selection color */
::selection {
  background: rgba(139,92,246,0.25);
  color: inherit;
}

/* Gradient system */
:root {
  --gradient-primary: linear-gradient(135deg, #8b5cf6, #d946ef, #f59e0b);
  --gradient-primary-reverse: linear-gradient(315deg, #8b5cf6, #d946ef, #f59e0b);
  --gradient-subtle: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(217,70,239,0.08), rgba(245,158,11,0.06));
  --gradient-subtle-dark: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(217,70,239,0.15), rgba(245,158,11,0.1));
}

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gradient-bg {
  background: var(--gradient-primary);
}

/* Gradient border on hover */
.gradient-border {
  position: relative;
}
.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: var(--gradient-primary);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  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;
}
.gradient-border:hover::before {
  opacity: 1;
}

/* Card glow + shine on hover */
.card-glow {
  transition: box-shadow 0.4s ease, border-color 0.4s ease, transform 0.4s ease;
}
.card-glow:hover {
  box-shadow: 0 8px 40px rgba(139,92,246,0.15), 0 0 80px rgba(217,70,239,0.1);
  transform: translateY(-4px) scale(1.02) rotate(-0.5deg);
}
.dark .card-glow:hover {
  box-shadow: 0 8px 40px rgba(139,92,246,0.25), 0 0 80px rgba(217,70,239,0.18);
}

/* How I Help cards - enhanced animations */
@property --skill-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
.skill-card {
  position: relative;
  overflow: visible;
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, background 0.4s ease, backdrop-filter 0.4s ease;
  z-index: 1;
  --skill-angle: 0deg;
}
/* Animated rotating gradient border */
.skill-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from var(--skill-angle), #8b5cf6, #d946ef, #f59e0b, #8b5cf6);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  z-index: -1;
  transition: opacity 0.4s ease;
}
.skill-card:hover::before {
  opacity: 1;
  animation: skill-rotate 4s linear infinite;
}
/* Glow effect behind card */
.skill-card::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: conic-gradient(from var(--skill-angle), #8b5cf6, #d946ef, #f59e0b, #8b5cf6);
  opacity: 0;
  z-index: -2;
  filter: blur(20px);
  transition: opacity 0.4s ease;
}
.skill-card:hover::after {
  opacity: 0.35;
  animation: skill-rotate 4s linear infinite;
}
.dark .skill-card:hover::after {
  opacity: 0.2;
}
@keyframes skill-rotate {
  to { --skill-angle: 360deg; }
}
.skill-card:hover {
  transform: translateY(-8px) rotateX(2deg) rotateY(-2deg);
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 20px 40px rgba(139,92,246,0.15),
    inset 0 1px 0 rgba(255,255,255,0.4);
}
.dark .skill-card:hover {
  background: rgba(12,10,9,0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 20px 40px rgba(139,92,246,0.25),
    inset 0 1px 0 rgba(255,255,255,0.1);
}
.skill-card .skill-icon {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s ease;
}
.skill-card:hover .skill-icon {
  transform: scale(1.2) rotate(-8deg);
  color: #d946ef;
}
.skill-card .skill-title {
  transition: color 0.3s ease, letter-spacing 0.3s ease;
}
.skill-card:hover .skill-title {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.01em;
}

/* Project filters */
.project-filter {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 9999px;
  border: 1px solid rgba(214, 211, 209, 0.5);
  background: rgba(255, 255, 255, 0.5);
  color: #78716c;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}
.dark .project-filter {
  border-color: rgba(68, 64, 60, 0.5);
  background: rgba(28, 25, 23, 0.5);
  color: #a8a29e;
}
.project-filter:hover {
  border-color: rgba(139, 92, 246, 0.5);
  color: #8b5cf6;
}
.project-filter.active {
  background: var(--gradient-primary) border-box;
  border: 1px solid transparent;
  color: white;
}

/* Project card animations */
.project-card {
  position: relative;
  overflow: visible;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, background 0.4s ease, backdrop-filter 0.4s ease;
  z-index: 1;
  --skill-angle: 0deg;
}
/* Animated rotating gradient border */
.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from var(--skill-angle), #8b5cf6, #d946ef, #f59e0b, #8b5cf6);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  z-index: -1;
  transition: opacity 0.4s ease;
}
.project-card:hover::before {
  opacity: 1;
  animation: skill-rotate 4s linear infinite;
}
/* Glow effect behind card */
.project-card::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: conic-gradient(from var(--skill-angle), #8b5cf6, #d946ef, #f59e0b, #8b5cf6);
  opacity: 0;
  z-index: -2;
  filter: blur(20px);
  transition: opacity 0.4s ease;
}
.project-card:hover::after {
  opacity: 0.35;
  animation: skill-rotate 4s linear infinite;
}
.dark .project-card:hover::after {
  opacity: 0.45;
}
.project-card:hover {
  transform: translateY(-8px) rotateX(2deg) rotateY(-2deg);
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 20px 40px rgba(139,92,246,0.15),
    inset 0 1px 0 rgba(255,255,255,0.4);
}
.dark .project-card:hover {
  background: rgba(12,10,9,0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 20px 40px rgba(139,92,246,0.25),
    inset 0 1px 0 rgba(255,255,255,0.1);
}
.project-card.hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

/* Gradient line */
.gradient-line {
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 2px;
}

/* Section divider — gradient fade */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139,92,246,0.3), rgba(217,70,239,0.3), rgba(245,158,11,0.2), transparent);
}
.dark .section-divider {
  background: linear-gradient(90deg, transparent, rgba(139,92,246,0.4), rgba(217,70,239,0.35), rgba(245,158,11,0.25), transparent);
}

/* Timeline dot */
.timeline-dot {
  background: var(--gradient-primary);
  border-radius: 50%;
}

/* Timeline gradient line */
.timeline-line {
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #8b5cf6, #d946ef, #f59e0b, rgba(245,158,11,0.2));
}

/* Pill gradient */
.pill-gradient {
  background: var(--gradient-subtle);
}
.dark .pill-gradient {
  background: var(--gradient-subtle-dark);
}

/* Scroll reveal */
.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.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for children */
.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 80ms; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 240ms; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 320ms; }
.reveal-stagger > .reveal:nth-child(6) { transition-delay: 400ms; }

/* Hero mesh gradient */
.hero-mesh {
  position: absolute;
  inset: -40px;
  z-index: 0;
  pointer-events: none;
}
.hero-mesh::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, rgba(139,92,246,0.12) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-mesh::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 50%;
  height: 60%;
  background: radial-gradient(circle, rgba(217,70,239,0.09) 0%, transparent 70%);
  border-radius: 50%;
}
.dark .hero-mesh::before {
  background: radial-gradient(circle, rgba(139,92,246,0.18) 0%, transparent 70%);
}
.dark .hero-mesh::after {
  background: radial-gradient(circle, rgba(217,70,239,0.14) 0%, transparent 70%);
}

/* Hero photo treatment */
.hero-photo-wrapper {
  position: relative;
}
.hero-photo-wrapper::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 32% 68% 56% 44% / 40% 45% 55% 60%;
  background: var(--gradient-primary);
  opacity: 0.6;
  z-index: 0;
  animation: blob-morph 12s ease-in-out infinite;
}
.hero-photo-wrapper::after {
  content: '';
  position: absolute;
  inset: -20px;
  border-radius: 32% 68% 56% 44% / 40% 45% 55% 60%;
  background: var(--gradient-primary);
  opacity: 0.12;
  z-index: -1;
  filter: blur(20px);
  animation: blob-morph 12s ease-in-out infinite reverse;
}
.dark .hero-photo-wrapper::before {
  opacity: 0.8;
}
.dark .hero-photo-wrapper::after {
  opacity: 0.2;
}
.hero-photo {
  position: relative;
  z-index: 1;
  border-radius: 32% 68% 56% 44% / 40% 45% 55% 60%;
  object-fit: cover;
  animation: blob-morph 12s ease-in-out infinite;
}

@keyframes blob-morph {
  0%, 100% { border-radius: 32% 68% 56% 44% / 40% 45% 55% 60%; }
  25% { border-radius: 47% 53% 38% 62% / 55% 35% 65% 45%; }
  50% { border-radius: 55% 45% 65% 35% / 38% 62% 38% 62%; }
  75% { border-radius: 40% 60% 50% 50% / 60% 40% 60% 40%; }
}

/* Button gradient hover */
.btn-gradient {
  background: var(--gradient-primary);
  background-size: 200% 200%;
  animation: gradient-shift 16s ease infinite;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}
.btn-gradient:hover {
  box-shadow: 0 4px 20px rgba(139,92,246,0.3), 0 2px 10px rgba(217,70,239,0.2);
  transform: translateY(-1px);
}
.btn-gradient:active {
  transform: translateY(0);
}

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

/* Project card arrow */
.project-arrow {
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0.4;
}
.group:hover .project-arrow {
  transform: translate(3px, -3px);
  opacity: 1;
}

/* Contact CTA panel */
.contact-panel {
  position: relative;
}
.contact-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(139,92,246,0.04), rgba(217,70,239,0.03), rgba(245,158,11,0.02));
  border-radius: inherit;
}
.dark .contact-panel::before {
  background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(217,70,239,0.06), rgba(245,158,11,0.04));
}

/* Grain texture overlay */
.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  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");
  background-repeat: repeat;
  background-size: 256px 256px;
}
.dark .grain-overlay {
  opacity: 0.04;
}

/* Floating gradient orbs */
.floating-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  z-index: -1;
  animation: float-orb 25s ease-in-out infinite;
}
.floating-orb-1 {
  width: 400px;
  height: 400px;
  background: rgba(139,92,246,0.06);
  top: 20%;
  right: -10%;
  animation-delay: 0s;
}
.floating-orb-2 {
  width: 300px;
  height: 300px;
  background: rgba(217,70,239,0.05);
  bottom: 30%;
  left: -8%;
  animation-delay: -8s;
}
.floating-orb-3 {
  width: 250px;
  height: 250px;
  background: rgba(245,158,11,0.04);
  top: 60%;
  right: 5%;
  animation-delay: -16s;
}
.dark .floating-orb-1 { background: rgba(139,92,246,0.1); }
.dark .floating-orb-2 { background: rgba(217,70,239,0.08); }
.dark .floating-orb-3 { background: rgba(245,158,11,0.06); }

@keyframes float-orb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* Back to top button */
.back-to-top {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Mobile nav */
.mobile-nav {
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.mobile-nav.open {
  transform: translateX(0);
}
.mobile-nav-backdrop {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.mobile-nav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Nav link active indicator */
.nav-link {
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 1px;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}
.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
}

/* Date badge */
.date-badge {
  background: var(--gradient-subtle);
  border-radius: 6px;
  padding: 2px 8px;
}
.dark .date-badge {
  background: var(--gradient-subtle-dark);
}

/* ===== DETAIL PAGE STYLES ===== */

/* Tech category section */
.tech-category {
  padding: 1.5rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(214, 211, 209, 0.3);
  backdrop-filter: blur(12px);
  transition: all 0.3s ease;
}
.dark .tech-category {
  background: rgba(28, 25, 23, 0.4);
  border-color: rgba(68, 64, 60, 0.3);
}
.tech-category:hover {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 4px 24px rgba(139, 92, 246, 0.08);
}
.dark .tech-category:hover {
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 4px 24px rgba(139, 92, 246, 0.15);
}

/* Tech pills */
.tech-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 9999px;
  background: rgba(245, 245, 244, 0.8);
  color: #57534e;
  border: 1px solid rgba(214, 211, 209, 0.5);
  transition: all 0.2s ease;
}
.dark .tech-pill {
  background: rgba(41, 37, 36, 0.8);
  color: #a8a29e;
  border-color: rgba(68, 64, 60, 0.5);
}
.tech-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Primary tech pill - violet */
.tech-pill-primary {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
  border-color: rgba(139, 92, 246, 0.25);
}
.dark .tech-pill-primary {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.3);
}

/* Secondary tech pill - fuchsia */
.tech-pill-secondary {
  background: rgba(217, 70, 239, 0.1);
  color: #c026d3;
  border-color: rgba(217, 70, 239, 0.2);
}
.dark .tech-pill-secondary {
  background: rgba(217, 70, 239, 0.18);
  color: #e879f9;
  border-color: rgba(217, 70, 239, 0.28);
}

/* Accent tech pill - amber */
.tech-pill-accent {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.2);
}
.dark .tech-pill-accent {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.25);
}

/* Approach cards */
.approach-card {
  transition: all 0.3s ease;
}
.approach-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.1);
}
.dark .approach-card:hover {
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15);
}

/* Skill card as link */
a.skill-card {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
a.skill-card:hover .skill-title {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Link arrow indicator for clickable cards */
.skill-card-link-indicator {
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.3s ease;
}
.skill-card:hover .skill-card-link-indicator {
  opacity: 1;
  transform: translateX(0);
}
