.container:has(.gallery-page) { min-width: 0; }
.main-content:has(.gallery-page) { min-width: 0; }
.gallery-page { padding: 20px; max-width: 960px; margin: 0 auto; container-type: inline-size; }

.gallery-page-title {
    text-align: center; margin-bottom: 18px; padding-bottom: 10px;
    border-bottom: 2px dashed #79ACC5;
}
.gallery-page-title h1 { font-size: 24px; color: #333; margin: 0 0 6px; }
.gallery-page-title p  { font-size: 13px; color: #555; margin: 0; }
.gallery-bbs-cta {
    display: inline-block; margin-top: 8px; font-size: 12px;
    padding: 4px 14px; background: #c0c0c0; border: 2px outset #fff;
    cursor: pointer; font-family: inherit; font-weight: bold;
}
.gallery-bbs-cta:hover { border-style: inset; background: #d0d0d0; }

/* ── 갤러리 래퍼 ── */
.gallery-list-wrap {
    border: 1px solid #a4c3d2; background: #eaf5f7; margin-bottom: 0;
}
.gallery-list-tb {
    background: linear-gradient(to right, #000080, #1084d0);
    color: #fff; padding: 4px 10px; font-weight: bold; font-size: 13px;
    display: flex; justify-content: space-between; align-items: center;
}
.gallery-list-tb .tb-info { font-size: 11px; font-weight: normal; opacity: 0.85; }

/* ── 그리드 ── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px 20px; padding: 20px;
}
.gallery-card {
    min-width: 0; border: 1px solid #c7c6ac; background: #fffdf2;
    cursor: pointer; display: flex; flex-direction: column;
}
.gallery-card:hover { border-color: #8baebb; }
.gallery-card-img-wrap {
    box-sizing: border-box; width: 100%; aspect-ratio: 1;
    padding: 0; border: 0; position: relative; flex-shrink: 0;
    background: #fffdf2; display: flex; align-items: center; justify-content: center;
}
.gallery-card-img-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery-card-info { border-top: 1px dotted #c7c6ac; padding: 9px 10px 10px; flex: 1; }
.gallery-card-subject {
    display: block; padding: 0; border: 0; background: none;
    text-align: left; font-weight: bold; line-height: 1.5; font-family: inherit; font-size: 13px;
    color: #0000aa; text-decoration: underline; text-underline-offset: 2px;
    overflow-wrap: anywhere; margin: 0 0 5px;
}
.gallery-card-subject:hover { color: #b34d28; }
.gallery-card-meta { font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.gallery-card-author { color: #35653d; }
.gallery-card-date { display: block; color: #77705e; }
.gallery-card-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 7px; }
.gallery-card-likes { font-size: 12px; color: #a04b61; }
.gallery-card .bbs-comment-count {
    margin: 0; padding: 2px 0; border: 0; background: transparent;
    line-height: 1.5; font-family: inherit; font-size: 12px; color: #0000aa; text-decoration: underline;
}
.gallery-page button:focus-visible { outline: 2px dotted #000080; outline-offset: 3px; }
/* Keep the monthly drawing in an ordinary album cell, with its existing frame. */
.gallery-page .monthly-illustration--tile { border: 1px solid #c7c6ac; background: #fffdf2; }
.gallery-page .monthly-illustration--tile .monthly-illustration-picture { background: #fffdf2; }
.gallery-page .monthly-illustration--tile .monthly-illustration-info { padding: 9px 10px 10px; border-top: 1px dotted #c7c6ac; }
.gallery-page .monthly-illustration--tile .monthly-illustration-subject { white-space: normal; overflow-wrap: anywhere; font-size: 13px; }
.gallery-page .monthly-illustration--tile .monthly-illustration-author { margin-top: 5px; }
.gallery-page .monthly-illustration--tile .monthly-illustration-likes { margin-top: 7px; }

/* ── 갤러리 입선 배지 ── */
.badge-gallery {
    display: inline-block; font-size: 9px; font-weight: bold;
    background: #fff4d0; border: 1px solid #d4a800; color: #9b7700;
    padding: 1px 4px; margin-right: 3px; vertical-align: middle;
}

/* ── 빈/로딩 상태 ── */
.gallery-status {
    text-align: center; padding: 36px 20px; color: #777; font-size: 14px;
    grid-column: 1 / -1;
}

/* ── 페이지네이션 ── */
.gallery-pagination {
    text-align: center; padding: 14px 8px;
    display: flex; gap: 5px; justify-content: center; flex-wrap: wrap;
    background: #f0f8ff; border: 1px solid #b8d4e8; border-top: none;
    margin-bottom: 4px;
}
.gallery-page-btn {
    min-width: 28px; min-height: 30px; padding: 3px 6px; border: 1px solid transparent;
    background: transparent; font: inherit; font-size: 12px; color: #0000aa; text-decoration: underline;
}
.gallery-page-btn:hover:not(:disabled) { background: #fffdf2; border-color: #c7c6ac; }
.gallery-page-btn.active { border: 1px inset #b8d4e8; background: #fffdf2; color: #554832; font-weight: bold; text-decoration: none; }
.gallery-page-btn:disabled { color: #777; text-decoration: none; }
.gallery-page-ellipsis { padding: 2px 4px; font-size: 12px; align-self: center; color: #888; }

/* ── 상태바 ── */
.gallery-statusbar {
    font-size: 11px; color: #555;
    padding: 3px 10px; background: #e8f4fb;
    border: 1px solid #b8d4e8; border-top: none;
    display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 20px;
}
.gallery-statusbar-item::before { content: '◆ '; color: #79ACC5; }

/* ── 아코디언 (보관함) ── */
.gallery-archive-wrap { border: 1px solid #b8d4e8; margin-bottom: 12px; }
.gallery-archive-tb {
    background: #d8ecf8; color: #335; border-bottom: 1px solid #b8d4e8;
    padding: 5px 10px; font-size: 13px; font-weight: bold;
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; user-select: none;
}
.gallery-archive-tb:hover { background: #c8e0f0; }
.gallery-archive-body { display: none; padding: 10px; background: #fff; }

/* ── 예전 갤러리 그리드 ── */
.old-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px; padding: 10px; background: #fff;
}
.old-gallery-item { border: 1px solid #cce0ee; overflow: hidden; }
.old-gallery-item img { width: 100%; height: 120px; object-fit: contain; background: #fffdf2; display: block; transition: opacity 0.15s; }
.old-gallery-item img:hover { opacity: 0.8; cursor: pointer; }


.gallery-farewell { text-align: center; font-size: 12px; color: #526e78; margin: 20px 0 4px; padding-top: 12px; border-top: 1px dashed #79acc5; }
.gallery-farewell span { color: #8b7849; }
.gallery-list-tb { gap: 8px; flex-wrap: wrap; }
@container (max-width: 660px) { .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; padding: 14px; } }
@container (max-width: 360px) { .gallery-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1000px) {
    .main-content:has(.gallery-page) { padding: 20px 14px; }
    .gallery-page { padding: 8px; }
}
@media (max-width: 700px) {
    .container:has(.gallery-page) { flex-direction: column; }
    .container:has(.gallery-page) > .sidebar { width: 100%; padding: 12px 16px; gap: 8px; }
    .container:has(.gallery-page) .menu-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }
    .container:has(.gallery-page) .menu-list li { margin: 0; padding: 0; }
    .container:has(.gallery-page) .menu-list a { font-size: 13px; }
    .container:has(.gallery-page) .link-info, .container:has(.gallery-page) .banner-area { display: none; }
    .main-content:has(.gallery-page) { border-left: 0; border-top: 3px ridge #ddd; padding: 16px 8px; }
    .gallery-page-title h1 { font-size: 21px; }
}
