:root {
    --green-dark: #010804;
    --green-mid: #03170d;
    --gold: #d4af37;
    --gold-light: #ffeba1;
    --gold-glow: rgba(212, 175, 55, 0.6);
    --emerald: #00ff88;
    --emerald-glow: rgba(0, 255, 136, 0.6);
}

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

/* Fade morbido sui testi quando si cambia lingua */
[data-it] {
    transition: opacity 0.18s ease;
}
[data-it].lang-fading {
    opacity: 0;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #052816;
    /* Fallback, lo sfondo vero è il mesh gradient WebGL */
    font-family: 'Outfit', sans-serif;
    color: #fff;
}

/* Cursore custom: classica freccia puntatore, tratto sottile bianco (outline).
   SVG inline via data-URI. Hotspot (4 3) = punta della freccia. Fallback ad auto.
   Solo desktop con pointer fine (su touch non serve). */
@media (pointer: fine) {
    body {
        cursor:
            url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M5 3 L5 22 L10 17 L13.5 24 L16.5 22.5 L13 16 L20 16 Z' fill='%23052816' stroke='%23ffffff' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E") 5 3,
            auto;
    }

    /* sugli elementi interattivi torna il puntino/mano standard per chiarezza */
    a, button, input, textarea, label {
        cursor: pointer;
    }
    input, textarea {
        cursor: text;
    }
}

/* Sfondo statico per mobile / reduced-motion / no-WebGL (niente scena 3D) */
body.static-bg {
    background:
        radial-gradient(ellipse 80% 70% at 50% 42%,
            #14653c 0%,
            #0a3d22 45%,
            #052816 75%,
            #020f08 100%);
}

body.static-bg::after {
    /* Flow verde che irradia dal basso, coerente col 3D */
    content: '';
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 55%;
    background: linear-gradient(to top, rgba(31, 168, 90, 0.35), transparent);
    pointer-events: none;
    z-index: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#webgl-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: transparent;
}

/* Canvas del lens-flare 2D, sopra la scena WebGL ma sotto i contenuti */
#flare-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    mix-blend-mode: screen;
}

/* Alone verde che segue il cursore (solo desktop, attivato via JS) */
#cursor-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 420px;
    height: 420px;
    margin: -210px 0 0 -210px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    background: radial-gradient(circle,
        rgba(0, 255, 136, 0.12) 0%,
        rgba(0, 255, 136, 0.05) 35%,
        rgba(0, 255, 136, 0) 70%);
    transition: opacity 0.6s ease;
    will-change: transform;
}

#cursor-glow.active {
    opacity: 1;
}

.glass-container {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 6vh 0 7vh 0;
    pointer-events: none;
}

.gold-text {
    position: relative;
    display: inline-block;
    font-family: 'Josefin Sans', sans-serif;
    /* Due layer clippati sul testo:
       1) sweep: striscia di luce bianca che attraversa periodicamente (shine)
       2) base: oro high-key + riflesso bianco sotto al cursore */
    background:
        linear-gradient(105deg,
            transparent 0%,
            transparent 38%,
            rgba(255, 255, 255, 0.85) 50%,
            transparent 62%,
            transparent 100%),
        radial-gradient(circle 300px at var(--mouse-x, 50%) var(--mouse-y, 50%),
            #ffffff 0%,
            #fff1c4 16%,
            #f0d27a 42%,
            #e6c668 78%,
            #fff1c4 100%);
    background-size: 220% 100%, 100% 100%;
    background-position: 200% 0, 0 0;
    background-repeat: no-repeat;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    font-size: 2vw;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    animation: fadeIn 1.5s ease-out forwards, goldSweep 9s ease-in-out 2.5s infinite;
}

/* Light-sweep: la striscia bianca scorre lentamente, poi pausa lunga */
@keyframes goldSweep {
    0%   { background-position: 200% 0, 0 0; }
    33%  { background-position: -120% 0, 0 0; }
    100% { background-position: -120% 0, 0 0; }
}

.subtitle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5vw;
    font-size: 1.25vw;
    font-weight: 300;
    color: #fff;
}

