:root {
    --bg-base: #000000; /* Nero puro Apple */
    --card-bg: #111112; /* Grigio scuro opaco */
    --card-border: rgba(255, 255, 255, 0.04);
    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --accent-blue: #2997ff;
    --nav-bg: rgba(28, 28, 30, 0.6);
}

*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Helvetica, Arial, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
    
    /* FIX: Previene lo spostamento della navbar */
    overflow-x: hidden;
    overflow-y: scroll; 
}
}

/* Nasconde il cursore di sistema (gestito da JS) */
body.custom-cursor-enabled, body.custom-cursor-enabled * {
    cursor: none !important;
}

::selection {
    background: rgba(41, 151, 255, 0.3);
    color: #fff;
}

h1, h2, h3, h4 {
    margin: 0;
    letter-spacing: -0.03em; /* Stile tipografico Apple */
    font-weight: 600;
}

a { text-decoration: none; color: inherit; }

/* Sfondo WebGL ridotto per non disturbare il minimalismo */
#plasma-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; pointer-events: none; opacity: 0.5;
}

/* Navigazione Fluttuante stile visionOS / Dynamic Island */
.nav-wrapper {
    position: fixed;
    top: 24px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 1000;
    pointer-events: none;
}

.navbar {
    background: var(--nav-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    padding: 6px;
    border-radius: 100px;
    display: flex;
    gap: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.navbar a {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 100px;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.navbar a:hover, .navbar a.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Sezione Eroe */
.hero-section {
    padding: 160px 20px 80px;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-section h1 {
    font-size: clamp(48px, 8vw, 72px);
    line-height: 1.05;
    margin: 16px 0;
    background: linear-gradient(180deg, #ffffff 0%, #86868b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.elegant-text {
    font-size: clamp(17px, 3vw, 21px);
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: -0.01em;
}

/* Griglia Bento Adattiva */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 980px;
    margin: 0 auto 100px;
    padding: 0 20px;
}

.col-span-2 { grid-column: span 2; }
.flex-col { display: flex; flex-direction: column; }
.space-between { justify-content: space-between; }
.flex-center { display: flex; justify-content: center; align-items: center; }

/* Design delle Card: Bordo sottilissimo, tanto padding */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    padding: 40px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.card h2 {
    font-size: 24px;
    margin: 12px 0;
}

.badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Immagine Profilo Perfetta (Quadrata) */
.profile-img-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 32px;
    overflow: hidden;
    padding: 0;
}

.profile-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(10%) contrast(1.1);
}

/* Bottoni */
.btn-apple {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    background: var(--text-primary);
    color: var(--bg-base);
    transition: all 0.3s ease;
    border: none;
    width: fit-content;
    margin-top: auto;
}

.btn-apple:hover { transform: scale(1.03); }
.btn-blue { background: var(--accent-blue); color: #fff; }
.btn-outline { background: transparent; border: 1px solid rgba(255,255,255,0.15); color: var(--text-primary); }
.btn-outline:hover { background: rgba(255,255,255,0.05); }

/* Stack Tecnologico Minimal */
.tech-stack-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.tech-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 100px;
    font-size: 13px;
    color: var(--text-primary);
}

.tech-icon { width: 16px; height: 16px; filter: invert(1); }

/* Form e Tabelle */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    width: 100%;
}

.form-group label { font-size: 13px; color: var(--text-secondary); }

.form-group input, .form-group textarea {
    width: 100%;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 16px;
    border-radius: 16px;
    font-family: inherit;
    font-size: 15px;
    transition: border 0.3s, background 0.3s;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(255,255,255,0.04);
}

/* Animazioni */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal.active { opacity: 1; transform: translateY(0); }

/* Footer */
footer {
    padding: 60px 20px;
    text-align: center;
    max-width: 980px;
    margin: 0 auto;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.social-links a { opacity: 0.5; transition: 0.3s; }
.social-links a:hover { opacity: 1; }
.social-links img { width: 20px; height: 20px; filter: invert(1); }

/* Cursore Custom (Rimane inviato dal JS) */
.custom-cursor {
    position: fixed;
    top: 0; left: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1), 
                height 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    backdrop-filter: blur(2px);
    display: none;
}
body.custom-cursor-enabled .custom-cursor { display: block; }

/* Responsive Mobile */
@media (max-width: 768px) {
    .nav-wrapper { top: 16px; padding: 0 16px; }
    .navbar { width: 100%; overflow-x: auto; justify-content: flex-start; padding: 6px 12px; }
    .navbar::-webkit-scrollbar { display: none; }
    .bento-grid { grid-template-columns: 1fr; gap: 16px; }
    .col-span-2 { grid-column: span 1; }
    .card { padding: 32px 24px; border-radius: 28px; }
    .hero-section { padding-top: 120px; }
    .btn-apple { width: 100%; }
}