/* ========================================= */
/* V16: Interactive Portfolio Grid           */
/* ========================================= */
.portfolio-section {
    padding: 5rem 6vw;
    background: var(--bg-dark);
    position: relative;
    z-index: 55;
    border-top: 1px solid var(--glass-border);
}

.portfolio-header {
    text-align: center;
    margin-bottom: 3rem;
}

.portfolio-header h3 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.portfolio-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.portfolio-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    background: #fff;
    aspect-ratio: 4/3;
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease-spring), filter 0.4s;
    filter: grayscale(20%);
}

.portfolio-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.2) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.4s var(--ease-smooth);
}

.portfolio-overlay i {
    color: white;
    width: 32px;
    height: 32px;
    margin-bottom: 1rem;
    transform: translateY(20px);
    transition: transform 0.4s var(--ease-spring);
}

.portfolio-title-hint {
    color: white;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.4s var(--ease-spring);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.portfolio-item:hover img {
    transform: scale(1.08);
    filter: grayscale(0%);
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-item:hover .portfolio-overlay i,
.portfolio-item:hover .portfolio-title-hint {
    transform: translateY(0);
}

/* ========================================= */
/* V16: Services Accordion                   */
/* ========================================= */
.services-section {
    padding: 5rem 6vw;
    background: #fafafa;
    position: relative;
    z-index: 55;
    border-top: 1px solid var(--glass-border);
}

.services-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: rgba(37, 99, 235, 0.08);
    color: var(--accent-1);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.section-badge i {
    width: 14px;
    height: 14px;
}

.services-header h3 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: var(--text-primary);
}

.accordion-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.accordion-item {
    background: #ffffff;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    transition: box-shadow 0.3s, border-color 0.3s;
}

.accordion-item:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
    border-color: rgba(37, 99, 235, 0.2);
}

.accordion-header {
    width: 100%;
    text-align: left;
    padding: 1.5rem 2rem;
    background: none;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s;
}

.accordion-header:hover,
.accordion-item.active .accordion-header {
    color: var(--accent-1);
}

.accordion-icon {
    width: 20px;
    height: 20px;
    transition: opacity 0.3s, transform 0.3s;
    color: var(--accent-1);
}

.minus-icon {
    display: none;
}

.accordion-item.active .plus-icon {
    display: none;
}

.accordion-item.active .minus-icon {
    display: block;
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--ease-smooth), opacity 0.4s var(--ease-smooth);
}

.accordion-item.active .accordion-content {
    /* Set via JS or fallback CSS inline style */
}

.services-list {
    list-style: none;
    padding: 0 2rem 1.5rem 2rem;
    margin: 0;
}

.services-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.services-list li:last-child {
    border-bottom: none;
}

.services-list i {
    width: 18px;
    height: 18px;
    color: var(--accent-3);
    /* Green checkmark */
    margin-top: 3px;
    flex-shrink: 0;
}

/* ========================================= */
/* V16: Back to Top Button                   */
/* ========================================= */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--accent-1);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s var(--ease-spring);
}

#backToTop.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#backToTop:hover {
    background: var(--accent-1);
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.3);
}

/* Enhancing Lightbox Modal for Portfolio text */
.lightbox-text-panel {
    background: #ffffff;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    display: none;
    /* hidden by default, shown via JS if data exists */
    flex-direction: column;
    justify-content: center;
    border-radius: 0 8px 8px 0;
}

.lightbox-content.has-text {
    flex-direction: row;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
}

.lightbox-content.has-text img {
    border-radius: 8px 0 0 8px;
    max-width: 65vw;
}

.lightbox-portfolio-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.lightbox-portfolio-desc {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

@media (max-width: 900px) {
    .lightbox-content.has-text {
        flex-direction: column;
    }

    .lightbox-content.has-text img {
        border-radius: 8px 8px 0 0;
        max-width: 90vw;
        max-height: 60vh;
    }

    .lightbox-text-panel {
        max-width: 100%;
        border-radius: 0 0 8px 8px;
        padding: 1.5rem;
    }
}