* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

body.light-mode {
  background: #f9f9f9;
  color: #1c222c;
}

body.dark-mode {
  background: #1c222c;
  color: #f9f9f9;
}

/* Header */
header {
  background: #1c222c;
  color: #f9f9f9;
  padding: 1.5rem 0;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

nav {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
}

nav h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 1px;
}

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

nav a {
  color: #f9f9f9;
  text-decoration: none;
  font-weight: 400;
  transition: color 0.3s, transform 0.3s;
}

nav a:hover {
  color: #ffba08;
  transform: translateY(-2px);
}

.theme-toggle, .language-toggle {
  background: none;
  border: none;
  color: #f9f9f9;
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.3s;
}

.theme-toggle:hover, .language-toggle:hover {
  color: #ffba08;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: #f9f9f9;
  font-size: 1.8rem;
  cursor: pointer;
}

.nav-links {
  display: flex;
}

/* Hero/About Section */
#about {
  background: linear-gradient(135deg, #d51301, #e85d04);
  color: #f9f9f9;
  padding: 8rem 2rem 5rem;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

#about.visible {
  opacity: 1;
  transform: translateY(0);
}

#about::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.1), transparent);
  z-index: 0;
}

.about-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: relative;
  z-index: 1;
}

.about-text {
  flex: 1;
}

#about h2 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

#about p {
  font-size: 1.2rem;
  max-width: 500px;
}

.about-photo {
  flex: 1;
  display: flex;
  justify-content: center;
}

.about-photo img {
  width: 100%;
  max-width: 300px;
  height: auto;
  border: 3px solid #1c222c;
  box-shadow: inset 0 0 10px #e85d04, 0 4px 10px rgba(0, 0, 0, 0.3);
  transform: rotate(2deg);
  transition: transform 0.3s;
}

.about-photo img:hover {
  transform: rotate(0deg);
}

/* Projects Section */
#projects {
  padding: 5rem 1rem;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

#projects.visible {
  opacity: 1;
  transform: translateY(0);
}

body.light-mode #projects {
  background: #f9f9f9;
}

body.dark-mode #projects {
  background: #2a303d;
}

#projects h2 {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 1rem;
}

.project-filters {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: #1c222c;
  color: #f9f9f9;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.3s, transform 0.3s;
}

.filter-btn:hover {
  background: #ffba08;
  color: #1c222c;
  transform: translateY(-2px);
}

.filter-btn.active {
  background: #e85d04;
}

.projects-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.project-card {
  background: #fff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  display: none;
  max-width: 100%;
}

.project-card.visible {
  opacity: 1;
  transform: translateY(0);
  display: block;
}

body.dark-mode .project-card {
  background: #3a4254;
}

.project-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.project-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.project-card h3 {
  font-size: 1.4rem;
  padding: 1rem;
  color: #d51301;
}

.project-card p {
  padding: 0 1rem 1rem;
  font-size: 0.95rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
  padding: 1rem;
  overflow-y: auto;
}

.modal-content {
  border-radius: 15px;
  position: relative;
  max-width: 600px;
  max-height: 70vh;
  width: 100%;
  margin: 2rem auto;
  overflow-y: auto;
  padding: 0;
}

body.light-mode .modal-content {
  background: #f9f9f9;
}

body.dark-mode .modal-content {
  background: #3a4254;
  color: #f9f9f9;
}

.modal-header {
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 1;
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.5rem;
  color: #d51301;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: #f9f9f9;
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.3s;
}

.modal-close:hover {
  color: #ffba08;
}

.modal-body {
  padding: 1rem;
}

.modal-section {
  margin-bottom: 1.2rem;
}

.modal-section h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e85d04;
  margin-bottom: 0.5rem;
}

.modal-section p {
  line-height: 1.6;
  font-size: 0.95rem;
}

.modal-section a {
  color: #ffba08;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.modal-section a:hover {
  color: #e85d04;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tech-tag {
  background: #1c222c;
  color: #f9f9f9;
  padding: 0.3rem 0.8rem;
  border-radius: 15px;
  font-size: 0.9rem;
  transition: background 0.3s;
}

body.light-mode .tech-tag {
  background: #d51301;
  color: #f9f9f9;
}

.tech-tag:hover {
  background: #ffba08;
  color: #1c222c;
}

.modal-content video {
  width: 100%;
  max-height: 200px;
  border-radius: 10px;
  margin-top: 0.5rem;
}

/* Skills Section */
#skills {
  padding: 5rem 1rem;
  text-align: center;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

#skills.visible {
  opacity: 1;
  transform: translateY(0);
}

body.light-mode #skills {
  background: #fff;
}

body.dark-mode #skills {
  background: #2a303d;
}

#skills h2 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
}

.skills-category {
  margin-bottom: 2rem;
}

.skills-category h3 {
  font-size: 1.5rem;
  color: #e85d04;
  margin-bottom: 1rem;
}

.skills-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.skill {
  background: #1c222c;
  color: #f9f9f9;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 400;
  transition: transform 0.3s, background 0.3s, box-shadow 0.3s;
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.skill.visible {
  opacity: 1;
  transform: translateX(0);
}

.skill:hover {
  transform: scale(1.1);
  background: #ffba08;
  color: #1c222c;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Education/Work Experience Section */
#experience {
  padding: 5rem 1rem;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

#experience.visible {
  opacity: 1;
  transform: translateY(0);
}

body.light-mode #experience {
  background: #f9f9f9;
}

body.dark-mode #experience {
  background: #2a303d;
}

#experience h2 {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 2rem;
}

.experience-container {
  max-width: 800px;
  margin: 0 auto;
}

