/* ================================
   CSS Custom Properties (Themes)
================================ */
:root {
  --font: 'Inter', system-ui, sans-serif;
  --radius: 14px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0a0a0f;
  --bg-card: #111118;
  --bg-card-hover: #16161f;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --accent: #7c6af7;
  --accent-glow: rgba(124, 106, 247, 0.15);
  --streamlit-color: #ff4b4b;
  --vercel-color: #f0f0f0;
  --online-color: #3ecf8e;
  --nav-bg: rgba(10, 10, 15, 0.85);
}

[data-theme="light"] {
  --bg: #f5f5fa;
  --bg-card: #ffffff;
  --bg-card-hover: #fafaff;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.14);
  --text-primary: #111120;
  --text-secondary: #555570;
  --text-muted: #9999b0;
  --accent: #5b4de8;
  --accent-glow: rgba(91, 77, 232, 0.1);
  --streamlit-color: #d93939;
  --vercel-color: #333333;
  --online-color: #2aa86e;
  --nav-bg: rgba(245, 245, 250, 0.85);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ================================
   Nav
================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 60px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-logo {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  text-transform: uppercase;
}

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: border-color var(--transition), background var(--transition), transform 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--border-hover);
  transform: scale(1.08);
}

/* ================================
   Hero
================================ */
.hero {
  position: relative;
  padding: 6rem 2rem 4rem;
  text-align: center;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
}

.hero-eyebrow {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 1.1rem;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto;
}

/* ================================
   Main & Projects
================================ */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem 6rem;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

/* ================================
   Card
================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

/* Platform badges */
.platform-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  border: 1px solid currentColor;
}

.platform-badge.streamlit {
  color: var(--streamlit-color);
  background: rgba(255, 75, 75, 0.08);
}

.platform-badge.vercel {
  color: var(--vercel-color);
  background: rgba(200, 200, 200, 0.08);
}

/* Status */
.card-status {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.card-status.online {
  color: var(--online-color);
}

/* Card content */
.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  position: relative;
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  position: relative;
  flex: 1;
}

/* Card footer */
.card-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  position: relative;
}

.card-tag {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
}

.card-link {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  transition: gap 0.15s ease, color var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.card:hover .card-link {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ================================
   Footer
================================ */
.footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent);
}

.footer a:hover {
  text-decoration: underline;
}

/* ================================
   Responsive
================================ */
@media (max-width: 600px) {
  .nav {
    padding: 0 1.25rem;
  }

  .hero {
    padding: 4rem 1.25rem 3rem;
  }

  .main {
    padding: 0 1.25rem 4rem;
  }

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

  .hero-title {
    font-size: 2.2rem;
  }
}

/* ================================
   Fade-in animation
================================ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeUp 0.4s ease both;
}

.projects-grid .card:nth-child(1) { animation-delay: 0.05s; }
.projects-grid .card:nth-child(2) { animation-delay: 0.12s; }
.projects-grid .card:nth-child(3) { animation-delay: 0.19s; }
.projects-grid .card:nth-child(4) { animation-delay: 0.26s; }
.projects-grid .card:nth-child(5) { animation-delay: 0.33s; }
.projects-grid .card:nth-child(6) { animation-delay: 0.40s; }
