/*
 * Blog archive & category archive styles — opentable theme.
 * Loaded only on is_home() and is_archive() pages.
 */

/* ── Hero banner ─────────────────────────────────────────────────────────── */
.blog-hero {
    background-color: var(--appskey-color-bg-alt, #f8fdf0);
    padding: 3.5rem 1.5rem 3rem;
    text-align: center;
    border-bottom: 3px solid var(--appskey-color-primary, #95c93d);
}

.blog-hero__inner {
    max-width: 1200px;
    margin: 0 auto;
}

.blog-hero__title {
    font-family: var(--appskey-font-heading, 'Playfair Display', serif);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--appskey-color-dark, #2d2d2d);
    margin: 0;
}

/* ── With background image — mirrors home banner dimensions ──────────────── */
.blog-hero.has-bg-image {
    position: relative;
    height: 500px;
    padding: 0;
    border-bottom: none;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-hero__overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, var(--overlay-opacity, 0.4));
    z-index: 0;
}

.blog-hero.has-bg-image .blog-hero__inner {
    position: relative;
    z-index: 1;
}

.blog-hero.has-bg-image .blog-hero__title {
    color: #ffffff;
    font-size: 3rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

@media (max-width: 959px) {
    .blog-hero.has-bg-image { height: 420px; }
    .blog-hero.has-bg-image .blog-hero__title { font-size: 2.25rem; }
}

@media (max-width: 767px) {
    .blog-hero.has-bg-image { height: 320px; }
    .blog-hero.has-bg-image .blog-hero__title { font-size: 1.875rem; }
}

@media (max-width: 479px) {
    .blog-hero.has-bg-image { height: 260px; }
    .blog-hero.has-bg-image .blog-hero__title { font-size: 1.5rem; }
}

/* ── Archive wrapper ─────────────────────────────────────────────────────── */
.blog-archive {
    padding: 4rem 1.5rem;
    background-color: #ffffff;
}

.blog-archive__inner {
    max-width: 1200px;
    margin: 0 auto;
}

/* archive.php uses a .page-header with the_archive_title() */
.blog-archive .page-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 3px solid var(--appskey-color-primary, #95c93d);
}

.blog-archive .page-title {
    font-family: var(--appskey-font-heading, 'Playfair Display', serif);
    font-size: 2rem;
    font-weight: 700;
    color: var(--appskey-color-dark, #2d2d2d);
    margin: 0 0 0.5rem;
}

.blog-archive .archive-description {
    font-family: var(--appskey-font-body, 'Lato', sans-serif);
    font-size: 0.9375rem;
    color: #666;
    margin: 0;
}

/* ── View toggle (grid / list) ───────────────────────────────────────────── */
.blog-archive__toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 0.25rem;
}

.blog-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #e5e7eb;
    border-radius: 3px;
    background: #fff;
    color: #aaa;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    padding: 0;
}

.blog-view-btn:hover {
    border-color: var(--appskey-color-primary, #95c93d);
    color: var(--appskey-color-primary, #95c93d);
}

.blog-view-btn.is-active {
    background-color: var(--appskey-color-primary, #95c93d);
    border-color: var(--appskey-color-primary, #95c93d);
    color: #fff;
}

.blog-view-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* ── Card grid ───────────────────────────────────────────────────────────── */
.blog-archive__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

/* ── Individual card ──────────────────────────────────────────────────────── */
.blog-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.blog-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
    transform: translateY(-3px);
}

/* ── Card thumbnail ──────────────────────────────────────────────────────── */
.blog-card__media {
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    flex-shrink: 0;
}

.blog-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.blog-card:hover .blog-card__media img {
    transform: scale(1.04);
}

/* ── Card body ───────────────────────────────────────────────────────────── */
.blog-card__body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.6rem;
}

/* ── Card meta: category + date ─────────────────────────────────────────── */
.blog-card__meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.blog-card__cat {
    font-family: var(--appskey-font-body, 'Lato', sans-serif);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--appskey-color-primary, #95c93d);
    text-decoration: none;
}

.blog-card__cat:hover {
    text-decoration: underline;
}

.blog-card__date {
    font-family: var(--appskey-font-body, 'Lato', sans-serif);
    font-size: 0.75rem;
    color: #999;
    font-style: italic;
}

/* ── Card title ──────────────────────────────────────────────────────────── */
.blog-card__title {
    font-family: var(--appskey-font-heading, 'Playfair Display', serif);
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--appskey-color-dark, #2d2d2d);
    margin: 0;
}

.blog-card__title a {
    color: inherit;
    text-decoration: none;
}

.blog-card__title a:hover {
    color: var(--appskey-color-primary, #95c93d);
}

/* ── Excerpt ─────────────────────────────────────────────────────────────── */
.blog-card__excerpt {
    font-family: var(--appskey-font-body, 'Lato', sans-serif);
    font-size: 0.9rem;
    line-height: 1.75;
    color: #555;
    flex: 1;
}

.blog-card__excerpt p {
    margin: 0;
}

/* ── Read More wrap + link ───────────────────────────────────────────────── */
.blog-card__readmore-wrap {
    margin-top: auto;
    padding-top: 0.5rem;
}

.blog-card__readmore {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    font-family: var(--appskey-font-body, 'Lato', sans-serif);
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #ffffff;
    background-color: var(--appskey-color-primary, #95c93d);
    border-radius: var(--appskey-border-radius, 3px);
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.blog-card__readmore:hover {
    background-color: var(--appskey-color-primary-dark, #7aab2d);
    color: #ffffff;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.blog-archive__pagination .nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.blog-archive__pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    font-family: var(--appskey-font-body, 'Lato', sans-serif);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--appskey-color-dark, #2d2d2d);
    text-decoration: none;
    border: 1px solid #e5e7eb;
    border-radius: 3px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.blog-archive__pagination .page-numbers:hover,
.blog-archive__pagination .page-numbers.current {
    background-color: var(--appskey-color-primary, #95c93d);
    color: #ffffff;
    border-color: var(--appskey-color-primary, #95c93d);
}

.blog-archive__pagination .page-numbers.dots {
    border: none;
    background: none;
    cursor: default;
}

/* ── List view ───────────────────────────────────────────────────────────── */
.blog-archive__grid.is-list {
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.blog-archive__grid.is-list .blog-card {
    flex-direction: row;
}

.blog-archive__grid.is-list .blog-card__media {
    flex: 0 0 260px;
    aspect-ratio: unset;
    align-self: stretch;
}

.blog-archive__grid.is-list .blog-card__media img {
    height: 100%;
}

.blog-archive__grid.is-list .blog-card__body {
    padding: 1.25rem 1.5rem;
}

.blog-archive__grid.is-list .blog-card__title {
    font-size: 1.25rem;
}

@media (max-width: 640px) {
    .blog-archive__grid.is-list .blog-card {
        flex-direction: column;
    }

    .blog-archive__grid.is-list .blog-card__media {
        flex: none;
        aspect-ratio: 16 / 9;
    }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .blog-archive__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .blog-hero {
        padding: 2.5rem 1rem 2rem;
    }

    .blog-hero__title {
        font-size: 1.875rem;
    }

    .blog-archive {
        padding: 2.5rem 1rem;
    }

    .blog-archive__grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .blog-archive__toolbar {
        display: none;
    }
}
