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

:root {
  --bg:        #0a0a0a;
  --bg2:       #111111;
  --bg3:       #181818;
  --line:      #222222;
  --text:      #e8e4dc;
  --muted:     #666;
  --amber:     #e8a020;
  --amber2:    #f5c05a;
  --amber-dim: rgba(232,160,32,0.08);
  --red:       #c94f3a;
  --green:     #4a9c6e;
  --blue:      #3a6ec9;
  --purple:    #7c5cbf;
  --radius:    4px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── NOISE OVERLAY ── */
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='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 9999; opacity: .4;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--amber); border-radius: 2px; }

/* ── NAVBAR ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 48px;
  height: 64px;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--amber);
  letter-spacing: .05em;
  text-decoration: none;
}

.nav-links {
  display: flex; align-items: center; gap: 32px;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: color .2s;
}
.nav-links a:hover { color: var(--text); }

.nav-contacts {
  display: flex; gap: 12px; align-items: center;
}

.nav-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  transition: border-color .2s, color .2s;
  font-size: 16px;
}
.nav-icon:hover { border-color: var(--amber); color: var(--amber); }

/* Colore del link quando la sezione è attiva */
.nav-links a.active, 
.mobile-menu a.active {
  color: var(--amber) !important;
}

/* Rende il testo del contatto ambra quando ci passi sopra se è un link */
.contact-info-item a.ci-value:hover {
    color: var(--amber);
    transition: color 0.2s;
}

/* Assicura che le icone SVG nei contatti siano allineate */
.ci-icon svg {
    display: block;
}

.btn-contact {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 8px 16px;
  background: var(--amber);
  color: #0a0a0a;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  transition: background .2s;
}
.btn-contact:hover { background: var(--amber2); }


/* ── HERO ── */
#hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding-top: 64px;
}

.hero-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 80px 48px;
    border-right: 1px solid var(--line);
}

.hero-right {
    position: relative;
    overflow: hidden;
}

.hero-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 40% 20%;
    display: block;
    filter: grayscale(10%) contrast(1.02);
}
.hero-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--amber);
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 12px;
}
.hero-tag::before {
  content: '';
  display: block; width: 32px; height: 1px;
  background: var(--amber);
}

.hero-name {
  font-family: var(--font-head);
  font-size: clamp(52px, 6vw, 88px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--text);
  margin-bottom: 8px;
}

.hero-title {
  font-family: var(--font-head);
  font-size: clamp(18px, 2.5vw, 28px);
  font-weight: 600;
  color: var(--amber);
  margin-bottom: 32px;
}

.hero-desc {
  font-size: 15px;
  color: white;
  max-width: 420px;
  line-height: 1.8;
  margin-bottom: 48px;
}

.hero-cta {
  display: flex; gap: 16px; flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 14px 28px;
  background: var(--amber);
  color: #0a0a0a;
  border: none; border-radius: var(--radius);
  cursor: pointer; text-decoration: none;
  font-weight: 500;
  transition: background .2s, transform .15s;
}
.btn-primary:hover { background: var(--amber2); transform: translateY(-1px); }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 14px 28px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer; text-decoration: none;
  transition: border-color .2s, transform .15s;
}
.btn-secondary:hover { border-color: var(--text); transform: translateY(-1px); }

.hero-card {
  position: relative; z-index: 1;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  max-width: 380px;
}

.hero-card-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 20px;
}

/* ── STACK BAR ── */
.hero-stack-bar {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 24px 48px;
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
    background: var(--bg2);
}

.stack-bar-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--amber);
    letter-spacing: .12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.stack-bar-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.hero-stats-inline {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    border-left: 1px solid var(--line);
    padding-left: 32px;
}

.stat-inline {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
    #hero { grid-template-columns: 1fr; min-height: auto; }
    .hero-left { padding: 48px 24px; border-right: none; }
    .hero-right { height: 50vw; min-height: 280px; }
    .hero-stack-bar { padding: 20px 24px; gap: 16px; }
    .hero-stats-inline { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; width: 100%; }
}

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--muted);
  letter-spacing: .04em;
}
.tag.amber { border-color: rgba(232,160,32,.4); color: var(--amber); }

