/*
 * Additions on top of the markup's compiled dist/css/styles.css — only for
 * inner pages the markup doesn't cover yet. Uses the markup's own CSS vars.
 */

.site-page-header {
    padding-top: calc(var(--header-height, 1rem) + .6rem);
    padding-bottom: .2rem;
}
.site-page-header .breadcrumbs { margin-bottom: .32rem; }
.site-page-header .h1 { margin: 0; }

.site-events {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .56rem .32rem;
}
@media (max-width: 640px) {
    .site-events { grid-template-columns: 1fr; }
}
.site-events .event__image img { width: 100%; height: auto; }

.site-filters,
.site-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: .12rem .32rem;
    margin-bottom: .56rem;
}
.site-pagination { margin: .84rem 0 0; }
.site-filters__item,
.site-pagination__link { opacity: .5; }
.site-filters__item.is-active,
.site-pagination__link.is-active,
.site-filters__item:hover,
.site-pagination__link:hover { opacity: 1; color: var(--color-red); }

.site-search-results { margin-top: .56rem; }
.site-search-results .search-result { padding: .24rem 0; border-bottom: 1px solid rgba(14, 18, 29, .1); }

.site-lead-form .form__columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .24rem;
    margin: .4rem 0 .24rem;
}
.site-lead-form .form__item_wide { grid-column: 1 / -1; }
@media (max-width: 640px) {
    .site-lead-form .form__columns { grid-template-columns: 1fr; }
}
.site-lead-form textarea.field__input { resize: vertical; min-height: 1rem; }
.site-lead-form .form__submit { margin-top: .32rem; }
.site-lead-form .form__message { margin-top: .24rem; }
.site-lead-form .form__message.is-error { color: #c62828; }

.site-feedback { max-width: 9rem; }
.site-feedback__description { margin-top: .16rem; opacity: .6; }

/* Back-to-top button */
.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: var(--color-red, #003153);
    color: var(--color-white, #fff);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .25s, visibility .25s, transform .25s, background-color .25s;
}
.back-to-top_visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top:hover { background-color: #00243d; }
html[class*=-drawer-opened] .back-to-top { opacity: 0; visibility: hidden; }
@media (max-width: 640px) {
    .back-to-top { right: 14px; bottom: 14px; width: 42px; height: 42px; }
}

/* Header on phones and tablets: icon-only "Экспертиза" toggle, logo centred in the bar */
@media (max-width: 990px) {
    .header__logotype { align-self: center; }
}
@media (max-width: 640px) {
    .expertise-toggle__label { display: none; }
    .header__logotype .logotype img { width: 96px; }
}

/* Navigation rows with an arrow: the arrow stays hidden until hover (or the
   active row), then slides in; the underline sweeps in from the left and the
   title nudges right. Touch devices have no hover, so the arrow stays there. */
.navigation__item_has-sub .navigation__link:before {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    border-bottom: .01rem solid var(--color-red);
    transform: scaleX(0);
    transform-origin: right center;
    transition: transform .5s cubic-bezier(.65, 0, .35, 1);
    z-index: 1;
    pointer-events: none;
}
.navigation__item_has-sub .navigation__title,
.navigation__item_has-sub .navigation__number {
    transition: transform .4s cubic-bezier(.22, 1, .36, 1), opacity .25s;
}
html:not(.-device-touch) .navigation__item_has-sub .navigation__link .icon {
    opacity: 0;
    transform: translateX(-.16rem);
    transition: opacity .3s, transform .45s cubic-bezier(.22, 1, .36, 1), color .25s;
}
html:not(.-device-touch) .navigation .navigation__item_has-sub:hover .navigation__link[href]:after,
.navigation .navigation__item_has-sub.navigation__item_active .navigation__link:after {
    border-bottom-color: currentColor;
    opacity: .3;
}
html:not(.-device-touch) .navigation__item_has-sub:hover .navigation__link[href]:before,
.navigation__item_has-sub.navigation__item_active .navigation__link:before {
    transform: scaleX(1);
    transform-origin: left center;
}
html:not(.-device-touch) .navigation__item_has-sub:hover .navigation__link[href] .navigation__title,
.navigation__item_has-sub.navigation__item_active .navigation__link .navigation__title {
    transform: translateX(.08rem);
}
html:not(.-device-touch) .navigation__item_has-sub:hover .navigation__link[href] .navigation__number {
    opacity: .5;
}
html:not(.-device-touch) .navigation__item_has-sub:hover .navigation__link[href] .icon,
html:not(.-device-touch) .navigation__item_has-sub.navigation__item_active .navigation__link .icon {
    opacity: 1;
    transform: translateX(0);
}
/* The homepage practices list sits on a dark background — white line and arrow there */
.practices__nav .navigation__item_has-sub .navigation__link:before { border-bottom-color: var(--color-white, #fff); }
.practices__nav .navigation .navigation__item_has-sub:hover .navigation__link[href] .icon,
.practices__nav .navigation .navigation__item_has-sub.navigation__item_active .navigation__link .icon { color: var(--color-white, #fff); }
@media (prefers-reduced-motion: reduce) {
    .navigation__item_has-sub .navigation__link:before,
    .navigation__item_has-sub .navigation__link .icon { transition: none !important; }
}

/* "Экспертиза" toggle: hug the icon and label instead of a fixed wide block */
.header__expertise { min-width: 0 !important; margin-left: calc(var(--spacing-24) * -1); }
.header__expertise .expertise-toggle { width: auto; padding: var(--spacing-4) var(--spacing-24) 0; }
@media (max-width: 640px) {
    .header__expertise { flex: 0 0 auto; margin-left: -.16rem; margin-right: auto; }
    .header__expertise .expertise-toggle { padding: var(--spacing-4) .16rem 0; }
}

/* Header controls follow the header theme: on a dark (blue) background they are
   white and hover/active turns white with blue content; on a light background
   they are blue and hover/active turns blue with white content (the default). */
html:not([class*=-drawer-opened]) [data-header*=color-light] .expertise-toggle__icon span { background-color: var(--color-white); }
html:not([class*=-drawer-opened]) [data-header*=color-dark] .expertise-toggle { color: var(--color-red); }
html:not(.-device-touch):not([class*=-drawer-opened]) [data-header*=color-dark] .expertise-toggle:hover { color: var(--color-white); }
html:not(.-device-touch):not([class*=-drawer-opened]) [data-header*=color-light] .expertise-toggle:hover,
html:not(.-device-touch):not([class*=-drawer-opened]) [data-header*=color-light] .search-toggle:hover,
html:not(.-device-touch):not([class*=-drawer-opened]) [data-header*=color-light] .header__control:hover,
html:not([class*=-drawer-opened]) [data-header*=color-light] .header__menu .menu > .menu__item:hover > .menu__link[href],
html:not([class*=-drawer-opened]) [data-header*=color-light] .header__menu .menu > .menu__item_active > .menu__link {
    background-color: var(--color-white);
    color: var(--color-red);
}
html:not(.-device-touch):not([class*=-drawer-opened]) [data-header*=color-light] .expertise-toggle:hover .expertise-toggle__icon span { background-color: var(--color-red); }

/* Search on phones: show the toggle next to the logo; full-width button under the field */
@media (max-width: 640px) {
    .header__search { display: block; width: .5rem; margin-right: 0; }
    .search-form__button .button { width: 100%; justify-content: center; }
}

/* The markup hides .section_breadcrumbs on phones — keep the page title, drop only the crumbs */
@media (max-width: 640px) {
    .site-page-header.section_breadcrumbs { display: block; }
    .site-page-header .breadcrumbs { display: none; }
}

/* Header background once the page is scrolled (class set in site.js):
   white over light sections, brand blue over dark ones */
.header { transition: background-color .25s; }
html:not([class*=-drawer-opened]) .header_scrolled[data-header*=color-dark] { background-color: var(--color-white); }
html:not([class*=-drawer-opened]) .header_scrolled[data-header*=color-light] { background-color: var(--color-red); }
