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

/* Senza questo, il nero di body verrebbe "propagato" come sfondo del
   canvas e dipingerebbe fuori dal filter:invert(1) dell'html, lasciando
   lo sfondo non invertito (stesso fix di style.css/commenti.css). */
html {
    background-color: #000000;
    transition: filter 0.5s ease;
}

body {
    background-color: #000000;
    overflow: hidden;
    height: 100vh;
}

/* === MODALITÀ LIGHT: un solo invert su tutto, come su index.html === */
html.light-mode {
    filter: invert(1);
}

/* === BOTTONE INDIETRO === */
.back-link {
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 2100;
}

.back-button {
    width: 50px;
    height: auto;
    display: block;
    cursor: pointer;
    animation: rotateY-infinite 4s linear infinite;
    transform-style: preserve-3d;
}

@keyframes rotateY-infinite {
    from { transform: rotateY(0deg); }
    to   { transform: rotateY(360deg); }
}

/* === BOTTONE INVERTI COLORI === */
.toggle-btn {
    position: fixed;
    top: 10px;
    right: 30px;
    z-index: 2100;
    width: 80px;
    height: 80px;
    background-image: url('invert_button.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    clip-path: inset(2px);
}

/* === FOTO CENTRALE CON DITHERING ATKINSON === */
.monitor-stage {
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vh 5vw;
}

.photo-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
}

.photo-wrap .real-img {
    display: block;
    width: auto;
    height: auto;
    max-height: 82vh;
    max-width: 86vw;
    user-select: none;
    -webkit-user-drag: none;
}

.photo-wrap .dither-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    opacity: 1;
    transition: opacity 0.35s ease;
}

.photo-wrap.is-revealed .dither-canvas {
    opacity: 0;
}

@media (max-width: 767px) {
    .back-button {
        width: 40px;
    }

    .toggle-btn {
        top: 8px;
        right: 12px;
        width: 56px;
        height: 56px;
    }

    .monitor-stage {
        padding: 3vh 5vw;
    }

    .photo-wrap .real-img {
        max-height: 78vh;
        max-width: 90vw;
    }
}
