@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

/* ==========================================
   0. VARIABILI GLOBALI (:ROOT)
   ========================================== */
:root {
    --bg-dark-absolute: #000000;
    --bg-dark-deep: #050505;
    --bg-dark-card: #0a0a0a;
    --bg-dark-modal: #0f0f0f;
    --bg-light-hero: #ffffff;
    --bg-light-grey: #f4f4f4;

    --text-dark: #000000;
    --text-white: #ffffff;
    --text-muted: #888888;
    --text-grey-dark: #333333;
    --text-light-grey: #e0e0e0;

    --accent-color: #ff4500;
    --border-overlay-light: rgba(255, 255, 255, 0.1);
    --border-overlay-ultra-light: rgba(255, 255, 255, 0.05);
    --bg-overlay-ultra-light: rgba(255, 255, 255, 0.02);
    --bg-overlay-light: rgba(255, 255, 255, 0.9);
}

/* ==========================================
   1. STILI BASE & RESET DEL BODY
   ========================================== */
html, body {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
    width: 0 !important;
    height: 0 !important;
}

body {
    margin: 0;
    background-color: var(--bg-dark-absolute);
    color: var(--text-white);
    overflow-x: hidden;
    cursor: none;
    font-family: "Montserrat", sans-serif !important;
    letter-spacing: -2%;
}

body.loading {
    height: 100vh;
}

/* Utility layout Hero */
.header-hero {
    background-color: var(--bg-light-hero);
    position: relative;
    z-index: 10;
}

.btn-primary {
    border-radius: 1000px !important;
    background-color: var(--bg-dark-card) !important;
    color: var(--text-white) !important;
    border: none !important;
}

.btn-outlined {
    border-radius: 1000px !important;
    background-color: transparent !important;
    color: var(--text-white) !important;
    border: 1px solid var(--text-white) !important;
}

a {
    text-decoration: none !important;
    color: var(--text-dark) !important;
}

a, button, .portfolio-card, input, textarea {
    cursor: none !important;
}

.c-primary {
    background-color: var(--bg-light-grey);
}

.text-white {
    color: var(--text-white) !important;
}

#foto-personale {
    border-radius: 1000px !important;
    aspect-ratio: 1 !important;
    height: 50px;
}

/* ==========================================
   2. SCHERMATA DI CARICAMENTO (LOADER)
   ========================================== */
#loader {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-dark-absolute);
    color: var(--text-white);
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loader-content {
    text-align: center;
}

#loader-counter {
    font-variant-numeric: tabular-nums;
    min-width: 250px;
}

/* ==========================================
   3. CURSORE PERSONALIZZATO
   ========================================== */
.custom-cursor {
    width: 30px;
    height: 30px;
    background-color: var(--text-white);
    border-radius: 50%;
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    will-change: transform;
}

@media only screen and (max-device-width: 991px) {
    .custom-cursor {
        display: none;
    }
}

/* ==========================================
   4. SEZIONE ORIZZONTALE CON MARQUEE & INDRE
   ========================================== */
.header-video-section {
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-dark-card);
    overflow: hidden;
}

.badge {
    background-color: var(--bg-dark-absolute);
}

.marquee-background {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    overflow: hidden;
    z-index: 1;
    opacity: 0.25;
    pointer-events: none;
}

.marquee-track {
    display: flex;
    width: max-content;
    white-space: nowrap;
    will-change: transform;
}

.marquee-track span {
    font-size: 10vw;
    font-weight: 900;
    text-transform: uppercase;
    font-family: "Montserrat", sans-serif !important;
    color: var(--text-white);
    -webkit-text-stroke: 2px var(--text-white);
    text-stroke: 2px var(--text-white);
    padding-right: 80px;
}

.cards-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    padding-left: 50vw;
    padding-right: 20vw;
    gap: 40px;
    z-index: 2;
    will-change: transform;
}

