/* Gallery — 往期封面墙（零间距平铺） */

html:has(.gallery-page),
body.gallery-page {
    margin: 0;
    padding: 0;
}

.gallery-page {
    min-height: 100vh;
    background: #000;
    overflow-x: hidden;
}

.gallery-page.is-active {
    overflow: hidden;
    height: 100vh;
}

/* 透明固顶导航 */
.gallery-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: transparent;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.gallery-topbar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.42) 0%,
        rgba(0, 0, 0, 0.12) 55%,
        transparent 100%
    );
    pointer-events: none;
    opacity: 0.85;
}

.gallery-topbar__brand,
.gallery-topbar__back {
    position: relative;
    z-index: 1;
    pointer-events: auto;
}

.gallery-topbar__brand {
    display: block;
    line-height: 0;
}

.gallery-topbar__logo {
    display: block;
    height: clamp(28px, 4.5vw, 38px);
    width: auto;
    max-width: min(72vw, 260px);
    object-fit: contain;
    object-position: left center;
    filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.45));
}

.gallery-topbar__back {
    flex-shrink: 0;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    opacity: 0.92;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    transition: opacity 0.2s ease;
}

.gallery-topbar__back:hover {
    opacity: 1;
}

.gallery-page.is-active .gallery-topbar {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-100%);
}

.gallery-mobile-hint {
    position: fixed;
    left: 50%;
    bottom: 2rem;
    z-index: 300;
    transform: translate(-50%, 12px);
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.96);
    color: #111;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.gallery-mobile-hint.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (min-width: 900px) {
    .gallery-mobile-hint {
        display: none;
    }
}

.gallery-main {
    width: 100%;
    margin: 0;
    padding: 0;
    transition: opacity 0.5s ease;
}

.gallery-page.is-active .gallery-main {
    opacity: 0.12;
    pointer-events: none;
}

/* 封面网格：零间距平铺，5:4 横版 */
.gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    width: 100%;
}

@media (min-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.gallery-card {
    --tilt-x: 0deg;
    --tilt-y: 0deg;
    position: relative;
    aspect-ratio: 5 / 4;
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    background: #111;
    transform-style: preserve-3d;
    perspective: 900px;
    transition: z-index 0s;
}

.gallery-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(35%) saturate(0.85);
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1),
                filter 0.45s ease;
    will-change: transform;
    transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(1);
}

.gallery-card__shine {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background:
        radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.35) 0%, transparent 52%),
        linear-gradient(125deg, transparent 40%, rgba(255, 255, 255, 0.12) 50%, transparent 60%);
    transition: opacity 0.35s ease;
    z-index: 2;
}

.gallery-card__overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: flex-end;
    padding: 1rem 1.1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.28) 52%, transparent 72%);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: none;
}

