/* Mobile-first, system font stack */
@font-face {
    font-family: "TeX Gyre Heros";
    src: url("fonts/TeXGyreHeros-Regular.woff2") format("woff2"),
         url("fonts/TeXGyreHeros-Regular.woff") format("woff"),
         url("fonts/texgyreheros-regular.otf") format("opentype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --content-max: 422px;
    --btn-bg: #fff;
    --btn-hover: rgb(240, 240, 240);
    --mobile-bg-right-width: 15%;
    --mobile-logo-width: 250px;
}

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

html {
    font-size: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Helvetica Neue", "TeX Gyre Heros", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: #fff;
    overflow-x: hidden;
}

.page-wrap {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 1rem;
    padding-top: 0.5rem;
}

/* Background layer: mobile-first — один фон background_mod_v3.jpg, привязка к нижнему левому углу; tablet/desktop: background_top.png */
.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background-color: #1a1d24;
    background-image: url("img/background_mod_v3.jpg");
    background-size: cover;
    background-position: left bottom;
    background-repeat: no-repeat;
    animation: bgZoom 45s ease-in-out infinite alternate;
}

@keyframes bgZoom {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.05);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bg-layer {
        animation: none;
    }
}

/* Нижняя полоса фона (20vh) — только десктоп, по умолчанию скрыта */
.bg-layer-bottom {
    display: none;
}

/* Правый слой фона для мобильного (две части); на десктопе скрыт */
.bg-layer-right {
    display: none;
    position: fixed;
    right: 0;
    top: 0;
    height: 100%;
    z-index: -2;
}

/* Dark overlay: только для контраста фона, без плашки под текстом */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(
        to right,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(0, 0, 0, 0.15) 45%,
        rgba(0, 0, 0, 0.0) 70%,
        transparent 100%
    );
}

/* Левый блок: логотип, место под доп. изображение, текстовый контент; мин. ширина 360px; padding-bottom — место под фиксированный копирайт */
.left-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    min-width: 360px;
    padding-bottom: 3rem;
}

/* Контейнер логотипа: выровнен по левому краю, без сдвига вправо */
.header {
    align-self: flex-start;
    margin-bottom: 0;
    margin-left: 0;
    padding-left: 0;
}

.logo-wrapper {
    display: block;
    text-align: left;
    margin-left: 0;
    padding-left: 0;
}

.logo-wrapper img,
.logo {
    display: block;
    margin-left: 0;
    max-width: 140px;
    height: auto;
    padding: 0.25rem 0;
}

.logo-wrapper .logo-block-img {
    display: none;
}

/* Место под дополнительное изображение под логотипом; пустой по умолчанию */
.logo-sub-image {
    display: block;
    width: 100%;
    min-height: 0;
}

.logo-sub-image img {
    display: block;
    max-width: 100%;
    margin-top: 8px;
    margin-bottom: 8px;
}

/* Текстовый блок: выровнен по левому краю контейнера (0), без сдвига вправо */
.content-text {
    margin-left: 0;
    padding-left: 0;
}

.content-text .card__title,
.content-text .card__subtitle,
.content-text .card__section,
.content-text .card__contacts {
    margin-left: 0;
}

/* Main: контент прижат к левому краю на всех размерах экрана */
.main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    padding: 0.5rem 0;
}

/* Карточка: левый край совпадает с левым краем логотипа, без центрирования */
.card {
    width: 100%;
    max-width: 90%;
    margin-left: 0;
    margin-right: auto;
    position: relative;
    left: 0;
    padding: 1.5rem 1.5rem 1.5rem 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

/* Читаемость без плашки: лёгкий text-shadow для заголовка и текста */
/* Заголовок h1 в одну строку: запрет переноса, масштабируемый размер (мин. 14px на мобильном) */
.card__title,
h1.card__title {
    margin: 0 0 0.75rem;
    max-width: 100%;
    white-space: nowrap;
    font-size: clamp(18px, 2vw, 36px);
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 0, 0, 0.6);
    box-sizing: border-box;
}

