:root {
  --mocha: #432F2E;
  --custard: #FEEFB6;
  --sky: #C3DAE8;
}
* { box-sizing: border-box; }
html { scroll-behavior: auto; }
html.smooth-scroll { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--mocha);
  color: var(--custard);
}
h1, h2, h3, .logo, .lang-btn, .eyebrow, .btn, .proj-index, .proj-period,
.cert-date, .service-num, .edu-date, .tags span { font-family: 'Space Grotesk', sans-serif; }
a { text-decoration: none; }
::selection { background: var(--custard); color: var(--mocha); }

.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 72px; background: var(--mocha);
  border-bottom: 1px solid rgba(254,239,182,0.12);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px;
  transition: box-shadow 0.3s ease;
}
.nav.scrolled { box-shadow: 0 12px 28px -16px rgba(0,0,0,0.5); }
.logo { font-weight: 700; font-size: 25px; color: var(--custard); letter-spacing: -0.02em; }
.accent { color: var(--sky); }
.nav-links { display: flex; align-items: center; gap: 36px; }
.nav-links a { color: rgba(254,239,182,0.85); font-size: 14px; position: relative; padding-bottom: 4px; }
.nav-links a::after { content: ""; position: absolute; left: 0; bottom: 0; width: 0; height: 1px; background: var(--custard); transition: width 0.2s ease; }
.nav-links a:hover { color: var(--custard); }
.nav-links a:hover::after { width: 100%; }
.divider { width: 1px; height: 20px; background: rgba(254,239,182,0.2); }
.lang-btn {
  background: none; border: 1px solid rgba(254,239,182,0.35); color: var(--custard);
  border-radius: 20px; padding: 6px 14px; font-size: 12px; letter-spacing: 0.05em; cursor: pointer;
}
.lang-btn:hover { border-color: var(--custard); }

.hero {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  padding: 120px 40px 80px; max-width: 1200px; margin: 0 auto; position: relative;
  scroll-margin-top: 72px;
}
.eyebrow { color: var(--sky); font-size: 14px; letter-spacing: 0.25em; text-transform: uppercase; margin: 0 0 24px; }
.eyebrow.dark { color: rgba(67,47,46,0.55); letter-spacing: 0.2em; font-size: 13px; }
h1 { font-weight: 700; font-size: clamp(48px,8vw,108px); line-height: 0.98; letter-spacing: -0.03em; margin: 0; }
.hero-sub { max-width: 560px; font-size: 19px; line-height: 1.6; color: rgba(254,239,182,0.78); margin: 32px 0 44px; }
.hero-ctas { display: flex; gap: 18px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 16px 32px; border-radius: 100px; font-weight: 600; font-size: 15px; transition: all 0.2s ease; }
.btn-primary { background: var(--custard); color: var(--mocha); }
.btn-primary:hover { background: var(--sky); transform: translateY(-2px); }
.btn-outline { border: 1px solid rgba(254,239,182,0.4); color: var(--custard); }
.btn-outline:hover { border-color: var(--custard); background: rgba(254,239,182,0.06); }
.btn-dark { background: var(--mocha); color: var(--custard); }
.btn-dark:hover { background: var(--sky); color: var(--mocha); }

.about { background: var(--custard); color: var(--mocha); padding: 140px 40px; scroll-margin-top: 72px; }
.about-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 80px; align-items: start; }
.about h2 { font-weight: 700; font-size: clamp(32px,4vw,48px); line-height: 1.1; margin: 0 0 24px; letter-spacing: -0.02em; }
.badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.badges span { border: 1px solid rgba(67,47,46,0.25); border-radius: 100px; padding: 8px 16px; font-size: 13px; }
.body-text { font-size: 19px; line-height: 1.75; margin: 0 0 24px; color: rgba(67,47,46,0.85); }
.body-text.light { color: rgba(254,239,182,0.7); font-size: 16px; margin-bottom: 36px; }
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; border-top: 1px solid rgba(67,47,46,0.15); padding-top: 32px; margin-top: 32px; }
.edu-date { font-size: 13px; color: rgba(67,47,46,0.55); margin: 0 0 6px; }
.edu-degree { font-weight: 600; margin: 0 0 4px; font-size: 15px; }
.edu-school { margin: 0; font-size: 14px; color: rgba(67,47,46,0.7); }

