* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #020204; color: white; font-family: system-ui, sans-serif; overflow-x: hidden; }

/* Фон */
#particleCanvas { position: fixed; inset: 0; z-index: -2; }
.grain-overlay { position: fixed; inset: 0; z-index: 10; opacity: 0.03; pointer-events: none; background-image: url("https://upload.wikimedia.org/wikipedia/commons/7/76/1k_ext_noise_transparent.png"); }

/* Основной контейнер */
.container { padding: 40px 20px; max-width: 1100px; margin: 0 auto; }

/* Кнопка "Назад" */
.button-box { text-align: center; margin-bottom: 60px; }
.button__back {
  display: inline-block; text-decoration: none; color: white; background: rgba(255, 60, 60, 0.1);
  padding: 12px 35px; border-radius: 50px; border: 1px solid rgba(255, 60, 60, 0.3);
  transition: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); font-weight: 600;
}
.button__back:hover { background: #ff3c3c; box-shadow: 0 0 20px rgba(255, 60, 60, 0.4); transform: translateY(-3px); }

/* Карточки проекта */
.project-card { 
    display: flex; 
    align-items: center; 
    gap: 40px; 
    margin-bottom: 120px; 
    transition: 1s cubic-bezier(0.16, 1, 0.3, 1); 
}
.reversed { flex-direction: row-reverse; }

.video-container { 
    flex: 1.2; 
    border-radius: 20px; 
    overflow: hidden; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); 
    position: relative; 
}
video { width: 100%; display: block; border-radius: 20px; }

/* Текстовый контент */
.text-content {
  flex: 1; position: relative; background: rgba(15, 15, 20, 0.5);
  backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
  padding: 40px; border-radius: 35px; border: 1px solid rgba(255,255,255,0.06); overflow: hidden;
}

/* Бегущая строка */
.card-ribbon {
    position: absolute; top: 30%; left: -10%; width: 130%; height: 35px;
    background: rgba(255, 60, 60, 0.03); transform: rotate(-10deg) translateY(-50%); 
    z-index: 0; pointer-events: none; overflow: hidden; display: flex; align-items: center;
}
.reversed .card-ribbon { transform: rotate(8deg) translateY(-50%); top: 40%; }
.ribbon-track { display: flex; white-space: nowrap; animation: scrollText 15s linear infinite; }
.ribbon-track span { color: rgba(255, 60, 60, 0.15); font-weight: 900; font-size: 13px; padding-right: 50px; text-transform: uppercase; letter-spacing: 3px; }

@keyframes scrollText { 
    from { transform: translateX(0); } 
    to { transform: translateX(-50%); } 
}

.content-inner { position: relative; z-index: 2; }
h2 { font-size: 2.2rem; margin-bottom: 15px; background: linear-gradient(to bottom, #fff, #ffb3b3); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* Печать и описание */
.description-wrapper { max-height: 0; opacity: 0; transition: 0.6s ease; }
.description-wrapper.expanded { max-height: 800px; opacity: 1; margin-top: 15px; }
.typewriter-text { font-size: 1.05rem; line-height: 1.6; color: rgba(255,255,255,0.7); }
.typing::after { content: '|'; animation: blink 0.7s infinite; color: #ff3c3c; margin-left: 4px; }
@keyframes blink { 50% { opacity: 0; } }

/* Кнопка "Читать" */
.toggle-btn {
  margin-top: 20px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: white; padding: 12px 25px; border-radius: 15px; cursor: pointer; transition: 0.3s;
  display: flex; align-items: center; gap: 10px; font-size: 1rem;
}
.toggle-btn.active { background: #ff3c3c; transform: scale(0.96); box-shadow: 0 0 20px rgba(255, 60, 60, 0.4); }

/* Анимации при скролле */
.reveal-left { opacity: 0; transform: translateX(-50px); filter: blur(10px); }
.reveal-right { opacity: 0; transform: translateX(50px); filter: blur(10px); }
.active { opacity: 1; transform: translateX(0); filter: blur(0); }

/* ==========================================================
   АДАПТИВ ДЛЯ ТЕЛЕФОНОВ И ПЛАНШЕТОВ
   ========================================================== */

@media (max-width: 768px) {
    .container { padding: 20px 15px; }
    
    .button-box { margin-bottom: 40px; }
    .button__back { padding: 10px 25px; font-size: 1rem; }

    .project-card { 
        flex-direction: column !important; /* Всегда видео сверху, текст снизу */
        gap: 20px; 
        margin-bottom: 70px; /* Уменьшили отступ между проектами */
    }

    .video-container { 
        width: 100%; 
        border-radius: 15px; 
    }

    .text-content {
        width: 100%;
        padding: 25px 20px; /* Уменьшили внутренние отступы */
        border-radius: 25px;
    }

    h2 { 
        font-size: 1.5rem; /* Уменьшили заголовки */
        margin-bottom: 10px;
        text-align: center;
    }

    .typewriter-text { 
        font-size: 0.95rem; /* Текст описания чуть меньше */
        line-height: 1.5;
    }

    .card-ribbon { 
        height: 25px; 
        top: 20%;
    }
    
    .ribbon-track span { 
        font-size: 10px; 
        padding-right: 30px; 
    }

    .toggle-btn {
        width: 100%; /* Кнопка на всю ширину для удобства клика */
        justify-content: center;
        padding: 10px;
        font-size: 0.9rem;
    }

    .description-wrapper.expanded {
        margin-top: 10px;
    }
}

/* Совсем маленькие экраны (iPhone SE и т.д.) */
@media (max-width: 400px) {
    h2 { font-size: 1.3rem; }
    .text-content { padding: 20px 15px; }
}
