/* ==========================================================================
   M. ABDUL RAHMAN — PORTFOLIO DESIGN SYSTEM
   Bespoke, Studio-Grade Dark Aesthetic (Clean, Non-AI-Slop Styling)
   v2.0 — Enhanced Color Depth & Subtle Background Animations
   ========================================================================== */

:root {
  /* Color Palette: Deep Space, Midnight Sapphire, Electric Accents */
  --bg-base: #080a12;
  --bg-surface: #0c1018;
  --bg-surface-elevated: #121826;
  --bg-card: rgba(14, 19, 32, 0.72);
  --bg-card-hover: rgba(20, 28, 48, 0.85);
  
  /* Primary & Accent Tones — Richer, Deeper */
  --accent-primary: #4f8df7;
  --accent-primary-hover: #3a7ae8;
  --accent-indigo: #7c7ff5;
  --accent-violet: #a78bfa;
  --accent-emerald: #10b981;
  --accent-emerald-subtle: rgba(16, 185, 129, 0.12);
  --accent-cyan: #22d3ee;
  
  /* Hairline Borders — Warmer tints */
  --border-subtle: rgba(148, 163, 200, 0.08);
  --border-medium: rgba(148, 163, 200, 0.14);
  --border-focus: rgba(79, 141, 247, 0.5);
  
  /* Text Tones */
  --text-main: #f0f4fc;
  --text-secondary: #8b9bc0;
  --text-muted: #5a6b8a;
  
  /* Elevation Shadows — Blue-tinted */
  --shadow-sm: 0 2px 8px rgba(4, 8, 20, 0.5);
  --shadow-md: 0 10px 25px -5px rgba(4, 8, 20, 0.6), 0 8px 10px -6px rgba(4, 8, 20, 0.5);
  --shadow-lg: 0 20px 40px -10px rgba(4, 8, 20, 0.75);
  --shadow-card-hover: 0 18px 36px -10px rgba(4, 8, 20, 0.8), 0 0 1px 1px rgba(79, 141, 247, 0.2);
  
  /* Transitions */
  --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  background-color: var(--bg-base);
  color-scheme: dark;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle film-grain texture overlay for depth */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  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='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  mix-blend-mode: overlay;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: #1a2240;
  border-radius: 9999px;
  border: 2px solid var(--bg-base);
}

::-webkit-scrollbar-thumb:hover {
  background: #2a3660;
}

/* Selection */
::selection {
  background: rgba(79, 141, 247, 0.25);
  color: #ffffff;
}

/* ==========================================================================
   AMBIENT BACKGROUND — FLOATING ORBS & CANVAS
   ========================================================================== */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Primary ambient orb — top center, cool blue-violet */
.ambient-spotlight {
  position: fixed;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 1000px;
  height: 600px;
  background: radial-gradient(
    ellipse at center,
    rgba(79, 141, 247, 0.07) 0%,
    rgba(124, 127, 245, 0.04) 30%,
    rgba(167, 139, 250, 0.02) 55%,
    transparent 75%
  );
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: orb-drift-top 20s ease-in-out infinite alternate;
}

/* Secondary ambient orb — bottom right, subtle teal */
.ambient-spotlight-bottom {
  position: fixed;
  bottom: -60px;
  right: 5%;
  width: 700px;
  height: 500px;
  background: radial-gradient(
    ellipse at center,
    rgba(34, 211, 238, 0.04) 0%,
    rgba(16, 185, 129, 0.02) 40%,
    transparent 70%
  );
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  animation: orb-drift-bottom 25s ease-in-out infinite alternate;
}

/* Gentle drift keyframes for ambient orbs */
@keyframes orb-drift-top {
  0% {
    transform: translateX(-50%) translateY(0);
  }
  100% {
    transform: translateX(-46%) translateY(30px);
  }
}

