/*
Theme Name: VIDEOPIT • Retro VHS
Theme URI: https://videopit.ru
Author: Videopit
Author URI: https://videopit.ru
Description: Современный ретро VHS шаблон для видеодизайнера и монтажера
Version: 1.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
Text Domain: videopit
*/

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
    --neon-cyan: #00f0ff;
    --neon-pink: #ff00aa;
    --neon-yellow: #ffff00;
}

/* Глобальная защита от вылезания */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
    width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Основные VHS-эффекты */
.retro-font {
    font-family: 'Press Start 2P', system-ui;
}

.vhs-bg {
    position: relative;
}

.vhs-bg::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 4px,
        rgba(255,255,255,0.07) 4px,
        rgba(255,255,255,0.07) 8px
    );
    pointer-events: none;
    z-index: 50;
    animation: scanlines 0.25s linear infinite;
}

.vhs-bg::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,0,170,0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 50;
    animation: noise 0.8s steps(8) infinite;
    mix-blend-mode: overlay;
}

@keyframes scanlines {
    0% { background-position: 0 0; }
    100% { background-position: 0 8px; }
}

@keyframes noise {
    0% { opacity: 0.15; }
    50% { opacity: 0.25; }
    100% { opacity: 0.15; }
}

/* Glitch эффект */
.glitch {
    position: relative;
    color: var(--neon-cyan);
    text-shadow: 
        0.05em 0 0 rgba(255, 0, 170, 0.75),
        -0.05em -0.025em 0 rgba(0, 240, 255, 0.75),
        0.025em 0.05em 0 rgba(255, 255, 0, 0.75);
    animation: glitch-skew 4s infinite linear alternate;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.glitch::before {
    animation: glitch-anim 2s infinite linear alternate-reverse;
    color: var(--neon-pink);
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
    transform: translate(-0.025em, -0.0125em);
    opacity: 0.8;
}

.glitch::after {
    animation: glitch-anim2 3s infinite linear alternate-reverse;
    color: var(--neon-yellow);
    clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
    transform: translate(0.025em, 0.0125em);
    opacity: 0.8;
}

@keyframes glitch-anim {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@keyframes glitch-anim2 {
    0% { transform: translate(0); }
    20% { transform: translate(2px, -2px); }
    40% { transform: translate(-2px, 2px); }
    60% { transform: translate(2px, -2px); }
    80% { transform: translate(-2px, 2px); }
    100% { transform: translate(0); }
}

@keyframes glitch-skew {
    0% { transform: skew(0deg); }
    10% { transform: skew(5deg); }
    20% { transform: skew(-3deg); }
    100% { transform: skew(0deg); }
}

/* Карточки */
.service-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.service-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 0 30px -5px var(--neon-cyan);
}

.portfolio-card {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.portfolio-card:hover img {
    filter: brightness(1.15) contrast(1.1);
    transition: all 0.3s ease;
}

.tab-active {
    background-color: #ff00aa;
    color: white;
    box-shadow: 0 0 15px #ff00aa;
}

.vhs-frame {
    position: relative;
}

/* АДАПТИВНЫЕ СТИЛИ ДЛЯ ВСЕХ УСТРОЙСТВ */

/* Мобильные устройства (до 640px) */
@media (max-width: 640px) {
    /* Hero секция */
    .min-h-screen {
        min-height: auto;
        padding: 4rem 0;
    }
    
    /* Заголовки */
    h2 {
        font-size: 2rem !important;
        line-height: 1.3 !important;
    }
    
    .text-6xl {
        font-size: 2.5rem !important;
    }
    
    .text-5xl {
        font-size: 2rem !important;
    }
    
    .text-2xl {
        font-size: 1.25rem !important;
    }
    
    .text-lg {
        font-size: 1rem !important;
    }
    
    /* Отступы */
    .px-6 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .py-24 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    /* Кнопки */
    .flex-wrap {
        gap: 0.75rem !important;
    }
    
    .px-8 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .py-4 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    /* Сервисы - 2 колонки на мобильных */
    .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    .service-card {
        padding: 1rem !important;
    }
    
    .service-card i {
        font-size: 2rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .service-card h3 {
        font-size: 0.875rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .service-card p {
        font-size: 0.75rem !important;
    }
    
    /* Портфолио */
    #portfolioTabs {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem !important;
    }
    
    #portfolioTabs button {
        padding: 0.5rem 1rem !important;
        font-size: 0.7rem !important;
    }
    
    .portfolio-card img {
        height: 200px !important;
    }
    
    .portfolio-card h4 {
        font-size: 1rem !important;
    }
    
    /* About секция */
    .text-6xl {
        font-size: 2rem !important;
    }
    
    .gap-8 {
        gap: 1rem !important;
    }
    
    /* Контакты */
    .grid-cols-2 {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    form {
        padding: 1.5rem !important;
    }
    
    input, textarea {
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
    }
    
    button[type="button"] {
        padding: 0.75rem !important;
        font-size: 0.875rem !important;
    }
}

/* Планшеты (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
    /* Hero секция */
    .min-h-screen {
        min-height: auto;
        padding: 5rem 0;
    }
    
    /* Заголовки */
    .text-6xl {
        font-size: 3rem !important;
    }
    
    .text-5xl {
        font-size: 2.5rem !important;
    }
    
    .text-2xl {
        font-size: 1.5rem !important;
    }
    
    /* Сервисы - 3 колонки на планшетах */
    .grid-cols-2 {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }
    
    .service-card {
        padding: 1.5rem !important;
    }
    
    /* Портфолио - 2 колонки */
    .sm\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* About секция */
    .md\:col-span-5, .md\:col-span-7 {
        grid-column: span 12 !important;
    }
    
    .grid.md\:grid-cols-12 {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
}

/* Большие десктопы (1025px+) */
@media (min-width: 1025px) {
    .container {
        max-width: 1280px;
        margin: 0 auto;
    }
}

/* Улучшения для touch-устройств */
@media (hover: none) and (pointer: coarse) {
    .service-card:hover,
    .portfolio-card:hover {
        transform: none !important;
    }
    
    button, 
    a,
    .service-card,
    .portfolio-card {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    button:active,
    .service-card:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

/* Анимация VHS рамки */
.vhs-frame::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 8px solid #111;
    border-image: linear-gradient(to bottom, #00f0ff, #ff00aa) 1;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

/* Адаптив для маленьких экранов (до 360px) */
@media (max-width: 360px) {
    .text-6xl {
        font-size: 2rem !important;
    }
    
    .text-5xl {
        font-size: 1.5rem !important;
    }
    
    .gap-3 {
        gap: 0.5rem !important;
    }
    
    .px-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    /* Стили для модального окна видео */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.video-modal.active {
    opacity: 1;
    visibility: visible;
}

.video-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 240, 255, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    border: 2px solid #00f0ff;
}

.video-modal.active .video-modal-content {
    transform: scale(1);
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.close-video-modal {
    position: absolute;
    top: -40px;
    right: 0;
    background: #ff00aa;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    font-size: 20px;
}

.close-video-modal:hover {
    transform: rotate(90deg);
    background: #ffff00;
    color: black;
}

/* VHS-эффект для модального окна */
.video-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.7) 0px,
        rgba(0, 0, 0, 0.7) 2px,
        transparent 2px,
        transparent 4px
    );
    pointer-events: none;
    animation: scanlines 8s linear infinite;
}

/* Анимация для кнопки play */
@keyframes pulse-play {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 0, 170, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 0, 170, 0);
    }
}

.video-modal-trigger .rounded-full {
    animation: pulse-play 2s infinite;
}

.video-modal-trigger:hover .rounded-full {
    animation: none;
    transform: scale(1.1);
}

/* Для мобильных устройств */
@media (max-width: 768px) {
    .close-video-modal {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .video-modal-content {
        width: 95%;
        border-radius: 12px;
    }
}

/* Line clamp для ограничения текста */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* SERVICES SECTION - улучшенные стили */
.service-card {
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.service-card i {
    transition: transform 0.3s ease;
}

.service-card:hover i {
    transform: scale(1.1);
}

.service-card h3 {
    word-break: break-word;
    hyphens: auto;
    line-height: 1.3;
}

.service-card p {
    word-break: break-word;
    hyphens: auto;
}

/* Адаптация для очень маленьких экранов */
@media (max-width: 480px) {
    .service-card {
        padding: 1rem !important;
    }
    
    .service-card i {
        font-size: 2rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .service-card h3 {
        font-size: 0.875rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    .service-card p {
        font-size: 0.7rem !important;
        line-height: 1.3 !important;
    }
}

/* Для планшетов */
@media (min-width: 481px) and (max-width: 768px) {
    .service-card {
        padding: 1.25rem !important;
    }
    
    .service-card i {
        font-size: 2.5rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .service-card h3 {
        font-size: 1rem !important;
    }
    
    .service-card p {
        font-size: 0.75rem !important;
    }
}

/* Для десктопов */
@media (min-width: 1024px) {
    .service-card {
        min-height: 280px;
    }
}
/* Простое решение - балансировка только где нужно */
.balanced-text {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* На мобильных - балансируем */
@media (max-width: 1024px) {
    .balanced-text {
        text-wrap: balance;
        max-width: 90%;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Если на десктопе все же нужно переносить очень длинные слова */
@media (min-width: 1025px) {
    .service-card h3 {
        word-break: keep-all; /* Не разбиваем слова */
        overflow-wrap: break-word; /* Но если нужно - разбиваем */
        max-width: 100%;
    }
    
    /* Если текст не помещается в карточку */
    .service-card {
        min-width: 0;
    }
}
/* SERVICES SECTION - исправление для планшетов */
.services-section {
    overflow-x: hidden;
    width: 100%;
}

/* Сетка для разных устройств */
@media (max-width: 640px) {
    .grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
}

@media (min-width: 641px) and (max-width: 768px) {
    .grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    .service-card {
        padding: 1rem !important;
    }
    
    .service-card h3 {
        font-size: 0.9rem !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
        max-width: 100%;
        margin: 0 auto;
    }
    
    .service-card {
        padding: 1.25rem !important;
        width: 100%;
        min-width: 0;
    }
    
    .service-card h3 {
        font-size: 0.9rem !important;
        word-break: break-word;
        hyphens: auto;
    }
    
    .service-card p {
        font-size: 0.7rem !important;
    }
    
    .service-card i {
        font-size: 2.5rem !important;
        margin-bottom: 0.75rem !important;
    }
}

@media (min-width: 1025px) and (max-width: 1280px) {
    .grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1.25rem !important;
    }
    
    .service-card h3 {
        font-size: 0.9rem !important;
    }
}

@media (min-width: 1281px) {
    .grid {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 1.5rem !important;
    }
}

/* Общие стили для всех карточек */
.service-card {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.service-card h3 {
    display: block;
    width: 100%;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Защита от вылезания */
section {
    overflow-x: hidden;
    width: 100%;
}

.container, 
.max-w-screen-2xl {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container, 
    .max-w-screen-2xl {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container, 
    .max-w-screen-2xl {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}
/* Адаптивная шапка */
header {
    transition: all 0.3s ease;
}

/* Уменьшаем отступы на мобильных */
@media (max-width: 640px) {
    header .px-6 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    header .py-5 {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
}

/* Планшеты */
@media (min-width: 641px) and (max-width: 1024px) {
    header .px-6 {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    header .py-5 {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}

/* Анимация для мобильного меню */
#mobileMenu {
    transition: all 0.3s ease;
    max-height: 0;
    overflow: hidden;
}

#mobileMenu:not(.hidden) {
    max-height: 500px;
}

/* Улучшаем touch-область для мобильных кнопок */
@media (max-width: 768px) {
    header a,
    header button {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Увеличиваем область нажатия для бургер-меню */
    .md\\:hidden {
        padding: 0.5rem;
        margin: -0.5rem;
    }
}

/* Скрываем длинный текст на очень маленьких экранах */
@media (max-width: 480px) {
    .glitch {
        font-size: 1.25rem !important;
        letter-spacing: 1px !important;
    }
    
    .w-10.h-10 {
        width: 2rem;
        height: 2rem;
        font-size: 1.25rem;
    }
}

/* Для экранов от 481px до 640px */
@media (min-width: 481px) and (max-width: 640px) {
    .glitch {
        font-size: 1.5rem !important;
        letter-spacing: 2px !important;
    }
}

/* Оптимизация для маленьких экранов в ландшафте */
@media (max-width: 768px) and (orientation: landscape) {
    header .py-5 {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .glitch {
        font-size: 1.25rem !important;
    }
    
    .w-10.h-10 {
        width: 2rem;
        height: 2rem;
    }
}

/* Плавная прокрутка для мобильного меню */
html {
    scroll-behavior: smooth;
}

/* Улучшаем читаемость на мобильных */
.retro-font {
    font-size: clamp(1rem, 5vw, 2rem);
}
/* Скрываем кнопку заказа на мобильных до 768px */
@media (max-width: 767px) {
    /* Скрываем десктопную кнопку заказа */
    header .bg-gradient-to-r.from-\\[\\#ff00aa\\] {
        display: none !important;
    }
}

/* Показываем кнопку заказа на планшетах и выше (768px+) */
@media (min-width: 768px) {
    header .bg-gradient-to-r.from-\\[\\#ff00aa\\] {
        display: flex !important;
    }
}

/* Убеждаемся, что в мобильном меню кнопка всегда видна */
#mobileMenu .bg-gradient-to-r {
    display: flex !important;
}
}