.subtitle-text {
    /* Base dorata high-key; riflesso bianco al passaggio del cursore */
    background: radial-gradient(circle 180px at var(--mouse-x, 50%) var(--mouse-y, 50%),
            #ffffff 0%,
            #fff1c4 18%,
            #f0d27a 40%,
            #e6c668 80%,
            #fff1c4 100%);
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
}

.subtitle::before,
.subtitle::after {
    content: '';
    display: block;
    width: 6vw;
    height: 1px;
    background: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
    opacity: 0.7;
    transform: translateY(2px);
    /* Fix per l'allineamento ottico */
}

.title-line {
    width: 30%;
    height: 1px;
    background: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
    margin: 15px auto 0 auto;
    opacity: 0.7;
    border-radius: 50%;
}

.bottom-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vh;
    pointer-events: auto;
    animation: fadeIn 1.5s ease-out 0.6s forwards;
    opacity: 0;
}

nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* Azioni primarie: pillole prominenti, alta gerarchia */
.nav-primary {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 14px;
}

.nav-primary a {
    position: relative;
    display: inline-block;
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    padding: 11px 26px;
    border-radius: 50px;
    background: rgba(10, 46, 31, 0.25);
    border: 1px solid rgba(212, 175, 55, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: color 0.4s, background 0.4s, border-color 0.4s, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Effetto DPr00f: due scintille luminose che corrono lungo i bordi (alto e basso) in loop.
   Punto netto + grande glow dorato/verde. */
.nav-primary a::before,
.nav-primary a::after {
    content: '';
    position: absolute;
    height: 1.5px;
    width: 4px;
    border-radius: 1px;
    background: #fff7e0;
    box-shadow:
        0 0 3px 0 #fff,
        0 0 7px 1px var(--gold),
        0 0 14px 2px rgba(212, 175, 55, 0.5);
    pointer-events: none;
}

/* scintilla sul bordo superiore: sx → dx (tempi randomizzati via JS) */
.nav-primary a::before {
    top: -2px;
    left: 17%;
    opacity: 0;
    animation: sparkTop var(--spark-top-dur, 3.2s) ease-in-out var(--spark-top-delay, 0s) infinite;
}

/* scintilla sul bordo inferiore: dx → sx */
.nav-primary a::after {
    bottom: -2px;
    left: 83%;
    opacity: 0;
    animation: sparkBottom var(--spark-bot-dur, 3.8s) ease-in-out var(--spark-bot-delay, 0s) infinite;
}

/* La scintilla attraversa rapidamente (0→30% del ciclo) poi lunga pausa invisibile */
@keyframes sparkTop {
    0%   { opacity: 0; left: 17%; }
    8%   { opacity: 1; }
    28%  { opacity: 1; left: 83%; }
    30%  { opacity: 0; left: 83%; }
    100% { opacity: 0; left: 83%; }
}
@keyframes sparkBottom {
    0%   { opacity: 0; left: 83%; }
    8%   { opacity: 1; }
    28%  { opacity: 1; left: 17%; }
    30%  { opacity: 0; left: 17%; }
    100% { opacity: 0; left: 17%; }
}

/* hover solo dove esiste un puntatore: su touch restava "incollato" dopo il tap */
@media (hover: hover) {
    .nav-primary a:hover {
        color: var(--green-dark);
        background: var(--gold);
        border-color: var(--gold);
        transform: translateY(-3px);
        box-shadow: 0 8px 24px rgba(212, 175, 55, 0.25);
    }
}

/* Contatti/profili: icone discrete, bassa gerarchia */
.nav-social {
    list-style: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 22px;
}

.nav-social a {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.3s, transform 0.3s, text-shadow 0.3s;
}

@media (hover: hover) {
    .nav-social a:hover {
        color: #fff;
        transform: translateY(-2px);
        text-shadow: 0 0 12px var(--emerald-glow);
    }
}

.nav-social svg { display: block; }

/* iOS: gli SVG/figli dentro i bottoni catturano il tap e non lo propagano al button.
   Disattivando i pointer-events sui figli, il tap colpisce sempre il <button>. */
button svg,
button svg * {
    pointer-events: none;
}

.nav-imdb {
    font-family: 'Outfit', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.footer-container {
    position: absolute;
    bottom: 3vh;
    width: 100%;
    z-index: 2;
    pointer-events: none;
}

.footer-menu {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 0.6vw;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 300;
    letter-spacing: 1px;
    pointer-events: auto;
}

/* --- Modal CV: onirico, minimal, caratteri piccoli --- */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    inset: 0;
    background-color: rgba(2, 12, 7, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 380px;
    padding: 38px 38px 34px;
    text-align: left;
    background: rgba(10, 46, 31, 0.35);
    border: 1px solid rgba(212, 175, 55, 0.18);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45),
                inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.modal-controls {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-lang {
    background: none;
    border: none;
    padding: 2px 4px;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Outfit', sans-serif;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    cursor: pointer;
    transition: color 0.3s, text-shadow 0.3s;
}

.modal-lang:hover {
    color: var(--gold);
    text-shadow: 0 0 10px var(--gold-glow);
}

.close-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s, transform 0.3s;
}

.close-btn:hover {
    color: var(--gold);
    transform: rotate(90deg);
}

.modal-eyebrow {
    display: block;
    font-size: 0.62rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.7;
    margin-bottom: 14px;
}

.modal-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 1.5rem;
    letter-spacing: 0.02em;
    color: #fff;
    margin-bottom: 6px;
}

.modal-intro {
    font-size: 0.78rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 300;
    margin-bottom: 26px;
}

/* --- FORM CV --- */
.cv-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.cv-form .field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cv-form label {
    font-size: 0.6rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
}

.cv-form label em {
    font-style: normal;
    opacity: 0.5;
    text-transform: none;
    letter-spacing: 0.05em;
}

.cv-form input,
.cv-form textarea {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding: 5px 1px;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 300;
    transition: border-color 0.3s;
}

.cv-form textarea {
    resize: none;
    line-height: 1.5;
}

.cv-form input:focus,
.cv-form textarea:focus {
    outline: none;
    border-bottom-color: var(--gold);
}

.cv-form .field.invalid input,
.cv-form .field.invalid textarea {
    border-bottom-color: #e5707a;
}

.cv-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    margin-top: 6px;
}

.cv-submit {
    background: none;
    border: none;
    color: var(--gold);
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 6px 2px;
    transition: color 0.3s, text-shadow 0.3s, letter-spacing 0.3s;
}

.cv-submit:hover {
    color: #fff;
    text-shadow: 0 0 14px var(--gold-glow);
    letter-spacing: 0.2em;
}

/* Messaggio di conferma post-invio */
.cv-feedback {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    color: var(--emerald);
    font-weight: 300;
    opacity: 0;
    transition: opacity 0.3s;
}

.cv-feedback.show {
    opacity: 0.8;
}

/* --- OVERLAY INTRO --- */
#intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    z-index: 9999;
    pointer-events: auto;
    transition: background-color 1.5s ease, opacity 1.5s ease;
}

