/* CSS Variables */
:root {
  /* Softer, less harsh light theme colors */
  --bg-primary: #f8f9fa;
  --bg-secondary: #f1f3f5;
  --bg-tertiary: #e9ecef;
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  /* Professional slate/gray color scheme */
  --accent: #475569;
  --accent-hover: #334155;
  --accent-light: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --border: #d1d5db;
  --shadow: rgba(0, 0, 0, 0.06);
  --shadow-hover: rgba(0, 0, 0, 0.12);
  --shadow-large: rgba(71, 85, 105, 0.15);
  --overlay: rgba(0, 0, 0, 0.5);
  --radius: 16px;
  --radius-sm: 10px;
}

[data-theme="dark"] {
  /* Premium dark slate theme like GitHub/Apple */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  /* Increased contrast for better text visibility in dark mode */
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-tertiary: #cbd5e1;
  --accent: #94a3b8;
  --accent-hover: #cbd5e1;
  --accent-light: #475569;
  /* End contrast improvements */
  --success: #34d399;
  --warning: #fbbf24;
  --border: #334155;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-hover: rgba(0, 0, 0, 0.5);
  --shadow-large: rgba(100, 116, 139, 0.25);
  --overlay: rgba(0, 0, 0, 0.8);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  /* Solid border instead of gradient */
  border-bottom: 2px solid var(--accent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px var(--shadow);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  /* Solid color instead of gradient text */
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.search-container {
  flex: 1;
  position: relative;
  max-width: 500px;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

.search-input {
  width: 100%;
  padding: 0.625rem 1rem 0.625rem 2.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Removed old icon-btn styles and added new smooth toggle switch */
/* Modern iOS-style toggle switch */
.theme-toggle {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 32px;
  cursor: pointer;
}

.theme-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: 100px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  padding: 0 6px;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.theme-toggle input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.theme-toggle input:checked + .toggle-slider::before {
  transform: translateX(28px);
  background: #fff;
}

.toggle-icon {
  position: absolute;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-tertiary);
}

.sun-icon {
  left: 8px;
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.moon-icon {
  right: 8px;
  opacity: 0;
  transform: rotate(180deg) scale(0.5);
}

.theme-toggle input:checked + .toggle-slider .sun-icon {
  opacity: 0;
  transform: rotate(-180deg) scale(0.5);
}

.theme-toggle input:checked + .toggle-slider .moon-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  color: white;
}

.theme-toggle:hover .toggle-slider {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Removed old icon-btn styles */
.icon-btn {
  display: none;
}

[data-theme="light"] .moon-icon,
[data-theme="dark"] .sun-icon {
  /* Keep for compatibility but toggle handles this now */
}

/* Buttons */
.btn-primary,
.btn-secondary {
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

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

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
}

/* Hero Section */
.hero {
  max-width: 900px;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
  text-align: center;
  position: relative;
}

/* Removed gradient background effect */

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  line-height: 1.1;
}

.hero-subtitle {
  font-size: 1.375rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Filter Bar */
.filter-bar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 2rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

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

.chip {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
}

.chip.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sort-select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
}

.project-count {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* New Featured Carousel Styles */
.featured-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 2rem;
  position: relative;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  padding: 0;
  /* Solid color instead of gradient */
  color: var(--accent);
  display: inline-block;
}

.featured-carousel-wrapper {
  position: relative;
  margin-bottom: 2rem;
}

.featured-carousel {
  display: flex;
  gap: 2.5rem;
  overflow: hidden;
  scroll-behavior: smooth;
  position: relative;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px var(--shadow-hover);
}

.carousel-nav:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-50%) scale(1.1);
}

.carousel-nav.prev {
  left: -28px;
}

.carousel-nav.next {
  right: -28px;
}

.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
}

.indicator.active {
  width: 32px;
  border-radius: 4px;
  background: var(--accent);
}

/* Projects Grid */
.projects-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem 4rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  /* Increased gap to 3rem to prevent cards from touching */
  gap: 3rem;
}

/* Project Card */
/* Cải thiện bố cục Project Card và nút bấm */
.project-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%; /* Đảm bảo các card cao bằng nhau trong cùng một hàng */
}

.project-image {
  width: 100%;
  height: 220px;
  position: relative;
  overflow: hidden;
}