.card__subtitle {
    margin: 0 0 1.25rem;
    font-size: 1.2rem;
    line-height: 1.5;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 16px rgba(0, 0, 0, 0.5);
}

.card__section {
    margin-bottom: 1.25rem;
}

.card__section:last-of-type {
    margin-bottom: 0;
}

.card__section-title {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 14px rgba(0, 0, 0, 0.5);
}

.card__links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card__links li {
    margin: 0;
    display: flex;
    flex: 1 1 0;
    min-width: 8rem;
}

/* Ссылки: белые кнопки, чёрный текст */
.card__link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 0.5rem 0.9rem;
    color: #000;
    background: var(--btn-bg);
    border: 1px solid var(--btn-bg);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.card__link:hover {
    background: var(--btn-hover);
    color: #000;
    border-color: var(--btn-hover);
}

.card__link:focus {
    outline: 2px solid #000;
    outline-offset: 2px;
}

.card__contacts {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 1.2rem;
    line-height: 1.5;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 14px rgba(0, 0, 0, 0.5);
}

.card__contact-item {
    white-space: nowrap;
}

/* Ссылки-телефоны: белый цвет (в т.ч. на iOS Safari), без подчёркивания */
.card__contacts a[href^="tel:"],
.card__contacts .card__contact-item {
    color: #fff;
    text-decoration: none;
}

.card__contacts a[href^="tel:"]:hover,
.card__contacts a[href^="tel:"]:focus,
.card__contacts a[href^="tel:"]:visited {
    color: #fff;
    text-decoration: none;
}

/* Копирайт внизу страницы (viewport): ссылка на profine-group.ru */
.copyright-area {
    position: fixed;
    bottom: 10px;
    left: 1rem;
    width: calc(100% - 2rem);
    z-index: 1;
    box-sizing: border-box;
}

.copyright {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 90%;
    font-size: 10px;
    line-height: 1.4;
    box-sizing: border-box;
}

.copyright a {
    display: block;
    width: 100%;
    padding-left: 5px;
    white-space: nowrap;
    color: #fff;
    opacity: 0.85;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    text-decoration: none;
    box-sizing: border-box;
}

.copyright a:hover,
.copyright a:focus {
    color: #fff;
    opacity: 1;
    text-decoration: none;
}

/* Блок контактов внизу экрана — только десктоп, по умолчанию скрыт */
.contacts-strip {
    display: none;
}

/* Кнопка «Контакты» в карточке — только мобильный, по умолчанию скрыта */
.card__link--contacts-cta {
    display: none;
    cursor: pointer;
    border: 1px solid var(--btn-bg);
    font: inherit;
}

.card__link--contacts-cta:hover {
    background: var(--btn-hover);
}

.card__link--contacts-cta:focus {
    outline: 2px solid #000;
    outline-offset: 2px;
}

/* Мобильный блок контактов — по умолчанию скрыт */
.mobile-contacts-view {
    display: none;
    width: 100%;
    max-width: 90%;
    margin-left: 0;
    margin-right: auto;
    padding: 1.5rem 1.5rem 1.5rem 0;
    flex-direction: column;
    gap: 1rem;
}

.mobile-contacts-view[hidden] {
    display: none !important;
}

