body {
  background-color: var(--background-color);
}

/* ============================================================
   HERO SECTION — Best Bike Paths
   Improved: mobile-first, polished, no layout breakage
   ============================================================ */

/* ---------- Container ---------- */
.hero-section-container {
  width: 100%;
  height: 100svh;              /* definite height lets flex shrink the image to fit */
  position: relative;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;    /* vertically centre the whole group */

  gap: 2rem;
  padding: 6rem 1.5rem 4rem;  /* top padding clears any nav / status bar */
  box-sizing: border-box;
}

.hero-section-container {
  position: relative;
  overflow: visible;
}

/* ---------- Ambient blobs ---------- */
.hero-section-container::before,
.hero-section-container::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.40;
  pointer-events: none;
  z-index: 0;
}

/* Large blob — top-left */
.hero-section-container::before {
  width: min(600px, 80vw);
  height: min(600px, 80vw);
  background: radial-gradient(circle, #2d9e5f, #166c2b);
  top: -100px;
  left: -120px;
  animation: blob-drift-a 12s ease-in-out infinite alternate;
}

/* Smaller blob — bottom-right */
.hero-section-container::after {
  width: min(400px, 60vw);
  height: min(400px, 60vw);
  background: radial-gradient(circle, #57c47a, #2d9e5f);
  bottom: -60px;
  right: -80px;
  animation: blob-drift-b 15s ease-in-out infinite alternate;
}

@keyframes blob-drift-a {
  0%   { transform: translate(0,   0)   scale(1);    }
  33%  { transform: translate(60px, 40px) scale(1.08); }
  66%  { transform: translate(20px, 80px) scale(0.95); }
  100% { transform: translate(80px, 20px) scale(1.05); }
}

@keyframes blob-drift-b {
  0%   { transform: translate(0,    0)    scale(1);    }
  33%  { transform: translate(-50px,-30px) scale(1.10); }
  66%  { transform: translate(-20px,-70px) scale(0.92); }
  100% { transform: translate(-70px,-10px) scale(1.06); }
}

/* ---------- Device image ---------- */
.hero-image {
  position: relative;
  z-index: 1;

  /* Fluid sizing: big on desktop, fills width on small screens.
     min-height: 0 allows flex to shrink this below its intrinsic height
     so the text group is never pushed off-screen. */
  width: min(22rem, 70vw);
  height: auto;
  min-height: 0;
  object-fit: contain;

  filter:
    drop-shadow(0 8px 24px rgba(0,0,0,0.22))
    drop-shadow(0 24px 60px rgba(0,0,0,0.18));

  /* Entrance animation */
  opacity: 0;
  transform: translateY(28px) scale(0.93);
  animation: fadeSlideUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.8s forwards;
  will-change: transform, opacity;
}

/* ---------- Text group ---------- */
.hero-items-container {
  position: relative;
  z-index: 1;

  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;

  /* Remove the old padding-bottom hack */
  padding: 0;
  gap: 0.75rem;
}

.hero-section-icon {
  width: clamp(5rem, 15vw, 8rem);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  margin-bottom: 0.5rem;

  opacity: 0;
  transform: translateY(26px) scale(0.94);
  filter: blur(8px);
  animation: fadeSlideUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.05s forwards;
  will-change: transform, opacity, filter;

  view-transition-name: project-icon;
}

.hero-section-title {
  margin: 0;
  color: #166c2b;
  font-size: clamp(2.2rem, 8vw, 4rem);
  letter-spacing: -0.03em;
  line-height: 1.05;

  opacity: 0;
  transform: translateY(26px) scale(0.94);
  filter: blur(8px);
  animation: fadeSlideUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.38s forwards;
  will-change: transform, opacity, filter;

  view-transition-name: project-title;
}

.hero-section-subtitle {
  margin: 0;
  color: #437850;
  font-size: clamp(1rem, 4vw, 1.5rem);
  opacity: 0.85;

  opacity: 0;
  transform: translateY(26px) scale(0.94);
  filter: blur(8px);
  animation: fadeSlideUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.65s forwards;
  will-change: transform, opacity, filter;
}

/* ---------- Shared entrance keyframe ---------- */
@keyframes fadeSlideUp {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* ---------- Scroll hint arrow (optional, auto-hides) ---------- */
.hero-scroll-hint {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  translate: -50% 0;
  z-index: 1;

  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  animation:
    fadeSlideUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 1.6s forwards,
    bounce 2s ease-in-out 2.4s infinite;
}

.hero-scroll-hint svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke: #2d9e5f;
  stroke-width: 2.5;
  fill: none;
  opacity: 0.7;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0);   }
  50%       { transform: translateY(6px); }
}

