/* /local/templates/.default/css/page-top-custom.css
   Все правила работают только если в шапке есть маркер .page-top__flag,
   т.е. кастомная шапка найдена. Иначе (в т.ч. в каталоге) шапка остаётся родной.
   Стили кнопок не нужны: используются штатные классы темы btn btn-default btn-lg [btn-transparent-bg]. */

/* ---------- общая плашка ---------- */
.page-top-wrapper:has(.page-top__flag) {
    background: #eee;
    overflow: hidden;
}

.page-top:has(.page-top__flag) {
    display: grid;
    grid-template-columns: 1fr;
    column-gap: 32px;
    row-gap: 0;
    padding-block: 32px;
}

.page-top:has(.page-top__flag)>* {
    grid-column: 1;
}

/* красный заголовок */
.page-top:has([data-red="Y"]) h1 {
    color: #e11d27;
}

/* ---------- содержимое под H1 ---------- */
.page-top__body {
    margin-top: 16px;
    max-width: 560px;
}

.page-top__desc {
    color: #444;
    line-height: 1.4;
}

.page-top__desc>*:first-child {
    margin-top: 0;
}

.page-top__desc>*:last-child {
    margin-bottom: 0;
}

.page-top__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

/* ---------- мета (дата, место): для мероприятий ---------- */
.page-top__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    font-size: 14px;
}

.page-top__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.page-top__meta-item::before {
    content: "";
    width: 16px;
    height: 16px;
    flex: none;
    background-repeat: no-repeat;
    background-size: contain;
}

.page-top__meta-item--date::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23333' stroke-width='1.2'%3E%3Crect x='1.5' y='2.5' width='13' height='12' rx='2'/%3E%3Cpath d='M1.5 6.5h13M5 1v3M11 1v3'/%3E%3C/svg%3E");
}

.page-top__meta-item--place::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23333' stroke-width='1.2'%3E%3Cpath d='M8 15s5-4.6 5-8.5a5 5 0 0 0-10 0C3 10.4 8 15 8 15z'/%3E%3Ccircle cx='8' cy='6.5' r='1.8'/%3E%3C/svg%3E");
}

/* ---------- layout: split (текст 50% / баннер 50%) ---------- */
.page-top:has([data-layout="split"]) {
    grid-template-columns: 1fr 1fr;
}

.page-top:has([data-layout="split"]) .page-top__media {
    grid-column: 2;
    grid-row: 1 / span 3;
    /* cowl + topic + body */
    align-self: end;
    justify-self: end;
    display: flex;
    align-items: flex-end;
    margin-bottom: -32px;
    /* картинка «стоит» на нижней границе плашки */
}

.page-top:has([data-layout="split"]) .page-top__media img {
    display: block;
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
}

/* ---------- layout: cover (заголовок, широкая картинка, под ней мета) ---------- */
.page-top:has([data-layout="cover"]) .cowl {
    grid-row: 1;
}

.page-top:has([data-layout="cover"]) .topic {
    grid-row: 2;
}

.page-top:has([data-layout="cover"]) .page-top__media {
    grid-row: 3;
    margin-top: 16px;
}

.page-top:has([data-layout="cover"]) .page-top__media img {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    border-radius: 12px;
}

.page-top:has([data-layout="cover"]) .page-top__body {
    grid-row: 4;
    max-width: none;
}

/* ---------- layout: plain (без баннера) ---------- */
.page-top:has([data-layout="plain"]) .page-top__body {
    max-width: 720px;
}

/* ---------- мобильная версия ---------- */
@media (max-width:767px) {
    .page-top:has(.page-top__flag) {
        padding-block: 20px;
    }

    .page-top:has([data-layout="split"]) {
        grid-template-columns: 1fr;
    }

    .page-top:has([data-layout="split"]) .page-top__media {
        grid-column: 1;
        grid-row: auto;
        justify-self: center;
        margin: 16px 0 -20px;
    }

    .page-top:has([data-layout="split"]) .page-top__media img {
        max-height: 220px;
    }

    .page-top__body {
        max-width: none;
    }

    .page-top__buttons .btn {
        width: 100%;
        justify-content: center;
    }
}