/* Responsive Components Rules */

@media (max-width: 800px) {

    /* ------------------------------------------------------------------
       1. SEARCH COMPONENT
       ------------------------------------------------------------------ */
    .search-bar {
        width: 100%;
        padding: 0 0.5rem;
        margin-bottom: 1.5rem;
    }

    .search-field {
        width: 100%;
        max-width: 100%;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    .search-suggestions {
        position: absolute;
        width: calc(100% - 1rem);
        /* 0.5rem margin on each side */
        left: 0.5rem;
        z-index: 1000;
        /* Ensure over post images */
        max-height: 60vh;
    }

    .suggestion-row {
        grid-template-columns: 1fr;
        /* Stack vertically if needed, or keep compact */
        gap: 0.25rem;
    }

    .suggestion-date {
        display: none;
        /* Hide date on very small screens to save space */
    }

    /* ------------------------------------------------------------------
       2. POST LIST VIEW (Default)
       ------------------------------------------------------------------ */
    /* ------------------------------------------------------------------
       2. POST LIST VIEW (Default)
       ------------------------------------------------------------------ */
    .blog-post {
        padding: 1.25rem 1rem;
        margin-bottom: 2rem;
        border-right: none;
        border-top: 1px solid var(--accent-gray);
        border-bottom: 1px solid var(--accent-gray);
        border-left: 4px solid var(--accent-gray);
        /* Keep the accent */
        box-shadow: none;
        /* Flatter look on mobile */
        background: transparent !important;
        /* User requested transparent */
    }

    .post-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 1rem;
        position: relative;
        /* For absolute positioning of admin link */
    }

    /* Admin Link: Position Top Right */
    .admin-actions {
        position: absolute !important;
        top: 0 !important;
        right: 0 !important;
        padding: 0.5rem !important;
        display: block !important;
        z-index: 10;
        margin: 0 !important;
        background: transparent !important;
        width: auto !important;
    }

    /* Ensure visibility in Card View which hides it by default */
    .view-mode-card .admin-actions {
        display: block !important;
        top: 0.5rem !important;
        right: 0.5rem !important;
    }

    .blog-post h2 {
        font-size: var(--font-size-h2);
        line-height: 1.3;
        padding-right: 2.5rem;
        /* Avoid overlap with admin link */
    }

    .blog-post-meta {
        font-size: var(--font-size-sm);
    }

    /* Illustrations in text flow */
    .illustration-image {
        float: none;
        width: 100%;
        margin: 0 0 1.25rem 0;
        max-width: 100%;
    }

    .illustration-image img {
        height: auto;
        max-height: 350px;
        width: 100%;
    }

    /* Post Content Images */
    .blog-post-content img {
        height: auto !important;
        max-width: 100% !important;
    }

    /* Image Grid in posts */
    .blog-post-images {
        margin-top: 1rem;
        /* Spacing from text/read-more */
    }

    .blog-post-images img {
        flex: 1 1 calc(50% - 10px);
        /* 2 columns */
        width: auto;
        height: 150px;
    }

    .read-more-btn {
        margin-bottom: 1rem;
        /* Spacing after button */
    }

    /* ------------------------------------------------------------------
       3. CARD VIEW
       ------------------------------------------------------------------ */
    .posts-container.view-mode-card {
        grid-template-columns: 1fr !important;
        /* Single column stack */
        gap: 1.5rem;
    }

    /* Adjust card sizing */
    .view-mode-card .blog-post {
        padding-top: 0;
        display: flex;
        flex-direction: column;
        height: auto !important;
        /* Allow growth */
        min-height: 400px;
        background: #fff;
    }

    .view-mode-card .illustration-image {
        position: relative;
        height: auto;
        min-height: 200px;
        /* Ensure image is visible */
        max-height: 300px;
        top: 0;
        overflow: hidden;
    }

    .view-mode-card .illustration-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .view-mode-card .blog-post {
        padding: 0;
        /* Reset */
        background: #fff;
    }

    .view-mode-card .post-header {
        padding: 1rem;
    }

    .view-mode-card .blog-post-content {
        padding: 0 1rem 1rem;
        flex-grow: 1 !important;

        /* Truncate nicely after ~12 lines */
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        -webkit-line-clamp: 12 !important;
        line-clamp: 12 !important;
        max-height: calc(1.5rem * 12) !important;
        overflow: hidden !important;
        margin-bottom: 0.5rem;
    }

    /* Override Desktop Resets for Typography */
    .view-mode-card .blog-post-content h1,
    .view-mode-card .blog-post-content h2,
    .view-mode-card .blog-post-content h3,
    .view-mode-card .blog-post-content strong {
        font-size: 1.1rem !important;
        line-height: 1.3 !important;
        margin: 1rem 0 0.5rem 0 !important;
        font-weight: bold !important;
        color: var(--text-primary) !important;
        display: block !important;
    }

    .view-mode-card .blog-post-content p {
        font-size: 1rem !important;
        line-height: 1.5 !important;
        margin-bottom: 0.75rem !important;
        color: var(--text-primary) !important;
        display: -webkit-box !important;
        /* Ensure it respects parent box if needed, or behaves as block */
    }

    .view-mode-card .card-footer {
        padding: 0.75rem 1rem;
        border-top: 1px solid var(--accent-gray);
        margin-top: auto;
        /* Push to bottom */
    }

    /* ------------------------------------------------------------------
       4. PUBLIC GALLERY PAGE
       ------------------------------------------------------------------ */
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }

    .gallery-card img {
        height: 150px;
    }

    .gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .gallery-pagination {
        flex-wrap: wrap;
    }

    /* ------------------------------------------------------------------
       5. GALLERY LIGHTBOX STYLES
       ------------------------------------------------------------------ */
    /* Ensure the description container inside glightbox is readable */
    .glightbox-clean .gslide-description {
        background: rgba(0, 0, 0, 0.85) !important;
        /* Darker background for contrast */
        color: #fff !important;
        padding: 1rem !important;
        text-align: left;
    }

    .gallery-desc {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .desc-title {
        font-size: 1.1rem;
        font-weight: bold;
        color: #fff;
        display: block;
    }

    .desc-meta {
        font-size: 0.85rem;
        color: #ccc;
        display: block;
        margin-bottom: 0.25rem;
    }

    .desc-excerpt {
        font-size: 0.95rem;
        line-height: 1.4;
        color: #eee;
        display: block;
        margin-bottom: 0.5rem;
    }

    .desc-link {
        display: inline-block;
        margin-top: 0.5rem;
        padding: 0.4rem 0.8rem;
        background: var(--text-primary);
        /* Use main brand color */
        color: var(--highlight-accent) !important;
        text-decoration: none;
        border-radius: 4px;
        font-size: 0.9rem;
        font-weight: bold;
        align-self: flex-start;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
}