* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a0a;
    --bg-sidebar: #111111;
    --text: #d4d4d8;
    --text-dim: #71717a;
    --accent: #f4f4f5;
    --border: #1f1f1f;
    --primary: #10b981;
    --secondary: #14b8a6;
    --tertiary: #06b6d4;
    --gradient: linear-gradient(135deg, #10b981, #14b8a6);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
    overflow-x: hidden;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeOutLoading 3s ease-in-out forwards;
}

.loading-logo {
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-logo img {
    width: 200px;
    height: 200px;
    object-fit: contain;
    animation: loadingLogoBuild 2.5s ease-out forwards;
    opacity: 0;
    transform: scale(0.5);
}

@keyframes loadingLogoBuild {
    0% {
        opacity: 0;
        transform: scale(0.5);
        clip-path: inset(100% 100% 100% 100%);
    }
    
    20% {
        opacity: 1;
        transform: scale(0.8);
        clip-path: inset(0% 0% 75% 0%);
    }
    
    40% {
        transform: scale(0.9);
        clip-path: inset(0% 0% 50% 0%);
    }
    
    60% {
        transform: scale(0.95);
        clip-path: inset(0% 0% 25% 0%);
    }
    
    80% {
        transform: scale(1.05);
        clip-path: inset(0% 0% 0% 0%);
    }
    
    100% {
        opacity: 1;
        transform: scale(1);
        clip-path: inset(0% 0% 0% 0%);
    }
}

@keyframes fadeOutLoading {
    0%, 80% {
        opacity: 1;
        visibility: visible;
    }
    
    100% {
        opacity: 0;
        visibility: hidden;
    }
}

/* Side Navigation */
.sidenav {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 100px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 0;
    z-index: 1000;
}

.logo {
    text-decoration: none;
    margin-bottom: 60px;
    transition: all 0.3s ease;
    display: block;
}

.logo img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    transition: all 0.3s ease;
    animation: blockByBlockBuild 3s ease-out forwards;
    opacity: 0;
}

@keyframes blockByBlockBuild {
    0% {
        opacity: 0;
        clip-path: inset(100% 100% 100% 100%);
        transform: scale(0.8);
    }
    
    /* Primo blocco - dall'alto */
    20% {
        opacity: 1;
        clip-path: inset(0% 0% 75% 0%);
        transform: scale(0.9);
    }
    
    /* Secondo blocco */
    40% {
        clip-path: inset(0% 0% 50% 0%);
        transform: scale(0.95);
    }
    
    /* Terzo blocco */
    60% {
        clip-path: inset(0% 0% 25% 0%);
        transform: scale(0.98);
    }
    
    /* Quarto blocco - completamento */
    80% {
        clip-path: inset(0% 0% 0% 0%);
        transform: scale(1.02);
    }
    
    100% {
        opacity: 1;
        clip-path: inset(0% 0% 0% 0%);
        transform: scale(1);
    }
}

.logo:hover img {
    opacity: 0.8;
    transform: scale(1.05);
}

.nav-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 11px;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.nav-link.active {
    color: var(--primary);
}

.nav-link:hover {
    color: var(--primary);
}

.nav-number {
    font-size: 10px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.social-vertical {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.social-vertical a {
    font-size: 11px;
    color: var(--text-dim);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.social-vertical a:hover {
    color: var(--primary);
}

/* Main Content */
.main-content {
    margin-left: 100px;
    padding: 0 60px;
    max-width: 1400px;
}

/* Intro Section */
.intro-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 100px 0;
}

.intro-content {
    max-width: 800px;
}

.intro-label {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.intro-name {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(40px, 8vw, 80px);
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 10px;
    line-height: 1.1;
    letter-spacing: -2px;
}

.intro-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(30px, 6vw, 60px);
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 30px;
    line-height: 1.2;
    letter-spacing: -1px;
    position: relative;
}

.intro-title::after {
    content: '.';
    color: var(--primary);
    font-weight: 900;
}

.intro-description {
    font-size: 18px;
    color: var(--text-dim);
    line-height: 1.8;
    margin-bottom: 40px;
    max-width: 600px;
}

.highlight {
    color: var(--primary);
    font-weight: 500;
    position: relative;
}

.highlight::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--primary);
}

.cta-button {
    display: inline-block;
    padding: 14px 28px;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.3s;
}

