@property --giro {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

:root {
    --fondo: #04050a;
    --testo: #eef3f9;
    --spento: #8a93a6;
    --accento: #1de4ff;
    --accento-luce: rgba(29, 228, 255, 0.35);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background: var(--fondo);
}

body {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color: var(--testo);
    overflow-x: hidden;
}

.sfondo {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.pavimento {
    position: absolute;
    left: -50%;
    bottom: 0;
    width: 200%;
    height: 55vh;
    background-image:
        linear-gradient(rgba(29, 228, 255, 0.35) 1px, transparent 1px),
        linear-gradient(90deg, rgba(29, 228, 255, 0.35) 1px, transparent 1px);
    background-size: 70px 70px;
    transform: perspective(320px) rotateX(72deg);
    transform-origin: center bottom;
    -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 75%);
    mask-image: linear-gradient(to top, #000 0%, transparent 75%);
    opacity: 0.8;
    animation: avanza 1.6s linear infinite;
}

.sfondo::after {
    content: "";
    position: absolute;
    left: 0;
    top: -20%;
    width: 100%;
    height: 14%;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(29, 228, 255, 0.05) 90%,
        rgba(29, 228, 255, 0.45) 99%,
        transparent 100%
    );
    animation: scansiona 7s linear infinite;
}

body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.025) 0px,
        rgba(255, 255, 255, 0.025) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 5;
}

.alone {
    position: absolute;
    border-radius: 50%;
}

.alone1 {
    top: -20%;
    left: -10%;
    width: 55vmax;
    height: 55vmax;
    background: radial-gradient(circle, rgba(29, 228, 255, 0.20), transparent 65%);
    animation: deriva 18s ease-in-out infinite alternate;
}

.alone2 {
    right: -15%;
    bottom: -25%;
    width: 60vmax;
    height: 60vmax;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.09), transparent 65%);
    animation: deriva 24s ease-in-out infinite alternate-reverse;
}

.anello {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.anello::after {
    content: "";
    position: absolute;
    top: -4px;
    left: 50%;
    width: 8px;
    height: 8px;
    margin-left: -4px;
    border-radius: 50%;
    background: var(--accento);
    box-shadow: 0 0 14px 3px var(--accento-luce);
}

.anello1 {
    top: -30vmax;
    right: -22vmax;
    width: 70vmax;
    height: 70vmax;
    animation: ruota2d 70s linear infinite;
}

.anello2 {
    bottom: -26vmax;
    left: -20vmax;
    width: 52vmax;
    height: 52vmax;
    animation: ruota2d 50s linear infinite reverse;
}

.sfondo i {
    position: absolute;
    bottom: -12px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--accento);
    box-shadow: 0 0 8px 2px var(--accento-luce);
    opacity: 0;
    animation: sale 14s linear infinite;
}

.sfondo i:nth-of-type(1) {
    left: 6%;
    animation-duration: 12s;
    animation-delay: -2s;
}

.sfondo i:nth-of-type(2) {
    left: 16%;
    animation-duration: 17s;
    animation-delay: -9s;
}

.sfondo i:nth-of-type(3) {
    left: 27%;
    animation-duration: 13s;
    animation-delay: -5s;
}

.sfondo i:nth-of-type(4) {
    left: 38%;
    animation-duration: 19s;
    animation-delay: -12s;
}

.sfondo i:nth-of-type(5) {
    left: 49%;
    animation-duration: 15s;
    animation-delay: -1s;
}

.sfondo i:nth-of-type(6) {
    left: 58%;
    animation-duration: 11s;
    animation-delay: -7s;
}

.sfondo i:nth-of-type(7) {
    left: 69%;
    animation-duration: 18s;
    animation-delay: -14s;
}

.sfondo i:nth-of-type(8) {
    left: 78%;
    animation-duration: 14s;
    animation-delay: -4s;
}

.sfondo i:nth-of-type(9) {
    left: 88%;
    animation-duration: 16s;
    animation-delay: -10s;
}

.sfondo i:nth-of-type(10) {
    left: 95%;
    animation-duration: 12s;
    animation-delay: -6s;
}

header,
main,
footer {
    position: relative;
    z-index: 1;
}

