:root {
    --ink: #17202c;
    --muted: #657386;
    --line: #dde3ea;
    --paper: #f6f8fb;
    --surface: #ffffff;
    --school-red: #a21f32;
    --school-red-dark: #7f1727;
    --gold: #b98a2d;
    --shadow: 0 14px 38px rgba(23, 32, 44, 0.1);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--paper);
    color: var(--ink);
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
    letter-spacing: 0;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(162, 31, 50, 0.055) 0, rgba(246, 248, 251, 0) 300px),
        var(--paper);
    font-size: 15px;
}

body.is-locked {
    overflow: hidden;
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 12px;
    z-index: 120;
    transform: translateY(-140%);
    border: 1px solid var(--school-red);
    border-radius: 6px;
    background: #fff;
    color: var(--school-red);
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 800;
    box-shadow: var(--shadow);
    transition: transform 0.18s ease;
}

.skip-link--gallery {
    left: 132px;
}

.skip-link:focus-visible {
    transform: translateY(0);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

:where(a, button, input, [tabindex]):focus {
    outline: none;
}

:where(a, button, input, [tabindex]):focus-visible {
    outline: 3px solid rgba(185, 138, 45, 0.72);
    outline-offset: 3px;
}

.album-card__button:focus-visible .album-card__media::after {
    opacity: 1;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid rgba(221, 227, 234, 0.86);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: min(1440px, calc(100% - 40px));
    min-height: 66px;
    margin: 0 auto;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand__mark {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid rgba(162, 31, 50, 0.16);
    border-radius: var(--radius);
    background: var(--school-red);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
}

.brand__text {
    display: grid;
    min-width: 0;
}

.brand__name {
    overflow: hidden;
    color: var(--ink);
    font-size: 17px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand__sub {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.site-header__link {
    flex: 0 0 auto;
    border: 1px solid rgba(162, 31, 50, 0.24);
    border-radius: 6px;
    padding: 9px 15px;
    color: var(--school-red);
    font-size: 14px;
    font-weight: 700;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.site-header__link:hover {
    border-color: var(--school-red);
    background: var(--school-red);
    color: #fff;
}

.album-shell {
    width: min(1440px, calc(100% - 40px));
    margin: 0 auto;
    padding: 30px 0 56px;
}

.album-head {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(221, 227, 234, 0.92);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(23, 32, 44, 0.075);
}

.album-head::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: var(--school-red);
    content: "";
}

.album-head__eyebrow {
    margin: 0;
    padding: 20px 28px 0 36px;
    color: var(--gold);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
}

.album-head__main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(330px, 0.44fr);
    gap: 26px;
    align-items: end;
    padding: 6px 28px 26px 36px;
}

.album-head h1 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(30px, 3.6vw, 48px);
    line-height: 1.1;
    letter-spacing: 0;
}

.album-head__lead {
    max-width: 660px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.75;
}

.album-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fbfcfe;
}

.album-stats div {
    min-width: 0;
    padding: 15px 14px;
}

.album-stats div + div {
    border-left: 1px solid var(--line);
}

.album-stats dt {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.album-stats dd {
    margin: 0;
    overflow: hidden;
    color: var(--ink);
    font-size: 17px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.album-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    margin-top: 20px;
}

.category-panel,
.gallery-section {
    border: 1px solid rgba(221, 227, 234, 0.96);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 28px rgba(23, 32, 44, 0.065);
}

.category-panel {
    position: sticky;
    top: 90px;
    overflow: hidden;
}

.category-panel__head,
.gallery-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    padding: 16px 18px;
}

.category-panel__head h2,
.gallery-toolbar h2 {
    margin: 0;
    color: var(--ink);
    font-size: 18px;
    line-height: 1.25;
}

.category-panel__head span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.category-list {
    display: grid;
    gap: 7px;
    padding: 12px;
}

.category-button {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    padding: 9px 11px;
    text-align: left;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.category-button:hover {
    border-color: rgba(162, 31, 50, 0.18);
    background: rgba(162, 31, 50, 0.06);
}

.category-button[aria-selected="true"] {
    border-color: rgba(162, 31, 50, 0.32);
    background: var(--school-red);
    color: #fff;
    box-shadow: 0 10px 20px rgba(162, 31, 50, 0.16);
}

.category-button__name {
    overflow-wrap: anywhere;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
}

.gallery-section {
    min-width: 0;
    overflow: hidden;
}

.gallery-toolbar {
    align-items: flex-end;
    background: #fff;
}

.gallery-toolbar__kicker {
    margin: 0 0 6px;
    color: var(--school-red);
    font-size: 12px;
    font-weight: 800;
}

.gallery-toolbar__summary {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

.keyboard-help {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    border-bottom: 1px solid var(--line);
    background: #fbfcfe;
    color: var(--muted);
    padding: 10px 18px;
    font-size: 12px;
    line-height: 1.5;
}

.keyboard-help strong {
    color: var(--ink);
    font-weight: 800;
}

.keyboard-help span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.keyboard-help kbd {
    min-width: 22px;
    border: 1px solid #cfd7e1;
    border-bottom-width: 2px;
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
    padding: 1px 5px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
}

.masonry {
    min-height: 460px;
    column-count: 4;
    column-gap: 16px;
    padding: 18px;
}

.masonry[aria-busy="true"] {
    cursor: progress;
}

.album-card {
    display: inline-block;
    width: 100%;
    margin: 0 0 16px;
    overflow: hidden;
    break-inside: avoid;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 8px 22px rgba(23, 32, 44, 0.075);
    content-visibility: auto;
    contain-intrinsic-size: 340px;
    vertical-align: top;
}

.album-card__button {
    display: block;
    width: 100%;
    border: 0;
    background: #edf1f5;
    padding: 0;
}

.album-card__media {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    background: linear-gradient(100deg, #eef2f6 0%, #f8fafc 45%, #eef2f6 100%);
}

.album-card__media::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(23, 32, 44, 0) 62%, rgba(23, 32, 44, 0.24) 100%);
    content: "";
    opacity: 0;
    transition: opacity 0.2s ease;
}

.album-card__button:hover .album-card__media::after {
    opacity: 1;
}

.album-card img {
    display: block;
    width: 100%;
    height: auto;
    opacity: 0;
    transform: scale(1.01);
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.album-card.is-loaded img {
    opacity: 1;
    transform: scale(1);
}

.album-card.is-broken .album-card__media {
    min-height: 200px;
}

.album-card.is-broken .album-card__media::before {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    color: var(--muted);
    content: "缩略图加载失败，点击尝试查看原图";
    font-size: 13px;
    font-weight: 700;
    padding: 18px;
    text-align: center;
}

.album-card figcaption {
    padding: 10px 12px 12px;
}

.album-card__title {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.album-card.is-skeleton {
    min-height: var(--skeleton-height, 300px);
    border-color: transparent;
    background: linear-gradient(100deg, #edf1f5 0%, #fbfcfe 45%, #edf1f5 100%);
    background-size: 220% 100%;
    box-shadow: none;
    animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position: 120% 0;
    }
    100% {
        background-position: -120% 0;
    }
}

.empty-state,
.error-state {
    display: grid;
    place-items: center;
    min-height: 320px;
    border: 1px dashed rgba(101, 115, 134, 0.35);
    border-radius: var(--radius);
    color: var(--muted);
    padding: 30px;
    text-align: center;
}

.error-state p {
    max-width: 440px;
    margin: 10px 0 0;
    font-size: 13px;
    line-height: 1.7;
}

.error-state button {
    margin-top: 16px;
    border: 1px solid var(--school-red);
    border-radius: 6px;
    background: var(--school-red);
    color: #fff;
    padding: 10px 16px;
    font-weight: 800;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-top: 1px solid var(--line);
    padding: 16px 18px 20px;
}

.pagination:empty {
    display: none;
}

.page-button,
.page-input {
    min-width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.page-button {
    padding: 0 11px;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.page-button:hover:not(:disabled),
.page-button[aria-current="page"] {
    border-color: var(--school-red);
    background: var(--school-red);
    color: #fff;
}

.page-button:disabled {
    color: #a4afbc;
    background: #f4f6f8;
}

.page-ellipsis {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 38px;
    color: var(--muted);
    font-weight: 800;
}

.page-jump {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.page-input {
    width: 68px;
    padding: 0 10px;
    text-align: center;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    grid-template-rows: 1fr;
    align-items: center;
    gap: 10px;
    padding: 34px 24px;
    background: rgba(12, 17, 24, 0.92);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.lightbox__figure {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 14px;
    width: 100%;
    max-width: 1180px;
    max-height: calc(100vh - 68px);
    margin: 0 auto;
}

.lightbox__image-wrap {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 0;
}

.lightbox__image-wrap.is-loading::after,
.lightbox__image-wrap.is-error::after {
    position: absolute;
    inset: auto auto 18px 50%;
    transform: translateX(-50%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(12, 17, 24, 0.7);
    color: rgba(255, 255, 255, 0.86);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
    content: "正在加载原图";
}

.lightbox__image-wrap.is-error::after {
    content: "原图加载失败";
}

.lightbox__image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 150px);
    border-radius: 4px;
    background: #111821;
    box-shadow: var(--shadow);
    object-fit: contain;
}

.lightbox__caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    line-height: 1.6;
}

.lightbox__caption-text {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.lightbox__caption-text span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#lightboxMeta,
.lightbox__status {
    color: rgba(255, 255, 255, 0.66);
    font-size: 12px;
}

.lightbox__status[data-type="error"] {
    color: #ffb8b8;
}

.lightbox__status[data-type="success"] {
    color: #c8f4d0;
}

.lightbox__download,
.lightbox__close,
.lightbox__nav {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.lightbox__download:hover:not(:disabled),
.lightbox__close:hover,
.lightbox__nav:hover:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.2);
}

.lightbox__download {
    flex: 0 0 auto;
    min-width: 92px;
    height: 38px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 800;
}

.lightbox__download:disabled {
    opacity: 0.6;
}

.lightbox__close {
    position: absolute;
    top: 22px;
    right: 24px;
    width: 42px;
    height: 42px;
    font-size: 30px;
    line-height: 1;
}

.lightbox__nav {
    width: 54px;
    height: 72px;
    font-size: 48px;
    line-height: 1;
}

.lightbox__nav:disabled {
    opacity: 0.28;
}

.lightbox__nav--prev {
    justify-self: end;
}

.lightbox__nav--next {
    justify-self: start;
}

.sr-only {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    margin: -1px;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    padding: 0;
}

@media (max-width: 1180px) {
    .album-head__main {
        grid-template-columns: 1fr;
    }

    .album-layout {
        grid-template-columns: 1fr;
    }

    .category-panel {
        position: static;
    }

    .category-list {
        display: flex;
        overflow-x: auto;
        padding-bottom: 14px;
    }

    .category-button {
        width: auto;
        min-width: 150px;
    }

    .masonry {
        column-count: 3;
    }
}

@media (max-width: 820px) {
    :root {
        --radius: 0;
    }

    body {
        background: #fff;
        font-size: 13px;
    }

    .site-header__inner {
        width: 100%;
        min-height: 56px;
        gap: 8px;
        padding: 0 12px;
    }

    .brand {
        gap: 8px;
    }

    .brand__mark {
        width: 34px;
        height: 34px;
        font-size: 11px;
    }

    .brand__name {
        max-width: 48vw;
        font-size: 14px;
    }

    .brand__sub {
        font-size: 11px;
    }

    .site-header__link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 32px;
        padding: 0 9px;
        font-size: 12px;
        white-space: nowrap;
    }

    .album-shell {
        width: 100%;
        padding: 0 0 34px;
    }

    .album-head,
    .category-panel,
    .gallery-section {
        border-right: 0;
        border-left: 0;
        box-shadow: none;
    }

    .album-head {
        border-top: 0;
    }

    .album-head::before {
        width: 4px;
    }

    .album-head__eyebrow {
        padding: 15px 14px 0 18px;
        font-size: 11px;
    }

    .album-head__main {
        gap: 14px;
        padding: 5px 14px 16px 18px;
    }

    .album-head h1 {
        font-size: 28px;
    }

    .album-head__lead {
        margin-top: 8px;
        font-size: 13px;
        line-height: 1.65;
    }

    .album-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .album-stats div {
        padding: 10px 8px;
    }

    .album-stats dt {
        margin-bottom: 5px;
        font-size: 10px;
    }

    .album-stats dd {
        font-size: 13px;
    }

    .album-layout {
        gap: 8px;
        margin-top: 8px;
    }

    .category-panel__head,
    .gallery-toolbar {
        padding: 12px 14px;
    }

    .category-panel__head h2,
    .gallery-toolbar h2 {
        font-size: 16px;
    }

    .category-panel__head span,
    .gallery-toolbar__summary,
    .gallery-toolbar__kicker {
        font-size: 11px;
    }

    .category-list {
        gap: 7px;
        padding: 10px 12px 12px;
    }

    .category-button {
        min-width: 126px;
        min-height: 36px;
        padding: 7px 9px;
    }

    .category-button__name {
        font-size: 12px;
    }

    .gallery-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .gallery-toolbar__summary {
        text-align: left;
    }

    .keyboard-help {
        gap: 6px 8px;
        padding: 9px 12px;
        font-size: 11px;
    }

    .keyboard-help kbd {
        min-width: 20px;
        padding: 1px 4px;
        font-size: 10px;
    }

    .masonry {
        min-height: 360px;
        column-count: 2;
        column-gap: 10px;
        padding: 10px;
    }

    .album-card {
        margin-bottom: 10px;
        box-shadow: none;
    }

    .album-card figcaption {
        padding: 8px 9px 9px;
    }

    .album-card__title {
        font-size: 12px;
        line-height: 1.45;
    }

    .empty-state,
    .error-state {
        min-height: 260px;
        border-right: 0;
        border-left: 0;
        padding: 24px 16px;
        font-size: 13px;
    }

    .pagination {
        flex-wrap: nowrap;
        justify-content: center;
        gap: 4px;
        overflow: hidden;
        padding: 10px 6px 12px;
    }

    .page-button,
    .page-input {
        min-width: 30px;
        height: 32px;
        font-size: 12px;
    }

    .page-button {
        padding: 0 7px;
    }

    .page-ellipsis {
        width: 12px;
        height: 32px;
        font-size: 12px;
    }

    .page-jump {
        display: none;
    }

    .lightbox {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
        padding: 64px 10px 16px;
    }

    .lightbox__figure {
        max-height: calc(100vh - 100px);
        gap: 10px;
    }

    .lightbox__image {
        max-height: calc(100vh - 182px);
    }

    .lightbox__caption {
        display: grid;
        justify-items: center;
        gap: 9px;
        font-size: 12px;
        text-align: center;
    }

    .lightbox__caption-text {
        width: 100%;
        justify-items: center;
    }

    .lightbox__download {
        display: none;
    }

    .lightbox__close {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
    }

    .lightbox__nav {
        position: fixed;
        bottom: 16px;
        width: 44px;
        height: 44px;
        font-size: 32px;
    }

    .lightbox__nav--prev {
        left: 10px;
    }

    .lightbox__nav--next {
        right: 10px;
    }

    .lightbox__image-wrap.is-loading::after,
    .lightbox__image-wrap.is-error::after {
        bottom: 12px;
        font-size: 12px;
    }

    .site-header__link,
    .brand__mark,
    .album-head,
    .album-stats,
    .category-panel,
    .gallery-section,
    .category-button,
    .album-card,
    .page-button,
    .page-input,
    .lightbox__image,
    .lightbox__download,
    .lightbox__close,
    .lightbox__nav,
    .empty-state,
    .error-state,
    .error-state button {
        border-radius: 0;
    }
}

@media (max-width: 560px) {
    .brand__sub {
        display: none;
    }

    .brand__name {
        max-width: 43vw;
        font-size: 13px;
    }

    .brand__mark {
        width: 32px;
        height: 32px;
    }

    .site-header__link {
        min-width: 54px;
        padding: 0 7px;
        font-size: 11px;
    }

    .album-head h1 {
        font-size: 26px;
    }

    .album-head__lead {
        font-size: 12px;
    }

    .masonry {
        column-count: 1;
    }

    .page-button,
    .page-input {
        min-width: 28px;
        height: 30px;
        font-size: 11px;
    }

    .page-button {
        padding: 0 6px;
    }
}

@media (max-width: 360px) {
    .brand__mark {
        display: none;
    }

    .brand__name {
        max-width: 54vw;
    }

    .site-header__inner {
        padding: 0 10px;
    }

    .page-button {
        min-width: 26px;
        padding: 0 5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