.cta-button:hover {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

/* Work Section */
.work-section,
.projects-section,
.contact-section {
    padding: 120px 0;
    border-top: 1px solid var(--border);
}

.section-number {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    color: var(--primary);
    margin-bottom: 20px;
    font-weight: 600;
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 60px;
    letter-spacing: -1.5px;
}

.work-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-bottom: 80px;
}

.work-card {
    padding: 30px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
}

.work-card:hover {
    border-color: var(--primary);
}

.work-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.work-card h3 {
    font-size: 20px;
    color: var(--accent);
    font-weight: 600;
    transition: color 0.3s;
}

.work-card:hover h3 {
    color: var(--primary);
}

.work-period {
    font-size: 12px;
    color: var(--text-dim);
}

.work-company {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 12px;
}

.work-description {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.7;
}

/* Skills Section */
.skills-section {
    margin-bottom: 80px;
}

.skills-heading {
    font-size: 20px;
    color: var(--accent);
    margin-bottom: 30px;
    font-weight: 600;
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.skill-tag {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: default;
}

.skill-tag:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--bg);
}

/* Services Section */
.services-section {
    margin-top: 80px;
}

.services-heading {
    font-size: 20px;
    color: var(--accent);
    margin-bottom: 30px;
    font-weight: 600;
}

.services-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.service-box {
    padding: 30px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
}

.service-box:hover {
    border-color: var(--primary);
}

.service-box h4 {
    font-size: 18px;
    color: var(--accent);
    margin-bottom: 12px;
    font-weight: 600;
    transition: all 0.3s;
}

.service-box:hover h4 {
    color: var(--primary);
}

.service-box p {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.7;
}

