/* ==========================================================================
   1. VARIABLES & THEMATIC CORES (Light Mode Optimized)
   ========================================================================== */
:root {
  /* Premium Slate-Infused Technical Light Palette */
  --bg-primary: #f1f5f9; /* Slate 100 base canvas - ensures white cards pop dynamically */
  --bg-secondary: #ffffff; /* Crystalline white for core section blocks */
  --bg-tertiary: #e2e8f0; /* Slate 200 for alternating layout sections (About/Projects) */

  --text-primary: #0f172a; /* Slate 900 - ultra-deep charcoal for rich, readable typography */
  --text-secondary: #475569; /* Slate 600 - comfortable, high-contrast reading for body prose */

  --accent-primary: #7c3aed; /* Punchy Violet 600 - vibrant visibility on tech elements */
  --accent-hover: #6d28d9; /* Deep Violet 700 for interactive active feedback loops */

  --header-bg: rgba(
    241,
    245,
    249,
    0.85
  ); /* Glassmorphic matching layer for the base canvas */
  --hero-bg-from: #4f46e5; /* Electric Indigo */
  --hero-bg-to: #7c3aed; /* Vivid Violet */

  --card-bg: #ffffff; /* Crystalline floating card base */
  --skill-card-bg: rgba(
    237,
    233,
    254,
    0.65
  ); /* Rich soft-tinted translucent lavender depth */
  --form-bg: #ffffff; /* Solid white backing to lift inputs clean off the page */
  --border-accent: #cbd5e1; /* Slate 300 line metrics for crisp structural containment */

  /* Upgraded structural shadowing profile to defeat flatness */
  --shadow-color: rgba(15, 23, 42, 0.07);

  --footer-bg: #1f2937;
  --footer-text: #ffffff;

  --carousel-btn-bg: rgba(255, 255, 255, 0.85);
  --carousel-btn-hover: #ffffff;
}

/* Cyber Dark Mode Overrides */
.dark {
  --bg-primary: #1f2937;
  --bg-secondary: #111827;
  --bg-tertiary: #374151;
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --accent-primary: #a78bfa;
  --accent-hover: #c4b5fd;
  --header-bg: rgba(15, 23, 42, 0.85);
  --hero-bg-from: #312e81;
  --hero-bg-to: #5b21b6;
  --card-bg: #1f2937;
  --skill-card-bg: #2e1065;
  --shadow-color: rgba(0, 0, 0, 0.35);
  --footer-bg: #111827;
  --footer-text: #d1d5db;
  --form-bg: #374151;
  --border-accent: #a78bfa;
  --carousel-btn-bg: rgba(17, 24, 39, 0.3);
  --carousel-btn-hover: rgba(17, 24, 39, 0.5);
}

/* ==========================================================================
   2. GLOBAL BASE RESET & SMOOTH SCROLLING
   ========================================================================== */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem; /* Prevents fixed header from masking content titles */
}

body {
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
  overflow-x: hidden;
}

/* Structural Semantic Overrides */
#about,
#projects {
  background-color: var(--bg-tertiary);
}
#skills,
#contact {
  background-color: var(--bg-secondary);
}

/* Section Dynamic Headings */
.section-title {
  position: relative;
  display: inline-block;
  padding-bottom: 8px;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background-color: var(--accent-primary);
  border-radius: 2px;
}

/* Tailwind Custom Escape Target Selectors */
.hover\:text-accent:hover {
  color: var(--accent-hover) !important;
}
.hover\:bg-accent:hover {
  background-color: var(--accent-hover) !important;
}

/* ==========================================================================
   3. FIXED GLASSMORPHIC HEADER & NAVIGATION LINKS
   ========================================================================== */
