/*
 * catalog.css - redesigned /catalog index (visual reference: image 3 of the redesign brief).
 *
 * Loaded from src/application/view/catalog/view_catalog_index.php only, so it never reaches another page.
 * Every selector is scoped to .cat-index (checked by an automated test): it cannot restyle the homepage, the global
 * navigation, the footer, the category pages or the product pages. No JavaScript, no external requests.
 * Font: Montserrat, already loaded by the site's header.php.
 *
 * The legacy stylesheets (bootstrap.css, main.css) are loaded before this file and set uppercase green Oswald headings,
 * 45px margins on p/ul/h*, and a grey .breadcrumb. The resets below are therefore explicit.
 */

.cat-index {
    --cat-ink: #0e1c3f;
    --cat-ink-soft: #364361;
    --cat-muted: #596780;
    --cat-line: #e3e8ef;
    --cat-line-strong: #cfd7e2;
    --cat-green: #4a8a1d;
    --cat-green-deep: #376b12;
    --cat-green-tint: #e5f0d9;
    --cat-surface: #ffffff;
    --cat-radius: 6px;

    /* content width on large screens (the side padding is added on top, so narrow screens keep their gutters) */
    --cat-max: 1480px;
    --cat-gutter: clamp(16px, 4.4vw, 70px);
    --cat-gap: clamp(16px, 1.5vw, 24px);

    --cat-shadow: 0 1px 2px rgba(14, 28, 63, .04), 0 4px 14px rgba(14, 28, 63, .05);
    --cat-shadow-hover: 0 2px 6px rgba(14, 28, 63, .05), 0 18px 40px rgba(14, 28, 63, .12);

    position: relative;
    padding: 0 0 clamp(56px, 7vw, 112px);
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-weight: 400;
    color: var(--cat-ink);
    background: #ffffff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /*
     * The page is lang="bg" and Montserrat then swaps in its Bulgarian-localised glyph forms (they make the upright
     * Cyrillic "т", "г", "в", "д" look like "m", "z", "b", "g"). Standard upright forms are used here, as in the design.
     */
    font-feature-settings: "locl" 0;
    font-variant-numeric: lining-nums;
}

.cat-index *,
.cat-index *::before,
.cat-index *::after {
    box-sizing: border-box;
}

.cat-index .cat-wrap {
    width: 100%;
    max-width: calc(var(--cat-max) + 2 * var(--cat-gutter));
    margin: 0 auto;
    padding: 0 var(--cat-gutter);
}

/* ---------- breadcrumb (markup comes from Breadcrumb::show(); only restyled) ---------- */

.cat-index .cat-crumbs {
    padding-top: clamp(18px, 2vw, 28px);
}

.cat-index .cat-crumbs nav {
    margin: 0;
}

.cat-index .cat-crumbs .breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    font-size: .8125rem;
    font-weight: 500;
    line-height: 1.4;
    list-style: none;
    color: var(--cat-muted);
}

.cat-index .cat-crumbs .breadcrumb-item {
    margin: 0;
    padding: 0;
    color: var(--cat-muted);
}

.cat-index .cat-crumbs .breadcrumb-item a {
    color: var(--cat-muted);
    text-decoration: none;
    transition: color .2s ease;
}

.cat-index .cat-crumbs .breadcrumb-item a:hover,
.cat-index .cat-crumbs .breadcrumb-item a:focus-visible {
    color: var(--cat-green-deep);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cat-index .cat-crumbs .breadcrumb-item + .breadcrumb-item {
    padding-left: 0;
}

.cat-index .cat-crumbs .breadcrumb-item + .breadcrumb-item::before {
    content: "\203A";
    display: inline-block;
    padding: 0 .6em;
    font-size: 1.15em;
    line-height: 1;
    color: var(--cat-muted);
}

.cat-index .cat-crumbs .breadcrumb-item.active {
    color: var(--cat-ink-soft);
}

/* ---------- page heading ---------- */

.cat-index .cat-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    padding: clamp(20px, 3.4vw, 48px) 0 clamp(20px, 2.8vw, 38px);
}

.cat-index .cat-head__title {
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-size: clamp(2.5rem, 5.2vw, 4.25rem);
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: -.028em;
    text-transform: none;
    color: var(--cat-ink);
}

/* ---------- category tabs: plain links ---------- */

