
/* =========================================
   PORTFOLIO MANAGER – PROJEKTIKORTIT
========================================= */

.pm-project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px;
    margin: 30px 0;
    align-items: stretch;
}

.pm-project-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #ffffff;
    border: 1px solid #dce5d9;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease,
                box-shadow 0.2s ease;
}

.pm-project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.pm-project-card[hidden] {
    display: none !important;
}

/* =========================================
   PROJEKTIKORTTIEN KUVAT
========================================= */

.pm-project-card .pm-project-image {
    width: 100%;
    height: 220px;
    flex: 0 0 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f5f1;
    padding: 15px;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.pm-project-card .pm-project-image img {
    display: block;
    position: static;
    width: 100%;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 8px;
    margin: 0;
}

/* =========================================
   PROJEKTIKORTTIEN SISÄLTÖ
========================================= */

.pm-project-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    padding: 25px;
}

.pm-project-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.pm-project-categories span {
    background: #e3ebe0;
    color: #4d6952;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.pm-project-card .pm-project-content h2 {
    color: #4d6952;
    font-size: 24px;
    line-height: 1.4;
    margin: 0 0 15px;
    overflow-wrap: anywhere;
}

.pm-project-card .pm-project-content p {
    font-size: 16px;
    line-height: 1.7;
    margin: 0 0 25px;
}

/* =========================================
   PAINIKKEET
========================================= */

.pm-project-button {
    display: inline-block;
    align-self: flex-start;
    margin-top: auto;
    background: #4d6952;
    color: #ffffff !important;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.pm-project-button:hover {
    background: #38513d;
}

.pm-project-button:focus-visible {
    outline: 3px solid #81977e;
    outline-offset: 3px;
}

/* =========================================
   TYÖNÄYTTEIDEN LASKURI
========================================= */

.projects-page .projects-counter {
    color: #4d6952;
    font-size: 14px;
    font-weight: 600;
    margin: 20px 0 0;
}

#projects-empty {
    padding: 25px;
    background: #e3ebe0;
    border-radius: 12px;
    text-align: center;
}

#projects-empty[hidden] {
    display: none;
}

/* =========================================
   YKSITTÄISEN TYÖNÄYTTEEN SIVU
========================================= */

.pm-single-project {
    max-width: 1000px;
}

/* Paluulinkki */

.pm-back-link {
    display: inline-block;
    color: #4d6952;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 30px;
}

.pm-back-link[hidden] {
    display: none;
}

.pm-back-link:hover {
    text-decoration: underline;
}

/* Projektin otsikko */

.pm-single-header {
    padding-bottom: 25px;
    margin-bottom: 30px;
    border-bottom: 1px solid #ccd7ca;
}

.pm-single-header h1 {
    font-size: 42px;
    line-height: 1.3;
    margin: 15px 0 25px;
    overflow-wrap: anywhere;
}

.pm-single-header .pm-project-categories {
    margin-bottom: 0;
}

/* Projektin sisältö */

.pm-single-content {
    font-size: 18px;
    line-height: 1.8;
}

.pm-single-content p {
    margin-bottom: 22px;
}

/* =========================================
   KUVAGALLERIAT
========================================= */

.pm-single-content .wp-block-gallery {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 35px 0;
    gap: 15px !important;
    align-items: start;
}

.pm-single-content .wp-block-gallery.columns-1 {
    grid-template-columns: 1fr;
}

.pm-single-content .wp-block-gallery.columns-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pm-single-content .wp-block-gallery.columns-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pm-single-content .wp-block-gallery.columns-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.pm-single-content .wp-block-gallery.columns-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.pm-single-content .wp-block-gallery figure.wp-block-image {
    width: 100% !important;
    min-width: 0;
    margin: 0 !important;
}

.pm-single-content .wp-block-gallery img {
    display: block;
    width: 100%;
    height: auto !important;
    object-fit: contain;
    border-radius: 10px;
}

/* =========================================
   YKSITTÄISEN PROJEKTIN LOPETUS
========================================= */

.pm-single-ending {
    background: #e3ebe0;
    border-radius: 20px;
    padding: 40px;
    margin-top: 50px;
    text-align: center;
}

.pm-single-ending h2 {
    color: #4d6952;
    font-size: 28px;
    margin: 0 0 15px;
}

.pm-single-ending p {
    margin-bottom: 25px;
}

.pm-single-ending .pm-project-button {
    margin: 5px;
}

/* =========================================
   MOBIILINÄKYMÄ
========================================= */

@media (max-width: 768px) {

    .pm-project-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .pm-project-card .pm-project-image {
        height: 200px;
        flex-basis: 200px;
    }

    .pm-project-content {
        padding: 20px;
    }

    .pm-project-card .pm-project-content h2 {
        font-size: 22px;
    }

    .pm-single-header h1 {
        font-size: 30px;
    }

    .pm-single-content,
    .pm-single-content p {
        font-size: 16px;
    }

    .pm-single-content .wp-block-gallery {
        grid-template-columns: 1fr !important;
    }

    .pm-single-ending {
        padding: 25px 20px;
        margin-top: 35px;
    }

    .pm-single-ending h2 {
        font-size: 24px;
    }
}

/* =========================================
   SAAVUTETTAVUUS
========================================= */

@media (prefers-reduced-motion: reduce) {

    .pm-project-card,
    .pm-project-button {
        transition: none;
    }

    .pm-project-card:hover {
        transform: none;
    }
}

/* =========================================
   TIIVIIMMÄT PROJEKTIKORTIT
========================================= */

/* Projektisivun leveys */

.page-content.projects-page {
    max-width: 1250px;
}

/* Kolme korttia rinnakkain */

.projects-page .pm-project-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin: 20px 0;
}

/* Kortin ulkoasu */

.projects-page .pm-project-card {
    border-radius: 12px;
}

/* Pienemmät artikkelikuvat */

.projects-page .pm-project-card .pm-project-image {
    height: 160px;
    flex-basis: 160px;
    padding: 10px;
}

/* Tiiviimpi sisältö */

.projects-page .pm-project-content {
    padding: 18px;
}

.projects-page .pm-project-categories {
    gap: 5px;
    margin-bottom: 10px;
}

.projects-page .pm-project-categories span {
    font-size: 11px;
    padding: 4px 8px;
}

/* Otsikot */

.projects-page .pm-project-card .pm-project-content h2 {
    font-size: 19px;
    line-height: 1.35;
    margin: 0 0 10px;
}

/* Kuvaustekstit */

.projects-page .pm-project-card .pm-project-content p {
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 18px;
}

/* Painikkeet */

.projects-page .pm-project-button {
    font-size: 13px;
    padding: 9px 14px;
}

/* Tablettinäkymä */

@media (max-width: 1050px) {

    .projects-page .pm-project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Mobiilinäkymä */

@media (max-width: 650px) {

    .projects-page .pm-project-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .projects-page .pm-project-card .pm-project-image {
        height: 180px;
        flex-basis: 180px;
    }
}
