﻿/* CSS specifico per la homepage di SaintChannel */

/* Fix overflow orizzontale - IMPORTANTE */
html,
body {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

/* Assicura che tutti i container rispettino i limiti */
.container,
.container-fluid,
.row {
    max-width: 100% !important;
}

/* Hero section */
#hero {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
}

/* Header image con effetti */
#header-image {
    width: 100%;
    height: auto;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    display: block;
}

/* =====================================================
   GLITCH WRAPPER — effetto glitch CSS al primo hover
   ===================================================== */
.glitch-wrapper {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    border-radius: 20px;
    cursor: pointer;
}

/* Pseudo-elementi che duplicano l'immagine con filtri cromatici */
.glitch-wrapper::before,
.glitch-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--glitch-img, none);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    pointer-events: none;
}

/* — ANIMAZIONE IMMAGINE PRINCIPALE — */
.glitch-wrapper.glitch-active #header-image {
    animation: glitch-main 0.75s steps(1) forwards;
}

/* — SLICE CANALE CIANO (::before) — */
.glitch-wrapper.glitch-active::before {
    animation: glitch-slice-1 0.75s steps(1) forwards;
}

/* — SLICE CANALE VIOLA (::after) — */
.glitch-wrapper.glitch-active::after {
    animation: glitch-slice-2 0.75s steps(1) forwards;
}

@keyframes glitch-main {
    0%   { transform: none; filter: none; }
    7%   { transform: translateX(-5px) skewX(-2deg); filter: brightness(1.3) contrast(1.2); }
    10%  { transform: translateX(5px) skewX(1deg);  filter: none; }
    13%  { transform: none; filter: brightness(0.7); }
    15%  { transform: none; filter: none; }
    42%  { transform: translateX(-3px); filter: saturate(4) hue-rotate(25deg); }
    45%  { transform: translateX(3px);  filter: none; }
    47%  { transform: none; }
    68%  { transform: translateX(-2px) skewX(-1deg); filter: brightness(1.15); }
    71%  { transform: none; filter: none; }
    100% { transform: none; filter: none; }
}

@keyframes glitch-slice-1 {
    0%   { opacity: 0; }
    8%   {
        opacity: 1;
        transform: translateX(-7px);
        clip-path: polygon(0 18%, 100% 18%, 100% 34%, 0 34%);
        filter: hue-rotate(220deg) saturate(4) brightness(1.6);
    }
    14%  { opacity: 0; }
    40%  {
        opacity: 1;
        transform: translateX(6px);
        clip-path: polygon(0 55%, 100% 55%, 100% 70%, 0 70%);
        filter: hue-rotate(160deg) saturate(3) brightness(1.3);
    }
    47%  { opacity: 0; }
    100% { opacity: 0; }
}

@keyframes glitch-slice-2 {
    0%   { opacity: 0; }
    14%  {
        opacity: 1;
        transform: translateX(7px);
        clip-path: polygon(0 40%, 100% 40%, 100% 56%, 0 56%);
        filter: hue-rotate(290deg) saturate(4) brightness(1.4);
    }
    21%  { opacity: 0; }
    52%  {
        opacity: 1;
        transform: translateX(-5px);
        clip-path: polygon(0 8%, 100% 8%, 100% 20%, 0 20%);
        filter: hue-rotate(50deg) saturate(3) brightness(1.2);
    }
    62%  { opacity: 0; }
    100% { opacity: 0; }
}

/* Grid snake effect */
#grid-snake {
    width: 100px;
    height: 100px;
    background: var(--saintchannel-gradient);
    border-radius: 50%;
    opacity: 0.7;
    animation: gridSnake 4s ease-in-out infinite;
}

@keyframes gridSnake {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 1;
    }
}

/* Laser effect */
#laser-div {
    position: relative;
    height: 4px;
    background: var(--saintchannel-gradient);
    border-radius: 2px;
    margin: 20px 0;
    overflow: hidden;
}

#laser-lamp {
    position: absolute;
    top: -2px;
    left: -20px;
    width: 20px;
    height: 8px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 20px var(--saintchannel-accent);
    animation: laserMove 3s linear infinite;
}

@keyframes laserMove {
    0% {
        left: -20px;
    }
    100% {
        left: calc(100% + 20px);
    }
}

/* Sezione spazio */
#space-to-header {
    min-height: 100px;
    background: linear-gradient(180deg, transparent 0%, rgba(102, 126, 234, 0.05) 100%);
}

/* Responsive per logo hero */
#logo-hero-full-block-sm {
    display: none;
}

@media (max-width: 768px) {
    #logo-hero-full-block-sm {
        display: flex !important;
        margin: 2rem 0;
    }
    
    .logo-hero-full {
        max-width: 280px;
    }
    
    #hero {
        min-height: auto;
        padding: 3rem 0;
    }
    
    #grid-snake {
        width: 60px;
        height: 60px;
    }
}