.cat-index .cat-tabs {
    --cat-tab-pad: clamp(16px, 1.7vw, 28px);
    margin: 0 0 clamp(24px, 2.8vw, 40px);
}

/*
 * Labels are 14px or larger at every width and are never shrunk to fit. The eight labels need about 1430px of text,
 * so on most screens the row scrolls sideways (still plain links): the right-edge fade and the thin scrollbar are the cue.
 * Every category is also reachable from the cards below.
 */
.cat-index .cat-tabs__list {
    display: flex;
    align-items: stretch;
    margin: 0;
    padding: 0 0 6px;
    list-style: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--cat-line-strong) transparent;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 64px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 64px), transparent 100%);
}

.cat-index .cat-tabs__list::-webkit-scrollbar {
    height: 5px;
}

.cat-index .cat-tabs__list::-webkit-scrollbar-track {
    background: transparent;
}

.cat-index .cat-tabs__list::-webkit-scrollbar-thumb {
    background: var(--cat-line-strong);
    border-radius: 3px;
}

.cat-index .cat-tabs__list::after {
    content: "";
    flex: 0 0 72px;
}

.cat-index .cat-tabs__item {
    position: relative;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    color: var(--cat-ink);
}

.cat-index .cat-tabs__item + .cat-tabs__item::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 1px;
    height: 20px;
    transform: translateY(-50%);
    background: var(--cat-line-strong);
}

.cat-index .cat-tabs__link {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 0 var(--cat-tab-pad);
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0;
    white-space: nowrap;
    color: var(--cat-ink);
    text-decoration: none;
    transition: color .2s ease;
}

.cat-index .cat-tabs__item:first-child .cat-tabs__link {
    padding-left: 0;
}

.cat-index .cat-tabs__link::after {
    content: "";
    position: absolute;
    right: var(--cat-tab-pad);
    bottom: 0;
    left: var(--cat-tab-pad);
    height: 2px;
    background: var(--cat-green);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .28s cubic-bezier(.2, .7, .2, 1);
}

.cat-index .cat-tabs__item:first-child .cat-tabs__link::after {
    left: 0;
}

.cat-index .cat-tabs__link:hover,
.cat-index .cat-tabs__link:focus-visible,
.cat-index .cat-tabs__link.is-active {
    color: var(--cat-green-deep);
    text-decoration: none;
}

.cat-index .cat-tabs__link:focus-visible {
    outline: 2px solid var(--cat-green);
    outline-offset: -2px;
    border-radius: 2px;
}

.cat-index .cat-tabs__link:hover::after,
.cat-index .cat-tabs__link:focus-visible::after,
.cat-index .cat-tabs__link.is-active::after {
    transform: scaleX(1);
}

/* ---------- CMS copy (printed raw by the template) ---------- */

.cat-index .cat-prose {
    max-width: 78ch;
    margin: 0 0 clamp(32px, 3.6vw, 52px);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--cat-ink-soft);
}

.cat-index .cat-prose p,
.cat-index .cat-prose ul,
.cat-index .cat-prose ol {
    margin: 0 0 1.1em;
    font-size: 1rem;
    line-height: 1.75;
    font-weight: 400;
    color: var(--cat-ink-soft);
}

.cat-index .cat-prose h2,
.cat-index .cat-prose h3,
.cat-index .cat-prose h4 {
    margin: 1.6em 0 .6em;
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.01em;
    text-transform: none;
    color: var(--cat-ink);
}

.cat-index .cat-prose h2 { font-size: 1.6rem; }
.cat-index .cat-prose h3 { font-size: 1.3rem; }
.cat-index .cat-prose h4 { font-size: 1.1rem; }

.cat-index .cat-prose a {
    color: var(--cat-green-deep);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- card grid ---------- */

.cat-index .cat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--cat-gap);
    margin: 0;
    padding: 0;
}

/* product cards printed below the category cards when the CMS lists products on the same page */
.cat-index .cat-grid--products {
    margin-top: var(--cat-gap);
}

/* category pages: the complete category copy comes first, in a readable column (78 characters) */
.cat-index--category .cat-prose {
    max-width: 78ch;
    margin: 0 0 clamp(28px, 3.4vw, 48px);
}

/*
 * the short introduction above the project cards: larger than body copy, and as wide as the first three card columns, so its right edge
 * lines up with the grid below (tablet and phone: the full width, like the grid)
 */
