/* Only new project cards: legacy .projects-item blocks remain untouched. */
.chd-project-card.projects-item {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    color: #30352d;
    background: var(--white, #fff);
    border: 1px solid #e3e7df;
    border-radius: 20px;
    text-decoration: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.chd-project-card .chd-project-card__media {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f5f6f2;
}

.chd-project-card .chd-project-card__image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    margin: 0;
    object-fit: contain;
    object-position: center;
}

.chd-project-card .chd-project-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
    padding: 22px;
}

.chd-project-card .chd-project-card__title {
    margin: 0;
    color: inherit;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.chd-project-card .chd-project-card__features {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 20px;
    margin: 0;
}

.chd-project-card .chd-project-card__feature {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.chd-project-card .chd-project-card__feature dt {
    margin: 0 0 4px;
    color: #646b5e;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
}

.chd-project-card .chd-project-card__feature dd {
    margin: 0;
    color: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
}

.chd-project-card .chd-project-card__footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-top: auto;
    padding-top: 4px;
}

.chd-project-card .chd-project-card__price {
    margin: 0;
    color: inherit;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.chd-project-card .chd-project-card__more {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid #dce6d3;
    border-radius: 10px;
    color: #426526;
    background: #f4f8ef;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

/* The new arrow belongs to archive cards; keep other existing loops unchanged. */
.chd-project-card .chd-project-card__arrow {
    display: none;
}

.chd-project-card:focus-visible {
    outline: 3px solid var(--dark-green, #5e8833);
    outline-offset: 4px;
}

@media (hover: hover) {
    .chd-project-card:hover {
        color: #30352d;
        border-color: var(--green, #78ad41);
        box-shadow: 0 6px 18px rgb(48 53 45 / 7%);
        text-decoration: none;
    }
}

@media (max-width: 991px) {
    .chd-project-card .chd-project-card__body {
        padding: 18px;
    }

    .chd-project-card .chd-project-card__title,
    .chd-project-card .chd-project-card__price {
        font-size: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chd-project-card.projects-item {
        transition: none;
    }
}

/* Iteration 2: archive layout only. No legacy home/related-project selectors. */
.chd-catalog .catalog-head {
    margin-bottom: 28px;
}

.chd-catalog .catalog-content {
    display: block;
    margin-top: 32px;
}

.chd-catalog .catalog-block {
    width: 100%;
    min-width: 0;
}

.chd-catalog .catalog-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-rows: 1fr;
    align-items: stretch;
    gap: 28px;
}

.chd-catalog .chd-catalog-nav {
    margin-bottom: 24px;
}

.chd-catalog .chd-catalog-nav__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.chd-catalog .chd-catalog-nav__tab {
    min-height: 48px;
    padding: 12px 24px;
    border: 1px solid #e1e5dc;
    border-radius: 999px;
    background: #fff;
    color: #30352d;
    font: inherit;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
}

.chd-catalog .chd-catalog-nav__tab[aria-current="true"] {
    border-color: #303f28;
    background: #303f28;
    color: #fff;
}

.chd-catalog .chd-catalog-nav__panel,
.chd-catalog .chd-catalog-nav__stone {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.chd-catalog .chd-catalog-nav__panel[hidden] {
    display: none;
}

.chd-catalog .chd-catalog-nav__stone {
    padding-left: 16px;
    border-left: 1px solid #dce2d7;
}

.chd-catalog .chd-catalog-nav__label,
.chd-catalog .chd-catalog-nav__empty {
    margin: 0;
    color: #646b5e;
    font-size: 14px;
    line-height: 1.5;
}

.chd-catalog .chd-catalog-nav__link {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 8px;
    color: #30352d;
    font-size: 15px;
    line-height: 1.4;
    text-decoration: none;
}

.chd-catalog .chd-catalog-nav__link:hover,
.chd-catalog .chd-catalog-nav__link.is-current {
    background: #eef3e8;
    color: #426526;
}

/* One stable archive ID outranks WBW's generated ID styles without hardcoding its view ID. */
#chd-catalog-filters {
    --chd-filter-accent: #426526;
    --chd-filter-ink: #30352d;
    --chd-filter-line: #dce3d5;
    padding: 24px;
    border: 1px solid #e1e5dc;
    border-radius: 18px;
    background: #f6f8f3;
    color: var(--chd-filter-ink);
}

#chd-catalog-filters .chd-catalog-filters__title {
    margin: 0 0 24px;
    padding: 0;
    color: inherit;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
}

#chd-catalog-filters .catalog-sidebar.chd-catalog-filters__body {
    position: static;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

#chd-catalog-filters .wpfMainWrapper {
    display: grid;
    grid-template-columns: minmax(190px, 1.15fr) repeat(4, minmax(0, 1fr));
    align-items: start;
    gap: 24px 20px;
    width: 100% !important;
    max-width: 100%;
    font-family: inherit;
}

#chd-catalog-filters .wpfMainWrapper .wpfFilterWrapper {
    min-width: 0;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

#chd-catalog-filters .wpfMainWrapper .wpfFilterTitle {
    min-height: 0;
    margin: 0 0 12px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #606b57 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    letter-spacing: .05em;
    line-height: 1.4;
    text-transform: uppercase;
    pointer-events: none;
}

#chd-catalog-filters .wpfMainWrapper .wfpTitle {
    margin: 0 !important;
    padding: 0 !important;
    font: inherit !important;
    color: inherit !important;
    cursor: default;
}

/* Remove WBW's group toggles too. Keep applicable group content permanently open.
   Hidden wrappers/options remain under WBW's control. */
#chd-catalog-filters .wpfMainWrapper .wpfTitleToggle {
    display: none !important;
}

