/* --- Expertise Accordion Section (Animated Expand) --- */
.expertise-bento-section {
    padding: 160px 0;
    background: transparent;
    position: relative;
    z-index: 10;
}

.expertise-header-modern {
    text-align: center;
    margin-bottom: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.expertise-section-title {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    letter-spacing: -1px;
    margin: 0;
}

.expertise-section-title .dark-text {
    color: var(--text-dark);
}

.expertise-section-title .gray-text {
    color: var(--lunar-dust);
}

/* Accordion Wrapper */
.expertise-expand-wrapper {
    display: flex;
    flex-direction: row;
    gap: 15px;
    height: 600px; /* Fixed height for desktop accordion */
    max-width: 1300px;
    margin: 0 auto;
}

.expand-panel {
    flex: 1; /* Narrow collapsed state */
    border-radius: 30px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    transition: all 0.7s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(88, 73, 79, 0.05);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.expand-panel:hover {
    flex: 7; /* Huge expanded state */
    background: var(--white);
    box-shadow: 0 30px 60px rgba(88, 73, 79, 0.1);
    align-items: flex-start;
    justify-content: flex-start;
}

.card-dark {
    background: var(--midnight-haze);
    color: var(--white);
    border: none;
}

.card-dark:hover {
    background: var(--midnight-haze);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
}

.panel-header {
    padding: 40px 20px;
    transition: all 0.7s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 30px;
    z-index: 2;
    height: 100%;
    width: 100%;
}

.expand-panel:hover .panel-header {
    height: auto;
    flex-direction: row;
    padding: 40px 50px;
    justify-content: flex-start;
    align-items: center;
}

.panel-num {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--shadow-blue);
    font-family: 'Outfit', sans-serif;
    transition: all 0.7s cubic-bezier(0.25, 1, 0.5, 1);
    line-height: 1;
}

.card-dark .panel-num {
    opacity: 0.3;
}

.expand-panel:hover .panel-num {
    font-size: 6rem;
    color: var(--midnight-haze);
    opacity: 0.05;
    transform: translateY(-5px);
    position: absolute;
    top: 20px;
    right: 40px;
}

.card-dark:hover .panel-num {
    color: var(--white);
    opacity: 0.05;
}

.panel-title-wrap {
    transition: all 0.7s cubic-bezier(0.25, 1, 0.5, 1);
}

.panel-title-wrap h3 {
    font-size: 1.5rem; /* Slightly smaller so it easily fits the 600px height vertically */
    font-weight: 700;
    margin: 0;
    color: var(--text-dark);
    transition: all 0.7s cubic-bezier(0.25, 1, 0.5, 1);
    white-space: nowrap;
    
    /* Rotate Text Bottom to Top for collapsed view */
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.card-dark .panel-title-wrap h3 {
    color: var(--white);
}

.expand-panel:hover .panel-title-wrap {
    transform: none;
}

.expand-panel:hover .panel-title-wrap h3 {
    writing-mode: horizontal-tb;
    transform: rotate(0deg);
    font-size: 2.5rem;
    white-space: normal;
}

/* Panel Content Area */
.panel-content {
    position: absolute;
    top: 160px; /* Increased from 140px to leave more generous spacing below heading */
    left: 0;
    width: 100%;
    height: calc(100% - 160px);
    padding: 0 50px 40px 50px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px);
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    overflow-y: auto;
}

/* Scrollbar styling */
.panel-content::-webkit-scrollbar {
    width: 4px;
}
.panel-content::-webkit-scrollbar-track {
    background: transparent;
}
.panel-content::-webkit-scrollbar-thumb {
    background: var(--shadow-blue);
    border-radius: 4px;
}

/* Fade in content on hover */
.expand-panel:hover .panel-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0.3s; /* Delay so panel opens first */
}


.exp-category-modern {
    margin-bottom: 2.5rem;
}

.exp-category-modern:last-child {
    margin-bottom: 0;
}

.exp-category-modern .exp-cat-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--lunar-dust);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 1.2rem;
    display: block;
}

.card-dark .exp-category-modern .exp-cat-title {
    color: var(--shadow-blue);
}

/* Animated Pill Tags */
.exp-tags {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.exp-tags li {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--midnight-haze);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--shadow-blue);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    transition: all 0.3s ease;
    cursor: default;
}

.exp-tags li:hover {
    background: var(--midnight-haze);
    color: var(--white);
    transform: translateY(-3px);
    border-color: var(--midnight-haze);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.card-dark .exp-tags li {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-dark .exp-tags li:hover {
    background: var(--white);
    color: var(--midnight-haze);
}

/* Responsive Handling */
@media (max-width: 992px) {
    .expertise-section-title {
        font-size: 3rem;
    }
    
    .expertise-expand-wrapper {
        flex-direction: column;
        height: auto;
    }
    
    .expand-panel {
        flex: none;
        height: 100px; /* Collapsed row height */
        border-radius: 24px;
        align-items: center;
        justify-content: flex-start;
    }
    
    .expand-panel:hover {
        flex: none;
        height: 500px; /* Expanded row height */
    }
    
    .panel-header {
        flex-direction: row;
        padding: 0 30px;
        justify-content: flex-start;
        align-items: center;
        gap: 20px;
    }
    
    .expand-panel:hover .panel-header {
        padding: 30px;
    }
    
    .panel-title-wrap h3 {
        writing-mode: horizontal-tb; /* Always horizontal on mobile */
        transform: rotate(0deg);
        font-size: 1.4rem;
        white-space: normal;
    }
    
    .expand-panel:hover .panel-title-wrap h3 {
        font-size: 1.8rem;
    }
    
    .panel-num {
        font-size: 2rem;
        position: static; /* No absolute positioning when collapsed */
    }
    
    .expand-panel:hover .panel-num {
        font-size: 4rem;
        position: absolute;
        top: 20px;
        right: 20px;
    }
    
    .panel-content {
        top: 130px;
        height: calc(100% - 130px);
        padding: 0 30px 30px 30px;
    }
    
    .exp-tags li {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 576px) {
    .expertise-section-title {
        font-size: 2.2rem;
    }

    .expertise-bento-section {
        padding: 80px 0;
    }
    
    .expand-panel:hover {
        height: 600px; /* Give more room on very small screens */
    }
    
    .panel-header {
        padding: 0 20px;
    }
    
    .expand-panel:hover .panel-header {
        padding: 20px;
    }
    
    .panel-content {
        top: 110px;
        height: calc(100% - 110px);
        padding: 0 20px 20px 20px;
    }
}