.cat-index--category .cat-intro,
.cat-index--category .cat-intro p {
    font-size: clamp(1.0625rem, .6vw + .75rem, 1.25rem);
    line-height: 1.6;
}

.cat-index--category .cat-intro {
    max-width: none;
}

@media (min-width: 1100px) {
    .cat-index--category .cat-intro {
        max-width: calc((100% - 3 * var(--cat-gap)) / 4 * 3 + 2 * var(--cat-gap));
    }
}

/* the rest of the category copy: its own full-width band below the project cards */
.cat-index .cat-seo {
    margin-top: clamp(48px, 6vw, 88px);
    padding: clamp(36px, 4.4vw, 64px) 0;
    background: #f5f7fa;
    box-shadow: 0 0 0 100vmax #f5f7fa;
    clip-path: inset(0 -100vmax);
}

.cat-index--category .cat-seo .cat-prose {
    margin: 0;
}

/* the heading added above the rest of the category copy (when the copy does not start with a heading of its own) */
.cat-index .cat-seo__title {
    margin: 0 0 clamp(16px, 1.8vw, 24px);
    padding: 0;
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-size: clamp(1.5rem, 2.3vw, 2rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.02em;
    text-transform: none;
    color: var(--cat-ink);
}

.cat-index--category .cat-prose > :first-child {
    margin-top: 0;
}

.cat-index--category .cat-prose > :last-child {
    margin-bottom: 0;
}

/* category pages: the section "Реализирани обекти" - one card per CMS product */
.cat-index .cat-projects {
    margin-top: clamp(8px, 1vw, 16px);
}

.cat-index .cat-projects__title {
    margin: 0 0 clamp(22px, 2.6vw, 34px);
    padding: 0;
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-size: clamp(1.625rem, 2.6vw, 2.25rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.022em;
    text-transform: none;
    color: var(--cat-ink);
}

.cat-index .cat-projects .cat-grid--products {
    margin-top: 0;
}

.cat-index .cat-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    color: var(--cat-ink);
    text-decoration: none;
    background: var(--cat-surface);
    border: 1px solid var(--cat-line);
    border-radius: var(--cat-radius);
    box-shadow: var(--cat-shadow);
    transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s ease, border-color .3s ease;
    -webkit-tap-highlight-color: transparent;
}

.cat-index .cat-card:hover,
.cat-index .cat-card:focus-visible {
    color: var(--cat-ink);
    text-decoration: none;
    border-color: var(--cat-line-strong);
    transform: translateY(-3px);
    box-shadow: var(--cat-shadow-hover);
}

.cat-index .cat-card:focus-visible {
    outline: 3px solid var(--cat-green);
    outline-offset: 3px;
}

/* photo window: taller than before (1.4 : 1); the source photos are 540 x 540 squares */
.cat-index .cat-card__media {
    position: relative;
    display: block;
    aspect-ratio: 1.4 / 1;
    overflow: hidden;
    background: #e8ecf1;
}

.cat-index .cat-card__img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    object-fit: cover;
    object-position: center 40%;
    transition: transform .7s cubic-bezier(.2, .7, .2, 1);
}

/*
 * Crop focus per photo. The photos keep their file names, files and alt text; only the visible window moves.
 * Matched by file name, so a photo that is replaced in the CMS simply falls back to the default above.
 * Category photos only: a project card (CMS product) can carry a photo with the same file name, and its window is different.
 */
.cat-index .cat-card:not(.cat-card--project) .cat-card__img[src$="thmb_cat-01_1.jpg"]            { object-position: center 46%; } /* entrance: canopy + door */
.cat-index .cat-card:not(.cat-card--project) .cat-card__img[src$="thmb_cat-04.jpg"]              { object-position: center 85%; } /* mailboxes: whole rows, no half-cut top row */
.cat-index .cat-card:not(.cat-card--project) .cat-card__img[src$="thmb_kontrol-na-dostup.jpg"]   { object-position: center 0%; }  /* intercom panel + handle, above the sign */
.cat-index .cat-card:not(.cat-card--project) .cat-card__img[src$="thmb_cat-02.jpg"]              { object-position: center 24%; } /* apartment door, full leaf */
.cat-index .cat-card:not(.cat-card--project) .cat-card__img[src$="thmb_cat-03.jpg"]              { object-position: center 30%; } /* house door with side light */
.cat-index .cat-card:not(.cat-card--project) .cat-card__img[src$="thmb_pluzgashti-se-vrati.jpg"] { object-position: center 46%; } /* gate + van */
.cat-index .cat-card:not(.cat-card--project) .cat-card__img[src$="thmb_cat-06.jpg"]              { object-position: center 44%; } /* fence run */
.cat-index .cat-card:not(.cat-card--project) .cat-card__img[src$="thmb_cat-05.jpg"]              { object-position: center 36%; } /* basement door + frame */

