<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Carousel CSS - Version 2.1.0</title>
<style>
/* Schleicher Social Feed - Carousel Styles */
/* Version 2.1.0 - Mobile Optimized with Bottom Padding Fix */

/* Main container */
.schleicher-social-feed {
    width: 100%;
    max-width: 100%;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    position: relative;
}

/* Carousel wrapper */
.carousel-container {
    position: relative;
    width: 100%;
    overflow: visible;
    background: transparent;
    border-radius: 12px;
    padding: 20px;
    box-sizing: border-box;
}

/* Track for slides */
.carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Individual slides */
.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.carousel-slide.active {
    opacity: 1;
    visibility: visible;
    position: relative;
}

/* Grid layout */
.posts-grid {
    display: grid;
    gap: 20px;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Post card */
.post-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 400px;
    min-height: 400px;
    max-height: 400px;
    position: relative;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Post image */
.post-image {
    width: 100%;
    height: 160px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.post-card:hover .post-image img {
    transform: scale(1.05);
}

/* Placeholder image styling */
.post-image.no-image {
    background: linear-gradient(135deg, #1372B7 0%, #0a3d62 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-image.no-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.95;
}

/* Post content area */
.post-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
}

/* Post header */
.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.post-author {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 14px;
}

.post-date {
    color: #666;
    font-size: 12px;
}

/* Post text content */
.post-text {
    color: #333;
    line-height: 1.6;
    font-size: 14px;
    margin-bottom: 15px;
    flex-grow: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
}

/* Post actions */
.post-actions {
    margin-top: auto;
    padding-bottom: 10px;
}

.read-more-btn {
    display: inline-block;
    padding: 8px 20px;
    background: #8e0303;
    color: white !important;
    text-decoration: none !important;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease, transform 0.2s ease;
    cursor: pointer;
}

.read-more-btn:hover {
    background: #666666;
    transform: translateY(-1px);
    text-decoration: none !important;
}

/* Post footer */
.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
}

.post-source {
    display: flex;
    align-items: center;
    color: #666;
    font-size: 12px;
}

.source-icon {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    fill: #0a3d62;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border: 1px solid #666666;
    border-radius: 4px;
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 12px;
    transition: all 0.3s ease;
    background: #666666;
    cursor: pointer;
}

.share-btn:hover {
    border-color: #d4a017;
    color: #666666 !important;
    background: #d4a017;
    text-decoration: none !important;
}

/* Navigation buttons */
.carousel-prev,
.carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #d4a017;
    color: white;
    border: 2px solid #d4a017;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    font-weight: normal;
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    line-height: 1;
}

.carousel-prev:hover,
.carousel-next:hover {
    background: #0a3d62;
    color: white;
    border-color: #0a3d62;
    box-shadow: 0 4px 12px rgba(29, 161, 242, 0.3);
}

.carousel-prev {
    left: -60px;
}

.carousel-next {
    right: -60px;
}

/* Dots navigation */
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding: 10px;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: #d0d0d0;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.carousel-dot:hover {
    background: #0a3d62;
    transform: scale(1.2);
}

.carousel-dot.active {
    width: 24px;
    border-radius: 4px;
    background: #8e0303;
}

/* Layout variations based on posts per slide */
/* 3 posts (1x3) - Single row */
.schleicher-social-feed[data-posts-per-slide="3"] .carousel-container {
    height: 480px !important;
}

.schleicher-social-feed[data-posts-per-slide="3"] .posts-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    grid-template-rows: 1fr !important;
}

/* 4 posts (2x2) */
.schleicher-social-feed[data-posts-per-slide="4"] .carousel-container {
    height: 960px !important;
}

.schleicher-social-feed[data-posts-per-slide="4"] .posts-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* 6 posts (2x3) - Default */
.schleicher-social-feed[data-posts-per-slide="6"] .carousel-container {
    height: 960px !important;
}

.schleicher-social-feed[data-posts-per-slide="6"] .posts-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* 8 posts (2x4) */
.schleicher-social-feed[data-posts-per-slide="8"] .carousel-container {
    height: 960px !important;
}

.schleicher-social-feed[data-posts-per-slide="8"] .posts-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* 9 posts (3x3) */
.schleicher-social-feed[data-posts-per-slide="9"] .carousel-container {
    height: 1440px !important;
}

.schleicher-social-feed[data-posts-per-slide="9"] .posts-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

/* Error message */
.mastodon-carousel-error {
    padding: 20px;
    text-align: center;
    color: #e74c3c;
    background: #fdf2f2;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin: 20px auto;
    max-width: 600px;
}

