/**
 * EOND Board — 갤러리 스킨 스타일
 *
 * default/style.css 가 베이스로 로드됩니다.
 * 이 파일은 갤러리 고유 스타일 + 오버라이드만 담습니다.
 */

/* =========================================
   목록 (list)
   ========================================= */

/* 갤러리 그리드 */
.eond-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 1.5em;
}

/* 카드 */
.eond-gallery-item {
    border: 1px solid var(--eb-border, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
    background: var(--eb-bg, #fff);
    transition: box-shadow 0.2s, transform 0.2s;
}

.eond-gallery-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* 썸네일 */
.eond-gallery-thumb {
    display: block;
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--eb-bg-subtle, #f7fafc);
}

.eond-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.eond-gallery-item:hover .eond-gallery-thumb img {
    transform: scale(1.05);
}

/* 재생 아이콘 오버레이 */
.eond-gallery-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 52px;
    height: 52px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    transition: background 0.2s, transform 0.2s;
    pointer-events: none;
}

.eond-gallery-play::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 54%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 9px 0 9px 16px;
    border-color: transparent transparent transparent #fff;
}

.eond-gallery-item:hover .eond-gallery-play {
    background: rgba(255, 0, 0, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

/* 카드 정보 */
.eond-gallery-info {
    padding: 12px 14px;
}

.eond-gallery-category {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    background: var(--eb-bg-subtle, #f7fafc);
    color: var(--eb-text-muted, #718096);
    margin-bottom: 6px;
    line-height: 1.4;
}

.eond-gallery-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    color: var(--eb-text-heading, #1a1a1a);
    text-decoration: none;
    margin-bottom: 8px;
    line-height: 1.5;
}

.eond-gallery-title:hover {
    color: var(--eb-focus-border, #3182ce);
}

.eond-gallery-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--eb-text-muted, #a0aec0);
}

.eond-gallery-meta span:not(:last-child)::after {
    content: '\00B7';
    margin-left: 6px;
    color: var(--eb-border, #e2e8f0);
}

/* 빈 목록 */
.eond-board-gallery .eond-empty {
    grid-column: 1 / -1;
}

/* =========================================
   글 보기 (view)
   ========================================= */

/* YouTube 영상 임베드 — 16:9 반응형 */
.eond-gallery-video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin-bottom: 1.5em;
    border-radius: 8px;
    background: #000;
}

.eond-gallery-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 8px;
}

/* 갤러리 뷰 — 헤더 보강 */
.eond-board-gallery-view .eond-view-header {
    margin-bottom: 1.5em;
}

/* 갤러리 뷰 — 본문 */
.eond-board-gallery-view .eond-view-content {
    padding: 1em 0 1.5em;
}

/* 갤러리 뷰 — 액션 버튼 */
.eond-board-gallery-view .eond-view-actions {
    margin-bottom: 0;
}

/* =========================================
   글쓰기/수정 (default write.php fallback)
   갤러리 컨텍스트에서의 폼 스타일 보강
   ========================================= */

.eond-board-gallery .eond-write-form,
.eond-board-gallery-view ~ .eond-write-form {
    max-width: 100%;
}

/* =========================================
   검색 + 하단 액션 오버라이드
   ========================================= */

.eond-board-gallery .eond-board-actions {
    padding-top: 0.5em;
}

.eond-board-gallery .eond-board-search input:focus {
    border-color: var(--eb-focus-border);
    box-shadow: 0 0 0 3px var(--eb-focus-ring);
    outline: none;
}

/* =========================================
   반응형
   ========================================= */

@media (max-width: 768px) {
    .eond-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .eond-gallery-play {
        width: 40px;
        height: 40px;
    }

    .eond-gallery-play::after {
        border-width: 7px 0 7px 12px;
    }

    .eond-gallery-info {
        padding: 10px;
    }

    .eond-gallery-title {
        font-size: 13px;
    }

    .eond-gallery-meta {
        font-size: 11px;
    }

    /* 글보기 — YouTube 영상 모서리 직각 */
    .eond-gallery-video {
        border-radius: 0;
        margin-left: -16px;
        margin-right: -16px;
    }

    .eond-gallery-video iframe {
        border-radius: 0;
    }
}

@media (max-width: 480px) {
    .eond-gallery-grid {
        grid-template-columns: 1fr;
    }

    .eond-gallery-thumb {
        aspect-ratio: 16/9;
    }
}

/* =========================================
   순서 변경 (Reorder) — 갤러리 카드
   ========================================= */

/* 갤러리 카드 오버레이 */
.eond-reorder-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.7);
    z-index: 5;
}

.eond-gallery-item {
    position: relative;
}

.eond-reorder-overlay .eond-reorder-badge {
    background: #fff;
    color: #1a1a1a;
}

.eond-reorder-overlay .eond-reorder-handle {
    color: #fff;
    cursor: grab;
}
.eond-reorder-overlay .eond-reorder-handle:active {
    cursor: grabbing;
}

.eond-reorder-arrows {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.eond-reorder-arrows button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 3px;
    color: #fff;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
}

.eond-reorder-arrows button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.4);
}

.eond-reorder-arrows button:disabled {
    opacity: 0.3;
    cursor: default;
}

/* 갤러리 리오더 모드 — 그리드 아이템 */
.eond-gallery-grid.eond-reorder-mode .eond-gallery-item {
    cursor: grab;
}
.eond-gallery-grid.eond-reorder-mode .eond-gallery-item:active {
    cursor: grabbing;
}
.eond-gallery-grid.eond-reorder-mode .eond-gallery-item:hover {
    transform: none;
}
