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

:root {
  --bg: #f5f5f5;
  --text: #222;
  --accent: #4e54c8;
  --secondary: #8f94fb;
}

body.dark {
  --bg: #0f172a;
  --text: #f5f5f5;
  --accent: #8f94fb;
  --secondary: #4e54c8;
}

body {
  font-family: "Poppins", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  height: 100%;
}

/* ===== Preloader ===== */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--accent);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader {
  border: 6px solid rgba(255, 255, 255, 0.2);
  border-top: 6px solid #fff;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

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

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
}

#preloader p {
  font-size: 1.1rem;
  font-weight: 500;
}

/* Fade in content when loaded */
main,
header,
section,
footer,
.theme-toggle {
  opacity: 0;
  transition: opacity 1s ease;
}

body.loaded header,
body.loaded section,
body.loaded footer,
body.loaded .theme-toggle {
  opacity: 1;
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 18px;
  transition: 0.3s;
  z-index: 1000;
}
.theme-toggle:hover {
  transform: scale(1.1);
}

/* Hero Section */
.hero {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.hero-content {
  z-index: 1;
  padding: 20px;
}
.hero h1 {
  font-size: 2.5rem;
}
.hero h2 {
  font-size: 1.5rem;
  color: var(--text);
  min-height: 2em;
}
.hero p {
  margin: 15px 0;
}
.highlight {
  color: var(--accent);
}
.btn {
  background: linear-gradient(45deg, var(--accent), var(--secondary));
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 25px;
  text-decoration: none;
  cursor: pointer;
  transition: 0.3s;
}
.btn:hover {
  opacity: 0.8;
}
.btn.small {
  padding: 8px 15px;
  font-size: 0.9rem;
}

/* Section Styling */
.section {
  padding: 80px 20px;
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}
.section-title {
  font-size: 2rem;
  margin-bottom: 20px;
  color: var(--accent);
}
.section-desc {
  font-size: 1.1rem;
  margin-bottom: 40px;
}

/* Projects */
.projects-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}
.project-card {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  padding: 20px;
  width: 280px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}
.dark .project-card {
  background: rgba(20, 25, 50, 0.8);
}
.project-card:hover {
  transform: scale(1.05);
}

/* Contact */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 500px;
  margin: 0 auto;
}
.contact-form input,
.contact-form textarea {
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-size: 1rem;
}
.contact-form button {
  width: fit-content;
  align-self: center;
}

/* Footer */
footer {
  text-align: center;
  padding: 30px;
  font-size: 0.9rem;
  background: var(--accent);
  color: #fff;
}

/* Scroll Animations */
[data-aos] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
[data-aos].active {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
  .projects-container {
    flex-direction: column;
    align-items: center;
  }
}
