/* ==========================================================================
   Homepage Styles
   ========================================================================== */


.homepage-content {
    width: 100%;
    padding: 0;
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}
/* Front page specific layout */
@media (min-width: 769px) {
    
     .home .forum-sidebar,
    .front-page .forum-sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        height: calc(100vh - var(--header-height));
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 10;
        background: var(--bg-color);
        box-shadow: var(--shadow-hover);
        overflow-y: auto;
    }
    
    /* When sidebar is opened */
    .home .forum-container.sidebar-visible .forum-sidebar,
    .front-page .forum-container.sidebar-visible .forum-sidebar {
        transform: translateX(0);
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.15);
    }
    
    /* Homepage main content - full width always */
    .home .forum-main,
    .front-page .forum-main {
        width: 100% !important;
        padding: 0;
        margin: 0;
    }
}

/* ==========================================================================
   Hero Section - Video and Slider Support
   ========================================================================== */

/* Hero Section Positioning */
.hero-section {
    position: relative;
    width: 100vw;
    margin-left: calc(-50vw + 50%); /* Full viewport width trick */
    height: 70vh;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-size: cover;
    background-position: top;
    background-attachment: fixed;
    z-index: 1; /* Below sidebar */
}

/* Video Background Styles */
.hero-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* Image Slider Background Styles */
.hero-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.hero-slide.active {
    opacity: 1;
}

/* Respect reduced motion preference for slider */
@media (prefers-reduced-motion: reduce) {
    .hero-slide {
        transition: none;
    }
    
    /* Show only the first slide */
    .hero-slide:not(:first-child) {
        display: none;
    }
    
    .hero-slide:first-child {
        opacity: 1;
    }
}

/* Hero Overlay */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Background color controlled by customizer - see forum_theme_customizer_css() */
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 2;
}

.home-hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: white;
    max-width: 800px;
    padding: 2rem;
}

/* Sections after hero */
.start-here-section,
.blueprint-categories-section,
.highlights-section,
.featured-posts-section,
.recent-activity-section {
    width: 100%;
    padding: 3rem 0;
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* When sidebar is visible, adjust section containers */
.home .forum-container.sidebar-visible .section-container,
.front-page .forum-container.sidebar-visible .section-container {
    max-width: 900px; /* Smaller when sidebar is visible */
}

/* Enhanced text styling for better readability over video/images */
.hero-title,
.hero-subtitle {
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
    color: white;
}

.hero-title {
    font-size: 3rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 2.5rem;
    line-height: 1.6;
    opacity: 0.95;
    font-weight: 400;
}

/* Button enhancements for video backgrounds */
.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-section .btn-primary {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 2px solid transparent;
}

.hero-section .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    color: white;
}

.hero-section .btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: white;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hero-section .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: white;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Loading state for better UX */
.hero-section.loading .home-hero-content {
    opacity: 0.9;
}

/* Error state - fallback to background image */
.hero-section.video-error .hero-video {
    display: none;
}

.hero-section.video-error {
    background-image: var(--fallback-image) !important;
}

/* Slow connection adaptation */
.hero-section.slow-connection .hero-video {
    display: none;
}

.hero-section.slow-connection {
    background-image: var(--fallback-image) !important;
}

/* Mobile optimisations */
@media (max-width: 768px) {
    .hero-section {
        min-height: 70vh;
        padding: 4rem 1rem;
        background-attachment: scroll; /* Better mobile performance */
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
        margin-bottom: 2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
    }
    
    /* Note: Overlay opacity controlled by customizer - see forum_theme_customizer_css() */
}

