/* ============================================================================
 * File    : portfolio.css
 * Desc    : 포트폴리오 탭, 게시물 카드/캐러셀, 게시물 모달, Coming Soon
 * ============================================================================ */

/* 포트폴리오 섹션 — 화면 전체 활용 */
#portfolio.section {
    min-height: 0 !important;
    padding-top: 80px;
    padding-bottom: 120px;
}

#portfolio .portfolio-tabs,
#portfolio .portfolio-tab-panels {
    padding-left: 16px;
    padding-right: 16px;
}

.portfolio-tabs {
    display: flex;
    justify-content: center;
    border-bottom: 2px solid #222;
    margin-bottom: 60px;
}

.portfolio-tab {
    background: transparent;
    border: none;
    color: #555;
    padding: 18px 48px;
    font-size: 1.33rem;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    transition: color 0.25s;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.portfolio-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    border-radius: 3px 3px 0 0;
    transition: background 0.25s;
}

.portfolio-tab:hover { color: #aaa; }

.portfolio-tab[data-tab="illustration"].active { color: #00B7A5; }
.portfolio-tab[data-tab="illustration"].active::after { background: #00B7A5; }

.portfolio-tab[data-tab="animation"].active { color: #007ACC; }
.portfolio-tab[data-tab="animation"].active::after { background: #007ACC; }

.portfolio-tab[data-tab="opensource"].active { color: #33CC99; }
.portfolio-tab[data-tab="opensource"].active::after { background: #33CC99; }

.tab-dot { font-size: 0.65rem; margin-right: 8px; vertical-align: middle; }
.dot-illustration { color: #00B7A5; }
.dot-animation    { color: #007ACC; }
.dot-opensource   { color: #33CC99; }

.portfolio-tab-panels { min-height: 200px; }

.portfolio-panel { display: none; animation: tabFadeIn 0.3s ease; }
.portfolio-panel.active { display: block; }

@keyframes tabFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* 그리드 레이아웃 (Gallery) */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(300px, 28vw, 500px), 1fr));
    gap: 30px;
    margin-bottom: 40px;
    margin-top: 40px;
}

/* ============================================================
 * 카드 — 이미지 풀 오버레이 디자인
 * ============================================================ */
.item-card {
    background: #111;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    height: 520px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 28px rgba(0,0,0,0.45);
    transition: transform 0.32s ease, box-shadow 0.32s ease;
}

.item-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 48px rgba(0,0,0,0.65);
}

/* 어드민 수정 버튼 (카드 우상단) */
.card-edit-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 6px;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 9px;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}
.item-card:hover .card-edit-btn { opacity: 1; }
.card-edit-btn:hover { background: rgba(0,183,165,0.7); }

/* 썸네일: 카드 상단 이미지 영역 */
.thumbnail-wrapper {
    position: relative;
    width: 100%;
    flex: 1;
    background: #111;
    overflow: hidden;
}

.thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease, opacity 0.4s ease;
    display: block;
}

.item-card:hover .thumbnail-wrapper img {
    transform: scale(1.07);
    opacity: 0.82;
}

/* 카드 하단 텍스트 영역 */
.item-info {
    position: relative;
    padding: 14px 18px 18px;
    background: #0f0f0f;
    height: 120px;
    overflow: hidden;
    flex-shrink: 0;
}

.item-info h4 {
    margin: 0 0 5px 0;
    font-size: 0.97rem;
    font-weight: 700;
    color: #fff;
}

.item-info p {
    margin: 0;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.55);
    line-height: 1.45;
    word-break: keep-all;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.3s ease;
}

.item-card:hover .item-info p {
    max-height: 80px;
    opacity: 1;
}

.item-time {
    display: block;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.35);
    margin-top: 6px;
}

/* ============================================================
 * 캐러셀 레이아웃
 * ============================================================ */
.carousel-wrapper {
    position: relative;
    padding: 0 52px;
}

.carousel-wrapper::before,
.carousel-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 16px;
    width: 15%;
    z-index: 5;
    pointer-events: none;
}

.carousel-wrapper::before {
    left: 52px;
    background: linear-gradient(to right, rgba(10,10,10,0.2) 0%, transparent 100%);
}

.carousel-wrapper::after {
    right: 52px;
    background: linear-gradient(to left, rgba(10,10,10,0.2) 0%, transparent 100%);
}

/* Swiper 오버라이드 */
.portfolio-swiper {
    width: 100%;
    overflow: hidden;
}

.portfolio-swiper .swiper-slide {
    height: auto;
}

.portfolio-swiper .item-card {
    width: 100%;
}

/* 글래스모피즘 화살표 */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-54%);
    width: 32px;
    height: 56px;
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: rgba(255,255,255,0.45);
    font-size: 1.4rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.25s ease;
}
.carousel-arrow:hover {
    background: rgba(0,183,165,0.14);
    border-color: rgba(0,183,165,0.45);
    color: var(--primary);
    box-shadow: 0 0 22px rgba(0,183,165,0.18);
}
.arrow-left  { left: 4px; }
.arrow-right { right: 4px; }

/* ============================================================
 * 아이템 모달 (이미지 / 게시물 / 비디오 공용)
 * ============================================================ */
.item-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.92);
    z-index: 9999;
    overflow-y: auto;
    padding: 60px 20px 40px;
    box-sizing: border-box;
    cursor: pointer;
    justify-content: center;
    align-items: flex-start;
}

