/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Mobile-specific fixes (up to 640px) */
@media (max-width: 640px) {
    .timeline__entry .date {
        min-width: 45px;
        font-size: var(--font-xs);
    }

    .timeline__entry .meta {
        margin-left: var(--spacing-xs);
    }

    .timeline__entry img,
    .timeline-placeholder {
        margin-left: var(--spacing-xs);
    }
}

/* Mobile and tablet layout reordering (up to 1023px) */
@media (max-width: 1023px) {
    /* Make original-content a flex container */
    .main-scroll-container .original-content,
    .original-content {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0 !important;
        padding: 0 !important;
    }

    /* Make columns "disappear" so sections become direct children of the flex container */
    .main-scroll-container .original-content .leftCol,
    .main-scroll-container .original-content .rightCol,
    .leftCol,
    .rightCol {
        display: contents !important;
    }

    /* Now we can reorder all sections as if they're siblings */
    /* Summary - leftCol section 2 */
    .leftCol > section:nth-child(2) {
        order: 2 !important;
    }

    /* Timeline - rightCol section 1 (move after summary) */
    .rightCol > section:nth-child(1) {
        order: 3 !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
        margin-bottom: var(--spacing-xl) !important;
        border-left: none !important;
        padding-left: 0 !important;
    }

    /* Filters - rightCol section 3 (move before posts) */
    .rightCol > section:nth-child(3) {
        order: 4 !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
        margin-bottom: var(--spacing-lg) !important;
    }

    /* Posts grid - leftCol section 3 */
    .leftCol > section:nth-child(3) {
        order: 5 !important;
    }

    /* Related questions - leftCol section 1 (move above People at bottom) */
    .leftCol > section:nth-child(1) {
        order: 6 !important;
    }

    /* People - rightCol section 2 (bottom) */
    .rightCol > section:nth-child(2) {
        order: 7 !important;
    }

    /* Remove line separators on mobile */
    .rightCol section .line {
        display: none !important;
    }

    /* Ensure all sections are full width */
    .leftCol > section,
    .rightCol > section {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Tablet (641px and up) */
@media (min-width: 641px) {


    .container {
        max-width: var(--container-sm);
    }

    /* 2-column grid for posts */
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Larger search input */
    .searchForm input[type=text] {
        font-size: var(--font-lg);
        padding: var(--spacing-md) calc(var(--spacing-xl) + 20px);
    }

    /* Related questions in a row */
    .related-questions {
        flex-wrap: wrap;
        overflow-x: visible;
        margin: 0 0 var(--spacing-xl) 0;
        padding: 0;
    }

    .related-questions .question {
        flex: 0 1 calc(50% - 8px);
        min-width: 200px;
        max-width: none;
    }

    /* Larger timeline images */
    .timeline__entry img {
        height: 40px;
        width: 40px;
    }

    /* Larger timeline placeholders */
    .timeline-placeholder {
        height: 40px !important;
        width: 40px !important;
    }

    /* Larger timeline placeholder icons */
    .timeline-placeholder-icon {
        width: 22px !important;
        height: 22px !important;
    }

    /* Better spacing */
    p.lead {
        font-size: var(--font-2xl);
    }
}

/* Small Laptop (1025px and up) */
@media (min-width: 1025px) {
    body {
        display: block;
    }

    .container {
        max-width: var(--container-md);
    }

    /* Two-column layout restored */
    .leftCol {
        flex: 1;
        width: auto;
        max-width: calc(100% - 320px - 40px);
        padding-bottom: var(--spacing-2xl);
        margin-bottom: 0;
        min-width: 0;
    }

    .rightCol {
        width: 320px;
        flex-shrink: 0;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }

    /* 3-column grid */
    .grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* Related questions horizontal */
    .related-questions .question {
        flex: 0 1 auto;
        min-width: 150px;
        max-width: 400px;
    }
}

/* Desktop (1367px and up) */
@media (min-width: 1367px) {
    body {
        max-width: var(--container-xl);
        margin: 0 auto;
    }

    .container {
        max-width: var(--container-lg);
    }

    /* Optimized column widths */
    .leftCol {
        max-width: calc(100% - 370px - 40px);
    }

    .rightCol {
        width: 370px;
    }

    /* Responsive grid with flexible sizing */
    .grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 40px;
    }

    /* Larger lead paragraph */
    p.lead {
        font-size: 28px;
        max-width: 950px;
    }

    /* Original search form sizing */
    .searchForm input[type=text] {
        padding: 20px 50px;
        font-size: 18px;
    }

    .searchForm .icon {
        font-size: 20px;
        height: 20px;
        width: 20px;
        left: 20px;
    }

    .searchForm button {
        height: 20px;
        width: 20px;
        right: 20px;
    }
}

/* Widescreen (1921px and up) */
@media (min-width: 1921px) {
    body {
        max-width: 1800px;
    }

    .container {
        max-width: var(--container-xl);
    }

    /* Maximum column widths */
    .leftCol {
        max-width: 1190px;
    }

    /* 3-column grid with fixed widths */
    .grid {
        grid-template-columns: repeat(3, 350px);
        justify-content: flex-start;
    }

    .card {
        width: 370px;
    }
}

/* Ultra-wide (2560px and up) */
@media (min-width: 2560px) {
    body {
        max-width: 2100px;
    }
    /* 4-column grid for ultra-wide displays */
    .grid {
        grid-template-columns: repeat(3, 370px);
    }

    .leftCol {
        max-width: calc(100% - 370px - 40px);
    }
}
