/* ============================================================
   RoboZone.pro — киберпанк-эффекты (раздел 7.4 ТЗ)
   1. Glitch на заголовках (hover)
   2. Скан-линии на фоне
   3. Неоновое свечение акцентов
   4. Печатающийся текст (typewriter)
   5. Буквица поста
   6. Плавное появление при скролле (IntersectionObserver)
   ============================================================ */

/* ---------- 2. Скан-линии ---------- */
.scanlines::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 2px,
        rgba(0, 255, 157, 0.015) 2px,
        rgba(0, 255, 157, 0.015) 4px
    );
}

/* ---------- 3. Неоновое свечение ---------- */
.logo-mark {
    text-shadow: 0 0 8px var(--accent), 0 0 24px rgba(0, 255, 157, 0.4);
}
.hero-label {
    text-shadow: 0 0 10px rgba(0, 255, 157, 0.5);
}
.post-card,
.archive-list,
.archive-list-full,
.empty-state,
.pag-link {
    box-shadow: 0 0 0 rgba(0, 255, 157, 0);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.post-card:hover {
    border-color: rgba(0, 255, 157, 0.5);
    box-shadow: 0 0 24px rgba(0, 255, 157, 0.12);
}
.meta-comment {
    text-shadow: 0 0 12px rgba(255, 0, 110, 0.35);
}
.post-title-line {
    box-shadow: 0 0 12px rgba(0, 255, 157, 0.5);
}

/* ---------- 1. Glitch-эффект заголовков ---------- */
.glitch {
    position: relative;
}
.glitch:hover {
    animation: glitch-shift 0.4s steps(2, end) infinite;
    text-shadow:
        2px 0 var(--accent2),
        -2px 0 var(--accent);
}
.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}
.glitch:hover::before {
    opacity: 0.8;
    color: var(--accent2);
    animation: glitch-slice-a 0.6s steps(2, end) infinite;
    clip-path: inset(0 0 55% 0);
    transform: translate(-2px, -1px);
}
.glitch:hover::after {
    opacity: 0.8;
    color: var(--accent);
    animation: glitch-slice-b 0.7s steps(2, end) infinite;
    clip-path: inset(55% 0 0 0);
    transform: translate(2px, 1px);
}

@keyframes glitch-shift {
    0% { transform: translate(0); }
    25% { transform: translate(1px, -1px); }
    50% { transform: translate(-1px, 1px); }
    75% { transform: translate(1px, 0); }
    100% { transform: translate(0); }
}
@keyframes glitch-slice-a {
    0% { clip-path: inset(0 0 55% 0); }
    25% { clip-path: inset(10% 0 60% 0); transform: translate(-3px, 0); }
    50% { clip-path: inset(30% 0 40% 0); transform: translate(3px, 0); }
    75% { clip-path: inset(5% 0 75% 0); transform: translate(-2px, 1px); }
    100% { clip-path: inset(0 0 55% 0); }
}
@keyframes glitch-slice-b {
    0% { clip-path: inset(55% 0 0 0); }
    25% { clip-path: inset(70% 0 5% 0); transform: translate(3px, 0); }
    50% { clip-path: inset(40% 0 30% 0); transform: translate(-3px, 0); }
    75% { clip-path: inset(80% 0 5% 0); transform: translate(2px, -1px); }
    100% { clip-path: inset(55% 0 0 0); }
}

/* ---------- 4. Печатающийся текст ---------- */
.typewriter {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 1px solid var(--accent);
    animation:
        typewriter-steps 3.2s steps(38, end) 0.5s both,
        typewriter-caret 0.9s step-end infinite;
}
@keyframes typewriter-steps {
    from { max-width: 0; }
    to { max-width: 100%; }
}
@keyframes typewriter-caret {
    0%, 100% { border-color: var(--accent); }
    50% { border-color: transparent; }
}

/* ---------- 5. Буквица ---------- */
.post-content > p:first-of-type::first-letter {
    float: left;
    font-family: var(--font-head);
    font-size: 3.4em;
    line-height: 0.85;
    padding: 6px 10px 0 0;
    color: var(--accent);
    text-shadow: 0 0 14px rgba(0, 255, 157, 0.6);
}

/* ---------- 6. Появление при скролле ---------- */
/* Скрытие включается ТОЛЬКО когда JS добавил класс js-anim на <html>.
   Без JS (или если скрипт не успел/не сработал на мобильном) контент
   виден сразу — никаких «пустых страниц до первого свайпа». */
.js-anim .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.js-anim .reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Дополнительно: свечение курсора-акцентов ---------- */
a:hover { text-shadow: 0 0 6px rgba(0, 255, 157, 0.4); }

::selection {
    background: rgba(0, 255, 157, 0.25);
    color: #ffffff;
}

/* Скроллбар в стиле темы */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