.experience-entry {
  margin-bottom: 2rem;
  padding: 1rem;
  border-left: 4px solid #e85d04;
}

.experience-entry h3 {
  font-size: 1.4rem;
  color: #d51301;
}

.experience-entry p {
  font-size: 1rem;
  margin: 0.5rem 0;
}

.experience-entry ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  font-size: 0.95rem;
}

/* Contact Section */
#contact {
  padding: 5rem 1rem;
  background: #1c222c;
  color: #f9f9f9;
  text-align: center;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

#contact.visible {
  opacity: 1;
  transform: translateY(0);
}

#contact h2 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.contact-links a {
  background: #e85d04;
  color: #f9f9f9;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.3s, transform 0.3s;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.contact-links a.visible {
  opacity: 1;
  transform: scale(1);
}

.contact-links a:hover {
  background: #ffba08;
  color: #1c222c;
  transform: scale(1.05);
}

.contact-form {
  max-width: 600px;
  margin: 0 auto;
}

.contact-form form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-form input,
.contact-form textarea {
  padding: 0.75rem;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
  background: #3a4254;
  color: #f9f9f9;
}

body.light-mode .contact-form input,
body.light-mode .contact-form textarea {
  background: #fff;
  color: #1c222c;
  border: 1px solid #1c222c;
}

.contact-form textarea {
  resize: vertical;
  min-height: 100px;
}

.contact-form button {
  background: #e85d04;
  color: #f9f9f9;
  padding: 0.75rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s, transform 0.3s;
}

.contact-form button:hover {
  background: #ffba08;
  color: #1c222c;
  transform: translateY(-2px);
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 1rem;
  background: #e85d04;
  color: #f9f9f9;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, background 0.3s;
  z-index: 1000;
}

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

.back-to-top:hover {
  background: #ffba08;
  color: #1c222c;
}

/* Footer */
footer {
  background: #1c222c;
  color: #f9f9f9;
  text-align: center;
  padding: 1.5rem;
  font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Responsive Design */
@media (min-width: 769px) {
  .project-card {
    max-width: 380px; /* Approximate width for 3 columns with gaps */
    margin: 0 auto; /* Center cards if fewer than 3 */
  }

  .projects-container {
    justify-items: center; /* Center cards when fewer than 3 */
  }
}

@media (max-width: 768px) {
  nav {
    padding: 0 1rem;
    position: relative;
  }

  nav h1 {
    font-size: 1.5rem;
  }

  .nav-links {
    display: none;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 0;
    background: #1c222c;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  }

  .nav-links.active {
    display: block;
  }

  .nav-links ul {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .nav-links li {
    width: 100%;
    text-align: center;
  }

  .nav-links a {
    display: block;
    padding: 0.5rem 0;
    font-size: 1rem;
  }

  .hamburger {
    display: block;
  }

  .theme-toggle, .language-toggle {
    font-size: 1rem;
  }

  .about-container {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  #about h2 {
    font-size: 2rem;
  }

  #about p {
    font-size: 1rem;
    max-width: 100%;
  }

  .about-photo img {
    max-width: 200px;
  }

  .project-filters {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .filter-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .projects-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .project-card {
    max-width: 100%;
  }

  .project-card h3 {
    font-size: 1.2rem;
  }

  .project-card p {
    font-size: 0.85rem;
  }

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

  .modal-header {
    padding: 0.5rem 1rem;
  }

  .modal-header h3 {
    font-size: 1.3rem;
  }

  .modal-close {
    font-size: 1rem;
  }

  .modal-body {
    padding: 0.5rem 1rem;
  }

  .modal-section h4 {
    font-size: 1rem;
  }

  .modal-section p {
    font-size: 0.9rem;
  }

  .modal-content video {
    max-height: 150px;
  }

  #skills h2 {
    font-size: 2rem;
  }

  .skills-category h3 {
    font-size: 1.2rem;
  }

  .skill {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
  }

  #experience h2 {
    font-size: 2rem;
  }

  .experience-entry h3 {
    font-size: 1.2rem;
  }

  .experience-entry p, .experience-entry ul {
    font-size: 0.9rem;
  }

  #contact h2 {
    font-size: 2rem;
  }

  .contact-links a {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
  }

  .contact-form input,
  .contact-form textarea {
    font-size: 0.9rem;
  }

  .contact-form button {
    font-size: 0.9rem;
    padding: 0.5rem;
  }

  .back-to-top {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  nav h1 {
    font-size: 1.2rem;
  }

  .hamburger {
    font-size: 1.5rem;
  }

  #about h2 {
    font-size: 1.8rem;
  }

  #about p {
    font-size: 0.9rem;
  }

  .about-photo img {
    max-width: 150px;
  }

  #projects h2 {
    font-size: 1.8rem;
  }

  .project-card h3 {
    font-size: 1.1rem;
  }

  .project-card p {
    font-size: 0.8rem;
  }

  .modal-header h3 {
    font-size: 1.2rem;
  }

  .modal-section h4 {
    font-size: 0.9rem;
  }

  .modal-section p {
    font-size: 0.85rem;
  }

  #skills h2 {
    font-size: 1.8rem;
  }

  .skills-category h3 {
    font-size: 1.1rem;
  }

  .skill {
    font-size: 0.7rem;
    padding: 0.4rem 0.8rem;
  }

  #experience h2 {
    font-size: 1.8rem;
  }

  .experience-entry h3 {
    font-size: 1.1rem;
  }

  .experience-entry p, .experience-entry ul {
    font-size: 0.85rem;
  }

  #contact h2 {
    font-size: 1.8rem;
  }

  .contact-links a {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
}