/* ============ Tokens ============ */
:root {
  --bg: #0b0f0c;
  --bg-2: #0f1612;
  --surface: #131b16;
  --surface-2: #182219;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8efe9;
  --text-muted: #9aa9a0;
  --accent: #2fbf71;
  --accent-2: #6ee7a3;
  --accent-deep: #0f4d0f;
  --accent-glow: rgba(47, 191, 113, 0.35);
  --gradient: linear-gradient(135deg, #2fbf71 0%, #6ee7a3 100%);
  --radius: 18px;
  --radius-sm: 10px;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 8px 40px rgba(47, 191, 113, 0.18);
  --max: 1200px;
  --pad: clamp(1rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.muted { color: var(--text-muted); }
.accent { color: var(--accent); }

/* ============ Decorative background ============ */
.bg-grid {
  position: fixed; inset: 0; z-index: -2;
  background-image:
    linear-gradient(rgba(47, 191, 113, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 191, 113, 0.05) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at top, black 30%, transparent 70%);
}
.bg-blob {
  position: fixed; z-index: -1;
  width: 600px; height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  pointer-events: none;
}
.blob-1 { background: var(--accent); top: -200px; right: -150px; }
.blob-2 { background: #1a8a4f; bottom: -250px; left: -200px; }

/* ============ Nav ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem var(--pad);
  background: rgba(11, 15, 12, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 1.1rem;
  display: flex; align-items: center; gap: .5rem;
}
.nav-brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.nav-links {
  list-style: none; display: flex; gap: 1.75rem;
  align-items: center;
}
.nav-links a {
  font-size: .92rem; font-weight: 500;
  color: var(--text-muted);
  transition: color .2s;
  position: relative;
}
.nav-links a:hover { color: var(--text); }
.nav-links .nav-cta {
  padding: .55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.nav-links .nav-cta:hover { border-color: var(--accent); color: var(--accent); }
.nav-links .nav-cta.active { background: var(--accent); color: #042312; border-color: var(--accent); }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; flex-direction: column; gap: 5px; padding: 8px; }
.nav-toggle span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: .25s; }

/* ============ Hero ============ */
.hero {
  padding: 4rem var(--pad) 6rem;
  max-width: var(--max);
  margin: 0 auto;
  position: relative;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 4rem;
  align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: .8rem; font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: .4rem .9rem;
  border: 1px solid rgba(47, 191, 113, 0.3);
  border-radius: 999px;
  background: rgba(47, 191, 113, 0.08);
  margin-bottom: 1.5rem;
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 191, 113, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(47, 191, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 191, 113, 0); }
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}
.hero h1 .accent {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.birthdate {
  font-family: 'JetBrains Mono', monospace;
  font-size: .9rem;
  color: var(--accent);
  letter-spacing: .05em;
  margin-bottom: 1.1rem;
}
.tagline {
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 1rem;
}
.lede {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 56ch;
  margin-bottom: 2rem;
}

.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .85rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .95rem;
  transition: transform .2s, box-shadow .2s, background .2s, color .2s;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--gradient);
  color: #042312;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 50px rgba(47, 191, 113, 0.35); }
.btn-ghost {
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.big { padding: 1.05rem 2.2rem; font-size: 1.05rem; }

.hero-meta {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem 1.5rem;
  font-size: .92rem;
  color: var(--text-muted);
}
.hero-meta li { display: flex; align-items: center; gap: .6rem; }
.hero-meta li.full { grid-column: 1 / -1; }
.hero-meta .ico {
  display: inline-flex; width: 26px; height: 26px;
  align-items: center; justify-content: center;
  border-radius: 8px;
  background: rgba(47, 191, 113, 0.1);
  color: var(--accent);
  font-size: .8rem;
  font-family: 'JetBrains Mono', monospace;
}
.hero-meta a:hover { color: var(--accent); }

/* Photo */
.hero-photo { position: relative; display: flex; justify-content: center; align-items: center; }
.photo-frame {
  position: relative;
  width: 320px; height: 320px;
  border-radius: 50%;
  padding: 6px;
  background: var(--gradient);
  box-shadow: var(--shadow-glow);
}
.photo-frame img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg);
}
.ring {
  position: absolute; inset: -20px;
  border: 1px dashed rgba(47, 191, 113, 0.4);
  border-radius: 50%;
  animation: spin 30s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.badge {
  position: absolute;
  padding: .55rem 1rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: .82rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  box-shadow: var(--shadow-soft);
  animation: float 4s ease-in-out infinite;
}
.badge-1 { top: 10%; left: -10px; animation-delay: 0s; }
.badge-2 { bottom: 18%; right: -20px; animation-delay: 1.3s; color: var(--accent); border-color: rgba(47,191,113,.4); }
.badge-3 { bottom: -5px; left: 30%; animation-delay: 2.6s; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.scroll-cue {
  display: block; text-align: center;
  margin-top: 3rem;
  color: var(--text-muted);
  font-size: 1.5rem;
  animation: bounce 2s infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* ============ Sections ============ */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 5rem var(--pad);
}
.section-head {
  margin-bottom: 3rem;
}
.kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: .85rem;
  color: var(--accent);
  letter-spacing: .12em;
  text-transform: uppercase;
  display: block;
  margin-bottom: .6rem;
}
.section h2 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  position: relative;
  display: inline-block;
}
.section h2::after {
  content: '';
  position: absolute;
  bottom: -8px; left: 0;
  width: 60px; height: 3px;
  background: var(--gradient);
  border-radius: 2px;
}

/* ============ About ============ */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: transform .25s, border-color .25s, background .25s;
}
.about-card:hover {
  transform: translateY(-4px);
  border-color: rgba(47, 191, 113, 0.4);
  background: var(--surface-2);
}
.about-card h3 {
  font-size: 1.1rem;
  margin-bottom: .75rem;
  color: var(--accent-2);
}
.about-card p { color: var(--text-muted); font-size: .95rem; }
.about-card .data {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  font-size: 1.1rem;
}

/* ============ Timeline ============ */
.timeline {
  list-style: none;
  position: relative;
  padding-left: 2rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), transparent);
}
.t-item { position: relative; margin-bottom: 2rem; }
.t-dot {
  position: absolute; left: -2rem; top: 1.5rem;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 4px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
}
.t-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: transform .25s, border-color .25s;
}
.t-card:hover { transform: translateX(6px); border-color: rgba(47, 191, 113, 0.4); }
.t-head {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: .5rem;
  margin-bottom: .35rem;
}
.t-head h3 { font-size: 1.2rem; }
.t-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: .82rem;
  color: var(--accent);
  background: rgba(47, 191, 113, 0.1);
  padding: .25rem .7rem;
  border-radius: 999px;
}
.t-org { color: var(--text-muted); font-size: .92rem; margin-bottom: .75rem; }
.t-card p:last-child { color: var(--text-muted); }