#chd-catalog-filters .wpfMainWrapper .wpfFilterContent {
    display: block !important;
    min-width: 0;
    min-height: 0;
    margin: 0 !important;
    padding: 0 !important;
}

#chd-catalog-filters [data-display-type="list"] .wpfFilterVerScroll {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 8px;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    list-style: none;
}

#chd-catalog-filters [data-display-type="list"] .wpfFilterVerScroll > li {
    float: none;
    width: auto;
    max-width: 100%;
    margin: 0 !important;
    padding: 0 !important;
}

#chd-catalog-filters .wpfMainWrapper [data-display-type="list"] .wpfLiLabel {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    max-width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    margin: 0 !important;
    padding: 10px 12px !important;
    border: 1px solid var(--chd-filter-line) !important;
    border-radius: 10px !important;
    background: #fff !important;
    color: var(--chd-filter-ink) !important;
    font-size: 14px !important;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease;
}

#chd-catalog-filters .wpfMainWrapper .wpfCheckbox {
    position: relative;
    display: inline-flex;
    flex: 0 0 18px;
    align-items: center;
    float: none;
    width: 18px;
    height: 18px;
    margin: 0 !important;
}

#chd-catalog-filters .wpfMainWrapper .wpfCheckbox > input[type="checkbox"] {
    position: absolute !important;
    display: block !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    clip-path: inset(50%);
    opacity: 0;
}

/* WBW and the old theme both paint label pseudos. Use just one checked surface. */
#chd-catalog-filters .wpfMainWrapper .wpfCheckbox > label::before,
#chd-catalog-filters .wpfMainWrapper .wpfCheckbox > label::after {
    display: none !important;
    content: none !important;
}

#chd-catalog-filters .wpfMainWrapper .wpfCheckbox > label {
    position: static !important;
    display: block !important;
    box-sizing: border-box;
    width: 18px !important;
    height: 18px !important;
    min-height: 0;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #aab79f !important;
    border-radius: 4px !important;
    background: #fff !important;
    cursor: pointer;
}

#chd-catalog-filters .wpfMainWrapper .wpfCheckbox > input:checked + label {
    border-color: var(--chd-filter-accent) !important;
    background: var(--chd-filter-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='m4 9 3 3 7-7' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px 18px no-repeat !important;
}

#chd-catalog-filters .wpfMainWrapper .wpfLiLabel:has(input:checked) {
    border-color: var(--chd-filter-accent) !important;
    background: #eaf1e3 !important;
    color: #334f1e !important;
}

#chd-catalog-filters .wpfLiLabel:has(input:focus-visible) {
    outline: 2px solid var(--chd-filter-accent);
    outline-offset: 3px;
}

#chd-catalog-filters .wpfCheckbox > input:focus-visible + label {
    outline: 2px solid var(--chd-filter-accent);
    outline-offset: 3px;
}

#chd-catalog-filters .wpfLiLabel:has(input:disabled) {
    opacity: .5;
    cursor: not-allowed;
}

#chd-catalog-filters .wpfDisplay {
    min-width: 0;
    margin: 0;
}

#chd-catalog-filters .wpfValue,
#chd-catalog-filters .wpfFilterTaxNameWrapper {
    color: inherit;
    font: inherit;
    white-space: normal;
    overflow-wrap: anywhere;
}

