/* ============================================================================================================*/
/*============================================= COMMUNITIES PAGE LAYOUT ================================*/
/* ============================================================================================================*/

/* ============================================================================================================*/
/* IMAGE SIZE CONTROLS - Change ONLY these 2 numbers to control article size */
/* ============================================================================================================*/
:root {
    --article-image-height: 220px;
    --article-image-width: 800px;  /* Set width explicitly */
}

.communities-sidebar-left .featured-image-placeholder {
    height: var(--article-image-height);
    width: var(--article-image-width);
    /* Remove aspect-ratio line */
}
/* Common ratios: 16/9 (wide), 4/3 (standard), 3/4 (portrait), 1/1 (square) */

/* Prevent horizontal overflow */
body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Main 3-column layout */
.communities-page-layout {
    display: grid;
    grid-template-columns: 290px 1fr 400px;
    gap: .3px;
    padding-top: 120px;
    max-width: 100%;
    margin: 0 auto;
    margin-top: -8rem !important;
    padding-left: 10px;
    padding-right: 10px;
    box-sizing: border-box;
}

/* Make nav bar smaller */
.floating-nav {
    padding: 0.2rem 0 !important;
}

.nav-container {
    padding: 0 .7rem !important;
}

.nav-brand {
    font-size: 2rem !important;
}

.nav-thumbnail {
    width: 50px !important;
    height: 50px !important;
    border: none !important;
}

.nav-thumbnail img {
    border: none !important;
}

.nav-label {
    font-size: 0.65rem !important;
}

/* ==================== LEFT SIDEBAR - Featured Articles ==================== */
.communities-sidebar-left {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    z-index: 20;
    padding-top: 30px;
    margin-right: -30px; /* Overlaps toward carousel */
}

.communities-sidebar-left .featured-box {
    /* Box wraps to image size - NO fixed dimensions */
    width: fit-content;
    max-width: 100%;
    
    border-radius: 8px;
    border: none !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3),
                inset 0 1px 1px rgba(212, 165, 116, 0.1);
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateX(10px);
}

.communities-sidebar-left .featured-box:hover {
    transform: translateX(15px) translateY(-5px);
    border: none !important;
    box-shadow: 0 8px 24px rgba(212, 165, 116, 0.4),
                inset 0 1px 1px rgba(212, 165, 116, 0.15);
}

.communities-sidebar-left .featured-image-placeholder {
    /* IMAGE controls everything */
    height: var(--article-image-height);
    aspect-ratio: var(--article-image-ratio);
    width: auto;
    min-width: 100%; /* Ensures it fills box horizontally */
    
    border-radius: 8px 8px 0 0;
    border: none !important;
    overflow: hidden;
    margin-bottom: 0;
    background: #000;
    flex-shrink: 0;
}

.communities-sidebar-left .featured-image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    display: block;
    border: none !important;
}

.communities-sidebar-left .featured-box:hover .featured-image-placeholder img {
    transform: scale(1.1);
}

.communities-sidebar-left .featured-label {
    display: inline-block;
    background: (--color-primary)574;
    color: #000;
    padding: 0.25rem 0.6rem;
    font-size: 0.65rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 1rem 0 0.75rem 1.5rem;
}

.communities-sidebar-left .featured-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    padding: 0 1.5rem;
}

.communities-sidebar-left .featured-meta {
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    padding: 0 1.5rem 1.5rem;
}

/* ==================== MAIN CONTENT - Carousel ==================== */
.communities-main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 5;
}

.communities-main-content .section-title {
    font-size: 3.5rem;
    margin-top: 30px;
    margin-bottom: 0.5rem;
    text-align: center;
}

.communities-intro {
    text-align: center;
    font-size: 1rem;
    color: #999;
    margin-bottom: 3rem;
    letter-spacing: 0.05em;
}

/* Space between title/intro and carousel */
.carousel-container.communities-carousel {
    margin-top: 5px !important;
    position: relative;
    z-index: 10;
}