/* this photo's window already sits at the very top; a 4% magnification from the top edge pushes the sign's last pixels out */
.cat-index .cat-card:not(.cat-card--project) .cat-card__img[src$="thmb_kontrol-na-dostup.jpg"] {
    transform-origin: center top;
    scale: 1.04;
}

.cat-index .cat-card:hover .cat-card__img,
.cat-index .cat-card:focus-visible .cat-card__img {
    transform: scale(1.04);
}

.cat-index .cat-card__body {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 78px;
    padding: 18px clamp(16px, 1.5vw, 24px) 19px;
}

.cat-index .cat-card__title {
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-size: clamp(.95rem, 1.05vw, 1.0625rem);
    font-weight: 700;
    line-height: 1.32;
    letter-spacing: -.005em;
    text-transform: none;
    color: var(--cat-ink);
}

.cat-index .cat-card__go {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: var(--cat-green-deep);
    background: var(--cat-green-tint);
    border-radius: 50%;
    transition: background-color .25s ease, color .25s ease, transform .3s cubic-bezier(.2, .7, .2, 1);
}

.cat-index .cat-card:hover .cat-card__go,
.cat-index .cat-card:focus-visible .cat-card__go {
    color: #ffffff;
    background: var(--cat-green);
    transform: translateX(3px);
}

/*
 * Project cards (category pages): one card per CMS product - the product's featured photo in a 4 : 3 window, its real CMS title
 * and a quiet arrow (it turns into the green chip on hover). The CMS thumbnails are 540 x 540 squares, centre-cropped to 4 : 3.
 */
.cat-index .cat-card--project .cat-card__media {
    aspect-ratio: 4 / 3;
}

.cat-index .cat-card--project .cat-card__img {
    object-position: center 50%;
}

.cat-index .cat-card--project .cat-card__body {
    min-height: 84px;
}

.cat-index .cat-card--project .cat-card__title {
    font-size: clamp(1rem, 1.12vw, 1.125rem);
}

.cat-index .cat-card--project .cat-card__go {
    color: var(--cat-muted);
    background: transparent;
}

/* product cards (only when the CMS lists products on this page) */

.cat-index .cat-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1;
    padding: 6px 10px;
    font-size: .6875rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #ffffff;
    border-radius: 999px;
}

.cat-index .cat-badge--sold { background: var(--cat-ink); }
.cat-index .cat-badge--promo { background: var(--cat-green-deep); }

/* ---------- pagination (markup comes from the paginator; only restyled) ---------- */

.cat-index .cat-pagination {
    margin-top: clamp(28px, 3.2vw, 44px);
}

.cat-index .cat-pagination .pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cat-index .cat-pagination .page-item {
    margin: 0;
}

