/*
 * 作品图集 · 前台样式
 *
 * 与 现代主题-超级模板 一致的黑白灰极简风；变量都给了兜底值，
 * 因此在其它模板下也能正常显示（只是配色跟随模板变量时才统一）。
 */

/*
 * 变量兜底优先取 现代主题-超级模板 的 token（--color-*、--font-serif），
 * 取不到才用自己的字面值，因此在其它模板下也能正常显示。
 */
:root {
    --wsg-gap: 20px;
    --wsg-fg: var(--color-text, #1a1a1a);
    --wsg-muted: var(--color-gray, #8a8580);
    --wsg-line: var(--color-border, rgba(26, 26, 26, .14));
    --wsg-bg: var(--color-bg, #ffffff);
    --wsg-alt: var(--color-section-alt, #f7f5f2);
    --wsg-accent: var(--color-black, #1a1a1a);
    --wsg-radius: 2px;
    --wsg-font: var(--font-serif, 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', Georgia, sans-serif);
}

/* ---------- 图库独立页外框 ---------- */
/*
 * 模板的 .ws-page 只有 900px 宽，装不下多列瀑布流，
 * 所以图库页用自己的 .wsg-page：宽度与间距沿用模板「整屏区块」的量感（上下 120/50/80）。
 */
.wsg-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 120px 50px 80px;
}

.wsg-head {
    margin-bottom: 40px;
    text-align: center;
}

.wsg-kicker {
    margin-bottom: 15px;
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--wsg-muted);
}

.wsg-title {
    font-family: var(--wsg-font);
    font-size: 42px;
    font-weight: 400;
    letter-spacing: 2px;
    line-height: 1.25;
    color: var(--wsg-accent);
}

.wsg-intro {
    max-width: 720px;
    margin: 18px auto 0;
    font-size: 15px;
    line-height: 1.9;
    color: var(--wsg-muted);
}

/* ---------- 按星期档期提示 ---------- */
.wsg-week-tip {
    margin: 16px 0 6px;
    font-size: 13px;
    color: var(--wsg-muted);
    letter-spacing: .04em;
}

.wsg-week-tip .wsg-week-empty {
    color: var(--wsg-fg);
}

/* ---------- 图库独立导航 ---------- */
/*
 * 图库页自己的一条导航：只放本插件的相册分类，与模板站点导航分开。
 * 相册不足两个时前台不输出这条导航（见 design_portfolio_show.php）。
 */
.wsg-nav {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 14px 24px;
    margin: 0 0 38px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--wsg-line);
}

.wsg-nav-albums {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---------- 相册分类胶囊（导航与卡片小标共用样式） ---------- */
.wsg-album {
    display: inline-block;
    padding: 6px 16px;
    font-size: 13px;
    letter-spacing: .06em;
    color: var(--wsg-muted);
    text-decoration: none;
    border: 1px solid var(--wsg-line);
    border-radius: 999px;
    transition: color .25s ease, border-color .25s ease, background-color .25s ease;
}

.wsg-album:hover,
.wsg-album.active {
    color: var(--wsg-bg);
    background: var(--wsg-accent);
    border-color: var(--wsg-accent);
    text-decoration: none;
}

/* ---------- 瀑布流网格 ---------- */
/*
 * 用多列（column-count）实现真正的瀑布流：每个卡片 break-inside:avoid，
 * 图片按自身高度自然错落，比 grid 更适合「原图尺寸」模式。
 */
.wsg-grid {
    columns: var(--wsg-cols, 4);
    column-gap: var(--wsg-gap);
    margin: 26px 0 8px;
}

.wsg-item {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    display: inline-block;
    width: 100%;
    margin: 0 0 var(--wsg-gap);
    padding: 0;
    position: relative;
    background: var(--wsg-bg);
    border: 1px solid var(--wsg-line);
    /* 圆角由后台「卡片圆角」控制：网格容器写入 --wsg-card-radius，其它组件仍用默认 --wsg-radius */
    border-radius: var(--wsg-card-radius, var(--wsg-radius));
    overflow: hidden;
    transition: box-shadow .3s ease;
}

/* 相册卡片阴影：默认关闭，后台开启后加一层很轻的投影，悬停时略加深 */
.wsg-grid.wsg-shadow .wsg-item {
    box-shadow: 0 10px 28px rgba(17, 17, 17, .08);
}

.wsg-grid.wsg-shadow .wsg-item:hover {
    box-shadow: 0 16px 40px rgba(17, 17, 17, .13);
}

.wsg-item .wsg-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.wsg-item:hover {
    border-color: var(--wsg-accent);
}

/* 图片容器：比例与填充色由内联 style 决定（值来自后台白名单） */
.wsg-media {
    display: block;
    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--wsg-alt);
}

.wsg-media img {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
}

/* 四种适配方式 */
.wsg-fit-original .wsg-media img {
    height: auto;
    object-fit: initial;
}

.wsg-fit-cover .wsg-media img {
    object-fit: cover;
}

.wsg-fit-stretch .wsg-media img {
    object-fit: fill;
}

.wsg-fit-pad .wsg-media img {
    object-fit: contain;
    padding: 0;
}

/* 文字条 */
.wsg-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px 11px;
}

.wsg-name {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--wsg-fg);
    letter-spacing: .02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 卡片上的相册小标（与筛选胶囊 .wsg-album 是两回事，类名必须分开） */
.wsg-item-album {
    font-size: 11px;
    letter-spacing: .08em;
    color: var(--wsg-muted);
    flex: none;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 下载 */
.wsg-dl {
    display: block;
    padding: 7px 12px 9px;
    font-size: 11.5px;
    letter-spacing: .08em;
    color: var(--wsg-muted);
    text-decoration: none;
    border-top: 1px dashed var(--wsg-line);
    transition: color .2s ease;
}

.wsg-dl:hover {
    color: var(--wsg-accent);
    text-decoration: none;
}

/* 关闭下载按钮、只显示文件大小：同一行位置，但不可点、不反色 */
.wsg-dl-static {
    cursor: default;
}

.wsg-dl-static:hover {
    color: var(--wsg-muted);
}

/* 首页区块里的图库稍作收紧 */
.ws-section .wsg-grid {
    margin-top: 22px;
}

/* ---------- 分页 ---------- */
.wsg-pager {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 30px 0 6px;
}

.wsg-pager a {
    min-width: 38px;
    padding: 8px 12px;
    text-align: center;
    font-size: 13px;
    color: var(--wsg-muted);
    text-decoration: none;
    border: 1px solid var(--wsg-line);
    border-radius: var(--wsg-radius);
}

.wsg-pager a:hover,
.wsg-pager a.active {
    color: var(--wsg-bg);
    background: var(--wsg-accent);
    border-color: var(--wsg-accent);
}

/* ---------- 空态 ---------- */
.wsg-empty {
    margin: 40px 0 60px;
    padding: 46px 20px;
    text-align: center;
    color: var(--wsg-muted);
    font-size: 14px;
    background: var(--wsg-alt);
    border: 1px dashed var(--wsg-line);
    border-radius: var(--wsg-radius);
}

.wsg-empty p {
    margin: 0 0 6px;
    color: var(--wsg-fg);
    font-size: 16px;
}

.wsg-empty .wsg-empty-sub {
    color: var(--wsg-muted);
    font-size: 13px;
}

/* ---------- 灯箱 ---------- */
.wsg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
    background: rgba(12, 12, 12, .94);
}

.wsg-lightbox.is-open {
    display: flex;
}

.wsg-lightbox figure {
    margin: 0;
    max-width: 100%;
    max-height: 100%;
    text-align: center;
}

.wsg-lightbox img {
    display: block;
    max-width: 100%;
    max-height: 72vh;
    margin: 0 auto;
    width: auto;
    height: auto;
    border-radius: 0;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}

.wsg-lightbox figcaption {
    margin: 14px auto 0;
    max-width: 70vw;
    font-size: 13px;
    letter-spacing: .06em;
    color: rgba(255, 255, 255, .78);
}

.wsg-lb-btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 22px;
    line-height: 1;
    color: rgba(255, 255, 255, .8);
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}

.wsg-lb-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, .18);
}

