/* ---------------- PAGE LAYOUT ---------------- */

.projects-page {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
}

.projects-header {
    text-align: center;
    margin-bottom: 20px;
}

/* ---------------- GRID ---------------- */

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    width: 100%;
}

/* ---------------- CARD ---------------- */

.project-card {
    background: #262626;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.project-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.project-content {
    padding: 12px;
}

.project-title {
    margin: 0;
}

.project-description {
    font-size: 0.9rem;
    color: #aaa;
}

.modal-description {
    white-space: pre-line;
    line-height: 1.6;
}

/* ---------------- TAGS ---------------- */

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag {
    font-size: 0.75rem;
    background: #444;
    padding: 3px 8px;
    border-radius: 999px;
}

/* ---------------- AUDIO ---------------- */

.modal-audio {
    margin: 20px 0;
}

.audio-track p {
    font-weight: bold;
}

.audio-track audio {
    width: 100%;
}

.modal-audio {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audio-track {
    display: flex;
    align-items: center;
    gap: 0px;
}

.audio-title {
    flex: 0 0 160px;
    font-size: 0.9rem;
    color: #ddd;
    text-align: left;
}

.audio-track audio {
    flex: 1;
    height: 32px;
}
/* ---------------- FILTERS ---------------- */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 10px 0 25px;
}

.filter-button {
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 999px;
    border: none;
    background: #333;
    color: white;
    cursor: pointer;
}

.filter-button.active {
    background: #0077ff;
}

/* ---------------- MODAL ---------------- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none;
}

.modal-content {
    background: #1f1f1f;
    width: min(900px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    border-radius: 12px;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

/* gallery now simple vertical stack */
.modal-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
    justify-content: center;
}

.modal-gallery img {
    max-height: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.modal-gallery img:hover {
    transform: scale(1.03);
}

.project-links a {
    margin-right: 10px;
    color: #4da3ff;
}

.project-links a {
    display: inline-block;
    margin-right: 8px;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: #0077ff;
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
}

.project-links a:hover {
    background: #005fcc;
}

.image-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);

    display: flex;
    justify-content: center;
    align-items: center;

    z-index: 2000;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.image-modal img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;

    cursor: zoom-out;
}

.image-modal.hidden {
    display: flex;
    visibility: hidden;
}

.modal-gallery img {
    cursor: zoom-in;
}

.image-modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

/* ---------------- IMAGE FADE-IN ---------------- */
.project-image,
.modal-gallery img {
    opacity: 0;
    transition: opacity 0.3s ease;
}
.project-image.loaded,
.modal-gallery img.loaded {
    opacity: 1;
}
.image-modal img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.image-modal img.loaded {
    opacity: 1;
}