.gallery-card__overlay-inner {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.gallery-card__issue {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.gallery-card__headline {
    margin: 0;
    color: #fff;
    font-family: 'Noto Serif SC', serif;
    font-size: clamp(0.82rem, 1.35vw, 1rem);
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

/* 大屏 hover 触感 */
@media (min-width: 900px) and (hover: hover) {
    .gallery-card {
        z-index: 1;
    }

    .gallery-card:hover {
        z-index: 4;
    }

    .gallery-card:hover .gallery-card__shine {
        opacity: 1;
    }

    .gallery-card:hover .gallery-card__overlay {
        opacity: 1;
        transform: translateY(0);
    }

    .gallery-card:hover .gallery-card__img {
        transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(1.08);
        filter: grayscale(0%) saturate(1.12) brightness(1.06);
    }
}

.gallery-sentinel {
    grid-column: 1 / -1;
    height: 1px;
    pointer-events: none;
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 1rem;
    color: rgba(255, 255, 255, 0.45);
    font-style: italic;
}

/* 飞行封面（点击过渡） */
.gallery-flying-cover {
    position: fixed;
    z-index: 200;
    object-fit: cover;
    transition: top 0.65s cubic-bezier(0.23, 1, 0.32, 1),
                left 0.65s cubic-bezier(0.23, 1, 0.32, 1),
                width 0.65s cubic-bezier(0.23, 1, 0.32, 1),
                height 0.65s cubic-bezier(0.23, 1, 0.32, 1),
                opacity 0.3s ease;
    pointer-events: none;
}

.gallery-flying-cover.is-settled {
    opacity: 0;
}

/* 激活层 */
.gallery-stage {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    visibility: hidden;
}

.gallery-page.is-active .gallery-stage {
    pointer-events: auto;
    visibility: visible;
}

.gallery-mask {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, 0.62);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.gallery-page.is-active .gallery-mask {
    opacity: 1;
}

/* 左侧 dock：封面 + 期数 + 资讯列表 */
.gallery-dock {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(100%, 272px);
    padding: 1.25rem 1.15rem 5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transform: translateX(-110%);
    transition: transform 0.55s cubic-bezier(0.23, 1, 0.32, 1) 0.15s;
    z-index: 210;
    overflow: hidden;
}

.gallery-page.is-active .gallery-dock {
    transform: translateX(0);
}

.gallery-dock__cover-slot {
    width: 100%;
    aspect-ratio: 5 / 4;
    flex-shrink: 0;
    margin: 0 -0.15rem;
}

.gallery-dock__cover-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    filter: grayscale(100%);
    opacity: 0;
    transition: opacity 0.3s ease 0.5s;
}

.gallery-page.is-active .gallery-dock__cover-slot img {
    opacity: 1;
}

.gallery-dock__meta {
    color: #fff;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease 0.55s, transform 0.4s ease 0.55s;
    padding: 0.15rem 0 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.gallery-page.is-active .gallery-dock__meta {
    opacity: 1;
    transform: translateY(0);
}

.gallery-dock__issue-line {
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
    line-height: 1;
}

.gallery-dock__issue-num {
    font-family: 'Inter', sans-serif;
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.gallery-dock__issue-suffix {
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.72;
    letter-spacing: 0.12em;
}

.gallery-dock__date {
    margin: 0.55rem 0 0;
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.62);
}

.gallery-dock__news {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.45s ease 0.65s, transform 0.45s ease 0.65s;
}

.gallery-page.is-active .gallery-dock__news {
    opacity: 1;
    transform: translateY(0);
}

.gallery-dock__news-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.gallery-dock__news-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: rgba(255, 255, 255, 0.78);
}

.gallery-dock__refresh {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: transparent;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.35s ease;
}

.gallery-dock__refresh:hover {
    background: rgba(255, 255, 255, 0.12);
}

.gallery-dock__refresh.is-spinning svg {
    animation: gallery-spin 0.6s ease;
}

@keyframes gallery-spin {
    to { transform: rotate(360deg); }
}

.gallery-dock__news-list {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.gallery-dock__news-list::-webkit-scrollbar {
    width: 4px;
}

.gallery-dock__news-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
}

.gallery-dock__news-item {
    display: block;
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    line-height: 1.55;
    text-decoration: none;
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.gallery-dock__news-item:hover {
    color: #fff;
    padding-left: 4px;
}

.gallery-dock__news-empty {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    padding: 0.5rem 0;
}

/* 日报正文滑出层 */
.gallery-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 8vh;
    background: var(--paper-stock);
    border-top: 3px solid #1a1a1a;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.35);
    transform: translateY(105%);
    transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1) 0.2s;
    z-index: 205;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gallery-page.is-active .gallery-sheet {
    transform: translateY(0);
}

@media (min-width: 900px) {
    .gallery-sheet {
        left: 272px;
        top: 0;
    }
}

@media (max-width: 899px) {
    .gallery-dock {
        width: 38vw;
        max-width: 160px;
        padding: 0.85rem 0.65rem 5rem;
    }

    .gallery-dock__cover-slot {
        width: 100%;
        margin: 0;
    }

    .gallery-dock__issue-num {
        font-size: 1.5rem;
    }

    .gallery-dock__news-item {
        font-size: 0.78rem;
    }

    .gallery-sheet {
        left: 38vw;
        top: 0;
    }

    .gallery-sheet__inner {
        padding: 1rem 0.85rem 3rem;
    }
}

.gallery-sheet__scroll {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.gallery-sheet__inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 3rem;
}

@media (min-width: 600px) {
    .gallery-sheet__inner {
        padding: 2rem 2.75rem 4rem;
    }
}

@media (min-width: 1200px) {
    .gallery-sheet__inner {
        max-width: none;
        padding-left: 3rem;
        padding-right: 3.5rem;
    }
}

/* 返回按钮 */
.gallery-back {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 220;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.15rem;
    background: #1a1a1a;
    color: #fff;
    border: none;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 6px 6px 0 rgba(192, 57, 43, 0.85);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.35s ease 0.75s, transform 0.35s ease 0.75s, background 0.2s ease;
    pointer-events: none;
}

.gallery-page.is-active .gallery-back {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.gallery-back:hover {
    background: #c0392b;
}

.gallery-back svg {
    width: 14px;
    height: 14px;
}

/* 加载态 */
.gallery-loading {
    text-align: center;
    padding: 4rem 1rem;
    color: #888;
    font-style: italic;
}

.gallery-loading-dots::after {
    content: '';
    animation: gallery-dots 1.2s steps(4, end) infinite;
}

@keyframes gallery-dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
}