header {
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  background-color: var(--header-bg);
  box-shadow: 0 4px 20px -5px var(--shadow-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition:
    background-color 0.3s ease,
    box-shadow 0.3s ease;
}

header a span {
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.dark header a span {
  color: #ffffff;
}

.nav-link {
  position: relative;
  color: var(--text-primary);
  font-weight: 500;
  transition: all 0.3s ease;
  padding: 6px 0;
}

.dark .nav-link {
  color: #ffffff;
}

.nav-link:hover {
  color: var(--accent-primary);
  text-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--accent-primary);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* Destruction Action Class for Logout Handles */
.logout-link {
  background: none;
  border: none;
  cursor: pointer;
  font-size: inherit;
  font-weight: 500;
  color: var(--text-primary);
  position: relative;
  transition: all 0.3s ease;
  padding: 6px 0;
}

.dark .logout-link {
  color: #ffffff;
}

.logout-link:hover {
  color: #ef4444;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.logout-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: #ef4444;
  transition: width 0.3s ease;
}

.logout-link:hover::after {
  width: 100%;
}

/* Theme Swapper Controller Vector Elements */
#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  color: var(--text-primary);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#theme-toggle:hover {
  transform: rotate(30deg);
}

/* ==========================================================================
   4. HERO BRANDING & KEYFRAME ENGINE
   ========================================================================== */
#hero {
  background: linear-gradient(135deg, var(--hero-bg-from), var(--hero-bg-to));
}

.hero-content {
  animation: fadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Realtime Typing Automation Terminal Cursor Indicator */
.typing-hero::after {
  content: "|";
  margin-left: 6px;
  color: #fde047;
  animation: blink 1s steps(2, start) infinite;
}

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

/* ==========================================================================
   5. SHOWCASE SKILL CARDS & PROGRESSIVE FORM SCHEMES
   ========================================================================== */
.skill-card {
  background-color: var(--skill-card-bg);
  box-shadow: 0 8px 25px var(--shadow-color);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 8px;
}

.skill-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.skill-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.12);
}

.dark .skill-card:hover {
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.45);
}

#contact-form {
  background-color: var(--form-bg);
  border: 1px solid var(--border-accent);
}

/* ==========================================================================
   6. PREMIUM MULTI-DIMENSIONAL PROJECT CARDS BLOCK
   ========================================================================== */
.project-card {
  background-color: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 25px var(--shadow-color);
  display: flex;
  flex-direction: column;
  position: relative;
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  perspective: 1000px;
}

.project-card > .p-6 {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Push Action Links Row Flush dynamically to Bottom Baseline */
.project-card > .p-6 > .flex {
  margin-top: auto;
}

.project-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

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

.project-card h3 a,
.project-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.project-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Immersive Reactive Cursor Track Glow */
.project-card::before {
  content: "";
  position: absolute;
  top: var(--y, 0px);
  left: var(--x, 0px);
  transform: translate(-50%, -50%);
  width: 0px;
  height: 0px;
  background: radial-gradient(
    circle,
    rgba(139, 92, 246, 0.2) 0%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.project-card:hover::before {
  width: 300px;
  height: 300px;
  opacity: 1;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(139, 92, 246, 0.15);
}

.dark .project-card:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   7. MODAL WINDOW MODIFIERS (Dynamic Quick-View)
   ========================================================================== */
.modal-content {
  background-color: #ffffff;
  color: #111827;
  position: relative;
  animation: modalSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dark .modal-content {
  background-color: #1f2937;
  color: #e5e7eb;
}

#modalDesc {
  color: var(--text-secondary);
}

#modalTitle:hover {
  text-decoration: underline;
  opacity: 0.9;
}

.modal-live-btn {
  background-color: var(--accent-primary);
  color: #ffffff !important;
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
  transition: all 0.2s ease;
}

.modal-live-btn:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
}

#modalGithub {
  color: var(--text-primary);
  border: 1px solid var(--border-accent);
  transition: all 0.2s ease;
}

#modalGithub:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.modal-close-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: auto;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
  color: #111827;
}

.dark .modal-close-btn {
  color: #e5e7eb;
}
.modal-close-btn:hover {
  background-color: rgba(139, 92, 246, 0.15);
  color: var(--accent-primary);
}