/* ==================== SCALED 3D CAROUSEL ==================== */
.communities-carousel .carousel-container {
    position: relative;
    width: 100%;
    height: 600px;
    perspective: 1400px;
    perspective-origin: center 60%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15rem;
    z-index: 5;
}

.communities-carousel .carousel-3d {
    position: relative;
    width: 300px;
    height: 350px;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(0deg);
    transition: transform 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.communities-carousel .carousel-item {
    position: absolute;
    width: 300px;
    height: 350px;
    border-radius: 16px;
    border: none !important;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 30px rgba(212, 165, 116, 0.2),
                inset 0 1px 1px rgba(212, 165, 116, 0.1);
    transition: all 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
    display: flex;
    flex-direction: column;
    left: 50%;
    top: 50%;
    margin-left: -150px;
    margin-top: -175px;
    transform-style: preserve-3d;
}

.communities-carousel .carousel-item img {
    width: 100%;
    height: 85%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.5s ease;
    border: none !important;
}

.communities-carousel .carousel-item .community-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.95) 0%,
        rgba(0, 0, 0, 0.7) 70%,
        transparent 100%
    );
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-align: center;
    color: var(--color-primary);
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    z-index: 5;
}

.communities-carousel .carousel-item:hover img {
    transform: scale(1.1);
}

.communities-carousel .carousel-item:hover {
    box-shadow: 0 30px 80px rgba(212, 165, 116, 0.4),
                0 0 50px rgba(212, 165, 116, 0.3),
                inset 0 1px 2px rgba(212, 165, 116, 0.2);
    border: none !important;
}

/* ==================== CAROUSEL CONTROLS ==================== */
.communities-carousel .carousel-control {
    position: absolute;
    top: 56%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg,
        rgba(26, 26, 26, 0.9) 0%,
        rgba(40, 30, 25, 0.9) 100%
    );
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 2px solid rgba(212, 165, 116, 0.3);
    border-radius: 50%;
    color: var(--color-primary);
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4),
                inset 0 1px 1px rgba(212, 165, 116, 0.1);
}

.communities-carousel .carousel-control:hover {
    background: linear-gradient(135deg,
        rgba(212, 165, 116, 0.2) 0%,
        rgba(212, 165, 116, 0.3) 100%
    );
    border-color: rgba(212, 165, 116, 0.7);
    box-shadow: 0 12px 32px rgba(212, 165, 116, 0.5),
                0 0 30px rgba(212, 165, 116, 0.4);
    transform: translateY(-50%) scale(1.1);
}

.communities-carousel .carousel-control-left {
    left: 17%;
}

.communities-carousel .carousel-control-right {
    right: 17%;
}

/* ==================== THUMBNAIL NAVIGATION STRIP ==================== */
.carousel-thumbnails {
    display: flex;
    justify-content: flex-start;
    gap: 0.75rem;
    margin-top: -12rem;
    padding: 1rem;
    max-width: 900px;
    overflow-x: auto;
    flex-wrap: nowrap;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 15;
}

.thumbnail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.5;
}

.thumbnail-item img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    border: none !important;
    object-fit: cover;
    transition: all 0.3s ease;
    transform: scale(0.9);
}

.thumbnail-label {
    font-size: 0.65rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.thumbnail-item:hover {
    opacity: 0.8;
}

.thumbnail-item:hover img {
    transform: scale(1);
}

.thumbnail-item:hover .thumbnail-label {
    color: var(--color-primary);
}

.thumbnail-item.active {
    opacity: 1;
}

.thumbnail-item.active img {
    transform: scale(1.2);
    border: 2px solid var(--color-primary) !important;
    box-shadow: 0 0 20px rgba(212, 165, 116, 0.6),
                0 4px 12px rgba(0, 0, 0, 0.4);
}

.thumbnail-item.active .thumbnail-label {
    color: var(--color-primary);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(212, 165, 116, 0.5);
}

/* ==================== RIGHT SIDEBAR - Event Calendar + Community Nav ==================== */
.communities-sidebar-right {
    display: flex;
    flex-direction: row-reverse;
    gap: 1rem;
    position: sticky;
    top: 100px;
    align-self: start;
    z-index: 20;
    padding-top: 30px;
    margin-left: -30px;
}

/* ==================== COMMUNITY NAVIGATION MENU ==================== */
.community-nav-menu {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 80px;
}

.community-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.6;
    text-decoration: none;
}

