/*
 * Rivera — Catalogue list (all six catalogues)
 *
 * Blocks:
 *   .catalog-page   — the page ground
 *   .catalog        — the page's one section: title, search, list, pages
 *   .catalog-search — price / plot / ID form
 *   .catalog-card   — one object: number, price, facts, text, link, photo
 *
 * Sizes are the design's, normalised to the 1380px container: the reference
 * card is 1708px wide, this one 1340px, so measured values are × ≈0.78 — the
 * same step the object page and the footer took.
 */

/* The page ground and the heading are shared: .site-main and .page-title in
 * css/main.css and css/sections.css. */

.catalog__intro {
    max-width:  900px;
    margin-top: 20px;
    font-size:  16px;
    line-height: 1.5;
}

.catalog__summary {
    margin: 0;
    color:  var(--color-sky);
}

.catalog__lead {
    margin: 8px 0 0;
}

.catalog__search {
    margin-top: 36px;
}

.catalog__about {
    margin-top: 64px;
}

.catalog__found {
    display:     flex;
    flex-wrap:   wrap;
    align-items: baseline;
    gap:         8px 20px;
    margin:      32px 0 0;
    color:       var(--color-sky);
    font-size:   16px;
    line-height: 1.4;
}

.catalog__reset {
    color:                 var(--color-orange);
    text-decoration:       underline;
    text-underline-offset: 3px;
    transition:            color var(--transition);
}

.catalog__reset:hover,
.catalog__reset:focus-visible {
    color: var(--color-secondary);
}

.catalog__list {
    display:        flex;
    flex-direction: column;
    gap:            24px;
    margin:         64px 0 0;
    padding:        0;
    list-style:     none;
}

.catalog__item {
    display: block;
}

.catalog__empty {
    margin:      48px 0 0;
    font-size:   var(--fs-body);
    line-height: 1.5;
}

/* ── Search ─────────────────────────────────────────────────────────────── */
/* Four groups on one line, the button pushed to the right edge — as drawn.
 * Every group is a legend above its fields, so the fields line up on one
 * baseline whatever the legend's length. */
.catalog-search {
    display:     flex;
    flex-wrap:   wrap;
    align-items: flex-end;
    gap:         32px 96px;
}

.catalog-search__group {
    display:        flex;
    flex-direction: column;
    gap:            28px;
    min-width:      0;
    margin:         0;
    padding:        0;
    border:         0;
}

/* A legend ignores flex gap in some engines, so it carries no margin of its
 * own and floats into normal flow instead. */
.catalog-search__legend {
    float:          left;
    width:          100%;
    padding:        0;
    font-size:      24px;
    line-height:    1.2;
    letter-spacing: 0.3px;
    text-transform: var(--tt-heading);
}

.catalog-search__fields {
    clear:       both;
    display:     flex;
    align-items: center;
    gap:         32px;
}

.catalog-search__field {
    display:     flex;
    align-items: center;
    gap:         16px;
}

.catalog-search__label {
    font-size:      18px;
    line-height:    1;
    text-transform: var(--tt-heading);
}

/* Mixed with .field, which holds the border, the colours and the states. */
.catalog-search__input {
    width:         96px;
    height:        46px;
    padding:       0 14px;
    border-radius: 23px;
    font-size:     16px;
    line-height:   1;
    text-align:    center;
}

.catalog-search__input--code {
    width: 128px;
}

.catalog-search__input::-webkit-search-cancel-button {
    display: none;
}

.catalog-search__submit {
    min-width:        208px;
    height:           60px;
    margin-left:      auto;
    padding:          0 32px;
    border:           3px solid var(--color-navy-soft);
    border-radius:    20px;
    background-color: var(--color-panel);
    color:            var(--color-secondary);
    font-family:      inherit;
    font-size:        26px;
    line-height:      1;
    letter-spacing:   0.5px;
    text-transform:   var(--tt-heading);
    cursor:           pointer;
    transition:       background-color var(--transition), border-color var(--transition), color var(--transition);
}

.catalog-search__submit:hover,
.catalog-search__submit:focus-visible {
    border-color:     var(--color-orange);
    background-color: var(--color-maroon);
    color:            var(--color-orange);
}

.catalog-search__submit:focus-visible,
.catalog__reset:focus-visible {
    outline:        2px solid var(--color-orange);
    outline-offset: 3px;
}

