.container {
    grid-template-columns: 2.5fr auto 7.5fr;
    align-items: start;
}

.left-section {
    display: flex;
    flex-direction: column;
    padding-right: 0.5rem;
    padding-bottom: 3rem;
    position: sticky;
    top: 7rem;
    height: calc(100vh - 9rem);
    overflow-y: auto;
}

.left-section .intro-box {
    color: #17223F;
    font-size: 8rem;
    font-weight: 900;
    padding: 0;
    line-height: 1;
    background-color: transparent;
}

.divider {
    width: 1px;
    background-color: #17223F;
    height: auto;
    align-self: stretch;
    opacity: 0.6;
}

.right-section {
    display: flex;
    flex-direction: column;
    padding-left: 0.5rem;
    height: auto;
    overflow: visible;
    padding-bottom: 3rem;
}

.right-section .intro-box:not(:first-child) {
    margin-top: 3rem;
}

.support-note {
    line-height: 1.8;
    color: #17223F;
}

.category-switch {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: flex-start;
}

.category-label {
    font-size: 0.9rem;
    color: #888;
}

.filter-buttons {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1px;
    gap: 0 1.2rem;
    align-items: start;
}

.photo-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #eee;
    border: 1px solid #cfe1ec;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 1.2rem;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    grid-row-end: span 300;
}

.photo-card.hidden {
    opacity: 0;
    transform: translateY(30px);
    pointer-events: none;
}

.photo-media {
    position: relative;
}

.author-avatar {
    position: absolute;
    left: 0.8rem;
    bottom: -25px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    background-color: #fff;
}

.photo-card img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.photo-card img.author-avatar {
    width: 44px;
    height: 44px;
}

.photo-card:hover img {
    transform: scale(1.01);
}

.photo-caption {
    padding: 0.6rem 0.8rem;
    color: #333;
}

.author-header {
    padding-left: calc(44px + 0.4rem);
    padding-bottom: 0.2rem;
    margin-bottom: 0.5rem;
    margin-top: -0.4rem;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 700;
    color: #888;
    min-height: 1.2rem;
}

.author-name {
    font-size: 0.95rem;
    color: #999;
    font-weight: 600;
}

.photo-title {
    font-weight: 600;
    line-height: 1.5;
    font-size: 1.08rem;
    margin-bottom: 0.4rem;
    word-break: break-word;
}

.photo-title .cat-tag {
    color: #447593;
    margin-right: 0.3rem;
    white-space: nowrap;
}

body.dark-mode .photo-title .cat-tag {
    color: #80cbc4;
}

.photo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
}

.meta-chip {
    font-size: 0.8rem;
    color: #447593;
    background: #eef5f9;
    border: 1px solid #cfe1ec;
    border-radius: 12px;
    padding: 0.1rem 0.5rem;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    color: #999;
    font-size: 0.78rem;
}

.meta-icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    color: inherit;
    vertical-align: -0.1em;
}

.dynamic-filter-btn.active {
    background-color: #17223F;
    color: #f2ece0;
}

