/* ═══════════════════════════════════════════════════════
   VARIABLES
═══════════════════════════════════════════════════════ */
:root {
    --black:    #000000;
    --green:    #00ff9f;
    --green-dim: rgba(0,255,65,0.12);
    --white:    #f0f0f0;
    --grey:     #888888;
    --grey-dim: #333333;
    --border:   #1c1c1c;
    --font-display: 'Syne', sans-serif;
    --font-mono:    'Fragment Mono', monospace;
    --font-term:    'Inconsolata', monospace;
    --nav-h:    64px;
    --max-w:    1100px;
}

/* ═══════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════ */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior: auto; }
body {
    background: var(--black);
    color: var(--white);
    font-family: var(--font-display);
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
    cursor: none;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--green); color: #000; }
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: var(--grey-dim); }

/* Noise globale */
.site-noise {
    position: fixed;
    inset: 0;
    background-image: url('/noise.gif');
    background-size: 200px 200px;
    opacity: 0.025;
    pointer-events: none;
    z-index: 1;
}

/* ═══════════════════════════════════════════════════════
   PRELOADER — originale Michele
═══════════════════════════════════════════════════════ */
#preloader {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: #000;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease;
    background-image: radial-gradient(#11581E, #041607), url('/noise.gif');
    background-repeat: no-repeat;
    background-size: cover;
    color: rgba(128,255,128,0.8);
}
.noise {
    pointer-events: none;
    position: absolute;
    width: 100%; height: 100%;
    background-image: url('/noise.gif');
    background-size: cover;
    opacity: 0.02;
    z-index: 10000;
}
.overlay {
    position: absolute;
    width: 100%; height: 100%;
    background: repeating-linear-gradient(180deg,rgba(0,0,0,0) 0,rgba(0,0,0,0.3) 50%,rgba(0,0,0,0) 100%);
    background-size: auto 4px;
    z-index: 10001;
}
.overlay::before {
    content:"";
    pointer-events: none;
    position: absolute;
    width: 100%; height: 100%;
    background-image: linear-gradient(0deg,transparent 0%,rgba(32,128,32,0.2) 2%,rgba(32,128,32,0.8) 3%,rgba(32,128,32,0.2) 3%,transparent 100%);
    background-repeat: no-repeat;
    animation: scan 7.5s linear infinite;
}
@keyframes scan {
    0%        { background-position: 0 -100vh; }
    35%, 100% { background-position: 0  100vh; }
}
.terminal {
    position: absolute;
    width: 80%; max-width: 1000px;
    top: 20%; left: 50%;
    transform: translate(-50%,0);
    padding: 2rem;
    font-family: var(--font-term);
    font-size: 1.5rem;
    color: rgba(128,255,128,0.8);
    text-transform: uppercase;
    line-height: 2rem;
    z-index: 10002;
}
.terminal_emulator__field, .terminal_emulator__field_no_cursor {
    display: block; min-width:1em; min-height:1.5em; background:transparent;
}
.terminal_emulator__field:after {
    content:""; display:inline-block;
    width:10px; height:20px;
    background: rgba(128,255,128,0.8);
    animation: blink 1s step-start infinite;
}
@keyframes blink { 50% { opacity:0; } }
.highlight { color:#fff; }
.progress-bar-text { color:#fff; font-family:var(--font-term); font-size:16px; margin:10px; }
@media(max-width:768px) {
    .terminal { width:95%; top:10%; font-size:1rem; padding:0.2rem; }
    .progress-bar-text { font-size:13px; }
}

/* ═══════════════════════════════════════════════════════
   SITE WRAPPER
═══════════════════════════════════════════════════════ */
.js-loaded #site { opacity:0; }

/* ═══════════════════════════════════════════════════════
   CUSTOM CURSOR
═══════════════════════════════════════════════════════ */
#cur-dot {
    position: fixed; top:0; left:0;
    width: 6px; height: 6px;
    background: var(--green);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9990;
    transform: translate(-50%,-50%);
    box-shadow: 0 0 8px var(--green);
    transition: opacity .2s;
    opacity: 0;
}
#cur-ring {
    position: fixed; top:0; left:0;
    width: 32px; height: 32px;
    border: 1px solid rgba(0,255,65,0.4);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9989;
    transform: translate(-50%,-50%);
    transition: width .25s ease, height .25s ease, border-color .25s ease, opacity .2s;
    opacity: 0;
}
#cur-ring.is-hover { width:52px; height:52px; border-color:var(--green); }
#cur-label {
    position: fixed; top:0; left:0;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--green);
    pointer-events: none;
    z-index: 9991;
    transform: translate(14px, 14px);
    opacity: 0;
    letter-spacing: .08em;
    transition: opacity .2s;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════
   NAV