/* ── Card ───────────────────────────────────────────────────────────────── */
/* Four columns at the design's proportions: number, price, the text column,
 * the photo. The photo sets the card's height; the button sits on the bottom
 * edge of the text column, level with the photo's lower edge. */
.catalog-card {
    display:               grid;
    grid-template-columns: 36px minmax(0, 275fr) minmax(0, 616fr) minmax(0, 294fr);
    grid-template-areas:   'number price body media';
    column-gap:            24px;
    padding:               14px 24px 14px 16px;
    background:            linear-gradient(180deg, var(--color-panel) 0%, var(--color-navy) 100%);
}

.catalog-card__number {
    grid-area:   number;
    padding-top: 22px;
    color:       var(--color-orange);
    font-size:   32px;
    font-weight: 700;
    line-height: 1;
    text-align:  center;
}

.catalog-card__price {
    grid-area:   price;
    margin:      0;
    padding-top: 18px;
    font-family: var(--font-price);
    font-size:   28px;
    font-weight: 900;
    line-height: 1.2;
    text-align:  center;
}

.catalog-card__body {
    grid-area:      body;
    display:        flex;
    flex-direction: column;
    min-width:      0;
    padding-top:    6px;
}

.catalog-card__facts {
    display:   flex;
    flex-wrap: wrap;
    gap:       4px 64px;
    margin:    0;
    padding:   0 0 0 12px;
}

.catalog-card__fact {
    display:     flex;
    align-items: baseline;
    gap:         40px;
}

/* A fixed width for the ID, so «ПЛОЩА» starts at one line down the whole
 * list whether the code is h28 or PR11. */
.catalog-card__fact--code {
    min-width: 250px;
}

.catalog-card__label {
    color:          var(--color-sky);
    font-size:      17px;
    line-height:    1.4;
    text-transform: var(--tt-heading);
}

.catalog-card__value {
    margin:      0;
    color:       var(--color-orange);
    font-size:   22px;
    line-height: 1.4;
}

/* Three lines, as in the design; the full text is one click away. */
.catalog-card__excerpt {
    display:            -webkit-box;
    overflow:           hidden;
    margin:             12px 0 16px;
    font-size:          16px;
    line-height:        1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp:         3;
}

.catalog-card__more {
    display:          flex;
    align-items:      center;
    min-height:       50px;
    margin-top:       auto;
    padding:          8px 28px;
    border-radius:    3px;
    background-color: var(--color-orange);
    color:            var(--color-navy-deep);
    font-size:        22px;
    line-height:      1.2;
    letter-spacing:   0.3px;
    text-decoration:  none;
    text-transform:   var(--tt-heading);
    transition:       background-color var(--transition), color var(--transition);
}

.catalog-card__more:hover,
.catalog-card__more:focus-visible {
    background-color: var(--color-orange-hot);
}

.catalog-card__more:focus-visible {
    outline:        2px solid var(--color-orange);
    outline-offset: 3px;
}

.catalog-card__media {
    grid-area:        media;
    display:          block;
    overflow:         hidden;
    aspect-ratio:     375 / 275;
    border:           2px solid var(--color-sky);
    background-color: var(--color-navy-deep);
}

.catalog-card__media:hover .catalog-card__img {
    transform: scale(1.04);
}

/* ── Desktop steps ──────────────────────────────────────────────────────── */
@media (max-width: 1279px) {
    .catalog-search {
        column-gap: 56px;
    }

    .catalog-card__price {
        font-size: 23px;
    }

    .catalog-card__facts {
        column-gap: 40px;
    }

    .catalog-card__fact {
        gap: 20px;
    }

    .catalog-card__fact--code {
        min-width: 190px;
    }

    .catalog-card__label {
        font-size: 15px;
    }

    .catalog-card__value {
        font-size: 20px;
    }

    .catalog-card__more {
        font-size: 19px;
    }
}

/* Below 1200 the four groups only share a line with the gaps drawn in. */
@media (max-width: 1199px) {
    .catalog-search {
        column-gap: 36px;
    }

    .catalog-search__legend {
        font-size: 21px;
    }

    .catalog-search__fields {
        gap: 24px;
    }

    .catalog-search__field {
        gap: 12px;
    }

    .catalog-search__input {
        width: 80px;
    }

    .catalog-search__input--code {
        width: 104px;
    }
}