/* Loading state */
.schleicher-social-feed.loading {
    min-height: 440px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.schleicher-social-feed.loading::after {
    content: 'Loading posts...';
    font-size: 16px;
}

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design - Tablet */
@media (max-width: 1024px) {
    .carousel-container {
        padding: 15px;
    }
    
    .posts-grid {
        gap: 15px;
    }
    
    /* Maintain 3 columns for 1x3 layout on tablets */
    .schleicher-social-feed[data-posts-per-slide="3"] .posts-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    /* Adjust other layouts */
    .schleicher-social-feed[data-posts-per-slide="6"] .posts-grid,
    .schleicher-social-feed[data-posts-per-slide="8"] .posts-grid,
    .schleicher-social-feed[data-posts-per-slide="9"] .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }
}

/* Responsive design - Small Tablet */
@media (max-width: 768px) {
    .carousel-container {
        padding: 12px;
        height: auto !important;
    }
    
    .posts-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: auto !important;
        gap: 12px;
    }
    
    .post-image {
        height: 140px;
    }
    
    .post-card {
        min-height: auto;
    }
    
    .carousel-prev,
    .carousel-next {
        width: 38px;
        height: 38px;
        font-size: 20px;
        left: -50px;
        right: -50px;
    }
}

/* Mobile Optimization - 1 POST PER SLIDE */
@media (max-width: 480px) {
    /* Mobile layout gets proper structure from PHP */
    .schleicher-social-feed.mobile-layout .carousel-container {
        padding: 15px;
        height: auto !important;
        min-height: 520px;
    }
    
    /* Mobile grid styling */
    .schleicher-social-feed.mobile-layout .posts-grid {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
    }
    
    /* Make the single card larger and centered on mobile */
    .schleicher-social-feed.mobile-layout .post-card {
        height: auto !important;
        min-height: 480px;
        max-height: none;
        width: 100%;
        max-width: 360px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
    }
    
    .schleicher-social-feed.mobile-layout .post-image {
        height: 220px;
        flex-shrink: 0;
    }
    
    .schleicher-social-feed.mobile-layout .post-content {
        padding: 18px;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        min-height: 0;
    }
    
    .schleicher-social-feed.mobile-layout .post-text {
        font-size: 15px;
        -webkit-line-clamp: 4;
        margin-bottom: 18px;
        line-height: 1.5;
    }
    
    .schleicher-social-feed.mobile-layout .post-author {
        font-size: 15px;
    }
    
    .schleicher-social-feed.mobile-layout .post-date {
        font-size: 13px;
    }
    
    .schleicher-social-feed.mobile-layout .read-more-btn {
        padding: 10px 24px;
        font-size: 15px;
    }
    
    .schleicher-social-feed.mobile-layout .post-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 12px;
        border-top: 1px solid #f0f0f0;
        margin-top: auto;
        flex-shrink: 0;
    }
    
    /* Show navigation arrows on mobile */
    .schleicher-social-feed.mobile-layout .carousel-prev,
    .schleicher-social-feed.mobile-layout .carousel-next {
        display: flex !important;
        width: 40px;
        height: 40px;
        font-size: 22px;
    }
    
    .schleicher-social-feed.mobile-layout .carousel-prev {
        left: -55px;
    }
    
    .schleicher-social-feed.mobile-layout .carousel-next {
        right: -55px;
    }
    
    .schleicher-social-feed.mobile-layout .carousel-dots {
        padding: 15px 8px;
        gap: 8px;
        margin-top: 15px;
    }
    
    .schleicher-social-feed.mobile-layout .carousel-dot {
        width: 8px;
        height: 8px;
    }
    
    .schleicher-social-feed.mobile-layout .carousel-dot.active {
        width: 20px;
    }
    
    /* Fallback for any non-mobile-layout on mobile screens */
    .schleicher-social-feed:not(.mobile-layout) .carousel-container {
        height: auto !important;
        padding: 12px;
    }
    
    .schleicher-social-feed:not(.mobile-layout) .posts-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto !important;
        gap: 12px;
    }
    
    .schleicher-social-feed:not(.mobile-layout) .post-card {
        height: auto !important;
        min-height: 300px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .carousel-container {
        padding: 12px;
    }
    
    .schleicher-social-feed.mobile-layout .post-card {
        max-width: 100%;
    }
    
    .carousel-prev,
    .carousel-next {
        left: -45px !important;
        right: -45px !important;
    }
}

/* Accessibility */
.carousel-prev:focus,
.carousel-next:focus,
.carousel-dot:focus,
.read-more-btn:focus,
.share-btn:focus {
    outline: 2px solid #1da1f2;
    outline-offset: 2px;
}

/* Remove unwanted link styles */
.post-card a {
    box-shadow: none !important;
}

/* Screen reader only content */
.sr-live-region {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Print styles */
@media print {
    .carousel-prev,
    .carousel-next,
    .carousel-dots {
        display: none;
    }
    
    .carousel-slide {
        position: static;
        opacity: 1;
        visibility: visible;
    }
    
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .carousel-slide,
    .post-card,
    .post-image img,
    .carousel-prev,
    .carousel-next,
    .carousel-dot,
    .read-more-btn,
    .share-btn {
        transition: none;
    }
}
</style>