#chd-catalog-filters select,
#chd-catalog-filters input[type="number"],
#chd-catalog-filters input[type="text"]:not(.irs-hidden-input) {
    max-width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--chd-filter-line) !important;
    border-radius: 10px;
    background-color: #fff !important;
    color: var(--chd-filter-ink) !important;
    font: inherit;
}

#chd-catalog-filters select { width: 100%; }

#chd-catalog-filters :is(select, input, button):focus-visible {
    outline: 2px solid var(--chd-filter-accent);
    outline-offset: 3px;
}

#chd-catalog-filters .wpfMainWrapper .irs {
    height: 64px;
    font-family: inherit;
}

#chd-catalog-filters .wpfMainWrapper [data-filter-type="wpfPrice"] .irs-line {
    top: 34px;
    height: 4px;
    border: 0;
    border-radius: 4px;
    background: #dce3d5;
}

#chd-catalog-filters .wpfMainWrapper [data-filter-type="wpfPrice"] .irs-bar {
    top: 34px;
    height: 4px;
    border: 0;
    background: var(--chd-filter-accent) !important;
}

#chd-catalog-filters .wpfMainWrapper [data-filter-type="wpfPrice"] .irs-handle {
    top: 25px;
    width: 22px;
    height: 22px;
    border: 3px solid #fff !important;
    border-radius: 50%;
    background: var(--chd-filter-accent);
    box-shadow: 0 0 0 1px var(--chd-filter-accent);
    cursor: ew-resize;
}

#chd-catalog-filters .irs-handle::before {
    position: absolute;
    inset: -10px;
    content: "";
}

#chd-catalog-filters .irs-handle > i { background: transparent !important; }

#chd-catalog-filters .wpfMainWrapper [data-filter-type="wpfPrice"] :is(.irs-from, .irs-to, .irs-single) {
    border-radius: 6px;
    background: #eaf1e3 !important;
    color: #334f1e !important;
    font-size: 12px;
    line-height: 1.5;
}

#chd-catalog-filters .wpfMainWrapper [data-filter-type="wpfPrice"] :is(.irs-from, .irs-to, .irs-single)::before {
    border-top-color: #eaf1e3 !important;
}

/* A zero-width price range cannot narrow results. Never invent missing values. */
#chd-catalog-filters .wpfMainWrapper [data-filter-type="wpfPrice"][data-minvalue="0"][data-maxvalue="0"] {
    display: none !important;
}

#chd-catalog-filters .wpfMainWrapper .wpfFilterButtons {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    margin: 0 !important;
    padding: 20px 0 0 !important;
    border-top: 1px solid var(--chd-filter-line);
}

#chd-catalog-filters .wpfMainWrapper .wpfFilterButtons .wpfButton {
    flex: 0 1 auto;
    width: auto !important;
    max-width: 100%;
    min-width: 144px;
    min-height: 46px;
    margin: 0 !important;
    padding: 12px 24px !important;
    border: 1px solid var(--chd-filter-accent) !important;
    border-radius: 10px !important;
    background: var(--chd-filter-accent) !important;
    box-shadow: none;
    color: #fff !important;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    white-space: normal;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease;
}

#chd-catalog-filters .wpfMainWrapper .wpfFilterButtons .wpfClearButton {
    border-color: var(--chd-filter-line) !important;
    background: #fff !important;
    color: #4e5d43 !important;
    order: -1;
}

#chd-catalog-filters .wpfFilterButtons .wpfButton:disabled {
    opacity: .5;
    cursor: wait;
}

#chd-catalog-filters .chd-catalog-filters__empty {
    margin: 0;
    color: #606b57;
    font-size: 15px;
    line-height: 1.6;
}

#chd-catalog-filters .chd-catalog-filters__empty[hidden] { display: none; }
#chd-catalog-filters[data-filter-empty="true"] .chd-catalog-filters__body { display: none; }

@media (hover: hover) {
    #chd-catalog-filters .wpfMainWrapper .wpfLiLabel:hover,
    #chd-catalog-filters .wpfMainWrapper .wpfFilterButtons .wpfClearButton:hover {
        border-color: #8aa476 !important;
        background: #eff4e9 !important;
    }
    #chd-catalog-filters .wpfMainWrapper .wpfFilterButtons .wpfFilterButton:not(.wpfClearButton):hover {
        background: #334f1e !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    #chd-catalog-filters .wpfLiLabel,
    #chd-catalog-filters .wpfFilterButtons .wpfButton { transition: none; }
}