.item-modal-close {
    position: fixed;
    top: 18px; right: 28px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2.4rem;
    cursor: pointer;
    z-index: 10001;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.item-modal-close:hover { opacity: 1; }

.item-modal-content {
    width: 100%;
    max-width: 860px;
    cursor: default;
    margin: auto;
}

.modal-img {
    width: 100%;
    height: auto;
    max-height: 80vh;
    border-radius: 12px;
    display: block;
    margin: 0 auto 8px;
    object-fit: contain;
}
.modal-caption {
    font-size: 0.78rem;
    color: #888;
    margin: 6px 0 22px 0;
    font-style: italic;
    letter-spacing: 0.2px;
    text-align: center;
}
.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    margin: 20px 0 12px 0;
}
.modal-body {
    font-size: 0.97rem;
    line-height: 1.85;
    color: #bbb;
    word-break: keep-all;
    margin: 0;
}

/* YouTube 임베드 (16:9) */
.modal-video {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-bottom: 4px;
}
.modal-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 12px;
}

/* 마크다운 렌더링 — 표 */
.modal-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.88rem;
}
.modal-body th, .modal-body td {
    border: 1px solid rgba(255,255,255,0.12);
    padding: 10px 14px;
    text-align: left;
}
.modal-body th {
    background: rgba(0,183,165,0.15);
    color: #fff;
    font-weight: 600;
}
.modal-body tr:nth-child(even) td { background: rgba(255,255,255,0.03); }

/* 마크다운 — 기타 요소 */
.modal-body strong { color: #fff; }
.modal-body ul, .modal-body ol { padding-left: 20px; margin: 8px 0; }
.modal-body li { margin-bottom: 4px; }
.modal-body p { margin: 0 0 8px 0; }
.modal-body a { color: var(--primary); }
.modal-body img { max-width: 100%; height: auto; border-radius: 8px; }

/* 재생 버튼 오버레이 (기본) */
.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    color: white;
    opacity: 0.8;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 2;
}

.item-card:hover .play-overlay {
    color: #00B7A5;
    opacity: 1;
}

/* 애니메이션 게시판 전용: 중복 버튼 해결 */
#grid-animation .item-card::before,
#grid-animation .item-card::after {
    content: none !important;
}

#grid-animation .play-overlay {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.8);
    opacity: 0;
    transition: 0.3s ease-in-out;
    z-index: 10;
    pointer-events: none;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#grid-animation .item-card:hover .play-overlay {
    opacity: 1;
    color: #00B7A5;
    transform: translate(-50%, -50%) scale(1.1);
}

/* ============================================================
 * 캐러셀 스크롤바 네비게이션 (이동하는 바)
 * ============================================================ */
.carousel-pagination {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: 3px !important;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin-top: 40px;
}

.carousel-pagination .swiper-scrollbar-drag {
    background: var(--primary);
    border-radius: 2px;
    height: 100%;
    cursor: grab;
}
.carousel-pagination .swiper-scrollbar-drag:active {
    cursor: grabbing;
}

#pagination-illustration .swiper-scrollbar-drag { background: #00B7A5; }
#pagination-animation    .swiper-scrollbar-drag { background: #007ACC; }
#pagination-opensource   .swiper-scrollbar-drag { background: #33CC99; }

/* ============================================================
 * 모달 이전/다음 내비게이션 버튼
 * ============================================================ */
.modal-nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.07);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: rgba(255,255,255,0.55);
    font-size: 2rem;
    width: 44px;
    height: 72px;
    cursor: pointer;
    z-index: 10002;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.22s ease;
}
.modal-nav-btn:hover {
    background: rgba(0,183,165,0.16);
    border-color: rgba(0,183,165,0.45);
    color: var(--primary);
    box-shadow: 0 0 20px rgba(0,183,165,0.15);
}
.modal-prev-btn { left: 16px; }
.modal-next-btn { right: 16px; }

/* 조회수 */
.modal-views {
    display: block;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.35);
    margin: 2px 0 14px 0;
}

/* ============================================================
 * 모바일 반응형
 * ============================================================ */
@media (max-width: 768px) {
    .portfolio-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 40px;
        scrollbar-width: none;
    }
    .portfolio-tabs::-webkit-scrollbar { display: none; }

    .portfolio-tab { padding: 14px 28px; font-size: 1rem; }

    .carousel-wrapper { padding: 0 36px; }
    .carousel-arrow { width: 26px; height: 44px; font-size: 1.1rem; }

    .thumbnail-wrapper { height: 220px; }

    .item-modal-overlay { padding: 50px 10px 30px; }
    .modal-nav-btn { width: 36px; height: 56px; font-size: 1.5rem; }
    .modal-prev-btn { left: 4px; }
    .modal-next-btn { right: 4px; }
}

/* ============================================================
 * Coming Soon (Surgery 등 콘텐츠 준비 중)
 * ============================================================ */
.coming-soon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 20px;
    text-align: center;
    background: #111;
    border-radius: 20px;
    border: 1px dashed #333;
    margin-top: 40px;
}

.coming-soon-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #e8a87c, #c0504a);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.coming-soon-container h2 {
    font-size: 2rem;
    color: white;
    margin-bottom: 15px;
    font-weight: 800;
}

.coming-soon-container p {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
}

.coming-soon-badge {
    background: #14b8a622;
    color: #14b8a6;
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 20px;
    border: 1px solid #14b8a644;
}

/* 모바일: 썸네일 1장씩, 화살표 숨김 */
@media (max-width: 639px) {
    .carousel-wrapper {
        padding: 0;
    }
    .carousel-wrapper::before,
    .carousel-wrapper::after {
        display: none;
    }
    .carousel-arrow {
        display: none;
    }
    .thumbnail-wrapper {
        height: 56vw;
        min-height: 180px;
        max-height: 280px;
    }
    .grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .portfolio-tab { padding: 12px 20px; font-size: 0.88rem; }
}