.hero-stat {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--muted); letter-spacing: .06em;
}
.stat-value {
  font-family: var(--font-head);
  font-size: 14px; color: var(--text); font-weight: 600;
}

section { border-top: 1px solid var(--line); }

.section-header {
  display: grid;
  grid-template-columns: 180px 1fr;
  border-bottom: 1px solid var(--line);
}

.section-num {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--amber);
  letter-spacing: .1em;
  padding: 24px 32px;
  border-right: 1px solid var(--line);
  display: flex; align-items: center;
}

.section-title {
  font-family: var(--font-head);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 800;
  padding: 24px 48px;
  letter-spacing: -.02em;
}

/* ── SKILLS ── */
#skills .skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  border-bottom: 1px solid var(--line);
}

.skill-item {
  padding: 32px 40px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: background .2s;
}
.skill-item:hover { background: var(--amber-dim); }

.skill-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}

.skill-name {
  font-family: var(--font-head);
  font-size: 16px; font-weight: 700;
}

.skill-pct {
  font-family: var(--font-mono);
  font-size: 12px; color: var(--amber);
}

.skill-bar {
  height: 2px;
  background: var(--line);
  border-radius: 1px;
  overflow: hidden;
}

.skill-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--amber2));
  border-radius: 1px;
  width: 0;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}

.skill-cat {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 8px;
}

/* ── PROJECTS ── */
#projects .projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.project-card {
  padding: 48px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  transition: background .2s;
  cursor: pointer;
}
.project-card:hover { background: var(--bg2); }

.project-card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 3px; height: 0;
  background: var(--amber);
  transition: height .3s;
}
.project-card:hover::before { height: 100%; }

.project-num {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--muted);
  letter-spacing: .1em;
  margin-bottom: 16px;
}

.project-title {
  font-family: var(--font-head);
  font-size: 22px; font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -.01em;
}

.project-desc {
  font-size: 14px; color: var(--muted);
  line-height: 1.7; margin-bottom: 24px;
}

.project-footer {
  display: flex; justify-content: space-between;
  align-items: center;
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
}
.status-done    { background: rgba(74,156,110,.15); color: var(--green); border: 1px solid rgba(74,156,110,.3); }
.status-dev     { background: rgba(58,110,201,.15); color: var(--blue);  border: 1px solid rgba(58,110,201,.3); }
.status-wip     { background: rgba(232,160,32,.12); color: var(--amber); border: 1px solid rgba(232,160,32,.3); }
.status-planned { background: rgba(124,92,191,.15); color: var(--purple);border: 1px solid rgba(124,92,191,.3); }

.project-tags {
  display: flex; gap: 6px; flex-wrap: wrap;
}

/* ── TIMELINE ── */
#percorso .timeline {
  padding: 64px 48px;
  max-width: 900px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 32px;
  padding-bottom: 56px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 160px;
  top: 8px; bottom: 0;
  width: 1px;
  background: var(--line);
}
.timeline-item:last-child::before { display: none; }

.timeline-date {
  font-family: var(--font-mono);
  font-size: 12px; color: var(--amber);
  letter-spacing: .05em;
  line-height: 1.4;
  padding-top: 6px;
}

.timeline-body { position: relative; padding-left: 32px; }

.timeline-body::before {
  content: '';
  position: absolute; left: -6px; top: 7px;
  width: 12px; height: 12px;
  border: 2px solid var(--amber);
  border-radius: 50%;
  background: var(--bg);
}

.timeline-org {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.timeline-role {
  font-family: var(--font-head);
  font-size: 20px; font-weight: 700;
  margin-bottom: 10px;
}

.timeline-desc {
  font-size: 14px; color: var(--muted); line-height: 1.7;
}

/* ── CONTACT ── */
.contact-section-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
}

.contact-left {
  padding: 64px 48px;
  border-right: 1px solid var(--line);
}

.contact-right {
  padding: 64px 48px;
}

