/*
 * Blog index and post archives as cards (IB-1302).
 * Loaded all year, only on the posts index and post archives.
 *
 * Older-audience rules (kept in sync by tests/japebo-themes/test-blog-index.php):
 *   - no text below 15px, running text 17px
 *   - click targets at least 44px, 48px where possible
 *   - no all-caps (the read-more link included)
 *
 * Theme colours (IB-1302): base.css paints every p/h1-h6/li with
 * var(--theme-text) !important and every plain link with
 * var(--theme-body-link, var(--theme-primary)) !important. In dark themes
 * (Black Week) those are light/yellow, which is unreadable on the white
 * cards. Plain colours here cannot win against !important, so each card
 * element redefines the custom properties locally instead. The page itself
 * (heading, pagination) sits on the theme background and keeps theme colours.
 */

body.japebo-blog-index,
body.japebo-blog-index #main,
body.japebo-blog-index #content {
    background: #fff;
}

.japebo-blog {
    font-size: 17px;
    line-height: 1.6;
    color: #222;
    padding-top: 24px;
    padding-bottom: 48px;
}

.japebo-blog__title {
    font-size: 34px;
    line-height: 1.2;
    margin: 0 0 28px;
    text-transform: none;
    letter-spacing: normal;
}

.japebo-blog__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
}

.japebo-blog-card {
    display: flex;
    flex-direction: column;
    margin: 0;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    /* The card is always white, so its text must be dark in every theme. */
    --theme-text: #333;
    --theme-body-link: #111;
    --theme-body-link-hover: #111;
}

.japebo-blog-card--no-image {
    border-top: 6px solid #1f6f8b;
}

.japebo-blog-card__image {
    display: block;
    aspect-ratio: 16 / 9;
    background: #f2f2f2;
    overflow: hidden;
}

.japebo-blog-card__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.japebo-blog-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 20px 22px 22px;
}

.japebo-blog-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    min-height: 44px;
    margin: 0 0 4px;
    font-size: 15px;
    line-height: 1.4;
    color: #555;
    --theme-text: #555;
}

.japebo-blog-card__category {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 15px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
    color: #1f6f8b;
    --theme-body-link: #1f6f8b;
    --theme-body-link-hover: #1f6f8b;
    text-decoration: none;
}

.japebo-blog-card__category:hover,
.japebo-blog-card__category:focus {
    text-decoration: underline;
}

.japebo-blog-card__date {
    font-size: 15px;
}

.japebo-blog-card__title {
    margin: 0 0 10px;
    font-size: 23px;
    line-height: 1.3;
    text-transform: none;
    letter-spacing: normal;
    --theme-text: #111;
}

.japebo-blog-card__title a {
    display: inline-block;
    min-height: 44px;
    color: #111;
    text-decoration: none;
}

.japebo-blog-card__title a:hover,
.japebo-blog-card__title a:focus {
    text-decoration: underline;
}

.japebo-blog-card__intro {
    margin: 0 0 18px;
    font-size: 17px;
    line-height: 1.6;
    color: #333;
    --theme-text: #333;
}

/* Read-more link: a real button, 48px tall, sentence case. */
.japebo-blog-card__more {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    box-sizing: border-box;
    min-height: 48px;
    margin-top: auto;
    padding: 0 22px;
    border: 2px solid #1f6f8b;
    border-radius: 8px;
    background: #1f6f8b;
    color: #fff;
    --theme-body-link: #fff;
    --theme-body-link-hover: #fff;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: normal;
    text-decoration: none;
}

.japebo-blog-card__more:hover,
.japebo-blog-card__more:focus {
    background: #17566c;
    border-color: #17566c;
    color: #fff;
}

.japebo-blog-card__more:focus-visible,
.japebo-blog-card__title a:focus-visible,
.japebo-blog-card__category:focus-visible {
    outline: 3px solid #f2a900;
    outline-offset: 2px;
}

.japebo-blog__empty {
    font-size: 17px;
}

/* Pagination (WordPress the_posts_pagination markup). */
.japebo-blog__pagination {
    margin-top: 36px;
}

.japebo-blog__pagination .nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.japebo-blog__pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 48px;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid #c9c9c9;
    border-radius: 8px;
    font-size: 17px;
    text-transform: none;
    letter-spacing: normal;
    color: #222;
    text-decoration: none;
}

.japebo-blog__pagination .page-numbers.current {
    background: #1f6f8b;
    border-color: #1f6f8b;
    color: #fff;
    font-weight: 700;
}

.japebo-blog .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

@media (max-width: 1023px) {
    .japebo-blog__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 639px) {
    .japebo-blog__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .japebo-blog__title {
        font-size: 28px;
    }

    .japebo-blog-card__more {
        align-self: stretch;
        justify-content: center;
    }
}