header::after {
    content: "";
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 0;
    height: 1px;
    background:
        linear-gradient(90deg, transparent, var(--accento), transparent) 0 0 / 25% 100% no-repeat,
        linear-gradient(90deg, rgba(29, 228, 255, 0.05), rgba(29, 228, 255, 0.35), rgba(29, 228, 255, 0.05));
    animation: corre 4s linear infinite;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
    padding: 26px 24px 18px 24px;
}

.sigla {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    letter-spacing: 0.35em;
    color: var(--spento);
}

.sigla::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accento);
    box-shadow: 0 0 10px 2px var(--accento-luce);
    animation: pulsa 1.8s ease-in-out infinite;
}

header h1 {
    position: relative;
    font-size: 46px;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1.1;
    background: linear-gradient(90deg, #ffffff, var(--accento), #ffffff, var(--accento));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: scorri 7s linear infinite;
}

header h1::before,
header h1::after {
    content: attr(data-testo);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: none;
    -webkit-text-fill-color: currentColor;
    clip-path: inset(0 0 100% 0);
}

header h1::before {
    color: var(--accento);
    animation: glitch1 4s steps(1) infinite;
}

header h1::after {
    color: #ffffff;
    animation: glitch2 4s steps(1) infinite;
}

.nome {
    display: inline-block;
    margin-top: 8px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 16px;
    letter-spacing: 0.3em;
    color: var(--spento);
    white-space: nowrap;
    animation: scrivi 1.6s steps(15) 0.4s backwards;
}

.nome::after {
    content: "_";
    color: var(--accento);
    animation: lampeggia 0.9s steps(1) infinite;
}

.scena {
    flex-shrink: 0;
    position: relative;
    width: 110px;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 500px;
}

.orbita {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.25);
    animation: ruota2d 9s linear infinite;
}

.orbita::after {
    content: "";
    position: absolute;
    top: -4px;
    left: 50%;
    width: 8px;
    height: 8px;
    margin-left: -4px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 12px 3px rgba(255, 255, 255, 0.6);
}

.cubo {
    position: relative;
    width: 54px;
    height: 54px;
    transform-style: preserve-3d;
    animation: ruota3d 12s linear infinite;
}

.cubo span {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 1.5px solid var(--accento);
    background: rgba(29, 228, 255, 0.06);
    box-shadow: inset 0 0 14px rgba(29, 228, 255, 0.35);
}

.cubo span:nth-child(1) {
    transform: translateZ(27px);
}

.cubo span:nth-child(2) {
    transform: rotateY(180deg) translateZ(27px);
}

.cubo span:nth-child(3) {
    transform: rotateY(90deg) translateZ(27px);
}

.cubo span:nth-child(4) {
    transform: rotateY(-90deg) translateZ(27px);
}

.cubo span:nth-child(5) {
    transform: rotateX(90deg) translateZ(27px);
}

.cubo span:nth-child(6) {
    transform: rotateX(-90deg) translateZ(27px);
}

main {
    flex: 1;
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
    padding: 18px 24px;
    flex-direction: column;
    justify-content: center;
}

#home {
    display: flex;
}

main {
    animation: accendi 0.8s ease backwards;
}

#lista,
#listatest {
    display: none;
}

#tabelline:target ~ #lista,
#test:target ~ #listatest {
    display: flex;
}

#tabelline:target ~ #home,
#test:target ~ #home {
    display: none;
}

.titolo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    animation: entra 0.6s ease backwards;
}

.titolo h2 {
    font-size: 28px;
    letter-spacing: 0.15em;
    margin-bottom: 4px;
}

.titolo p {
    color: var(--spento);
}

.griglia {
    display: grid;
    gap: 18px;
    width: 100%;
}

#home .griglia {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

#home .carta {
    grid-column: span 2;
}

#lista .griglia {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

