* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
  /* Light theme (default) */
  --bg-primary: #edf0f3;
  --bg-secondary: #f8f9fa;
  --bg-accent: #f0f4f8;
  --bg-badge: #e2e8f0;
  --bg-hover: #e5e9ef;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-accent: #2b6cb0;
  --border-color: #cbd5e0;
  --shadow-color: rgba(0,0,0,0.08);
  --shadow-hover: rgba(0,0,0,0.15);
}

[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-accent: #363636;
  --bg-badge: #404040;
  --bg-hover: #404040;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --text-accent: #5b9eff;
  --border-color: #404040;
  --shadow-color: rgba(0,0,0,0.2);
  --shadow-hover: rgba(0,0,0,0.3);
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-accent: #363636;
    --bg-badge: #404040;
    --bg-hover: #404040;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-accent: #5b9eff;
    --border-color: #404040;
    --shadow-color: rgba(0,0,0,0.2);
    --shadow-hover: rgba(0,0,0,0.3);
  }
}

html, body {
  height: 100%;
  font-family: 'Poppins', sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
}

header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 1rem 2rem;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.header-container {
  width: 95%;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 15px;
  width: 100%;
  text-align: center;
}

nav {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 700px;
}

nav a {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

nav a:hover {
  background-color: var(--bg-hover);
}


@media (max-width: 600px) {
  nav {
    display: none;
  }
}

.contact-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.header-buttons {
  display: flex;
  gap: 0.5rem;
}

[data-i18n] {
  transition: all 0.3s ease;
}

.theme-btn {
  background: var(--bg-accent);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.2rem;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-btn:hover {
  background: var(--bg-hover);
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 4px 8px var(--shadow-color);
}

.theme-btn:active {
  transform: scale(0.95);
}

.main {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1rem;
  max-height: calc(100vh - 72px);
}

.container {
  max-width: 1000px;
  margin: 0 auto;
}

.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px var(--shadow-color);
  transition: transform 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 12px var(--shadow-hover);
}

.card h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.skills-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  justify-content: center;
  gap: 1rem;
  justify-items: center;
}

.skills-category {
  background-color: var(--bg-accent);
  padding: 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px var(--shadow-color);
  width: 100%;
  max-width: 320px;
  box-sizing: border-box;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}


.badge {
  background-color: var(--bg-badge);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.9rem;
  white-space: nowrap;
  color: var(--text-primary);
}

.skills-list .badge {
  display: inline-block;
  margin-top: 20px;
}

.skills-list, .languages-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

@media (max-width: 600px) {
  .contact-card {
    flex-direction: column;
    align-items: center;
  }
}

.contact-card img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.contact-details p {
  margin-bottom: 0.5rem;
}

.divider {
  height: 0.5px;
  background-color: var(--border-color);
  margin: 1.5rem 0;
  width: 100%;
}

.business-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.business-item img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 0.5rem;
  border: 1px solid #dee2e6;
}

.education-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.education-item img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 0.5rem;
  border: 1px solid #dee2e6;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.project-item img,
.business-item img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
}

/* Shared styles for education, project and business items */
.project-item,
.business-item,
.education-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.8rem;
  border-left: 4px solid transparent;
  transition: all 0.2s ease;
}

.project-item:hover,
.business-item:hover,
.education-item:hover {
  background-color: var(--bg-accent);
  transform: translateY(-2px);
  border-left-color: var(--text-accent);
  box-shadow: 0 4px 6px var(--shadow-color);
}

.item-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-accent);
  margin: 0;
}

.item-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0;
}

.item-meta {
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

@media (max-width: 600px) {
  .project-item,
  .business-item,
  .education-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-item img,
  .business-item img,
  .education-item img {
    width: 64px;
    height: 64px;
  }
}

/* Education styling: titoli e paragrafi distinti e più visibili */
.education-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Shared title styles for all sections */
.edu-title,
.item-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-accent);
  margin: 0;
}

.edu-subtitle,
.item-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0;
}

.edu-school,
.item-meta {
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.edu-year {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background-color: var(--bg-accent);
  padding: 4px 8px;
  border-radius: 999px;
  display: inline-block;
  margin-top: 6px;
}

@media (max-width: 600px) {
  .education-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .education-item img {
    width: 64px;
    height: 64px;
  }
}