@media (max-width: 480px) {
    .hero-section {
        min-height: 60vh;
        padding: 3rem 1rem;
    }
    
    .hero-title {
        font-size: 1.875rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
}

/* Accessibility and performance optimisations */
@media (prefers-reduced-motion: reduce) {
    .hero-video {
        display: none !important;
    }
    
    .hero-section {
        background-image: var(--fallback-image) !important;
    }
    
    .hero-video,
    .hero-overlay {
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .hero-overlay {
        background: rgba(0, 0, 0, 0.8);
    }
    
    [data-theme="dark"] .hero-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
    
    .hero-title,
    .hero-subtitle {
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
        font-weight: var(--font-weight-normal);
    }
    
    .hero-section .btn-primary,
    .hero-section .btn-secondary {
        border-width: 3px;
    }
}

/* Data saver mode detection */
@media (prefers-reduced-data: reduce) {
    .hero-video {
        display: none !important;
    }
    
    .hero-slider {
        display: none !important;
    }
    
    .hero-section {
        background-image: var(--fallback-image) !important;
    }
}

/* Print styles */
@media print {
    .hero-video,
    .hero-slider {
        display: none !important;
    }
    
    .hero-section {
        background: #f5f5f5 !important;
        color: #333 !important;
        min-height: auto;
        padding: 2rem;
    }
    
    .hero-overlay {
        display: none;
    }
    
    .hero-title,
    .hero-subtitle {
        color: #333 !important;
        text-shadow: none !important;
    }
    
    .hero-buttons {
        display: none;
    }
}

/* Connection speed adaptations */
.connection-slow .hero-video,
.connection-slow .hero-slider {
    display: none;
}

.connection-slow .hero-section {
    background-image: var(--fallback-image) !important;
}

/* Battery level considerations */
.battery-low .hero-video,
.battery-low .hero-slider {
    display: none;
}

.battery-low .hero-section {
    background-image: var(--fallback-image) !important;
}

/* ==========================================================================
   Button Styles
   ========================================================================== */

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    cursor: pointer;
    min-width: 160px;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-outline {
    background: transparent;
    color: var(--text-color);
    border-color: var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ==========================================================================
   Start Here Section
   ========================================================================== */

.start-here-section {
    padding: 4rem 0;
    background: var(--bg-color);
}

.section-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 400;
}

.start-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.start-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    display: block;
}

.start-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.card-icon {
    width: 4rem;
    height: 4rem;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    transition: all 0.3s ease;
}

.start-card:hover .card-icon {
    transform: scale(1.1);
    background: var(--primary-hover);
}

.card-icon .material-icon {
    font-size: 2rem;
    color: white;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.card-description {
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* ==========================================================================
   Blueprint Category Tiles Section
   ========================================================================== */

.blueprint-categories-section {
    padding: 4rem 0;
    background: var(--bg-color);
}

.section-title {
    font-size: 2rem;
    font-weight: 400;
    color: var(--text-color);
    margin-bottom: 3rem;
    text-align: center;
}

.blueprint-tiles-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.blueprint-tile {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.blueprint-tile:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.blueprint-tile-image {
    width: 100%;
    height: 170px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-secondary);
    position: relative;
}


.blueprint-tile-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
}

.blueprint-tile-placeholder .material-icon {
    font-size: 4rem;
    color: white;
    opacity: 0.8;
}

.blueprint-tile-content {
    padding: .3rem 1.5rem 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.blueprint-tile-title {
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    line-height: 1.4;
}

.blueprint-tile-description {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.9375rem;
    margin: 0;
}

/* Responsive adjustments for blueprint tiles */
@media (max-width: 1024px) {
    .blueprint-tiles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .blueprint-tiles-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ==========================================================================
   Featured Blueprints & Posts Sections (Highlights)
   ========================================================================== */

.blueprint-categories-section,
.featured-posts-section {
    padding: 3rem 0 5rem;
    background: var(--bg-secondary);
}

.highlights-carousel {
    position: relative;
    overflow: hidden;
}

.highlights-container {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 0;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.highlights-container::-webkit-scrollbar {
    display: none;
}

.highlight-card {
    flex: 0 0 350px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease;
}

.highlight-card:hover {
    box-shadow: var(--shadow-hover);
}

.highlight-link {
    display: block;
    text-decoration: none;
    color: var(--text-color);
    height: 100%;
}

.highlight-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-secondary);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .highlight-image::before {
    background: var(--bg-secondary);
    opacity: 0.5;
}

.featured-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.featured-badge .material-icon {
    font-size: 1rem;
}

.highlight-content {
    padding: 1.5rem;
}

.highlight-title {
    font-size: 1.125rem;
    font-weight: 400;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    line-height: 1.4;
}

.highlight-excerpt {
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.highlight-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    gap: 1rem;
}

.highlight-author,
.highlight-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.highlight-meta .material-icon {
    font-size: 0.875rem;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.carousel-nav:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.carousel-prev {
    left: -1.5rem;
}

.carousel-next {
    right: -1.5rem;
}

.carousel-nav .material-icon {
    font-size: 1.25rem;
}

/* ==========================================================================
   Recent Activity Section
   ========================================================================== */

.recent-activity-section,
.highlights-section {
    padding: 3rem 0 5rem;
    background: var(--bg-color);
}

.activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.activity-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.activity-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.activity-link {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    text-decoration: none;
    color: var(--text-color);
}

.activity-icon {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.activity-icon .material-icon {
    font-size: 1.25rem;
    color: var(--primary-color);
}

.activity-content {
    flex-grow: 1;
    min-width: 0;
}

.activity-title {
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    line-height: 1.4;
}

.activity-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.section-footer {
    text-align: center;
    margin-top: 2rem;
}

/* ==========================================================================
   Front Page Sidebar - Closed by Default
   ========================================================================== */

@media (max-width: 768px) {
    .home .forum-container,
    .front-page .forum-container {
        flex-direction: column;
 
    }
    
    .home .forum-main,
    .front-page .forum-main {
        width: 100%;
        margin-left: 0;
        padding: 0;
    }
    
    .hero-section {
        height: 60vh;
        min-height: 400px;
        margin-left: 0;
        width: 100%;
    }
    
    .home-hero-content {
        padding: 1rem;
    }
    
    .section-container {
        padding: 0 1rem;
    }
}

/* Smooth transitions for sidebar toggle */
.hero-section,
.start-here-section,
.blueprint-categories-section,
.highlights-section,
.featured-posts-section,
.recent-activity-section {
    transition: all 0.3s ease;
}

/* Ensure hero section layers properly below sidebar */
.hero-section {
    z-index: 5; /* Below sidebar but above other content */
}

/* Fix for any layout shifts during transitions */
.home .forum-main,
.front-page .forum-main {
    will-change: margin-left, width;
}

.home .forum-sidebar,
.front-page .forum-sidebar {
    will-change: transform;
}

/**
 * Homepage Grid Layouts
 * CSS for the simplified featured blueprints and blog posts sections
 * 
 * This replaces the carousel styles with simple grid layouts:
 * - .blueprints-grid: 3 columns for featured blueprints
 * - .posts-grid: 3 columns that can stack for blog posts
 */

/* Featured Blueprints Grid - Fixed 3 items */
.blueprints-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

/* Blog Posts Grid - 3 columns, can stack to multiple rows */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

/* Tablet view - 2 columns */
@media (max-width: 768px) {
    .blueprints-grid,
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
    .blueprint-tiles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* Mobile view - 1 column */
@media (max-width: 480px) {
    .blueprints-grid,
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .blueprint-tiles-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

}

/* Ensure highlight cards fill their grid cells properly */
.blueprints-grid .highlight-card,
.posts-grid .highlight-card {
    height: 100%;
}

/* Ensure the link inside cards stretches to fill */
.blueprints-grid .highlight-link,
.posts-grid .highlight-link {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Make sure content area grows to fill available space */
.blueprints-grid .highlight-content,
.posts-grid .highlight-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Push meta to bottom of card */
.blueprints-grid .highlight-meta,
.posts-grid .highlight-meta {
    margin-top: auto;
}