/* Мобильный (до 1199px): один фон background_mod_v3.jpg, привязка к нижнему левому углу; контент в левом блоке; копирайт внизу слева; без анимации */
@media (max-width: 1199px) {
    .bg-layer {
        width: 100%;
        background-image: url("img/background_mod_v3.jpg");
        background-position: left bottom;
        background-size: cover;
        animation: none;
    }

    .bg-layer-right {
        display: none;
    }

    .page-wrap {
        height: 100vh;
        min-height: 100vh;
        justify-content: flex-start;
        align-items: center;
        box-sizing: border-box;
    }

    .left-panel {
        flex: 1;
        min-height: 0;
        align-items: center;
        max-width: 100%;
        width: 100%;
    }

    .header {
        align-self: center;
        width: 100%;
        max-width: 100%;
    }

    .logo-wrapper {
        margin-left: auto;
        margin-right: auto;
        max-width: 100%;
    }

    .logo-wrapper picture {
        display: block;
        width: fit-content;
        margin-left: auto;
        margin-right: auto;
    }

    .main {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
    }

    .card {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        margin-left: auto;
        margin-right: auto;
        position: relative;
        left: 0;
        padding-left: 1.5rem;
        width: 100%;
    }

    .card__bottom {
        margin-top: auto;
    }

    .card.content-text,
    .content-text {
        text-align: center;
    }

    .content-text .card__title,
    .content-text .card__subtitle,
    .content-text .card__section,
    .content-text .card__section-title {
        text-align: center;
    }

    .card__links {
        justify-content: center;
    }

    .card__contacts {
        justify-content: center;
    }

    .card__link--contacts-cta {
        display: flex;
    }

    .card__links li.card__links-item--contacts {
        display: flex;
    }

    .main .card.content-text[hidden] {
        display: none !important;
    }

    .mobile-contacts-view:not([hidden]) {
        display: flex;
        flex-direction: column;
        align-items: center;
        flex: 1 1 0;
        min-height: 0;
        max-height: calc(100vh - 4rem);
        max-width: min(420px, 90%);
        margin-left: auto;
        margin-right: auto;
        padding-bottom: 3rem;
        text-align: center;
    }

    .mobile-contacts-view:not([hidden]) .mobile-contacts-view__content {
        flex: 1 1 0;
        min-height: 0;
        width: 100%;
        overflow-y: auto;
        padding: 1.5rem;
        background: rgba(255, 255, 255, 0.8);
        border-radius: 12px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    }

    .mobile-contacts-view:not([hidden]) .mobile-contacts-central .contacts-strip__title,
    .mobile-contacts-view:not([hidden]) .mobile-contacts-regional .contacts-strip__title {
        color: #1a1d24;
        text-shadow: none;
    }

    .mobile-contacts-view:not([hidden]) .mobile-contacts-central .contacts-block__city,
    .mobile-contacts-view:not([hidden]) .mobile-contacts-central .contacts-block__address,
    .mobile-contacts-view:not([hidden]) .mobile-contacts-central .contacts-block__phone,
    .mobile-contacts-view:not([hidden]) .mobile-contacts-central .contacts-block__name,
    .mobile-contacts-view:not([hidden]) .mobile-contacts-regional .contacts-block__name,
    .mobile-contacts-view:not([hidden]) .mobile-contacts-regional .contacts-block__address,
    .mobile-contacts-view:not([hidden]) .mobile-contacts-regional .contacts-block__phone {
        color: #1a1d24;
        text-shadow: none;
    }

    .mobile-contacts-view:not([hidden]) .mobile-contacts-central .contacts-block__phone a,
    .mobile-contacts-view:not([hidden]) .mobile-contacts-regional .contacts-block__phone a {
        color: #1a1d24;
    }

    .mobile-contacts-view:not([hidden]) .mobile-contacts-central .contacts-block__phone a:hover,
    .mobile-contacts-view:not([hidden]) .mobile-contacts-regional .contacts-block__phone a:hover {
        text-decoration: underline;
    }

    .mobile-contacts-central {
        flex: 1 1 0;
        min-height: 0;
        text-align: center;
    }

    .mobile-contacts-central .contacts-column-central,
    .mobile-contacts-central .contacts-column-production {
        text-align: center;
    }

    .mobile-contacts-actions {
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
        align-items: stretch;
        justify-content: center;
        width: calc(2 * var(--mobile-logo-width) + 0.5rem);
        max-width: 100%;
        align-self: center;
        flex-shrink: 0;
    }

    .mobile-contacts-actions .mobile-contacts-back,
    .mobile-contacts-actions .mobile-contacts-toggle-regional {
        flex: 1 1 var(--mobile-logo-width);
        min-width: 0;
        max-width: calc(50% - 0.25rem);
        box-sizing: border-box;
    }

    .mobile-contacts-central .contacts-strip__title,
    .mobile-contacts-regional .contacts-strip__title {
        margin: 0 0 0.5rem;
        font-size: 0.85rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 14px rgba(0, 0, 0, 0.5);
    }

    .mobile-contacts-central .contacts-block__city,
    .mobile-contacts-central .contacts-block__address,
    .mobile-contacts-central .contacts-block__phone,
    .mobile-contacts-regional .contacts-block__name,
    .mobile-contacts-regional .contacts-block__address,
    .mobile-contacts-regional .contacts-block__phone {
        margin: 0 0 0.25rem;
        font-size: 0.9rem;
        line-height: 1.4;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 14px rgba(0, 0, 0, 0.5);
    }

    .mobile-contacts-central .contacts-block__phone a,
    .mobile-contacts-regional .contacts-block__phone a {
        color: #fff;
        text-decoration: none;
    }

    .mobile-contacts-central .contacts-block__phone a:hover,
    .mobile-contacts-regional .contacts-block__phone a:hover {
        text-decoration: underline;
    }

    .mobile-contacts-regional .contacts-block {
        margin-bottom: 1rem;
    }

    .mobile-contacts-regional {
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto;
        text-align: center;
    }

    .mobile-contacts-toggle-regional {
        border-radius: 8px;
        border: 1px solid var(--btn-bg);
        background: var(--btn-bg);
        color: #000;
        font-size: 0.9rem;
        font-weight: 500;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 0.5rem 0.9rem;
        line-height: 1.2;
        flex-shrink: 0;
        box-sizing: border-box;
        min-height: 2.5rem;
    }

    .mobile-contacts-toggle-regional:hover {
        background: var(--btn-hover);
    }

    .mobile-contacts-toggle-regional:focus {
        outline: 2px solid #000;
        outline-offset: 2px;
    }

    .mobile-contacts-back {
        min-height: 2.5rem;
    }

    .copyright-area {
        left: 1rem;
        transform: none;
        width: auto;
        max-width: calc(100% - 2rem);
        box-sizing: border-box;
    }
}

