/*
Theme Name: Live Church
Theme URI: https://example.com/live-church-theme
Author: Christo Innocent
Author URI: https://example.com/christo-innocent
Description: A highly customized Single Page Application (SPA) WordPress theme designed for live ministry and media content.
Version: 1.0.0
Text Domain: live-church
Tags: one-column, custom-menu, custom-header, full-width-template, responsive-layout, accessibility-ready
*/

/* ==========================================================================
   1. GLOBAL STYLES & VARIABLES
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300..800&display=swap');

:root {
    --color-primary: #59167e;
    --color-accent: #f7a01d;
    --color-accent-bg: #fea916;
    --color-label-bg: #d37f00;
    --color-marquee-text: #3e2f11;
    --color-bg-light: #eff3fe;
    --color-bg-dark: #3a0058;
    --color-sidebar-bg: #8c54c3;
    --left-menu-width: 280px; /* Width of the slide-out menu */
    --right-push: 18px; /* How much the viewport nudges left when right sidebar opens */
}

/* Broader mobile coverage: ensure the bottom nav stays visible on larger mobile breakpoints too */
@media (max-width: 767px) {
    .left-nav[aria-locked="true"].slide-down {
        transform: translateY(0) !important;
        transition: none !important;
    }
}

body {
    font-family: 'Open Sans', sans-serif;
    background-color: var(--color-bg-dark);
    color: #ffffff;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Adds scroll locking when any menu/sidebar is open */
body.noscroll {
    overflow: hidden;
}

/*
* This is the key fix:
* When body.noscroll is active, find the main content window AND 
* the offcanvas menu itself and disable their individual scrolling.
*/
body.noscroll .main-content,
body.noscroll #left-offcanvas-menu {
    overflow-y: hidden;
}


/* ==========================================================================
   2. MOBILE SLIDE-OUT MENU
   ========================================================================== */

#left-offcanvas-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--left-menu-width);
    height: 100%;
    background-color: var(--color-primary);
    z-index: 110; /* Highest level for the menu itself */
    overflow-y: auto;
    padding-top: 40px; /* To avoid announcement bar */
    transform: translateX(-100%); /* Start off-screen */
    transition: transform 0.3s ease-in-out;
}
#left-offcanvas-menu nav a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: background-color 0.2s;
}
#left-offcanvas-menu nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
#left-offcanvas-menu nav a i {
    width: 24px;
    margin-right: 1rem;
    text-align: center;
}

#viewport-container {
    position: relative;
    transition: transform 0.3s ease-in-out;
    background-color: var(--color-bg-dark);
    min-height: 100vh;
    z-index: 99; 
}
#viewport-container.left-menu-open {
    transform: translateX(var(--left-menu-width));
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}
/* ------------------------------------------------------------------
   RIGHT SIDEBAR: push + subtle decelerating transition
   - The sidebar is translated off-screen by default (translateX(100%)).
   - When the container receives the class `right-sidebar-open` the
     viewport nudges left slightly and the sidebar translates to 0.
   - The cubic-bezier curve produces a fast-start, slow-end effect.
   ------------------------------------------------------------------ */

#right-sidebar {
    /* Start off-screen to the right */
    transform: translateX(100%);
    will-change: transform;
    /* Duration chosen to be noticeable but snappy */
    transition: transform 420ms cubic-bezier(0.05, 0.7, 0.1, 1),
                box-shadow 420ms ease;
    box-shadow: -24px 0 40px rgba(0,0,0,0.25);
}

/* When the viewport container has this class the sidebar is visible */
#viewport-container.right-sidebar-open {
    /* Slight push to the left to create a subtle physical 'push' effect */
    transform: translateX(calc(var(--right-push) * -1));
    transition: transform 420ms cubic-bezier(0.05, 0.7, 0.1, 1);
}

/* Reveal the sidebar when its parent has the open class */
#viewport-container.right-sidebar-open #right-sidebar,
.right-sidebar.is-open {
    transform: translateX(0);
}

/* Backdrop fade (for the right sidebar) */
#sidebar-backdrop {
    opacity: 0;
    pointer-events: none;
    transition: opacity 320ms cubic-bezier(0.05, 0.7, 0.1, 1);
}

#viewport-container.right-sidebar-open #sidebar-backdrop,
#sidebar-backdrop.visible {
    opacity: 0.45; /* semi-opaque dim */
    pointer-events: auto;
}