.cat-index .cat-pagination .page-link {
    display: block;
    min-width: 44px;
    padding: 12px 14px;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    color: var(--cat-ink);
    text-decoration: none;
    background: var(--cat-surface);
    border: 1px solid var(--cat-line-strong);
    border-radius: var(--cat-radius);
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.cat-index .cat-pagination .page-link:hover,
.cat-index .cat-pagination .page-link:focus-visible,
.cat-index .cat-pagination .page-link.pageactive {
    color: #ffffff;
    background: var(--cat-green-deep);
    border-color: var(--cat-green-deep);
}

/* ---------- tablet ---------- */

@media (max-width: 1099px) {
    .cat-index .cat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cat-index .cat-card__title {
        font-size: 1.0625rem;
    }
}

/* ---------- mobile ---------- */

@media (max-width: 599px) {
    .cat-index .cat-head__title {
        font-size: clamp(2.25rem, 12vw, 3rem);
    }

    .cat-index .cat-tabs {
        margin-right: calc(var(--cat-gutter) * -1);
        margin-left: calc(var(--cat-gutter) * -1);
    }

    .cat-index .cat-tabs__list {
        padding-right: var(--cat-gutter);
        padding-left: var(--cat-gutter);
    }

    .cat-index .cat-tabs__link {
        min-height: 54px;
    }

    .cat-index .cat-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .cat-index .cat-card__media {
        aspect-ratio: 1.3 / 1;
    }

    .cat-index .cat-card__body {
        min-height: 72px;
        padding: 16px 18px 17px;
    }
}

/* a category with a single project: the card is wider so the section does not look empty */
.cat-index .cat-grid--solo {
    grid-template-columns: minmax(0, 560px);
}

@media (max-width: 1099px) {
    .cat-index .cat-grid--solo {
        grid-template-columns: minmax(0, 560px);
    }
}

@media (max-width: 599px) {
    .cat-index .cat-grid--solo {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- product / project detail page ---------- */

.cat-index--item {
    --prj-gap: clamp(10px, 1vw, 16px);
}

/* hero: title + request button on the left, the featured photo and four more on the right */
.cat-index .prj-hero {
    display: grid;
    grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
    gap: clamp(32px, 4.4vw, 80px);
    align-items: center;
    padding: clamp(8px, 1.6vw, 24px) 0 clamp(40px, 5vw, 76px);
}

.cat-index .prj-hero__title {
    margin: 0 0 clamp(26px, 2.8vw, 40px);
    padding: 0;
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-size: clamp(2rem, 3.5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -.026em;
    text-transform: none;
    color: var(--cat-ink);
    overflow-wrap: anywhere;
}

.cat-index .prj-hero__cta {
    max-width: 380px;
}

/* product ID 29 (text first): the hero is only the title and the button, side by side */
.cat-index .prj-hero--text {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: clamp(28px, 3.4vw, 48px);
}

.cat-index .prj-hero--text .prj-hero__text {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px clamp(32px, 4vw, 64px);
}

.cat-index .prj-hero--text .prj-hero__title {
    flex: 1 1 520px;
    margin-bottom: 0;
    font-size: clamp(2.25rem, 4.6vw, 4rem);
}

.cat-index .prj-hero--text .prj-hero__cta {
    flex: 0 1 340px;
    padding-bottom: 6px;
}

/* photos: a 4 x 2 mosaic, the featured one is the 2 x 2 tile; the CMS photos are 540 x 540 squares */
.cat-index .prj-hero__photos,
.cat-index .prj-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--prj-gap);
}

.cat-index .prj-hero--n0 .prj-hero__photos {
    grid-template-columns: minmax(0, 1fr);
    max-width: 560px;
}

.cat-index .prj-photo {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #e8ecf1;
    border: 1px solid var(--cat-line);
    border-radius: var(--cat-radius);
    box-shadow: var(--cat-shadow);
    transition: box-shadow .3s ease, border-color .3s ease;
}

.cat-index .prj-photo[hidden] {
    display: none;
}

.cat-index .prj-photo--featured {
    grid-column: span 2;
    grid-row: span 2;
}

.cat-index .prj-hero--n0 .prj-photo--featured {
    grid-column: auto;
    grid-row: auto;
}

.cat-index .prj-photo__img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    object-fit: cover;
    transition: transform .7s cubic-bezier(.2, .7, .2, 1);
}

.cat-index .prj-photo::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(14, 28, 63, 0);
    transition: background-color .3s ease;
    pointer-events: none;
}

.cat-index a.prj-photo:hover,
.cat-index a.prj-photo:focus-visible {
    border-color: var(--cat-line-strong);
    box-shadow: var(--cat-shadow-hover);
}

.cat-index a.prj-photo:hover .prj-photo__img,
.cat-index a.prj-photo:focus-visible .prj-photo__img {
    transform: scale(1.05);
}

.cat-index a.prj-photo:hover::after,
.cat-index a.prj-photo:focus-visible::after {
    background: rgba(14, 28, 63, .16);
}

.cat-index a.prj-photo:focus-visible {
    outline: 3px solid var(--cat-green);
    outline-offset: 3px;
}

/* the rest of the photos: full width */
.cat-index .prj-gallery {
    padding-bottom: clamp(40px, 5vw, 76px);
}

.cat-index--desc-first .prj-gallery {
    padding-top: clamp(36px, 4.4vw, 64px);
}

/* photos revealed by "Покажи още" fade in (the script adds the class; reduced motion turns the animation off) */
.cat-index .prj-photo--new {
    animation: prj-in .5s ease both;
}

