/* =========================================
   PERLITE HOLDING — Main Styles
   ========================================= */

/* --- Variables --- */
:root {
    --color-primary: #54bb90;
    --color-primary-hover: #3da87a;
    --color-dark: #111111;
    --color-dark-footer: #0d0d0d;
    --color-text: #1a1a1a;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-bg: #ffffff;
    --color-bg-light: #f9f9f9;

    --font-primary: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    /* Для данных: телефоны, время, цифры — системный шрифт с чёткими нейтральными цифрами */
    --font-data: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;

    --container-width: 1280px;

    --header-height: 72px;
}

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    /* scroll-behavior: smooth убран — мешает браузерному восстановлению позиции при перезагрузке.
       Плавный скролл к якорям реализован через JS там где нужно. */
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-primary);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
}

.site-main {
    padding-top: var(--header-height);
}

@media (max-width: 600px) {
    :root { --header-height: 60px; }
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

/* --- Container --- */
.container {
    max-width: var(--container-width);
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 48px;
    padding-right: 48px;
}

@media (max-width: 768px) {
    .container { padding-left: 20px; padding-right: 20px; }
}
/* Единый padding 20px — не уменьшаем дальше, чтоб контент не прилипал */

/* --- Form validation — глобальные стили --- */

/* Обязательное поле — зелёная точка перед лейблом */
.contact-form__label--req::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-primary);
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Метка необязательного поля */
.field-optional {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    opacity: 0.6;
    margin-left: 6px;
}

/* Inline ошибка */
.field-error {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: #c0392b;
    line-height: 1.4;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.field-error.is-shown {
    max-height: 32px;
    opacity: 1;
    margin-top: 5px;
}

.field-error::before {
    content: '';
    display: inline-flex;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none'%3E%3Ccircle cx='7' cy='7' r='6' stroke='%23c0392b' stroke-width='1.3'/%3E%3Cpath d='M7 4.5v3M7 9.5h.01' stroke='%23c0392b' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/* Тёмный вариант (callback форма) */
.field-error--dark {
    color: #ff8f8f;
}

.field-error--dark::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none'%3E%3Ccircle cx='7' cy='7' r='6' stroke='%23ff8f8f' stroke-width='1.3'/%3E%3Cpath d='M7 4.5v3M7 9.5h.01' stroke='%23ff8f8f' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Состояние поля при ошибке — только линия под инпутом */
.contact-form__field.has-error .contact-form__input {
    border-bottom-color: #e53e3e;
}

/* Блокируем зелёную анимированную линию на has-error */
.contact-form__field.has-error::after { display: none; }

/* Callback — ошибка */
.callback__field.has-error input,
.callback__field.has-error textarea {
    border-color: rgba(255,107,107,0.6) !important;
}

/* --- Video Modal --- */
@keyframes modal-in  { from { opacity:0; transform:scale(0.94); } to { opacity:1; transform:none; } }
@keyframes modal-out { from { opacity:1; transform:none; }        to { opacity:0; transform:scale(0.94); } }

.video-modal {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.video-modal.is-open {
    opacity: 1;
    pointer-events: all;
}

.video-modal__overlay {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
}

.video-modal__box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 960px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0,0,0,0.6);
    transform: scale(0.94);
    transition: transform 0.35s cubic-bezier(0.22,1,0.36,1);
}

.video-modal.is-open .video-modal__box {
    transform: none;
}

/* 16:9 */
.video-modal__ratio {
    position: relative;
    padding-top: 56.25%;
    background: #000;
}

.video-modal__iframe,
.video-modal__video {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.video-modal__close {
    position: absolute;
    top: -44px;
    right: 0;
    z-index: 2;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
}

@media (hover: hover) {
    .video-modal__close:hover { background: rgba(255,255,255,0.22); }
}

@media (max-width: 600px) {
    .video-modal { padding: 16px; }
    .video-modal__close { top: -40px; width: 32px; height: 32px; }
}

/* --- Hero play button --- */
.hero__btn-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    flex-shrink: 0;
}

/* --- Buttons (global) --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 100px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
    border: none;
    text-decoration: none;
    white-space: nowrap;
    min-height: 48px;
    transition: background 0.25s ease, color 0.25s ease,
                border-color 0.25s ease, transform 0.15s ease;
    align-self: flex-start;
}

/* Primary — зелёный */
.btn--primary {
    background: var(--color-primary);
    color: #ffffff;
    border: 1.5px solid var(--color-primary);
}

@media (hover: hover) {
    .btn--primary:hover {
        background: var(--color-primary-hover);
        border-color: var(--color-primary-hover);
        transform: translateY(-1px);
    }
}

/* Outline — светлая рамка */
.btn--outline {
    background: transparent;
    color: var(--color-text);
    border: 1.5px solid rgba(0,0,0,0.15);
}

@media (hover: hover) {
    .btn--outline:hover {
        background: var(--color-text);
        color: #ffffff;
        border-color: var(--color-text);
    }
}

/* Dark — тёмная заливка */
.btn--dark {
    background: var(--color-dark);
    color: #ffffff;
    border: 1.5px solid var(--color-dark);
}

@media (hover: hover) {
    .btn--dark:hover {
        background: #2a2a2a;
        border-color: #2a2a2a;
        transform: translateY(-1px);
    }
}

/* Стрелка внутри кнопки */
.btn__arrow {
    display: inline-flex;
    align-items: center;
    transition: transform 0.2s ease;
}

@media (hover: hover) {
    .btn:hover .btn__arrow { transform: translateX(3px); }
}

/* --- Section label / tag --- */
.section-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-primary);
}

.section-label::before {
    content: '';
    display: block;
    width: 20px;
    height: 2px;
    background: var(--color-primary);
    border-radius: 1px;
}

/* =========================================
   Flex gap fallback — Safari < 14.1
   Класс .no-flex-gap добавляется через JS
   ========================================= */

/* Hero */
.no-flex-gap .hero__content > * + *  { margin-top: 20px; }
.no-flex-gap .hero__inner            { gap: 0; }

/* Sections */
.no-flex-gap .why-us__content > * + *    { margin-top: 24px; }
.no-flex-gap .callback__intro > * + *    { margin-top: 20px; }
.no-flex-gap .about-hero__content > * + *{ margin-top: 28px; }
.no-flex-gap .about-hero__intro > * + *  { margin-top: 16px; }
.no-flex-gap .about-hero__body > * + *   { margin-top: 20px; }
.no-flex-gap .reasons__content > * + *   { margin-top: 40px; }
.no-flex-gap .reasons__intro > * + *     { margin-top: 14px; }

/* Buttons */
.no-flex-gap .btn                    { gap: 0; }
.no-flex-gap .btn > * + *            { margin-left: 10px; }

/* Section label */
.no-flex-gap .section-label          { gap: 0; }
.no-flex-gap .section-label::before  { margin-right: 8px; }

/* Header */
.no-flex-gap .site-header__island    { gap: 0; }
.no-flex-gap .site-header__logo      { margin-right: auto; }
.no-flex-gap .site-header__actions > * + * { margin-left: 12px; }
.no-flex-gap .nav-menu               { gap: 0; }

/* Footer */
.no-flex-gap .site-footer__socials   { gap: 0; }
.no-flex-gap .site-footer__socials > * + * { margin-left: 10px; }
.no-flex-gap .site-footer__contact-item { gap: 0; }
.no-flex-gap .site-footer__contact-item svg { margin-right: 9px; }

/* --- Utility --- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