.contact-intro {
  font-size: 14px; color: var(--muted);
  line-height: 1.8; margin-bottom: 40px;
}

.contact-info-item {
  display: flex; gap: 16px; align-items: flex-start;
  margin-bottom: 24px;
}

.ci-icon {
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  color: var(--amber);
}

.ci-label {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--muted);
  letter-spacing: .1em; text-transform: uppercase;
  margin-bottom: 4px;
}

.ci-value {
  font-size: 14px; color: var(--text);
}

/* ── FORM ── */
.form-group { margin-bottom: 20px; }

.form-label {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--muted);
  letter-spacing: .1em; text-transform: uppercase;
  display: block; margin-bottom: 8px;
}

.form-input, .form-textarea {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--amber);
}
.form-textarea { resize: vertical; min-height: 120px; }

.form-error {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--red);
  margin-top: 6px; display: none;
}

.form-success {
  display: none;
  background: rgba(74,156,110,.1);
  border: 1px solid rgba(74,156,110,.3);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--green);
  margin-top: 16px;
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--line);
  padding: 32px 48px;
  display: flex; justify-content: space-between; align-items: center;
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--muted);
  letter-spacing: .06em;
}

.footer-links {
  display: flex; gap: 24px;
}
.footer-links a {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--muted);
  text-decoration: underline; letter-spacing: .06em;
  transition: color .2s;
}
.footer-links a:hover { color: var(--amber); }

/* ── HAMBURGER / MOBILE MENU ── */
.hamburger {
  display: none;
  background: none; border: none;
  cursor: pointer; color: var(--text);
  font-size: 22px;
}

.mobile-menu {
  display: none;
  position: fixed; top: 64px; left: 0; right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 24px 32px;
  z-index: 99;
  flex-direction: column; gap: 16px;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  font-family: var(--font-mono);
  font-size: 13px; color: var(--muted);
  text-decoration: none; letter-spacing: .08em;
  text-transform: uppercase;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

/* ── ANIMATE ON SCROLL ── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  nav { padding: 0 24px; }
  .nav-links, .nav-contacts { display: none; }
  .hamburger { display: block; }

  #skills .skills-grid { grid-template-columns: 1fr 1fr; }
  .skill-item { padding: 24px; }

  #projects .projects-grid { grid-template-columns: 1fr; }
  .project-card { padding: 32px 24px; }

  .timeline-item { grid-template-columns: 100px 1fr; gap: 16px; }
  .timeline-item::before { left: 100px; }

  .contact-section-inner { grid-template-columns: 1fr; }
  .contact-left, .contact-right { padding: 40px 24px; }
  .contact-left { border-right: none; border-bottom: 1px solid var(--line); }

  footer { flex-direction: column; gap: 16px; text-align: center; }
  .section-header { grid-template-columns: 80px 1fr; }
}

@media (max-width: 600px) {
  #skills .skills-grid { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; }
  .timeline-item { grid-template-columns: 1fr; }
  .timeline-item::before { display: none; }
  .timeline-date { padding-top: 0; }
}

/* ── FIX OVERFLOW ORIZZONTALE MOBILE ── */
html, body { overflow-x: hidden; max-width: 100%; }
img, svg { max-width: 100%; }

/* le colonne grid possono restringersi sotto il min-content */
#hero,
.contact-section-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hero-left, .hero-right,
.contact-left, .contact-right { min-width: 0; }

/* griglia skills: mai più larga del contenitore */
#skills .skills-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
}

.ci-value { overflow-wrap: anywhere; }

@media (max-width: 900px) {
  #hero,
  .contact-section-inner { grid-template-columns: 1fr; }

  .hero-name {
    font-size: min(calc((100vw - 48px) / 7.5), 72px);
    white-space: nowrap; }

  .section-num { padding: 20px 16px; }
  .section-title { padding: 20px 24px; }
  #percorso .timeline { padding: 40px 24px; }
  .hero-desc { max-width: 100%; }
}

@media (max-width: 600px) {
  #skills .skills-grid { grid-template-columns: minmax(0, 1fr); }
}
