:root {
      --gallery-gap: 30px;
    }

    body {
      font-family: system-ui, -apple-system, sans-serif;
      background-color: #f8f9fa;
    }

    /* --- Gallery Grid System --- */
    .project-gallery {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: var(--gallery-gap);
    }

    .project-card {
      background: #fff;
      border-radius: 12px;
      overflow: hidden;
      box-shadow: 0 4px 15px rgba(0,0,0,0.05);
      transition: transform 0.3s ease, box-shadow 0.3s ease;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      height: 100%;
      border: 1px solid rgba(0,0,0,0.05);
    }

    .project-card:hover {
      transform: translateY(-8px);
      box-shadow: 0 12px 24px rgba(0,0,0,0.12);
    }

    .project-card:focus-visible {
      outline: 3px solid #0d6efd;
      outline-offset: 4px;
    }

    .project-card img {
      width: 100%;
      height: 220px;
      object-fit: cover;
    }

    .project-card-content {
      padding: 20px;
      flex-grow: 1;
      display: flex;
      flex-direction: column;
    }

    .project-card-content h3 {
      font-size: 1.25rem;
      font-weight: 600;
      margin-bottom: 10px;
      color: #212529;
    }

    .project-card-content p {
      font-size: 0.95rem;
      color: #6c757d;
      line-height: 1.5;
      display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;
      overflow: hidden;
      margin: 0;
    }

    /* --- Modal Styling --- */
    .modal-content {
      background-color: #1a1a1a;
      color: #fff;
      border: none;
      border-radius: 12px; 
      overflow: hidden; 
    }

    .modal-header {
      position: absolute;
      top: 15px;
      right: 15px;
      z-index: 1050;
      border: none;
      padding: 0;
      background: transparent;
    }

    .close-modal-btn {
      color: #ffffff;
      background-color: rgba(0, 0, 0, 0.5); 
      border-radius: 50%;
      width: 45px;
      height: 45px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.3s ease;
      border: none;
      padding: 0;
      font-size: 1.5rem;
    }

    .close-modal-btn:hover, 
    .close-modal-btn:focus {
      color: #ff4757 !important; 
      background-color: rgba(0, 0, 0, 0.8);
    }

    .modal-body {
      padding: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      min-height: 60vh;
      background-color: #000;
    }

    .modal-body img {
      max-width: 100%;
      max-height: 75vh;
      object-fit: contain;
    }

    .image-counter {
      position: absolute;
      bottom: 20px;
      left: 20px;
      background: rgba(0, 0, 0, 0.6);
      color: #fff;
      padding: 6px 14px;
      border-radius: 20px;
      font-size: 0.9rem;
      font-weight: 500;
      z-index: 10;
      backdrop-filter: blur(4px);
    }

    .modal-footer {
      border-top: 1px solid #333;
      padding: 20px 30px;
      background-color: #1a1a1a;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .modal-footer .project-info {
      text-align: left;
      max-width: 60%;
      margin-right: auto; 
    }

    .modal-footer .project-info h5 {
      font-weight: 600;
      margin-bottom: 5px;
      color: #fff;
    }

    .modal-footer .project-info p {
      font-size: 0.9rem;
      color: #adb5bd;
      margin: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .nav-buttons .nav-btn {
      width: 45px;
      height: 45px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      border-radius: 50%;
      font-size: 1.25rem;
    }

    /* --- Responsive Breakpoints --- */
    
    @media (max-width: 1199.98px) {
      .project-gallery { gap: 25px; }
    }

    @media (max-width: 991.98px) {
      .project-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
      }
      .modal-dialog { max-width: 90vw; }
    }

    @media (max-width: 767.98px) {
      .project-gallery {
        grid-template-columns: 1fr;
        gap: 20px;
      }
      .project-card img { height: 200px; }
      .modal-dialog {
        max-width: 95vw;
        margin: 0.5rem auto;
      }
      .modal-footer {
        flex-direction: column;
        text-align: center;
        padding: 15px;
      }
      .modal-footer .project-info {
        max-width: 100%;
        margin-right: 0;
        margin-bottom: 15px;
        text-align: center;
      }
      .nav-buttons {
        width: 100%;
        justify-content: center;
      }
      .image-counter {
        bottom: 10px;
        left: 10px;
        font-size: 0.8rem;
        padding: 4px 10px;
      }
    }