#listatest .griglia {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.carta {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 24px 22px 22px 22px;
    border-radius: 4px;
    clip-path: polygon(
        18px 0,
        100% 0,
        100% calc(100% - 18px),
        calc(100% - 18px) 100%,
        0 100%,
        0 18px
    );
    background-image:
        linear-gradient(135deg, transparent 12px, var(--accento) 12px, var(--accento) 14px, transparent 14px),
        linear-gradient(315deg, transparent 12px, var(--accento) 12px, var(--accento) 14px, transparent 14px),
        linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(29, 228, 255, 0.02) 60%, rgba(255, 255, 255, 0.015));
    background-position: top left, bottom right, center;
    background-size: 26px 26px, 26px 26px, 100% 100%;
    background-repeat: no-repeat;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: entra 0.7s ease backwards, galleggia 5s ease-in-out infinite alternate;
    animation-delay: calc(var(--n) * 0.09s), calc(var(--n) * -1.1s);
}

.carta:nth-child(1) {
    --n: 1;
}

.carta:nth-child(2) {
    --n: 2;
}

.carta:nth-child(3) {
    --n: 3;
}

.carta:nth-child(4) {
    --n: 4;
}

.carta:nth-child(5) {
    --n: 5;
}

.carta:nth-child(6) {
    --n: 6;
}

.carta:nth-child(7) {
    --n: 7;
}

.carta:nth-child(8) {
    --n: 8;
}

.carta::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1.5px;
    border-radius: inherit;
    background: conic-gradient(from var(--giro), transparent 0%, transparent 62%, var(--accento) 82%, transparent 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    animation: giro 5s linear infinite;
    animation-delay: calc(var(--n) * -0.7s);
    pointer-events: none;
}

.carta::after {
    content: "";
    position: absolute;
    top: 0;
    left: -70%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.13), transparent);
    transform: skewX(-20deg);
    animation: lampo 6s ease-in-out infinite;
    animation-delay: calc(var(--n) * 0.6s);
    pointer-events: none;
}

.carta:hover {
    transform: perspective(800px) rotateX(5deg) rotateY(-6deg) scale(1.04);
    box-shadow: inset 0 0 40px rgba(29, 228, 255, 0.22), inset 0 0 0 1px rgba(29, 228, 255, 0.5);
}

.numero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-family: Consolas, "Courier New", monospace;
    margin-bottom: 14px;
    font-size: 13px;
    letter-spacing: 0.3em;
    color: var(--accento);
}

.numero::after {
    content: "";
    flex: 1;
    height: 2px;
    background:
        linear-gradient(90deg, transparent, var(--accento), transparent) 0 0 / 40% 100% no-repeat,
        rgba(255, 255, 255, 0.1);
    animation: corre 2.2s linear infinite;
    animation-delay: calc(var(--n) * -0.4s);
}

.carta h2 {
    margin-bottom: 10px;
    font-size: 21px;
    letter-spacing: 0.06em;
}

.carta p {
    flex-grow: 1;
    margin-bottom: 18px;
    font-size: 15px;
    line-height: 1.45;
    color: var(--spento);
}

.bottone {
    align-self: flex-start;
    display: inline-block;
    padding: 10px 18px;
    border: 1.5px solid var(--accento);
    border-radius: 999px;
    color: var(--accento);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.15em;
    transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.carta .bottone::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.carta:hover .bottone,
.titolo .bottone:hover {
    background: var(--accento);
    color: #04050a;
    box-shadow: 0 0 22px var(--accento-luce);
}

.bottone:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 3px;
}

.online::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 10px;
    border-radius: 50%;
    background: var(--accento);
    box-shadow: 0 0 10px 2px var(--accento-luce);
    animation: lampeggia 1.2s steps(1) infinite;
}

footer {
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
    padding: 12px 24px 20px 24px;
    display: flex;
    justify-content: center;
    font-size: 13px;
    letter-spacing: 0.3em;
    color: var(--spento);
}

@keyframes avanza {
    to {
        background-position: 0 70px, 0 0;
    }
}

@keyframes scansiona {
    to {
        top: 110%;
    }
}

@keyframes corre {
    from {
        background-position: -60% 0, 0 0;
    }
    to {
        background-position: 160% 0, 0 0;
    }
}

