/*
 * Template: Blog / Archive
 *
 * Styles for home.php (posts page) and archive.php.
 * Loaded conditionally via is_home() || is_archive().
 * Depends on faq.css (hero styles) and global.css.
 *
 * Black base, green accent, Inter text — consistent with site system.
 */

.template-blog {
    background-color: #000;
}


/* ==========================================================================
   Blog wrap + layout
   ========================================================================== */

.blog-wrap {
    padding-block: 3rem;
    background-color: #000;
}

/* Desktop: sidebar (left) + posts (right) */
.blog-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}


/* ==========================================================================
   Sidebar
   ========================================================================== */

.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: calc(var(--header-height, 96px) + 1.5rem);
}

.blog-sidebar__block {
    background: #0d0d0d;
    border: 1px solid #1e1e1e;
    border-radius: 5px;
    padding: 1.25rem 1.25rem;
    box-shadow: 0 3px 16px rgba(166, 206, 57, 0.06);
}

.blog-sidebar__heading {
    font-family: var(--font-base, 'Inter', sans-serif);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-green, #a6ce39);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.875rem;
}

/* Search */
.blog-sidebar__search {
    padding: 1rem 1.25rem;
}

.blog-search-form__inner {
    display: flex;
    align-items: center;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.blog-search-form__inner:focus-within {
    border-color: var(--color-green, #a6ce39);
}

.blog-search-form__input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 0.6rem 0.875rem;
    font-family: var(--font-base, 'Inter', sans-serif);
    font-size: 0.875rem;
    color: #ccc;
}

.blog-search-form__input::placeholder {
    color: #555;
}

.blog-search-form__btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-green, #a6ce39);
    font-size: 0.875rem;
    transition: opacity 0.2s;
}

.blog-search-form__btn:hover {
    opacity: 0.7;
}

/* Recent posts list */
.blog-sidebar__recent-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.blog-sidebar__recent-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #1e1e1e;
}

.blog-sidebar__recent-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.blog-sidebar__recent-link {
    font-family: var(--font-base, 'Inter', sans-serif);
    font-size: 0.85rem;
    font-weight: 600;
    color: #e0e0e0;
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.2s;
}

.blog-sidebar__recent-link:hover {
    color: var(--color-green, #a6ce39);
    text-decoration: none;
}

.blog-sidebar__recent-date {
    font-size: 0.75rem;
    color: #555;
}

/* Categories list with max-height scroll */
.blog-sidebar__cats-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    max-height: 280px;
    overflow-y: auto;
}

.blog-sidebar__cats-list::-webkit-scrollbar {
    width: 4px;
}

.blog-sidebar__cats-list::-webkit-scrollbar-track {
    background: transparent;
}

.blog-sidebar__cats-list::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 2px;
}

.blog-sidebar__cats-item {
    border-bottom: 1px solid #1a1a1a;
}

.blog-sidebar__cats-item:last-child {
    border-bottom: none;
}

.blog-sidebar__cats-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-family: var(--font-base, 'Inter', sans-serif);
    font-size: 0.875rem;
    font-weight: 400;
    color: #ccc;
    text-decoration: none;
    transition: color 0.2s;
}

