/* Basic reset */
* {
  box-sizing: border-box;
}

/* CSS Variables for Light/Dark Mode */
:root {
  --bg-color: #ffffff; /* Light mode background */
  --text-color: #1c1c1e; /* Light mode text */
  --header-bg: #f5f5f7; /* Light mode header */
  --border-color: #d2d2d7; /* Light mode borders */
  --accent-color: #0071e3; /* Apple blue */
  --accent-hover: #0066cc;
  --subtext-color: #6e6e73; /* Subtle gray */
  --card-bg: #f5f5f7; /* Card background */
  --shadow-color: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  --bg-color: #1c1c1e; /* Dark mode background */
  --text-color: #f5f5f7; /* Dark mode text */
  --header-bg: #2c2c2e; /* Dark mode header */
  --border-color: #3a3a3c; /* Dark mode borders */
  --accent-color: #0a84ff; /* Slightly brighter blue for dark */
  --accent-hover: #007aff;
  --subtext-color: #9e9e9e; /* Lighter gray for subtext */
  --card-bg: #2c2c2e; /* Dark card background */
  --shadow-color: rgba(255, 255, 255, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease; /* Smooth theme switch */
}

/* Layout */
header {
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background-color 0.3s ease; /* Smooth header transition */
}
nav {
  max-width: 1024px; /* Wider for desktop, like Apple */
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.nav-links a {
  opacity: 0;
  transform: translateY(-10px);
  animation: slideDown 0.5s ease-out forwards;
}
.nav-links a:nth-child(1) { animation-delay: 0.1s; }
.nav-links a:nth-child(2) { animation-delay: 0.2s; }
.nav-links a:nth-child(3) { animation-delay: 0.3s; }
.nav-links a:nth-child(4) { animation-delay: 0.4s; }
/* Add more for additional nav links */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text-color);
  transition: color 0.2s ease;
}
nav a {
  text-decoration: none;
  color: var(--text-color);
  font-size: 15px;
  transition: color 0.2s ease, transform 0.2s ease;
}
nav a:hover {
  color: var(--accent-color); /* Accent on hover */
  transform: translateY(-1px); /* Subtle lift */
}
.lang-switch {
  font-size: 14px;
  color: var(--subtext-color);
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-color);
  margin-left: 16px;
  transition: color 0.2s ease;
}

/* Main content wrapper */
main {
  max-width: 980px; /* Apple-inspired width for readability */
  margin: 48px auto;
  padding: 40px 32px;
  background-color: var(--bg-color);
  border-radius: 12px; /* Softer corners */
  animation: fadeIn 0.5s ease-out forwards; /* Fade-in on load */
}

/* Typography */
h1 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 48px; /* Larger for impact, like Apple heroes */
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 40px;
  color: var(--text-color);
  text-align: center;
  letter-spacing: -0.02em;
  opacity: 0;
  animation: fadeIn 0.6s ease-out 0.1s forwards;
}
h2 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 32px;
  font-weight: 600;
  margin-top: 64px; /* More separation */
  margin-bottom: 32px;
  color: var(--text-color);
  text-align: center;
  letter-spacing: -0.01em;
  opacity: 0;
  animation: fadeIn 0.6s ease-out 0.3s forwards;
}
/* Paragraphs and bullet points */
p,
li {
  font-size: 17px; /* Slightly larger for readability */
  line-height: 1.8;
  color: var(--text-color);
  opacity: 0;
  transform: translateX(-10px);
  animation: slideInLeft 0.5s ease-out forwards;
}
p:nth-of-type(1), li:nth-of-type(1) { animation-delay: 0.5s; }
p:nth-of-type(2), li:nth-of-type(2) { animation-delay: 0.6s; }
p:nth-of-type(3), li:nth-of-type(3) { animation-delay: 0.7s; }
/* Add more for additional paragraphs/lists */
p {
  margin-top: 0;
  margin-bottom: 24px; /* More space */
}
ul {
  padding-left: 24px;
  margin-top: 0;
  margin-bottom: 24px;
  list-style-type: disc;
}
li {
  margin-bottom: 12px;
}

/* CTA button style */
.button {
  display: table;                 /* shrink to content, but still centerable */
  margin: 24px auto 0 auto;       /* centered horizontally with space above */
  text-align: center;
  padding: 12px 24px;
  border-radius: 999px;
  background-color: var(--accent-color);
  color: #ffffff;
  text-decoration: none;
  font-size: 17px;
  font-weight: 400;
  transition: background-color 0.2s ease, transform 0.2s ease;
  border: none;
  opacity: 0;
  animation: fadeIn 0.5s ease-out 0.8s forwards;
}

/* Mobile adjustments if needed */
@media (max-width: 640px) {
  .button {
    width: 100%;                  /* if you want full width on mobile, enable */
    max-width: none;
    margin: 16px auto 0 auto;
  }
}


/* Hero section */
.hero {
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.hero.visible {
  opacity: 1;
  transform: translateY(0);
}
.hero-subtitle {
  font-size: 21px;
  color: var(--subtext-color);
  margin-bottom: 16px;
  font-weight: 400;
}

/* Section helper with staggered animation */
.section {
  margin-top: 64px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}
.section.visible {
  opacity: 1;
  transform: translateY(0);
}
/* Staggering will be handled by JS observing each section independently as they enter view. */

/* Project cards */
.project-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Wider cards */
  gap: 24px;
  margin-top: 24px;
}
.project-card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  background-color: var(--card-bg);
  transition: box-shadow 0.3s ease, transform 0.3s ease, opacity 0.5s ease-out;
  opacity: 0;
  transform: translateY(20px);
}
.project-card.visible {
  opacity: 1;
  transform: translateY(0);
}
.project-card:hover {
  box-shadow: 0 8px 24px var(--shadow-color); /* Deeper hover shadow */
  transform: translateY(-4px); /* Lift on hover */
}
.project-card h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 24px;
  color: var(--text-color);
}

/* Form styles */
.form-section {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.form-section.visible {
  opacity: 1;
  transform: translateY(0);
}
form label {
  display: block;
  font-size: 15px;
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--text-color);
}
form input[type="text"],
form input[type="email"],
form textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 17px;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
form input:focus,
form textarea:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1); /* Subtle glow */
  outline: none;
}
form textarea {
  min-height: 160px;
  resize: vertical;
}
form .button {
  margin-top: 24px;
  /* inherit everything else from .button (centered, compact) */
}

/* Footer */
footer {
  max-width: 1024px;
  margin: 0 auto 32px;
  padding: 24px 24px;
  font-size: 13px;
  color: var(--subtext-color);
  text-align: center;
  border-top: 1px solid var(--border-color);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
footer.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Keyframes for load-based animations (nav, headings, etc.) */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Mobile optimization */
@media (max-width: 768px) { /* Adjusted breakpoint for tablets */
  nav {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 20px;
  }
  .menu-toggle {
    display: block;
    align-self: flex-end;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    margin-top: 12px;
  }
  .nav-links.open {
    display: flex;
  }
  main {
    max-width: 100%;
    margin: 24px 16px;
    padding: 32px 24px;
    border-radius: 0;
  }
  h1 {
    font-size: 36px;
    margin-bottom: 32px;
  }
  h2 {
    font-size: 28px;
    margin-top: 48px;
    margin-bottom: 24px;
  }
  .project-list {
    grid-template-columns: 1fr; /* Stack cards on mobile */
  }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Smooth scrolling for enhanced navigation */
html {
  scroll-behavior: smooth;
}
