/*
 * Дизайн-система v2 (Figma: «Website design», OpzLPaT554rlkGSoBp6YYh).
 * Токены и базовые компоненты, общие для всех страниц нового дизайна.
 * Брейкпоинты макета: desktop 1440, tablet 768, mobile 375.
 */

:root {
    /* Цвета */
    --v2-bg: #000000;
    --v2-text: #F0F0F0;
    --v2-text-secondary: #C0C0C0;
    --v2-text-muted: #808080;
    --v2-line: #444444;
    --v2-line-strong: #808080;
    --v2-lime: #E0F54A;
    --v2-success: #3BD88C;
    --v2-success-line: #1D6E49;
    --v2-success-bg: #144B32;
    /* В макете нет состояния ошибки — подобрано по аналогии с success */
    --v2-error: #FF6B6B;
    --v2-error-line: #C24141;
    --v2-error-bg: #4B1414;

    /* Светлые секции */
    --v2-light-bg: #F0F0F0;
    --v2-light-text: #000000;
    --v2-light-text-secondary: #444444;

    /* Шрифты. В макете крупные заголовки переведены с trial-шрифта Martina Plantijn
       на Google Sans 400 — тот же шрифт, что и у заголовков секций, но светлее. */
    --v2-font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --v2-font-display: 'Google Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --v2-font-heading: 'Google Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Отступ страницы от краёв */
    --v2-gutter: 80px;
}

@media (max-width: 1199px) {
    :root { --v2-gutter: 32px; }
}

@media (max-width: 767px) {
    :root { --v2-gutter: 16px; }
}

/* ---------- База ---------- */

/* Сбросы через :where() — нулевая специфичность, чтобы любой класс компонента их перебивал */
:where(.v2) *,
:where(.v2) *::before,
:where(.v2) *::after {
    box-sizing: border-box;
}

body.v2 {
    margin: 0;
    min-height: 100vh;
    background: var(--v2-bg);
    color: var(--v2-text);
    font-family: var(--v2-font-body);
    font-weight: 500;
    font-size: 18px;
    line-height: 22px;
    letter-spacing: -0.03em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:where(.v2) a {
    color: inherit;
    text-decoration: none;
}

:where(.v2) img {
    display: block;
    max-width: 100%;
}

.v2 [hidden] {
    display: none !important;
}

:where(.v2) button {
    font: inherit;
    letter-spacing: inherit;
}

.v2-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Типографика ---------- */

.v2-h2 {
    margin: 0;
    font-family: var(--v2-font-display);
    font-weight: 500;
    font-size: 44px;
    line-height: 1;
    letter-spacing: 0;
    color: var(--v2-text);
}

.v2-body-s {
    font-size: 14px;
    line-height: 17px;
}

@media (max-width: 1199px) {
    .v2-h2 { font-size: 32px; }
}

@media (max-width: 767px) {
    .v2-h2 { font-size: 24px; }
}

/* ---------- Навигация ---------- */

.v2-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    height: 96px;
    padding: 0 var(--v2-gutter);
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid var(--v2-line-strong);
    -webkit-backdrop-filter: blur(50px);
    backdrop-filter: blur(50px);
}

.v2-nav__back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 18px;
    line-height: 21px;
    color: var(--v2-text);
    transition: opacity .15s;
}

.v2-nav__back:hover {
    opacity: .7;
}

.v2-nav__back img {
    width: 24px;
    height: 24px;
}

@media (max-width: 767px) {
    .v2-nav { height: 61px; }
    .v2-nav__back { gap: 4px; font-size: 14px; line-height: 17px; letter-spacing: 0; }
}

/* ---------- Кнопки ---------- */

.v2-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 12px 24px;
    border: 0;
    border-radius: 0;
    font-weight: 600;
    font-size: 18px;
    line-height: 21px;
    letter-spacing: -0.03em;
    text-align: center;
    cursor: pointer;
    transition: background-color .15s, color .15s, opacity .15s;
}

.v2-btn--block {
    display: flex;
    width: 100%;
}

.v2-btn--lime {
    background: var(--v2-lime);
    color: #000;
}

.v2-btn--lime:hover {
    background: #EAFA78;
}

.v2-btn--light {
    background: var(--v2-text);
    color: #000;
}

.v2-btn--light:hover {
    background: #FFFFFF;
}

.v2-btn--ghost {
    padding: 8px 12px;
    background: transparent;
    color: var(--v2-text-secondary);
}

.v2-btn--ghost:hover {
    color: var(--v2-text);
}

/* «Blocked» из макета */
.v2-btn:disabled,
.v2-btn.is-disabled {
    background: var(--v2-line);
    color: var(--v2-text-muted);
    cursor: not-allowed;
}

