*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; cursor: none !important; }

:root {
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #181818;
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.18);
  --text: #e8e6df;
  --muted: #6b6b6b;
  
  /* Variabili Colore Dinamiche (Tema Default) */
  --accent: #c8f135;
  --accent-rgb: 200, 241, 53;
  --accent-hover: #d4f855;
  --accent2: #4ade80;
  --accent2-rgb: 74, 222, 128;
  
  --mono: 'Space Mono', monospace;
  --sans: 'Syne', sans-serif;
}

html { 
  scroll-behavior: smooth; 
  scroll-snap-type: none; 
  scroll-padding-top: 80px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* ── CUSTOM SCROLLBAR ── */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); border-left: 1px solid var(--border); }
::-webkit-scrollbar-thumb { background: rgba(var(--accent-rgb), 0.4); border-radius: 5px; border: 2px solid var(--bg); transition: background 0.3s ease; }
::-webkit-scrollbar-thumb:hover { background: rgba(var(--accent-rgb), 0.8); }
* { scrollbar-width: thin; scrollbar-color: var(--accent) var(--bg); }

/* ── ANIMAZIONE SCROLL SECTION INDICATOR ── */
.section-indicator {
  position: fixed; right: 25px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  writing-mode: vertical-rl; text-transform: uppercase; letter-spacing: 0.15em;
  opacity: 0; transition: opacity 0.3s ease, color 0.3s ease;
  z-index: 90; pointer-events: none; text-shadow: 0 0 8px rgba(var(--accent-rgb), 0.4);
}
.section-indicator.visible { opacity: 0.7; }

/* ── STILI CURSORE CUSTOM ── */
#c-dot, #c-ring, #c-trail { position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999; border-radius: 50%; transform: translate(-50%, -50%); transition: opacity 0.3s; }
#c-dot { width: 8px; height: 8px; background: var(--accent); transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
#c-ring { width: 32px; height: 32px; border: 1px solid rgba(var(--accent-rgb), 0.45); transition: width 0.35s cubic-bezier(0.22,1,0.36,1), height 0.35s cubic-bezier(0.22,1,0.36,1), border-color 0.3s ease, background 0.3s ease; }
#c-trail { width: 18px; height: 18px; border: 1px solid rgba(var(--accent-rgb), 0.15); }
#c-dot.hov { transform: translate(-50%, -50%) scale(2); background: var(--accent); }
#c-ring.hov { width: 48px; height: 48px; border-color: rgba(var(--accent-rgb), 0.8); background: rgba(var(--accent-rgb), 0.05); }
#c-dot.txt { opacity: 0; }
#c-ring.txt { width: 3px; height: 28px; border-radius: 2px; background: rgba(var(--accent-rgb), 0.7); border: none; opacity: 1; }
#c-dot.clk { transform: translate(-50%, -50%) scale(0.4); }
#c-ring.clk { width: 24px; height: 24px; border-color: rgba(var(--accent-rgb), 1); background: rgba(var(--accent-rgb), 0.1); }

/* ── NAV ── */
nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 3rem; background: rgba(10,10,10,0.88); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
nav::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(var(--accent-rgb), 0.15), transparent 40%); opacity: 0; transition: opacity 0.4s ease; pointer-events: none; z-index: 0; }
nav:hover::before { opacity: 1; }
.nav-cmd-wrap, .nav-links { position: relative; z-index: 1; }
.nav-cmd-wrap { display: flex; align-items: center; gap: 0.2rem; background: transparent; border-bottom: 1px solid transparent; padding: 0.2rem 0; transition: border-color 0.2s; }
.nav-cmd-wrap:focus-within { border-bottom-color: rgba(var(--accent-rgb), 0.5); }
.nav-cmd-prefix { font-family: var(--mono); font-size: 13px; color: var(--muted); flex-shrink: 0; user-select: none; }
#nav-cmd { background: transparent; border: none; outline: none; color: var(--accent); font-family: var(--mono); font-size: 13px; letter-spacing: 0.05em; min-width: 100px; caret-color: var(--accent); padding: 0 6px; }
#nav-cmd::placeholder { color: var(--muted); opacity: 0.4; }

