/* ==========================================================================
   CSS Variables & Theming
   ========================================================================== */
:root {
  --bg-color: #fbfbfd;
  --text-main: #1d1d1f;
  --text-muted: #86868b;
  --card-bg: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.8);
  --primary: #0066cc;
  --primary-hover: #0055b3;
  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.08);
  --border-radius: 16px;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg-color: #000000;
  --text-main: #f5f5f7;
  --text-muted: #a1a1a6;
  --card-bg: #1c1c1e;
  --nav-bg: rgba(0, 0, 0, 0.8);
  --shadow-soft: 0 4px 24px rgba(255, 255, 255, 0.02);
  --shadow-hover: 0 12px 32px rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

h1 { font-size: 3.5rem; line-height: 1.1; }
h2 { font-size: 2.5rem; }
h3 { font-size: 1.5rem; }
p { margin-bottom: 1rem; color: var(--text-muted); }

/* ==========================================================================
   Layout & Container
   ========================================================================== */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 0;
}

.section-title {
  text-align: center;
  margin-bottom: 3rem;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  border-bottom: 1px solid rgba(134, 134, 139, 0.1);
}

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

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text-main);
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  font-size: 1.2rem;
}

.hamburger {
  display: none;
  cursor: pointer;
  font-size: 1.5rem;
  background: none;
  border: none;
  color: var(--text-main);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-align: center;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid var(--text-muted);
}

.btn-secondary:hover {
  border-color: var(--text-main);
  transform: translateY(-2px);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 60px;
}

.hero-content {
  display: flex;
  align-items: center;
  gap: 4rem;
  width: 100%;
}

.hero-text {
  flex: 1;
  animation: fadeIn 1s ease forwards;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 2rem;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
}

.hero-image {
  flex: 1;
  display: flex;
  justify-content: center;
  animation: fadeIn 1s ease 0.3s forwards;
  opacity: 0;
}

.hero-image img {
  width: 100%;
  max-width: 400px;
  border-radius: 50%;
  box-shadow: var(--shadow-soft);
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

/* ==========================================================================
   Cards (Projects, About, etc.)
   ========================================================================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.card-img-placeholder {
  width: 100%;
  height: 200px;
  background: #e5e5ea;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #86868b;
  font-weight: 600;
}

[data-theme="dark"] .card-img-placeholder {
  background: #2c2c2e;
}

.card-content {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.card-tech {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-content .btn {
  margin-top: auto;
  align-self: flex-start;
}

/* ==========================================================================
   Project Details Pages
   ========================================================================== */
.project-hero {
  width: 100%;
  height: 60vh;
  background: #e5e5ea;
  margin-top: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #86868b;
  font-size: 2rem;
  font-weight: bold;
}

[data-theme="dark"] .project-hero {
  background: #2c2c2e;
}

.project-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 4rem 5%;
}

.project-section {
  margin-bottom: 3rem;
}

.tag-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.tag {
  background: rgba(0, 102, 204, 0.1);
  color: var(--primary);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.project-links {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Search & Filter (All Projects)
   ========================================================================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 3rem;
  align-items: center;
  justify-content: space-between;
}

.search-input {
  padding: 0.8rem 1.5rem;
  border-radius: 30px;
  border: 1px solid var(--text-muted);
  background: var(--bg-color);
  color: var(--text-main);
  width: 100%;
  max-width: 300px;
  outline: none;
  font-family: inherit;
}

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

.filter-btn {
  background: var(--card-bg);
  border: 1px solid var(--text-muted);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn.active, .filter-btn:hover {
  background: var(--text-main);
  color: var(--bg-color);
  border-color: var(--text-main);
}

/* ==========================================================================
   Timelines (Education / Leadership)
   ========================================================================== */
.timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}

.timeline::after {
  content: '';
  position: absolute;
  width: 2px;
  background-color: var(--text-muted);
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -1px;
  opacity: 0.2;
}

.timeline-item {
  padding: 10px 40px;
  position: relative;
  background-color: inherit;
  width: 50%;
}

.timeline-item::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  right: -8px;
  background-color: var(--primary);
  border: 4px solid var(--bg-color);
  top: 15px;
  border-radius: 50%;
  z-index: 1;
}

.left { left: 0; }
.right { left: 50%; }
.right::after { left: -8px; }

.timeline-content {
  padding: 1.5rem;
  background: var(--card-bg);
  position: relative;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-soft);
}

/* ==========================================================================
   Forms & Contact
   ========================================================================== */
.contact-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(134, 134, 139, 0.3);
  background: var(--card-bg);
  color: var(--text-main);
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--primary);
}

.map-placeholder {
  width: 100%;
  height: 300px;
  background: #e5e5ea;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #86868b;
  margin-top: 2rem;
}

[data-theme="dark"] .map-placeholder { background: #2c2c2e; }

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
  background: var(--card-bg);
  padding: 4rem 5%;
  border-top: 1px solid rgba(134, 134, 139, 0.1);
  margin-top: 4rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

/* ==========================================================================
   Animations & Utilities
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.8s ease forwards;
}

.text-center { text-align: center; }
.mt-4 { margin-top: 4rem; }
.mb-2 { margin-bottom: 2rem; }

/* ==========================================================================
   Media Queries
   ========================================================================== */
@media screen and (max-width: 768px) {
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    padding: 2rem 0;
    border-bottom: 1px solid rgba(134, 134, 139, 0.1);
  }
  .nav-links.active { display: flex; }
  .hamburger { display: block; }
  .hero-content { flex-direction: column-reverse; text-align: center; }
  .hero-buttons { justify-content: center; }
  .timeline::after { left: 31px; }
  .timeline-item { width: 100%; padding-left: 70px; padding-right: 25px; }
  .timeline-item.right { left: 0; }
  .timeline-item::after { left: 23px; }
  .contact-wrapper { grid-template-columns: 1fr; }
}