.projects-section {
  width: 75%;
  margin: auto;
  height: 100vh;
  padding: 120px 0;
  cursor: default;
  user-select: text;
}

.projects-title {
  text-align: center;
  font-size: 5em;
  color: #28a4fa;
  opacity: 0.7;
  margin-bottom: 20px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 56px;
}

.controls input {
  padding: 12px 16px;
  font-size: 14px;
  border-radius: 10px;
  border: 1px solid #ddd;
}

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  border: none;
  background: #ffffff;
  color: #333333;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: lowercase;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  user-select: none;
  height: 30px;
  min-width: 60px;
}

.filter-btn:hover {
  background: #f0f0f0;
}

.filter-btn.active {
  background: #28a4fa;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(40, 164, 250, 0.3);
}

.controls select {
  margin-left: auto;
  padding: 10px 14px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid #ddd;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

.project-card {
  font-family: "Montserrat", sans-serif;
  transition: transform 0.25s ease-in-out;
}

.project-card:hover {
  transform: translateY(-6px);
}

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

.project-card h3 {
  color: #777;
  font-size: 16px;
  overflow: hidden;
}

.project-card p {
  font-size: 16px;
  margin-bottom: 10px;
  text-align: justify;
}

.meta {
  font-size: 13px;
  opacity: 0.55;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.project-card a {
  text-decoration: none;
  color: #28a4fa;
}

.pagination {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.pagination button {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 18px;
  cursor: pointer;
  user-select: none;
}

.pagination button:disabled {
  opacity: 0.3;
}


/* ========================= */
/* Desktop    */
/* ========================= */
@media (min-width: 1920px) {
  .projects-section {
    width: 95%;
  }
}


/* ========================= */
/* Tablet & small laptop    */
/* ========================= */
@media (max-width: 1024px) {
  .projects-section {
    width: 85%;
    padding: 100px 0;
    height: auto;
    min-height: 100vh;
  }

  .projects-title {
    font-size: 3.8em;
  }

  .projects-grid {
    gap: 32px;
  }
}

/* ========================= */
/* Tablet                    */
/* ========================= */
@media (max-width: 768px) {
  .projects-section {
    width: 90%;
    padding: 80px 0;
  }

  .projects-title {
    font-size: 3em;
    margin-bottom: 16px;
  }

  .controls {
    gap: 12px;
    margin-bottom: 40px;
  }

  .controls select {
    margin-left: 0;
  }

  .projects-grid {
    gap: 28px;
  }
}

/* ========================= */
/* Mobile                    */
/* ========================= */
@media (max-width: 480px) {
  .projects-section {
    width: 92%;
    padding: 60px 0;
    height: auto;
  }

  .projects-title {
    font-size: 2.2em;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .controls input,
  .controls select {
    width: 100%;
  }

  .filters {
    gap: 8px;
  }

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

  .pagination {
    justify-content: center;
  }
}

/* Modal styles - modern minimal, white background */
.project-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 260ms ease;
}
.project-modal.open {
  pointer-events: auto;
  opacity: 1;
}
.project-modal .modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 260ms ease;
}
.project-modal.open .modal-overlay { opacity: 1; }
.project-modal .modal-panel {
  position: relative;
  background: #ffffff;
  border-radius: 14px;
  width: min(500px, 75%);
  max-height: 92vh;
  overflow: hidden;
  box-shadow: 0 20px 48px rgba(12,20,30,0.20);
  transform: translateY(18px) scale(0.995);
  opacity: 0;
  transition: transform 300ms cubic-bezier(.2,.9,.2,1), opacity 260ms ease;
}
.project-modal.open .modal-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.project-modal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px;
  align-items: flex-start;
}
.project-modal .modal-media img {
  width: 520px;
  max-width: 48%;
  height: auto;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 8px 28px rgba(12,20,30,0.08);
}
.project-modal .modal-content {
  flex: 1 1 auto;
  overflow: auto;
  padding-right: 6px;
}
.project-modal h3 { color: #777; margin-top: 0; font-size: 1.6rem; margin-bottom:8px; }
.project-modal .modal-meta { font-size: 14px; opacity: .9; display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:16px; }
.project-modal .modal-meta.final-meta { margin-top:18px; }
.project-modal .modal-meta .meta-item { margin-right:8px; color:#777; font-weight:600; }
.project-modal #modal-description { font-size: 15.5px; line-height:1.75; color:#2b2b2b; margin-bottom:8px; }
.project-modal .modal-actions { margin-top: 8px; }
.project-modal .modal-close {
  position: absolute;
  right: 10px;
  top: 8px;
  background: transparent;
  border: none;
  font-size: 28px;
  line-height:1;
  padding: 8px 12px;
  cursor: pointer;
  color: #666;
}
.project-modal .btn { background: #28a4fa; color: #fff; padding: 8px 12px; border-radius: 8px; text-decoration:none; }

/* Support basic inline formatting inside description */
.project-modal #modal-description em { font-style: italic; }
.project-modal #modal-description strong { font-weight:700; }
.project-modal #modal-description b { font-weight:700; }
.project-modal #modal-description i { font-style: italic; }
.project-modal #modal-description a { color: #28a4fa; text-decoration: underline; }

/* Responsive modal layout */
@media (max-width: 720px) {
  .project-modal .modal-body { flex-direction: column; padding: 18px; }
  .project-modal .modal-media img { width: 100%; max-width: 100%; }
}

/* 40/60 layout: left column 40% (image 90% of that), right column 60% */
.project-modal .modal-media { flex: 0 0 40%; display:flex; flex-direction:column; align-items:center; gap:12px; }
.project-modal .modal-media img { width: 90%; max-width: 100%; }
.project-modal .modal-content { flex: 1 1 60%; }

/* Ensure modal uses Montserrat like the main cards */
.project-modal, .project-modal * { font-family: "Montserrat", sans-serif; }

/* Prevent body scroll when modal open */
body.modal-open { overflow: hidden; }
