:root {
  --bg: #0a192f;  /* Deep Navy */
  --card: #112240; /* Lighter Navy */
  --muted: #9ca3af;
  --accent: #7c3aed; /* Violet/Purple */
  --glass: rgba(255, 255, 255, 0.03);
  --radius: 12px;
  --max-width: 1100px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background-color: var(--bg);
  background: linear-gradient(180deg, var(--bg) 0%, #020c1b 100%);
  background-attachment: fixed;
  color: #e6eef8;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px;
}

/* --- HEADER & NAV --- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 200px;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.nav-menu {
  display: flex;
  gap: 8px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
}

nav a:hover {
  color: white;
  background: var(--glass);
}

/* Hamburger Menu (Hidden on Desktop) */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 101; /* Ensure it stays on top */
}

.hamburger span {
  width: 24px;
  height: 2px;
  background: var(--muted);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger:hover span {
  background: white;
}

/* --- HERO SECTION --- */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
  padding: 48px 0;
}

.hero h1 {
  font-size: clamp(24px, 5vw, 44px);
  margin: 0;
  line-height: 1.2;
}

.lead {
  color: var(--muted);
  margin-top: 8px;
  font-size: clamp(14px, 2vw, 16px);
}

.cta {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* --- BUTTONS --- */
.btn {
  background: linear-gradient(90deg, var(--accent), #3b82f6);
  color: white;
  padding: 10px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  display: inline-block;
  text-align: center;
  transition: transform 0.2s, opacity 0.2s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.btn.secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  box-shadow: none;
}
.btn.secondary:hover {
  border-color: var(--accent);
  color: white;
}

/* Form Inputs */
input, textarea {
  font-size: 16px;
}

input[type="email"],
textarea {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: inherit;
  border-radius: 8px;
  padding: 10px;
  font-family: inherit;
  transition: border-color 0.2s;
}

input[type="email"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,0.02);
}

/* --- CARDS (Islands) --- */
.card {
  background: var(--card);
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(2, 6, 23, 0.5);
  border: 1px solid rgba(255,255,255,0.03);
}

.projects {
  margin-top: 36px;
}

.projects .project {
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, #162c46 -10%, #112240);
  transition: all 0.3s ease;
  border: 1px solid rgba(124, 58, 237, 0.05);
}

.projects .project:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.15);
  background: linear-gradient(180deg, #1a3a52 -10%, #162c46);
}

/* --- HORIZONTAL SCROLL PROJECTS --- */
.project-scroller {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  
  /* Centering Logic */
  padding-inline: calc(50% - 150px);
  scroll-padding-inline: calc(50% - 150px);
  
  margin-right: 0;
  margin-left: 0;
}

.project-card-scroll {
  min-width: 300px;
  max-width: 320px;
  flex: 0 0 auto;
  scroll-snap-align: center; /* Center snap */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.project-scroller::-webkit-scrollbar { height: 8px; }
.project-scroller::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 4px; }
.project-scroller::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

/* --- SCROLL ARROW BUTTONS --- */
.scroll-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(124, 58, 237, 0.9);
  color: white;
  border: none;
  width: 40px; /* Slightly smaller for elegance */
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50; /* Higher Z-index to float above cards */
  transition: all 0.3s ease;
  opacity: 1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.scroll-arrow:hover {
  transform: translateY(-50%) scale(1.1);
  background: var(--accent);
}

/* FIX: Arrows inside the container so they aren't cut off */
.scroll-left { left: 10px; }
.scroll-right { right: 10px; }

/* --- SKILLS --- */
.skills-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.skill-card {
  display: flex;
  flex-direction: column;
}

.skills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.skill {
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
  cursor: default;
}

.skill:hover {
  background: rgba(124, 58, 237, 0.2);
  color: var(--accent);
}

/* --- CONTACT SECTION --- */
#contact { margin-top: 36px; }
#contact h2 { margin-top: 0; }

#contact .card {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

/* --- FOOTER --- */
footer {
  padding: 48px 0 28px 0;
  color: var(--muted);
  background: transparent;
  text-align: center;
}

.socials { display: flex; gap: 10px; }
.socials a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
}

/* --- MODAL (POPUP) STYLES --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  backdrop-filter: blur(5px);
  padding: 10px;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #0f1720;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.modal-header {
  position: sticky;
  top: 0;
  background: rgba(15, 23, 32, 0.95);
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.modal-header h2 { font-size: clamp(16px, 4vw, 24px); }

.close-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.close-btn:hover { color: white; }

.modal-body { padding: 16px; }

/* Carousel */
.carousel-container {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 300px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.1);
    margin-top: 20px;
}

.carousel-track {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-track img {
    max-width: 100%;
    max-height: 400px;
    display: none;
    object-fit: contain;
}

.carousel-track img.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 20px;
    padding: 10px 16px;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10;
}
.prev { left: 8px; }
.next { right: 8px; }

@keyframes fadeIn {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

.video-container {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
  background: black;
  border: 1px solid rgba(255,255,255,0.1);
  max-height: 60vh;
}

/* --- CERTIFICATIONS --- */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.cert-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, background 0.2s;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.cert-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.cert-logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
  background: white;
  border-radius: 8px;
  padding: 4px;
  flex-shrink: 0;
}
.cert-info h3 { margin: 0; font-size: 16px; font-weight: 600; }
.cert-info p { margin: 4px 0 0 0; font-size: 13px; color: var(--muted); }

.pdf-slide {
  display: none;
  width: 100%;
  justify-content: center;
  align-items: center;
}
.pdf-slide.active { display: flex; }

/* --- RESPONSIVE FIXES --- */
/* This covers Tablets (768px) and Phones */
@media (max-width: 768px) {
  .container { padding: 16px; }
  
  /* 1. Header Layout */
  .hero { grid-template-columns: 1fr; padding: 32px 0; gap: 24px; }
  .hero h1 { font-size: clamp(22px, 5vw, 32px); }
  
  /* 2. Show Hamburger, Hide Text Links */
  .hamburger { 
    display: flex; /* Show the icon */
  }

  /* This is the part that fixes your "text under menu" issue */
  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #111a24;
    flex-direction: column;
    align-items: center;
    padding: 0;
    
    /* Hide logic */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    z-index: 100;
  }

  /* When JS adds the 'active' class, the menu expands */
  .nav-menu.active {
    max-height: 500px;
    opacity: 1;
    padding: 20px;
  }
  
  /* Make links big and clickable on mobile */
  .nav-menu a {
    width: 100%;
    text-align: center;
    padding: 12px;
    display: block;
  }
  
  .project-card-scroll { min-width: 280px; }
  .cert-grid { grid-template-columns: 1fr; }
  .skills-container { grid-template-columns: 1fr; }
  
  /* Hide scroll arrows on mobile/tablet since we can swipe */
  .scroll-arrow { display: none; }
}

@media (max-width: 520px) {
  header { padding: 8px 0; }
  .logo { width: 40px; height: 40px; font-size: 14px; }
  
  .project-card-scroll { min-width: 85vw; max-width: 85vw; }
}

/* --- DESKTOP FIX FOR PROJECT GAP --- */
@media (min-width: 769px) {
  .project-scroller {
    /* Remove the huge centering padding on desktop */
    padding-inline: 0; 
    
    /* Align cards to the start (Left) */
    justify-content: flex-start; 
    scroll-snap-type: x mandatory;
  }

  .project-card-scroll {
    /* Make them snap to the left edge, not center */
    scroll-snap-align: start; 
  }
  
  /* Optional: Add slight breathing room on the ends */
  .project-scroller {
    padding-left: 20px;
    padding-right: 20px;
  }
}