:root {
  --bg: #0f0f12;
  --card: #17171c;
  --text: #eef1f8;
  --muted: #a6adbb;
  --accent: #6ee7b7;
  --accent-2: #93c5fd;
}

body:not(.dark-mode) {
  --bg: #f8f9fa;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --bg-gradient-start: #f0f4f8;
  --bg-gradient-end: #e2e8f0;
  --border: #e5e7eb;
  --input-bg: #ffffff;
}

body.dark-mode {
  --bg: #0f0f12;
  --card: #17171c;
  --text: #eef1f8;
  --muted: #a6adbb;
  --bg-gradient-start: #0b0b0e;
  --bg-gradient-end: #121217;
  --border: #262631;
  --input-bg: #0e0e13;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell,
    Noto Sans, sans-serif;
  background: linear-gradient(
    180deg,
    var(--bg-gradient-start, #0b0b0e),
    var(--bg-gradient-end, #121217)
  );
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
}

.site-header {
  padding: 2rem 1rem;
  text-align: center;
  position: relative;
}

.site-header h1 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
}

.site-header p {
  margin: 0.25rem 0 1rem;
  color: var(--muted);
}

.controls {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}

.controls input,
.controls select {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border, #2a2a33);
  background: var(--input-bg, #0e0e13);
  color: var(--text);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.theme-toggle {
  background: var(--card);
  border: 2px solid var(--border, #262631);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
  transform: rotate(15deg) scale(1.1);
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(110, 231, 183, 0.2);
}

.theme-toggle svg {
  position: absolute;
  transition: all 0.3s ease;
}

.theme-toggle .sun-icon {
  opacity: 0;
  transform: rotate(90deg);
}

.theme-toggle .moon-icon {
  opacity: 1;
  transform: rotate(0deg);
}

body:not(.dark-mode) .theme-toggle .sun-icon {
  opacity: 1;
  transform: rotate(0deg);
}

body:not(.dark-mode) .theme-toggle .moon-icon {
  opacity: 0;
  transform: rotate(-90deg);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  padding: 1rem;
  max-width: 1100px;
  margin: 0 auto 3rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border, #262631);
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.card h3 {
  margin: 0.25rem 0 0.25rem;
  font-size: 1.05rem;
}

.card p {
  margin: 0.25rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 2.6em;
}

.card .meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.8rem;
}

.card a {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1020;
  text-decoration: none;
  font-weight: 600;
}

.card a:hover {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  background-size: 200% auto;
  transition: background-position 0.4s ease;
  background-position: right center;
}

.site-footer {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid var(--border, #22222b);
  transition: border-color 0.3s ease;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

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


/* ================================
   📱 RESPONSIVE DESIGN ENHANCEMENTS
   ================================ */

/* --- Tablet (≤ 1024px) --- */
@media (max-width: 1024px) {
  .site-header {
    padding: 1.5rem 1rem;
  }

  .site-header h1 {
    font-size: 1.75rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .controls input,
  .controls select {
    width: 100%;
    font-size: 1rem;
  }

  .project-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
  }
}

/* --- Mobile (≤ 600px) --- */
@media (max-width: 600px) {
  body {
    font-size: 0.95rem;
  }

  .site-header {
    padding: 1rem 0.75rem;
  }

  .site-header h1 {
    font-size: 1.5rem;
  }

  .site-header p {
    font-size: 0.9rem;
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
    top: 0.75rem;
    right: 0.75rem;
  }

  .controls {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .controls input,
  .controls select {
    width: 100%;
    font-size: 0.95rem;
  }

  .project-grid {
    grid-template-columns: 1fr;
    padding: 0.75rem;
  }

  .card {
    padding: 0.75rem;
  }

  .site-footer {
    font-size: 0.85rem;
    padding: 1rem;
  }
}


/* ================================
   ✨ TRANSITIONS & ANIMATIONS
   ================================ */

/* Smooth transitions on layout adjustments */
.controls,
.project-grid,
.card,
.site-header,
.site-footer {
  transition:
    all 0.3s ease-in-out,
    grid-template-columns 0.3s ease-in-out,
    padding 0.3s ease-in-out,
    font-size 0.2s ease-in-out;
}

/* Animate cards when the grid rearranges */
.project-grid {
  transition:
    grid-template-columns 0.4s ease,
    gap 0.3s ease;
}

/* Subtle hover animation for cards */
.card {
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    background 0.3s ease;
}

.card:hover {
   border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(110, 231, 183, 0.15);
  transform: translateY(-5px);
}

.card:active {
  transform: scale(0.98);
}

/* Smoothly scale theme toggle when viewport changes */
.theme-toggle {
  transition:
    all 0.25s ease,
    transform 0.3s ease;
}

/* Fade animation when switching between dark/light themes */
body {
  transition:
    background 0.4s ease,
    color 0.4s ease,
    filter 0.4s ease;
}

/* Optional: add a slight fade-in effect when content loads */
body {
  opacity: 0;
  animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
