/*
 * Modern, clean styling for the biography page of Riccardo Braglia. The
 * design takes inspiration from contemporary personal sites, featuring
 * generous white space, a subtle color palette and card‑based layouts.
 */

/* Global reset and box-sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #2c3e50;
  background-color: #f7f9fc;
  line-height: 1.6;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

/* Header styles */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Allow the navigation container to span the full viewport width. A fixed
     maximum width can cause horizontal overflow on screens narrower than
     that limit. */
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 20px;
}

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: #0a3871;
  text-decoration: none;
}

nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0;
  padding: 0;
}

nav ul li a {
  display: block;
  padding: 12px 10px;
  font-size: 0.9rem;
  color: #0a3871;
  text-decoration: none;
  transition: color 0.3s ease;
  word-break: break-word;
  /* Allow breaking long words at normal points (e.g. hyphens) but avoid
     splitting within a word unless absolutely necessary. */
  overflow-wrap: break-word;
}

nav ul li a:hover {
  color: #345f9f;
}

/* Burger icon for mobile */
.burger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 5px;
}

.burger span {
  width: 24px;
  height: 2px;
  background-color: #0a3871;
  transition: transform 0.3s ease;
}

/* Hero section */
.hero {
  background: linear-gradient(135deg, #e7eef8 0%, #f5faff 100%);
  padding: 100px 20px 80px;
  margin-top: 56px; /* offset for fixed header */
}

.hero-container {
  max-width: 1200px;
  margin: 0 auto;
  /*
   * Use a flexible layout for the hero section so the text and image sit
   * side‑by‑side on larger screens and stack on smaller screens. A flexbox
   * layout avoids the overflow issues we saw previously with CSS Grid and
   * makes it easier to control wrapping behaviour. The gap property adds
   * breathing room between the two columns.
   */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 40px;
}

.hero-left {
  /* Allow the left column to grow twice as much as the right on larger
     screens. The min-width ensures the text can shrink responsively
     without overflowing its container. */
  flex: 2;
  min-width: 300px;
}

.hero-left h1 {
  font-size: 2.4rem;
  line-height: 1.3;
  margin-bottom: 20px;
  color: #0a3871;
  /* Allow the hero heading to wrap even when non‑breaking spaces are
     present by enabling breaking opportunities anywhere. This prevents
     overflow on smaller screens. */
  /* Allow the hero heading to wrap naturally without forcing breaks
     inside words. */
  overflow-wrap: break-word;
}

.hero-left p {
  margin-bottom: 1.2rem;
  /* Remove the artificial width constraint on paragraphs so they fill
     the available space within the hero container. This prevents text
     from abruptly truncating or wrapping unexpectedly. */
  max-width: 100%;
  color: #34495e;
  /* Allow lines to break anywhere if necessary (e.g. when non‑breaking
     spaces are present in the content from the Word document). This
     prevents horizontal overflow caused by very long unbreakable
     strings. */
  /* Wrap at normal word boundaries; avoid breaking words unless they
     exceed the container width. */
  overflow-wrap: break-word;
}

.hero-right {
  /* The right column flexes to occupy the remaining space. Align the image
     centrally within it for a balanced layout. */
  flex: 1;
  display: flex;
  justify-content: center;
}

.hero-right img {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  object-fit: cover;
  background-color: #e0e7ee;
}

/* Section and card styling */
.section {
  padding: 60px 20px;
}

.section-container {
  max-width: 1100px;
  margin: 0 auto;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  padding: 40px;
}

.section-container h2,
.section-container h3 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #0a3871;
  line-height: 1.3;
}

.section-container h2 {
  font-size: 1.8rem;
}

.section-container h3 {
  font-size: 1.4rem;
}

.section-container p {
  margin-bottom: 1rem;
  color: #34495e;
  max-width: 1000px;
  word-break: break-word;
  /* Similarly allow paragraphs in the card sections to break long
     sequences when necessary so they never overflow the viewport. */
  /* Wrap paragraphs at natural break points rather than forcing
     mid‑word breaks. */
  overflow-wrap: break-word;
}

/* Mobile responsive adjustments */
@media (max-width: 900px) {
  .hero-left h1 {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .nav-wrapper {
    flex-wrap: wrap;
  }
  .burger {
    display: flex;
  }
  nav ul {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
  nav ul.open {
    max-height: 500px;
  }
  nav ul li a {
    width: 100%;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
  }
  .hero-container {
    flex-direction: column;
    align-items: center;
  }
  .hero-right img {
    width: 200px;
    height: 200px;
  }
  .section-container {
    padding: 30px;
  }
}

@media (max-width: 576px) {
  .hero-left h1 {
    font-size: 1.6rem;
  }
  .section-container h2 {
    font-size: 1.5rem;
  }
  .section-container h3 {
    font-size: 1.2rem;
  }
  .section-container p {
    font-size: 0.9rem;
  }
}

/* Footer styles */
footer {
  background-color: #f7f9fc;
  border-top: 1px solid #e5edf5;
  margin-top: 60px;
  padding: 20px 0;
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
  font-size: 0.8rem;
  color: #64748b;
}