:root {
  /* Palette: Cool neutral / Stone */
  --bg:         #fbfbfb;
  --text:       #1a1a1a;
  --muted:      #666666;
  --accent:     #485a6b;
  --light-gray: #f3f5f7;
  --border:     #dce3e8;
}

/* Reset universale per evitare problemi di larghezza e scroll orizzontale */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  overflow-wrap: break-word; /* Spezza URL o parole lunghe */
}

/* Intestazione principale */
.top-name {
  background: var(--light-gray);
  padding: 1.5rem 1rem 0.8rem;
  text-align: center;
}

.top-name h1 {
  font-size: 1.6rem;
  margin: 0;
  color: var(--text);
}

.tagline {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

/* Navigazione responsive */
nav {
  background: var(--accent);
  padding: 0.8rem 1rem;
  text-align: center;
  display: flex;
  justify-content: center;
  flex-wrap: wrap; /* Va a capo su schermi stretti */
  gap: 1.2rem;
}

nav a {
  color: #ffffff;
  text-decoration: none;
  font-size: 0.95rem;
}

nav a:hover {
  text-decoration: underline;
}

/* Layout principale */
main {
  padding: 2rem 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.section {
  margin-bottom: 2.5rem;
}

.section h2 {
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
  color: var(--text);
}

/* Layout profilo a due colonne */
.profile-section {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.contact-column {
  flex: 1 1 0;
}

.photo-column {
  flex: 0 0 220px;
  display: flex;
  justify-content: flex-end;
}

.photo-column img {
  width: 220px;
  height: 220px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.contact-info a {
  color: var(--text);
  text-decoration: none;
  word-break: break-word;
}

.contact-info a:hover {
  text-decoration: underline;
}

/* Stili del Form */
form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  max-width: 600px;
}

form p {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

input, textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(72, 90, 107, 0.15);
}

textarea {
  min-height: 130px;
  resize: vertical;
}

button[type="submit"] {
  font-family: inherit;
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 0.8rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  align-self: flex-start;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

button[type="submit"]:hover {
  opacity: 0.9;
}

button[type="submit"]:active {
  transform: translateY(1px);
}

/* Pie di pagina */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* Stili articoli */
.article {
  margin-bottom: 1.8rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.article h3 {
  font-size: 1.1rem;
  margin: 0 0 0.3rem;
}

.article .meta {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.article .abstract {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

/* Stili esperienze */
.subsection {
  margin-bottom: 2rem;
}

.subsection h2 {
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
}

.item {
  margin-bottom: 1.2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.item .title {
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.item .meta {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.item .desc {
  font-size: 0.95rem;
}

/* Regole Media Query per dispostivi mobile */
@media (max-width: 700px) {
  .profile-section {
    flex-direction: column;
    align-items: center;
  }

  .photo-column {
    justify-content: center;
    flex: 0 0 auto;
  }

  .photo-column img {
    width: 160px;
    height: 160px;
  }

  main {
    padding: 1.5rem 1rem;
  }

  button[type="submit"] {
    width: 100%;
  }
}