@font-face {
    font-family: 'RelativeDensity';
    src: url('./font/relative_density.woff2') format('woff2');
    font-display: swap;
}

/* 기본 스타일 */
* {
    box-sizing: border-box;
}

body {
    font-family: "Noto Sans KR", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    margin: 0;
    padding: 0;
    background: #f2f4f9;
    min-height: 100vh;
    word-break: keep-all;
    hyphens: none;
}

/* 모바일 레이아웃 기본 숨김 */
.mobile-layout {
    display: none;
}

/* 데스크톱 레이아웃 */
.desktop-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 40px;
}

.container {
    width: 800px;
    height: 600px;
    margin-bottom: 100px;
    margin-top: 180px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 2px;
    width: 100%;
    height: 100%;
    background: #f2f4f9;
    padding: 2px;
    transition: grid-template-columns 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                grid-template-rows 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.work-cell {
    background: rgb(255, 255, 255);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.5s ease;
    position: relative;
    overflow: hidden;
}

.work-cell.expanded {
    cursor: zoom-in;
    background: rgb(255, 255, 255);
}

.work-cell.expanded:hover {
    background: rgb(255, 255, 255);
}

.work-cell.expanded .work-number {
    color: #666;
}

.work-cell.expanded:hover .work-number {
    color: #666;
}

/* 채도 감소 효과 추가 */
.work-cell.desaturated {
    filter: saturate(0.95);
    opacity: 0.6;
}

.work-cell.desaturated .work-image {
    filter: grayscale(0.1);
}

/* 작가 필터링 효과 */
.work-cell.artist-filtered {
    filter: saturate(0.2);
    opacity: 0.3;
}

.work-cell.artist-filtered .work-image {
    filter: grayscale(0.8);
}

/* hover 효과를 desaturated 상태가 아니고 expanded 상태가 아닐 때만 적용 */
.work-cell:not(.desaturated):not(.expanded):not(.artist-filtered)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
    pointer-events: none;
}

.work-cell:not(.desaturated):not(.expanded):not(.artist-filtered):hover::before {
    opacity: 1;
}

.work-cell:not(.desaturated):not(.expanded):not(.artist-filtered):hover {
    background: #ffffff;
}

/* desaturated 상태일 때의 hover 효과 - 원래 상태로 복원 */
.work-cell.desaturated:hover {
    filter: saturate(1);
    opacity: 1;
}

.work-cell.desaturated:hover .work-image {
    filter: grayscale(0);
}

/* 작가 필터링 상태일 때의 hover 효과 */
.work-cell.artist-filtered:hover {
    filter: saturate(1);
    opacity: 1;
}

.work-cell.artist-filtered:hover .work-image {
    filter: grayscale(0);
}

.work-number {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 12px;
    font-weight: bold;
    color: #666;
    z-index: 3;
    transition: color 0.3s ease;
}

.work-cell:hover .work-number {
    color: #333;
}

.work-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.5s ease;
}

.header1 {
    position: fixed;
    left: 0;
    top: 0;
    width: 200px;
    height: 100%;
    padding: 0;
    background: #f2f4f9;
    text-align: left;
    margin-left: 50px;
}

.header1 h2 {
    font-family: 'RelativeDensity', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 45px;
    font-weight: normal;
    margin: 0;
    padding: 40px 0;
    line-height: 0.9;
    cursor: pointer;
}

.header1 h2:hover {
    color: blue;
    transition: 0.3s ease;
    text-shadow: 0 0 6px #06ef7a;
}

.header1 p{
    line-height: 1.4;
    font-size: 11.5pt;
    padding-top: 40px;
}

.highlight{
  color: blue;
  animation: neon-glow 1s infinite alternate;
}

@keyframes neon-glow {
  from {
    text-shadow: none;
  }
  to {
    text-shadow: 0 0 6px #06ef7a;
  }
}

.header1 ul {
    list-style: none;
    padding: 0;
    margin-top: 60px;
    font-size: 11pt;
}

.header1 li {
    padding: 5px 10px;
    margin: 20px 0;
    margin-right: 85px;
    cursor: pointer;
    transition: color 0.3s ease, background-color 0.3s ease, transform 0.3s ease;
    position: relative;
    background-color: transparent;
    border: 1.4px solid black;
    border-radius: 50px;
    text-align: center;
}

.header1 li:hover {
    color: white;
    background-color: blue;
    border-color: blue;
    transition: 0.3s ease;
    transform: translateX(10px);
    text-shadow: 0 0 4px #00ff0d;
}

.header1 li.active {
    color: white;
    background-color: blue;
    border-color: blue;
    text-shadow: 0 0 4px #00ff0d;
}

.header2 {
    position: fixed;
    right: 0;
    top: 60px;
    width: 200px;
    height: 100%;
    padding: 0;
    margin-right: 6vh;
    background: #f2f4f9;
    text-align: left;
    font-family: 'D2Coding';
}

.header2 p{
    line-height: 1.4;
    font-size: 11.5pt;
    padding-top: 15px;
}

/* 툴팁 스타일 - 최대 너비 설정 */
.tooltip {
    position: fixed;
    background: #000;
    color: #fff;
    padding: 8px 12px;
    font-size: 12px;
    max-width: 250px;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tooltip.show {
    opacity: 1;
}

.cell-info {
    margin-top: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cell-info.show {
    opacity: 1;
}

.cell-info h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
    font-weight: normal;
    font-family: "Noto Sans KR", sans-serif;
}

.cell-info p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    font-family: "Noto Sans KR", sans-serif;
}