/* ── DROPDOWN ── */
.nav-dropdown { position: absolute; top: calc(100% + 12px); left: 0; width: 220px; background: #0f0f0f; border: 1px solid rgba(255,255,255,0.11); border-radius: 7px; overflow: hidden; z-index: 999; opacity: 0; transform: translateY(-5px); pointer-events: none; transition: opacity 0.14s ease, transform 0.14s ease; box-shadow: 0 12px 32px rgba(0,0,0,0.6); }
.nav-dropdown.open { opacity: 1; transform: translateY(0); pointer-events: all; }
.dropdown-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 0.55rem 0.9rem 0.3rem; opacity: 0.55; }
.dd-option { display: flex; align-items: center; justify-content: space-between; padding: 0.52rem 0.9rem; transition: background 0.1s; border-top: 1px solid rgba(255,255,255,0.04); gap: 0.8rem; }
.dd-option:first-of-type { border-top: none; }
.dd-option:hover, .dd-option.active { background: rgba(var(--accent-rgb), 0.07); }
.dd-option.active .dd-name { color: var(--accent); }
.dd-left { display: flex; align-items: center; gap: 0.35rem; }
.dd-slash { font-family: var(--mono); font-size: 11px; color: var(--muted); opacity: 0.35; }
.dd-name { font-family: var(--mono); font-size: 11px; color: var(--text); transition: color 0.1s; }
.dd-desc { font-family: var(--mono); font-size: 10px; color: var(--muted); opacity: 0.5; flex-shrink: 0; }
.dd-badge { font-family: var(--mono); font-size: 9px; color: var(--muted); background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); border-radius: 3px; padding: 1px 5px; opacity: 0.55; flex-shrink: 0; }
.dd-nomatch { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 0.6rem 0.9rem; opacity: 0.45; font-style: italic; }

/* ── NAV LINKS ── */
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a { font-family: var(--mono); font-size: 12px; color: var(--muted); text-decoration: none; letter-spacing: 0.1em; text-transform: uppercase; transition: color 0.3s ease, text-shadow 0.3s ease; }
.nav-links a:hover { color: var(--text); text-shadow: 0 0 8px rgba(232, 230, 223, 0.4); }
.nav-links a.active { color: var(--accent); text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.6); }

/* ── STATUS BADGE ── */
.status-badge-wrap { position: fixed; bottom: 2rem; right: 3rem; z-index: 90; }
.status-badge { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--mono); font-size: 12px; color: #4ade80; background: rgba(10, 10, 10, 0.7); backdrop-filter: blur(12px); border: 1px solid rgba(74, 222, 128, 0.25); padding: 0.6rem 1rem; border-radius: 100px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease; white-space: nowrap; }
.status-badge:hover { border-color: rgba(74, 222, 128, 0.5); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; animation: pulse 2s ease-in-out infinite; flex-shrink: 0; }
.status-extra { display: inline-block; max-width: 0; opacity: 0; overflow: hidden; vertical-align: bottom; transition: max-width 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease; }
.status-badge:hover .status-extra { max-width: 250px; opacity: 1; transition: max-width 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s ease 0.1s; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.8); } }