═══════════════════════════════════════════════════════ */
#nav {
    position: fixed; top:0; left:0; right:0;
    height: var(--nav-h);
    display: flex; align-items:center; justify-content:space-between;
    padding: 0 48px;
    z-index: 200;
    transition: background .3s, border-color .3s;
    border-bottom: 1px solid transparent;
}
#nav.is-scrolled {
    background: rgba(0,0,0,.85);
    backdrop-filter: blur(12px);
    border-color: var(--border);
}
.nav-logo {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -.02em;
}
.nav-logo span { color: var(--green); }
.nav-links { display:flex; gap:36px; }
.nav-links a {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--grey);
    letter-spacing: .1em;
    transition: color .2s;
    position: relative;
}
.nav-links a::after {
    content:''; position:absolute; bottom:-2px; left:0;
    width:0; height:1px;
    background: var(--green);
    transition: width .25s ease;
}
.nav-links a:hover { color:#fff; }
.nav-links a:hover::after { width:100%; }

/* ═══════════════════════════════════════════════════════
   HERO
═══════════════════════════════════════════════════════ */
#hero {
    min-height: 100vh;
    display: flex; align-items: center;
    padding: 0 48px;
    position: relative;
    overflow: hidden;
}
.hero-inner {
    width: 100%;
    padding-top: var(--nav-h);
    padding-bottom: 60px;
}
.hero-meta {
    display: flex; align-items:center; gap:32px;
    margin-bottom: 28px;
}
.js-loaded .hero-meta { opacity: 0; }
.hero-year-wrap {
    display: flex; align-items: baseline; gap: 6px;
    font-family: var(--font-mono);
}
.hero-year-label {
    font-size: 10px;
    color: var(--grey);
    letter-spacing: .15em;
}
#hero-year {
    font-size: 15px;
    color: var(--green);
    font-variant-numeric: tabular-nums;
    min-width: 3ch;
}
.hero-role {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--grey);
    letter-spacing: .08em;
    border-left: 1px solid var(--grey-dim);
    padding-left: 20px;
}

.hero-name {
    line-height: .92;
    margin-bottom: 36px;
    overflow: hidden;
}
.hero-name-line {
    display: block;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(72px, 11.5vw, 148px);
    letter-spacing: -.04em;
    color: var(--white);
    white-space: nowrap;
}
.js-loaded .hero-name-line { transform: translateY(110%); }
.hero-name-green { color: var(--green); }

.hero-tagline-wrap {
    display: flex; align-items: center; gap: 28px;
    margin-bottom: 64px;
    overflow: hidden;
}
.js-loaded .hero-tagline-wrap { opacity: 0; }
.hero-line { width:40px; height:1px; background:var(--green); flex-shrink:0; }
.hero-tagline { display:flex; flex-direction:column; gap:2px; }
.hero-tagline-mono {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--grey);
    letter-spacing: .08em;
}
.hero-tagline-main {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(20px, 2.5vw, 30px);
    color: var(--white);
    letter-spacing: -.01em;
}

.hero-scroll-hint {
    display: flex; align-items:center; gap:16px;
}
.js-loaded .hero-scroll-hint { opacity: 0; }
.scroll-text {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--grey);
    letter-spacing: .2em;
    text-transform: uppercase;
}
.scroll-bar {
    width: 48px; height: 1px;
    background: var(--grey-dim);
    position: relative;
    overflow: hidden;
}
.scroll-bar::after {
    content:''; position:absolute; top:0; left:-100%;
    width:100%; height:100%;
    background: var(--green);
    animation: scroll-slide 2s ease-in-out infinite;
}
@keyframes scroll-slide {
    0%   { left:-100%; }
    100% { left:100%; }
}

/* Hero scanline underlay */
#hero::after {
    content:'';
    position: absolute; inset:0;
    background: repeating-linear-gradient(
        0deg, transparent, transparent 3px,
        rgba(0,255,65,.015) 3px, rgba(0,255,65,.015) 4px
    );
    pointer-events: none;
    z-index:0;
}
.hero-inner { position:relative; z-index:1; }