@keyframes modalSlideUp {
  from {
    transform: translateY(30px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* ==========================================================================
   8. COMPACT COMPONENT INTERFACES & FORM TRACKS
   ========================================================================== */
.carousel-btn {
  background-color: var(--carousel-btn-bg);
  border: 1px solid var(--border-accent);
  transition: background-color 0.2s ease;
}
.carousel-btn:hover {
  background-color: var(--carousel-btn-hover);
}

footer {
  background-color: var(--footer-bg);
  color: var(--footer-text);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   GLOBAL OVERRIDES (Place this OUTSIDE and right BEFORE the @media block)
   ========================================================================== */
.mobile-menu {
  display: none; /* Hidden globally by default on all screens instantly */
}

/* ==========================================================================
   9. DEVICE SPECIFIC STRUCTURAL INHERITANCE (Media Query Cascade)
   ========================================================================== */

/* Tablet & Universal Mobile Interface Layer (<= 768px) */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }
  section {
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }
  header {
    padding: 0.75rem 1.25rem !important;
  }

  .nav-links {
    display: none !important;
  }
  #mobile-menu-button {
    display: block !important;
  }

  .section-title {
    font-size: 1.85rem !important;
  }
  #hero h1 {
    font-size: 2.3rem !important;
    line-height: 1.25;
  }

  /* System Mobile Menu Glassmorphism Overlays */
  .mobile-menu {
    position: fixed;
    inset: 0;
    height: 100vh;
    width: 100%;
    /* display: none; -> Controlled cleanly by the global class now */
    flex-direction: column;
    align-items: center;
    z-index: 9999;
    background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.95),
      rgba(243, 244, 246, 0.98)
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow-y: auto;
    padding: 6rem 1.5rem 2rem;
  }

  .dark .mobile-menu {
    background: linear-gradient(
      180deg,
      rgba(17, 24, 39, 0.96),
      rgba(15, 23, 42, 0.99)
    );
  }

  /* ... Leave the rest of your mobile sub-styles exactly the same ... */

  /* ==========================================================================
   FIX: BASE HIDDEN STATE FOR MOBILE MENU (Prevents page-load flash)
   ========================================================================== */
  .mobile-menu {
    display: none; /* Default hidden everywhere until activated by your JavaScript */
  }

  .dark .mobile-menu {
    background: linear-gradient(
      180deg,
      rgba(17, 24, 39, 0.96),
      rgba(15, 23, 42, 0.99)
    );
  }

  .mobile-nav {
    list-style: none;
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .mobile-nav li a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px;
    color: #111827 !important;
    font-size: 1.15rem;
    font-weight: 600;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.25s ease;
  }

  .dark .mobile-nav li a {
    color: #ffffff !important;
    background: rgba(31, 41, 55, 0.8);
    border-color: rgba(255, 255, 255, 0.06);
  }

  .mobile-nav li a:hover {
    color: var(--accent-primary) !important;
    transform: translateX(5px);
    background: var(--bg-secondary);
  }

  /* Structural Synchronization for Mobile Logout Triggers */
  .mobile-nav #mobileLogoutBtn,
  .mobile-logout-btn {
    color: #ffffff !important;
    background: #ef4444 !important;
    border: none;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
  }
  .mobile-nav #mobileLogoutBtn:hover,
  .mobile-logout-btn:hover {
    background: #dc2626 !important;
  }

  /* Universal Mobile Structural Close Handles */
  #close-mobile-menu {
    position: fixed !important;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #ffffff !important;
    color: #111827 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100000 !important;
    cursor: pointer;
    transition: transform 0.2s ease;
  }

  .dark #close-mobile-menu {
    background: #1f2937 !important;
    color: #ffffff !important;
  }
  #close-mobile-menu:hover {
    transform: rotate(90deg);
    color: var(--accent-primary) !important;
  }

  /* Grid Layout Normalizations */
  #skills .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  /* Transform Project Blocks into Clean Minimal Cards Matching Skill Card Weights */
  #projects .grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
  }
  .project-card img {
    display: none !important;
  } /* Strips image blocks to ensure unified structural weight */
  .project-card {
    padding: 1.25rem;
    border-radius: 12px;
    transform: none !important;
  }
  .project-card .p-6 {
    padding: 0 !important;
  }
  .project-card h3 {
    font-size: 1rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
  }
  .project-card p {
    font-size: 0.8rem;
    line-height: 1.45;
    margin-bottom: 0.75rem;
  }
  .project-card a {
    font-size: 0.8rem;
  }
  .project-card::before {
    display: none !important;
  } /* Suppresses 3D calculations to prevent core processing lag */

  /* Contact Adjustments */
  #contact-form {
    padding: 1.5rem;
  }
  #contact-form button {
    width: 100%;
  }

  /* Quick View Mobile Safety Boundaries */
  .modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    background: #ffffff !important;
    color: #111827 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  }
  .dark .modal-close-btn {
    background: #374151 !important;
    color: #ffffff !important;
  }
}

