/* ============================================================
   CSS VARIABLES & RESET
============================================================ */
:root {
  --accent: #6db8e8;
  --accent-dim: rgba(109,184,232,0.15);
  --accent-glow: rgba(109,184,232,0.08);

  --bg: #0e0f11;
  --bg-alt: #111316;
  --bg-card: #13161a;
  --bg-glass: rgba(255,255,255,0.03);

  --text: #f0f0f0;
  --text-muted: rgba(240,240,240,0.45);
  --text-dim: rgba(240,240,240,0.22);

  --border: rgba(255,255,255,0.07);
  --border-accent: rgba(109,184,232,0.25);

  --radius: 2px;
  --radius-card: 6px;

  --transition: 0.4s cubic-bezier(0.25,0.46,0.45,0.94);
  --transition-fast: 0.2s ease;
}

[data-theme="light"] {
  --bg: #f4f3ef;
  --bg-alt: #eeede9;
  --bg-card: #e8e7e3;
  --bg-glass: rgba(0,0,0,0.03);

  --text: #0e0f11;
  --text-muted: rgba(14,15,17,0.5);
  --text-dim: rgba(14,15,17,0.25);

  --border: rgba(0,0,0,0.09);
  --border-accent: rgba(59,130,180,0.3);

  --accent: #2a86c8;
  --accent-dim: rgba(42,134,200,0.12);
  --accent-glow: rgba(42,134,200,0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  cursor: none;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

/* ============================================================
   CUSTOM CURSOR
============================================================ */
#cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.15s, height 0.15s, opacity 0.15s;
  mix-blend-mode: screen;
}

#cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(109,184,232,0.5);
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.35s cubic-bezier(0.25,0.46,0.45,0.94),
              height 0.35s cubic-bezier(0.25,0.46,0.45,0.94),
              border-color 0.3s;
}

[data-theme="light"] #cursor-dot {
  background: #000;
  mix-blend-mode: normal;
}

[data-theme="light"] #cursor-ring {
  border-color: rgba(0,0,0,0.45);
}

body.cursor-hover #cursor-dot {
  width: 4px; height: 4px;
  opacity: 0.5;
}

body.cursor-hover #cursor-ring {
  width: 48px; height: 48px;
  border-color: var(--accent);
}

/* ============================================================
   CANVAS BACKGROUND
============================================================ */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
}

/* ============================================================
   THEME TOGGLE
============================================================ */
#theme-toggle {
  position: fixed;
  top: 24px;
  right: 28px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: none;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 7px 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--transition);
}

#theme-toggle:hover {
  border-color: var(--border-accent);
  background: var(--accent-dim);
}

.toggle-track {
  width: 34px;
  height: 18px;
  border-radius: 10px;
  background: var(--border);
  position: relative;
  transition: background var(--transition);
}

[data-theme="light"] .toggle-track {
  background: var(--accent);
}

.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--transition), background var(--transition);
}

[data-theme="light"] .toggle-thumb {
  transform: translateX(16px);
  background: #fff;
}

.toggle-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  transition: color var(--transition);
}

/* ============================================================
   NAVBAR
============================================================ */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  padding: 0 48px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), background var(--transition);
}

nav.scrolled {
  border-color: var(--border);
  background: rgba(14,15,17,0.7);
}

[data-theme="light"] nav.scrolled {
  background: rgba(244,243,239,0.8);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: none;
}

.nav-logo-icon {
  width: 36px;
  height: 36px;
}

.nav-logo-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  transition: color var(--transition);
}

.nav-links {
  display: flex;
  gap: 36px;
  list-style: none;
}

.nav-links a {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  cursor: none;
  position: relative;
  transition: color var(--transition-fast);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width var(--transition);
}

.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { width: 100%; }

.lil-image {
  width: 30px;
  height: 30px;
  display: block;
}

/* ============================================================
   HERO
============================================================ */
#hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 48px 80px;
  overflow: hidden;
}

.hero-eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 56px;
  opacity: 0;
  animation: fadeUp 1s 0.3s forwards;
}

.hero-logo-wrap {
  margin-bottom: 60px;
  opacity: 0;
  animation: fadeScale 1.2s 0.5s cubic-bezier(0.25,0.46,0.45,0.94) forwards;
}

