/*
Theme Name: CoreThread Theme
Theme URI: 
Author: Dendro Logic
Author URI: 
Description: A custom WordPress theme for CoreThread, based on the Dendro Logic template.
Version: 2.0
Text Domain: corethread-theme
*/

/* --- WordPress Defaults --- */
.aligncenter {
    display: block;
    margin: 0 auto;
}

.alignleft {
    float: left;
    margin-right: 1.5em;
}

.alignright {
    float: right;
    margin-left: 1.5em;
}

/* --- Custom Theme Styles --- */
body {
    background-color: #050505;
    color: #e5e5e5;
    overflow-x: hidden;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

body.loaded {
    opacity: 1;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.glass-panel:hover {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.tab-active {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #ffffff;
}

.text-gradient-green {
    background: linear-gradient(to right, #10b981, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-gold {
    background: linear-gradient(to right, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-glow-gold {
    color: #fbbf24 !important;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
    font-weight: 700;
}

/* --- Navigation & Dropdowns --- */
nav ul {
    list-style: none !important;
    padding: 0;
    margin: 0;
}

nav li {
    list-style: none !important;
}

/* Desktop Dropdown Behavior */
@media (min-width: 1280px) {
    .sub-menu {
        position: absolute;
        left: 0;
        top: 100%;
        margin-top: 0.5rem;
        width: 12rem;
        background-color: #0f172a;
        /* Brand Card */
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0.5rem;
        padding: 0.5rem 0;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        opacity: 0;
        visibility: hidden;
        transition: all 0.2s ease;
        z-index: 50;
        display: flex;
        flex-direction: column;
    }

    .group:hover>.sub-menu {
        opacity: 1;
        visibility: visible;
    }
}

/* Mobile Accordion Menu */
#mobile-menu .sub-menu {
    display: none;
    position: static;
    width: 100%;
    background: transparent;
    border: none;
    border-left: 1px solid rgba(251, 191, 36, 0.2);
    margin: 0.5rem 0 1rem 0.5rem;
    padding: 0 0 0 1.5rem;
    flex-direction: column;
    gap: 0.75rem;
    opacity: 1;
    visibility: visible;
}

#mobile-menu .is-open>.sub-menu {
    display: flex !important;
}

#mobile-menu .menu-item-has-children>span,
#mobile-menu .menu-item-has-children>a {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #FBBF24;
    padding: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
}

#mobile-menu .is-open i {
    transform: rotate(180deg);
}

#mobile-menu .sub-menu a {
    font-size: 1.125rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: #e5e5e5;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* --- Modal Styles --- */
.project-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    /* Highest priority */
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.project-modal.active {
    display: flex;
}

/* Backdrop */
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    /* Darker opacity for focus */
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-modal.active .modal-backdrop {
    opacity: 1;
}

/* Content Container */
.modal-content-wrapper {
    position: relative;
    background: #0a0a0a;
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.3s ease;
    /* Flex column for fixed header + scrolling body */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.project-modal.active .modal-content-wrapper {
    opacity: 1;
    transform: scale(1);
}

/* Modal Header (Fixed Gradient Corner) */
.modal-header {
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    z-index: 50;
    /* Gradient from top-right corner: 50% opacity black fading to transparent */
    background: radial-gradient(circle at top right, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 70%);
    pointer-events: none;
    /* Allow clicking through transparent parts if needed */
    border-top-right-radius: 1rem;
    /* Match wrapper radius */
}

/* Close Button */
.close-modal-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    pointer-events: auto;
    /* Re-enable clicks */
    transition: color 0.2s, transform 0.2s;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    /* Enhance visibility */
}

.close-modal-btn:hover {
    color: #10b981;
    /* dendro-green */
    transform: rotate(90deg);
}

/* Scrollable Body */
.modal-body {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #333 #000;
}

.close-modal-btn:hover {
    color: #10b981;
}

/* --- Gallery Styles --- */

/* Grid Style */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.gallery-item {
    /* aspect-ratio: 16/9; REMOVED for original aspect */
    background-color: #111;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    /* Centers content if needed */
    align-items: center;
    justify-content: center;
}

.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item img {
    width: 100%;
    height: auto;
    /* Allow natural height */
    object-fit: contain;
    /* Ensure full image is seen if constrained */
    display: block;
}

/* Carousel Style */
.gallery-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 1rem;
    padding-bottom: 1rem;
}

.carousel-item {
    flex: 0 0 auto;
    /* Allow auto width based on content/image */
    max-width: 80%;
    /* Don't let it take full width on mobile */
    scroll-snap-align: center;
    /* aspect-ratio: 16/9; REMOVED */
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    background: #000;
}

@media(min-width: 768px) {
    .carousel-item {
        max-width: 45%;
    }
}

/* --- Lightbox --- */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-overlay.active {
    display: flex;
    opacity: 1;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-size: 3rem;
    color: white;
    cursor: pointer;
    z-index: 10010;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 4rem;
    color: white;
    cursor: pointer;
    padding: 0 1rem;
    user-select: none;
    transition: color 0.3s ease, transform 0.2s ease;
    z-index: 10010;
    line-height: 1;
}

.lightbox-nav:hover {
    color: #10b981;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

@media (max-width: 768px) {
    .lightbox-nav {
        font-size: 3rem;
        padding: 0.5rem;
    }

    .lightbox-prev {
        left: 0.5rem;
    }

    .lightbox-next {
        right: 0.5rem;
    }

    .lightbox-img {
        max-width: 100vw;
    }
}

/* --- Ripple Animation --- */
.ripple-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.ripple-circle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(16, 185, 129, 0.2);
    background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, rgba(251, 191, 36, 0.2) 100%);
    animation: ripple 14s linear infinite;
    opacity: 0;
    filter: blur(4px);
}

.ripple-circle:nth-child(1) {
    animation-delay: 0s;
}

.ripple-circle:nth-child(2) {
    animation-delay: 4.6s;
}

.ripple-circle:nth-child(3) {
    animation-delay: 9.2s;
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0;
    }

    20% {
        opacity: 0.5;
    }

    100% {
        transform: scale(30);
        opacity: 0;
    }
}

.ripple-text {
    position: relative;
    z-index: 20;
    font-family: 'Space Grotesk', sans-serif;
    color: #10b981;
    font-size: 0.875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------------
   ANIMATION UTILITIES
   -------------------------------------------------------------------------- */
.scroll-fade-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-fade-up.in-view {
    opacity: 1;
    transform: translateY(0);
}

.progress-bar {
    width: 0;
    transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --------------------------------------------------------------------------
   MENU HIGHLIGHTING
   -------------------------------------------------------------------------- */
.current-menu-item>a,
.current-menu-item>span,
.current-menu-parent>a,
.current-menu-parent>span,
.current-menu-ancestor>a,
.current-menu-ancestor>span,
.current_page_item>a,
.current_page_item>span {
    color: #FBBF24 !important;
    /* Brand Yellow */
    position: relative;
    font-weight: 600;
}

.current-menu-item>a::after,
.current-menu-item>span::after,
.current-menu-parent>a::after,
.current-menu-parent>span::after,
.current-menu-ancestor>a::after,
.current-menu-ancestor>span::after,
.current_page_item>a::after,
.current_page_item>span::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #FBBF24;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}