.projects {
  background-color: var(--mesana-white);
  width: 100%;
  position: relative;
  z-index: 1;
}

.projects-container {
  max-width: var(--max-width-container);
  margin: 0 auto;
  padding: 60px 82px;
}

.projects-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  width: 100%;
}

.projects-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.projects-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--mesana-cream);
  border-radius: 52.5px;
  padding: 6px 12px;
  width: fit-content;
  opacity: 0;
}

.projects-badge.in-view {
  animation: fadeIn 0.8s ease-out 0.2s forwards;
}

.projects-badge-text {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1em;
  text-transform: uppercase;
  color: var(--mesana-red);
}

.projects-title {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 400;
  font-size: 52px;
  font-style: normal;
  line-height: 1.1423077216515174em;
  text-align: center;
  color: var(--mesana-red);
  margin: 0;
  max-width: 894.75px;
  opacity: 0;
}

.projects-title.in-view {
  animation: fadeIn 0.8s ease-out 0.4s forwards;
}

.projects-title-span {
  font-family: 'PT Serif Italic', sans-serif;
  font-weight: 300;
  font-style: italic;
}

.projects-subtitle {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 300;
  font-size: 24px;
  line-height: 1.75em;
  text-align: center;
  color: var(--mesana-black);
  margin: 0;
  max-width: 650px;
  opacity: 0;
}

.projects-subtitle.in-view {
  animation: fadeIn 0.8s ease-out 0.6s forwards;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 1276px;
}

.project-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--mesana-red);
  border-radius: 12px;
  padding: 30px 20px;
  gap: 49px;
  min-height: 371px;
  opacity: 0;
}

.project-card.in-view {
  animation: fadeIn 0.8s ease-out forwards;
}

.project-card:nth-child(1).in-view {
  animation-delay: 0.8s;
}

.project-card:nth-child(2).in-view {
  animation-delay: 0.9s;
}

.project-card:nth-child(3).in-view {
  animation-delay: 1.0s;
}

.project-card:nth-child(4).in-view {
  animation-delay: 1.1s;
}

.project-card:nth-child(5).in-view {
  animation-delay: 1.2s;
}

.project-card:nth-child(6).in-view {
  animation-delay: 1.3s;
}

.project-card:nth-child(7).in-view {
  animation-delay: 1.4s;
}

.project-card:nth-child(8).in-view {
  animation-delay: 1.5s;
}

.project-card-hidden {
  display: none;
}

.projects-button-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.project-card-title {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  border-bottom: 1px solid var(--mesana-red);
  padding-bottom: 8px;
}

.project-card-name {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 400;
  font-size: 20px;
  line-height: 1.8em;
  color: var(--mesana-red);
  padding: 0;
}

.project-card-divider {
  width: 100%;
  height: 0;
  border-top: 1px solid var(--mesana-red);
}

.project-card-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.project-card-amount {
  display: flex;
  flex-direction: column;
}

.project-card-currency {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5em;
  color: var(--mesana-red);
}

.project-card-value {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 400;
  font-size: 68px;
  line-height: 1.0294117647058822em;
  color: var(--mesana-red);
}

.project-card-description {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5em;
  color: var(--mesana-black);
  margin: 0;
}

.project-card-year {
  font-family: 'PT Serif Regular', serif;
  font-style: normal;
  font-weight: 400;
  font-size: 16px;
  color: var(--mesana-red);
}

.projects-button {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--mesana-white);
  border: 1px solid var(--mesana-red);
  border-radius: 60px;
  padding: 12px 36px;
  width: 172px;
  height: 38px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.projects-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--mesana-red) 0%, rgba(95, 28, 33, 0) 100%);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.2s ease;
  z-index: 0;
}

.projects-button-text {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.462499976158142em;
  color: var(--mesana-red);
  position: relative;
  z-index: 1;
  display: inline-block;
  padding-right: 0;
  transition: color 0.3s ease, padding-right 0.2s ease;
}

.projects-button-text::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 0;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.projects-button:hover {
  color: var(--mesana-cream);
}

.projects-button:hover::before {
  transform: scaleY(7);
}

.projects-button:hover .projects-button-text {
  color: var(--mesana-cream);
}

.projects-button:hover .projects-button-text::after {
  opacity: 1;
  transform: translateY(-50%) translateX(2px);
  /* keep arrow visible on red bg */
  filter: brightness(0) saturate(100%) invert(93%) sepia(16%) saturate(1026%) hue-rotate(327deg) brightness(98%) contrast(92%);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.live-projects-section {
  width: 100%;
  max-width: var(--max-width-container);
}

.live-projects-heading {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 400;
  font-size: 40px;
  line-height: 1.2em;
  color: var(--mesana-red);
  padding-bottom: 40px;
}

.live-projects-live {
  font-style: normal;
}

.live-projects-projects {
  font-family: 'PT Serif Italic', sans-serif;
  font-style: italic;
  font-weight: 300;
}

.live-projects-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}

.live-project-item {
  padding: 20px 0;
  position: relative;
}

/* Animated border - top */
.live-project-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--mesana-red);
  transition: width 0.8s ease-out;
}

/* Animated border - bottom (only for last child) */
.live-project-item:last-child::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0.5px;
  background-color: var(--mesana-red);
  transition: width 0.8s ease-out;
  transition-delay: 0.2s;
}

/* Reveal animation */
.live-project-item.reveal::before {
  width: 100%;
}

.live-project-item:last-child.reveal::before {
  width: 100%;
}

.live-project-item:last-child.reveal::after {
  width: 100%;
}

.live-project-title {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 400;
  font-size: 28px;
  line-height: 1.5em;
  color: var(--mesana-red);
  margin: 0 0 8px 0;
  padding: 0;
  opacity: 0;
  transition: opacity 0.6s ease-in;
}

.live-project-description {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5em;
  color: var(--mesana-black);
  margin: 0;
  padding: 0;
  opacity: 0;
  transition: opacity 0.6s ease-in;
}

/* Fade in text after border animation */
.live-project-item.reveal .live-project-title,
.live-project-item.reveal .live-project-description {
  opacity: 1;
  transition-delay: 0.4s;
}

@media (max-width: 1200px) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}


@media (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .project-card {
    padding: 12px;
    gap: 20px;
  }
  
  .projects-container {
    padding: 40px 20px;
  }

  .project-card-content {
    gap: 4px;
  }

  .project-card-amount {
    gap: 4px;
  }

  .projects-badge-text {
    font-size: 12px;
  }

  .projects-title {
    font-size: 32px;
  }

  .projects-subtitle {
    font-size: 16px;
  }

  .project-card-description {
    font-size: 12px;
  }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 100%;
    gap: 8px;
  }

  .project-card-currency {
    font-size: 8px;
  }

  .project-card-year {
    font-size: 12px;
  }

  .project-card {
    min-height: auto;
  }

  .project-card-value {
    font-size: 32px;
  }

  .project-card-name {
    font-size: 12px;
  }

  .project-card-hidden {
    display: none;
  }

  .projects-button-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
  }

  .projects-button {
    padding: 8px 24px;
  }

  .projects-button-text {
    font-size: 12px;
  }

  .live-projects-section {
    padding: 0;
    margin-top: 30px;
    border-left: none;
    border-right: none;
  }

  .live-projects-heading {
    font-size: 32px;
    /* margin-bottom: 20px; */
  }

  .live-project-item {
    padding: 15px 0;
  }

  .live-project-title {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .live-project-description {
    font-size: 16px;
  }
}
