@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

:root {
  --bg-color: #0a0a0a;
  --text-color: #cbd5e1; /* slate-300 */
  --text-dim: #94a3b8; /* slate-400 */
  --text-bright: #f1f5f9; /* slate-100 */
  --accent-color: #10b981; /* emerald-500 */
  --accent-hover: #059669; /* emerald-600 */
  --card-bg: #111111;
  --card-border: #1e293b; /* slate-800 */
  --nav-bg: rgba(10, 10, 10, 0.7);
  --selection-bg: rgba(16, 185, 129, 0.3);
  --footer-bg: #050505;
  --code-bg: #1e293b;
  --code-text: #fbbf24; /* amber-400 */
  --btt-tint: rgba(255, 255, 255, 0.03);
}

/* Sophisticated Light Mode */
.light-mode {
  --bg-color: #F8F9FA; /* Off-white paper */
  --text-color: #475569; /* slate-600 */
  --text-dim: #64748b; /* slate-500 */
  --text-bright: #1A1A1B; /* Charcoal */
  --accent-color: #059669; /* Emerald-600 */
  --accent-hover: #047857; /* Emerald-700 */
  --card-bg: #ffffff;
  --card-border: #E5E7EB; /* Subtle gray */
  --nav-bg: rgba(248, 249, 250, 0.8);
  --selection-bg: rgba(5, 150, 105, 0.1);
  --footer-bg: #F8F9FA;
  --code-bg: #F1F5F9;
  --code-text: #D97706; /* Amber/Burned Orange */
  --btt-tint: rgba(0, 0, 0, 0.05);
}

#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background-color: var(--accent-color);
  width: 0%;
  z-index: 100;
  transition: width 0.1s ease-out;
}

html {
  scroll-padding-top: 0.5rem;
}


.hero-parallax {
  background-image: linear-gradient(to bottom right, var(--bg-color), var(--footer-bg));
  width: 100%;
  height: 100vh;
  position: relative;
}

#particle-canvas {
  opacity: 0.4; /* Subtle background presence */
  pointer-events: none;
}

/* Page Fade-in */
body {
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}

body.loaded {
  opacity: 1;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Inter', sans-serif;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

/* Animations */
@keyframes blink {
  50% { opacity: 0; }
}

.cursor {
  display: inline-block;
  width: 10px;
  height: 1.5em;
  background-color: var(--accent-color);
  vertical-align: middle;
  margin-left: 5px;
  animation: blink 1s step-end infinite;
}

/* Project Card Glow */
.project-card {
  position: relative;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--card-border);
  z-index: 10;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 20%,
    var(--accent-color) 50%,
    transparent 80%
  );
  transform: translate(-50%, -50%) rotate(0deg);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -2;
}

.project-card::after {
  content: '';
  position: absolute;
  inset: 1px;
  background: var(--card-bg);
  border-radius: inherit;
  z-index: -1;
  transition: background-color 0.3s;
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px -20px rgba(16, 185, 129, 0.2);
  border-color: transparent;
}

.project-card:hover::before {
  opacity: 1;
  animation: border-rotate-continuous 3s linear infinite;
}

@keyframes border-rotate-continuous {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Mobile Menu Transition */
#mobile-menu {
  transition: transform 0.3s ease-in-out;
  transform: translateX(100%);
}

#mobile-menu.active {
  transform: translateX(0);
}

/* Glassmorphism */
.glass {
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
}

/* Hero Section Terminal Effect */
.terminal-text {
  font-family: 'Courier New', Courier, monospace;
}

.hero-avatar-wrapper {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-avatar-wrapper::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px dashed var(--accent-color);
  opacity: 0.4;
  animation: avatar-spin 12s linear infinite;
  pointer-events: none;
}

.hero-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid var(--accent-color);
  object-fit: cover;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  filter: grayscale(0.2);
}

.hero-avatar-wrapper:hover .hero-avatar {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.5);
  filter: grayscale(0);
}

@keyframes avatar-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.carousel-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.carousel-img.active {
  opacity: 1;
}

/* Tech-Card Blocks */
.tech-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1.5rem;
  aspect-ratio: 16/10;
  border-radius: 0.75rem;
  border: 1px solid var(--slate-800, #1e293b);
  background-color: rgba(15, 23, 42, 0.8); /* slate-900/80 */
  /* Reveal Transition (Smooth & Bouncy) */
  transition: opacity 0.6s ease-out, transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  opacity: 0;
  transform: translateY(20px);
}

.tech-card.active {
  opacity: 1;
  transform: translateY(0);
}

.tech-card:hover {
  /* Interactive Transition (Crisp & Near-Instant) */
  transition: transform 0.12s ease-out, border-color 0.12s ease-out, background-color 0.12s ease-out, box-shadow 0.12s ease-out;
  border-color: var(--accent-color);
  background-color: rgba(16, 185, 129, 0.1);
  box-shadow: 0 10px 30px -10px rgba(16, 185, 129, 0.4);
  transform: translateY(-4px) scale(1.02);
}

/* Rapid Staggered Animations */
.tech-card:nth-child(1) { transition-delay: 60ms; }
.tech-card:nth-child(2) { transition-delay: 120ms; }
.tech-card:nth-child(3) { transition-delay: 180ms; }
.tech-card:nth-child(4) { transition-delay: 240ms; }
.tech-card:nth-child(5) { transition-delay: 300ms; }
.tech-card:nth-child(6) { transition-delay: 360ms; }

