:root {
    --theme-primary: #0f4c81;
    --theme-secondary: #1e90ff;
    --theme-tertiary: #f59e0b;
    --surface: #f8f9fb;
    --text: #1f2933;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background: var(--surface);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
}

img,
picture,
video,
canvas,
iframe {
    max-width: 100%;
    height: auto;
}

figure {
    margin: 0;
}

.container {
    width: min(1280px, 92vw);
    margin: 0 auto;
}

.site-body {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    /* padding: 1.5rem 0 2rem; */
}

.content-area {
    flex: 2;
    min-width: 0;
    max-width: calc(66.666% - 1.333rem);
    overflow: hidden;
    margin-top: 2rem;
}

.sidebar {
    flex: 1;
    margin-top: 2rem;
    max-width: calc(33.333% - 0.667rem);
}

/* Ensure sticky two-column layout on home and standard pages */
body.home .site-body,
body.page .site-body,
body.blog .site-body {
    display: flex !important;
    align-items: flex-start !important;
    gap: 2rem;
}

body.home .sidebar,
body.page .sidebar,
body.blog .sidebar {
    position: sticky !important;
    top: 6rem !important;
    align-self: flex-start !important;
    height: fit-content !important;
}

.button,
button,
input[type="submit"] {
    display: inline-block;
    padding: 0.65rem 1.2rem;
    background: var(--theme-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
    background: var(--theme-secondary);
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.entry-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.entry-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

/* Full card clickable link */
.entry-card__link {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Keep category link clickable above the card link */
.entry-card .entry-category {
    position: relative;
    z-index: 2;
}

.entry-card .entry-thumbnail {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #f3f4f6;
}

.entry-card .entry-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    border-radius: 4px;
}

.entry-card:hover .entry-thumbnail img {
    transform: scale(1.05);
}

.entry-card .entry-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.25rem;
}

.entry-card .entry-category {
    display: inline-block;
    width: fit-content;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--theme-primary);
    background: rgba(15, 76, 129, 0.08);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    text-decoration: none;
    transition: background 0.15s ease;
}

.entry-card .entry-category:hover {
    background: rgba(15, 76, 129, 0.15);
}

.entry-card .entry-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    line-height: 1.4;
    color: #111827;
    transition: color 0.15s ease;
}

.entry-card:hover .entry-title {
    color: var(--theme-primary);
}

.entry-card .entry-excerpt {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.entry-card .entry-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.entry-card .entry-meta .meta-sep {
    color: #d1d5db;
}

@media (max-width: 600px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }
}

/* Load More Button */
.load-more-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    padding: 0.875rem 2rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    background: var(--theme-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.load-more-btn:hover {
    background: color-mix(in srgb, var(--theme-primary) 85%, #000);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.load-more-btn:active {
    transform: translateY(0);
}

.load-more-btn.loading {
    opacity: 0.7;
    cursor: wait;
}

.not-found {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.entry-title a {
    color: var(--theme-primary);
}

.pagination {
    margin: 2rem 0 1rem;
    display: flex;
    justify-content: center;
}

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

.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.pagination .page-numbers:hover:not(.current):not(.dots) {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.pagination .current {
    background: var(--theme-primary);
    color: #fff;
    border-color: var(--theme-primary);
}

.pagination .prev,
.pagination .next {
    padding: 0 1rem;
}

.pagination .dots {
    border: none;
    background: transparent;
    color: #9ca3af;
}

.screen-reader-text {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.entry-content {
    overflow-wrap: anywhere;
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
}

.entry-content pre {
    max-width: 100%;
    overflow-x: auto;
}

/* =============================================
   TABLET BREAKPOINT (1024px and below)
   ============================================= */
@media (max-width: 1024px) {
    .site-body {
        flex-direction: column;
        gap: 1.5rem;
    }

    .content-area,
    .sidebar {
        width: 100%;
        max-width: 100%;
        margin-top: 0;
    }

    .content-area {
        overflow: visible;
    }

    /* Disable sticky sidebar on tablet/mobile */
    body.home .sidebar,
    body.page .sidebar,
    body.blog .sidebar,
    .sidebar {
        position: static !important;
    }
}

/* =============================================
   MOBILE BREAKPOINT (768px and below)
   ============================================= */
@media (max-width: 768px) {
    /* Container with proper padding */
    .container {
        width: 100%;
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
        box-sizing: border-box;
    }

    .site-body {
        gap: 1rem;
    }

    /* Ensure content area doesn't overflow */
    .content-area {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: visible;
    }

    /* Ensure all direct children respect container width */
    .content-area > *,
    .sidebar > * {
        max-width: 100%;
        box-sizing: border-box;
    }

    .entry-card,
    .not-found {
        padding: 1.25rem;
    }

    .pagination {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .pagination .page-numbers {
        margin-right: 0;
    }

    /* Grid adjustments */
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}