.community-nav-item img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: none !important;
    object-fit: cover;
    transition: all 0.3s ease;
    transform: scale(0.95);
}

.community-nav-item span {
    font-size: 0.45rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    text-align: center;
    margin-top: 0.25rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.community-nav-item:hover {
    opacity: 0.9;
}

.community-nav-item:hover img {
    transform: scale(1);
}

.community-nav-item:hover span {
    color: var(--color-primary);
}

.community-nav-item.active {
    opacity: 1;
}

.community-nav-item.active img {
    transform: scale(1.1);
    border: 2px solid var(--color-primary) !important;
    box-shadow: 0 0 15px rgba(212, 165, 116, 0.5),
                0 4px 10px rgba(0, 0, 0, 0.4);
}

.community-nav-item.active span {
    color: var(--color-primary);
    font-weight: bold;
    text-shadow: 0 0 8px rgba(212, 165, 116, 0.4);
}

/* ==================== EVENT CALENDAR ==================== */
.event-calendar-box {
    flex: 1;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3),
                inset 0 1px 1px rgba(212, 165, 116, 0.1);
    padding: 1.5rem;
    transform: translateX(-10px);
}

.calendar-title {
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    color: var(--color-primary);
    text-align: center;
}

.event-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(212, 165, 116, 0.15);
    transition: all 0.3s ease;
    cursor: pointer;
}

.event-item:hover {
    background: rgba(212, 165, 116, 0.1);
    border-color: rgba(212, 165, 116, 0.4);
    transform: translateX(5px);
}

.event-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #a67c52 100%);
    border-radius: 8px;
}

.event-month {
    font-size: 0.6rem;
    font-weight: bold;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.event-day {
    font-size: 1.3rem;
    font-weight: bold;
    color: #000;
}

.event-details {
    flex: 1;
}

.event-name {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 0.4rem;
    color: #fff;
}

.event-location {
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.view-all-events-btn {
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, #a67c52 100%);
    color: #000;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-all-events-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.5);
}

/* ==================== DYNAMIC CONTENT TRANSITIONS ==================== */
.article-set,
.event-set {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.article-set.active {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.event-set.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
    .communities-page-layout {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .communities-sidebar-left {
        order: 2;
        flex-direction: row;
        gap: 2rem;
        margin-right: 0;
    }
    
    .communities-main-content {
        order: 1;
    }
    
    .communities-sidebar-right {
        order: 3;
        position: relative;
        top: 0;
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .communities-sidebar-left {
        flex-direction: column;
    }
    
    .carousel-thumbnails {
        flex-wrap: wrap;
        margin-top: -8rem;
    }
}

/* ==================== COMMUNITIES PAGE GLASSMORPHISM - UNIFIED CONTROL ==================== */
:root {
    --card-opacity: 0.1;
    --card-blur: 2px;
    --card-saturation: 15%;
}

/* Sidebar boxes - Premium Glassmorphism */
.communities-sidebar-left .featured-box,
.event-calendar-box,
.community-nav-menu {
    background: linear-gradient(120deg, 
        rgba(26, 26, 26, var(--card-opacity)) 0%,
        rgba(35, 28, 24, calc(var(--card-opacity) + 0.03)) 25%,
        rgba(40, 30, 25, calc(var(--card-opacity) + 0.05)) 50%,
        rgba(35, 28, 24, calc(var(--card-opacity) + 0.03)) 75%,
        rgba(26, 26, 26, var(--card-opacity)) 100%
    ) !important;
    backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturation)) brightness(1.08) !important;
    -webkit-backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturation)) brightness(1.08) !important;
    border: none !important;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 1px rgba(255, 255, 255, 0.12),
        inset 0 -1px 1px rgba(0, 0, 0, 0.12),
        0 0 30px rgba(212, 165, 116, 0.08) !important;
}

/* Carousel thumbnails - Premium Glassmorphism */
.carousel-thumbnails {
    background: linear-gradient(120deg, 
        rgba(26, 26, 26, var(--card-opacity)) 0%,
        rgba(35, 28, 24, calc(var(--card-opacity) + 0.03)) 25%,
        rgba(40, 30, 25, calc(var(--card-opacity) + 0.05)) 50%,
        rgba(35, 28, 24, calc(var(--card-opacity) + 0.03)) 75%,
        rgba(26, 26, 26, var(--card-opacity)) 100%
    ) !important;
    backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturation)) brightness(1.08) !important;
    -webkit-backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturation)) brightness(1.08) !important;
    border: none !important;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 1px rgba(255, 255, 255, 0.12),
        inset 0 -1px 1px rgba(0, 0, 0, 0.12),
        0 0 30px rgba(212, 165, 116, 0.08) !important;
}

