/*
 * Optional compact card layout for post listings.
 * Loaded as a standalone stylesheet after the standard Alto CSS when the
 * "Post feed layout" theme setting is set to "Compact cards".
 *
 * Intentionally kept outside the Gulp bundle, so a downloaded Ghost theme
 * can switch layouts without recompiling the standard built assets.
 */

.content-area {
    width: 100%;
    max-width: 1440px;
    margin-inline: auto;
    padding-inline: 24px;
}

.post-feed {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    align-items: start;
}

.post-feed > .post {
    display: flex;
    align-self: start;
    flex-direction: column;
    min-width: 0;
    margin-bottom: 0;
    overflow: hidden;
    background-color: var(--white-color);
    border: 0;
    border-radius: 12px;
    box-shadow: var(--alto-card-shadow);
    transform: translateY(0);
    transition: box-shadow 0.24s ease, transform 0.24s ease;
}

@media (hover: hover) and (pointer: fine) {
    .post-feed > .post:hover {
        box-shadow: var(--alto-card-shadow-hover);
        transform: translateY(-4px);
    }
}

.post-feed > .post .post-media {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    overflow: hidden;
}

.post-feed > .post .post-media .u-placeholder {
    width: 100%;
}

/*
 * The featured card is two columns wide and its image is 62.5% of that width.
 * This image ratio plus a 176px text area keeps regular cards close to the
 * same height across the desktop grid.
 */
.post-feed > .post .post-media .u-placeholder.horizontal::before {
    padding-bottom: calc(125% - 161px);
}

.post-feed > .post > .gh-canvas {
    display: block;
    flex: 0 0 auto;
    box-sizing: border-box;
    min-width: 0;
    min-height: 176px;
    padding: 20px;
}

.post-feed > .post.no-image > .gh-canvas {
    padding-top: 28px;
}

.post-feed > .post .post-header {
    gap: 10px;
}

.post-feed > .post .post-title {
    display: -webkit-box;
    overflow: hidden;
    font-size: 1.8rem;
    font-weight: 750;
    line-height: 1.35;
    letter-spacing: -0.02em;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.post-feed > .post .post-meta {
    font-size: 1.1rem;
    line-height: 1.6;
}

.post-feed > .post .post-meta-item:not(:first-of-type)::before {
    padding-inline: 4px;
}

.post-feed > .post .post-excerpt {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 12px;
    font-size: 1.35rem;
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.post-feed > .post .post-title-link:focus-visible::after {
    outline: 2px solid var(--primary-color);
    outline-offset: -3px;
}

.post-feed > .post .post-meta-tags a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
}

.dark-mode .post-feed > .post {
    background-color: var(--alto-dark-card-background);
    border: 0;
}

@media (min-width: 768px) and (max-width: 991px) {
    .post-feed {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .content-area {
        padding-inline: 16px;
    }

    .post-feed {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .post-feed > .post .post-media .u-placeholder.horizontal::before {
        padding-bottom: 80%;
    }

    .post-feed > .post > .gh-canvas {
        min-height: 164px;
    }

    .post-feed > .post .post-title {
        font-size: 1.9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .post-feed > .post {
        transition: none;
    }
}