/* --- TOP RIGHT CONTROLS --- */
.top-right-controls {
    position: fixed;
    top: 4vh;
    right: 3vw;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 20px;
}

.top-right-controls button {
    background: none;
    border: none;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.96rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s, transform 0.3s, text-shadow 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (hover: hover) {
    .top-right-controls button:hover {
        color: #fff;
        text-shadow: 0 0 15px var(--emerald-glow);
        transform: scale(1.1);
    }
}

#audio-toggle {
    opacity: 0.5;
    /* Spento di default */
}

#audio-toggle.playing {
    opacity: 1;
}

#audio-toggle.playing .bar {
    animation: soundWave 1.2s ease-in-out infinite;
    transform-origin: center;
    transform-box: fill-box;
}

#audio-toggle.playing .bar-1 {
    animation-delay: 0.0s;
}

#audio-toggle.playing .bar-2 {
    animation-delay: 0.2s;
}

#audio-toggle.playing .bar-3 {
    animation-delay: 0.4s;
}

#audio-toggle.playing .bar-4 {
    animation-delay: 0.2s;
}

#audio-toggle.playing .bar-5 {
    animation-delay: 0.0s;
}

@keyframes soundWave {

    0%,
    100% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(0.3);
    }
}

/* --- RESPONSIVE DESIGN --- */

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
    .gold-text {
        font-size: 10vw;
    }

    .subtitle {
        font-size: 2.5vw;
        gap: 3vw;
    }

    .subtitle::before,
    .subtitle::after {
        width: 8vw;
    }

    .nav-primary a {
        font-size: 0.9rem;
    }

    .footer-menu {
        font-size: 1.2vw;
        gap: 20px;
    }

    .modal-title {
        font-size: 3vw;
    }

    .modal-body p {
        font-size: 2vw;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .glass-container {
        padding: 6vh 0 12vh 0;
    }

    .gold-text {
        font-size: 15vw;
        letter-spacing: 0.2vw;
    }

    .subtitle {
        font-size: 1rem;
        gap: 12px;
        margin-bottom: 3vh;
        max-width: 100%;
    }

    .subtitle-text {
        white-space: nowrap;   /* il claim resta su una riga sola */
    }

    .subtitle::before,
    .subtitle::after {
        width: 22px;           /* linee corte: lasciano spazio al testo */
        flex-shrink: 0;
    }

    .bottom-content {
        width: 90%;
    }

    .nav-primary {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
        width: auto;
    }

    .nav-primary a {
        font-size: 0.9rem;
        padding: 11px 24px;
    }

    .nav-social {
        gap: 30px;
    }

    .footer-container {
        bottom: 2vh;
    }

    .footer-menu {
        flex-direction: column;
        gap: 10px;
        font-size: 0.85rem;
        text-align: center;
    }

    .modal-content {
        padding: 25px 20px;
        width: 92%;
    }

    .modal-title {
        font-size: 1.5rem;
    }

    .modal-body p {
        font-size: 1.1rem;
    }
}
/* Quando il popup è aperto, nascondi i controlli globali (EN/IT + audio):
   altrimenti, essendo position:fixed con z-index alto, finiscono sopra la X di chiusura. */