.hero-logo-svg {
  width: 140px;
  height: 140px;
  filter: drop-shadow(0 0 40px rgba(109,184,232,0.15));
}

.hero-headline {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(42px, 6vw, 84px);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
  max-width: 800px;
  margin-bottom: 24px;
  opacity: 0;
  animation: fadeUp 1s 0.8s forwards;
}

.hero-headline em {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(14px, 1.5vw, 17px);
  font-weight: 300;
  color: var(--text-muted);
  max-width: 500px;
  margin-bottom: 56px;
  line-height: 1.75;
  opacity: 0;
  animation: fadeUp 1s 1s forwards;
}

.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0;
  animation: fadeUp 1s 1.2s forwards;
}

.btn {
  display: inline-block;
  padding: 14px 32px;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--radius);
  cursor: none;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--accent);
  color: #0e0f11;
  border: 1px solid var(--accent);
}

.btn-primary:hover {
  background: transparent;
  color: var(--accent);
  box-shadow: 0 0 30px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.hero-scroll {
  position: absolute;
  bottom: 32px;
  right: 32px;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;

  opacity: 0;
  animation: fadeUp 1s 1.5s forwards;
}

.scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, transparent, var(--accent));
  animation: scrollPulse 2s ease-in-out infinite;
}

.scroll-label {
  font-family: 'Space Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}


.hero-logo-img {
  width: 180px;
  height: auto;
  display: block;
}

.logo-light {
  display: none;
}

[data-theme="light"] .logo-dark {
  display: none;
}

[data-theme="light"] .logo-light {
  display: block;
}

/* ============================================================
   SECTION BASE
============================================================ */
section {
  position: relative;
  z-index: 1;
  padding: 120px 48px;
}

.section-alt {
  background: var(--bg-alt);
}

.section-inner {
  max-width: 1160px;
  margin: 0 auto;
}

.section-tag {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
  display: block;
}

.section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(36px, 4vw, 58px);
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 60px;
}

.section-title em {
  font-style: italic;
  color: var(--accent);
}

/* ============================================================
   ABOUT
============================================================ */
.about .section-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 100px;
  align-items: center;
}

.about-left .section-title {
  margin-bottom: 28px;
}

.about-text {
  font-size: 15px;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.85;
  margin-bottom: 20px;
}

.about-text strong {
  color: var(--text);
  font-weight: 500;
}

.about-stat-row {
  display: flex;
  gap: 48px;
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}

.about-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.about-stat-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 44px;
  font-weight: 300;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.02em;
}

.about-stat-label {
  font-family: 'Space Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.about-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 28px 32px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.about-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}

.about-card:hover { border-color: var(--border-accent); }
.about-card:hover::before { opacity: 1; }

.about-card-icon {
  font-size: 20px;
  margin-bottom: 10px;
  display: block;
  opacity: 0.7;
}

.about-card h4 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 6px;
}

.about-card p {
  font-size: 13px;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ============================================================
   COMPETENZE
============================================================ */
.skills .skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--border);
}

.skill-item {
  background: var(--bg-card);
  padding: 40px 36px;
  transition: all var(--transition);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.skill-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-dim);
  opacity: 0;
  transition: opacity var(--transition);
}

.skill-item:hover { background: var(--bg-alt); }
.skill-item:hover::after { opacity: 1; }

.skill-number {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 20px;
  display: block;
  position: relative;
  z-index: 1;
}

.skill-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
  transition: color var(--transition);
}

.skill-item:hover .skill-name { color: var(--accent); }

.skill-desc {
  font-size: 13px;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.7;
  position: relative;
  z-index: 1;
}

/* ============================================================
   PORTFOLIO
============================================================ */
.portfolio .portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.portfolio-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: all var(--transition);
  cursor: none;
  position: relative;
}

.portfolio-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-4px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
}

.portfolio-thumb {
  aspect-ratio: 16/10;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.portfolio-thumb-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: opacity var(--transition);
}

.portfolio-thumb-icon {
  width: 40px;
  height: 2px;
  background: var(--text-muted);
}

.portfolio-thumb-icon::before,
.portfolio-thumb-icon::after {
  content: '';
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-muted);
  margin-bottom: 8px;
}