/* ============ Education ============ */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.edu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  position: relative;
  transition: transform .25s, border-color .25s;
}
.edu-card:hover { transform: translateY(-4px); border-color: rgba(47, 191, 113, 0.4); }
.edu-card.highlight {
  border-color: rgba(47, 191, 113, 0.5);
  background: linear-gradient(180deg, rgba(47, 191, 113, 0.08), var(--surface));
}
.edu-tag {
  position: absolute; top: 1rem; right: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: .7rem;
  background: var(--accent);
  color: #042312;
  padding: .25rem .6rem;
  border-radius: 999px;
  font-weight: 600;
}
.edu-card h3 { font-size: 1.15rem; margin-bottom: .25rem; }
.edu-sub { color: var(--accent-2); font-weight: 500; margin-bottom: .8rem; }
.edu-org { color: var(--text-muted); font-size: .92rem; margin-bottom: .25rem; }
.edu-date { font-family: 'JetBrains Mono', monospace; font-size: .82rem; color: var(--text-muted); }

/* ============ Skills ============ */
.skills-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.skills-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.skills-block:last-child { grid-column: 1 / -1; }
.block-title {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 1.2rem;
  font-weight: 600;
}
.chips { display: flex; flex-wrap: wrap; gap: .55rem; }
.chip {
  display: inline-flex; align-items: center;
  padding: .5rem 1rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: .88rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all .2s;
}
.chip:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.chip-strong {
  background: rgba(47, 191, 113, 0.12);
  color: var(--accent-2);
  border-color: rgba(47, 191, 113, 0.3);
  font-family: 'JetBrains Mono', monospace;
}
.chip-accent {
  background: linear-gradient(135deg, rgba(47, 191, 113, 0.15), rgba(110, 231, 163, 0.05));
  color: var(--text);
  border-color: rgba(47, 191, 113, 0.25);
}

.lang-list { list-style: none; display: flex; flex-direction: column; gap: 1.2rem; }
.lang-list li {
  display: grid;
  grid-template-columns: 130px 1fr 130px;
  gap: 1rem;
  align-items: center;
}
.lang-name { font-weight: 600; }
.lang-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.lang-bar span {
  display: block;
  height: 100%;
  width: var(--lvl);
  background: var(--gradient);
  border-radius: 999px;
}
.lang-level {
  font-family: 'JetBrains Mono', monospace;
  font-size: .82rem;
  color: var(--text-muted);
  text-align: right;
}