.wsg-lb-close {
    top: 18px;
    right: 18px;
}

.wsg-lb-prev {
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
}

.wsg-lb-next {
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
}

.wsg-lb-dl {
    bottom: 20px;
    right: 20px;
    width: auto;
    height: auto;
    padding: 9px 22px;
    font-size: 12px;
    letter-spacing: .1em;
    border-radius: 999px;
    text-decoration: none;
}

/* 序号（由 js/wsg.js 写入） */
.wsg-lb-num {
    position: absolute;
    top: 22px;
    left: 22px;
    font-size: 12px;
    letter-spacing: .14em;
    color: rgba(255, 255, 255, .62);
    pointer-events: none;
}

body.wsg-lb-lock {
    overflow: hidden;
}

/* ---------- 响应式（断点与模板 style.css 对齐：1024 / 768 / 480） ---------- */
@media (max-width: 1200px) {
    .wsg-grid {
        columns: 3;
    }
}

@media (max-width: 1024px) {
    .wsg-page {
        padding: 90px 30px 60px;
    }

    .wsg-title {
        font-size: 34px;
    }

    .wsg-grid {
        columns: 3;
    }
}

@media (max-width: 768px) {
    .wsg-page {
        padding: 70px 20px 50px;
    }

    /* 小屏放不下就横向滑，不折成两行把页头顶下去 */
    .wsg-nav {
        margin-bottom: 28px;
    }

    .wsg-nav-albums {
        flex-wrap: nowrap;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .wsg-nav-albums::-webkit-scrollbar {
        display: none;
    }

    .wsg-nav-albums .wsg-album {
        flex: none;
    }

    .wsg-title {
        font-size: 28px;
        letter-spacing: 1px;
    }

    .wsg-grid {
        columns: 2;
    }

    :root {
        --wsg-gap: 14px;
    }

    .wsg-lightbox img {
        max-height: 68vh;
    }
}

@media (max-width: 480px) {
    .wsg-grid {
        columns: 1;
    }

    .wsg-lb-prev {
        left: 8px;
    }

    .wsg-lb-next {
        right: 8px;
    }
}

/* 无障碍：用户要求减少动效时不做过渡 */
@media (prefers-reduced-motion: reduce) {
    .wsg-item,
    .wsg-album,
    .wsg-dl,
    .wsg-lb-btn {
        transition: none;
    }
}