/* Carousel items - Premium Glassmorphism */
.communities-carousel .carousel-item {
    background: linear-gradient(120deg,
        rgba(26, 26, 26, calc(var(--card-opacity) + 0.15)) 0%,
        rgba(35, 28, 24, calc(var(--card-opacity) + 0.18)) 30%,
        rgba(40, 30, 25, calc(var(--card-opacity) + 0.20)) 50%,
        rgba(35, 28, 24, calc(var(--card-opacity) + 0.18)) 70%,
        rgba(26, 26, 26, calc(var(--card-opacity) + 0.15)) 100%
    ) !important;
    backdrop-filter: blur(20px) saturate(140%) brightness(1.15) !important;
    -webkit-backdrop-filter: blur(20px) saturate(140%) brightness(1.15) !important;
    border: none !important;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 5px 20px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(212, 165, 116, 0.3),
        inset 0 2px 2px rgba(255, 255, 255, 0.15),
        inset 0 -2px 2px rgba(0, 0, 0, 0.2) !important;
}

/* Carousel controls - Premium Glassmorphism */
.communities-carousel .carousel-control {
    background: linear-gradient(135deg,
        rgba(26, 26, 26, 0.9) 0%,
        rgba(35, 28, 24, 0.95) 50%,
        rgba(40, 30, 25, 0.9) 100%
    ) !important;
    backdrop-filter: blur(20px) saturate(130%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(130%) !important;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 1px 1px rgba(212, 165, 116, 0.12),
        0 0 20px rgba(212, 165, 116, 0.08) !important;
}

/* Fix blurry images - keep them crisp */
.featured-image-placeholder img,
.carousel-item img {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
}

/* ============================================================================================================
   CORRECTED NAV CENTERING - STRONGER SELECTORS
   ============================================================================================================ */

/* Target ALL possible nav label variations */
.nav-label,
.floating-nav .nav-label,
.nav-item .nav-label,
.nav-container .nav-label,
.nav-thumbnail + .nav-label,
a .nav-label,
span.nav-label,
div.nav-label {
    font-size: 0.65rem !important;
    text-align: center !important;
    display: block !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Force centering on nav items */
.nav-item,
.floating-nav .nav-item,
.nav-container .nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

/* Force centering on nav thumbnails */
.nav-thumbnail,
.floating-nav .nav-thumbnail,
.nav-item .nav-thumbnail {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* If nav items are links */
.floating-nav a,
.nav-container a {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
}

/* Center text under community nav thumbnails */
.community-nav-item,
.community-nav-item span {
    text-align: center !important;
    display: block !important;
    width: 100% !important;
}

/* Center text under carousel thumbnails */
.thumbnail-label,
.thumbnail-item .thumbnail-label {
    text-align: center !important;
    display: block !important;
    width: 100% !important;
}