@keyframes prj-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

/* "Покажи още" */
.cat-index .prj-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: clamp(26px, 3vw, 40px);
}

.cat-index .prj-more[hidden] {
    display: none;
}

.cat-index .prj-more__btn {
    min-height: 52px;
    padding: 0 34px;
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--cat-ink);
    background: #ffffff;
    border: 2px solid var(--cat-ink);
    border-radius: 999px;
    cursor: pointer;
    transition: color .25s ease, background-color .25s ease;
}

.cat-index .prj-more__btn:hover {
    color: #ffffff;
    background: var(--cat-ink);
}

.cat-index .prj-more__btn:focus-visible {
    outline: 3px solid var(--cat-green);
    outline-offset: 3px;
}

.cat-index .prj-more__status {
    margin: 0;
    font-size: .875rem;
    font-weight: 500;
    color: var(--cat-muted);
}

/* description: a full-width band, readable column */
.cat-index .prj-desc {
    padding: clamp(40px, 5vw, 76px) 0;
    background: #f5f7fa;
    box-shadow: 0 0 0 100vmax #f5f7fa;
    clip-path: inset(0 -100vmax);
}

.cat-index--desc-first .prj-desc {
    padding: 0 0 clamp(8px, 1vw, 16px);
    background: none;
    box-shadow: none;
    clip-path: none;
}

.cat-index .prj-desc__label {
    max-width: 78ch;
    margin: 0 0 22px;
    padding: 0 0 14px;
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-size: .8125rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--cat-green-deep);
    border-bottom: 1px solid var(--cat-line-strong);
}

.cat-index .prj-desc .cat-prose {
    max-width: 78ch;
    margin: 0;
}

.cat-index .prj-desc .cat-prose > :last-child {
    margin-bottom: 0;
}

/* request button */
.cat-index .prj-cta__btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 62px;
    padding: 0 12px 0 26px;
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
    text-decoration: none;
    background: var(--cat-green-deep);
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(55, 107, 18, .28);
    transition: background-color .25s ease, box-shadow .25s ease, transform .3s cubic-bezier(.2, .7, .2, 1);
}

.cat-index .prj-cta__btn:hover,
.cat-index .prj-cta__btn:focus-visible {
    color: #ffffff;
    text-decoration: none;
    background: #2c590f;
    box-shadow: 0 14px 32px rgba(55, 107, 18, .36);
    transform: translateY(-2px);
}

.cat-index .prj-cta__btn:focus-visible {
    outline: 3px solid var(--cat-ink);
    outline-offset: 3px;
}

.cat-index .prj-cta__go {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: var(--cat-green-deep);
    background: #ffffff;
    border-radius: 50%;
}

/* closing request button */
.cat-index .prj-cta {
    max-width: 420px;
    margin: clamp(36px, 4.4vw, 64px) 0 clamp(8px, 2vw, 24px);
}

.cat-index .prj-admin {
    margin: 32px 0 0;
    font-size: .875rem;
}

@media (max-width: 1099px) {
    .cat-index .prj-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: clamp(26px, 4vw, 40px);
        padding-bottom: clamp(32px, 5vw, 48px);
    }

    .cat-index .prj-hero--text .prj-hero__cta {
        flex: 1 1 100%;
        max-width: 420px;
    }

    .cat-index .prj-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

}

@media (max-width: 599px) {
    .cat-index .prj-hero__title {
        font-size: clamp(1.875rem, 9vw, 2.5rem);
    }

    .cat-index .prj-hero__cta,
    .cat-index .prj-cta {
        max-width: none;
    }

    .cat-index .prj-hero__photos,
    .cat-index .prj-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cat-index .prj-more__btn {
        width: 100%;
    }
}

/* ---------- photo grid of "Реализирани обекти": installation photos and project photos as photo cards (projects/view_projects.php) ---------- */

.cat-index .cat-photo-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--cat-gap); /* the same gap as the category cards, so the introduction lines up with the 3rd column */
}

/* the photo card is the product page's .prj-photo (square, rounded, zoom on hover, no text); only the grid differs */
.cat-index .cat-photos .prj-more {
    margin-top: clamp(28px, 3.4vw, 44px);
}