/* ── HERO ── */
#hero { min-height: 100vh; display: flex; align-items: center; padding: 8rem 3rem 4rem; position: relative; z-index: 1; }
.hero-inner { max-width: 900px; }
.hero-tag { font-family: var(--mono); font-size: 12px; color: var(--accent); letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.5rem; }
.hero-tag::before { content: ''; display: inline-block; width: 24px; height: 1px; background: var(--accent); }
h1 { font-family: var(--sans); font-size: clamp(3.5rem, 8vw, 6.5rem); font-weight: 800; line-height: 1.0; letter-spacing: -0.03em; margin-bottom: 1.5rem; }
h1 em { font-style: normal; color: var(--muted); }
.hero-desc { font-size: 1.2rem; color: var(--muted); max-width: 650px; margin-bottom: 2.5rem; line-height: 1.8; }
.hero-desc strong { color: var(--text); font-weight: 600; }
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; padding: 0.9rem 1.8rem; border-radius: 4px; transition: all 0.2s; border: none; }
.btn-primary { background: var(--accent); color: #0a0a0a; font-weight: 700; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.4); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-hover); }

/* ── SECTIONS ── */
section { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 6rem 3rem; position: relative; z-index: 1; }
.section-header { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 3.5rem; }
.section-num { font-family: var(--mono); font-size: 13px; color: var(--accent); letter-spacing: 0.1em; }
h2 { font-family: var(--sans); font-size: clamp(2.2rem, 4vw, 3.5rem); font-weight: 700; letter-spacing: -0.02em; }
.section-line { flex: 1; height: 1px; background: var(--border); max-width: 80px; }
.container { max-width: 1100px; margin: 0 auto; width: 100%; }

/* ── ABOUT ── */
#about .about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5rem; align-items: start; }
.about-text p { color: var(--muted); margin-bottom: 1.2rem; line-height: 1.9; font-size: 1.1rem; }
.about-text p strong { color: var(--text); }
.about-info { display: flex; flex-direction: column; gap: 0.8rem; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--border); font-size: 1rem; }
.info-label { font-family: var(--mono); font-size: 13px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.info-value { color: var(--text); }
.diploma-badge { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--mono); font-size: 12px; color: var(--accent); background: rgba(var(--accent-rgb), 0.08); border: 1px solid rgba(var(--accent-rgb), 0.2); padding: 0.3rem 0.7rem; border-radius: 4px; }

/* ── SKILLS ── */
#skills { background: var(--bg2); }
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.skill-card { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 2rem; transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s; }
.skill-card:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.1); }
.skill-icon { font-family: var(--mono); font-size: 13px; color: var(--accent); letter-spacing: 0.1em; margin-bottom: 1rem; opacity: 0.7; }
.skill-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 1.2rem; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.tag { font-family: var(--mono); font-size: 12px; color: var(--muted); background: rgba(255,255,255,0.04); border: 1px solid var(--border); padding: 0.3rem 0.6rem; border-radius: 3px; letter-spacing: 0.05em; }
.tag.highlight { color: var(--accent); background: rgba(var(--accent-rgb), 0.06); border-color: rgba(var(--accent-rgb), 0.2); }

/* ── PROJECTS ── */
.projects-list { display: flex; flex-direction: column; gap: 1.5rem; }
.project-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2rem; padding: 2rem 2.5rem; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--text); transition: border-color 0.3s, background 0.3s, box-shadow 0.3s; }
.project-card:hover { border-color: var(--accent); background: var(--bg3); box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.1); }
.project-num { font-family: var(--mono); font-size: 16px; color: var(--muted); min-width: 36px; }
.project-info h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.4rem; }
.project-info p { font-size: 1.05rem; color: var(--muted); }
.project-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.project-lang { font-family: var(--mono); font-size: 12px; color: var(--accent); letter-spacing: 0.05em; }
.project-arrow { color: var(--muted); font-size: 1.2rem; transition: transform 0.2s, color 0.2s, text-shadow 0.2s; }
.project-card:hover .project-arrow { transform: translateX(6px); color: var(--accent); text-shadow: 0 0 8px rgba(var(--accent-rgb), 0.5); }
.wip { font-family: var(--mono); font-size: 10px; color: #f59e0b; background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.2); padding: 0.2rem 0.5rem; border-radius: 3px; letter-spacing: 0.05em; text-transform: uppercase; }

/* ── DOCUMENTS ── */
.wip-banner { display: inline-flex; align-items: center; gap: 0.8rem; font-family: var(--mono); font-size: 13px; color: #f59e0b; background: rgba(245, 158, 11, 0.08); border: 1px dashed rgba(245, 158, 11, 0.4); padding: 0.8rem 1.2rem; border-radius: 4px; margin-bottom: 2.5rem; letter-spacing: 0.05em; }
.wip-icon { font-weight: bold; opacity: 0.8; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2rem; }
.doc-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 2rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; transition: border-color 0.3s, background 0.3s, box-shadow 0.3s; }
.doc-card:hover { border-color: var(--accent); background: var(--bg3); box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.1); }
.doc-info h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.5rem; }
.doc-info p { font-size: 1.05rem; color: var(--muted); line-height: 1.6; }
.doc-action { align-self: flex-start; }