.view-detail-button {
    padding: 5px 10px;
    margin: 10px 0;
    margin-right: 85px;
    cursor: pointer;
    transition: color 0.3s ease;
    position: relative;
    background-color: transparent;
    border: 1.4px solid black;
    border-radius: 50px;
    font-size: 11pt;
    text-align: center;
    display: inline-block;
    font-family: "Noto Sans KR", sans-serif;
}

.view-detail-button:hover {
    color: white;
    background-color: blue;
    border-color: blue;
    transition: 0.3s ease;
    transform: translateX(10px);
    text-shadow: 0 0 4px #00ff0d;
}

.info {
    margin-top: 155px;
}

/* 팝업 스타일 */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

.popup-container {
    background: #f2f4f9;
    border: 1.4px solid black;
    border-radius: 20px;
    max-width: 1000px;
    width: 90%;
    max-height: 80vh;
    position: relative;
    overflow: hidden;
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.popup-overlay.show .popup-container {
    transform: scale(1);
}

.popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    z-index: 10;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: white;
    transition: all 0.3s ease;
    border: 1.4px solid black;
}

.popup-close:hover {
    background: blue;
    color: white;
    border-color: blue;
    text-shadow: 0 0 4px #00ff0d;
    transform: scale(1.1);
}

.popup-content {
    display: flex;
    height: 100%;
    min-height: 500px;
}

.popup-image-container {
    flex: 1;
    background: #f2f4f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 40px 30px;
}

.popup-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: block;
}

.popup-info {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #f2f4f9;
    position: relative;
}

.popup-title {
    font-size: 28px;
    font-weight: 400;
    color: #333;
    margin: 0 0 20px 0;
    font-family: "Noto Sans KR", sans-serif;
    line-height: 1.3;
}

.popup-number {
    font-size: 12px;
    color: #888;
    margin: 0 0 15px 0;
    font-weight: bold;
    font-family: "Noto Sans KR", sans-serif;
    display: block;
}

.popup-description {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    margin: 0;
    font-family: "Noto Sans KR", sans-serif;
    font-weight: 400;
}

/* 모바일 레이아웃 스타일 */
@media (max-width: 1300px) {
    .desktop-layout {
        display: none;
    }
    
    .mobile-layout {
        display: block;
        padding: 20px;
    }
    
    .mobile-header {
        text-align: center;
        margin-bottom: 40px;
    }
    
    .mobile-header h1 {
        font-family: 'RelativeDensity', -apple-system, BlinkMacSystemFont, sans-serif;
        font-size: 36px;
        font-weight: normal;
        margin: 0 0 20px 0;
        line-height: 0.9;
        cursor: pointer;
    }
    
    .mobile-header h1:hover {
        color: blue;
        transition: 0.3s ease;
        text-shadow: 0 0 6px #06ef7a;
    }
    
    .mobile-description {
        line-height: 1.4;
        font-size: 14px;
        margin: 0;
        color: #666;
    }
    
    .mobile-container {
        margin-bottom: 40px;
    }
    
    .mobile-grid-container {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(7, 1fr);
        gap: 2px;
        width: 100%;
        aspect-ratio: 1.4;
        background: #f2f4f9;
        padding: 2px;
        transition: grid-template-columns 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                    grid-template-rows 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .mobile-artists {
        margin-bottom: 40px;
    }
    
    .mobile-artists h3 {
        font-size: 18px;
        margin-bottom: 20px;
        color: #333;
    }
    
    .mobile-artist-list {
        list-style: none;
        padding: 0;
        margin: 0;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .mobile-artist-list li {
        padding: 8px 15px;
        cursor: pointer;
        transition: all 0.3s ease;
        background-color: transparent;
        border: 1.4px solid black;
        border-radius: 50px;
        text-align: center;
        font-size: 12px;
    }
    
    .mobile-artist-list li:hover,
    .mobile-artist-list li.active {
        color: white;
        background-color: blue;
        border-color: blue;
        text-shadow: 0 0 4px #00ff0d;
    }
    

}

/* 스마트폰 세로 모드 */
@media (max-width: 768px) {
    .mobile-layout {
        padding: 15px;
    }
    
    .mobile-header h1 {
        font-size: 28px;
        margin-bottom: 15px;
    }
    
    .mobile-description {
        font-size: 13px;
    }
    
    .mobile-grid-container {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(14, 1fr);
    }
    
    .mobile-artist-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .mobile-artist-list li {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    /* 팝업 모바일 조정 */
    .popup-container {
        width: 95%;
        max-height: 85vh;
    }
    
    .popup-content {
        flex-direction: column;
        min-height: 400px;
    }
    
    .popup-image-container {
        flex: 0 0 auto;
        max-height: 40vh;
        padding: 30px 20px 20px 20px;
    }
    
    .popup-info {
        padding: 30px;
        flex: 1;
    }
    
    .popup-title {
        font-size: 24px;
    }
    
    .popup-description {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .mobile-layout {
        padding: 10px;
    }
    
    .mobile-header h1 {
        font-size: 24px;
    }
    
    .mobile-description {
        font-size: 12px;
    }
    
    .mobile-grid-container {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(20, 1fr);
    }
    
    .popup-container {
        width: 95%;
        max-height: 90vh;
        border-radius: 15px;
    }
    
    .popup-content {
        flex-direction: column;
        min-height: 350px;
    }
    
    .popup-image-container {
        padding: 25px 15px 15px 15px;
        max-height: 35vh;
    }
    
    .popup-info {
        padding: 25px 20px;
    }
    
    .popup-title {
        font-size: 22px;
        margin-bottom: 15px;
    }
    
    .popup-description {
        font-size: 14px;
    }
    
    .popup-close {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
}