.chd-catalog .chd-catalog-nav__tab:focus-visible,
.chd-catalog .chd-catalog-nav__link:focus-visible {
    outline: 3px solid var(--dark-green, #5e8833);
    outline-offset: 3px;
}

.chd-catalog .chd-project-card.projects-item {
    border-radius: 18px;
}

.chd-catalog .chd-project-card__media {
    position: relative;
    flex-shrink: 0;
    aspect-ratio: 3 / 2;
    background: #f3f4ef;
}

/* WebP Express may wrap the image in picture. Both paths fill the same frame. */
.chd-catalog .chd-project-card__media > picture {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

.chd-catalog .chd-project-card__image {
    position: absolute;
    inset: 0;
    object-fit: cover;
    object-position: center;
    opacity: 1;
    filter: none;
}

.chd-catalog .chd-project-card__body {
    gap: 24px;
    padding: 26px;
}

.chd-catalog .chd-project-card__title {
    font-size: 28px;
    line-height: 1.25;
}

.chd-catalog .chd-project-card__features {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.chd-catalog .chd-project-card__feature dt {
    margin-bottom: 6px;
    font-size: 13px;
}

.chd-catalog .chd-project-card__feature dd {
    font-size: 19px;
    line-height: 1.35;
}

.chd-catalog .chd-project-card__footer {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 0;
}

.chd-catalog .chd-project-card__price {
    flex: 1 1 190px;
    min-width: 0;
    font-size: 26px;
    line-height: 1.3;
}

.chd-catalog .chd-project-card__price-prefix {
    color: #646b5e;
    font-size: 14px;
    font-weight: 400;
}

.chd-catalog .chd-project-card__price del {
    color: #646b5e;
    font-size: 16px;
    font-weight: 400;
}

.chd-catalog .chd-project-card__price ins {
    text-decoration: none;
}

.chd-catalog .chd-project-card__more {
    flex: 0 0 auto;
    gap: 18px;
    min-height: 48px;
    margin-left: auto;
    padding: 10px 12px 10px 20px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: #303f28;
}

.chd-catalog .chd-project-card__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #4a5a40;
    font-size: 19px;
    line-height: 1;
}

@media (max-width: 991px) {
    .chd-catalog .catalog-list {
        gap: 20px;
    }

    .chd-catalog .chd-project-card__body {
        gap: 20px;
        padding: 20px;
    }

    .chd-catalog .chd-project-card__title,
    .chd-catalog .chd-project-card__price {
        font-size: 24px;
    }

    .chd-catalog .chd-project-card__features {
        gap: 12px;
    }

    .chd-catalog .chd-project-card__feature dd {
        font-size: 17px;
    }

    #chd-catalog-filters .wpfMainWrapper {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    #chd-catalog-filters .wpfMainWrapper [data-filter-type="wpfPrice"] {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767px) {
    .chd-catalog .catalog-list {
        grid-template-columns: minmax(0, 1fr);
        grid-auto-rows: auto;
    }

    .chd-catalog .catalog-content {
        margin-top: 24px;
    }

    .chd-catalog .chd-catalog-nav__tab {
        padding: 10px 18px;
        font-size: 15px;
    }

    .chd-catalog .chd-catalog-nav__stone {
        padding-left: 0;
        border-left: 0;
    }

    #chd-catalog-filters { padding: 18px; }
    #chd-catalog-filters .chd-catalog-filters__title {
        margin-bottom: 20px;
        font-size: 18px;
    }
    #chd-catalog-filters .wpfMainWrapper { gap: 20px 12px; }
    #chd-catalog-filters .wpfMainWrapper [data-label="Особенности"],
    #chd-catalog-filters .wpfMainWrapper [data-label="Размеры"] {
        grid-column: 1 / -1;
    }
    #chd-catalog-filters .wpfMainWrapper [data-display-type="list"] .wpfLiLabel {
        padding: 10px !important;
        font-size: 13px !important;
    }
    #chd-catalog-filters .wpfMainWrapper .wpfFilterButtons {
        gap: 10px;
        padding-top: 16px !important;
    }
    #chd-catalog-filters .wpfMainWrapper .wpfFilterButtons .wpfButton {
        flex: 1 1 120px;
        min-width: 0;
        padding: 12px 16px !important;
    }

    .chd-catalog .chd-project-card__title {
        font-size: 23px;
    }
}
