/* =========================================================
   MV STUDIO CODE — ANIMAZIONI, HEADER E TERMINALE
========================================================= */

/* Header: sparisce scendendo, torna salendo */
.header {
    transition: background 0.3s ease, backdrop-filter 0.3s ease, border-color 0.3s ease, transform 0.35s ease;
}

.header.header-hidden {
    transform: translateY(-110%);
}

/* Entrata della prima schermata */
@keyframes mvIntro {
    from { opacity: 0; transform: translateY(26px); filter: blur(6px); }
    to { opacity: 1; transform: none; filter: none; }
}

.intro-item {
    opacity: 0;
    animation: mvIntro 0.9s cubic-bezier(.2, .8, .2, 1) forwards;
}

.hero-title > * {
    display: block;
}

/* Comparsa a cascata (competenze, progetti in arrivo, pulsanti del terminale) */
.stagger-item {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(.2, .8, .2, 1);
}

    .stagger-item.in {
        opacity: 1;
        transform: none;
    }

/* Competenze: hover immediato, testo e sfondo cambiano insieme */
.skill {
    position: relative;
    transition: padding 0.25s ease, background-color 0.15s ease, opacity 0.6s ease, transform 0.6s cubic-bezier(.2, .8, .2, 1);
}

    .skill .skill-number,
    .skill .skill-name,
    .skill .skill-description {
        transition: color 0.15s ease;
    }

    .skill::after {
        content: "";
        position: absolute;
        left: 0;
        bottom: -1px;
        width: 0;
        height: 2px;
        background: var(--accent);
        transition: width 0.3s ease;
    }

    .skill:hover::after {
        width: 100%;
    }

/* Anteprime dei progetti che si inclinano */
.project-image {
    transition: transform 0.25s ease-out;
    will-change: transform;
}

/* Il cursore del logo lampeggia */
@keyframes mvBlink {
    0%, 55% { opacity: 1; }
    56%, 100% { opacity: 0; }
}

.brand-logo rect:last-of-type {
    animation: mvBlink 1.1s steps(1) infinite;
}

/* Bottoni: freccia che scatta */
.button span,
.project-link span,
.email-link span {
    display: inline-block;
    transition: transform 0.25s ease;
}

.button:hover span,
.project-link:hover span,
.email-link:hover span {
    transform: translate(3px, -3px);
}


/* =========================================================
   TERMINALE
========================================================= */

.terminal-content {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 80px;
    align-items: start;
}

.terminal-title h2 {
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(42px, 5vw, 75px);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -3px;
}

    .terminal-title h2 span {
        display: block;
        color: #555;
    }

.terminal-title p {
    margin-top: 28px;
    max-width: 380px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.7;
}

.terminal-window {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    background: #0c0c0d;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: #111113;
}

    .terminal-bar span {
        width: 11px;
        height: 11px;
        border-radius: 50%;
        background: #333;
    }

        .terminal-bar span:first-child { background: #ff5f57; }
        .terminal-bar span:nth-child(2) { background: #febc2e; }
        .terminal-bar span:nth-child(3) { background: #28c840; }

    .terminal-bar em {
        margin-left: auto;
        font-style: normal;
        font-size: 11px;
        color: #777;
    }

.terminal-output {
    height: 300px;
    overflow-y: auto;
    padding: 20px 20px 8px;
    font-size: 13px;
    line-height: 1.7;
    color: #d6d6d6;
    overscroll-behavior: contain;
}

.t-line {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.t-cmd {
    margin-top: 10px;
    color: #f5f5f5;
}

.t-dim {
    color: #8a8a8a;
}

.t-err {
    color: #ff8a7a;
}

.t-prompt {
    color: var(--accent);
    white-space: nowrap;
}

.t-link {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.terminal-form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px 16px;
    font-size: 13px;
}

.terminal-input {
    flex: 1;
    min-width: 0;
    height: 36px;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: #f5f5f5;
    font: inherit;
    font-size: 16px; /* niente zoom automatico su iPhone */
    caret-color: var(--accent);
    outline: none;
}

    .terminal-input:focus {
        border-bottom-color: var(--accent);
    }

.terminal-run {
    height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: transparent;
    color: #f5f5f5;
    font: 600 12px/1 "Inter", sans-serif;
    cursor: pointer;
}

    .terminal-run:hover,
    .terminal-run:focus-visible {
        border-color: var(--accent);
        color: var(--accent);
    }

.terminal-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 20px;
}

    .terminal-chips button {
        min-height: 36px;
        padding: 0 14px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 999px;
        background: #141416;
        color: #cfcfcf;
        font: 500 12px/1 "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
        cursor: pointer;
        transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    }

        .terminal-chips button:hover,
        .terminal-chips button:focus-visible {
            border-color: var(--accent);
            color: #fff;
            outline: none;
        }

@media (max-width: 900px) {
    .terminal-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .terminal-output {
        height: 260px;
    }
}

@media (max-width: 600px) {
    .terminal-output,
    .terminal-form {
        padding-left: 14px;
        padding-right: 14px;
    }

    .terminal-chips {
        padding: 0 14px 16px;
    }

    .terminal-form .t-prompt {
        display: none;
    }
}

/* Chi preferisce meno movimento */
@media (prefers-reduced-motion: reduce) {
    .intro-item,
    .stagger-item {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        filter: none !important;
    }

    .brand-logo rect:last-of-type {
        animation: none;
    }

    .header {
        transition: none;
    }
}
