/* ==========================================================
   JYA / OviPro purchase assignments (ostotoimeksiannot)
   Separate from the property search and single-property CSS.
   ========================================================== */

:root {
    --jya-pa-navy: #1c4482;
    --jya-pa-blue: #19a3dd;
    --jya-pa-border: #e0e4e9;
    --jya-pa-text: #20242a;
    --jya-pa-muted: #5b6470;
}

/* ----------------------------------------------------------
   Purchase-assignment listing
   Use the full width of the WordPress content container.
   ---------------------------------------------------------- */
.pdx_purchase_assignment_list.real_estate_assignment_list {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    justify-content: stretch;
    gap: 22px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100% !important;
    margin: 24px auto 32px;
    padding: 0;
    line-height: 1.45;
}

.pdx_purchase_assignment_list > .pdx_purchase_assignment_link {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
    width: auto;
    min-width: 0;
    min-height: 250px;
    max-width: none;
    margin: 0;
    padding: 22px 20px 18px;
    border: 1px solid var(--jya-pa-border);
    border-radius: 0;
    background: #fff;
    color: var(--jya-pa-text);
    text-align: left;
    text-decoration: none;
    box-shadow: 0 2px 9px rgb(0 0 0 / 5%);
    transition: box-shadow 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.pdx_purchase_assignment_list > .pdx_purchase_assignment_link:hover {
    border-color: #c7d3e3;
    color: var(--jya-pa-text);
    text-decoration: none;
    box-shadow: 0 6px 18px rgb(0 0 0 / 9%);
    transform: translateY(-2px);
}

.pdx_purchase_assignment_list > .pdx_purchase_assignment_link:focus-visible {
    outline: 3px solid var(--jya-pa-blue);
    outline-offset: 3px;
}

.pdx_purchase_assignment_link > span {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
}

.pdx_purchase_assignment_link > .pdx_purchase_assignment_types {
    margin-bottom: 10px;
    color: var(--jya-pa-navy);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
}

.pdx_purchase_assignment_link > .pdx_purchase_assignment_area_room_count,
.pdx_purchase_assignment_link > .pdx_purchase_assignment_region,
.pdx_purchase_assignment_link > .pdx_purchase_assignment_cities,
.pdx_purchase_assignment_link > .pdx_purchase_assignment_districts,
.pdx_purchase_assignment_link > .pdx_purchase_assignment_postal_codes {
    margin-bottom: 5px;
    color: var(--jya-pa-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.pdx_purchase_assignment_link > .pdx_purchase_assignment_price {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: none !important;
    margin: auto 0 0;
    padding: 11px 12px;
    border: 0;
    border-radius: 0;
    background: var(--jya-pa-navy);
    color: #fff;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.35;
}

.pdx_purchase_assignment_link:hover > .pdx_purchase_assignment_price {
    background: var(--jya-pa-blue);
    color: #fff;
}

/* A list title supplied by OviPro should align with the cards. */
.pdx_purchase_assignment_list_title {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 18px;
    color: var(--jya-pa-text);
}

/* ----------------------------------------------------------
   Single purchase-assignment title

   Exact markup in OviPro's purchase-assignment.php is either:
   .gh-plugin-wrapper > .gre-assignment-title-container > h1.gre-assignment-title
   or .gh-plugin-wrapper > .pdx-plus-commission-title > h1

   Use the exact wrapper and direct-child selectors to beat the theme's
   global h1 typography rules. The enqueue snippet has no unrelated style
   dependency, so this file is also loaded on single purchase assignments.
   ---------------------------------------------------------- */
html body .gh-plugin-wrapper > .gre-assignment-title-container > h1.gre-assignment-title,
html body .gh-plugin-wrapper > .pdx-plus-commission-title > h1 {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 2rem !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    letter-spacing: normal !important;
    overflow-wrap: anywhere;
}

html body .gh-plugin-wrapper > .gre-assignment-title-container,
html body .gh-plugin-wrapper > .pdx-plus-commission-title {
    width: 100%;
    max-width: 100%;
}

/* Tablet: three cards per row, then two. */
@media (max-width: 1100px) {
    .pdx_purchase_assignment_list.real_estate_assignment_list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 18px;
    }
}

@media (min-width: 541px) and (max-width: 1024px) {
    html body .gh-plugin-wrapper > .gre-assignment-title-container > h1.gre-assignment-title,
    html body .gh-plugin-wrapper > .pdx-plus-commission-title > h1 {
        font-size: 1.6rem !important;
        line-height: 1.2 !important;
    }
}

@media (max-width: 800px) {
    .pdx_purchase_assignment_list.real_estate_assignment_list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .pdx_purchase_assignment_list > .pdx_purchase_assignment_link {
        min-height: 235px;
        padding: 19px 17px 16px;
    }
}

@media (max-width: 540px) {
    .pdx_purchase_assignment_list.real_estate_assignment_list {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .pdx_purchase_assignment_list > .pdx_purchase_assignment_link {
        min-height: 0;
        padding: 20px;
    }

    html body .gh-plugin-wrapper > .gre-assignment-title-container > h1.gre-assignment-title,
    html body .gh-plugin-wrapper > .pdx-plus-commission-title > h1 {
        font-size: 1.3rem !important;
        line-height: 1.2 !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pdx_purchase_assignment_list > .pdx_purchase_assignment_link {
        transition: none;
    }

    .pdx_purchase_assignment_list > .pdx_purchase_assignment_link:hover {
        transform: none;
    }
}

/* FIX: actual Kadence entry-title markup on single purchase-assignment pages.
   This is separate from OviPro's optional title wrappers above. */
html body header.entry-header.pdx_purchase_assign-title > h1.entry-title {
    font-size: 32px !important;
    line-height: 1.2 !important;
    max-width: 100%;
    letter-spacing: normal !important;
    overflow-wrap: anywhere;
}

@media (max-width: 1024px) {
    html body header.entry-header.pdx_purchase_assign-title > h1.entry-title {
        font-size: 26px !important;
        line-height: 1.2 !important;
    }
}

@media (max-width: 540px) {
    html body header.entry-header.pdx_purchase_assign-title > h1.entry-title {
        font-size: 21px !important;
        line-height: 1.25 !important;
    }
}