.blog-sidebar__cats-link:hover {
    color: var(--color-green, #a6ce39);
    text-decoration: none;
}

.blog-sidebar__cats-count {
    font-size: 0.75rem;
    color: #444;
}


/* ==========================================================================
   Chips (tags + mobile categories)
   ========================================================================== */

.blog-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.blog-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-family: var(--font-base, 'Inter', sans-serif);
    font-size: 0.775rem;
    font-weight: 500;
    color: #ccc;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.blog-chip:hover,
.blog-chip--active {
    color: #000;
    background: var(--color-green, #a6ce39);
    border-color: var(--color-green, #a6ce39);
    box-shadow: 0 2px 10px rgba(166, 206, 57, 0.2);
    text-decoration: none;
}


/* ==========================================================================
   Posts area
   ========================================================================== */

.blog-posts {
    min-width: 0; /* prevent grid blowout */
}

.blog-cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}


/* ==========================================================================
   Blog card
   ========================================================================== */

.blog-card {
    background: #0d0d0d;
    border: 1px solid #1e1e1e;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 3px 16px rgba(166, 206, 57, 0.06);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.blog-card:hover {
    box-shadow: 0 6px 28px rgba(166, 206, 57, 0.12);
    transform: translateY(-2px);
}

.blog-card__img-wrap {
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 7;
}

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

.blog-card:hover .blog-card__img {
    transform: scale(1.03);
}

.blog-card__body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.blog-card__meta {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.blog-card__date,
.blog-card__author {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-base, 'Inter', sans-serif);
    font-size: 0.775rem;
    font-weight: 400;
    color: #555;
}

.blog-card__title {
    margin: 0;
    font-family: var(--font-base, 'Inter', sans-serif);
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3;
}

.blog-card__title-link {
    color: #fff;
    text-decoration: none;
    transition: color 0.2s;
}

.blog-card__title-link:hover {
    color: var(--color-green, #a6ce39);
    text-decoration: none;
}

.blog-card__excerpt {
    font-family: var(--font-base, 'Inter', sans-serif);
    font-size: 0.875rem;
    font-weight: 400;
    color: #aaa;
    line-height: 1.7;
}

.blog-card__excerpt p {
    margin: 0;
}

.blog-card__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    align-self: flex-start;
    padding: 7px 16px;
    font-family: var(--font-base, 'Inter', sans-serif);
    font-size: 0.825rem;
    font-weight: 600;
    color: #000;
    background-color: var(--color-green, #a6ce39);
    border: 1px solid var(--color-green, #a6ce39);
    border-radius: 4px;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(166, 206, 57, 0.2);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.blog-card__btn:hover {
    box-shadow: 0 4px 18px rgba(166, 206, 57, 0.35);
    transform: translateY(-1px);
    text-decoration: none;
}


/* ==========================================================================
   Pagination
   ========================================================================== */

.blog-pagination {
    margin-top: 2rem;
}

.blog-pagination .nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.blog-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    font-family: var(--font-base, 'Inter', sans-serif);
    font-size: 0.875rem;
    font-weight: 500;
    color: #ccc;
    background: #0d0d0d;
    border: 1px solid #1e1e1e;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.blog-pagination .page-numbers:hover {
    color: #000;
    background: var(--color-green, #a6ce39);
    border-color: var(--color-green, #a6ce39);
    box-shadow: 0 2px 10px rgba(166, 206, 57, 0.2);
    text-decoration: none;
}

.blog-pagination .page-numbers.current {
    color: #000;
    background: var(--color-green, #a6ce39);
    border-color: var(--color-green, #a6ce39);
    box-shadow: 0 2px 10px rgba(166, 206, 57, 0.2);
}

.blog-pagination .page-numbers.dots {
    background: transparent;
    border-color: transparent;
    color: #444;
    cursor: default;
}


/* ==========================================================================
   Mobile-only blocks (hidden on desktop/tablet)
   ========================================================================== */

.blog-mobile-top,
.blog-mobile-tags {
    display: none;
}


/* ==========================================================================
   Responsive — Tablet (≤1024px): keep 2-col but narrower sidebar
   ========================================================================== */

@media (max-width: 1024px) {
    .blog-layout {
        grid-template-columns: 240px 1fr;
        gap: 1.5rem;
    }
}


/* ==========================================================================
   Responsive — Mobile (≤768px): single column, sidebar hidden
   ========================================================================== */

@media (max-width: 768px) {

    .blog-wrap {
        padding-block: 2rem;
    }

    /* Hide sidebar entirely */
    .blog-sidebar {
        display: none;
    }

    /* Single column posts */
    .blog-layout {
        grid-template-columns: 1fr;
    }

    /* Show mobile-specific blocks */
    .blog-mobile-top {
        display: flex;
        flex-direction: column;
        gap: 0.875rem;
        margin-bottom: 1.5rem;
    }

    .blog-mobile-tags {
        display: block;
        margin-top: 2rem;
    }

    /* Mobile categories horizontal slider */
    .blog-mobile-cats {
        display: flex;
        gap: 0.4rem;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .blog-mobile-cats::-webkit-scrollbar {
        display: none;
    }

    .blog-mobile-cats .blog-chip {
        flex-shrink: 0;
    }

    /* Card image shorter on mobile */
    .blog-card__img-wrap {
        aspect-ratio: 16 / 9;
    }
}