/* ==========================================================================
   THEME TOGGLE BUTTON MODIFIERS
   ========================================================================== */
.theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 9999px;
  color: var(--text-primary); /* Adapts fluidly to the layout core */
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.2s ease;
}

/* Force specific structural rendering rules on the raw SVG path */
.theme-toggle-btn svg {
  width: 22px !important;
  height: 22px !important;
  display: block;
}

/* Color adjustments to keep consistency with layout changes */
header .theme-toggle-btn {
  color: var(--text-primary);
}

.dark header .theme-toggle-btn {
  color: #ffffff;
}

/* Hover Accent Feedback Effects */
.theme-toggle-btn:hover {
  transform: rotate(40deg);
  color: var(--accent-primary);
  background-color: rgba(139, 92, 246, 0.1);
}

.dark .theme-toggle-btn:hover {
  color: var(--accent-primary);
  background-color: rgba(167, 139, 250, 0.1);
}

/* ==========================================================================
   ADVANCED 3D CHROMATIC HERO TYPING TEXT
   ========================================================================== */
.typing-hero {
  color: #ffffff; /* Crisp white face text to stand out against your dark hero background */
  font-weight: 900;
  letter-spacing: -0.02em;

  /* 3D Extrusion effect using layered offsets with your purple theme values */
  text-shadow:
    1px 1px 0px var(--accent-primary),
    2px 2px 0px var(--accent-hover),
    3px 3px 0px #5b21b6,
    /* Deep indigo shadow layer */ 4px 4px 0px #4c1d95,
    /* Deeper violet shadow layer */ 5px 5px 0px #2e1065,
    /* Base dark shadow layer */ 6px 6px 15px rgba(0, 0, 0, 0.7); /* Ambient depth blur */

  display: inline-block;
  transform: skewX(
    -4deg
  ); /* Subtle modern angular tilt for extra tech aesthetic */
}

/* Customize your typing cursor to match the glowing neon theme */
.typing-hero::after {
  content: "|";
  margin-left: 8px;
  color: #a78bfa !important; /* Bright lavender glow cursor */
  text-shadow: 0 0 10px var(--accent-primary);
  animation: blink 1s steps(2, start) infinite;
}

/* ==========================================================================
   UPDATED MOBILE NAVIGATION SELECTORS (Links & Theme Button Synchronization)
   ========================================================================== */
.mobile-nav li a,
#mobile-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  color: #111827 !important; /* Strong text for Light Mode visibility */
  font-size: 1.15rem;
  font-weight: 600;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: all 0.25s ease;
  cursor: pointer;
}

/* Dark Mode Overrides for unified layout elements */
.dark .mobile-nav li a,
.dark #mobile-theme-toggle {
  color: #ffffff !important;
  background: rgba(31, 41, 55, 0.8);
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Hover/Active Micro-interactions */
.mobile-nav li a:hover,
#mobile-theme-toggle:hover {
  color: var(--accent-primary) !important;
  transform: translateX(5px);
  background: var(--bg-secondary);
}

/* Explicit vector rules inside the mobile list layout container */
#mobile-theme-toggle svg {
  width: 20px !important;
  height: 20px !important;
  fill: currentColor;
  flex-shrink: 0;
  display: block;
}

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

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Smartphone Portrait Refinements (<= 480px) */
@media screen and (max-width: 480px) {
  #hero h1 {
    font-size: 1.95rem !important;
  }
  .section-title {
    font-size: 1.65rem !important;
  }
  #skills .grid,
  #projects .grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem;
  }
  .skill-card,
  .project-card {
    padding: 1rem;
  }
}

.project-hidden {
  display: none;
}