/* ============================================================
   RESPONSIVE TWEAKS
   ============================================================ */

/* Tall phones in portrait: a little more breathing room */
@media (max-width: 480px) {
  .hero-section-container {
    gap: 1.5rem;
    padding-top: 5rem;
  }

  .hero-image {
    max-height: 35vh;
  }
}

/* Landscape phones: shrink image so text stays visible */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-image {
    width: min(14rem, 35vw);
  }

  .hero-section-container {
    flex-direction: row;
    justify-content: center;
    gap: 3rem;
    padding: 3rem 4rem;
  }

  .hero-items-container {
    align-items: flex-start;
    text-align: left;
  }
}

/* Large screens: cap image slightly larger + sit higher */
@media (min-width: 1000px) {
  .hero-section-container {
    justify-content: flex-start;
    padding-top: 8rem;
  }
}

@media (min-width: 1200px) {
  .hero-image {
    width: 24rem;
  }
}

/* Back button floats over the hero so it doesn't push the hero down */
.back-button-container {
  position: absolute;
  top: 0;
  left: 0;
}

/* ---------------- MAIN CONTENT ---------------- */

.main-content-container, .full-width-container {
  width: 90%;
  margin: 0 auto;

  display: flex;
  align-items: stretch;
  justify-content: center;

  gap: 2rem;
}

/* Shared card base */
.left-detail-container,
.middle-content-container,
.right-detail-container {
  display: flex;
  flex: 1;
  flex-direction: column;

  padding: 1.8rem;
  border-radius: 18px;

  /* Same tone as page, just slightly lifted */
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);

  /* Apple-like elevation */
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,   /* top highlight */
    0 8px 24px rgba(0, 0, 0, 0.12),             /* main soft shadow */
    0 2px 6px rgba(0, 0, 0, 0.08);              /* grounding shadow */

  transition: 
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1);

  box-sizing: border-box;

  height: fit-content;
}

.left-detail-container {
  flex-direction: row-reverse;
  justify-content: space-between;
}

@media (min-width: 1000px) {
  .left-detail-container {
    flex-direction: column;
    justify-content: flex-start;
  }

  .polimi-logo {
    align-self: center;
  }

  .left-detail-container,
  .middle-content-container,
  .right-detail-container {
    height: auto;
  }
}

.left-detail-container-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;

  gap: 1rem;
}

@media (min-width: 1000px) {
  .left-detail-container-inner {
    margin: 2rem 0 0 0;
  }
}

/* Subtle hover lift */
.left-detail-container:hover,
.middle-content-container:hover,
.right-detail-container:hover {
  transform: translateY(-4px);

  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 14px 34px rgba(0, 0, 0, 0.16),
    0 4px 12px rgba(0, 0, 0, 0.10);
}


/* Layout proportions */
.middle-content-container {
  flex: 2.5;
}

.left-detail-container,
.right-detail-container {
  max-width: 300px;
}

/* Color personality — softer + more premium */
.left-detail-container {
  background: linear-gradient(
    180deg,
    rgba(237, 122, 122, 0.10),
    rgba(237, 122, 122, 0.04)
  );
  border: 1px solid rgba(237, 122, 122, 0.18);

  align-items: flex-start;
}