/* ============ More section ============ */
.more-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.more-col.full { grid-column: 1 / -1; }
.award-list { list-style: none; display: flex; flex-direction: column; gap: .7rem; }
.award-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: .9rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: .95rem;
}
.section-lede {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 62ch;
  margin-top: 1rem;
}
.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.act-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  transition: border-color .25s, transform .25s;
}
.act-card:hover { border-color: rgba(47, 191, 113, 0.4); transform: translateY(-3px); }
.act-card h4 { font-size: 1rem; margin-bottom: .35rem; }
.act-card .act-org {
  font-family: 'JetBrains Mono', monospace;
  font-size: .8rem;
  color: var(--accent);
  margin-bottom: .5rem;
}
.act-card p:last-child { color: var(--text-muted); font-size: .9rem; }

/* Larger activity cards (top-level Altre attività section) */
.act-card-lg {
  position: relative;
  padding: 1.6rem 1.7rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  overflow: hidden;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.act-card-lg::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gradient);
  opacity: .6;
  transition: opacity .25s, width .25s;
}
.act-card-lg:hover {
  transform: translateY(-4px);
  border-color: rgba(47, 191, 113, 0.4);
  box-shadow: var(--shadow-glow);
}
.act-card-lg:hover::before { opacity: 1; width: 5px; }
.act-card-lg.featured {
  background: linear-gradient(180deg, rgba(47, 191, 113, 0.08), var(--surface));
  border-color: rgba(47, 191, 113, 0.35);
}
.act-card-lg .act-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .15rem;
}
.act-card-lg .act-head h3 {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.act-card-lg .act-org {
  font-family: 'JetBrains Mono', monospace;
  font-size: .82rem;
  color: var(--accent);
  margin: 0;
}
.act-card-lg .act-desc {
  color: var(--text-muted);
  font-size: .94rem;
  flex: 1;
}
.act-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .25rem;
}
.act-tags li {
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  padding: .25rem .65rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
}

/* ============ CTA ============ */
.cta-section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 4rem var(--pad);
}
.cta-card {
  background: linear-gradient(135deg, rgba(47, 191, 113, 0.12), rgba(15, 77, 15, 0.08));
  border: 1px solid rgba(47, 191, 113, 0.3);
  border-radius: 24px;
  padding: clamp(2rem, 5vw, 4rem);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(47, 191, 113, 0.15), transparent 60%);
  pointer-events: none;
}
.cta-card h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  margin-bottom: .8rem;
  position: relative;
}
.cta-card p { color: var(--text-muted); margin-bottom: 1.8rem; position: relative; }
.cta-card .btn { position: relative; }

/* ============ Projects page ============ */
.proj-hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 4rem var(--pad) 2rem;
  text-align: center;
}
.proj-hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 1rem 0;
}
.proj-hero h1 .accent {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.proj-hero .lede { max-width: 60ch; margin: 0 auto; color: var(--text-muted); }

.proj-main { padding-bottom: 3rem; }

.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
}
.proj-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  position: relative;
  transition: transform .25s, border-color .25s, box-shadow .25s;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 240px;
}
.proj-card:hover {
  transform: translateY(-6px);
  border-color: rgba(47, 191, 113, 0.4);
  box-shadow: var(--shadow-glow);
}
.proj-card.placeholder {
  border-style: dashed;
  background: linear-gradient(180deg, var(--surface), transparent);
}
.proj-card.muted-card { opacity: .85; }

.proj-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: .3rem .7rem;
  border-radius: 999px;
  align-self: flex-start;
}
.status-active {
  background: rgba(47, 191, 113, 0.15);
  color: var(--accent-2);
  border: 1px solid rgba(47, 191, 113, 0.3);
}
.status-planned {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.proj-card h3 { font-size: 1.2rem; }
.proj-desc { color: var(--text-muted); font-size: .94rem; flex: 1; }
.proj-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: .75rem;
  padding: .25rem .65rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
}
.proj-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: .8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: .75rem;
}

/* ============ Footer ============ */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 2rem var(--pad);
}
.foot-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .88rem;
  color: var(--text-muted);
}

/* ============ Reveal animation ============ */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 3rem; text-align: center; }
  .hero-meta { grid-template-columns: 1fr; justify-items: center; }
  .hero-meta li { justify-content: center; }
  .hero-cta { justify-content: center; }
  .photo-frame { width: 240px; height: 240px; }
  .skills-wrap { grid-template-columns: 1fr; }
  .more-grid { grid-template-columns: 1fr; }
  .lang-list li { grid-template-columns: 100px 1fr 90px; }

  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem;
    gap: 1rem;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: .25s;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
}

@media (max-width: 520px) {
  .lang-list li { grid-template-columns: 1fr; gap: .35rem; }
  .lang-level { text-align: left; }
  .badge { font-size: .72rem; padding: .4rem .7rem; }
  .badge-1 { left: 0; top: 0; }
  .badge-2 { right: 0; }
}