/* Projects Section */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.project-item {
    display: grid;
    grid-template-columns: 60px 1fr 60px;
    gap: 30px;
    align-items: center;
    padding: 40px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.project-item:hover {
    opacity: 0.8;
}

.project-item:hover .project-arrow {
    color: var(--primary);
}

.project-number {
    font-size: 14px;
    color: var(--text-dim);
    font-weight: 500;
}

.project-name {
    font-size: 24px;
    color: var(--accent);
    margin-bottom: 8px;
    font-weight: 600;
    transition: all 0.3s;
}

.project-item:hover .project-name {
    color: var(--primary);
}

.project-desc {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 16px;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.project-tags span {
    font-size: 11px;
    color: var(--text-dim);
    padding: 4px 10px;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.project-item:hover .project-tags span {
    border-color: var(--primary);
    color: var(--primary);
}

.project-arrow {
    font-size: 24px;
    color: var(--text-dim);
    text-align: right;
    transition: transform 0.3s;
}

/* Contact Section */
.contact-intro {
    font-size: 18px;
    color: var(--text-dim);
    line-height: 1.8;
    margin-bottom: 60px;
    max-width: 600px;
}

.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 600px;
}

.contact-method {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.contact-method:hover {
    opacity: 0.8;
}

.method-label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.method-value {
    font-size: 18px;
    color: var(--accent);
    font-weight: 500;
    transition: all 0.3s;
}

.contact-method:hover .method-value {
    color: var(--primary);
}

/* Footer */
.footer {
    margin-left: 100px;
    padding: 40px 60px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer p {
    font-size: 12px;
    color: var(--text-dim);
}

/* Responsive Design */

/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .main-content {
        padding: 0 40px;
        max-width: 1200px;
    }
    
    .intro-section {
        padding: 80px 0;
    }
    
    .work-section,
    .projects-section,
    .contact-section {
        padding: 100px 0;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .sidenav {
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: space-between;
        padding: 15px 20px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        position: fixed;
        top: 0;
        z-index: 1001;
    }

    .logo {
        margin-bottom: 0;
    }
    
    .logo img {
        width: 50px;
        height: 50px;
    }

    .nav-links {
        flex-direction: row;
        gap: 15px;
        flex: 0;
    }

    .nav-text {
        display: none;
    }
    
    .nav-number {
        font-size: 12px;
    }

    .social-vertical {
        flex-direction: row;
        gap: 12px;
    }
    
    .social-vertical a {
        font-size: 10px;
    }

    .main-content {
        margin-left: 0;
        margin-top: 80px;
        padding: 0 30px;
    }
    
    .intro-section {
        padding: 60px 0;
        min-height: 80vh;
    }
    
    .intro-name {
        font-size: clamp(32px, 8vw, 60px);
    }
    
    .intro-title {
        font-size: clamp(24px, 6vw, 45px);
    }
    
    .intro-description {
        font-size: 16px;
        margin-bottom: 30px;
    }

    .work-section,
    .projects-section,
    .contact-section {
        padding: 80px 0;
    }
    
    .section-title {
        font-size: clamp(28px, 5vw, 40px);
        margin-bottom: 40px;
    }

    .work-grid,
    .services-list {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .work-card,
    .service-box {
        padding: 25px;
    }

    .project-item {
        grid-template-columns: 30px 1fr 30px;
        gap: 15px;
        padding: 25px 0;
    }

    .project-name {
        font-size: 18px;
    }
    
    .project-desc {
        font-size: 13px;
    }
    
    .project-tags span {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .contact-intro {
        font-size: 16px;
        margin-bottom: 40px;
    }
    
    .method-value {
        font-size: 16px;
    }

    .footer {
        margin-left: 0;
        padding: 30px 30px;
    }
    
    /* Loading screen responsive */
    .loading-logo img {
        width: 150px;
        height: 150px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .sidenav {
        padding: 12px 15px;
    }
    
    .logo img {
        width: 40px;
        height: 40px;
    }
    
    .nav-links {
        gap: 10px;
    }
    
    .nav-number {
        font-size: 10px;
    }
    
    .social-vertical {
        gap: 8px;
    }
    
    .social-vertical a {
        font-size: 9px;
    }

    .main-content {
        padding: 0 20px;
        margin-top: 70px;
    }
    
    .intro-section {
        padding: 40px 0;
        min-height: 70vh;
    }
    
    .intro-name {
        font-size: clamp(28px, 8vw, 50px);
        margin-bottom: 8px;
    }
    
    .intro-title {
        font-size: clamp(20px, 6vw, 35px);
        margin-bottom: 20px;
    }
    
    .intro-description {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 25px;
    }
    
    .cta-button {
        padding: 12px 24px;
        font-size: 13px;
    }

    .work-section,
    .projects-section,
    .contact-section {
        padding: 60px 0;
    }
    
    .section-title {
        font-size: clamp(24px, 5vw, 32px);
        margin-bottom: 30px;
    }
    
    .work-grid {
        gap: 20px;
    }
    
    .work-card,
    .service-box {
        padding: 20px;
    }
    
    .work-card h3 {
        font-size: 18px;
    }
    
    .service-box h4 {
        font-size: 16px;
    }
    
    .skills-list {
        gap: 8px;
    }
    
    .skill-tag {
        padding: 6px 12px;
        font-size: 12px;
    }

    .project-item {
        grid-template-columns: 25px 1fr 25px;
        gap: 12px;
        padding: 20px 0;
    }
    
    .project-number {
        font-size: 12px;
    }

    .project-name {
        font-size: 16px;
        margin-bottom: 6px;
    }
    
    .project-desc {
        font-size: 12px;
        margin-bottom: 12px;
    }
    
    .project-tags {
        gap: 6px;
    }
    
    .project-tags span {
        font-size: 9px;
        padding: 2px 6px;
    }
    
    .project-arrow {
        font-size: 20px;
    }
    
    .contact-intro {
        font-size: 14px;
        margin-bottom: 30px;
    }
    
    .contact-methods {
        gap: 20px;
    }
    
    .contact-method {
        padding: 20px 0;
    }
    
    .method-label {
        font-size: 11px;
    }
    
    .method-value {
        font-size: 14px;
    }

    .footer {
        padding: 25px 20px;
    }
    
    .footer p {
        font-size: 11px;
    }
    
    /* Loading screen mobile */
    .loading-logo img {
        width: 120px;
        height: 120px;
    }
}

/* Very small screens */
@media (max-width: 320px) {
    .main-content {
        padding: 0 15px;
    }
    
    .intro-name {
        font-size: clamp(24px, 8vw, 40px);
    }
    
    .intro-title {
        font-size: clamp(18px, 6vw, 28px);
    }
    
    .project-item {
        grid-template-columns: 20px 1fr 20px;
        gap: 10px;
    }
    
    .project-name {
        font-size: 14px;
    }
    
    .loading-logo img {
        width: 100px;
        height: 100px;
    }
}