.project-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.project-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1; /* Chiếm hết phần còn lại của card */
}

.project-actions {
  margin-top: auto; /* Đẩy nút xuống dưới cùng của card */
  padding-top: 1rem;
}

.btn-small.primary {
  width: 100%; /* Nút bấm chiếm hết chiều ngang card */
  padding: 0.8rem;
  display: block;
  text-align: center;
}
/* Removed gradient border effect on hover */
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px var(--shadow-large);
  border-color: var(--accent);
}

.project-thumbnail {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: var(--bg-tertiary);
  transition: transform 0.4s ease;
}

.project-card:hover .project-thumbnail {
  transform: scale(1.05);
}

.project-info {
  padding: 1.5rem;
  /* Added flex properties to ensure consistent layout */
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  /* Limit title to 2 lines for consistency */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  min-height: 3.25rem;
}

.project-tagline {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  /* Limit tagline to 3 lines for consistent card heights */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
  min-height: 4.5rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  /* Fixed height for tags area */
  min-height: 2.5rem;
}

.tag {
  padding: 0.375rem 0.875rem;
  /* Solid background instead of gradient */
  background: var(--accent-light);
  /* Better contrast for tags in both light and dark mode */
  color: var(--text-primary);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.project-card:hover .tag {
  /* Simple color transition on hover */
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.project-actions {
  display: flex;
  gap: 0.5rem;
  /* Push actions to bottom of card */
  margin-top: auto;
}

.btn-small {
  width: 100%;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  text-decoration: none;
  border: none;
  position: relative;
  overflow: hidden;
}

/* Solid background instead of gradient */
.btn-small.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px var(--shadow-large);
}

.btn-small.primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--shadow-large);
}

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

.btn-small.secondary:hover {
  background: var(--bg-tertiary);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-primary);
  border-radius: var(--radius);
  max-width: 1200px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1001;
  animation: modalSlideUp 0.3s ease;
}

.modal-small {
  max-width: 600px;
}

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

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Increased z-index to prevent overlap with content */
  z-index: 100;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-tertiary);
  transform: rotate(90deg);
}

.modal-body {
  padding: 2rem;
}

.modal-body h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

.modal-body p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* Project Detail Modal */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

.detail-gallery {
  position: sticky;
  top: 2rem;
  height: fit-content;
}

.gallery-main {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-tertiary);
  margin-bottom: 1rem;
}

.gallery-main img,
.gallery-main video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumbs {
  display: flex;
  /* Increased gap between gallery thumbnails */
  gap: 1rem;
  overflow-x: auto;
}

.thumb {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.thumb:hover {
  border-color: var(--accent);
}

.thumb.active {
  border-color: var(--accent);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-info h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.detail-info .project-tags {
  margin-bottom: 2rem;
}

.detail-description {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.8;
}

.detail-section {
  margin-bottom: 2rem;
}

.detail-section h3 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.detail-section ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-section ul li {
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.detail-section.highlights ul {
  flex-direction: column;
  gap: 0.75rem;
}

.detail-section.highlights ul li {
  padding-left: 1.5rem;
  position: relative;
  background: transparent;
  border: none;
}

.detail-section.highlights ul li::before {
  content: "•";
  position: absolute;
  left: 0.5rem;
  color: var(--accent);
  font-weight: bold;
}

.detail-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.similar-projects {
  margin-top: 3rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}

.similar-projects h3 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

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

/* About Modal */
.about-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 2rem;
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.link:hover {
  color: var(--accent-hover);
}

/* Add Project Form */
.add-project-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.add-project-form input,
.add-project-form select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
}

.add-project-form input:focus,
.add-project-form select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Added error message styling */
.error-message {
  color: #ef4444;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: none;
}

.error-message.show {
  display: block;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  background: var(--text-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px var(--shadow-hover);
  z-index: 2000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Skeleton Loading */
.skeleton-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.skeleton-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  max-width: 1400px;
  width: 90%;
}

.skeleton-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 400px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  /* Solid border instead of gradient */
  border-top: 2px solid var(--accent);
  margin-top: 6rem;
  padding: 4rem 2rem 2rem;
  box-shadow: 0 -4px 16px var(--shadow);
  position: relative;
}

/* Removed gradient background effect */

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 4rem;
  margin-bottom: 3rem;
  position: relative;
  z-index: 1;
}

.footer-brand h3 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  /* Solid color instead of gradient text */
  color: var(--accent);
}

