.projects-section {
  padding: 80px 0;
  background: #fdfdfd;
  color: #222;
  width: 100%;
  position: relative;
  overflow: visible;
}

.projects-header {
  text-align: center;
}

.projects-section h1 {
  font-size: 4rem;
  margin-bottom: 10px;
}

.projects-section p {
  margin-bottom: 50px;
  color: #555;
}

.download-btn-paper {
  background: #f1f2f3;
  color: #222;
  border: none;
  font-size: 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.download-btn-paper:hover {
  background: #2ac7bf;
}

/* ------- Timeline Implementation ------- */
.timeline-container {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  height: auto;
  min-height: 100%;
}

.timeline-line {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 0; /* animated */
  transform: translateX(-50%);
  background-color: #222;
  transition: height 0.6s ease-out;
}

/* ------- Node Layout ------- */
.project-node {
  position: relative;
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    40px
    minmax(0, 1fr);
  margin: 120px 0;
}

.project-node .media {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 520px;
  height: 320px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.project-node.left .media {
  right: 50%;
  margin-right: 80px;
}
.project-node.right .media {
  left: 50%;
  margin-left: 80px;
}
.project-node .media img {
  width: 100%;
  height: 100%;
  object-fit: cover;

  opacity: 0;
  transform: scale(1.05);

  /* Subtle depth only */
  filter: brightness(95%) contrast(95%);

  /* Fade on all sides */
  mask-image: radial-gradient(
    ellipse at center,
    black 55%,
    transparent 100%
  );

  transition:
    opacity 0.6s ease-out,
    transform 0.6s ease-out;
}

.project-node .content,
.project-node .marker {
  position: relative;
  z-index: 2;
}
.project-node .media img {
  transform: scale(1.05);
}

.project-node.is-visible .media img {
  opacity: 0.8;
  transform: scale(1);
}

.project-node.left .tags {
  justify-content: flex-end; /* push tags to the right */
}

.project-node.right .tags {
  justify-content: flex-start; /* push tags to the left */
}
.tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 12px;
  margin-top: 0.5rem;
  background-color: rgba(0, 0, 0, 0.08);
  color: #222;
  white-space: nowrap;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.tag:hover {
  background-color: rgba(0, 0, 0, 0.15);
}



.project-node.left .content {
  grid-column: 1;
  text-align: right;
  justify-self: end;
}

.project-node.right .content {
  grid-column: 3;
  text-align: left;
  justify-self: start;
}

.project-node .marker {
  grid-column: 2;
  justify-self: center;
  align-self: start;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #222;
  transform: scale(0);
  transition: transform 0.3s ease-out;
  z-index: 2;
}

.project-node .content {
  opacity: 0;
  transform: translateX(40px);
  transition:
    transform 0.5s ease-out,
    opacity 0.4s ease-out;
}
.project-node.left .content {
  transform: translateX(-40px);
}
.project-node.is-visible .marker {
  transform: scale(1);
}
.project-node.is-visible .content {
  opacity: 1;
  transform: translateX(0);
}

.confidential-tag {
  display: inline-block;
  padding: 3px 10px;
  margin-bottom: 8px;
  font-size: 0.65rem;
  font-weight: 400;
  text-transform: uppercase;
  color: #fff;
  background-color: #ED543B; /* red */
  border-radius: 12px;
  letter-spacing: 0.5px;
}
.project-node .confidential-tag {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.project-node.is-visible .confidential-tag {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {

  /* Section padding */
  .projects-section {
    padding: 60px 0;
    overflow-x: clip;
  }
  .project-node .content {
    max-inline-size: calc(100vw - 64px);
  }

  .projects-header p {
    font-size: 0.8rem;
    padding-left: 10%;
    padding-right: 10%;
  }

  /* Timeline container keeps normal flow */
  .timeline-container {
    padding-left: 4px; /* breathing room from edge */
    padding-right: 4px;
  }

  /* Timeline line moves to the left */
  .timeline-line {
    left: 14px;
    transform: none;
  }

  /* Collapse node grid:
     [ marker | content ]
  */
  .project-node {
    grid-template-columns: 0 minmax(0, 1fr);
    column-gap: 4px;
    margin: 0 0;
  }

  .project-node h2 {
    font-size: 1.4rem;
    text-align: left;
    padding-right: 20px;
    padding-bottom: 0px;
    margin-bottom: 0px;
  }

  .project-node p {
    font-size: 0.7rem;
    text-align: left;
    padding-right: 20px;
  }

  /* Marker stays perfectly centered on the line */
  .project-node .marker {
    grid-column: 1;
    justify-self: center;
    align-self: start;
    left: 11px;
  }

  /* Content always on the right, left-aligned */
  .project-node .content {
    grid-column: 2;
    text-align: left;
    justify-self: start;

    /* unified animation direction */
    transform: translateX(40px);
  }

  /* Remove left/right variants entirely */
  .project-node.left .content,
  .project-node.right .content {
    grid-column: 2;
    text-align: left;
    justify-self: start;
    transform: translateX(40px);
  }

  /* Tags align naturally left */
  .project-node.left .tags,
  .project-node.right .tags {
    justify-content: flex-start;
  }

  .project-node .tag{
    margin-top: 0px;
    font-size: 0.7rem;
  }

  /* Media disabled on mobile (cleaner + avoids overlap) */
  .project-node .media {
    display: none;
  }
}