@media (max-width: 991px) {
    .cat-index .cat-photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 599px) {
    /* phones: always two columns */
    .cat-index .cat-photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ---------- motion and contrast preferences ---------- */

@media (prefers-reduced-motion: reduce) {
    .cat-index *,
    .cat-index *::before,
    .cat-index *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }

    .cat-index .cat-card:hover,
    .cat-index .cat-card:focus-visible,
    .cat-index .cat-card:hover .cat-card__img,
    .cat-index .cat-card:focus-visible .cat-card__img,
    .cat-index .cat-card:hover .cat-card__go,
    .cat-index .cat-card:focus-visible .cat-card__go,
    .cat-index a.prj-photo:hover .prj-photo__img,
    .cat-index a.prj-photo:focus-visible .prj-photo__img,
    .cat-index .prj-cta__btn:hover,
    .cat-index .prj-cta__btn:focus-visible {
        transform: none;
    }

    .cat-index .prj-photo--new {
        animation: none;
    }
}

@media (forced-colors: active) {
    .cat-index .cat-card,
    .cat-index .cat-card__go {
        border: 1px solid CanvasText;
    }
}

/* ==========================================================================================================================
 * "Реализирани обекти" (/realizirani-obekti): the introduction, the per-category sections, the closing request link and the empty state.
 * The filter is the catalog's own tab row (.cat-tabs); the cards are the product page's .prj-photo; nothing else is new.
 * ========================================================================================================================== */
.cat-index .obj-lead {
    max-width: 62ch;
    margin: 0 0 clamp(20px, 2.4vw, 32px);
    font-size: clamp(1.0625rem, .6vw + .75rem, 1.25rem);
    line-height: 1.6;
    color: var(--cat-ink-soft);
}

.cat-index .obj-status {
    margin: 0;
    height: 0;
    overflow: hidden;
}

.cat-index .obj-group[hidden] {
    display: none;
}

.cat-index .obj-group__product {
    margin: -6px 0 clamp(14px, 1.6vw, 20px);
    font-size: .9375rem;
    line-height: 1.5;
    color: var(--cat-muted, #4b5a6b);
}

.cat-index .obj-group__product a {
    color: var(--cat-green-deep);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cat-index .obj-group__product a:hover,
.cat-index .obj-group__product a:focus-visible {
    text-decoration-thickness: 2px;
}

.cat-index .obj-group__more {
    margin: clamp(16px, 2vw, 24px) 0 0;
    font-size: .9375rem;
    font-weight: 600;
}

.cat-index .obj-group__more a {
    color: var(--cat-green-deep);
    text-decoration: none;
}

.cat-index .obj-group__more a:hover,
.cat-index .obj-group__more a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cat-index .obj-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px clamp(20px, 3vw, 40px);
    margin-top: clamp(40px, 5vw, 72px);
    padding: clamp(20px, 2.6vw, 32px);
    background: #f5f7fa;
    border-radius: 10px;
}

.cat-index .obj-cta__text {
    margin: 0;
    font-size: clamp(1.125rem, .8vw + .8rem, 1.375rem);
    font-weight: 700;
    color: var(--cat-ink);
}

.cat-index .obj-cta .prj-cta__btn,
.cat-index .obj-empty .prj-cta__btn {
    width: 100%;
    max-width: 340px;
}

.cat-index .obj-empty {
    max-width: 720px;
    margin: clamp(8px, 2vw, 24px) 0 0;
    padding: clamp(24px, 3vw, 40px);
    background: #f5f7fa;
    border-radius: 10px;
}

.cat-index .obj-empty__title {
    margin: 0 0 12px;
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-size: clamp(1.25rem, 1vw + .9rem, 1.625rem);
    font-weight: 800;
    line-height: 1.25;
    text-transform: none;
    letter-spacing: 0;
    color: var(--cat-ink);
}

.cat-index .obj-empty__text {
    margin: 0 0 16px;
    line-height: 1.6;
    color: var(--cat-ink-soft);
}

.cat-index .obj-empty__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}

.cat-index .obj-empty__links li {
    margin: 0;
    padding: 0;
}

.cat-index .obj-empty__links a {
    display: inline-block;
    padding: 8px 14px;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--cat-ink);
    text-decoration: none;
    background: #ffffff;
    border: 1px solid var(--cat-line-strong);
    border-radius: 999px;
}

.cat-index .obj-empty__links a:hover,
.cat-index .obj-empty__links a:focus-visible {
    color: var(--cat-green-deep);
    border-color: var(--cat-green);
}
