:root {
  /* Light mode default (Gruvbox Light Hard) */
  --bg-color: #f9f5d7;
  --text-primary: #3c3836;
  --text-secondary: #7c6f64;
  --text-heading: #1d2021;
  --accent: #98971a;
  --font-main: 'Poppins', -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark mode (Gruvbox Dark Hard) */
    --bg-color: #1d2021;
    --text-primary: #ebdbb2;
    --text-secondary: #a89984;
    --text-heading: #f9f5d7;
    --accent: #b8bb26;
  }
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.6;
  display: grid;
  place-items: safe center;
  min-height: 100vh;
}

.layout {
  display: flex;
  width: 100%;
  max-width: 1000px;
  height: 90vh; /* Fixed height to allow internal scrolling */
  margin: auto;
  padding: 50px 6%; /* Responsive left/right margins (6%) */
  box-sizing: border-box;
}

.sidebar {
  width: 250px;
  height: fit-content;
  flex-shrink: 0;
}

.logo {
  margin-bottom: 50px;
  display: flex;
  align-items: center;
  position: relative;
}

.profile-popup {
  position: absolute;
  top: 60px; /* Appear just below the icon */
  left: 0;
  width: clamp(200px, 22vw, 280px);
  height: clamp(200px, 22vw, 280px);
  border-radius: 16px;
  object-fit: cover;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 15px 35px rgba(0,0,0,0.15);
  z-index: 100;
  pointer-events: none;
}

.logo:hover .profile-popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0 0 50px 0;
}

nav li {
  margin-bottom: 18px;
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

nav a:hover, nav a.active {
  color: var(--accent);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: transparent;
  margin-right: 12px;
  transition: background-color 0.2s ease;
}

nav a.active .dot {
  background-color: var(--accent);
}

.lang-toggle {
  display: flex;
  gap: 15px;
}

.lang-toggle button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.85rem;
  padding: 0;
  transition: color 0.2s ease;
}

.lang-toggle button.active, .lang-toggle button:hover {
  color: var(--accent);
  font-weight: 700;
}

.content {
  flex: 1;
  max-width: 650px;
  overflow-y: auto; /* Enable vertical scrolling */
  padding-right: 10px; /* Slight padding for aesthetics */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.content::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

header {
  margin-bottom: 60px;
}

h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: 0;
  margin-bottom: 25px;
  color: var(--text-heading);
}

p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 25px;
  line-height: 1.7;
}

.role {
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 5px;
}

.location {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

section {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

section.active {
  display: block;
}

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

/* Experience, Project, Education items styling */
.experience-item, .project-item, .education-item {
  margin-bottom: 45px;
}

.experience-item:last-child, .project-item:last-child, .education-item:last-child {
  margin-bottom: 0;
}

.experience-item h3, .project-item h3, .education-item h3 {
  font-size: 1.05rem;
  font-weight: 500;
  margin: 0 0 8px 0;
  color: var(--text-primary);
}

.experience-item .company, .project-item .tech, .education-item .school {
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 8px;
  display: block;
}

.experience-item .date, .education-item .date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 12px;
  opacity: 0.8;
}

.experience-item p, .project-item p, .education-item p {
  margin-bottom: 0;
}

footer {
  margin-top: 100px;
  padding-top: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

footer p {
  margin: 0;
}

.social-links {
  display: flex;
  gap: 18px;
}

.social-links a {
  color: var(--text-secondary);
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
}

.social-links a:hover {
  color: var(--accent);
}

.social-links svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

@media (max-width: 768px) {
  body {
    display: block; /* Remove grid centering for natural scrolling */
  }

  .layout {
    flex-direction: column;
    padding: 40px 8%; /* Increased side margins on mobile */
    height: auto; /* Remove 90vh restriction */
    min-height: 100vh;
  }
  
  .sidebar {
    width: 100%;
    margin-bottom: 30px;
  }

  .logo {
    margin-bottom: 30px;
  }
  
  nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
  }

  nav a {
    font-size: 0.9rem;
  }
  
  .content {
    padding-left: 0;
    max-width: 100%;
    overflow-y: visible; /* Let the whole page scroll on mobile */
  }

  section {
    padding-top: 10px;
    margin-bottom: 40px;
  }

  footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    margin-top: 50px;
    padding-bottom: 30px;
  }
}
