.projects {
  position: relative;
  background: transparent;
}

.projects-subtitle {
  max-width: 640px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.85;
}

.projects-slider {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 1rem;
}

.projects-track-wrapper {
  overflow: hidden;
  border-radius: 36px;
}

.projects-track {
  display: flex;
  gap: 1.25rem;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.project-card {
  flex: 0 0 calc(50% - 0.625rem);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.08);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease,
    background 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease;
  opacity: 0;
  transform: translateY(20px);
}

.project-card.animate-in {
  opacity: 1;
  transform: translateY(0);
}

.project-card:hover {
  transform: translateY(-8px);
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
}

.project-image {
  height: 220px;
  min-height: 220px;
  position: relative;
  overflow: hidden;
  background: #111;
}

.project-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.18), transparent 45%);
  pointer-events: none;
}

.card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-number {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 30px;
  padding: 0 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 1px solid rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.project-info {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: clamp(1rem, 2.2vw, 1.3rem);
}

.project-category {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.project-info h3 {
  margin-bottom: 0.65rem;
  font-size: clamp(1.3rem, 2.3vw, 1.75rem);
  letter-spacing: -0.04em;
}

.project-info p {
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: 1rem;
  max-width: 34rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(17, 17, 17, 0.08);
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  font-family: 'Fira Code', monospace;
  font-size: 0.72rem;
  font-weight: 600;
}

.project-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: auto;
  flex-wrap: wrap;
}

.project-link {
  flex: 1;
  min-width: 110px;
  text-align: center;
  justify-content: center;
  white-space: nowrap;
  width: fit-content;
  min-height: 42px;
  margin-top: auto;
  padding: 0 1rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  transition: transform 220ms ease, box-shadow 220ms ease, opacity 220ms ease;
}

.project-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.demo-link {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(17, 17, 17, 0.1);
}

.demo-link:hover {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
  border-color: rgba(37, 99, 235, 0.18);
}

.slider-btn {
  width: 52px;
  height: 52px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.slider-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow-md);
}

.slider-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.slider-dots {
  margin-top: 1.7rem;
  display: flex;
  justify-content: center;
  gap: 0.55rem;
}

.slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 0;
  background: rgba(17, 17, 17, 0.18);
  cursor: pointer;
  transition: var(--transition);
}

.slider-dot.active {
  width: 30px;
  background: var(--text);
}

/* Hover Video Integration styles */
.card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--transition);
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 1;
}

.project-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  z-index: 0;
  transition: opacity 320ms ease;
}

.project-card:hover .card-thumb {
  opacity: 1;
}

.project-card:hover .project-video {
  opacity: 0;
  visibility: hidden;
}

/* Animations */
.project-card.animate-in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 580ms ease, transform 580ms ease, box-shadow var(--transition), border-color var(--transition), background var(--transition);
}

/* Dark Mode Overrides */
body.dark-mode .project-card {
  border-color: rgba(255, 255, 255, 0.10);
  background: linear-gradient(180deg, rgba(21, 23, 26, 0.88), rgba(21, 23, 26, 0.68));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

body.dark-mode .project-card:hover {
  border-color: rgba(96, 165, 250, 0.28);
  background: rgba(21, 23, 26, 0.96);
}

body.dark-mode .project-number {
  background: rgba(21, 23, 26, 0.86);
  color: var(--text);
  border: 1px solid var(--line);
}

body.dark-mode .tag {
  background: rgba(21, 23, 26, 0.72);
  border-color: var(--line);
}

body.dark-mode .project-link {
  background: var(--text);
  color: var(--surface);
}

body.dark-mode .demo-link {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

body.dark-mode .demo-link:hover {
  background: var(--accent);
  color: var(--surface);
}

body.dark-mode .slider-btn,
body.dark-mode .tag {
  background: rgba(21, 23, 26, 0.72);
}

body.dark-mode .slider-dot.active {
  background: var(--text);
  color: var(--surface);
}

/* Media Queries */
@media (max-width: 992px) {
  .project-card {
    flex: 0 0 100%;
  }
}

@media (max-width: 768px) {
  .projects-slider {
    grid-template-columns: 44px 1fr 44px;
    gap: 0.5rem;
  }
  .slider-btn {
    display: inline-grid;
    width: 42px;
    height: 42px;
  }
  .projects-track-wrapper {
    border-radius: 28px;
  }
  .project-card {
    grid-template-rows: 240px 1fr;
    border-radius: 28px;
  }
  .project-info {
    padding: 1.2rem;
  }
}

@media (max-width: 560px) {
  .projects-slider {
    grid-template-columns: 38px 1fr 38px;
    gap: 0.35rem;
  }
  .slider-btn {
    width: 36px;
    height: 36px;
    font-size: 0.78rem;
  }
  .project-card {
    grid-template-rows: 210px 1fr;
    border-radius: 26px;
  }
  .project-info h3 {
    font-size: 1.45rem;
  }
  .project-number {
    left: 0.85rem;
    top: 0.85rem;
    min-width: 46px;
    height: 34px;
    font-size: 0.75rem;
  }
  .projects-subtitle {
    font-size: 0.94rem;
  }
}

/* Responsive rules moved from css/style.css to keep section styles together */
@media (max-width: 992px) {
  .project-card { flex: 0 0 100%; }
}

@media (max-width: 768px) {
  .projects-slider { grid-template-columns: 44px 1fr 44px; gap: 0.5rem; }
  .slider-btn { display: inline-grid; width: 42px; height: 42px; }
  .projects-track-wrapper { overflow: hidden; border-radius: 28px; }
  .projects-track { flex-direction: row; }
  .project-card { flex: 0 0 100%; width: 100%; grid-template-rows: 240px 1fr; border-radius: 28px; }
  .project-info { padding: 1.2rem; }
  .slider-dots { display: flex; }
}

@media (max-width: 560px) {
  .projects-slider { grid-template-columns: 38px 1fr 38px; gap: 0.35rem; }
  .slider-btn { width: 36px; height: 36px; font-size: 0.78rem; }
  .project-card { grid-template-rows: 210px 1fr; border-radius: 26px; }
  .project-info h3 { font-size: 1.45rem; }
  .project-number { left: 0.85rem; top: 0.85rem; min-width: 46px; height: 34px; font-size: 0.75rem; }
  .projects-subtitle { font-size: 0.94rem; }
}