/* ============ Fonts (self-hosted, no external requests) ============ */
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 700 800;
  font-display: swap;
  src: url("assets/fonts/playfair-700.woff2") format("woff2");
}

/* ============ Design tokens ============ */
:root {
  --bg: #12151f;
  --bg-alt: #171b28;
  --surface: #1c2130;
  --surface-2: #232838;
  --border: rgba(255,255,255,.09);
  --text: #f3f4f8;
  --text-muted: #9aa1b4;
  --accent: #f5c518;
  --hero-grey: #222a35;
  --accent-dim: #f5c51826;
  --accent-contrast: #14151d;
  --shadow: 0 24px 60px -24px rgba(0,0,0,.55);
  --radius: 16px;
  --radius-sm: 10px;
  --max-width: 1160px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(.22,1,.36,1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 24px;
}

a { color: inherit; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 200;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ============ Header / Nav ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background .25s var(--ease), border-color .25s var(--ease), backdrop-filter .25s var(--ease);
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom-color: var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 72px;
}

.brand {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: .02em;
  text-decoration: none;
  margin-right: auto;
  color: var(--accent-contrast);
  transition: color .25s var(--ease);
}
.site-header.is-scrolled .brand { color: var(--text); }
.brand-dot { color: var(--accent-contrast); transition: color .25s var(--ease); }
.site-header.is-scrolled .brand-dot { color: var(--accent); }

.nav-menu {
  list-style: none;
  display: flex;
  gap: 30px;
  margin: 0;
  padding: 0;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: .92rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  position: relative;
  padding: 6px 0;
  transition: color .2s var(--ease);
}
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.nav-link:hover::before, .nav-link.active::before { opacity: 1; }

.nav-actions { display: flex; align-items: center; gap: 14px; }

.lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .03em;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.lang-toggle:hover { border-color: var(--accent); color: var(--accent); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle span {
  width: 18px;
  height: 2px;
  margin-inline: auto;
  background: var(--text);
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 4px;
  font-weight: 700;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-decoration: none;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 12px 26px -12px var(--accent-dim);
}
.btn-primary:hover { background: #ffd84d; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 10px 18px; font-size: .78rem; }

/* ============ Hero ============ */
.hero {
  position: relative;
  overflow: hidden;
  height: 520px;
  display: flex;
  align-items: flex-start;
  padding: 0;
  background: var(--hero-grey);
  clip-path: polygon(0 0, 100% 0, 100% 78%, 30% 92%, 0 78%);
}

.hero-deco {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(45% 55% at 85% 10%, rgba(245,197,24,.18), transparent 70%);
}

.hero-photo-stage {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(42vw, 460px);
  z-index: 1;
}

.hero-photo-block {
  position: absolute;
  top: 0;
  left: 0;
  width: min(32vw, 380px);
  height: 465px;
  background: var(--accent);
}

.hero-photo-wrap {
  position: absolute;
  top: 0;
  left: 44%;
  width: 78%;
  aspect-ratio: 1280 / 1698;
  z-index: 2;
}
.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  filter: drop-shadow(0 24px 26px rgba(0,0,0,.4));
}

.hero-inner {
  position: relative;
  z-index: 3;
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  padding-top: 60px;
}

.hero-copy { margin-left: min(46vw, 320px); max-width: 580px; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .76rem;
  color: var(--accent);
  margin: 0 0 8px;
  font-weight: 700;
}

.hero-title {
  margin: 0 0 10px;
  line-height: .95;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.hero-title-solid {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  color: var(--accent);
}
.hero-title-outline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 5.4vw, 4.2rem);
  color: transparent;
  -webkit-text-stroke: 1.5px var(--text);
  letter-spacing: .01em;
}

.hero-role {
  font-size: clamp(.95rem, 1.4vw, 1.1rem);
  color: var(--text);
  margin: 0 0 14px;
  font-weight: 600;
  line-height: 1.35;
}

.hero-lede {
  color: var(--text-muted);
  max-width: 460px;
  margin: 0 0 24px;
  font-size: .92rem;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-social {
  display: flex;
  flex-direction: column;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
  align-self: center;
}
.hero-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.hero-social a svg { width: 17px; height: 17px; }
.hero-social a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ============ Sections ============ */
.section { padding: 100px 0; }
.section-alt { background: var(--bg-alt); }

.section-kicker {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .78rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 10px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.6vw, 2.4rem);
  font-weight: 700;
  margin: 0 0 40px;
}
.section-title--tight { margin-bottom: 0; }

.section-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 36px;
}

/* ---- Servizi ---- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px 40px;
}
.service-icon {
  width: 34px;
  height: 34px;
  color: var(--accent);
  margin-bottom: 16px;
}
.service-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 8px;
}
.service-card p {
  color: var(--text-muted);
  font-size: .92rem;
  margin: 0;
}

/* ---- Job carousel ---- */
.carousel-nav { display: flex; gap: 10px; flex-shrink: 0; }
.carousel-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}
.carousel-btn svg { width: 18px; height: 18px; }
.carousel-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

.job-carousel {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.job-card {
  position: relative;
  flex: 0 0 clamp(260px, 32vw, 340px);
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  overflow: hidden;
}
.job-index {
  position: absolute;
  top: 8px;
  right: 16px;
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--text);
  opacity: .06;
  line-height: 1;
}
.job-date {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}
.job-role { margin: 0 0 4px; font-size: 1.1rem; font-weight: 700; }
.job-role a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--accent); }
.job-role a:hover { color: var(--accent); }
.job-org { margin: 0 0 14px; color: var(--text-muted); font-weight: 500; font-size: .92rem; }
.job-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: .88rem;
}
.job-list li { margin-bottom: 6px; }

