/* Magic Bento Grid Layout for Portfolio */
.magic-bento-section {
    padding: 80px 20px 60px;
    background: #1a1a1a;
    min-height: 100vh;
}

.magic-bento-container {
    margin: 0 auto;
}

.magic-bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    grid-auto-rows: minmax(180px, auto);
    grid-auto-flow: dense;
    align-content: start;
}

/* Different sized cards */
.bento-card {
    border-radius: 8px;
    padding: 0;
    background: #333;
    border: none;
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
}

/* Video background for bento cards - always visible */
.bento-card-video {
    display: none;
}

/* Video cards overlay */
.bento-card.has-video::before {
    background: rgba(0, 0, 0, 0.6);
}

.bento-card.has-video:hover::before {
    background: rgba(0, 0, 0, 0.3);
}

.bento-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
    transition: all 0.3s ease;
}

.bento-card > * {
    position: relative;
    z-index: 2;
}

.bento-card-content {
    padding: 20px;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    position: relative;
    z-index: 2;
}

.bento-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.bento-card:hover::before {
    background: rgba(0, 0, 0, 0.2);
}

/* Card sizes */
.bento-card.large {
    grid-column: span 2;
    grid-row: span 3;
    min-height: 380px;
}

.bento-card.wide {
    grid-column: span 2;
    grid-row: span 2;
    min-height: 280px;
}

.bento-card.tall {
    grid-column: span 1;
    grid-row: span 3;
    min-height: 380px;
}

.bento-card.small {
    grid-column: span 1;
    grid-row: span 3;
    min-height: 380px;
}

.bento-card.medium {
    grid-column: span 1;
    grid-row: span 2;
    min-height: 280px;
}

/* Card content */
.bento-card-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: #ffffff;
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.213px;
    font-family: 'SUIT', 'Inter', sans-serif;
    line-height: 1.3;
}

.bento-card-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 15px;
    font-family: 'SUIT', 'Inter', sans-serif;
}

.bento-card-description {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
    font-family: 'SUIT', 'Inter', sans-serif;
}

/* Tags */
.bento-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px;
    position: relative;
    z-index: 3;
}

.bento-tag {
    padding: 4px 8px;
    background-color: transparent;
    border: 1.5px solid #ffffff;
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: #ffffff;
    font-family: 'SUIT', 'Inter', sans-serif;
    transition: all 0.3s ease;
}

/* 태그 호버 효과 제거 */

/* 모든 카드에 Magic Bento 3D 효과 */
.bento-card {
    transform-style: preserve-3d;
    transition: transform 0.5s ease-out !important;
    will-change: transform;
}

/* 기존 호버 효과 무시 */
.bento-card:hover {
    transform: none !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
}

/* Responsive design */
@media (max-width: 1200px) {
    .magic-bento-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 800px) {
    .magic-bento-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        min-height: auto;
    }

    .bento-card.large,
    .bento-card.wide,
    .bento-card.tall,
    .bento-card.small,
    .bento-card.medium {
        grid-column: span 1;
        grid-row: span 1;
        min-height: 380px;
        height: 380px;
    }

    .bento-card-video {
        width: 100%;
        height: 100%;
        object-fit: cover;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 0;
    }

    .bento-card::before {
        background: rgba(0, 0, 0, 0.5);
        z-index: 1;
    }

    .bento-card-content {
        position: relative;
        z-index: 2;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    }

    .magic-bento-section {
        padding: 40px 10px 30px;
    }
}

/* Loading animation */
.bento-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.bento-card:nth-child(1) { animation-delay: 0.1s; }
.bento-card:nth-child(2) { animation-delay: 0.2s; }
.bento-card:nth-child(3) { animation-delay: 0.3s; }
.bento-card:nth-child(4) { animation-delay: 0.4s; }
.bento-card:nth-child(5) { animation-delay: 0.5s; }
.bento-card:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header styling for the bento grid */
.bento-header {
    text-align: center;
    margin-bottom: 60px;
    color: white;
}

.bento-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #ffffff;
    font-family: 'SUIT', 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.213px;
}

.bento-header p {
    font-size: 1rem;
    color: #909090;
    font-family: 'SUIT', 'Inter', sans-serif;
}

/* Magic Bento 섹션에서는 뒤로가기 버튼 및 화살표 숨기기 */
.magic-bento-section .back-nav {
    display: none;
}

.magic-bento-section::before,
.magic-bento-section::after,
.magic-bento-section *::before,
.magic-bento-section *::after {
    content: none !important;
}

/* 화살표가 포함된 모든 요소 숨기기 */
.magic-bento-section [class*="arrow"],
.magic-bento-section [class*="back"] {
    display: none !important;
}

/* Magic Bento 섹션에서 커스텀 커서 비활성화 */
.magic-bento-section ~ .custom-cursor {
    display: none !important;
}

/* Magic Bento 섹션이 활성화된 상태에서는 커스텀 커서 완전히 숨기기 */
body:has(.magic-bento-section) .custom-cursor {
    display: none !important;
}

/* Project Detail Modal Styles */
.project-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.project-detail-modal.active {
    opacity: 1;
    visibility: visible;
}

.project-detail-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.project-detail-modal .modal-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    background: transparent;
    border-radius: 20px;
    overflow: hidden;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.project-detail-modal.active .modal-content {
    transform: scale(1);
}

.project-detail-modal .modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.15);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    color: white;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.project-detail-modal .modal-close:hover {
    background: rgba(0, 0, 0, 0.3);
    transform: scale(1.1);
}

.project-detail-modal .modal-body {
    display: block;
    max-height: 95vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: transparent;
    padding: 0;
    margin: 0;
}

.project-detail-modal .modal-body::-webkit-scrollbar {
    display: none;
}

.project-detail-modal .modal-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 20px;
}