/* ── CONTACT ── */
#contact { background: var(--bg2); }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; }
.contact-text h3 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 1rem; }
.contact-text p { color: var(--muted); font-size: 1.15rem; line-height: 1.8; margin-bottom: 2rem; }
.terminal { background: #0f0f0f; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.terminal-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.8rem 1rem; background: #161616; border-bottom: 1px solid var(--border); }
.t-dot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-body { padding: 1.5rem; font-family: var(--mono); font-size: 14px; line-height: 2; }
.t-prompt { color: var(--accent); }
.t-cmd { color: var(--text); }
.t-out { color: var(--muted); }
.t-val { color: var(--accent2); }
.t-gh-link { color: var(--accent2); text-decoration: none; border-bottom: 1px dashed rgba(var(--accent2-rgb), 0.35); transition: border-color 0.2s, color 0.2s, text-shadow 0.2s; }
.t-gh-link:hover { color: var(--accent2); border-bottom-color: rgba(var(--accent2-rgb), 0.75); text-shadow: 0 0 8px rgba(var(--accent2-rgb), 0.4); }
.t-cursor { display: inline-block; width: 8px; height: 16px; background: var(--accent); animation: blink 1s step-end infinite; vertical-align: middle; margin-left: 2px; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── FOOTER ── */
footer { padding: 2rem 3rem; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); position: relative; z-index: 1; }
footer p { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 0.05em; }

/* ── ANIMATIONS ── */
.fade-up { opacity: 0; transform: translateY(40px); transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1), transform 1s cubic-bezier(0.22, 1, 0.36, 1); }
.fade-up.visible { opacity: 1; transform: translateY(0); }
.fade-side { opacity: 0; transform: translateX(-60px); transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1), transform 1.2s cubic-bezier(0.22, 1, 0.36, 1); }
.fade-side.visible { opacity: 1; transform: translateX(0); }

/* ── THEME SWITCHER (MOBILE ONLY) ── */
.mobile-theme-switcher { display: none; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  html { scroll-snap-type: none; }
  section, #hero, footer { min-height: auto; }
  body, *, *::before, *::after { cursor: auto !important; }
  #c-dot, #c-ring, #c-trail { display: none !important; }

  nav { padding: 1rem 1.5rem; justify-content: center; }
  .nav-cmd-wrap { display: none; }
  .nav-links { gap: 1.2rem; }
  h1 { font-size: clamp(2.5rem, 12vw, 3.5rem); }
  
  /* Incrementato il padding in alto per fare spazio al badge assoluto */
  #hero { padding: 10rem 1.5rem 4rem; }
  section { padding: 4rem 1.5rem; }
  #about .about-grid, .skills-grid, .contact-grid { grid-template-columns: 1fr; gap: 2rem; }
  .project-card { grid-template-columns: auto 1fr; padding: 1.5rem; gap: 1rem; }
  .project-meta { display: none; }
  .terminal-body { overflow-x: auto; font-size: 13px; padding: 1.2rem; }
  footer { flex-direction: column; gap: 0.5rem; text-align: center; }
  
  /* Riposizionamento del badge per il mobile: non più fixed ma assoluto rispetto al documento */
  .status-badge-wrap {
    position: absolute;
    top: 100px;
    left: 1.5rem;
    right: auto;
    bottom: auto;
    transform: none !important;
  }
  .status-badge { font-size: 10px; padding: 0.5rem 0.8rem; display: inline-flex; }
  
  /* Nascondi l'indicatore testuale dello scroll */
  .section-indicator { display: none; }

  /* Mostra il selettore temi in basso a destra */
  .mobile-theme-switcher {
    display: flex;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    gap: 0.6rem;
    z-index: 90;
    background: rgba(10, 10, 10, 0.85);
    padding: 0.6rem;
    border-radius: 50px;
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  }
  
  .theme-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: var(--btn-color);
    cursor: pointer;
    transition: transform 0.2s;
  }
  
  .theme-btn:active {
    transform: scale(0.8);
  }
}

@media (hover: none) {
  *, *::before, *::after { cursor: auto !important; }
  #c-dot, #c-ring, #c-trail { display: none !important; }
}
