/* ===== Projects Filter/Grid ===== */
.projects-filter-section { 
    background-color: #191919;
    padding: 20vh 16px 80px; 
}

.projects-filter-container { margin: 0 auto; padding: 0 vw; }

.filter-toolbar { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; 
    margin-bottom: 24px; 
}
.filter-button { padding: 10px 15px; border: 1px solid rgba(255, 239, 67, 0.3); background: transparent; color: rgba(255,255,255,0.7); cursor: pointer; transition: background .2s ease, color .2s ease, border-color .2s ease; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.filter-button:hover { background-color: rgba(255, 239, 67, 0.1); }
/* 활성(선택) 상태 - 전체와 동일 톤 */
.filter-button.is-active { background: rgba(255, 239, 67, 1); color: #191919; border-color: transparent; }

/* 전체 버튼 전용 */
.filter-button.is-all { background: transparent; border-radius: none; color: inherit; }
.filter-button.is-all.is-active { background: rgba(255, 239, 67, 0.1); color: #FFEF43; border-color: transparent; }

/* 태그 아이콘: 첫 번째(전체) 제외, 순서대로 지정 */
.filter-toolbar .filter-button:not(.is-all)::before { content: ''; display: inline-block; font-size: 14px; line-height: 1; }
.filter-toolbar .filter-button:nth-child(2)::before { content: '✦'; }
.filter-toolbar .filter-button:nth-child(3)::before { content: '✧'; }
.filter-toolbar .filter-button:nth-child(4)::before { content: '✱'; }
.filter-toolbar .filter-button:nth-child(5)::before { content: '✷'; }
.filter-toolbar .filter-button:nth-child(6)::before { content: '✸'; }
.filter-toolbar .filter-button:nth-child(7)::before { content: '✹'; }
.filter-toolbar .filter-button:nth-child(8)::before { content: '✽'; }
.filter-toolbar .filter-button:nth-child(9)::before { content: '✤'; }

/* Grid */
.projects-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 12px;
    position: relative; /* Flip 애니메이션을 그리드 내에서만 작동하도록 */
    min-height: 200px; /* 필터 적용 중에도 최소 높이 유지 */
}
@media (max-width: 1199px) { .projects-grid { grid-template-columns: 1fr; } }

/* Card */
.project-card { 
    position: relative; 
    aspect-ratio: 10 / 10; 
    overflow: hidden; 
    background-color: #191919;
    border: 1px solid #191919; 
    cursor: pointer;
    background: transparent;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
    transform: translateY(-2px);
    border-color:#FFEF43;
    background-color: #191919;
}

.project-card__media { 
    position: absolute; 
    inset: 0; 
    background-size: cover; 
    background-position: center; 
    transition: transform 0.3s ease;
}

.project-card:hover .project-card__media {
    transform: scale(0.8);
}

/* 장식 요소 */
.project-card__decoration {
    position: absolute;
    top: 50%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 2;
    pointer-events: none;
    font-size: 24px;
    color: #FFEF43;
    line-height: 1;
    transform: translateY(-50%);
}

.project-card:hover .project-card__decoration {
    opacity: 1;
    visibility: visible;
}

.project-card__decoration--top-left {
    left: 24px;
    transform: translate(-20px, -50%);
}

.project-card:hover .project-card__decoration--top-left {
    transform: translate(0, -50%);
}

.project-card__decoration--bottom-right {
    right: 24px;
    transform: translate(20px, -50%);
}

.project-card:hover .project-card__decoration--bottom-right {
    transform: translate(0, -50%);
}

.project-card__overlay { 
    position: absolute; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    padding: 14px; 
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.55) 100%); 
    color: #fff; 
    justify-content: space-between; 
    display: flex; 
    gap: 8px; 
    z-index: 1;
}

.project-card__title { margin: 0; font-size: 20px; font-weight: 500; }
.project-card__tags { display: flex; gap: 6px; flex-wrap: wrap; }
.project-card__tag { font-size: 14px; padding: 5px 10px; border: 1px solid rgba(255,255,255,1); background: rgba(17,24,39,.25); backdrop-filter: blur(2px); }

/* Filtering state */
.project-card.is-hidden { pointer-events: none; }

/* ===== Project Detail Modal ===== */
.project-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.project-detail-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.project-detail-modal__backdrop {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(4px);
}

.project-detail-modal__content {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    border: 1px solid rgba(255, 255, 255, 1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.project-detail-modal.is-open .project-detail-modal__content {
    transform: scale(1);
}

.project-detail-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, transform 0.2s ease;
    width: 45px;
    height: 45px;
}

.project-detail-modal__close:hover {
    color: #FFEF43;
    transform: rotate(90deg);
}

.project-detail-modal__close svg {
    width: 65px;
    height: 65px;
}

.project-detail-modal__body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.project-detail-modal__body::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.project-detail-modal__image-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.project-detail-modal__image {
    max-width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    animation: fadeIn 0.3s ease-in-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 로딩 스피너 */
.project-detail-modal__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    min-height: 300px;
}

.project-detail-modal__spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #FFEF43;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.project-detail-modal__loading-text {
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* 에러 메시지 */
.project-detail-modal__error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    min-height: 300px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}


/* 모바일 반응형 */
@media (max-width: 768px) {
    .project-detail-modal__content {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .project-detail-modal__close {
        top: 12px;
        right: 12px;
    }

    .project-detail-modal__body {
        padding: 16px;
    }
}
