/* --- DESIGN SYSTEM --- */
:root {
  --primary: #3b82f6;
  --primary-dark: #1e40af;
  --accent: #06b6d4;
  --bg-dark: #030712;
  --surface: rgba(17, 24, 39, 0.7);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --glass-border: rgba(255, 255, 255, 0.1);
  --font-main: 'Inter', sans-serif;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: #1f2937; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #374151; }

/* --- REUSABLE UTILITIES --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.text-gradient {
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.glass {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 2rem;
  border-radius: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* --- NAVBAR --- */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  padding: 1.5rem 0;
  transition: all 0.3s ease;
}

.navbar.scrolled {
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(12px);
  padding: 1rem 0;
  border-bottom: 1px solid var(--glass-border);
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 900;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.3s;
  position: relative;
}

.nav-links a:hover { color: white; }

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s;
}

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

/* --- HERO --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding-top: 80px;
  background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.05), transparent),
              radial-gradient(circle at bottom left, rgba(167, 139, 250, 0.05), transparent);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 3rem;
  align-items: center;
  justify-content: center;
}

.hero-content h1 {
  font-size: 4.5rem;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 2rem;
}

.typing-container {
  height: 3rem;
  margin-bottom: 2rem;
}

.typing-text {
  font-size: 2rem;
  color: var(--text-muted);
  font-weight: 700;
}

.hero-p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 500px;
  margin-bottom: 2.5rem;
}

.hero-image-wrapper {
  position: relative;
}

.profile-card {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3rem;
  overflow: hidden;
  position: relative;
  z-index: 10;
  border: 2px solid var(--glass-border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.profile-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.5s ease;
}

.profile-card:hover img { transform: scale(1.1); }

/* --- SECTIONS --- */
section { padding: 100px 0; }

.section-title {
  text-align: center;
  margin-bottom: 4rem;
}

.section-title h2 {
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: 1rem;
}

.underline {
  width: 80px;
  height: 6px;
  background: var(--primary);
  margin: 0 auto;
  border-radius: 3px;
}

/* --- ABOUT --- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
}

.story-card {
  background: rgba(255, 255, 255, 0.03);
  padding: 3rem;
  border-radius: 2.5rem;
  border: 1px solid var(--glass-border);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.stat-item {
  text-align: center;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 1.5rem;
}

.stat-val { font-size: 1.5rem; font-weight: 900; color: white; }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }

/* --- SKILLS --- */
.skill-nav-container {
  display: flex;
  justify-content: center;
  gap: 1.1rem;
  margin-bottom: 3.5rem;
  flex-wrap: wrap;
}

.skill-nav-item {
  padding: 0.8rem 1.8rem;
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.85rem;
}

.skill-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
  color: white;
}

.skill-nav-item.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
  border-color: var(--primary);
}

.skills-filter-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
}

