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

:root {
    --rosso: #d32f2f;
    --rosso-chiaro: #ff6b6b;
    --testo-tenue: #f1c9c9;
    --glow: rgba(211, 47, 47, 0.5);
    --glow-forte: rgba(229, 57, 53, 0.85);
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #0b0b0d;
    background-image: linear-gradient(135deg, #0b0b0d, #3b0d12, #1a1a1f);
    min-height: 100vh;
    min-height: 100dvh; /* dynamic viewport on mobile browsers */
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
}

.container {
    width: 100%;
    max-width: 640px;
    text-align: center;
    padding: 2rem;
}

.js .container {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.js .container.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Logo (cliccabile per l'easter egg) */
.logo-wrap {
    --carica: 0; /* 0 → 1 man mano che si clicca il logo */
    display: inline-block;
    max-width: 250px;
    width: 100%;
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 calc(var(--carica) * 30px) rgba(255, 82, 82, calc(var(--carica) * 0.9)));
    transition: filter 0.3s ease-out;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation; /* niente zoom con il doppio tap */
    user-select: none;
    -webkit-user-select: none;
}

.logo-wrap.is-tapped {
    animation: tap 0.25s ease-out;
}

.logo-wrap.is-attivo {
    animation: attivo 0.45s ease-in forwards;
}

.logo-img {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 15px var(--glow));
    animation: pulse 4s infinite ease-in-out;
    -webkit-user-drag: none;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(to right, #ffffff, var(--rosso-chiaro));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-text {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--testo-tenue);
    position: relative;
    display: inline-block;
}

.dots span {
    display: inline-block;
    animation: fadeDots 1.5s infinite ease-in-out both;
}

.dots span:nth-child(1) { animation-delay: -0.32s; }
.dots span:nth-child(2) { animation-delay: -0.16s; }
.dots span:nth-child(3) { animation-delay: 0s; }

/* Legge di Murphy del giorno */
.murphy {
    margin-top: 2.5rem;
    padding: 1.5rem 1.75rem 1.25rem;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--rosso);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 25px rgba(211, 47, 47, 0.12);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.murphy[hidden] {
    display: none;
}

.murphy__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
}

.murphy__titolo,
.murphy__numero {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--rosso-chiaro);
}

.murphy__numero {
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 1px;
    white-space: nowrap;
}

.voce + .voce {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.voce__citazione {
    font-size: 1.15rem;
    font-style: italic;
    line-height: 1.55;
    white-space: pre-line; /* rispetta gli a capo delle leggi su più righe */
    overflow-wrap: break-word;
}

.voce__autore {
    margin-top: 0.4rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--testo-tenue);
}

/* Corollari e commenti: stesso formato, più discreti */
.voce + .voce .voce__citazione {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
}

.voce + .voce .voce__autore {
    font-size: 0.85rem;
}

.murphy--lunga .voce__citazione {
    font-size: 1rem;
}

.murphy--lunga .voce + .voce .voce__citazione {
    font-size: 0.92rem;
}

.murphy__fonte {
    margin-top: 1.25rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: right;
}

.murphy__fonte a {
    color: inherit;
}

.murphy__fonte a:hover,
.murphy__fonte a:focus-visible {
    color: var(--testo-tenue);
}

/* Easter egg "gaspar": occhietti che seguono il cursore */
.occhietti {
    position: fixed;
    top: 14px;
    left: 50%;
    z-index: 10;
    width: 130px;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -140%);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease-out;
    filter: drop-shadow(0 0 12px var(--glow));
}

.occhietti.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.occhietti svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.occhio {
    transform-box: fill-box;
    transform-origin: center;
}

.occhietti.is-blinking .occhio {
    animation: battito 0.18s ease-in-out;
}

.occhio__bordo {
    fill: none;
    stroke: #ffffff;
    stroke-width: 8;
}

.occhio__bianco {
    fill: #ffffff;
}

.occhio__contorno {
    fill: none;
    stroke: #111111;
    stroke-width: 3;
}

.occhio__pupilla {
    transition: transform 0.12s ease-out;
}

.occhio__iride {
    fill: var(--rosso);
    stroke: #7f1414;
    stroke-width: 1.5;
}

.occhio__nero {
    fill: #111111;
}

.occhio__luce {
    fill: #ffffff;
}

@keyframes pulse {
    0%   { transform: scale(1);    filter: drop-shadow(0 0 15px var(--glow)); }
    50%  { transform: scale(1.05); filter: drop-shadow(0 0 25px var(--glow-forte)); }
    100% { transform: scale(1);    filter: drop-shadow(0 0 15px var(--glow)); }
}

@keyframes fadeDots {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

@keyframes tap {
    0%   { transform: scale(1); }
    40%  { transform: scale(0.93); }
    100% { transform: scale(1); }
}

@keyframes battito {
    0%, 100% { transform: scaleY(1); }
    50%      { transform: scaleY(0.1); }
}

@keyframes attivo {
    0%   { transform: scale(1) rotate(0); opacity: 1; }
    100% { transform: scale(1.4) rotate(360deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .logo-img,
    .dots span,
    .logo-wrap.is-tapped,
    .logo-wrap.is-attivo,
    .occhietti.is-blinking .occhio {
        animation: none;
    }

    .occhietti {
        transition: opacity 0.3s ease-out;
    }

    .dots span {
        opacity: 1;
    }

    .js .container {
        transition: none;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .container {
        padding: 1.5rem 1rem;
    }

    .logo-wrap {
        max-width: 160px;
        margin-bottom: 1.5rem;
    }

    h1 {
        font-size: 2rem;
        letter-spacing: 1px;
    }

    .status-text {
        font-size: 1.1rem;
    }

    .occhietti {
        width: 100px;
        top: 10px;
    }

    .murphy {
        margin-top: 2rem;
        padding: 1.25rem 1.25rem 1rem;
    }

    .voce__citazione,
    .murphy--lunga .voce__citazione {
        font-size: 1rem;
    }

    .voce + .voce .voce__citazione,
    .murphy--lunga .voce + .voce .voce__citazione {
        font-size: 0.92rem;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    h1 {
        font-size: 1.6rem;
    }

    .status-text {
        font-size: 1rem;
    }

    .logo-wrap {
        max-width: 130px;
    }
}