.skills { background: var(--sky); color: var(--mocha); padding: 140px 40px; scroll-margin-top: 72px; }
.skills h2 { font-weight: 700; font-size: clamp(32px,4vw,48px); margin: 0 0 56px; letter-spacing: -0.02em; max-width: 700px; }
.certs-grid {
  max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(3,1fr); gap: 1px;
  background: rgba(67,47,46,0.18); border: 1px solid rgba(67,47,46,0.18); border-radius: 16px; overflow: hidden;
}
.cert-card { background: var(--sky); padding: 36px; transition: background 0.2s ease; }
.cert-card:hover { background: rgba(254,239,182,0.35); }
.cert-card-pending { border: 1px dashed rgba(67,47,46,0.4); background: transparent; }
.cert-card-pending:hover { background: rgba(254,239,182,0.2); }
.cert-date { font-size: 12px; color: rgba(67,47,46,0.55); margin: 0 0 14px; }
.cert-title { font-weight: 600; font-size: 17px; margin: 0 0 8px; line-height: 1.3; }
.cert-issuer { margin: 0; font-size: 14px; color: rgba(67,47,46,0.65); }

.projects { background: var(--mocha); color: var(--custard); padding: 140px 40px; scroll-margin-top: 72px; }
.projects h2 { font-weight: 700; font-size: clamp(32px,4vw,48px); margin: 0 0 64px; letter-spacing: -0.02em; max-width: 700px; }
.project-list { max-width: 1200px; margin: 0 auto; }
.project-row {
  display: grid; grid-template-columns: 60px 1fr auto; gap: 32px; align-items: start;
  padding: 36px 0; border-top: 1px solid rgba(254,239,182,0.15); transition: padding-left 0.25s ease;
}
.project-row:hover { padding-left: 16px; }
.proj-index { font-size: 14px; color: rgba(254,239,182,0.4); margin: 0; }
.project-row h3 { font-weight: 600; font-size: 26px; margin: 0 0 10px; letter-spacing: -0.01em; }
.project-row p { font-size: 16px; line-height: 1.6; color: rgba(254,239,182,0.7); margin: 0 0 14px; max-width: 620px; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tags span { font-size: 12px; color: var(--sky); border: 1px solid rgba(195,218,232,0.35); border-radius: 100px; padding: 4px 12px; }
.proj-period { font-size: 13px; color: rgba(254,239,182,0.45); margin: 0; white-space: nowrap; }


.proj-link {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 2px;
  background-image: linear-gradient(var(--sky), var(--sky));
  background-repeat: no-repeat;
  background-position: left bottom;
  background-size: 0% 2px;
  transition: background-size 0.3s ease, color 0.25s ease;
}
.proj-link::after {
  content: "↗";
  font-size: 0.55em;
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.proj-link:hover,
.proj-link:focus-visible {
  color: var(--sky);
  background-size: 100% 2px;
}
.proj-link:hover::after,
.proj-link:focus-visible::after {
  opacity: 1;
  transform: translate(0, 0);
}

.services { background: var(--custard); color: var(--mocha); padding: 140px 40px; scroll-margin-top: 72px; }
.services-head { max-width: 1200px; margin: 0 auto 56px; display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.services-head h2 { font-weight: 700; font-size: clamp(32px,4vw,48px); margin: 0; letter-spacing: -0.02em; max-width: 680px; }
.services-sub { max-width: 340px; font-size: 15px; line-height: 1.6; color: rgba(67,47,46,0.7); margin: 0; }
.services-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(3,1fr); gap: 28px; }
.service-card {
  background: var(--mocha); color: var(--custard); border-radius: 20px; padding: 36px;
  min-height: 260px; transition: transform 0.25s ease;
}
.service-card:hover { transform: translateY(-6px); }
.service-num { font-size: 34px; margin: 0 0 24px; color: var(--sky); }
.service-card h3 { font-weight: 600; font-size: 20px; margin: 0 0 12px; }
.service-card p { font-size: 14.5px; line-height: 1.6; color: rgba(254,239,182,0.7); margin: 0; }
.services-cta { text-align: center; margin-top: 48px; }

.cyber { background: var(--sky); color: var(--mocha); padding: 100px 40px; text-align: center; }
.cyber h2 { font-weight: 700; font-size: clamp(26px,3.2vw,38px); margin: 0 0 20px; letter-spacing: -0.01em; max-width: 900px; margin-left: auto; margin-right: auto; }
.cyber p { font-size: 17px; line-height: 1.7; color: rgba(67,47,46,0.75); margin: 0 auto; max-width: 640px; }

.contact { background: var(--mocha); color: var(--custard); padding: 140px 40px 100px; scroll-margin-top: 72px; }
.contact-grid { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 72px; }
.contact h2 { font-weight: 700; font-size: clamp(32px,4vw,46px); margin: 0 0 24px; letter-spacing: -0.02em; }
.contact-links { display: flex; flex-direction: column; gap: 14px; }
.contact-links a { color: var(--custard); font-size: 15px; border-bottom: 1px solid rgba(254,239,182,0.25); padding-bottom: 12px; }
.contact-links a:last-child { border-bottom: none; }
.contact-links a:hover { color: var(--sky); }

form { display: flex; flex-direction: column; gap: 20px; }
form label { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(254,239,182,0.6); }
form input, form textarea {
  width: 100%; background: none; border: none; border-bottom: 1px solid rgba(254,239,182,0.3);
  color: var(--custard); font-size: 17px; padding: 12px 0; margin-top: 6px; outline: none;
  font-family: 'Inter', sans-serif; resize: vertical;
}
form button {
  margin-top: 12px; background: var(--custard); color: var(--mocha); border: none;
  padding: 16px 32px; border-radius: 100px; font-weight: 600; font-size: 15px; cursor: pointer;
  align-self: flex-start; font-family: 'Space Grotesk', sans-serif;
}
form button:hover { background: var(--sky); }
.form-status { font-size: 14px; color: var(--sky); margin: 0; }

footer {
  background: var(--mocha); border-top: 1px solid rgba(254,239,182,0.12); padding: 32px 40px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  max-width: 1200px; margin: 0 auto; color: rgba(254,239,182,0.5); font-size: 13px;
}
footer p { margin: 0; }
.footer-right { display: flex; align-items: center; gap: 20px; }
.footer-right a { color: rgba(254,239,182,0.5); }
.footer-right a:hover { color: var(--custard); }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

@media (max-width: 900px) {
  .about-grid, .contact-grid { grid-template-columns: 1fr; gap: 48px; }
  .services-grid, .certs-grid { grid-template-columns: 1fr; }
  .nav-links { gap: 18px; }
  .nav-links a { font-size: 13px; }
  .project-row { grid-template-columns: 1fr; gap: 8px; }
}

/* --- Ottimizzazione per smartphone (iPhone e Android stretti) --- */
@media (max-width: 600px) {
  .nav { padding: 0 20px; }
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 12px; }
  .logo { font-size: 21px; }
  .lang-btn { padding: 5px 10px; font-size: 11px; }
  .divider { display: none; }

  .hero { padding: 100px 24px 60px; }
  .hero-sub { font-size: 16px; margin: 24px 0 32px; }
  .btn { padding: 14px 24px; font-size: 14px; }

  .about, .skills, .projects, .services, .contact { padding: 90px 24px; }
  .contact { padding-bottom: 70px; }
  .cyber { padding: 70px 24px; }

  .about h2, .skills h2, .projects h2, .services-head h2, .contact h2 { margin-bottom: 32px; }

  .edu-grid { grid-template-columns: 1fr; gap: 28px; }

  .cert-card { padding: 24px; }
  .service-card { padding: 28px; min-height: auto; }

  .project-row { padding: 28px 0; gap: 6px; }
  .project-row h3 { font-size: 22px; }
  .project-row p { font-size: 15px; }

  .services-head { gap: 16px; }
  .services-sub { max-width: 100%; }

  footer { padding: 24px 20px; flex-direction: column; align-items: flex-start; }
}