/* Substack Feed Display - Frontend Styles */

.substack-feed-container {
    max-width: 100%;
    margin: 0 auto;
}

/* Auto-Scroll Carousel Styles */
.substack-scroll-wrapper {
    position: relative;
    overflow: hidden;
    padding: 0 60px 50px;
}

.substack-scroll-viewport {
    overflow: hidden;
    width: 100%;
    position: relative;
}

/* Hide posts initially to prevent FOUC */
.substack-auto-scroll {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show posts after JavaScript has positioned them */
.substack-auto-scroll.sfd-ready {
    opacity: 1;
}

/* When auto-scroll is enabled, container scrolls horizontally through posts */
.substack-auto-scroll {
    display: flex !important;
    flex-wrap: nowrap !important;
    transition: margin-left 0.6s ease, opacity 0.3s ease;
    grid-template-columns: none !important; /* Override grid */
}

/* Each post in auto-scroll - width set by JavaScript */
.substack-auto-scroll .substack-post {
    /* Width and flex set dynamically by JavaScript */
    min-width: 0; /* Prevent flex item from overflowing */
    box-sizing: border-box;
}

/* Navigation Buttons */
.substack-scroll-prev,
.substack-scroll-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    font-size: 30px;
    line-height: 1;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.substack-scroll-prev:hover,
.substack-scroll-next:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.substack-scroll-prev {
    left: 0;
}

.substack-scroll-next {
    right: 0;
}

.substack-scroll-prev.disabled,
.substack-scroll-next.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Dot Indicators */
.substack-scroll-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.scroll-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e5e7eb;
    cursor: pointer;
    transition: all 0.3s ease;
}

.scroll-dot:hover {
    background: #cbd5e1;
    transform: scale(1.2);
}

.scroll-dot.active {
    background: #667eea;
    width: 30px;
    border-radius: 6px;
}


/* Grid Layout */
.substack-feed-grid {
    display: grid;
    gap: 30px;
}

.substack-feed-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.substack-feed-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.substack-feed-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Grid posts don't need bottom border */
.substack-feed-grid .substack-post {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* List Layout (default) */
.substack-post {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid #e0e0e0;
}

.substack-post:last-child {
    border-bottom: none;
}

.substack-post-image {
    margin-bottom: 20px;
    overflow: hidden;
    border-radius: 8px;
}

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

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

.substack-fallback-image {
    opacity: 0.95;
}

.substack-fallback-image img {
    object-fit: cover;
}

.substack-post-video-placeholder {
    margin-bottom: 20px;
    overflow: hidden;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 60px 20px;
    text-align: center;
    transition: transform 0.3s ease;
}

.substack-post-video-placeholder:hover {
    transform: scale(1.02);
}

.substack-post-video-placeholder a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: white;
    text-decoration: none;
}

.substack-post-video-placeholder svg {
    width: 80px;
    height: 80px;
    opacity: 0.9;
}

.substack-post-video-placeholder .video-label {
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

.substack-post-content {
    display: block;
}

.substack-post-title {
    margin: 0 0 15px;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
}

.substack-post-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.substack-post-title a:hover {
    color: #ff6719;
}

.substack-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.substack-author {
    display: flex;
    align-items: center;
}

.substack-author strong {
    margin-right: 5px;
}

.substack-date {
    display: flex;
    align-items: center;
}

.substack-date::before {
    content: "•";
    margin-right: 15px;
}

.substack-post-excerpt {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.6;
    color: #555;
}

.substack-read-more {
    display: inline-block;
    padding: 10px 20px;
    background-color: #ff6719;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.substack-read-more:hover {
    background-color: #e55a15;
    color: #fff;
}

/* Error and notice messages */
.sfd-error {
    padding: 15px;
    background-color: #fef2f2;
    border-left: 4px solid #dc2626;
    color: #991b1b;
    margin: 20px 0;
    border-radius: 4px;
}

.sfd-notice {
    padding: 15px;
    background-color: #fef9c3;
    border-left: 4px solid #eab308;
    color: #854d0e;
    margin: 20px 0;
    border-radius: 4px;
}

/* Footer Button */
.substack-footer-button-container {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
}

.substack-footer-button {
    display: inline-block;
    padding: 15px 40px;
    background-color: #ff6719;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 103, 25, 0.3);
}

.substack-footer-button:hover {
    background-color: #e55a15;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 103, 25, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Stack grid to 2 columns on tablets */
    .substack-feed-grid.columns-3,
    .substack-feed-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Auto-scroll adjustments for tablets */
    .substack-scroll-wrapper {
        padding: 0 50px 40px;
    }
    
    .substack-scroll-prev,
    .substack-scroll-next {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .substack-post-title {
        font-size: 24px;
    }
    
    .substack-post-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .substack-date::before {
        content: "";
        margin-right: 0;
    }
    
    .substack-post {
        margin-bottom: 30px;
        padding-bottom: 30px;
    }
    
    .substack-footer-button {
        padding: 12px 30px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    /* Stack all grids to single column on mobile */
    .substack-feed-grid.columns-2,
    .substack-feed-grid.columns-3,
    .substack-feed-grid.columns-4 {
        grid-template-columns: 1fr;
    }
    
    .substack-feed-grid {
        gap: 20px;
    }
    
    /* Auto-scroll adjustments for mobile */
    .substack-scroll-wrapper {
        padding: 0 40px 35px;
    }
    
    .substack-scroll-prev,
    .substack-scroll-next {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .scroll-dot {
        width: 10px;
        height: 10px;
    }
    
    .scroll-dot.active {
        width: 24px;
    }
    
    .substack-scroll-dots {
        gap: 8px;
        margin-top: 20px;
    }
    
    .substack-post-title {
        font-size: 20px;
    }
    
    .substack-post-excerpt {
        font-size: 15px;
    }
    
    .substack-read-more {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .substack-footer-button {
        padding: 12px 24px;
        font-size: 14px;
        width: 100%;
        max-width: 300px;
    }
}