/* Вертикальный экран (портрет): один фон background_mod_v3.jpg, привязка к нижнему левому углу; контент в левом блоке; без анимации */
@media (orientation: portrait) {
    .page-wrap {
        height: 100vh;
        min-height: 100vh;
    }

    .bg-layer {
        width: 100%;
        background-image: url("img/background_mod_v3.jpg");
        background-position: left bottom;
        background-size: cover;
        animation: none;
    }

    .bg-layer-right {
        display: none;
    }

    .main {
        flex: 1;
        min-height: 0;
    }

    .logo-wrapper {
        width: 100%;
        max-width: 100%;
    }

    .logo-wrapper picture {
        display: block;
        width: fit-content;
        max-width: 250px;
        margin-left: auto;
        margin-right: auto;
    }

    .logo-wrapper img,
    .logo {
        display: block;
        width: var(--mobile-logo-width);
        max-width: 100%;
        height: auto;
    }

    .left-panel {
        flex: 1;
        min-height: 0;
        max-width: 100%;
    }

    .card {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }

    .card__bottom {
        margin-top: auto;
        margin-bottom: 80px;
    }

    .copyright-area {
        left: 1rem;
        transform: none;
    }
}

/* Desktop: фон 80% background_top.png + 20% красная полоса; панель справа */
@media (min-width: 1200px) {
    .bg-layer {
        height: 80vh;
        width: 100%;
        background-image: url("img/background_top.png");
        background-size: cover;
        background-position: center top;
        background-attachment: fixed;
    }

    .bg-layer-bottom {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 20vh;
        background: rgb(198, 9, 30);
        z-index: -2;
    }

    .page-wrap {
        flex-direction: row;
        align-items: flex-start;
        justify-content: flex-end;
        padding: 1.5rem 2rem;
        padding-top: 1rem;
    }

    .left-panel {
        max-width: var(--content-max);
        margin-left: auto;
        margin-right: 2rem;
        align-items: stretch;
    }

    .header {
        position: static;
        align-self: flex-start;
    }

    .logo-wrapper {
        width: 320px;
    }

    .logo-wrapper img,
    .logo {
        max-width: 320px;
        width: 320px;
        margin-left: 0;
    }

    .logo-wrapper .logo-block-img {
        display: block;
        width: 320px;
        max-width: 100%;
        margin-top: 0.5rem;
    }

    .main {
        position: fixed;
        left: 70px;
        top: 15rem;
        align-items: flex-start;
        justify-content: flex-start;
        padding-left: 0;
        padding-top: 0;
        max-width: var(--content-max);
        width: fit-content;
        z-index: 1;
    }

    .card {
        max-width: none;
        width: fit-content;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
        text-align: left;
    }

    .card__title,
    h1.card__title {
        width: fit-content;
        max-width: none;
        white-space: nowrap;
    }

    .card__subtitle,
    .card__section-title {
        text-align: center;
    }

    .card__links {
        justify-content: flex-start;
    }

    .card__links li.card__links-item--contacts {
        display: none !important;
    }

    .copyright-area {
        left: auto;
        right: 2rem;
    }

    .copyright {
        max-width: var(--content-max);
    }

    .overlay {
        background: linear-gradient(
            to right,
            rgba(0, 0, 0, 0.65) 0%,
            rgba(0, 0, 0, 0.35) 40%,
            rgba(0, 0, 0, 0.1) 70%,
            transparent 100%
        );
    }

    .contacts-strip {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 20vh;
        min-height: 120px;
        z-index: 1;
        align-items: center;
        justify-content: flex-start;
    }

    .contacts-strip__inner {
        display: flex;
        flex-direction: row;
        gap: 3rem;
        max-width: 100%;
        width: 100%;
        padding: 0 2rem 0 70px;
        color: #fff;
    }

    .contacts-column-central {
        flex: 0 0 auto;
        min-width: 280px;
    }

    .contacts-column-production {
        flex: 0 0 auto;
        min-width: 0;
    }

    .contacts-production-blocks {
        display: flex;
        flex-direction: row;
        gap: 1.5rem;
    }

    .contacts-column-regional {
        flex: 1 1 auto;
        min-width: 0;
    }

    .contacts-regional-slider {
        position: relative;
        overflow: hidden;
        cursor: grab;
        user-select: none;
    }

    .contacts-regional-slider:active {
        cursor: grabbing;
    }

    .contacts-regional-track {
        display: flex;
        flex-direction: row;
        gap: 1.5rem;
        transition: transform 0.3s ease-out;
    }

    .contacts-strip__title {
        margin: 0 0 0.5rem;
        font-size: 0.85rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    .contacts-block__city,
    .contacts-block__address,
    .contacts-block__phone {
        margin: 0 0 0.25rem;
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .contacts-block__phone a {
        color: #fff;
        text-decoration: none;
    }

    .contacts-block__phone a:hover,
    .contacts-block__phone a:focus {
        text-decoration: underline;
    }

    .contacts-block {
        flex: 0 0 220px;
        min-width: 220px;
        margin: 0;
        padding: 0;
    }

    .contacts-block__name {
        margin: 0 0 0.25rem;
        font-size: 0.95rem;
        font-weight: 600;
    }

    .contacts-regional-track .contacts-block {
        flex: 0 0 220px;
        min-width: 220px;
    }

    .contacts-production-blocks .contacts-block {
        flex: 0 0 220px;
        min-width: 220px;
    }
}

/* Очень узкий экран: сильнее оверлей для читаемости */
@media (max-width: 380px) {
    .overlay {
        background: linear-gradient(
            to right,
            rgba(0, 0, 0, 0.82) 0%,
            rgba(0, 0, 0, 0.55) 60%,
            rgba(0, 0, 0, 0.3) 100%
        );
    }

    .card {
        max-width: 92%;
    }

    .copyright-area {
        max-width: 92%;
    }

    .card__links {
        flex-direction: column;
    }

    .card__link {
        min-height: 2.5rem;
    }
}
