:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --primary: #2c7a2c;
  --primary-dark: #1a5c1a;
  --text: #1a1a1a;
  --text-muted: #555;
  --border: #ddd;
  --card-bg: #fff;
  --nav-bg: #1a5c1a;
  --nav-text: #fff;
  --hero-bg: linear-gradient(135deg, #1a5c1a 0%, #2c7a2c 60%, #3a9a3a 100%);
  --footer-bg: #1a1a1a;
  --footer-text: #ccc;
  --tag-bg: #e8f5e9;
  --tag-text: #2c7a2c;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --bg: #111827;
  --surface: #1f2937;
  --primary: #4ade80;
  --primary-dark: #22c55e;
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --border: #374151;
  --card-bg: #1f2937;
  --nav-bg: #0d1117;
  --nav-text: #f3f4f6;
  --hero-bg: linear-gradient(135deg, #0d1117 0%, #111827 60%, #1a2740 100%);
  --footer-bg: #0d1117;
  --footer-text: #9ca3af;
  --tag-bg: #064e3b;
  --tag-text: #6ee7b7;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
  line-height: 1.7;
}

/* NAV */
nav {
  background: var(--nav-bg);
  color: var(--nav-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--nav-text);
  text-decoration: none;
}

.nav-brand svg { width: 36px; height: 36px; }

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

.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active { color: #fff; }

.theme-toggle {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: 50px;
  padding: 0.35rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s;
}

.theme-toggle:hover { background: rgba(255,255,255,0.25); }

/* HERO */
.hero {
  background: var(--hero-bg);
  color: #fff;
  padding: 5rem 2rem;
  text-align: center;
}

.hero h1 { font-size: 2.8rem; font-weight: 800; margin-bottom: 1rem; }
.hero p { font-size: 1.2rem; max-width: 600px; margin: 0 auto 2rem; opacity: 0.9; }

.hero-img { margin: 2rem auto 0; display: flex; justify-content: center; }
.hero-img svg { width: 200px; height: 200px; filter: drop-shadow(0 8px 24px rgba(0,0,0,0.4)); }

.btn {
  display: inline-block;
  background: #fff;
  color: var(--primary-dark);
  padding: 0.75rem 2rem;
  border-radius: 50px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }

/* SECTIONS */
.section { padding: 4rem 2rem; max-width: 1100px; margin: 0 auto; }
.section-title {
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.section-subtitle { color: var(--text-muted); margin-bottom: 2.5rem; font-size: 1rem; }

/* CARDS */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 1.5rem; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.card-icon { margin-bottom: 1rem; }
.card-icon svg { width: 48px; height: 48px; }
.card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text); }
.card p { color: var(--text-muted); font-size: 0.92rem; }

.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.7rem;
  border-radius: 50px;
  margin-top: 0.8rem;
}

/* PROJECTS PAGE */
.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  transition: transform 0.2s;
}

.project-card:hover { transform: translateY(-3px); }
.project-card svg { flex-shrink: 0; width: 72px; height: 72px; }
.project-card h3 { font-size: 1.25rem; margin-bottom: 0.4rem; }
.project-card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 0.6rem; }

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

/* ABOUT */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

.about-text p { color: var(--text-muted); margin-bottom: 1rem; }
.about-img { display: flex; justify-content: center; }
.about-img svg { width: 260px; height: 260px; }

.values { list-style: none; margin-top: 1rem; }
.values li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.values li::before { content: "✦"; color: var(--primary); font-size: 0.8rem; }

/* OSS BANNER */
.oss-banner {
  background: var(--hero-bg);
  color: #fff;
  text-align: center;
  padding: 3.5rem 2rem;
}
.oss-banner h2 { font-size: 1.8rem; margin-bottom: 0.8rem; }
.oss-banner p { opacity: 0.9; max-width: 560px; margin: 0 auto 1.5rem; }

/* FOOTER */
footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  text-align: center;
  padding: 2rem;
  font-size: 0.88rem;
}
footer a { color: var(--primary); text-decoration: none; }

/* PAGE VISIBILITY */
.page { display: none; }
.page.active { display: block; }

/* HAMBURGER */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  z-index: 200;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* RESPONSIVE */
@media (max-width: 768px) {
  /* Nav mobile */
  .hamburger { display: flex; }

  .nav-links {
    display: none;
    flex-direction: column;
    gap: 0;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    padding: 0.5rem 0 1rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a {
    display: block;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  /* Theme toggle compact */
  .theme-toggle { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

  /* Hero */
  .hero { padding: 3rem 1.25rem 2.5rem; }
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: 1rem; }
  .hero-img img, .hero-img svg { width: 140px; height: 140px; }

  /* Sections */
  .section { padding: 2.5rem 1.25rem; }
  .section-title { font-size: 1.5rem; }

  /* Cards: single column on small screens */
  .cards { grid-template-columns: 1fr; }

  /* Project cards */
  .project-card { flex-direction: column; padding: 1.25rem; gap: 1rem; }
  .project-card svg { width: 52px; height: 52px; }

  /* About */
  .about-grid { grid-template-columns: 1fr; }
  .about-img { order: -1; }
  .about-img img { width: 180px; height: 180px; }

  /* OSS banner */
  .oss-banner { padding: 2.5rem 1.25rem; }
  .oss-banner h2 { font-size: 1.4rem; }
  .oss-banner img { width: 100%; max-width: 220px; }

  /* Footer */
  footer { padding: 1.5rem 1rem; font-size: 0.82rem; }
}

@media (max-width: 400px) {
  .hero h1 { font-size: 1.5rem; }
  .nav-brand { font-size: 1.1rem; }
}