body.overlay-open .top-right-controls {
    opacity: 0;
    pointer-events: none;
}
.top-right-controls {
    transition: opacity 0.3s;
}

/* --- COOKIE BANNER (cookie-free notice) --- */
.cookie-banner {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%) translateY(20px);
    z-index: 95;
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: min(620px, 92vw);
    padding: 12px 16px 12px 20px;
    background: rgba(10, 46, 31, 0.55);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 14px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-banner.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.cookie-text {
    font-size: 0.72rem;
    line-height: 1.5;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.cookie-text a {
    color: var(--gold);
    text-decoration: none;
}

.cookie-text a:hover {
    text-decoration: underline;
}

.cookie-ok {
    flex-shrink: 0;
    background: var(--gold);
    color: var(--green-dark);
    border: none;
    border-radius: 40px;
    padding: 8px 18px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: filter 0.3s, transform 0.2s;
}

.cookie-ok:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .cookie-banner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        bottom: 12px;
        padding: 14px 16px;
    }
}

/* --- EASTER EGG: STRAFELLOID --- */
.strafelloid {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(2, 10, 6, 0.92);  /* scurisce per contrasto */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.strafelloid.show {
    display: flex;
    animation: fadeIn 0.4s ease-out forwards;
}

.strafelloid .close-btn {
    position: absolute;
    top: 20px;
    right: 22px;
    color: rgba(255, 255, 255, 0.55);
}
.strafelloid .close-btn:hover { color: var(--gold); transform: rotate(90deg); }

#sf-canvas {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    max-width: 92vw;
    max-height: 76vh;
    background: #020a06;
}

/* Nome, punteggio e istruzioni SOTTO il box del gioco, allineati a sinistra */
.sf-foot {
    margin-top: 16px;
    width: min(92vw, 900px);   /* stessa larghezza del canvas */
    display: flex;
    align-items: baseline;
    gap: 22px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.sf-foot .sf-hint {
    margin-left: auto;   /* le istruzioni vanno a destra, titolo+score a sinistra */
}

.sf-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.28em;
    color: #fff;
}

.sf-score {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.18em;
    color: var(--gold);
}

