:root { color-scheme: dark; }

::selection { background: #0ea5e9; color: #fff; }

/* ------------------------------------------------------------------
   Grana di stampa: velo di rumore su tutta la pagina.
   Il nero smette di sembrare "sfondo" e diventa nero stampato.
   ------------------------------------------------------------------ */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 60;
    pointer-events: none;
    opacity: 0.045;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------------
   Crocini di taglio agli angoli delle sezioni
   ------------------------------------------------------------------ */
.print-marks::before {
    content: "";
    position: absolute;
    inset: 1.25rem;
    z-index: 1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)),
        linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)),
        linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)),
        linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)),
        linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)),
        linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)),
        linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)),
        linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16));
    background-size:
        20px 1px, 1px 20px,
        20px 1px, 1px 20px,
        20px 1px, 1px 20px,
        20px 1px, 1px 20px;
    background-position:
        left top, left top,
        right top, right top,
        left bottom, left bottom,
        right bottom, right bottom;
    background-repeat: no-repeat;
}

/* Su schermi stretti i crocini rubano spazio ai contenuti */
@media (max-width: 640px) {
    .print-marks::before { display: none; }
}

/* ------------------------------------------------------------------
   Crocino di registro in quadricromia
   ------------------------------------------------------------------ */
.reg-mark {
    --reg-bg: #0a0a0a;
    width: 30px;
    height: 30px;
    border-radius: 9999px;
    pointer-events: none;
    opacity: 0.8;
    background: conic-gradient(#22d3ee 0 25%, #e879f9 25% 50%, #facc15 50% 75%, #71717a 75% 100%);
}

/* Disco interno: lascia in vista solo l'anello CMYK */
.reg-mark::before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 9999px;
    background: var(--reg-bg);
}

/* Croce passante */
.reg-mark::after {
    content: "";
    position: absolute;
    inset: -9px;
    background:
        linear-gradient(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.45)) center / 1px 100% no-repeat,
        linear-gradient(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.45)) center / 100% 1px no-repeat;
}

/* ------------------------------------------------------------------
   Spotlight: dove passa il cursore, arriva il colore
   ------------------------------------------------------------------ */
.hero-spot {
    --spot-x: 50%;
    --spot-y: 40%;
    opacity: 0;
    transition: opacity 700ms ease;
    background: radial-gradient(420px circle at var(--spot-x) var(--spot-y),
        rgba(56, 189, 248, 0.18),
        rgba(244, 63, 94, 0.10) 42%,
        transparent 70%);
}

.hero-spot.is-on { opacity: 1; }

/* Senza mouse (touch) lo spotlight non ha senso */
@media (hover: none), (pointer: coarse) {
    .hero-spot { display: none; }
}

/* Blob decorativi animati */
@keyframes blob-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -50px) scale(1.1); }
    66% { transform: translate(-30px, 30px) scale(0.92); }
}

.animate-blob {
    animation: blob-float 16s ease-in-out infinite;
}

.animation-delay-3000 { animation-delay: 3s; }
.animation-delay-6000 { animation-delay: 6s; }

/* Gradiente animato per il testo in evidenza */
@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradient-shift 6s ease infinite;
}

/* ------------------------------------------------------------------
   Comparatore B&N → Colore
   --split = quanta parte del documento resta in bianco e nero (da sinistra)
   ------------------------------------------------------------------ */
.b4c-compare {
    --split: 100%;
    touch-action: pan-y;
}

/* Velo che desatura il documento sottostante */
.b4c-veil {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--split);
    z-index: 10;
    /* Safari non compone il velo se e' del tutto trasparente */
    background: rgba(255, 255, 255, 0.001);
    -webkit-backdrop-filter: grayscale(1) contrast(1.08) brightness(0.97);
    backdrop-filter: grayscale(1) contrast(1.08) brightness(0.97);
}

/* Browser senza backdrop-filter: mostra il documento a colori senza cursore fantasma */
@supports not ((backdrop-filter: grayscale(1)) or (-webkit-backdrop-filter: grayscale(1))) {
    .b4c-line,
    .b4c-knob,
    .b4c-hint { display: none; }

    .b4c-compare { cursor: default; }
}

/* Linea luminosa di separazione */
.b4c-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--split);
    width: 2px;
    margin-left: -1px;
    z-index: 20;
    background: linear-gradient(180deg, rgba(56,189,248,0) 0%, #38bdf8 18%, #fff 50%, #fb7185 82%, rgba(251,113,133,0) 100%);
    box-shadow: 0 0 18px 3px rgba(56, 189, 248, 0.45);
}

.b4c-knob {
    position: absolute;
    top: 50%;
    left: var(--split);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin: -1.125rem 0 0 -1.125rem;
    border-radius: 9999px;
    background: #fff;
    color: #0a0a0a;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

@media (prefers-reduced-motion: reduce) {
    .animate-blob,
    .animate-gradient { animation: none; }
}
