/* Dedicated post view: details on the left, media on the right on desktop. */
.post-page .post-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "header" "media" "details" "discussion";
    gap: 20px;
    padding: 24px 0 0;
}

.post-page .image-header {
    grid-area: header;
    margin: 0;
    min-width: 0;
}

.post-page .image-header h1 {
    margin: 0 0 12px;
    font-size: clamp(26px, 3vw, 36px);
    line-height: 1.12;
    overflow-wrap: anywhere;
    text-align: left;
}

.post-page .image-meta {
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.7;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink-dim);
    overflow-wrap: anywhere;
}

.post-page .image-meta p {
    margin: 0;
}

.post-page .post-media {
    grid-area: media;
    min-width: 0;
}

.post-page .image-container-wrapper {
    margin: 0;
    gap: 12px;
}

.post-page .image-container {
    max-width: 100%;
    margin: 0;
}

.post-page .image-container > div,
.post-page .image-container > div > a {
    min-width: 0;
    max-width: 100%;
}

.post-page .image-container img,
.post-page .image-container video {
    max-height: min(70vh, 760px);
    max-height: min(70svh, 760px);
    max-width: 100%;
    object-fit: contain;
}

.post-page .youtube-container {
    margin: 0;
}

.post-page .youtube-container iframe {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
}

.post-page .post-nav-btn {
    width: 40px;
    height: 44px;
    border-radius: 4px;
    background: var(--bg-warm-elevated);
    color: var(--ink-dim);
}

.post-page .post-nav-btn span {
    transform: none;
    font-size: 24px;
    font-family: var(--font-body);
    font-weight: 500;
}

.post-page .post-nav-btn:hover {
    border-color: var(--color-primary);
    color: var(--ink);
}

.post-page .post-details {
    grid-area: details;
    min-width: 0;
}

.post-page .post-category {
    margin-bottom: 16px;
}

.post-page .image-description {
    color: var(--ink-dim);
    font-size: 15px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.post-page .image-description p {
    margin: 0 0 20px;
}

.post-page .post-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-warm);
}

.post-page .image-voting,
.post-page .download-section {
    margin: 0;
}

.post-page .vote-container {
    gap: 8px;
}

.post-page .vote-net-score {
    margin-left: 4px;
    width: auto;
    padding-top: 0;
}

.post-page .download-btn {
    min-height: 40px;
}

.post-page .download-dropdown {
    min-width: 210px;
    max-width: calc(100vw - 32px);
}

.post-page .image-galleries,
.post-page .image-actions {
    margin-top: 24px;
}

.post-page .image-galleries h3 {
    font-size: 14px;
    margin: 0 0 10px;
}

.post-page .image-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-page .post-discussion {
    grid-area: discussion;
    min-width: 0;
}

.post-page .comments-section {
    margin-top: 8px;
    margin-inline: 0;
    padding-top: 24px;
}

.post-page .comments-section h3 {
    margin-bottom: 20px;
}

.post-page .post-nav-btn:focus-visible,
.post-page .mobile-nav-btn:focus-visible,
.post-page .download-btn:focus-visible,
.post-page .download-dropdown a:focus-visible {
    outline: 2px solid var(--accent-green);
    outline-offset: 4px;
}

/* Side-by-side only on landscape screens; portrait/tall monitors keep the
   stacked layout so the media gets the full width. */
@media (min-width: 1000px) and (min-aspect-ratio: 5/4) {
    .post-page .post-layout {
        grid-template-columns: 260px minmax(0, 1fr);
        grid-template-areas: "header media" "details media" "discussion discussion";
        grid-template-rows: auto 1fr auto;
        column-gap: 32px;
        row-gap: 20px;
        align-items: start;
        padding-top: 32px;
    }

    .post-page .post-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .post-page .post-discussion {
        margin-top: 12px;
    }
}

/* Tall/portrait desktop screens: stacked layout with room for the media to grow. */
@media (min-width: 769px) and (max-aspect-ratio: 5/4) {
    .post-page .post-layout {
        padding-top: 32px;
    }

    .post-page .image-container img,
    .post-page .image-container video {
        max-height: min(75vh, 1400px);
        max-height: min(75svh, 1400px);
    }

    .post-page .image-description {
        max-width: 72ch;
    }
}

@media (max-width: 768px) {
    .post-page > .container {
        width: 100%;
        padding: 0 16px;
        margin: 0;
        box-sizing: border-box;
    }

    .post-page .post-layout {
        gap: 16px;
        padding-top: 18px;
    }

    .post-page .image-container img,
    .post-page .image-container video {
        max-height: 70vh;
        max-height: 70svh;
    }

    .post-page .mobile-nav-buttons {
        margin-top: 12px;
    }

    .post-page .comments-section {
        margin-top: 0;
    }
}