.v2-btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.v2-btn.is-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid #000;
    border-right-color: transparent;
    border-radius: 50%;
    animation: v2-spin .7s linear infinite;
}

@keyframes v2-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
    .v2-btn { min-height: 33px; padding: 8px 16px; gap: 4px; font-size: 14px; line-height: 17px; letter-spacing: 0; }
    .v2-btn--ghost { min-height: 25px; padding: 4px 8px; }
    .v2-btn--google { min-height: 40px; }
    .v2-btn--icon { padding-right: 12px; }
}

.v2-btn--dark {
    background: #000;
    color: var(--v2-text);
}

.v2-btn--dark:hover {
    background: #1A1A1A;
}

.v2-btn--outline {
    background: transparent;
    color: var(--v2-text);
    box-shadow: inset 0 0 0 1.5px currentColor;
}

.v2-btn--outline:hover {
    background: rgba(240, 240, 240, .1);
}

/* Кнопка со стрелкой/шевроном справа */
.v2-btn--icon {
    padding-right: 18px;
}

.v2-btn--icon .v2-icon {
    flex: none;
}

/* Размер M — крупные кнопки в секциях (hero, CTA) */
.v2-btn--m {
    gap: 12px;
    min-height: 53px;
    padding: 12px 24px;
    font-weight: 500;
    font-size: 24px;
    line-height: 28.8px;
}

.v2-btn--m.v2-btn--icon {
    padding-right: 20px;
}

.v2-btn--google img {
    flex: none;
}

@media (max-width: 767px) {
    .v2-btn--m {
        gap: 8px;
        min-height: 46px;
        padding: 12px 24px;
        font-size: 18px;
        line-height: 21.6px;
    }

    .v2-btn--m.v2-btn--icon { padding-right: 18px; }
}

/* Текстовая ссылка-кнопка (Button size=S, color=dark) */
.v2-link {
    font-size: 14px;
    line-height: 17px;
    color: var(--v2-text);
    transition: opacity .15s;
}

.v2-link:hover {
    opacity: .7;
}

/* ---------- Разделитель «или» ---------- */

.v2-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    line-height: 17px;
    color: var(--v2-text-muted);
}

.v2-divider::before,
.v2-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--v2-line);
}

/* ---------- Сегментный переключатель (Filtering) ---------- */

.v2-segmented {
    display: flex;
    gap: 16px;
    margin: 0;
    padding: 0;
    border: 0;
}

.v2-segmented__item {
    flex: 1;
    position: relative;
}

.v2-segmented__item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.v2-segmented__item span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 24px;
    background: var(--v2-line-strong);
    color: var(--v2-line);
    font-weight: 600;
    font-size: 18px;
    line-height: 21px;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.v2-segmented__item span:hover {
    color: var(--v2-bg);
}

.v2-segmented__item input:checked + span {
    background: var(--v2-text);
    color: #000;
}

.v2-segmented__item input:focus-visible + span {
    outline: 2px solid var(--v2-lime);
    outline-offset: 2px;
}

@media (max-width: 767px) {
    .v2-segmented__item span { min-height: 33px; padding: 8px 12px; font-size: 14px; line-height: 17px; letter-spacing: 0; }
}

/* ---------- Поле ввода (Dropdown Selec / Password) ---------- */

.v2-field {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.v2-field__label {
    font-size: 14px;
    line-height: 17px;
    color: var(--v2-text-secondary);
}

.v2-field__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.v2-field__control {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 4px;
    border-bottom: 1.5px solid var(--v2-line-strong);
    transition: border-color .15s;
}

.v2-field__input {
    flex: 1;
    min-width: 0;
    height: 22px;
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--v2-text);
    font: inherit;
    font-size: 18px;
    line-height: 22px;
    letter-spacing: -0.03em;
    caret-color: var(--v2-lime);
}

.v2-field__input::placeholder {
    color: var(--v2-text-muted);
    opacity: 1;
}

/* Автозаполнение Chrome не должно перекрашивать фон */
.v2-field__input:-webkit-autofill,
.v2-field__input:-webkit-autofill:hover,
.v2-field__input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--v2-text);
    -webkit-box-shadow: 0 0 0 1000px var(--v2-bg) inset;
    transition: background-color 9999s;
}

.v2-field__control:hover,
.v2-field.is-filled .v2-field__control,
.v2-field__control:focus-within {
    border-color: var(--v2-text);
}

.v2-field.is-success .v2-field__control {
    border-color: var(--v2-success-line);
}

.v2-field.is-invalid .v2-field__control {
    border-color: var(--v2-error-line);
}

.v2-field__toggle {
    flex: none;
    display: flex;
    width: 24px;
    height: 24px;
    margin: -1px 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    opacity: .9;
}

.v2-field__toggle:hover {
    opacity: 1;
}