.left-detail-container, .right-detail-container {
  background: linear-gradient(
    180deg,
    rgba(80, 200, 140, 0.10),
    rgba(80, 200, 140, 0.04)
  );
  border: 1px solid rgba(80, 200, 140, 0.18);

  align-items: flex-start;

}

/* ---------------- MOBILE ---------------- */

@media (max-width: 1000px) {
  .main-content-container {
    flex-direction: column;
  }

  .left-detail-container,
  .middle-content-container,
  .right-detail-container {
    width: 100%;
    max-width: 100%;
  }
}

.section-title-bar {
  padding: 0;
}

.middle-section-title {
  font-size: 2rem;
}

.content {
  text-align: justify;
  hyphens: auto;
  text-justify: inter-word;
}

.course-container, .skills-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.subsection-header-label {
  font-weight: bold;
  color: var(--text-color-secondary);
  opacity: 0.65;
  margin: 0;
}

.project-popup-skill-pills-container {
  margin: 0.5rem 0 0 0;
}

.degree-badge-container {
  margin: 0.25rem 0 0 0;
}

@media (min-width: 1000px) {
  .project-exam-course {
    font-size: 0.9rem;
  }

  .project-popup-skill-pills-container {
    align-items: flex-start;
    justify-content: flex-start;
  }
}

.polimi-logo {
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-drag: none;
  user-select: none;
  -webkit-user-select: none;

  height: 5rem;
}

@media (prefers-color-scheme: dark) {
  .polimi-logo {
    filter: invert(1);
  }
}

.right-detail-container-inner {
  display: flex;
  flex-direction: column;
}

#github-group-partners {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.partner-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;

  text-decoration: none;
}

.partner-link:hover {
  text-decoration: underline;
}

.partner-avatar {
  width: 1.3rem;
  border-radius: 999px;
}

.partner-username {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text-color-secondary);
  opacity: 0.75;
}

.partner-username:hover {
  color: var(--text-color-accent);
}

.project-type-image {
  width: 3.5rem;

  align-self: center;
}

@media (max-width: 1000px) {
  .right-detail-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
  }
}

.github-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background-color: rgba(30, 30, 30, 0.08);
  border-radius: 9999px;
  text-decoration: none;
  font-weight: 600;
  color: #24292f;    
  
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.github-link-button:hover {
  transform: scale(1.1);
  background-color: rgba(30, 30, 30, 0.15);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.github-icon {
  width: 1.4rem;
  height: 1.4rem;
  color: #24292f;
}

.github-link-text {
  font-size: 0.9rem;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .github-link-button {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
  }
  .github-link-button:hover {
    background-color: rgba(255, 255, 255, 0.15);
  }
  .github-icon {
    color: #fff;
  }
}

.github-icon-link-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 1000px) {
  .github-icon-link-container {
    align-self: center;
  }
}

.full-width-container {
  flex-direction: column;

  margin: 2rem 0;

  text-align: start;
}

.pdf-links-container {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
}

.pdf-thumbnail-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

.pdf-thumbnail {
  width: 10rem;
  border-radius: 8px;
  filter:
    drop-shadow(0 2px 6px rgba(0,0,0,0.12))
    drop-shadow(0 8px 24px rgba(0,0,0,0.18));
  transition:
    transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1),
    filter 0.35s ease;
  will-change: transform;
}

.pdf-thumbnail-link:hover .pdf-thumbnail {
  transform: translateY(-6px) rotate(3deg) scale(1.04);
  filter:
    drop-shadow(0 8px 24px rgba(0,0,0,0.20))
    drop-shadow(0 24px 48px rgba(0,0,0,0.18));
}

.pdf-thumbnail-link:active .pdf-thumbnail {
  transform: scale(0.96);
}

.pdf-thumbnail-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color-secondary, #888);
  text-align: center;
}