/* 为插件所有样式添加命名空间，防止与用户主题冲突 */
.hexo-apple-gallery {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #f5f5f7; 
    line-height: 1.6;
    margin: 2em auto;
    padding: 1em;
    background-color: #6e6e63; 
    border-radius: 12px;
}

.hexo-apple-gallery * {
    box-sizing: border-box;
}

/* 信息区域样式 */
.hexo-apple-gallery .gallery-info {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #8e8e93; 
}

.hexo-apple-gallery .gallery-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.hexo-apple-gallery .meta-data {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    color: #c7c7cc;
    font-size: 14px;
}

.hexo-apple-gallery .meta-item {
    display: flex;
    align-items: center;
}

.hexo-apple-gallery .gallery-info:empty,
.hexo-apple-gallery .meta-data:empty {
    display: none;
}

/* 瀑布流布局样式 */
.hexo-apple-gallery .masonry-gallery {
    column-gap: 16px;
}

.hexo-apple-gallery .gallery-item {
    break-inside: avoid;
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border: 1px solid #8e8e93;
}

.hexo-apple-gallery .gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.hexo-apple-gallery .gallery-image {
    width: 100%;
    height: auto;
    display: block;
}

.hexo-apple-gallery .gallery-empty-message {
    color: #c7c7cc;
}

/* “加载更多” 按钮样式 */
.hexo-apple-gallery .gallery-more-btn {
    display: block;
    width: fit-content;
    margin: 20px auto 0;
    padding: 8px 20px;
    background-color: rgba(0, 0, 0, 0.1);
    color: inherit; 
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.hexo-apple-gallery .gallery-more-btn:hover {
    background-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

/* 用于初始隐藏图片的类 */
.hexo-apple-gallery .gallery-item.initially-hidden {
    display: none;
}


/* --- 灯箱预览样式 --- */

.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 10px;
}

.gallery-lightbox.visible {
    opacity: 1;
    visibility: visible;
}

.gallery-lightbox-image {
    max-width: 95vw;
    max-height: calc(100vh - 120px); 
    object-fit: contain;
    cursor: default;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    transition: transform 0.3s ease;
    margin-bottom: 10px;
}

/* --- 预览导航和关闭按钮样式 --- */
.lightbox-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(30, 30, 30, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    z-index: 10000;
}

.lightbox-control:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.lightbox-prev {
    left: 15px;
}

.lightbox-next {
    right: 15px;
}

.lightbox-close {
    top: 15px;
    right: 15px;
    transform: none;
}

/* --- 缩略图列表样式 --- */
.lightbox-thumbnails {
    width: 100%;
    max-width: 80vw;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding-top: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.lightbox-thumbnails::-webkit-scrollbar {
    display: none;
}

.lightbox-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, opacity 0.2s ease;
    opacity: 0.6;
    flex-shrink: 0;
}

.lightbox-thumbnail:hover {
    opacity: 1;
}

.lightbox-thumbnail.active {
    border-color: #fff;
    opacity: 1;
}
