:root {
  --ink: #152a3b;
  --blue: #2154dc;
  --blue-dark: #163da7;
  --muted: #4c5d6c;
  --paper: #fafbf8;
  --line: #d6dfe5;
  --panel: #eef2f5;
  --white: #fff;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6.5rem;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
}

a { color: var(--blue-dark); text-underline-offset: .24em; }
a:focus-visible { outline: 3px solid #c67c07; outline-offset: 4px; }

h1, h2, h3 {
  font-weight: 750;
  letter-spacing: -.04em;
  line-height: 1.12;
}

h1 { font-size: clamp(2.8rem, 7vw, 6.15rem); margin: 0 0 .85rem; }
h2 { font-size: clamp(2.15rem, 4.1vw, 3.5rem); margin: 0 0 1.75rem; }
h3 { font-size: 1.35rem; margin: 0 0 .55rem; }
p { margin: 0; color: var(--muted); }
img { display: block; max-width: 100%; }

.container {
  width: min(100% - 3rem, 70rem);
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  inset: .75rem auto auto .75rem;
  transform: translateY(-200%);
  padding: .7rem 1rem;
  z-index: 2;
  background: var(--white);
}

.skip-link:focus { transform: none; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.navigation, .footer-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  padding: .15rem .5rem;
  border-radius: .5rem;
  background: var(--blue);
  color: var(--white);
}

.nav-links, .profile-links, .technologies {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a { color: var(--ink); font-size: .94rem; font-weight: 650; text-decoration: none; }
.nav-links a:hover { text-decoration: underline; }

.hero { padding-block: clamp(3.25rem, 7.5vw, 6.75rem); }

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
}

.availability {
  width: fit-content;
  margin-bottom: 1.3rem;
  padding: .3rem .8rem;
  border: 1px solid #c1ddce;
  border-radius: 1rem;
  background: #eaf5ed;
  color: #20543a;
  font-size: .94rem;
  font-weight: 700;
}

.hero-role { color: var(--blue-dark); font-size: clamp(1.1rem, 2.6vw, 1.65rem); font-weight: 700; }
.hero-copy { max-width: 34rem; margin-block: .85rem 1.5rem; font-size: 1.08rem; }

.actions { display: flex; flex-wrap: wrap; gap: .7rem; }

.button {
  display: inline-block;
  padding: .7rem 1rem;
  border: 1px solid transparent;
  border-radius: .55rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.button-primary { background: var(--blue); color: var(--white); }
.button-primary:hover { background: var(--blue-dark); }
.button-outline { border-color: #9eacb6; color: var(--ink); }
.button-outline:hover { background: var(--panel); }

.portrait {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: #e1e9ed;
}

.portrait img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1.05;
  object-fit: cover;
  object-position: center 28%;
}

.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
#competenze { border-top: 1px solid var(--line); }

.skills-grid, .projects-grid { display: grid; gap: 1rem; }
.skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.skill, .project {
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: var(--white);
}

.skill { padding: clamp(1.1rem, 3vw, 1.65rem); }
.technologies { gap: .4rem; margin-top: 1rem; }

.technologies li {
  padding: .2rem .58rem;
  border-radius: .4rem;
  background: var(--panel);
  color: var(--ink);
  font-size: .88rem;
  font-weight: 600;
}

.projects-section { background: var(--panel); }
.projects-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.project { overflow: hidden; }

.project img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top;
  border-bottom: 1px solid var(--line);
  background: #dbe4e9;
}

.project-info { padding: 1.1rem 1.2rem 1.35rem; }
.project-category { margin-bottom: .35rem; font-size: .88rem; font-weight: 700; }
.project h3 a { color: var(--ink); }
.project h3 a:hover { color: var(--blue-dark); }

.contact-section { background: var(--ink); color: var(--white); }
.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  align-items: center;
  gap: 1.5rem 3rem;
}

.contact-section h2 { margin-bottom: .75rem; }
.contact-section p { max-width: 35rem; color: #cfdae5; }
.button-light { background: var(--white); color: var(--ink); }
.button-light:hover { background: #e0e8ff; }
.contact-section .email-address { margin-block: .5rem .85rem; overflow-wrap: anywhere; }
.profile-links a { color: var(--white); font-weight: 700; }

.site-footer { padding-block: .5rem; font-size: .9rem; }
.site-footer a { color: var(--ink); }

@media (max-width: 45rem) {
  .hero-layout { grid-template-columns: minmax(0, 1fr); }
  .desktop-break { display: none; }
  .portrait { max-width: 22rem; }
  .projects-grid, .contact-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 34rem) {
  .container { width: calc(100% - 2rem); }
  .site-header { position: static; }
  html { scroll-padding-top: 1rem; }
  .navigation { padding-block: .8rem; }
  .nav-links { gap: .5rem 1rem; }
  .skills-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
