/* --- RESET & VARS --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-black: #000000;
    --bg-card: #0a0a0a;
    --text-white: #ffffff;
    --text-gray: #888888;
    --kde-blue: #00f3ff; 
    --term-bg-kde: rgba(10, 15, 20, 0.2); 
    --wip-color: #ffbd2e;
    --border: #222;
    --code-bg: #111;
    
    /* Telegram Colors */
    --tg-bg-left: #17212b;
    --tg-bg-chat: #0e1621;
    --tg-bg-bubble-in: #182533;
    --tg-bg-bubble-out: #2b5278;
    --tg-text-main: #fff;
    --tg-text-meta: #6c7883;
}

html { scroll-behavior: smooth; }
body {
    background-color: var(--bg-black);
    color: var(--text-white);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    perspective: 1000px;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }

/* --- BACKGROUND --- */
.cyber-grid { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -2; background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px); background-size: 50px 50px; }
.vignette { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; background: radial-gradient(circle, transparent 30%, #000000 90%); pointer-events: none; }

/* --- NAVBAR --- */
nav { position: fixed; top: 0; width: 100%; padding: 1.5rem 4rem; display: flex; justify-content: space-between; align-items: center; z-index: 1000; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.logo { font-weight: 800; font-size: 1.5rem; letter-spacing: -1px; }
.logo .dot { color: #555; }
.nav-links { display: flex; gap: 2rem; }
.nav-links a { font-size: 0.85rem; font-family: 'JetBrains Mono', monospace; color: var(--text-gray); }
.nav-links a:hover { color: var(--text-white); }

/* --- HERO --- */
.hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; }
.hero-title { font-size: clamp(4rem, 10vw, 8rem); font-weight: 900; letter-spacing: -3px; margin-bottom: 1rem; }
.hero-subtitle { font-size: 1.5rem; color: var(--text-gray); margin-bottom: 3rem; }
.highlight { color: #fff; }

.hero-desc-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    max-width: 650px;
    margin: 0 auto 3rem auto;
    background: rgba(15, 15, 15, 0.6);
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 3px solid #ffffff;
    backdrop-filter: blur(5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    text-align: left;
}
.prompt-char { font-family: 'JetBrains Mono', monospace; color: #ffffff; margin-right: 15px; font-weight: 700; font-size: 1.2rem; }
.hero-description-mono { font-family: 'JetBrains Mono', monospace; font-size: 0.95rem; color: #d0d0d0; line-height: 1.6; margin: 0; }

.hero-btns { display: flex; gap: 1rem; justify-content: center; }
.btn { padding: 1rem 2rem; font-weight: 600; border: 1px solid #fff; }
.btn.primary { background: #fff; color: #000; }
.btn.secondary { color: #fff; }
.scroll-indicator { position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; opacity: 0.6; }
.mouse-icon { width: 20px; height: 35px; border: 2px solid #fff; border-radius: 20px; position: relative; }
.wheel { width: 4px; height: 4px; background: #fff; border-radius: 50%; position: absolute; top: 5px; left: 50%; transform: translateX(-50%); animation: scrollMouse 1.5s infinite; }
@keyframes scrollMouse { 0% { top: 5px; opacity: 1; } 100% { top: 20px; opacity: 0; } }

/* --- COMMON SECTIONS --- */
section { padding: 8rem 0; position: relative; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 2rem; }
.section-title { font-size: 2.5rem; font-weight: 700; margin-bottom: 2rem; }
.section-header { margin-bottom: 4rem; display: flex; align-items: baseline; gap: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.section-number { font-family: 'JetBrains Mono', monospace; font-size: 1.2rem; color: #444; }

/* --- MARQUEE --- */
.tech-strip { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg-card); padding: 1.5rem 0; overflow: hidden; white-space: nowrap; transform: rotate(-2deg) scale(1.05); margin: 4rem 0; opacity: 0.8; }
.strip-content { display: inline-block; animation: marquee 20s linear infinite; }
.strip-content span { font-family: 'JetBrains Mono', monospace; font-size: 1.2rem; margin: 0 2rem; color: #444; font-weight: 700; }
@keyframes marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* --- ABOUT --- */
.about-content { display: grid; grid-template-columns: 3fr 2fr; gap: 4rem; }
.about-text p { font-size: 1.1rem; color: #bbb; margin-bottom: 1.5rem; }
.quote-box { border-left: 2px solid #fff; padding-left: 1.5rem; font-style: italic; color: #fff; margin: 2rem 0; background: rgba(255,255,255,0.02); padding: 1.5rem; }
.stats-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; }
.stat-item { background: var(--bg-card); padding: 2rem; border: 1px solid var(--border); text-align: center; display: flex; flex-direction: column; justify-content: center; }
.stat-item h3 { font-size: 2.5rem; font-weight: 800; }
.stat-item p { font-family: 'JetBrains Mono', monospace; color: #666; text-transform: uppercase; }

/* --- CODE SHOWCASE --- */
.code-terminal { background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px; margin-bottom: 5rem; font-family: 'JetBrains Mono', monospace; }
.terminal-bar { background: #1a1a1a; padding: 10px; border-bottom: 1px solid #333; display: flex; gap: 10px; }
.traffic-lights .light { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.light.red { background: #ff5f56; } .light.yellow { background: #ffbd2e; } .light.green { background: #27c93f; }
.terminal-nav { display: flex; background: #151515; }
.nav-item { padding: 10px 20px; background: transparent; color: #666; border: none; cursor: pointer; }
.nav-item.active { background: #111; color: #fff; border-top: 2px solid #fff; }
.terminal-window { padding: 20px; color: #ddd; font-family: 'JetBrains Mono', monospace; }
.kwd { color: #c678dd; } .str { color: #98c379; } .fun { color: #61afef; }

/* --- SKILLS --- */
.skills-wrapper { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.skill-box { border: 1px solid var(--border); padding: 2rem; background: var(--bg-card); height: 100%; }
.skill-box h4 { font-size: 1.2rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.skill-box ul li { display: flex; align-items: center; gap: 10px; margin-bottom: 1rem; color: #ccc; }

/* --- PROJECTS (FIX IMMAGINI) --- */
.project-row { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; padding: 2rem 0; }
.project-info h3 { font-size: 2.5rem; margin: 1rem 0; }
.project-year { font-family: 'JetBrains Mono', monospace; color: #666; font-size: 0.8rem; }
.highlight-wip { color: var(--wip-color); font-weight: 700; border: 1px dashed var(--wip-color); padding: 2px 8px; border-radius: 4px; letter-spacing: 1px; }
.project-info p { color: #aaa; line-height: 1.7; margin-bottom: 2rem; }
.tags { margin-bottom: 2rem; display: flex; gap: 10px; flex-wrap: wrap; }
.tags span { border: 1px solid var(--border); padding: 5px 10px; font-size: 0.75rem; font-family: 'JetBrains Mono', monospace; text-transform: uppercase; color: #888; }
.project-link { font-weight: 700; border-bottom: 1px solid #fff; padding-bottom: 2px; }

/* Visual Container */
.project-visual {
    height: 300px;
    background: #111;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden; /* Importante per tagliare l'immagine */
    border-radius: 6px;
}

/* Visual Text (Fallback) */
.visual-text { font-family: 'JetBrains Mono', monospace; color: #333; font-size: 2rem; font-weight: 700; z-index: 0;}

/* FIX IMMAGINI: Si adattano perfettamente al box */
.project-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Taglia l'immagine per riempire senza distorcere */
    z-index: 1;
    transition: transform 0.5s ease;
}

.project-visual:hover .project-img {
    transform: scale(1.05); /* Leggero zoom on hover */
}

.divider { border: none; height: 1px; background: var(--border); margin: 3rem 0; }

/* --- VALUES --- */
.values-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; position: relative; }
.value-card { background-color: rgba(20, 20, 20, 0.6); border: 1px solid var(--border); border-radius: 12px; padding: 2.5rem; overflow: hidden; transition: transform 0.3s; position: relative; }
.value-card:hover { transform: translateY(-5px); border-color: rgba(255, 255, 255, 0.3); }
.card-content { position: relative; z-index: 2; }
.spotlight-bg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; opacity: 0; z-index: 1; background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(0, 243, 255, 0.1), transparent 40%); transition: opacity 0.5s; pointer-events: none; }
.value-card:hover .spotlight-bg { opacity: 1; }
.value-card h4 { margin-bottom: 1rem; } .value-card p { color: #999; }
.card-number { font-family: 'JetBrains Mono', monospace; font-size: 3rem; font-weight: 800; color: rgba(255, 255, 255, 0.03); position: absolute; bottom: -10px; right: 10px; }

/* --- KDE DESKTOP SECTION --- */
#linux-desktop-section { padding: 6rem 2rem; width: 100%; display: flex; justify-content: center; align-items: center; }
.desktop-wrapper { width: 90%; max-width: 1400px; height: 750px; border-radius: 4px; overflow: hidden; border: 1px solid #333; position: relative; background-color: #000; box-shadow: 0 20px 60px rgba(0,0,0,0.8); }
.desktop-container { width: 100%; height: 100%; background: url('wallpaper.jpg') no-repeat center center; background-size: cover; position: relative; }
.kde-bottom-bar { position: absolute; bottom: 0; left: 0; width: 100%; height: 48px; background: rgba(10, 10, 15, 0.9); backdrop-filter: blur(10px); display: flex; align-items: center; padding: 0 10px; z-index: 100; border-top: 1px solid rgba(0, 243, 255, 0.2); }
.kde-start-btn { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; cursor: pointer; margin-right: 15px; }
.kde-tasks { flex-grow: 1; display: flex; gap: 5px; }
.kde-task { padding: 0 20px; height: 40px; display: flex; align-items: center; background: rgba(255,255,255,0.05); border-radius: 4px; color: #eee; font-size: 0.9rem; border-bottom: 2px solid var(--kde-blue); cursor: pointer; }
.kde-tray { padding: 0 20px; color: #fff; font-size: 0.9rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }

/* Draggable Window */
.draggable-terminal { position: absolute; background-color: var(--term-bg-kde); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); border-radius: 6px; box-shadow: 0 30px 80px rgba(0,0,0,0.7); border: 1px solid rgba(255,255,255,0.1); display: flex; flex-direction: column; overflow: hidden; }
.terminal-header { background: rgba(10, 10, 15, 0.4); height: 38px; display: flex; align-items: center; cursor: move; border-bottom: 1px solid rgba(255,255,255,0.05); }
.terminal-tab { padding: 0 25px; height: 100%; display: flex; align-items: center; background: rgba(255,255,255,0.05); color: #ccc; font-size: 0.85rem; border-right: 1px solid rgba(255,255,255,0.05); border-top: 2px solid var(--kde-blue); flex-grow: 1; }
.terminal-body-content { padding: 20px; flex-grow: 1; font-family: 'JetBrains Mono', monospace; color: #f0f0f0; font-size: 0.95rem; overflow-y: auto; line-height: 1.5; cursor: text; }
.ascii-banner { color: var(--kde-blue); font-weight: 700; margin-bottom: 2rem; font-size: 0.6rem; }
.kde-num { color: var(--kde-blue); font-weight: 700; margin-right: 8px; }
.screenfetch-art { float: left; margin-right: 20px; font-size: 0.75rem; color: #fff; font-weight: 700; }
.info-label { color: var(--kde-blue); font-weight: 700; }
.cmd-input { background: transparent; border: none; color: #fff; font-family: 'JetBrains Mono', monospace; font-size: 1rem; width: 30px; outline: none; caret-color: transparent; }
.block-cursor { display: inline-block; width: 8px; height: 16px; background-color: #ddd; animation: blink 1s infinite; margin-left: -25px; pointer-events: none; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.kde-panel-floating { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); width: auto; min-width: 200px; height: 60px; background: rgba(15, 15, 20, 0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 30px; border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 10px 30px rgba(0,0,0,0.5); display: flex; align-items: center; padding: 0 20px; z-index: 100; }
.panel-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 5px; margin: 0 5px; cursor: pointer; transition: background 0.2s; position: relative; }
.panel-icon:hover { background: rgba(255,255,255,0.1); }
.start-icon svg { fill: var(--kde-blue); }
.app-icon { color: #eee; }
.active-dot { position: absolute; bottom: 3px; width: 4px; height: 4px; background-color: var(--kde-blue); border-radius: 50%; }
.panel-separator { width: 1px; height: 25px; background: rgba(255,255,255,0.1); margin: 0 10px; }

/* --- TELEGRAM WIDGET --- */
.contact-section { padding-bottom: 4rem; }
.tg-desktop-wrapper {
    width: 90%; max-width: 1400px; height: 750px;
    background-color: var(--bg-black);
    margin: 0 auto;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    border: 1px solid #222;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    font-family: 'Inter', sans-serif;
    position: relative;
}

.tg-sidebar { width: 30%; background-color: var(--tg-bg-left); border-right: 1px solid #000; display: flex; flex-direction: column; }
.tg-search-bar { padding: 10px 15px; display: flex; align-items: center; gap: 15px; }
.tg-menu-icon { color: #777; cursor: pointer; font-size: 1.2rem; }
.tg-search-input { flex-grow: 1; background: #242f3d; padding: 8px 15px; border-radius: 20px; color: #777; font-size: 0.9rem; cursor: text; }
.tg-chat-list { flex-grow: 1; overflow-y: auto; }
.tg-chat-item { display: flex; padding: 10px 15px; cursor: pointer; transition: background 0.2s; }
.tg-chat-item:hover { background-color: #202b36; }
.tg-chat-item.active { background-color: #2b5278; }
.tg-avatar-small { width: 45px; height: 45px; background: linear-gradient(135deg, #66b0ff 0%, #3a7dbf 100%); border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; margin-right: 10px; font-size: 1.1rem; }
.tg-chat-details { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; }
.tg-chat-top { display: flex; justify-content: space-between; margin-bottom: 4px; }
.tg-chat-name { font-weight: 600; color: #fff; font-size: 0.95rem; }
.tg-chat-time { font-size: 0.75rem; color: var(--tg-text-meta); }
.tg-chat-bottom { display: flex; justify-content: space-between; }
.tg-chat-preview { color: var(--tg-text-meta); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.tg-chat-item.active .tg-chat-preview, .tg-chat-item.active .tg-chat-time { color: #dcebff; }

.tg-main-chat {
    width: 70%;
    background-color: var(--tg-bg-chat);
    background-image: radial-gradient(#131b26 15%, transparent 16%);
    background-size: 20px 20px;
    display: flex; flex-direction: column;
}
.tg-main-chat.hidden { display: none; }
.tg-chat-header { height: 60px; background-color: var(--tg-bg-left); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid #000; }
.tg-header-name { color: #fff; font-weight: 600; font-size: 1rem; }
.tg-header-status { color: #64b5ef; font-size: 0.85rem; }
.tg-messages-area { flex-grow: 1; padding: 20px 30px; display: flex; flex-direction: column; gap: 15px; overflow-y: auto; }
.tg-msg-row { display: flex; }
.tg-msg-row.incoming { justify-content: flex-start; }
.tg-msg-row.outgoing { justify-content: flex-end; }
.tg-bubble { max-width: 60%; padding: 10px 15px; border-radius: 10px; position: relative; font-size: 0.95rem; box-shadow: 0 1px 2px rgba(0,0,0,0.3); line-height: 1.5; }
.tg-msg-row.incoming .tg-bubble { background-color: var(--tg-bg-bubble-in); color: #fff; border-bottom-left-radius: 0; }
.tg-msg-row.outgoing .tg-bubble { background-color: var(--tg-bg-bubble-out); color: #fff; border-bottom-right-radius: 0; }
.tg-timestamp { font-size: 0.7rem; color: #8faec9; float: right; margin-left: 10px; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.tg-read { color: #64b5ef; font-size: 0.9rem; }
.tg-link-group { margin-top: 15px; display: flex; flex-direction: column; gap: 8px; }
.tg-link-row { display: flex; align-items: center; background: rgba(0,0,0,0.2); padding: 10px; border-radius: 6px; text-decoration: none; color: #fff; transition: background 0.2s; cursor: pointer; }
.tg-link-row:hover { background: rgba(0,0,0,0.4); }
.tg-link-icon { width: 32px; height: 32px; background: var(--kde-blue); color: #000; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; margin-right: 15px; }
.tg-link-text { flex-grow: 1; font-size: 0.9rem; }
.tg-copy-tooltip { position: absolute; right: 10px; background: #000; color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.tg-input-bar { height: 60px; background-color: var(--tg-bg-left); padding: 0 20px; display: flex; align-items: center; gap: 20px; border-top: 1px solid #000; }
.tg-input-field { flex-grow: 1; color: #777; }

footer { padding: 3rem 0; text-align: center; border-top: 1px solid var(--border); color: #444; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }

/* --- ANIMATIONS --- */
.progress-bar { position: fixed; top: 0; left: 0; width: 100%; height: 2px; background: #222; z-index: 2000; }
.progress-fill { height: 100%; background: #fff; width: 0%; }
.tilt-card { transition: transform 0.1s; will-change: transform; transform-style: preserve-3d; }
.reveal-up { opacity: 0; transform: translateY(50px); transition: all 0.8s cubic-bezier(0.165, 0.84, 0.44, 1); }
.reveal-left { opacity: 0; transform: translateX(-50px); transition: all 0.8s cubic-bezier(0.165, 0.84, 0.44, 1); }
.reveal-right { opacity: 0; transform: translateX(50px); transition: all 0.8s cubic-bezier(0.165, 0.84, 0.44, 1); }
.reveal-text { opacity: 0; transform: translateY(30px); transition: all 1s ease; }
.active { opacity: 1; transform: translate(0); }

@media (max-width: 768px) { .nav-links { display: none; } .about-content, .project-row { grid-template-columns: 1fr; } .project-row { gap: 2rem; } .project-visual { order: -1; } .scroll-line-container { display: none; } .draggable-terminal { width: 95% !important; height: 60% !important; left: 2.5% !important; top: 5% !important; } #screenfetchTerminal { display: none; } .tg-sidebar { display: none; } .tg-main-chat { width: 100%; } .tg-desktop-wrapper { height: 600px; width: 100%; border: none; } }