/* Back to Top ('RETURN') */
#back-to-top {
  position: fixed;
  bottom: 6rem; /* Mobile offset to clear footer links */
  right: 2rem;
  background-color: var(--btt-tint);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--accent-color);
  padding: 0.8rem 1.2rem;
  border-radius: 4px;
  border: 1px solid var(--card-border);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 40;
  text-decoration: none;
  white-space: nowrap;
}

@media (min-width: 768px) {
  #back-to-top {
    bottom: 2rem; /* Desktop reset */
  }
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
}

#back-to-top:hover {
  background-color: var(--accent-color);
  color: white;
  transform: translateY(-5px) scale(1.1);
  border-color: var(--accent-color);
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2);
}

/* Light Mode Overrides for Tailwind Classes */
.light-mode .text-slate-100,
.light-mode .text-slate-200 { color: var(--text-bright); }
.light-mode .text-slate-300,
.light-mode .text-slate-400 { color: var(--text-color); }
.light-mode .text-slate-500,
.light-mode .text-slate-600 { color: var(--text-dim); }

.light-mode .bg-slate-900,
.light-mode .bg-\[\#111\] { background-color: var(--card-bg); }

.light-mode .border-slate-800,
.light-mode .border-white\/5 { border-color: var(--card-border); }

/* Logo Inversion in Light Mode */
.light-mode nav img {
  filter: invert(0.8) brightness(0.2); /* Adjust to make it dark against light bg */
}

/* Hero Tagline fix for Light Mode */
.light-mode .text-slate-400 { color: var(--text-dim); }

/* Global Monospace Base */
.font-mono {
  background-color: transparent;
  color: inherit;
  padding: 0;
}

/* Specific Technical Labels / Code Blocks */
.tech-log, 
code {
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

#progress-bar {
  background-color: var(--accent-color);
}

/* Animated Nav Underline */
.nav-link-animated {
  position: relative;
  display: inline-block;
}

.nav-link-animated::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 0;
  background-color: var(--accent-color);
  transition: width 0.3s cubic-bezier(0.65, 0.05, 0.36, 1);
}

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

/* Contact Form Enhancements */
input:focus, 
textarea:focus {
  border: 1px solid var(--accent-color) !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
  outline: none;
}

.btn-loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

/* High-Glow Toaster Notification Overhaul */
#toaster {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 9999;
  transition: opacity 0.5s ease;
  pointer-events: none;
  opacity: 0;
  display: block; /* Ensure it's not hidden by default structure */
}

#toaster.show {
  opacity: 1;
  pointer-events: auto;
  animation: SlideInFromRight 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#toaster.hide {
  animation: FadeOut 0.5s ease forwards;
}

#toaster .bg-slate-900\/90 {
  background-color: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4), 
              inset 0 0 10px rgba(16, 185, 129, 0.2);
  overflow: hidden; /* Contain the progress bar */
}

/* Progress Bar Styling */
#toaster-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background-color: #10b981;
  width: 100%;
  transform-origin: left;
  transform: scaleX(0);
}

#toaster.show #toaster-progress {
  animation: ShrinkProgress 5s linear forwards;
}

@keyframes ShrinkProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* Close Button Styling */
#close-toaster {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

#close-toaster:hover {
  color: #10b981;
  background-color: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  transform: scale(1.1);
}

@keyframes SlideInFromRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes FadeOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(10px); }
}

/* Custom Spinner Animation (Backup/Alternative to Tailwind) */
.spinner-ring {
  border: 2px solid rgba(16, 185, 129, 0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  width: 1.25rem;
  height: 1.25rem;
  animation: spinner-rotate 0.8s linear infinite;
}

@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

/* Copy feedback is now in-line, badge styles removed */

/* Terminal CTA Buttons */
.cta-container {
  margin-top: 2.5rem;
}

.terminal-btn {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.9rem;
  padding: 0.75rem 1.75rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn-terminal-primary {
  background-color: var(--accent-color);
  color: #0f172a;
  font-weight: 700;
  border: 2px solid var(--accent-color);
}

.btn-terminal-primary:hover {
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.6), 0 0 50px rgba(16, 185, 129, 0.2);
  transform: translateY(-2px);
}

.btn-terminal-primary:hover .terminal-cursor {
  display: none;
}

.btn-terminal-secondary {
  border: 2px solid var(--accent-color);
  color: var(--accent-color);
  background-color: transparent;
}

.btn-terminal-secondary:hover {
  background-color: rgba(16, 185, 129, 0.15);
  /* box-shadow: 0 0 15px rgba(16, 185, 129, 0.3); */
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .cta-container {
    flex-direction: column;
    gap: 1rem; /* Exact gap-y-4 */
    width: 100%;
  }

  .terminal-btn {
    width: 100%;
    justify-content: center;
    font-size: 0.85rem;
    padding: 0.8rem 1rem;
  }
}

.terminal-cursor {
  font-weight: bold;
  animation: terminal-blink 1s step-end infinite;
}

@keyframes terminal-blink {
  from, to { opacity: 1; }
  50% { opacity: 0; }
}

/* Footer UX Refinement */
.footer-contact-info {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.email-link {
  display: inline-block;
  min-width: 120px; /* Prevent layout shift */
  text-align: center;
  transition: all 0.3s ease;
}

.email-link.copied {
  color: var(--accent-color) !important;
  text-shadow: 0 0 15px rgba(16, 185, 129, 0.6);
  font-weight: bold;
  transform: scale(1.05);
}