.portfolio-card {
    flex-shrink: 0;
    width: 350px;
    height: 350px;
    background: var(--bg-overlay-light);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(0px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    color: var(--text-dark);
}

/* Indicatore freccia fissa "Scorri in basso" */
.scroll-down-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.scroll-down-indicator span {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    font-weight: 600;
}

.scroll-down-indicator i {
    font-size: 1.5rem;
    color: var(--text-white);
    animation: bounceArrow 1.6s infinite ease-in-out;
}

@keyframes bounceArrow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* ==========================================
   5. SEZIONE FINALE TESTO ANCORATO (PINNED)
   ========================================== */
.section-pinned {
    width: 100%;
    height: 100vh;
    position: relative;
    z-index: 10;
    overflow: hidden;
    background-color: var(--bg-light-hero);
}

.color-scroll-text {
    font-size: 9vh;
    line-height: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media only screen and (max-width: 576px) {
    .color-scroll-text {
        font-size: 6vw;
    }
}

.line-wrapper {
    display: block;
    overflow: hidden;
}

.txt-line {
    display: inline-block;
    font-weight: 900;
    position: relative;
    color: var(--text-light-grey) !important;
    white-space: nowrap;
}

.txt-line::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: var(--line-width, 0%);
    height: 100%;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
}

.fixed-description-text {
    color: var(--text-grey-dark);
    opacity: 0;
    transform: translateY(30px);
    will-change: transform, opacity;
}

.x-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.floating-x {
    position: absolute;
    bottom: -10%;
    font-family: "Montserrat", sans-serif;
    font-weight: 900;
    color: var(--text-dark);
    opacity: 0.06;
    user-select: none;
    will-change: transform, opacity;
}

/* ==========================================
   6. SEZIONE PROGETTO (SHOWCASE)
   ========================================== */
.project-showcase-section {
    background-color: var(--bg-dark-deep) !important;
    position: relative;
}

.font-family-montserrat {
    font-family: "Montserrat", sans-serif !important;
}

.img-tilt-container {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    background: transparent;
    will-change: transform;
}

.showcase-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    opacity: 0;
    transform: translateY(40px);
    will-change: transform, opacity;
}

.projects-global-wrapper {
    background-color: var(--bg-dark-deep) !important;
    width: 100%;
}

.projects-counter-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.projects-counter-sidebar.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.counter-track {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.counter-divider {
    width: 30px;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.3);
}

.current-number {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-white);
    display: inline-block;
    will-change: transform, opacity;
}

.total-number {
    font-size: 1.2rem;
    color: #666666;
}

@media (min-width: 992px) {
    .projects-counter-sidebar {
        position: sticky;
        top: 0;
        left: 0;
        width: 180px;
        height: 100vh;
        float: left;
        background: transparent;
        border-top: none;
        border-right: 1px solid rgba(255, 255, 255, 0.08);
        box-sizing: border-box;
    }

    .projects-list {
        margin-left: 180px;
        width: calc(100% - 180px);
    }

    .counter-track {
        flex-direction: column;
        gap: 10px;
    }

    .counter-divider {
        width: 1px;
        height: 40px;
    }

    .current-number {
        font-size: 2.5rem;
    }
}

/* ==========================================
   7. SEZIONE SKILLS MARQUEE PARALLAX
   ========================================== */
.skills-marquee-section {
    background-color: var(--bg-dark-deep) !important;
    position: relative;
    z-index: 10;
}

.skills-row {
    display: flex;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    user-select: none;
}

.skills-marquee-text {
    display: flex;
    gap: 3vw;
    font-size: 8vh;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--text-muted) !important;
}

@media only screen and (max-width: 576px) {
    .skills-marquee-text {
        font-size: 12vw;
    }
}

.skills-marquee-text span {
    display: inline-flex;
    align-items: center;
}

.slide-right .skills-marquee-text {
    transform: translateX(-30%);
    will-change: transform;
}

.slide-left .skills-marquee-text {
    transform: translateX(10%);
    will-change: transform;
}

/* ==========================================
   8. SEZIONE CONTATTI & FORM
   ========================================== */
.contact-form-section {
    background-color: var(--bg-light-hero) !important;
    position: relative;
    z-index: 10;
    color: var(--text-dark);
}

.form-custom-style {
    background: var(--bg-overlay-ultra-light);
    border: 1px solid var(--border-overlay-ultra-light);
}

.portfolio-input {
    background-color: var(--bg-dark-absolute) !important;
    border: 1px solid var(--border-overlay-light) !important;
    color: var(--text-white) !important;
    padding: 12px 18px !important;
    border-radius: 12px !important;
    transition: all 0.3s ease !important;
}

.portfolio-input::placeholder {
    color: gray !important;
}

/* Modals style */
.modal-dark-success, .modal-dark-error {
    background: var(--bg-dark-modal);
    border: 1px solid var(--border-overlay-light);
}

/* ==========================================
   9. PORTFOLIO FOOTER
   ========================================== */
.portfolio-footer {
    background-color: var(--bg-dark-card) !important;
    position: relative;
    z-index: 10;
    color: var(--text-white) !important;
}

.footer-divider-color {
    border-color: var(--border-overlay-light);
}