/* ═══════════════════════════════════════════════════════
   TIMELINE ORIZZONTALE
═══════════════════════════════════════════════════════ */
#timeline-section {
    position: relative;
    height: calc(100vh - var(--nav-h));
    overflow: hidden;
}
.timeline-track-wrap {
    display: flex;
    align-items: center;
    height: 100%;
    will-change: transform;
}
.timeline-track {
    display: flex;
    align-items: stretch;
    height: 100%;
    padding: 0 10vw;
    gap: 4px;
}
.timeline-panel {
    flex-shrink: 0;
    width: 38vw;
    min-width: 340px;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 40px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    background: #000;
    transition: border-color .3s;
}
.timeline-panel::before {
    content: attr(data-era);
    position: absolute;
    top: 20px; right: 20px;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--grey-dim);
    letter-spacing: .15em;
    text-transform: uppercase;
}
.timeline-panel:hover { border-color: var(--green); }
.timeline-panel:hover .tp-year { color: var(--green); }

.tp-year {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(60px, 8vw, 96px);
    letter-spacing: -.04em;
    color: var(--grey-dim);
    line-height: 1;
    margin-bottom: 24px;
    transition: color .3s;
}
.tp-code {
    margin-bottom: 28px;
    flex: 1;
    display: flex;
    align-items: flex-start;
}
.tp-pre {
    font-family: var(--font-term);
    font-size: 13px;
    color: rgba(128,255,128,0.7);
    line-height: 1.8;
    white-space: pre;
    tab-size: 2;
}
.tp-tag  { color: #569cd6; }
.tp-val  { color: #ce9178; }
.tp-comment { color: var(--grey-dim); }
.tp-cursor  { animation: blink 1s step-start infinite; }
.tp-label {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--grey);
    line-height: 1.5;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.timeline-progress-wrap {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: var(--border);
}
.timeline-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    transition: width .05s linear;
}

/* ═══════════════════════════════════════════════════════
   CONTAINER
═══════════════════════════════════════════════════════ */
.container { max-width:var(--max-w); margin:0 auto; padding:0 48px; }

/* ═══════════════════════════════════════════════════════
   SECTION LABEL
═══════════════════════════════════════════════════════ */
.section-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--green);
    letter-spacing: .12em;
    margin-bottom: 52px;
    opacity: .75;
}

/* ═══════════════════════════════════════════════════════
   ABOUT
═══════════════════════════════════════════════════════ */
#about { padding: 140px 0; }
.about-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 80px;
    align-items: start;
}
.about-text p {
    font-size: 17px;
    color: #aaa;
    max-width: 600px;
    line-height: 1.85;
    margin-bottom: 28px;
}
.about-text p.about-highlight {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--green);
    border-left: 2px solid var(--green);
    padding-left: 20px;
    margin-bottom: 0;
}
.about-right { position:sticky; top:120px; }
.about-deco {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.deco-inner {
    font-family: var(--font-term);
    font-size: 9px;
    color: rgba(0,255,65,.15);
    line-height: 1.4;
    letter-spacing: .02em;
    user-select: none;
    padding: 20px;
    position: relative;
    z-index: 1;
    width: 100%;
    word-break: break-all;
}
/* Scan line on deco */
.about-deco::after {
    content:'';
    position:absolute; left:0; right:0; top:0;
    height:2px;
    background: rgba(0,255,65,.4);
    box-shadow: 0 0 10px rgba(0,255,65,.6);
    animation: deco-scan 4s ease-in-out infinite;
}
@keyframes deco-scan {
    0%   { top: 0%; }
    100% { top: 100%; }
}

/* ═══════════════════════════════════════════════════════
   SERVICES — gradient mask hover (Evervault style)
═══════════════════════════════════════════════════════ */
#services { padding:140px 0; border-top:1px solid var(--border); }

.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
}

.service-card {
    position: relative;
    background: #000;
    overflow: hidden;
    padding: 48px 36px 40px;
    transition: background .3s;
}
/* Gradient mask che segue il cursore */
.sc-mask {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle 220px at var(--mx,50%) var(--my,50%),
        rgba(0,255,65,.06) 0%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity .4s;
    pointer-events: none;
    z-index: 1;
}
.service-card:hover .sc-mask { opacity:1; }
/* Top border reveal on hover */
.sc-bg {
    position: absolute;
    top:0; left:0; right:0;
    height: 1px;
    background: var(--green);
    box-shadow: 0 0 10px var(--green);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .4s ease;
    z-index: 2;
}
.service-card:hover .sc-bg { transform: scaleX(1); }

