/* GP Category Styler Styles */

/* Common Header */
.gpc-archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 2px solid #eee;
    margin-bottom: 30px;
}

.gpc-header-left {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.gpc-cat-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.gpc-cat-count {
    font-size: 0.9rem;
    color: #666;
}

.gpc-header-right {
    display: flex;
    gap: 8px;
}

.gpc-view-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px;
    cursor: pointer;
    color: #888;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gpc-view-btn:hover,
.gpc-view-btn.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* ---------------------------------------------------------
   GLOBAL RESET & HIDE FORCED ELEMENTS
   --------------------------------------------------------- */
/* Hide native theme elements to avoid duplicates (assuming we use ours) */
/* We target these only when our view mode is active, to be safe. */
body[class*="gpc-view-"] .generate-columns-container .post-image,
body[class*="gpc-view-"] .entry-meta,
body[class*="gpc-view-"] footer.entry-meta,
body[class*="gpc-view-"] .entry-summary,
body[class*="gpc-view-"] .entry-content,
body[class*="gpc-view-"] article .entry-summary,
body[class*="gpc-view-"] article .entry-content {
    display: none !important;
}

/* Default styles for our injected elements */
.gpc-featured-image img {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    aspect-ratio: 4/3;
    width: 100%;
    border-radius: 4px;
}

.gpc-entry-meta {
    font-size: 0.85rem;
    color: #888;
    margin-top: 5px;
}

.gpc-sep {
    margin: 0 5px;
    color: #ccc;
}

.gpc-excerpt {
    font-size: 1rem;
    color: #666;
    margin: 10px 0;
    line-height: 1.6;
    display: block;
}

/* ---------------------------------------------------------
   VIEW SPECIFIC STYLES
   --------------------------------------------------------- */

/* === LIST VIEW === */
body.gpc-view-list .type-post {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

body.gpc-view-list .type-post .inside-article {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Vertically center title and meta */
    padding: 20px 0;
}

/* Hide Image in List View */
body.gpc-view-list .gpc-featured-image {
    display: none;
}

/* Content Order */
body.gpc-view-list .entry-header {
    flex: 1;
    /* Title takes available space */
    margin-bottom: 0;
    padding-right: 20px;
}

body.gpc-view-list .gpc-entry-meta {
    white-space: nowrap;
    /* Keep Author | Date on one line if possible */
    margin-top: 0;
    /* Reset */
    text-align: right;
}

/* Hide Excerpt in List View */
body.gpc-view-list .gpc-excerpt {
    display: none;
}


/* === THUMBNAIL VIEW === */
body.gpc-view-thumbnail .type-post {
    margin-bottom: 30px;
    border-bottom: 1px solid #f0f0f0;
}

body.gpc-view-thumbnail .inside-article {
    display: grid;
    grid-template-columns: 30% 1fr;
    grid-template-rows: auto auto 1fr;
    /* Title, Excerpt, Margin-space? No, let's use areas */
    gap: 0 20px;
    padding-bottom: 30px;
}

/* Assign Grid Areas */
body.gpc-view-thumbnail .gpc-featured-image {
    grid-column: 1;
    grid-row: 1 / 4;
    /* Span all rows */
}

body.gpc-view-thumbnail .entry-header {
    grid-column: 2;
    grid-row: 1;
}

body.gpc-view-thumbnail .gpc-excerpt {
    grid-column: 2;
    grid-row: 2;
    margin-top: 10px;
}

body.gpc-view-thumbnail .gpc-entry-meta {
    grid-column: 2;
    grid-row: 3;
    align-self: end;
    /* Push to bottom */
    margin-top: auto;
    padding-top: 15px;
    text-align: right;
    /* Revert to Right or Left? User liked Right previously? */
}


/* === GRID VIEW === */
body.gpc-view-grid .site-main {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

body.gpc-view-grid .type-post {
    margin-bottom: 0;
    /* Let grid gap handle it */
    border-bottom: none;
}

body.gpc-view-grid .inside-article {
    display: flex;
    flex-direction: column;
    height: 100%;
}

body.gpc-view-grid .gpc-featured-image {
    order: 1;
    margin-bottom: 15px;
}

body.gpc-view-grid .entry-header {
    order: 2;
    margin-bottom: 10px;
}

body.gpc-view-grid .gpc-excerpt {
    display: none;
    /* Hide excerpt in Grid usually */
}

body.gpc-view-grid .gpc-entry-meta {
    order: 3;
    margin-top: auto;
    /* Push if we want full height alignment, else just below title */
}


/* ---------------------------------------------------------
   RESPONSIVE
   --------------------------------------------------------- */
@media (max-width: 991px) {

    /* Tablet */
    body.gpc-view-grid .site-main {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {

    /* Mobile */
    /* Grid becomes 1 column list-like but visual stack */
    body.gpc-view-grid .site-main {
        grid-template-columns: 1fr;
    }

    /* Thumbnail View Stack */
    body.gpc-view-thumbnail .inside-article {
        display: flex;
        /* Switch to flex stack on mobile */
        flex-direction: column;
        gap: 15px;
    }

    body.gpc-view-thumbnail .gpc-featured-image {
        width: 100%;
        margin-bottom: 5px;
    }

    body.gpc-view-thumbnail .gpc-entry-meta {
        text-align: left;
    }

    /* List View Adjustments */
    body.gpc-view-list .inside-article {
        flex-direction: column;
        align-items: flex-start;
    }

    body.gpc-view-list .entry-header {
        padding-right: 0;
        margin-bottom: 5px;
    }

    body.gpc-view-list .gpc-entry-meta {
        text-align: left;
        font-size: 0.8rem;
    }
}