/* Grandeko Portfolio Frontend Styles */

.grandeko-portfolio-categories,
.grandeko-portfolio-projects {
    width: 100%;
    margin: 0 auto;
    padding: 20px 0;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

.category-card {
    background: #ffffff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-card:hover {
    transform: translateY(-5px);
}

.category-card-content {
    padding: 30px;
    flex: 1;
}

.category-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-icon svg {
    width: 100%;
    height: 100%;
}

.category-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
    line-height: 1.3;
}

.category-description {
    font-size: 16px;
    line-height: 1.6;
    color: #666;
    margin: 0;
}

.category-image-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: visible;
    margin-top: auto;
}

.category-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.category-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    pointer-events: none;
}

.category-link-button {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #2D5016;
    border-radius: 0px;
    border: solid 1px #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.3s ease, transform 0.3s ease;
    z-index: 10;
    margin-top: -40px;
}

.category-link-button:hover {
    background: #4c9929;
}

.category-link-button svg {
    width: 20px;
    height: 20px;
}

/* Projects Grid */
.projects-header {
    margin-bottom: 40px;
    text-align: center;
}

.projects-header .category-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #333;
}

.projects-header .category-description {
    font-size: 18px;
    color: #666;
    max-width: 800px;
    margin: 0 auto;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

.project-card {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.project-card-content {
    padding: 30px;
    flex: 1;
    position: relative;
}

.project-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
    line-height: 1.3;
}

.project-description {
    font-size: 16px;
    line-height: 1.6;
    color: #666;
    margin: 0 0 15px 0;
}

.project-year-badge {
    display: inline-block;
    background: #2D5016;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 10px;
}

.project-card-content .project-year-badge {
    margin-top: 0;
    margin-bottom: 12px;
}

.project-image-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
    margin-top: auto;
}

/* Grid: before/after hover - show after by default, before on hover */
.all-projects-grid .project-image-wrapper.grid-before-after .grid-image-after,
.all-projects-grid .project-image-wrapper.grid-before-after .grid-image-before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.4s ease;
}

.all-projects-grid .project-image-wrapper.grid-before-after .grid-image-after {
    z-index: 1;
    opacity: 1;
}

.all-projects-grid .project-image-wrapper.grid-before-after .grid-image-before {
    z-index: 0;
    opacity: 0;
}

.all-projects-grid .all-projects-card:hover .project-image-wrapper.grid-before-after .grid-image-after {
    opacity: 0;
}

.all-projects-grid .all-projects-card:hover .project-image-wrapper.grid-before-after .grid-image-before {
    opacity: 1;
}

.all-projects-grid .project-image-wrapper.grid-before-after .grid-image-after img,
.all-projects-grid .project-image-wrapper.grid-before-after .grid-image-before img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-link-button {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #2D5016;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.project-link-button:hover {
    background: #1f3610;
    transform: scale(1.1);
}

.project-link-button svg {
    width: 20px;
    height: 20px;
}

.no-projects {
    text-align: center;
    padding: 40px 20px;
    font-size: 18px;
    color: #666;
}

/* All projects (shortcode projekti-visi) */
.grandeko-all-projects {
    margin: 30px 0;
}

.projects-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
}

.filter-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.filter-select {
    min-width: 200px;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.view-toggle-row {
    margin-left: auto;
}

.view-toggle {
    display: flex;
    gap: 0;
}

.view-btn {
    padding: 10px 16px;
    font-size: 14px;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.view-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.view-btn:last-child {
    border-radius: 0 4px 4px 0;
}

.view-btn.active {
    background: #2D5016;
    color: #fff;
    border-color: #2D5016;
}

.view-btn:not(.active):hover {
    background: #eee;
}

.all-projects-container {
    display: grid;
    gap: 30px;
}

.all-projects-container.all-projects-grid {
    grid-template-columns: repeat(3, 1fr);
}

.grandeko-projects-container.grandeko-projects-loading {
    min-height: 200px;
    position: relative;
}

.grandeko-projects-container.grandeko-projects-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #e0e0e0;
    border-top-color: #2D5016;
    border-radius: 50%;
    animation: grandeko-spin 0.8s linear infinite;
}

@keyframes grandeko-spin {
    to { transform: rotate(360deg); }
}

.all-projects-container.all-projects-list {
    grid-template-columns: 1fr;
}

/* List item: text left, two before/after images right (side by side) */
.all-projects-list .all-projects-card {
    display: grid;
    grid-template-columns: 1fr 2fr;
    grid-template-rows: 1fr;
    gap: 0;
    align-items: stretch;
    min-height: 220px;
    max-height: 350px;
}

.all-projects-list .all-projects-card .project-card-content {
    display: none;
}

/* Grid view: single image; list view: hide single image wrapper */
.all-projects-grid .list-view-images {
    display: none;
}

.all-projects-list .all-projects-card .project-image-wrapper {
    display: none;
}

.all-projects-list .all-projects-card .list-item-meta {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px 32px 24px 32px;
    grid-column: 1;
    grid-row: 1;
}

.all-projects-list .all-projects-card .list-item-year-badge {
    margin-top: 0;
    margin-bottom: 12px;
}

.all-projects-list .all-projects-card .list-item-service {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    line-height: 1.4;
}

.all-projects-list .all-projects-card .list-view-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    width: 100%;
    grid-column: 2;
    grid-row: 1;
    overflow: hidden;
    position: relative;
}