.sc-content { position:relative; z-index:3; }
.sc-num {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--green);
    opacity:.5;
    letter-spacing:.1em;
    margin-bottom: 24px;
}
.sc-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    color: var(--white);
    margin-bottom: 20px;
    letter-spacing: -.02em;
    line-height: 1.2;
}
.sc-desc {
    font-size: 14px;
    color: var(--grey);
    line-height: 1.8;
    margin-bottom: 28px;
}
.sc-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--grey-dim);
    letter-spacing: .1em;
    border: 1px solid var(--border);
    display: inline-block;
    padding: 4px 10px;
    transition: border-color .3s, color .3s;
}
.service-card:hover .sc-tag {
    border-color: rgba(0,255,65,.3);
    color: var(--green);
}

/* ═══════════════════════════════════════════════════════
   BLOG
═══════════════════════════════════════════════════════ */
#blog { padding:140px 0; border-top:1px solid var(--border); }
.blog-intro {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--grey);
    line-height: 1.9;
    max-width: 440px;
    margin-bottom: 56px;
}
.blog-intro em { font-style: italic; color: var(--grey-dim); }
.blog-list { display:grid; }
.blog-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    align-items: center;
    gap: 24px;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: border-color .2s;
}
.blog-item:hover { border-color: var(--green); }
.blog-item:hover .bi-title { color: var(--white); }
.bi-num {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--grey-dim);
    letter-spacing: .1em;
}
.bi-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 16px;
    color: #aaa;
    transition: color .2s;
    line-height: 1.3;
}
.bi-date {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--grey-dim);
    white-space: nowrap;
}
.blog-empty {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--grey-dim);
    padding: 60px 0;
}
.blog-empty .accent { color: var(--green); }

/* ═══════════════════════════════════════════════════════
   CONTACTS
═══════════════════════════════════════════════════════ */
#contacts {
    border-top: 1px solid var(--border);
    min-height: 60vh;
    display: flex;
    align-items: center;
}
.contacts-inner {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 120px 48px;
}
.contacts-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--green);
    letter-spacing: .12em;
    opacity: .75;
    margin-bottom: 32px;
}
.contacts-sub {
    font-family: var(--font-display);
    font-size: clamp(16px, 2vw, 20px);
    color: var(--grey);
    line-height: 1.8;
    max-width: 480px;
    margin-bottom: 56px;
}
/* Big email link */
.contacts-email {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 56px;
    position: relative;
    group: true;
}
.ce-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(24px, 3.5vw, 44px);
    color: var(--white);
    letter-spacing: -.02em;
    transition: color .3s;
    position: relative;
}
.ce-text::after {
    content:'';
    position:absolute; bottom:-4px; left:0;
    width:0; height:2px;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    transition: width .4s ease;
}
.contacts-email:hover .ce-text { color: var(--green); }
.contacts-email:hover .ce-text::after { width:100%; }
.ce-arrow {
    font-size: clamp(20px, 2.5vw, 32px);
    color: var(--green);
    transform: translateY(2px);
    transition: transform .3s;
}
.contacts-email:hover .ce-arrow { transform: translate(4px,-2px); }

.contacts-social { display:flex; gap:28px; }
.cs-link {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--grey);
    letter-spacing: .06em;
    transition: color .2s;
}
.cs-link:hover { color: var(--green); }

/* ═══════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════ */
footer { padding: 36px 0; border-top: 1px solid var(--border); }
footer .container { display:flex; justify-content:space-between; align-items:center; }
.ft-copy, .ft-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--grey-dim);
}
.ft-tag { font-style:italic; }

/* ═══════════════════════════════════════════════════════
   TEXT REVEAL (jh3y scroll effect)
═══════════════════════════════════════════════════════ */
.word-reveal .word {
    display: inline-block;
    color: var(--grey-dim);
    transition: color .3s;
}
.word-reveal .word.is-visible { color: #aaa; }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .about-grid { grid-template-columns: 1fr; }
    .about-right { display:none; }
    .services-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    #nav { padding:0 24px; }
    .nav-links { gap:20px; }
    .container { padding:0 24px; }
    #hero { padding:0 24px; }
    .contacts-inner { padding:80px 24px; }
    .hero-name-line { font-size: clamp(48px, 14vw, 100px); }
    footer .container { flex-direction:column; gap:8px; text-align:center; }
    .timeline-panel { width:85vw; min-width:280px; padding:32px 24px; }
    .tp-pre { font-size:11px; }
}
@media (max-width: 480px) {
    .nav-links { display:none; }
    .blog-item { grid-template-columns: 1fr auto; }
    .bi-num { display:none; }
}