.skill-card-v2 {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: 1.5rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  width: 150px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.skill-card-v2:hover {
  transform: translateY(-10px) scale(1.05);
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.skill-icon-box {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.skill-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s;
}

.skill-name {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

/* --- PROJECTS --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2.5rem;
}

.project-card {
  border-radius: 2.5rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.project-card:hover { transform: translateY(-10px); border-color: var(--primary); }

.project-img {
  width: 100%;
  aspect-ratio: 16/10;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 1), rgba(3, 7, 18, 1));
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.project-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.project-card,
.cert-card,
.skill-card-v2 {
  transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
}

.mobile-hidden {
  opacity: 0;
  transform: translateY(-10px);
  max-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

.project-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex: 1;
  align-content: flex-start;
}

.tech-tag {
  font-size: 0.7rem;
  padding: 0.3rem 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.5rem;
  color: var(--text-muted);
}

/* --- CERTIFICATIONS --- */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.cert-card {
  border-radius: 2rem;
  overflow: hidden;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
}

.cert-img-container {
  height: 200px;
  position: relative;
  overflow: hidden;
}

.cert-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.cert-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(4px);
  color: white;
}

.cert-card:hover .cert-overlay {
  opacity: 1;
}

.cert-overlay i {
  font-size: 2.5rem;
  transform: scale(0.8);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cert-card:hover .cert-overlay i {
  transform: scale(1);
}

.cert-info { padding: 1.5rem; }
.cert-info h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: white; }
.cert-info p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }
.cert-issuer {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* --- SOCIAL TOOLTIPS --- */
.social-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
}

.social-link {
  color: var(--text-muted);
  font-size: 1.6rem;
  transition: all 0.3s ease;
}

.social-link:hover {
  color: var(--hover-color, #fff) !important;
  transform: scale(1.2);
}

.social-tooltip {
  position: absolute;
  top: -35px;
  background: var(--primary);
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 0.5rem;
  font-size: 0.7rem;
  font-weight: 800;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.social-wrapper:hover .social-tooltip {
  opacity: 1;
  visibility: visible;
  top: -45px;
}

/* --- CONTACT --- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  border-radius: 1.5rem;
  text-decoration: none;
  border: 1px solid var(--glass-border);
  transition: all 0.3s;
  margin-bottom: 1.5rem;
}

.contact-card i { font-size: 1.8rem; }
.card-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; font-weight: 800; }
.card-text { font-weight: 800; color: white; }

.input-field {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  padding: 1.2rem;
  border-radius: 1rem;
  color: white;
  margin-bottom: 1.5rem;
  transition: all 0.3s;
}

.input-field:focus { 
  outline: none; 
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.form-container {
  padding: 2rem;
  border-radius: 2rem;
  max-width: 650px;
}

/* --- FOOTER --- */
footer { padding: 4rem 0; border-top: 1px solid var(--glass-border); text-align: center; }
.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0 1rem;
}

/* --- REVEAL ANIMATION --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 1s ease-out;
}

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

/* --- MOBILE RESPONSIVE --- */
.menu-toggle, .nav-close {
  display: none;
  font-size: 1.8rem;
  color: white;
  cursor: pointer;
  z-index: 2000;
}

@media (max-width: 968px) {
  section {
    padding: 60px 0;
  }
  
  .hero-grid, .about-grid, .contact-grid { 
    grid-template-columns: 1fr; 
    text-align: left;
    gap: 3rem;
  }
  
  .section-title {
    text-align: left;
  }
  
  .section-title .underline {
    margin: 0;
  }

  .hero-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
  
  .hero-content h1 { 
    font-size: 3.2rem; 
    margin-bottom: 1.5rem;
    text-align: left;
  }
  
  .hero-p { 
    margin: 0 0 2.5rem 0; 
    font-size: 1rem;
    text-align: left;
  }

  .menu-toggle { display: block; }
  
  /* Sidebar initially hidden off-screen to the right */
  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: rgba(3, 7, 18, 0.98);
    backdrop-filter: blur(25px);
    flex-direction: column;
    justify-content: flex-start;
    padding: 6rem 2rem;
    align-items: flex-start;
    gap: 2rem;
    transform: translateX(100%); /* Smooth GPU-accelerated movement */
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2500;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    border-left: 1px solid var(--glass-border);
  }

  .nav-links.active { 
    transform: translateX(0); 
  }
  
  .nav-links a { 
    font-size: 1.2rem; 
    font-weight: 700;
    color: white !important;
    width: 100%;
    padding: 1rem;
    border-radius: 1rem;
    transition: background 0.3s;
  }

  .nav-links a:hover {
    background: rgba(255, 255, 255, 0.05);
  }

  /* Dedicated Close Button inside Sidebar - Only visible in mobile */
  .nav-close {
    display: block; /* Shown only when sidebar is active/mobile */
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s;
  }
  .nav-close:hover { color: white; }
  
  .hero-image-wrapper { 
    order: -1; 
    max-width: 320px; 
    margin: 0 auto; 
  }
  
  .stats-grid { grid-template-columns: repeat(3, 1fr); padding: 0 1rem; }
  .cert-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 640px) {
  .cert-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; gap: 1rem; }
  .section-title h2 { font-size: 2.5rem; }
}

@media (max-width: 480px) {
  .hero-content h1 { font-size: 2.5rem; }
  .typing-text { font-size: 1.5rem; }
  .skill-card-v2 { width: 46%; }
  .projects-grid { grid-template-columns: 1fr; }
  
  /* Additional mobile padding fixes */
  .story-card { padding: 1.5rem; }
  .form-container { padding: 1.5rem; }
}

.mobile-hidden {
  display: none !important;
}

.section-action {
  display: none;
}

@media (max-width: 768px) {
  .section-action {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
  }
  
  .story-card {
    padding: 2rem; /* Less padding on tablet */
  }
  
  .form-container {
    padding: 1.5rem;
  }
}

/* --- CERT OVERLAY --- */
.cert-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(59, 130, 246, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
}

.cert-card:hover .cert-overlay {
  opacity: 1;
}

.cert-overlay i {
  color: white;
  font-size: 2.5rem;
  transform: scale(0.5);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cert-card:hover .cert-overlay i {
  transform: scale(1);
}

/* --- CERT MODAL --- */
.cert-modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.95);
  backdrop-filter: blur(15px);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cert-modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90vh;
}

.modal-content img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.modal-close {
  position: absolute;
  top: -3rem;
  right: 0;
  color: white;
  font-size: 2rem;
  cursor: pointer;
}

/* --- BACK TO TOP --- */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 1000;
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

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

.back-to-top:hover {
  transform: translateY(-5px);
  background: var(--accent);
}

/* --- SHOW MORE FUNCTIONALITY --- */
.show-more-btn {
  display: none;
  margin: 2rem auto 0;
  padding: 0.8rem 2rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
}

.show-more-btn {
  transition: opacity 0.2s ease, transform 0.3s ease, background 0.3s ease;
}

.show-more-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

@media (max-width: 968px) {
  .show-more-btn {
    display: block;
  }
  
  /* Hide extra cards on mobile unless section is expanded */
  .projects-grid:not(.expanded) .project-card:nth-child(n+4),
  .cert-grid:not(.expanded) .cert-card:nth-child(n+4),
  .skills-filter-grid:not(.expanded) .skill-card-v2:nth-child(n+7) {
    display: none;
  }
}