.all-projects-list .all-projects-card .list-view-images.list-view-single-image {
    grid-template-columns: 1fr;
}

.all-projects-list .all-projects-card .list-view-image-single {
    position: relative;
    overflow: hidden;
    background: #eee;
    min-height: 200px;
}

.all-projects-list .all-projects-card .list-view-image-single img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    min-height: 200px;
}

.all-projects-list .all-projects-card .list-view-image-single .list-view-link {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: #2D5016;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
    transition: background 0.3s ease;
}

.all-projects-list .all-projects-card .list-view-image-single .list-view-link:hover {
    background: #1f3610;
}

.all-projects-list .all-projects-card .list-view-image-before,
.all-projects-list .all-projects-card .list-view-image-after {
    position: relative;
    overflow: hidden;
    background: #eee;
    min-height: 200px;
}

.all-projects-list .all-projects-card .list-view-image-before img,
.all-projects-list .all-projects-card .list-view-image-after img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    min-height: 200px;
}

.all-projects-list .all-projects-card .list-view-two-images .list-view-link-single {
    position: absolute;
    top: 41px;
    right: 16px;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: #2D5016;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
    transition: background 0.3s ease;
}

.all-projects-list .all-projects-card .list-view-two-images .list-view-link-single:hover {
    background: #1f3610;
}

.all-projects-list .all-projects-card .list-item-title {
    font-size: 21px;
    font-weight: 800;
    color: #333;
    margin-bottom: 6px;
    line-height: 1.3;
}

.all-projects-list .all-projects-card .list-item-address {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* Grid view: hide list meta */
.all-projects-grid .list-item-meta {
    display: none;
}

/* Sticky clone of projects-filters: hidden above viewport until original scrolls out */
.projects-filters-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 16px 24px;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    visibility: hidden;
}

.grandeko-all-projects.sticky-filters-visible .projects-filters-sticky {
    transform: translateY(0);
    visibility: visible;
}

.projects-filters-sticky .projects-filters {
    margin: 0;
    max-width: 100%;
}

.no-projects-message {
    text-align: center;
    padding: 40px 20px;
    font-size: 18px;
    color: #666;
}

/* Breadcrumbs Styles */
.grandeko-project-breadcrumbs {
    margin: 20px 0 30px 0;
}

.projekti-breadcrumbs {
    margin: 0;
    padding: 0;
}

.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 14px;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
}

.breadcrumb-item a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb-item a:hover {
    color: #2D5016;
    text-decoration: underline;
}

.breadcrumb-item span {
    color: #333;
}

.breadcrumb-item .breadcrumb-current {
    color: #2D5016;
    font-weight: 600;
}

.breadcrumb-separator {
    margin: 0 8px;
    color: #999;
}

/* Project Detail Page Styles */
.grandeko-project-title {
    font-size: 36px;
    font-weight: 700;
    color: #333;
    margin: 0 0 20px 0;
    line-height: 1.2;
}

.grandeko-project-main-image {
    margin-bottom: 30px;
}

.grandeko-project-main-image img,
.project-main-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.grandeko-project-short-description {
    font-size: 18px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 30px;
}

.project-short-description {
    font-size: 18px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 30px;
}

.project-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.gallery-item {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.project-gallery .gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-image {
    opacity: 0.9;
}

/* Lightbox Styles */
.grandeko-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.grandeko-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    z-index: 10000;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: fixed!important;
    top: 20px!important;
    right: 20px!important;
    background: transparent!important;
    border: 2px solid #fff!important;
    color: #fff!important;
    font-size: 32px!important;
    width: 40px!important;
    height: 40px!important;
    border-radius: 50%!important;
    cursor: pointer!important;
    display: flex!important;
    align-items: center!important;
    justify-content: center!important;
    line-height: 1!important;
    padding: 0!important;
    transition: background 0.3s ease, border-color 0.3s ease!important;
    z-index: 10001!important;
}