@keyframes scrivi {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

@keyframes lampeggia {
    50% {
        opacity: 0;
    }
}

@keyframes accendi {
    0% {
        opacity: 0;
        clip-path: inset(50% 0 50% 0);
    }
    40% {
        opacity: 1;
        clip-path: inset(49% 0 49% 0);
    }
    100% {
        clip-path: inset(0 0 0 0);
    }
}

@keyframes glitch1 {
    0% {
        clip-path: inset(0 0 100% 0);
        transform: translate(0, 0);
    }
    86% {
        clip-path: inset(10% 0 60% 0);
        transform: translate(-4px, 0);
    }
    89% {
        clip-path: inset(55% 0 20% 0);
        transform: translate(4px, 0);
    }
    92% {
        clip-path: inset(0 0 100% 0);
        transform: translate(0, 0);
    }
}

@keyframes glitch2 {
    0% {
        clip-path: inset(0 0 100% 0);
        transform: translate(0, 0);
    }
    87% {
        clip-path: inset(65% 0 5% 0);
        transform: translate(3px, 0);
    }
    90% {
        clip-path: inset(25% 0 50% 0);
        transform: translate(-3px, 0);
    }
    93% {
        clip-path: inset(0 0 100% 0);
        transform: translate(0, 0);
    }
}

@keyframes entra {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.92);
    }
}

@keyframes galleggia {
    from {
        translate: 0 -6px;
    }
    to {
        translate: 0 6px;
    }
}

@keyframes giro {
    to {
        --giro: 360deg;
    }
}

@keyframes lampo {
    0% {
        left: -70%;
    }
    35%, 100% {
        left: 150%;
    }
}

@keyframes ruota2d {
    to {
        transform: rotate(360deg);
    }
}

@keyframes ruota3d {
    from {
        transform: rotateX(-25deg) rotateY(0deg);
    }
    to {
        transform: rotateX(335deg) rotateY(360deg);
    }
}

@keyframes deriva {
    from {
        translate: 0 0;
    }
    to {
        translate: 8vw 6vh;
    }
}

@keyframes sale {
    0% {
        opacity: 0;
        transform: translateY(0);
    }
    10% {
        opacity: 0.9;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translateY(-105vh);
    }
}

@keyframes scorri {
    to {
        background-position: -300% 0;
    }
}

@keyframes pulsa {
    50% {
        opacity: 0.3;
        scale: 0.7;
    }
}

@media (max-height: 800px) {

    header {
        padding-top: 14px;
    }

    .sigla {
        display: none;
    }

    header h1 {
        font-size: 36px;
    }

    .nome {
        margin-top: 4px;
    }

    .scena {
        width: 84px;
        height: 84px;
    }

    .cubo {
        width: 40px;
        height: 40px;
    }

    .cubo span:nth-child(1) {
        transform: translateZ(20px);
    }

    .cubo span:nth-child(2) {
        transform: rotateY(180deg) translateZ(20px);
    }

    .cubo span:nth-child(3) {
        transform: rotateY(90deg) translateZ(20px);
    }

    .cubo span:nth-child(4) {
        transform: rotateY(-90deg) translateZ(20px);
    }

    .cubo span:nth-child(5) {
        transform: rotateX(90deg) translateZ(20px);
    }

    .cubo span:nth-child(6) {
        transform: rotateX(-90deg) translateZ(20px);
    }

    main {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .carta {
        padding: 16px 18px 16px 18px;
    }

    .numero {
        margin-bottom: 8px;
    }

    .carta p {
        margin-bottom: 12px;
        font-size: 14px;
    }

    .titolo {
        margin-bottom: 12px;
    }

    .titolo h2 {
        font-size: 22px;
    }

    footer {
        padding-top: 6px;
        padding-bottom: 10px;
    }

}

@media (max-width: 1000px) {

    #home .griglia {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #home .carta {
        grid-column: auto;
    }

    #lista .griglia,
    #listatest .griglia {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 600px) {

    header {
        padding-left: 16px;
        padding-right: 16px;
    }

    header h1 {
        font-size: 28px;
    }

    .nome {
        letter-spacing: 0.25em;
        font-size: 14px;
    }

    .scena {
        display: none;
    }

    main {
        padding-left: 16px;
        padding-right: 16px;
    }

    #home .griglia,
    #lista .griglia,
    #listatest .griglia {
        grid-template-columns: 1fr;
    }

    .titolo {
        flex-direction: column;
        align-items: flex-start;
    }

    footer {
        padding-left: 16px;
        padding-right: 16px;
        letter-spacing: 0.2em;
    }

}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

}