/* Ensure the right-sidebar sits above the viewport when open */
#right-sidebar {
    z-index: 120;
}


/* When the menu is open, the menu itself becomes visible */
#viewport-container.left-menu-open + #left-offcanvas-menu,
#left-offcanvas-menu.is-open { /* Added a class for direct control too */
    transform: translateX(0);
}


/* ==========================================================================
   3. LAYOUT & CONTENT STYLES
   ========================================================================== */

.main-content {
    padding: 20px 50px 20px 40px;
}

#page-title {
    margin: 40px 0 15px 35px;
    font-size: 28px;
    font-weight: 700;
}

/* Hides the outer #page-title when blog lists/singles are shown */
#page-title.blog-title-hidden {
    display: none;
}

#dynamic-content-container {
    padding: 0 20px;
}

.content-card {
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.blog-post-card {
    background-color: rgba(255, 255, 255, 0.95);
    color: #333;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius:20px;
}

footer {
    margin: 45px 0;
    padding: 16px 20px;
    text-align: center;
}

/* ==========================================================================
   4. HEADER & ANNOUNCEMENT BAR
   ========================================================================== */

.top-announcement-bar {
    background-color: var(--color-accent-bg);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    padding: 0;
    font-weight: 700;
    font-size: 14px;
}

.top-announcement-bar .label {
    position: relative;
    z-index: 60;
    padding: 0 20px;
    background-color: var(--color-label-bg);
    color: white;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
}

.marquee-wrapper {
    flex-grow: 1;
    overflow: hidden;
    position: relative; 
    display: flex; 
    align-items: center; 
    min-height: 100%; 
}

/* Original marquee content style - Adjusted for seamless loop */
.marquee-content {
    display: inline-block; 
    white-space: nowrap;
    /* padding-left: 100%; REMOVED - Using duplicate content */
    animation-name: scrolling;
    animation-duration: 105s; /* SLOWED DOWN FURTHER */
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-delay: 2s; /* ADDED DELAY */
    color: var(--color-marquee-text);
    will-change: transform;
    font-weight: 700;
    padding-right: 40px; 
}

/* Remove ticker-specific styles */
.announcement-item,
.announcement-item.active,
.announcement-item.scrolling-announcement {
   display: none; 
}

/* Restore scrolling animation - Adjusted for seamless loop */
@keyframes scrolling {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-100%); } /* Scrolls left by the width of ONE content span */
}

/* Remove scroll-text animation */
@keyframes scroll-text {
   /* No longer needed */
}

.top-announcement-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -43px;
    width: 190px;
    height: 100%;
    background: linear-gradient(to right, var(--color-label-bg) 90px, rgba(211, 127, 0, 0) 190px);
    z-index: 55;
    pointer-events: none;
}

.top-announcement-bar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 100%;
    background: linear-gradient(to left, var(--color-accent-bg), rgba(254, 169, 22, 0));
    z-index: 55;
    pointer-events: none;
}

