@font-face { font-family: "Inter"; src: url("fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --paper: #fbfaf7;
  --card: #ffffff;
  --ink: #1d1b1a;
  --text: #3a3633;
  --muted: #6f6a64;
  --rule: #e7e2da;
  --accent: #7a2e45;
  --accent-soft: #f5ecef;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --w: 1080px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--text); font: 400 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
b { color: var(--ink); font-weight: 600; }
::selection { background: #ecdde2; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 30; background: #fff; padding: .5rem 1rem; }
.print-only { display: none; }
.wrap { width: min(var(--w), 100% - 3rem); margin-inline: auto; }

/* Barra di navigazione */
.bar { position: sticky; top: 0; z-index: 20; background: rgba(251, 250, 247, .9); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.bar.is-scrolled { border-bottom-color: var(--rule); }
.bar__inner { width: min(var(--w), 100% - 3rem); margin-inline: auto; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.bar__name { font-family: var(--serif); font-size: 1.35rem; color: var(--ink); text-decoration: none; white-space: nowrap; opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s; }
.bar.is-scrolled .bar__name { opacity: 1; transform: none; }
.bar__nav { display: flex; align-items: center; gap: .25rem; }
.bar__nav a { text-decoration: none; font-size: .9rem; font-weight: 500; color: var(--muted); padding: .4rem .75rem; border-radius: 999px; transition: color .15s, background .15s; }
.bar__nav a:hover { color: var(--ink); }
.bar__nav a.is-active { color: var(--ink); background: #f0ece6; }
.bar__nav .bar__cta { color: var(--paper); background: var(--ink); margin-left: .5rem; }
.bar__nav .bar__cta:hover, .bar__nav .bar__cta.is-active { color: #fff; background: var(--accent); }

/* Pulsanti */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 2rem; }
.btn { display: inline-flex; align-items: center; font: inherit; font-weight: 500; font-size: .95rem; text-decoration: none; background: var(--ink); color: var(--paper); border: 1px solid var(--ink); border-radius: 999px; padding: .65rem 1.3rem; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--ghost { background: transparent; color: var(--ink); border-color: #cfc8be; }
.btn--ghost:hover { background: transparent; color: var(--ink); border-color: var(--ink); }

.mailbox { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; padding: .3rem .4rem .3rem 1.1rem; border: 1px solid var(--rule); background: var(--card); border-radius: 999px; animation: fade .2s ease; }
.mailbox a { font-weight: 600; color: var(--ink); text-decoration: none; word-break: break-all; }
.mailbox a:hover { color: var(--accent); }
.mailbox button { font: inherit; font-size: .82rem; color: var(--muted); background: var(--paper); border: 1px solid var(--rule); border-radius: 999px; padding: .3rem .8rem; cursor: pointer; }
.mailbox button:hover { color: var(--ink); border-color: var(--ink); }
@keyframes fade { from { opacity: 0; } }

/* Apertura */
.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(3rem, 7vw, 5rem); }
h1 { font-family: var(--serif); font-weight: 400; color: var(--ink); font-size: clamp(3.2rem, 7.5vw, 5.4rem); line-height: .98; letter-spacing: -.015em; }
.hero__role { margin-top: 1.1rem; font-size: clamp(1.1rem, 2vw, 1.3rem); font-weight: 600; color: var(--accent); }
.hero__lead { margin-top: 1.1rem; font-size: 1.1rem; line-height: 1.7; max-width: 34em; }

.summary { background: var(--card); border: 1px solid var(--rule); border-radius: 18px; padding: 1.6rem 1.7rem; box-shadow: 0 1px 2px rgba(29, 27, 26, .03), 0 12px 32px -12px rgba(29, 27, 26, .12); }
.summary__title { font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: .9rem; }
.summary dl > div { display: grid; grid-template-columns: 6.2rem minmax(0, 1fr); gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--rule); font-size: .93rem; line-height: 1.5; }
.summary dt { color: var(--muted); }
.summary dd { color: var(--text); }

/* Sezioni */
.section { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 2.5rem; padding: 3.5rem 0; border-top: 1px solid var(--rule); }
.section__head h2 { font-family: var(--serif); font-weight: 400; font-size: 2.1rem; line-height: 1.1; color: var(--ink); position: sticky; top: 92px; }
h3 { font-size: 1.05rem; font-weight: 600; color: var(--ink); line-height: 1.4; }

.prose { font-size: 1.08rem; line-height: 1.75; max-width: 40em; }
.prose p + p { margin-top: 1rem; }

.sectors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 2.2rem; }
.sectors li { background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: 1.2rem 1.25rem; display: flex; flex-direction: column; gap: .35rem; }
.sectors b { font-size: 1rem; }
.sectors span { font-size: .9rem; line-height: 1.5; }
.sectors small { margin-top: auto; padding-top: .5rem; font-size: .8rem; color: var(--muted); }

/* Linea del tempo */
.timeline { position: relative; }
.job { display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); gap: 2rem; position: relative; padding-bottom: 2.4rem; }
.job:last-child { padding-bottom: 0; }
.job__date { font-size: .9rem; color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; padding-top: .1rem; }
.job__date small { display: block; color: var(--muted); font-weight: 400; font-size: .82rem; margin-top: .1rem; }
.job__main { position: relative; padding-left: 1.8rem; border-left: 1px solid var(--rule); }
.job:last-child .job__main { border-left-color: transparent; }
.job__main::before { content: ""; position: absolute; left: -5px; top: .45rem; width: 9px; height: 9px; border-radius: 50%; background: var(--paper); border: 1.5px solid #b9b1a6; }
.job--current .job__main::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.job__badge { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: .15rem .55rem; border-radius: 4px; margin-bottom: .5rem; }
.job__org { font-weight: 500; color: var(--ink); margin-top: .1rem; }
.job__org span { font-weight: 400; color: var(--muted); }
.job__intro { margin-top: .6rem; color: var(--text); }
.job ul { margin-top: .8rem; }
.job ul li, .list li { position: relative; padding-left: 1.15rem; }
.job ul li + li { margin-top: .35rem; }
.job ul li::before, .list li::before { content: ""; position: absolute; left: 0; top: .78em; width: 6px; height: 1.5px; background: #b9b1a6; }
.job--short h3 { font-weight: 500; }
.job__role { margin-top: 1rem; font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.job__role + ul { margin-top: .4rem; }
.timeline--plain .job__main::before { display: none; }
.timeline--plain .job__main { border-left: 0; padding-left: 0; }

/* Competenze */
.skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.2rem 3rem; }
.skills h3, .extra h3 { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: .9rem; }
.regs > div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.regs > div:first-child { padding-top: 0; }
.regs dt { font-weight: 600; color: var(--ink); }
.regs dd { color: var(--muted); font-variant-numeric: tabular-nums; }
.list li + li { margin-top: .4rem; }

.extra { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 3rem; margin-top: 2.6rem; padding-top: 2rem; border-top: 1px dashed var(--rule); }

/* Contatti */
.contact__lead { font-family: var(--serif); font-size: clamp(1.6rem, 3.2vw, 2.2rem); line-height: 1.25; color: var(--ink); max-width: 20em; }
.contact .actions { margin-top: 1.6rem; }

.footer { padding: 2rem 0 3rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .8rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; }

/* Comparsa allo scorrimento */
.js .section { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.js .section.is-visible { opacity: 1; transform: none; }

/* Tablet */
@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .summary { max-width: 560px; }
  .section { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
  .section__head h2 { position: static; }
}
/* Telefono */
@media (max-width: 680px) {
  .wrap, .bar__inner { width: min(var(--w), 100% - 2.5rem); }
  .bar__name { display: none; }
  .bar__inner { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .bar__inner::-webkit-scrollbar { display: none; }
  .bar__nav { gap: 0; }
  .bar__nav a { white-space: nowrap; padding: .4rem .6rem; }
  .hero { padding-top: 2rem; }
  .hero__lead { font-size: 1.02rem; }
  .summary { padding: 1.2rem 1.25rem; }
  .summary dl > div { grid-template-columns: 5.2rem minmax(0, 1fr); gap: .8rem; }
  .section { padding: 2.6rem 0; }
  .section__head h2 { font-size: 1.85rem; }
  .sectors { grid-template-columns: minmax(0, 1fr); }
  .job { grid-template-columns: minmax(0, 1fr); gap: .3rem; }
  .job__date { padding-left: 1.8rem; }
  .job__date small { display: inline; margin-left: .4rem; }
  .job__date small::before { content: "· "; }
  .timeline--plain .job__date { padding-left: 0; }
  .job__main { border-left-color: var(--rule) !important; }
  .job:last-child .job__main { border-left-color: transparent !important; }
  .job__main::before { top: -1.55rem; }
  .skills, .extra { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
  .js .section { opacity: 1; transform: none; }
}

/* Stampa / PDF */
@media print {
  @page { size: A4; margin: 13mm 15mm; }
  * { animation: none !important; transition: none !important; }
  body { background: #fff; font-size: 8.8pt; line-height: 1.42; }
  .bar, .actions, .contact, .skip, .sectors, .footer p + p { display: none !important; }
  .js .section { opacity: 1 !important; transform: none !important; }
  .wrap { width: auto; }
  .print-only { display: block; }
  .print-contact { margin-top: 5pt; font-weight: 600; color: var(--ink); }
  .hero { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 8mm; padding: 0 0 8pt; align-items: start; }
  h1 { font-size: 30pt; }
  .hero__role { font-size: 11pt; margin-top: 5pt; }
  .hero__lead { font-size: 9pt; margin-top: 5pt; }
  .summary { box-shadow: none; padding: 7pt 9pt; border-radius: 6px; }
  .summary__title { margin-bottom: 3pt; font-size: 6.5pt; }
  .summary dl > div { grid-template-columns: 17mm minmax(0, 1fr); gap: 3mm; padding: 2.5pt 0; font-size: 7.8pt; line-height: 1.35; }
  .section { grid-template-columns: 26mm minmax(0, 1fr); gap: 5mm; padding: 8pt 0; }
  .section__head h2 { font-size: 15pt; position: static; }
  h3 { font-size: 9.3pt; }
  .prose { font-size: 8.8pt; line-height: 1.5; max-width: none; }
  .prose p + p { margin-top: 3pt; }
  .sectors { gap: 4pt; margin-top: 6pt; }
  .sectors li { padding: 5pt 6pt; border-radius: 5px; gap: 1pt; }
  .sectors span { font-size: 7.8pt; }
  .sectors small { font-size: 7pt; padding-top: 2pt; }
  main { display: flex; flex-direction: column; }
  .hero { order: 0; } #profilo { order: 1; } #competenze { order: 2; } #formazione { order: 3; } #esperienze { order: 4; break-before: page; border-top: 0; padding-top: 0; }
  #profilo .prose p:last-child { margin-bottom: 0; }
  .job { grid-template-columns: 29mm minmax(0, 1fr); gap: 4mm; padding-bottom: 6pt; break-inside: avoid; }
  .job__date span { white-space: nowrap; }
  .timeline--plain .job { grid-template-columns: 10mm minmax(0, 1fr); }
  .timeline--plain .job + .job { padding-top: 0; }
  .job__date { font-size: 8pt; }
  .job__date small { font-size: 7.5pt; }
  .job__main { padding-left: 4mm; }
  .job__badge { font-size: 6pt; margin-bottom: 2pt; padding: 0 3pt; }
  .job__intro { margin-top: 2pt; }
  .job ul { margin-top: 3pt; }
  .job__role { margin-top: 3pt; font-size: 6.8pt; }
  .job__role + ul { margin-top: 1pt; }
  .job ul li + li { margin-top: 0; }
  .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6pt 8mm; }
  .skills h3, .extra h3 { font-size: 6.8pt; margin-bottom: 3pt; }
  .regs > div { grid-template-columns: 18mm minmax(0, 1fr); gap: 2mm; padding: 1.5pt 0; }
  .list li + li { margin-top: 1pt; }
  .extra { margin-top: 6pt; padding-top: 6pt; gap: 8mm; }
  .footer { padding: 6pt 0 0; font-size: 6.8pt; }
}