@keyframes orb-drift-bottom {
  0% {
    transform: translateX(0) translateY(0);
  }
  100% {
    transform: translateX(-20px) translateY(-25px);
  }
}

/* ==========================================================================
   FLOATING NAVBAR
   ========================================================================== */
.floating-navbar {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: max-content;
  max-width: calc(100vw - 2rem);
  background: rgba(10, 14, 24, 0.78);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid rgba(148, 163, 200, 0.1);
  border-radius: 9999px;
  padding: 0.4rem 0.65rem;
  box-shadow:
    0 12px 30px -10px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(79, 141, 247, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-navbar.scrolled {
  top: 0.75rem;
  background: rgba(8, 12, 20, 0.94);
  border-color: rgba(148, 163, 200, 0.14);
  box-shadow:
    0 16px 36px -8px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(79, 141, 247, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-link {
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.45rem 1rem;
  border-radius: 9999px;
  transition: var(--transition-smooth);
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover {
  color: #ffffff;
  background: rgba(79, 141, 247, 0.06);
}

.nav-link.active {
  color: #ffffff;
  background: rgba(79, 141, 247, 0.1);
  border: 1px solid rgba(79, 141, 247, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Mobile Nav Drawer */
.mobile-nav-panel {
  position: fixed;
  top: 4.75rem;
  left: 1rem;
  right: 1rem;
  z-index: 99;
  background: rgba(10, 14, 24, 0.96);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--border-medium);
  border-radius: 1.25rem;
  padding: 1.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  transform: translateY(-16px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav-panel.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   CARDS & SURFACES — REFINED GLASS WITH DEPTH
   ========================================================================== */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
  position: relative;
}

/* Top highlight edge — subtle light leak effect */
.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(148, 163, 200, 0.12),
    rgba(79, 141, 247, 0.08),
    rgba(148, 163, 200, 0.12),
    transparent
  );
  pointer-events: none;
  border-radius: 1px;
}

.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(79, 141, 247, 0.12);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
}

/* Special Profile Avatar — animated gradient ring */
.avatar-frame {
  position: relative;
  border-radius: 9999px;
  padding: 4px;
  background: linear-gradient(
    145deg,
    rgba(79, 141, 247, 0.35),
    rgba(124, 127, 245, 0.3),
    rgba(167, 139, 250, 0.2),
    rgba(79, 141, 247, 0.15)
  );
  background-size: 200% 200%;
  animation: avatar-glow 6s ease-in-out infinite;
  box-shadow:
    0 10px 30px -5px rgba(79, 141, 247, 0.15),
    0 0 0 1px rgba(79, 141, 247, 0.08);
}

@keyframes avatar-glow {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* ==========================================================================
   BUTTONS & ACTIONS
   ========================================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: #ffffff;
  color: #080a12;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.75rem 1.6rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 10px rgba(255, 255, 255, 0.1), 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: var(--transition-smooth);
  text-decoration: none;
  cursor: pointer;
}

.btn-primary:hover {
  background: #f1f5f9;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.16), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: rgba(18, 24, 38, 0.75);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
  text-decoration: none;
  cursor: pointer;
}

.btn-secondary:hover {
  background: rgba(26, 36, 58, 0.9);
  border-color: rgba(148, 163, 200, 0.25);
  color: #ffffff;
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-emerald {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: rgba(16, 185, 129, 0.08);
  color: #34d399;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(16, 185, 129, 0.22);
  box-shadow: 0 4px 15px -3px rgba(16, 185, 129, 0.1);
  transition: var(--transition-smooth);
  text-decoration: none;
  cursor: pointer;
}

.btn-emerald:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px -3px rgba(16, 185, 129, 0.15);
}

/* ==========================================================================
   STAT CARDS
   ========================================================================== */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  padding: 1.5rem 1rem;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

/* Subtle corner accent glow on stat cards */
.stat-card::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 141, 247, 0.08) 0%, transparent 70%);
  pointer-events: none;
  transition: opacity 0.4s ease;
  opacity: 0;
}

.stat-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(79, 141, 247, 0.12);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card:hover::after {
  opacity: 1;
}

/* ==========================================================================
   TIMELINE
   ========================================================================== */
.timeline-item {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 2rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-line {
  position: absolute;
  top: 14px;
  left: 7px;
  bottom: -32px;
  width: 2px;
  background: linear-gradient(180deg, rgba(79, 141, 247, 0.4) 0%, rgba(124, 127, 245, 0.15) 60%, rgba(148, 163, 200, 0.06) 100%);
}

.timeline-dot {
  position: absolute;
  top: 8px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  background: var(--accent-primary);
  border: 2px solid var(--bg-base);
  box-shadow: 0 0 0 3px rgba(79, 141, 247, 0.2), 0 0 8px rgba(79, 141, 247, 0.1);
}

/* ==========================================================================
   PROJECT FILTER BUTTONS
   ========================================================================== */
.filter-btn {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 1.2rem;
  border-radius: 9999px;
  background: rgba(14, 19, 32, 0.8);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  transition: var(--transition-smooth);
  cursor: pointer;
}

.filter-btn:hover {
  color: #ffffff;
  border-color: rgba(79, 141, 247, 0.2);
  background: rgba(20, 28, 48, 0.8);
}

.filter-btn.active {
  color: #ffffff;
  background: rgba(79, 141, 247, 0.1);
  border-color: rgba(79, 141, 247, 0.25);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 12px -4px rgba(79, 141, 247, 0.2);
}

/* Project Card */
.project-card {
  transition: var(--transition-smooth);
}

.project-card-image-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: #080a12;
  border-bottom: 1px solid var(--border-subtle);
}

.project-card:hover .project-card-image-wrap img {
  transform: scale(1.04);
}

/* ==========================================================================
   MODAL DIALOG
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(4, 6, 12, 0.85);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 48rem;
  max-height: 90vh;
  overflow-y: auto;
  background: #0a0e18;
  border: 1px solid var(--border-medium);
  border-radius: 1.5rem;
  box-shadow:
    0 25px 60px -15px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(79, 141, 247, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: scale(0.96) translateY(12px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-content {
  transform: scale(1) translateY(0);
}

/* Modal Gallery Thumbnails */
.modal-thumb-btn {
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 2px solid transparent;
  aspect-ratio: 16 / 10;
  transition: var(--transition-smooth);
  cursor: pointer;
  background: #080a12;
}

.modal-thumb-btn.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(79, 141, 247, 0.3);
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
#toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  z-index: 300;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   ANIMATIONS & REVEALS
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }

/* Typewriter blinking cursor */
.typewriter-cursor {
  display: inline-block;
  margin-left: 2px;
  color: var(--accent-primary);
  font-weight: 300;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Hero Headline — richer gradient with blue-to-slate shift */
.hero-headline {
  background: linear-gradient(
    175deg,
    #ffffff 0%,
    #d4dff7 40%,
    #8b9bc0 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.03em;
}

/* Form Inputs */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: rgba(12, 16, 24, 0.8);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  font-size: 0.875rem;
  transition: var(--transition-smooth);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus {
  outline: none;
  border-color: rgba(79, 141, 247, 0.45);
  background: rgba(16, 22, 36, 0.95);
  box-shadow: 0 0 0 3px rgba(79, 141, 247, 0.12), 0 0 20px -4px rgba(79, 141, 247, 0.08);
}

/* ==========================================================================
   SECTION DIVIDER GRADIENT LINE — replaces flat border-t
   ========================================================================== */
section[id]::before {
  content: '';
  display: block;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(79, 141, 247, 0.12) 20%,
    rgba(124, 127, 245, 0.08) 50%,
    rgba(79, 141, 247, 0.12) 80%,
    transparent 100%
  );
  margin-bottom: 0;
}