.header {
    background-color: var(--color-primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   5. NAVIGATION (LEFT & RIGHT SIDEBARS)
   ========================================================================== */
#left-menu-backdrop, #sidebar-backdrop {
    background-color: transparent; /* Removes dark overlay */
}
/* --- Left Nav (Desktop Floating / Mobile Bottom Bar) --- */
.left-nav {
    display: flex;
    position: fixed;
    z-index: 90; 
    background: var(--color-primary);
    transition: transform 0.3s ease-in-out;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    color: #848ea8;
    background-color: #eff3fe;
}

.nav-item.active {
    color: #ffffff;
    background-color: #d37f00;
}

.nav-item:hover:not(.active) {
    color: #3a0058;
    background-color: #efb969;
}


/* ==========================================================================
   6. RESPONSIVE STYLES
   ========================================================================== */

/* --- Desktop & Tablet (768px and up) --- */
@media (min-width: 768px) {
    .left-nav {
        flex-direction: column;
        align-items: center;
        top: 50%;
        left: 0;
        width: 80px;
        height: auto;
        max-height: 80vh;
        overflow-y: auto;
        transform: translateY(-50%) translateX(-30px);
        border-radius: 0 20px 20px 0;
    }
    .left-nav:hover {
        transform: translateY(-50%) translateX(0);
    }
    .nav-item {
        width: 80px;
        height: 80px;
    }
    .left-nav > .nav-item:first-child {
        border-top-right-radius: 20px !important;
    }
    .left-nav > .nav-item:last-child {
        border-bottom-right-radius: 20px !important;
    }
}

/* --- Mobile (767px and down) --- */
@media (max-width: 767px) {
    #main-header, .top-announcement-bar {
        position: fixed;
        width: 100%;
        z-index: 90; /* Sit above content, below menus */
        transition: transform 0.3s ease-in-out;
    }
    .top-announcement-bar {
        top: 0;
        height: 40px;
    }
    .top-announcement-bar.slide-up {
        transform: translateY(-100%);
    }
    .top-announcement-bar .desktop-label-text {
        display: none;
    }
    #main-header {
        top: 40px;
        height: 80px;
    }
    #main-header.slide-up {
        transform: translateY(-120px); /* Move up by its own height + announcement bar */
    }
    .left-nav {
        flex-direction: row;
        justify-content: stretch;
        bottom: 0;
        left: 0;
        width: 100vw;
        height: 65px;
        transform: translateY(0);
    }
    .left-nav.slide-down {
        transform: translateY(100%);
    }
    .nav-item {
        flex: 1;
    }
    .nav-item i {
        font-size: 20px;
        line-height: 25px;
    }
    .nav-item span {
        line-height: 1em;
    }
    .main-content {
        z-index: 1; /* Ensure content is below header */
        position: relative; /* Needed for z-index to work */
        padding: 120px 20px 65px; /* top, sides, bottom */
        height: 100vh;
        overflow-y: auto;
    }
    .main-content.header-hidden {
        padding-top: 40px;
    }
    .main-content.nav-hidden {
        padding-bottom: 0;
    }
    .main-content.nav-hidden footer {
        margin-bottom: 40px;
    }
    #page-title {
        margin: 0 0 20px 0; /* Adjusted for mobile */
        font-size: 23px;
        line-height: 30px;
    }
    #dynamic-content-container {
        padding: 0;
    }
}

/* --- Smaller Mobile Breakpoint (600px and down) --- */
@media (max-width: 600px) {
    #main-header {
        height: 65px;
    }
    .main-content {
        padding-top: 105px; /* 40px + 65px */
    }
    .main-content.header-hidden {
        padding-top: 40px;
    }
    #main-header.slide-up {
        transform: translateY(-105px); /* Move up by its own height + announcement bar */
    }
    #page-title {
        margin-left: 5px;
        margin-right: 5px;
    }
}

/* ==========================================================================
   7. CUSTOM POST TYPE LAYOUTS
   ========================================================================== */

/* --- Custom Layout: Groups Directory --- */
.custom-groups-directory {
    /* Styles for the main container of the groups page */
    padding: 0; /* placeholder to avoid empty ruleset (safe default) */
}
.group-card {
    /* Styles for an individual group card */
    background-color: white;
    border-radius: 15px;
    padding: 1rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    color: #333;
}
.group-card h3 {
    margin: 0 0 0.5rem 0; /* small, sensible default */
}

/* ------------------------------------------------------------------
   MOBILE OVERRIDES: Keep right-sidebar attached to the right edge
   Use right-based animation on small viewports to avoid centering issues
   ------------------------------------------------------------------ */
@media (max-width: 599px) {
    /* Hide any transform-based transitions and use right property */
    #right-sidebar {
        position: fixed !important;
        top: 0 !important;
        right: calc(-1 * (100vw - 30px)) !important; /* hide to the right */
        width: calc(100vw - 30px) !important;
        height: 100vh !important;
        transform: none !important;
        transition: right 420ms cubic-bezier(0.05, 0.7, 0.1, 1) !important;
        box-shadow: none !important; /* remove shadow on mobile */
        z-index: 120 !important;
    }

    /* When opened, snap to right:0 and remain attached to viewport edge */
    #right-sidebar.is-open,
    #right-sidebar.open,
    #viewport-container.right-sidebar-open #right-sidebar {
        right: 0 !important;
    }

    /* Prevent viewport shifting on mobile; keep it static */
    #viewport-container.right-sidebar-open {
        transform: none !important;
        box-shadow: none !important; /* remove any viewport shadow on mobile */
    }

    /* Make sure backdrop fades properly */
    #sidebar-backdrop {
        transition: opacity 320ms cubic-bezier(0.05, 0.7, 0.1, 1) !important;
    }

    /* Ensure bottom nav remains visible when aria-locked is set (covers more mobile sizes) */
    .left-nav[aria-locked="true"].slide-down {
        transform: translateY(0) !important;
        transition: none !important;
    }
}