.footer-brand p {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 1rem;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.footer-column h4 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.footer-column a {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 0.875rem;
  transition: all 0.3s ease;
  font-size: 0.9375rem;
  position: relative;
  padding-left: 0;
}

/* Added animated underline effect on hover */
.footer-column a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  /* Solid color underline effect */
  background: var(--accent);
  transition: width 0.3s ease;
}

.footer-column a:hover::after {
  width: 100%;
}

.footer-column a:hover {
  color: var(--accent);
  transform: translateX(4px);
}

.footer-bottom {
  max-width: 1400px;
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-bottom p {
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* Responsive */
/* Complete rewrite of responsive media queries to fix mobile layout issues */
/* Tablet and smaller devices (768px and below) */
@media (max-width: 768px) {
  .header-content {
    padding: 1rem 1rem;
    gap: 1rem;
  }

  .logo {
    font-size: 1.25rem;
  }

  .search-container {
    flex: 1;
    max-width: 200px;
  }

  .search-input {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  }

  .header-actions {
    gap: 0.5rem;
  }

  .hero {
    padding: 3rem 1rem 2rem;
  }

  .hero-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
  }

  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }

  .filter-bar {
    padding: 1rem 1rem 0.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .filter-chips {
    width: 100%;
    gap: 0.5rem;
  }

  .filter-controls {
    width: 100%;
    gap: 0.5rem;
  }

  .sort-select {
    flex: 1;
  }

  .project-count {
    width: 100%;
    text-align: left;
  }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0.5rem 1rem 2rem;
  }

  .project-card {
    margin: 0;
  }

  .featured-carousel-wrapper {
    margin-bottom: 1rem;
  }

  .carousel-nav {
    display: none;
  }

  .featured-carousel {
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .featured-carousel > * {
    scroll-snap-align: start;
    min-width: 100%;
  }

  .modal-content {
    width: 95%;
    max-height: 95vh;
    border-radius: 12px;
  }

  .detail-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .detail-gallery {
    position: static;
  }

  .detail-info h1 {
    font-size: 1.75rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-links {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* Mobile devices (480px and below) */
@media (max-width: 480px) {
  .header-content {
    padding: 0.75rem 0.75rem;
    gap: 0.75rem;
  }

  .logo {
    font-size: 1rem;
  }

  .search-container {
    display: none;
  }

  .header-actions {
    gap: 0.5rem;
  }

  .theme-toggle {
    width: 50px;
    height: 28px;
  }

  .toggle-slider::before {
    height: 18px;
    width: 18px;
  }

  .theme-toggle input:checked + .toggle-slider::before {
    transform: translateX(22px);
  }

  .hero {
    padding: 2rem 0.75rem 1.5rem;
  }

  .hero-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
  }

  .hero-subtitle {
    font-size: 0.875rem;
    margin-bottom: 1rem;
  }

  .hero-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }

  .filter-bar {
    padding: 0.75rem 0.75rem 0.5rem;
    gap: 0.75rem;
  }

  .filter-chips {
    gap: 0.5rem;
    justify-content: flex-start;
  }

  .chip {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0.5rem 0.75rem 1.5rem;
  }

  .project-card {
    border-radius: 12px;
  }

  .project-image {
    height: 180px;
  }

  .project-content {
    padding: 1rem;
  }

  .project-name {
    font-size: 1rem;
  }

  .project-tagline {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
  }

  .btn-small {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }

  .modal-content {
    width: 95%;
    border-radius: 10px;
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-close {
    width: 32px;
    height: 32px;
    top: 1rem;
    right: 1rem;
  }

  .detail-info h1 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .footer {
    padding: 2rem 1rem 1rem;
    margin-top: 3rem;
  }

  .footer-content {
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .footer-brand h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
  }

  .footer-brand p {
    font-size: 0.875rem;
  }

  .footer-links {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .footer-column h4 {
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .footer-column a {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
  }

  .about-links {
    flex-direction: column;
    gap: 1rem;
  }

  .link {
    font-size: 0.875rem;
  }
}