.sf-hint {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   MIGLIORIE D'USO — v2.1 / v2.2 (11/11/2026)
   Nessun cambio estetico: tutto ciò che segue interviene solo su tastiera,
   touch, schermi bassi e "riduci movimento".
   ========================================================================== */

/* Tastiera: focus visibile (col mouse non compare) */
:focus-visible {
    outline: 1px solid var(--gold-light);
    outline-offset: 4px;
}
.cv-form input:focus-visible,
.cv-form textarea:focus-visible {
    outline: none;                  /* i campi hanno già la riga oro sotto */
}

/* BUG su telefono: la riga "✦ contatto" (semitrasparente, quindi dipinta sopra) copriva la X
   e il cambio lingua del popup, che non ricevevano il tocco. Ora i controlli stanno davanti. */
.modal-controls {
    z-index: 2;
}

/* Popup più alto dello schermo (telefono sdraiato, tastiera aperta): scorre invece di tagliarsi */
.modal-content {
    max-height: calc(100% - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Touch */
@media (pointer: coarse) {
    /* 16px: iPhone non ingrandisce la pagina quando si tocca un campo */
    .cv-form input,
    .cv-form textarea {
        font-size: 16px;
    }

    /* area di tocco più ampia, grafica identica (il margine negativo compensa il padding) */
    .nav-social a {
        padding: 13px;
        margin: -13px;
    }
    .modal .close-btn,
    .modal-lang {
        position: relative;
    }
    .modal .close-btn::before,
    .modal-lang::before {
        content: '';
        position: absolute;
        inset: -9px -5px;
    }
}

/* Tablet (769–1024px): il titolo a 10vw toccava i bordi dello schermo e finiva sotto
   lingua/audio. Stesso titolo, un po' più piccolo: resta su una riga e lascia libero l'angolo. */
@media (min-width: 769px) and (max-width: 1024px) {
    .gold-text {
        font-size: 7vw;
    }
}

/* Modulo: indirizzo in chiaro sotto "Invia", per chi non ha un programma di posta configurato
   (in quel caso il bottone non apre nulla). Un tocco sull'indirizzo lo copia. */
.cv-alt {
    margin-top: 20px;
    font-size: 0.72rem;
    font-weight: 300;
    line-height: 1.5;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.4);
}
.modal-body p.cv-alt {
    font-size: 0.72rem;             /* non eredita gli ingrandimenti di .modal-body p su tablet/telefono */
}
.cv-copy {
    background: none;
    border: none;
    padding: 4px 0;
    font: inherit;
    letter-spacing: 0.03em;
    color: var(--gold);
    cursor: pointer;
    -webkit-user-select: text;
    user-select: text;
    transition: color 0.3s, text-shadow 0.3s;
}
@media (hover: hover) {
    .cv-copy:hover {
        color: #fff;
        text-shadow: 0 0 14px var(--gold-glow);
    }
}
.cv-copied {
    margin-left: 6px;
    color: var(--emerald);
    opacity: 0.8;
}

/* Telefono sdraiato: titolo, menu e footer non si accavallano più */
@media (orientation: landscape) and (max-height: 500px) {
    .glass-container {
        padding: 5vh 0 44px;
    }
    .cv-alt {
        margin-top: 8px;
    }
    .gold-text {
        font-size: clamp(24px, 10vh, 8vw);
        letter-spacing: normal;
    }
    .title-line {
        margin-top: 8px;
    }
    .subtitle {
        font-size: 1rem;
        gap: 14px;
        margin-bottom: 0;
    }
    .subtitle::before,
    .subtitle::after {
        width: 40px;
    }
    .bottom-content {
        width: auto;
        gap: 10px;
    }
    nav {
        gap: 10px;
    }
    .nav-primary a {
        padding: 8px 22px;
    }
    .footer-container {
        bottom: 12px;
    }
    .footer-menu {
        flex-direction: row;
        gap: 20px;
        font-size: 10px;
    }
    .modal-content {
        padding: 22px 28px 18px;
    }
    .modal-title {
        font-size: 1.3rem;
    }
    .modal-body p {
        font-size: 0.8rem;
    }
    .modal-intro {
        margin-bottom: 14px;
    }
    .cv-form {
        gap: 12px;
    }
}

/* Avviso cookie (primo accesso): prima copriva icone, footer e su telefono anche il bottone.
   Resta dov'è e com'è: finché è a schermo, menu e footer salgono per fargli posto,
   poi tornano giù quando si tocca "Ho capito". Valori = altezza dell'avviso + respiro. */
body:has(.cookie-banner.show) {
    --cookie-shift: 68px;
}
.bottom-content,
.footer-container {
    translate: 0 calc(-1 * var(--cookie-shift, 0px));
    transition: translate 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (max-width: 768px) {
    body:has(.cookie-banner.show) {
        --cookie-shift: 156px;       /* qui l'avviso è in colonna, più alto */
    }
}
@media (orientation: landscape) and (max-height: 500px) {
    .cookie-banner {
        flex-direction: row;         /* telefono sdraiato: in riga, sennò occupa mezzo schermo */
        text-align: left;
        bottom: 10px;
        padding: 10px 14px 10px 18px;
    }
    body:has(.cookie-banner.show) {
        --cookie-shift: 86px;
    }
}

/* "Riduci movimento" attivo nel sistema: niente animazioni, tutto subito a posto */
@media (prefers-reduced-motion: reduce) {
    .gold-text,
    .bottom-content,
    .modal.show,
    .strafelloid.show,
    #audio-toggle.playing .bar {
        animation: none;
    }
    .bottom-content {
        opacity: 1;
    }
    .nav-primary a::before,
    .nav-primary a::after {
        display: none;
    }
    #intro-overlay,
    .cookie-banner,
    .nav-primary a,
    .nav-social a,
    .close-btn {
        transition-duration: 0.01s;
    }
}