.portfolio-thumb-label {
  font-family: 'Space Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.portfolio-overlay {
  position: absolute;
  inset: 0;
  background: rgba(109,184,232,0.06);
  opacity: 0;
  transition: opacity var(--transition);
}

.portfolio-card:hover .portfolio-overlay { opacity: 1; }

.portfolio-body {
  padding: 24px;
}

.portfolio-cat {
  font-family: 'Space Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  display: block;
}

.portfolio-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 8px;
}

.portfolio-note {
  font-size: 12px;
  font-weight: 300;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-uc {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: 2px;
  font-family: 'Space Mono', monospace;
  font-size: 7px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ============================================================
   RICONOSCIMENTI
============================================================ */
.collab .collab-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.collab-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  min-height: 140px;
  transition: all var(--transition);
  cursor: none;
  background: var(--bg-card);
}

.collab-card:hover {
  border-color: var(--border-accent);
  background: var(--bg-alt);
}

.collab-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition);
}

.collab-card:hover .collab-placeholder { border-color: var(--accent); }

.collab-plus {
  font-size: 16px;
  color: var(--text-dim);
  line-height: 1;
  transition: color var(--transition);
}

.collab-card:hover .collab-plus { color: var(--accent); }

.collab-label {
  font-family: 'Space Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color var(--transition);
}

.collab-card:hover .collab-label { color: var(--text-muted); }

.collab-image {
  width: 100%;
  height: auto;
  overflow: hidden;
  border-radius: 16px;
  margin-bottom: 16px;
}

.collab-image img, .portfolio-thumb img{
  width: 100%;
  height: auto;
  display: block;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.collab-card:hover .collab-image img, .portfolio-card:hover img {
  opacity: 1;
}

/* ============================================================
   FOOTER
============================================================ */
footer {
  position: relative;
  z-index: 1;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 80px 48px 40px;
}

.footer-inner {
  max-width: 1160px;
  margin: 0 auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 60px;
  padding-bottom: 60px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.footer-brand .footer-logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.footer-logo-svg { width: 32px; height: 32px; }

.footer-brand-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.footer-tagline {
  font-size: 13px;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 280px;
}

.footer-col h5 {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-col ul a {
  font-size: 14px;
  font-weight: 300;
  color: var(--text-muted);
  text-decoration: none;
  cursor: none;
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-col ul a:hover { color: var(--text); }

.footer-col ul a span {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  color: var(--accent);
  opacity: 0.7;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-copy {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.footer-copy strong {
  color: var(--text-muted);
  font-weight: 400;
}

.footer-back {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  cursor: none;
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-back:hover { color: var(--accent); }

/* ============================================================
   DIVIDERS
============================================================ */
.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 30%, var(--border) 70%, transparent);
  margin: 0;
}

/* ============================================================
   ANIMATIONS
============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeScale {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(1); }
  50%       { opacity: 1;   transform: scaleY(1.1); }
}

.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.25,0.46,0.45,0.94),
              transform 0.8s cubic-bezier(0.25,0.46,0.45,0.94);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 960px) {
  nav { padding: 0 24px; }
  .nav-links { display: none; }
  section { padding: 80px 24px; }
  .about .section-inner { grid-template-columns: 1fr; gap: 60px; }
  .portfolio .portfolio-grid { grid-template-columns: 1fr 1fr; }
  .collab .collab-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-top { grid-template-columns: 1fr; gap: 40px; }
  footer { padding: 60px 24px 32px; }
  #theme-toggle { top: 16px; right: 16px; }
}

@media (max-width: 600px) {
  .portfolio .portfolio-grid { grid-template-columns: 1fr; }
  .collab .collab-grid { grid-template-columns: 1fr 1fr; }
  .about-stat-row { gap: 32px; }
  .hero-cta { flex-direction: column; align-items: center; }
  .footer-bottom { flex-direction: column; gap: 16px; text-align: center; }
}

@media (hover: none) and (pointer: coarse) {
  html,
  body,
  a,
  button,
  .btn,
  .portfolio-card,
  .about-card,
  .collab-card,
  .skill-item {
    cursor: auto !important;
  }

  #cursor-dot,
  #cursor-ring {
    display: none !important;
  }
}


/* ============================================================
   SCROLLBAR
============================================================ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