.lightbox-close:hover {
    background: #fff;
    color: #000;
}

.lightbox-nav {
    position: fixed!important;
    top: 50%!important;
    transform: translateY(-50%)!important;
    background: rgba(255, 255, 255, 0.2)!important;
    border: 2px solid #fff!important;
    color: #fff!important;
    font-size: 36px!important;
    width: 50px!important;
    height: 50px!important;
    border-radius: 50%!important;
    cursor: pointer!important;
    display: flex!important;
    align-items: center!important;
    justify-content: center!important;
    transition: background 0.3s ease, opacity 0.3s ease!important;
    z-index: 10001!important;
    padding: 0!important;
    line-height: 1!important;
}

.lightbox-nav:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.4);
}

.lightbox-nav.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lightbox-prev {
    left: 20px!important;
}

.lightbox-next {
    right: 20px!important;
}

.lightbox-counter {
    color: #fff;
    font-size: 16px;
    margin-top: 20px;
    text-align: center;
}

body.lightbox-open {
    overflow: hidden;
}

.project-year,
.project-customer,
.project-address {
    display: inline-block;
    margin-right: 20px;
    margin-bottom: 10px;
    font-size: 16px;
    color: #333;
}

.project-year {
    background: #2D5016;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 600;
}

.project-services {
    margin: 20px 0;
    font-size: 16px;
    line-height: 1.8;
    color: #666;
}

.project-service-link {
    color: #2D5016;
    text-decoration: none;
    transition: color 0.3s ease, text-decoration 0.3s ease;
}

.project-service-link:hover {
    color: #1f3610;
    text-decoration: underline;
}

.project-service-text {
    color: #666;
}

.project-content {
    margin-top: 40px;
    font-size: 16px;
    line-height: 1.8;
    color: #333;
}

.project-content h1,
.project-content h2,
.project-content h3,
.project-content h4,
.project-content h5,
.project-content h6 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: #333;
}

.project-content p {
    margin-bottom: 15px;
}

.project-content ul,
.project-content ol {
    margin-bottom: 15px;
    padding-left: 30px;
}

.project-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .categories-grid,
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .category-card-content,
    .project-card-content {
        padding: 20px;
    }
    
    .category-title,
    .project-title {
        font-size: 20px;
    }
    
    .projects-header .category-title {
        font-size: 24px;
    }
    
    .project-gallery {
        grid-template-columns: 1fr;
    }
    
    .project-year,
    .project-customer,
    .project-address {
        display: block;
        margin-right: 0;
    }
    
    .breadcrumb-list {
        font-size: 12px;
    }
    
    .breadcrumb-separator {
        margin: 0 4px;
    }
    
    /* Lightbox Mobile */
    .lightbox-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    .lightbox-image {
        max-height: 80vh;
    }
    
    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 28px;
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 28px;
    }
    
    .lightbox-prev {
        left: 15px;
    }
    
    .lightbox-next {
        right: 15px;
    }
    
    .lightbox-counter {
        font-size: 14px;
        margin-top: 15px;
    }

    /* All projects filters */
    .projects-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .view-toggle-row {
        margin-left: 0;
    }

    .filter-select {
        min-width: 0;
    }

    .all-projects-container.all-projects-grid {
        grid-template-columns: 1fr;
    }

    .all-projects-list .all-projects-card {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        min-height: 0;
    }

    .all-projects-list .all-projects-card .list-item-meta {
        grid-column: 1;
        grid-row: 1;
        padding: 20px 0 16px 0;
    }

    .all-projects-list .all-projects-card .list-view-images {
        grid-column: 1;
        grid-row: 2;
        grid-template-columns: 1fr 1fr;
        min-height: 0;
    }

    .all-projects-list .all-projects-card .list-view-image-before,
    .all-projects-list .all-projects-card .list-view-image-after {
        min-height: 160px;
    }

    .all-projects-list .all-projects-card .list-view-image-before img,
    .all-projects-list .all-projects-card .list-view-image-after img {
        min-height: 160px;
    }

    .all-projects-list .all-projects-card .list-view-image-single {
        min-height: 160px;
    }

    .all-projects-list .all-projects-card .list-view-image-single img {
        min-height: 160px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .all-projects-container.all-projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