.v2-field__hint,
.v2-field__status {
    font-size: 14px;
    line-height: 17px;
    color: var(--v2-text-muted);
}

.v2-field__status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.v2-field__status--success {
    color: var(--v2-success);
}

.v2-field__error {
    font-size: 14px;
    line-height: 17px;
    color: var(--v2-error);
    white-space: pre-line;
}

.v2-field__error:empty {
    display: none;
}

/* Многострочное поле */
textarea.v2-field__input {
    height: 78px;
    min-height: 44px;
    resize: vertical;
}

/* Выпадающий список ([data-select]) */
.v2-select {
    position: relative;
}

.v2-select__toggle {
    width: 100%;
    margin: 0;
    padding-top: 0;
    padding-inline: 0;
    border-width: 0 0 1.5px;
    background: none;
    color: var(--v2-text);
    font-size: 18px;
    line-height: 22px;
    text-align: left;
    cursor: pointer;
}

.v2-select__value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v2-select:not(.is-filled):not(.is-open) .v2-select__value {
    color: var(--v2-text-muted);
}

.v2-select.is-open .v2-field__control {
    border-color: var(--v2-text);
}

/* Фокус с клавиатуры показываем линией поля, как у инпутов */
.v2-select__toggle:focus {
    outline: none;
}

.v2-select__toggle:focus-visible {
    border-color: var(--v2-lime);
}

.v2-select__chevron {
    transition: transform .15s;
}

.v2-select.is-open .v2-select__chevron {
    transform: rotate(180deg);
}

.v2-select__list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 351px;
    overflow-y: auto;
    margin: 4px 0 0;
    padding: 8px 0;
    list-style: none;
    background: #000;
    border: 1px solid var(--v2-line-strong);
}

.v2-select__list [role="option"] {
    padding: 10px 16px;
    font-size: 14px;
    line-height: 17px;
    cursor: pointer;
    outline: none;
}

.v2-select__list [role="option"]:hover,
.v2-select__list [role="option"]:focus {
    background: rgba(240, 240, 240, .08);
}

.v2-select__list [role="option"][aria-selected="true"] {
    color: var(--v2-lime);
}

/* Индикатор надёжности пароля */
.v2-strength {
    display: flex;
    gap: 4px;
}

.v2-strength span {
    flex: 1;
    height: 5px;
    background: var(--v2-line);
    transition: background-color .2s;
}

.v2-strength[data-score="1"] span:nth-child(-n+1),
.v2-strength[data-score="2"] span:nth-child(-n+2),
.v2-strength[data-score="3"] span:nth-child(-n+3),
.v2-strength[data-score="4"] span {
    background: var(--v2-lime);
}

/* ---------- Чекбокс ---------- */

.v2-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 17px;
    color: var(--v2-text-secondary);
    cursor: pointer;
}

.v2-checkbox input {
    flex: none;
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin: 0;
    border: 1px solid var(--v2-text);
    border-radius: 0;
    background: transparent center / 16px 16px no-repeat;
    cursor: pointer;
}

.v2-checkbox input:checked {
    background-color: var(--v2-text);
    background-image: url('../../img/v2/check-dark.svg');
}

.v2-checkbox input:focus-visible {
    outline: 2px solid var(--v2-lime);
    outline-offset: 2px;
}

.v2-checkbox a {
    color: var(--v2-lime);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.v2-checkbox a:hover {
    text-decoration: none;
}

/* ---------- Toast ---------- */

.v2-toasts {
    position: fixed;
    left: 50%;
    bottom: 80px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 388px;
    max-width: calc(100% - 2 * var(--v2-gutter));
    transform: translateX(-50%);
    pointer-events: none;
}

.v2-toast {
    display: flex;
    gap: 14px;
    padding: 24px;
    border: 1px solid var(--v2-success-bg);
    background: #000 linear-gradient(90deg, rgba(20, 75, 50, .3) 0%, rgba(20, 75, 50, 0) 53%);
    font-size: 14px;
    line-height: 17px;
    pointer-events: auto;
    animation: v2-toast-in .25s ease-out;
}

.v2-toast--error {
    border-color: var(--v2-error-bg);
    background: #000 linear-gradient(90deg, rgba(75, 20, 20, .3) 0%, rgba(75, 20, 20, 0) 53%);
}

.v2-toast.is-leaving {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .2s, transform .2s;
}

.v2-toast__icon {
    flex: none;
    width: 16px;
    height: 16px;
    margin-top: 1px;
}

.v2-toast__text {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.v2-toast__title {
    font-weight: 600;
    color: var(--v2-text);
}

.v2-toast__message {
    color: var(--v2-text-muted);
    white-space: pre-line;
}

@keyframes v2-toast-in {
    from { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 767px) {
    .v2-toasts { bottom: 24px; }
    .v2-toast { gap: 12px; padding: 16px; }
}
