/*
Theme Name: Museum of Metro
Theme URI: https://peresadka-project.org/
Description: Чистая кастомная тема для Онлайн-музея жетонов metro.
Author: ZYZYX
Version: 1.0.0
*/

/* ===== СБРОС СТИЛЕЙ И БАЗА ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-image: url('/wp-content/uploads/2025/08/%D1%84%D0%BE%D0%BD750.png') !important;
    background-repeat: repeat !important;
    background-size: auto !important;
    background-attachment: fixed !important;
    background-position: top left !important;
    color: #ffffff;
    font-family: 'Bahnschrift', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
}

/* ШРИФТЫ */
@font-face {
    font-family: 'AeroMaticsStencil-Regular';
    src: url('fonts/AeroMaticsStencil-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap; /* Сайт не будет скрывать текст, пока шрифт грузится */
}

@font-face {
    font-family: 'bahnschrift';
    src: url('fonts/bahnschrift.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap; /* Сайт не будет скрывать текст, пока шрифт грузится */
}

@font-face {
    font-family: 'Furore';
    src: url('fonts/Furore.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap; /* Сайт не будет скрывать текст, пока шрифт грузится */
}

@font-face {
    font-family: 'Golos-Text_DemiBold';
    src: url('fonts/Golos-Text_DemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap; /* Сайт не будет скрывать текст, пока шрифт грузится */
}

@font-face {
    font-family: 'mossansregular';
    src: url('fonts/mossansregular.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap; /* Сайт не будет скрывать текст, пока шрифт грузится */
}


/* =========================================================================
   ФИРМЕННАЯ ШАПКА И МЕНЮ САЙТА (ИТОГОВАЯ ПЛАВНАЯ ГЕОМЕТРИЯ)
   ========================================================================= */

/* Контейнер всей шапки */
.site-header {
    height: clamp(88px, 5.5vw + 22px, 110px);
    background-image: url('/wp-content/uploads/2025/08/%D0%9F%D0%BB%D0%B8%D1%82%D0%BA%D0%B0-%D1%85%D0%B5%D0%B4%D0%B5%D1%80_01.jpg'); 
    background-repeat: repeat-x;        
    background-position: left center;    
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    width: 100%;
    z-index: 100;
}

.site-header {
    background-size: auto clamp(88px, 5.5vw + 22px, 110px);
    z-index: 100;
}

/* Ограничитель ширины контента */
.header-wrapper {
    max-width: 1960px;                  
    height: 100%;
    margin: 0 auto;
    
    padding-left: clamp(20px, 10vw - 80px, 80px);
    padding-right: clamp(20px, 10vw - 80px, 80px);
    
    display: flex;
    justify-content: space-between;      
    align-items: center;                 
}

/* Блок логотипа */
.site-logo a {
    display: block;
    line-height: 0;
}

.site-logo img {
    height: clamp(73px, 4.25vw + 22px, 90px);
    width: auto;                         
    display: block;
    flex-shrink: 0;
}

/* Запрещаем перетаскивание и выделение для логотипа и шапки */
.site-header, 
.site-header a, 
.site-header img {
    -webkit-user-drag: none; /* Запрет перетаскивания в WebKit (Chrome, Safari) */
    -webkit-user-select: none; /* Запрет выделения текста */
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* Навигация (менюшка) */
.metro-nav-container {
    --desktop-menu-height: clamp(32px, calc(2.35vw + 8px), 48px);
    display: flex;
    align-items: center; 
    gap: 0; 
    z-index: 1000;
    position: relative;
    margin: 0;
    padding: 0;
    flex-shrink: 0;                      
}

.metro-item {
    position: relative; 
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline-block;
}

/* Главные плашки десктопного меню */
.desktop-menu-link {
    position: relative;
    display: block;
    height: var(--desktop-menu-height);
    overflow: visible;
    line-height: 0;
    text-decoration: none;
    isolation: isolate;
    transition: filter 0.3s ease, transform 0.2s ease;
}

.desktop-menu-base {
    display: block;
    height: 100%;
    width: auto;
    max-height: none;
    image-rendering: auto;
    filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.68));
    pointer-events: none;
}

.desktop-menu-link-closed {
    pointer-events: none;
}

.desktop-menu-closed-art {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: fill;
    pointer-events: none;
}

/* --- ПЕРЕХОД НА МОБИЛЬНЫЙ ФОРМАТ (Меньше 1000px) --- */
@media screen and (max-width: 1000px) {
    .metro-nav-container { 
        display: none !important;        
    }
    
    .header-wrapper {
        padding-left: clamp(10px, 1.47vw + 5.3px, 20px);
        padding-right: clamp(10px, 1.47vw + 5.3px, 20px);
        justify-content: flex-start;     
    }
}

/* --- СТИЛИ ВЫПАДАЮЩЕГО МЕНЮ --- */
.metro-nav-container:not(.is-touch-input) .metro-item:hover > .metro-link,
.metro-item > .metro-link:focus-visible {
    filter: brightness(1.13) drop-shadow(0 0 6px rgba(255, 255, 255, 0.96));
}

.metro-nav-container.is-touch-input .metro-item > .metro-link:active {
    filter: brightness(1.13) drop-shadow(0 0 6px rgba(255, 255, 255, 0.96));
}

.metro-link:focus-visible,
.desktop-token-region-link:focus-visible,
.desktop-token-country-list a:focus-visible {
    outline: 2px solid #dd5136;
    outline-offset: 2px;
}

.metro-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 120%;
    box-sizing: border-box;
    padding: 2px 0 4px;
    background: #dfe2e5;
    border: 3px solid #d7d7d7;
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.metro-dropdown::before {
    content: '';
    position: absolute;
    left: -3px;
    right: -3px;
    bottom: 100%;
    height: 8px;
}

.metro-dropdown::after {
    content: '';
    position: absolute;
    z-index: 100;
    inset: 0;
    border: 2px solid #868686;
    pointer-events: none;
}

.metro-item:hover .metro-dropdown,
.metro-item:focus-within .metro-dropdown {
    display: block;
}

/* Close the persistent desktop dropdown before PJAX replaces page content. */
.metro-item-tokens.is-dropdown-dismissed .metro-dropdown {
    display: none;
}

.desktop-token-region {
    --region-color: #868686;
    text-decoration: none;
    position: relative;
    margin: 0;
    padding: 0;
}

.desktop-token-region-link {
    position: relative;
    display: block;
    width: 100%;
    color: #090909;
    line-height: 0;
    text-decoration: none;
    transition: filter 0.2s ease, background-color 0.2s ease;
}

.metro-nav-container:not(.is-touch-input) .desktop-token-region-link:hover,
.desktop-token-region-link:focus-visible {
    background-color: rgba(255, 255, 255, 0.2);
    filter: brightness(1.14) drop-shadow(0 0 7px rgba(255, 255, 255, 0.96));
    z-index: 2;
}

.metro-nav-container.is-touch-input .desktop-token-region-link:active {
    background-color: rgba(255, 255, 255, 0.2);
    filter: brightness(1.14) drop-shadow(0 0 7px rgba(255, 255, 255, 0.96));
}

.desktop-token-region-ussr-art {
    display: block;
    width: 100%;
    height: auto;
}

.desktop-token-region-art {
    display: block;
    width: 100%;
    aspect-ratio: 265.0308 / 70.3287;
    background-color: var(--region-color);
    -webkit-mask: url('assets/desktop-menu/desktop-menu-token-region.svg') center / 100% 100% no-repeat;
    mask: url('assets/desktop-menu/desktop-menu-token-region.svg') center / 100% 100% no-repeat;
}

.desktop-token-region-name {
    position: absolute;
    z-index: 1;
    inset: 0 0 27%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 calc(var(--desktop-menu-height) * 0.12);
    color: #090909;
    font-family: 'bahnschrift', 'Bahnschrift', sans-serif;
    font-size: calc(var(--desktop-menu-height) * 0.69);
    font-stretch: condensed;
    font-weight: 600;
    line-height: 0.9;
    letter-spacing: 0;
    text-align: center;
    white-space: nowrap;
    transform: translateY(-3px);
}

.desktop-token-country-list {
    margin: 0;
    padding:
        0
        calc(var(--desktop-menu-height) * 0.12)
        calc(var(--desktop-menu-height) * 0.07)
        calc(var(--desktop-menu-height) * 0.22);
    list-style: none;
}

.desktop-token-country-list li {
    margin: 0;
    padding: 0;
    width: 100%;
}

.desktop-token-country-list a {
    display: flex;
    align-items: center;
    gap: calc(var(--desktop-menu-height) * 0.10);
    width: 100%;
    min-height: calc(var(--desktop-menu-height) * 0.41);
    color: #090909;
    font-family: 'bahnschrift', 'Bahnschrift', sans-serif;
    font-size: calc(var(--desktop-menu-height) * 0.34);
    font-stretch: normal;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: 0.10em;
    text-decoration: none;
    white-space: nowrap;
    transition: filter 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.metro-nav-container:not(.is-touch-input) .desktop-token-country-list a:hover,
.desktop-token-country-list a:focus-visible {
    background-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.68);
    filter: brightness(1.14) drop-shadow(0 0 5px rgba(255, 255, 255, 0.96));
}

.metro-nav-container.is-touch-input .desktop-token-country-list a:active {
    background-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.68);
    filter: brightness(1.14) drop-shadow(0 0 5px rgba(255, 255, 255, 0.96));
}

.desktop-token-country-dot {
    flex: 0 0 auto;
    width: calc(var(--desktop-menu-height) * 0.235);
    height: calc(var(--desktop-menu-height) * 0.235);
    background: var(--region-color);
    border-radius: 50%;
}

.desktop-token-country-list a > span:last-child {
    overflow: visible;
    transform: translateY(0.035em);
}

.no-click img { filter: none !important; }
.no-click { cursor: default !important; pointer-events: none; }


/* =========================================================================
   ФИРМЕННЫЙ ФУТЕР САЙТА (МАТЕМАТИЧЕСКИ ВЫВЕРЕННЫЙ ЦЕНТР)
   ========================================================================= */

.site-footer {
    background-color: #000000;
    border-top: 1px solid #111111;
    padding: 14px 0;                    
    width: 100%;
    margin-top: auto;
    z-index: 100;
}

/* Идеальный баланс трех флекс-блоков */
.footer-wrapper {
    max-width: 1960px;
    margin: 0 auto;
    padding-left: clamp(20px, 10vw - 80px, 80px);
    padding-right: clamp(20px, 10vw - 80px, 80px);
    
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

/* Левый блок занимает 1 часть пространства */
.footer-copyright {
    flex: 1;
    white-space: nowrap; 
    color: #a1b7ca;                      
    font-family: 'Bahnschrift', 'Segoe UI', sans-serif; 
    font-size: 17px;                     
    font-weight: 200;                    
    letter-spacing: 0.4px;               
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-divider {
    color: #a1b7ca;                      
    font-weight: 400;                    
    font-family: 'Bahnschrift', 'Segoe UI', sans-serif;
}

/* Центр: теперь СТРОГО в одну строку. Если левый текст жмет — условия уходят вправо */
.footer-terms {
    flex: 2;
    text-align: center;       
}

.terms-link {
    color: #788896;                      
    font-family: 'Bahnschrift', 'Segoe UI', sans-serif; 
    font-size: 17px;                     
    font-weight: 200;                    
    text-decoration: none;
    letter-spacing: 0.4px;               
    transition: color 0.25s ease;
    cursor: pointer;
    display: inline-block;    
    white-space: nowrap; /* Запрещаем перенос на десктопе, заставляя смещаться вправо */
}

.terms-link:hover {
    color: #cbe7ff;                       
}

.terms-link:active {
    color: #cbe7ff;
}

/* Правый блок уравновешивает левый для центровки */
.footer-socials {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
}

.social-link {
    color: #a1b7ca;                      
    display: inline-block;
    transition: color 0.25s ease;        
}

.social-link svg {
    width: 28px;                         
    height: 28px;
    display: block;
}

.social-link:hover {
    color: #cbe7ff;                      
}


/* ===== ГЛОБАЛЬНЫЙ АДАПТИВ И ПЕРЕСТРОЕНИЕ ФУТЕРA ===== */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Переходим на мобильный формат футера на 900px */
@media screen and (max-width: 900px) {
    .footer-wrapper {
        display: grid !important; /* Принудительно включаем grid на мобилках */
        grid-template-columns: 1fr auto !important; 
        row-gap: 4px !important;       
        column-gap: 15px !important; 
        align-items: center !important; 
        padding-left: clamp(15px, 3vw, 30px) !important;
        padding-right: clamp(15px, 3vw, 30px) !important;
    }

    .footer-copyright {
        grid-column: 1 !important;
        grid-row: 1 !important;
        white-space: normal !important; 
        justify-content: flex-start !important;
        min-width: auto !important;
        font-size: 15px !important;
        line-height: 1.2 !important;
        margin: 0 !important;
    }

    .footer-divider {
        display: inline-block !important; 
    }

    /* ИСПРАВЛЕНО: Сразу на 900px растягиваем блок на всю ширину ряда и центрируем */
    .footer-terms {
        grid-column: 1 / span 2 !important; /* Растягиваем на 2 колонки, чтобы центрировать от краев */
        grid-row: 2 !important;
        text-align: center !important;       /* Центрируем текст по середине */
        margin: 0 !important;
        line-height: 1.2 !important;
        width: 100% !important;
    }
    
    /* ИСПРАВЛЕНО: Даем inline-block и разрешаем перенос слов на узких экранах */
    .terms-link {
        font-size: 15px !important;
        white-space: normal !important; 
        display: inline-block !important;
        line-height: 1.2 !important;
    }

    .footer-socials {
        grid-column: 2 !important;
        grid-row: 1 !important; 
        justify-content: flex-end !important;
        align-items: center !important;
        gap: 15px !important;
        min-width: auto !important;
        margin-top: 0 !important; 
    }
}

/* Точечные адаптивные правки */
@media screen and (max-width: 768px) {
    .custom-popup-overlay {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    .custom-popup-window {
        width: 100%;
    }

    .custom-popup-content h3 {
        white-space: normal !important; 
        letter-spacing: 0.5px !important;
    }
    
    .custom-popup-window {
        border-width: 4px !important;
    }
    
    .custom-popup-ol li {
        font-size: 16px !important;
        margin-bottom: 12px !important;
    }
}

/* Наведение работает ТОЛЬКО на устройствах с мышкой */
@media (hover: none) {
    .metro-scroll-top:hover {
        background-color: #3a4f66 !important;
        border-color: #202c3c !important;
        color: #202c3c !important;
    }
}

/* Экстремально узкие экраны (500px и меньше) */
@media screen and (max-width: 500px) {
    .footer-wrapper {
        display: grid !important;
        grid-template-columns: 1fr auto !important; 
        row-gap: 6px !important;       
        column-gap: 15px !important;
        align-items: start !important; 
    }
    
    .footer-copyright {
        grid-column: 1 !important;
        grid-row: 1 !important;
        display: flex !important;
        flex-direction: column !important; 
        align-items: flex-start !important;
        gap: 4px !important;           
        white-space: normal !important;
    }
    
    .footer-divider {
        display: none !important; 
    }
    
    /* ИСПРАВЛЕНО: Сохраняем центрирование, меняем только маржины под мелкий экран */
    .footer-terms {
        grid-column: 1 / span 2 !important; 
        grid-row: 2 !important;
        text-align: center !important; 
        margin-top: 0px !important;   
        margin-bottom: -3px !important; 
        width: 100% !important;
    }
    
    .terms-link {
        white-space: normal !important; 
        display: inline-block !important;
    }

    .footer-socials {
        grid-column: 2 !important;
        grid-row: 1 !important; 
        justify-content: flex-end !important;
        align-self: start !important;
        margin-top: 2px !important;    
    }
}

@media screen and (max-width: 480px) {
    .footer-wrapper {
        padding-left: clamp(10px, 1.47vw + 5.3px, 20px) !important;
        padding-right: clamp(10px, 1.47vw + 5.3px, 20px) !important;
    }
}


/* =========================================================================
   КАСТОМНАЯ НАКЛЕЙКА МЕТРО (МОДАЛЬНОЕ ОКНО ПРАВИЛ)
   ========================================================================= */
/* Внешний флекс-контейнер */
.custom-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
}

/* Эффект плавного появления всей обертки */
.custom-popup-overlay.is-active {
    opacity: 1;
}

/* Слой заднего фона вокруг окна */
.custom-popup-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Оставляем плавность только для цвета (затемнения), убирая её с backdrop-filter */
    background-color: rgba(0, 0, 0, 0); 
    z-index: 1;
    transition: background-color 0.2s ease; 
    
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* Когда попап активен, плавно затемняем фон */
.custom-popup-overlay.is-active .custom-popup-backdrop {
    background-color: rgba(0, 0, 0, 0.4);
}

/* Твоё окно, которое теперь стоит выше фона по z-index */
.custom-popup-window {
    z-index: 2;
    background-color: rgba(20, 20, 20, 0.75); 
    backdrop-filter: blur(12px);               /* Глубокое размытие ПОД окном */
    -webkit-backdrop-filter: blur(12px);  
    border: 7px solid #dfe2e5;                 
    width: calc(100% - clamp(10px, 4vw, 100px)); 
    max-width: 1300px;                                         
    border-radius: 4px;                  
    margin: auto;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-top: clamp(35px, 4.5vw, 60px);
    padding-bottom: clamp(25px, 3.5vw, 55px);
    padding-left: clamp(4px, 1.5vw, 75px);  
    padding-right: clamp(12px, 1.5vw, 75px);
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

/* Анимация увеличения самого окна */
.custom-popup-overlay.is-active .custom-popup-window {
    transform: scale(1);
}

.custom-popup-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #dfe2e5;
    font-size: clamp(28px, 2vw + 12px, 46px); 
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.custom-popup-close:hover {
    opacity: 1;
    color: #cbe7ff;
}

.custom-popup-content {
    color: #dfe2e5;                      
    font-family: 'mossansregular', sans-serif; 
    line-height: 1.65;                         
    text-align: left;
    width: 100%;
    text-align: justify;
    text-align-last: left;
}

.custom-popup-content h3 {
    color: #dfe2e5;
    font-family: 'Bahnschrift', 'Segoe UI', sans-serif; 
    text-transform: uppercase;                 
    margin-top: 0;
    font-size: clamp(20px, 2.3vw + 10px, 44px); 
    margin-bottom: clamp(10px, 1.2vw + 5px, 30px);                                       
    font-weight: 600;
    letter-spacing: 1.5px;
    /* Жестко возвращаем заголовок по центру */
    text-align: center !important;      
    text-align-last: center !important;   
    width: 100%;
    white-space: nowrap; 
}

.custom-popup-ol {
    list-style-type: none;               
    padding-left: 0;
    margin: 0;
    width: 100%;
}

.custom-popup-ol li {
    font-size: clamp(15px, 1.1vw + 10px, 24px); 
    margin-bottom: clamp(12px, 1.5vw + 4px, 24px);                                       
    display: flex;                      
    align-items: flex-start;
    gap: clamp(3px, 0.3vw + 1px, 6px);  
}

.custom-popup-ol li .num {
    flex-shrink: 0;
    width: clamp(14px, 1vw + 8px, 24px);                                               
    font-weight: 600;
}

.custom-popup-ol li .txt {
    flex: 1;
}

.custom-popup-ol li:last-child {
    margin-bottom: 0;                    
}


/* =========================================================================
   КНОПКА СКРОЛЛА НАВЕРХ В ВИДЕ ЖЕТОНА МЕТРО (ЗАЩИЩЕННЫЙ ВАРИАНТ)
   ========================================================================= */
.metro-scroll-top {
    position: fixed !important;
    bottom: 95px !important; 
    right: 30px !important;
    
    /* Жестко исключаем влияние на ширину страницы, пока кнопка скрыта */
    display: none !important; 
    
    width: 65px !important;  
    height: 65px !important;
    border: 7px solid #202c3c !important; 
    background-color: #3a4f66 !important;
    color: #202c3c !important; 
    border-radius: 50% !important;
    
    justify-content: center !important;
    align-items: center !important;
    z-index: 90 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    
    -webkit-tap-highlight-color: transparent; 
    outline: none;                            
    user-select: none;
    -webkit-user-select: none;
    
    opacity: 0 !important;
    visibility: hidden !important;
    
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
}

.metro-scroll-top svg {
    width: 32px !important; 
    height: 32px !important;
    transition: transform 0.25s ease;
}

/* Показываем её ИСКЛЮЧИТЕЛЬНО флексом и только при наличии класса */
.metro-scroll-top.is-visible {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* PJAX меняет только центральную часть страницы: шапка, фон и футер остаются на месте. */
.site-main-content {
    transition: opacity 0.16s ease;
}

html.is-pjax-loading .site-main-content {
    opacity: 0.42;
    pointer-events: none;
}

html.is-pjax-loading,
html.is-pjax-loading a {
    cursor: progress;
}

@media (prefers-reduced-motion: reduce) {
    .site-main-content {
        transition: none;
    }
}

/* Во время открытой модалки жетона кнопка относится к её центральному слайду,
   поэтому должна находиться выше затемняющего оверлея. */
.metro-scroll-top.is-token-modal-scroll {
    z-index: 905 !important;
}

@media (hover: hover) {
    .metro-scroll-top:hover {
        background-color: #202c3c !important;
        border-color: #151d27 !important;
        color: #3a4f66 !important; 
    }
    .metro-scroll-top:hover svg {
        transform: translateY(-2px);
    }
}

.metro-scroll-top:focus,
.metro-scroll-top:active {
    background-color: #3a4f66 !important;
    border-color: #202c3c !important;
    color: #202c3c !important;
}

/* Адаптив кнопки */
@media screen and (max-width: 768px) {
    /* Используем двойной класс, чтобы перебить базовый .is-visible */
    .metro-scroll-top.is-visible {
        bottom: 135px !important; 
        right: 5px !important;
        width: 54px !important;
        height: 54px !important;
        border-width: 5px !important; 
        transition: opacity 0.3s ease !important; 
    }
    .metro-scroll-top svg {
        width: 28px !important;
        height: 28px !important;
    }

}

@media screen and (max-width: 500px) {
    .metro-scroll-top.is-visible {
        bottom: 195px !important; 
        right: 5px !important;   
        width: 48px !important;   
        height: 48px !important;
        border-width: 4px !important;
    }
    .metro-scroll-top svg {
        width: 26px !important;
        height: 26px !important;
    }
}


/* Базовый сброс для тега плеера по всему сайту */
dotlottie-player {
    display: inline-block;
    vertical-align: middle;
}

/* Глобальное сглаживание векторов для всех Lottie на сайте */
.token-lottie-player svg {
    shape-rendering: geometricPrecision !important;
    text-rendering: geometricPrecision !important;
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: crisp-edges !important;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Блокируем прыжки макета при открытии попапов и скрытии скроллбара */
html {
    scrollbar-gutter: stable;
}

/* На тач-устройствах убираем системную синюю вспышку у всех интерактивных элементов.
   Стили :focus-visible не затрагиваются, поэтому клавиатурная навигация остаётся доступной. */
@media (hover: none) {
    a,
    button,
    input[type="button"],
    input[type="submit"],
    input[type="reset"],
    [role="button"] {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
    }
}

/* Финальное мобильное правило: находится после базовых стилей и расширяет
   поп-ап вместе с белой рамкой до безопасных границ экрана. */
@media screen and (max-width: 768px) {
    .custom-popup-overlay {
        padding-left: max(2px, env(safe-area-inset-left));
        padding-right: max(2px, env(safe-area-inset-right));
    }

    .custom-popup-window {
        width: 100%;
        max-width: none;
    }
}