/* ── Tablet ─────────────────────────────────────────────────────────────── */
/* The price moves up beside the number, over the text; the photo keeps the
 * right-hand column. The form wraps to two rows: the two ranges, then the ID
 * and the button. */
@media (max-width: 1023px) {


    .catalog__search {
        margin-top: 32px;
    }

    .catalog__about {
        margin-top: 48px;
    }

    .catalog__list {
        gap:        20px;
        margin-top: 44px;
    }

    .catalog-search {
        gap: 32px 48px;
    }

    .catalog-search__group {
        gap: 20px;
    }

    .catalog-search__legend {
        font-size: 18px;
    }

    .catalog-search__label {
        font-size: 16px;
    }

    .catalog-search__submit {
        min-width: 160px;
        height:    48px;
        font-size: 20px;
    }

    .catalog-card {
        grid-template-columns: 28px minmax(0, 1fr) minmax(0, 40%);
        grid-template-rows:    auto 1fr;
        grid-template-areas:
            'number price media'
            'body   body  media';
        column-gap:            16px;
        padding:               16px;
    }

    .catalog-card__number {
        padding-top: 4px;
        font-size:   26px;
        text-align:  left;
    }

    .catalog-card__price {
        padding-top: 0;
        font-size:   24px;
        text-align:  left;
    }

    .catalog-card__body {
        padding-top: 12px;
    }

    .catalog-card__facts {
        gap:          2px 28px;
        padding-left: 0;
    }

    .catalog-card__fact {
        gap: 12px;
    }

    .catalog-card__fact--code {
        min-width: 150px;
    }

    .catalog-card__label {
        font-size: 14px;
    }

    .catalog-card__value {
        font-size: 18px;
    }

    .catalog-card__excerpt {
        margin:    8px 0 14px;
        font-size: 15px;
    }

    .catalog-card__more {
        min-height: 44px;
        padding:    8px 18px;
        font-size:  17px;
    }

    .catalog-card__media {
        align-self: start;
    }
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
/* One column: number and price, the photo full width, then the facts, text
 * and the button. The form stacks; each pair of inputs shares a row. */
@media (max-width: 767px) {


    .catalog__intro {
        margin-top: 12px;
        font-size:  15px;
    }

    .catalog__search {
        margin-top: 24px;
    }

    .catalog__about {
        margin-top: 36px;
    }

    .catalog__list {
        gap:        16px;
        margin-top: 36px;
    }

    .catalog-search {
        flex-direction: column;
        align-items:    stretch;
        gap:            24px;
    }

    .catalog-search__group {
        gap: 12px;
    }

    .catalog-search__legend {
        font-size: 16px;
    }

    .catalog-search__fields {
        gap: 16px;
    }

    .catalog-search__field {
        flex: 1 1 0;
    }

    .catalog-search__input {
        flex:      1 1 auto;
        width:     100%;
        min-width: 0;
        height:    46px;
        font-size: 16px;
    }

    .catalog-search__input--code {
        width: 100%;
    }

    .catalog-search__submit {
        width:       100%;
        min-width:   0;
        height:      50px;
        margin-top:  4px;
        margin-left: 0;
    }

    .catalog-card {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows:    auto;
        grid-template-areas:
            'number price'
            'media  media'
            'body   body';
        column-gap:            12px;
        padding:               14px;
    }

    .catalog-card__number {
        padding-top: 2px;
        font-size:   22px;
    }

    .catalog-card__price {
        font-size: 21px;
    }

    .catalog-card__media {
        margin-top: 12px;
    }

    .catalog-card__label {
        font-size: 13px;
    }

    .catalog-card__value {
        font-size: 17px;
    }

    .catalog-card__more {
        justify-content: center;
        font-size:       16px;
    }
}

/* ── State: the list under «Знайдено обʼєктів» ──────────────────────────── */
/* Last in the file, so it wins over every breakpoint's .catalog__list. */
.catalog__list--found {
    margin-top: 20px;
}

/* While the next results load: the old ones dim rather than vanish, so the
 * page does not jump. */
.catalog__results {
    transition: opacity var(--transition);
}

.catalog__results:focus {
    outline: none;
}

.catalog__results--loading {
    opacity:        0.45;
    pointer-events: none;
}