/* Dark Mode Tweaks */
body.dark-mode .divider {
    background-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .support-note {
    color: #DFDFD9;
}

body.dark-mode .photo-card {
    background: #2a2a2a;
    border: 1px solid #444;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

body.dark-mode .dynamic-filter-btn.active {
    background-color: #DFDFD9;
    color: #1a1a1a;
}

body.dark-mode .photo-caption {
    color: #DFDFD9;
}

body.dark-mode .meta-chip {
    color: #aaa;
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}

body.dark-mode .meta-item {
    color: #aaa;
}

body.dark-mode .author-avatar {
    border-color: #1a1a1a;
    background-color: #1a1a1a;
}

body.dark-mode .author-header {
    border-bottom-color: rgba(255,255,255,0.15);
    color: #DFDFD9;
}

@media (max-width: 1200px) {
    .container {
        grid-template-columns: 1fr !important;
        padding: 0 1.5rem;
        gap: 0.8rem;
    }

    .divider {
        display: none;
    }

    .left-section {
        position: static;
        height: auto;
        padding: 0;
        margin-top: 1rem;
    }

    .right-section {
        padding: 0;
    }

    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .left-section .intro-box {
        font-size: 4rem;
        margin-bottom: 0.5rem;
    }

    .category-switch {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 0 0.3rem;
    }

    .left-section, .right-section {
        padding: 0;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0 0.8rem;
    }

    .photo-card {
        margin-bottom: 0.8rem;
    }

    .photo-title {
        font-size: 0.95rem;
    }

    .author-avatar {
        width: 32px;
        height: 32px;
        bottom: -16px;
    }

    .author-header {
        padding-left: calc(32px + 0.3rem);
    }
}

.photo-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.photo-modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.photo-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.photo-modal-dialog {
    position: relative;
    width: fit-content;
    max-width: min(1300px, 96vw);
    max-height: 90vh;
    background: #f2ece0;
    border-radius: 0;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    z-index: 1;
    /* 初始缩放和偏移 */
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.photo-modal.active .photo-modal-dialog {
    transform: scale(1) translateY(0); 
}

.photo-modal-close {
    position: absolute;
    top: 0.6rem;
    right: 0.8rem;
    background: transparent;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: #17223F;
    z-index: 100;
}

.photo-modal-content {
    display: flex;
    flex-direction: row;
    gap: 0;
    padding: 0;
    height: auto;
    max-height: 90vh;
    align-items: stretch;
}

.modal-left {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #ebebeb;
    position: relative;
    justify-content: center;
}

.image-wrap {
    width: 100%;
    height: auto;
    min-height: 200px;
    border: 0;
    border-right: 1px solid #ddd;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: transparent;
}

.modal-image-track {
    display: flex;
    height: auto;
    width: 100%;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    align-items: center;
}

.modal-slide {
    flex: 0 0 100%;
    width: 100%;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.modal-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.3);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s, opacity 0.3s;
    z-index: 10;
    outline: none;
    opacity: 0;
}

.modal-nav-btn:hover {
    background: rgba(0,0,0,0.5);
}

.image-wrap:hover .modal-nav-btn,
.image-wrap.show-controls .modal-nav-btn {
    opacity: 1;
}

.prev-btn {
    left: 1rem;
}

.next-btn {
    right: 1rem;
}

.modal-counter {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    display: none;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.image-wrap:hover .modal-counter,
.image-wrap.show-controls .modal-counter {
    opacity: 1;
}

.modal-img {
    display: block;
    max-width: 100%;
    max-height: 90vh; 
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: default;
    margin: 0;
}

.modal-right {
    flex: 0 0 380px;
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    background: #f2ece0;
}

.modal-author {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem;
    background: inherit;
    z-index: 5;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.modal-author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.modal-author-name {
    color: #666;
}

.modal-title {
    font-size: 1.25rem;
    line-height: 1.5;
}

.modal-title .cat-tag {
    color: #447593;
    margin-right: 0.5rem;
    font-weight: 600;
}

body.dark-mode .modal-title .cat-tag {
    color: #80cbc4;
}

.modal-desc {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #444;
    margin-bottom: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 主创回复样式 */
.modal-reply-container {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding-top: 0.8rem;
    margin-top: 0.8rem;
    display: none;
}

.reply-badge {
    display: inline-block;
    background-color: #447593;
    color: #fff;
    font-size: 0.72rem;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.modal-reply-content {
    font-size: 0.92rem;
    line-height: 1.65;
    color: #444;
}

body.dark-mode .modal-reply-container {
    border-top-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .reply-badge {
    background-color: #80cbc4;
    color: #1a1a1a;
}

body.dark-mode .modal-reply-content {
    color: #ccc;
}

.modal-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    color: #777;
}

.modal-links {
    display: flex;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    border-top: 1px solid #e0e0e0;
    background: inherit;
}

.modal-links .link-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #447593;
    background: #eef5f9;
    border: 1px solid #cfe1ec;
    border-radius: 8px;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.modal-links .link-icon:hover {
    opacity: 0.85;
}

@media (max-width: 900px) {
    .photo-modal-dialog {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .photo-modal-content {
        display: flex;
        flex-direction: column;
        height: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        overflow: hidden;
    }

    .modal-left {
        flex: 0 0 auto;
        height: auto;
        max-height: 60vh;
        max-height: 60dvh;
    }

    .image-wrap {
        height: 100%;
        max-height: 60vh;
        max-height: 60dvh;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .modal-right {
        flex: 1;
        height: auto;
        min-height: 0;
        max-height: none;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .modal-img {
        max-height: 60vh;
        max-height: 60dvh;
        width: 100%;
        object-fit: contain;
    }

    .modal-body {
        padding: 1rem;
    }

    .photo-modal-close {
        top: calc(1rem + env(safe-area-inset-top));
        right: 1rem;
        width: 40px;
        height: 40px;
        background: rgba(0, 0, 0, 0.5);
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.8rem;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
        z-index: 101;
    }
}

body.dark-mode .photo-modal-dialog,
body.dark-mode .modal-right {
    background: #1a1a1a;
    color: #DFDFD9;
}

body.dark-mode .image-wrap {
    background: transparent;
    border-right-color: #444;
}

body.dark-mode .modal-left {
    background: #222;
}

body.dark-mode .photo-modal-close {
    color: #DFDFD9;
}

@media (max-width: 900px) {
    body.dark-mode .photo-modal-close {
        background: rgba(255, 255, 255, 0.2);
        color: white;
    }
}

body.dark-mode .modal-author {
    border-bottom-color: rgba(255,255,255,0.15);
}

body.dark-mode .modal-desc {
    color: #ccc;
}

body.dark-mode .modal-links {
    border-top-color: rgba(255,255,255,0.15);
}

body.dark-mode .modal-links .link-icon {
    color: #80cbc4;
    background: rgba(128,203,196,0.15);
    border-color: rgba(128,203,196,0.3);
}