/* ---- Profilo / Resume tabs ---- */
.resume-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}
.resume-lede { color: var(--text-muted); max-width: 560px; margin: 0; }

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 12px 20px;
  cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.tab-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.tab-btn:hover { color: var(--text); }
.tab-btn.is-active { color: var(--accent-contrast); background: var(--accent); }

.resume-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  align-items: start;
}

.resume-stats {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.stat { text-align: left; }
.stat-icon { width: 30px; height: 30px; color: var(--accent); margin-bottom: 10px; display: block; }
.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text);
}
.stat-label { font-size: .82rem; color: var(--text-muted); }

.tab-panel p { color: var(--text-muted); }
.tab-panel p strong { color: var(--text); }
.signature {
  font-family: "Brush Script MT", cursive;
  font-size: 1.8rem;
  color: var(--accent);
  margin-top: 24px !important;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.skill-group h4 {
  font-size: .88rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text);
  margin: 0 0 12px;
}
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: .8rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: .95rem;
  color: var(--text-muted);
}
.plain-list li:last-child { border-bottom: none; }
.plain-list strong { color: var(--text); }
.muted { color: var(--text-muted); font-size: .85rem; }

.cert-list { list-style: none; margin: 0; padding: 0; }
.cert-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: .92rem;
}
.cert-list li:last-child { border-bottom: none; }
.cert-year { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Clienti ---- */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.clients-grid span {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 700;
  font-size: .88rem;
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.clients-grid span:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Hobby ---- */
.hobby-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.hobby-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.hobby-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.hobby-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  background: var(--accent-dim);
  color: var(--accent);
}
.hobby-icon svg { width: 26px; height: 26px; }
.hobby-card h3 { margin: 0 0 10px; font-size: 1.15rem; font-weight: 700; }
.hobby-card p { margin: 0; color: var(--text-muted); }
.hobby-card a { color: var(--accent); text-decoration: none; font-weight: 600; }
.hobby-card a:hover { text-decoration: underline; }
.hobby-card > a { display: inline-block; margin-top: 14px; }

.personal-projects-grid { grid-template-columns: repeat(3, 1fr); }
.project-placeholder { opacity: .8; border-style: dashed; }
.badge-soon {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}

/* ---- Articoli Nerdando ---- */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.article-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 22px;
  text-decoration: none;
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.article-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.article-tag {
  align-self: flex-start;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent-contrast);
  background: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
}
.article-card h3 {
  font-size: .96rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.35;
}
.article-date {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* ---- Contatti ---- */
.contact-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: start;
}
.contact-lede { color: var(--text-muted); margin: 0 0 24px; }
.contact-form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.field input, .field textarea {
  font-family: inherit;
  font-size: .95rem;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.contact-form .btn { align-self: flex-start; }
.form-note { font-size: .78rem; color: var(--text-muted); margin: 0; }

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.contact-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.contact-link:hover { border-color: var(--accent); transform: translateX(4px); }
.contact-static:hover { transform: none; border-color: var(--border); cursor: default; }
.contact-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.contact-value { font-weight: 700; }

/* ============ Footer ============ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: .85rem;
  color: var(--text-muted);
}
.footer-inner p { margin: 0; }

/* ============ Reveal on scroll ============ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-0 { transition-delay: 0ms; }
.reveal-delay-1 { transition-delay: 60ms; }
.reveal-delay-2 { transition-delay: 120ms; }
.reveal-delay-3 { transition-delay: 180ms; }
.reveal-delay-4 { transition-delay: 240ms; }
.reveal-delay-5 { transition-delay: 300ms; }

/* ============ Responsive ============ */
@media (max-width: 980px) {
  .hero { height: 560px; }
  .hero-photo-stage { width: 38vw; }
  .hero-photo-block { width: 28vw; height: 400px; }
  .hero-copy { margin-left: min(50vw, 460px); max-width: 480px; }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .skills-grid { grid-template-columns: 1fr; }
  .clients-grid { grid-template-columns: repeat(3, 1fr); }
  .articles-grid { grid-template-columns: repeat(2, 1fr); }
  .personal-projects-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr; }
  .resume-body { grid-template-columns: 1fr; }
  .resume-stats { flex-direction: row; flex-wrap: wrap; gap: 20px; }
  .resume-stats .stat { flex: 1 1 140px; }
}

@media (max-width: 680px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s var(--ease);
  }
  .nav-menu.open { max-height: 320px; }
  .nav-menu li { border-top: 1px solid var(--border); }
  .nav-link { display: block; padding: 16px 24px; }
  .nav-link::before { display: none; }

  .hero {
    clip-path: polygon(0 0, 100% 0, 100% 97%, 35% 99%, 0 97%);
    height: 230px;
  }
  .hero-photo-stage { width: 44vw; }
  .hero-photo-block { width: 34vw; height: 218px; }
  .hero-photo-wrap { top: auto; left: 0; bottom: 0; width: 113%; }
  .hero-inner { flex-wrap: wrap; padding-top: 12px; }
  .hero-copy { margin-left: min(48vw, 165px); max-width: 100%; }
  .hero-title-solid { font-size: 1.2rem; }
  .hero-title-outline { font-size: 2.1rem; }
  .hero-role { font-size: .8rem; margin-bottom: 12px; }
  .hero-lede { display: none; }
  .hero-actions .btn-ghost { display: none; }
  .hero-actions .btn { padding: 9px 14px; font-size: .72rem; }
  .hero-social { display: none; }

  .services-grid { grid-template-columns: 1fr; }
  .clients-grid { grid-template-columns: repeat(2, 1fr); }
  .hobby-grid { grid-template-columns: 1fr; }
  .articles-grid { grid-template-columns: 1fr; }
  .section-head-row { flex-direction: column; align-items: flex-start; }
  .section { padding: 72px 0; }
}
