.page-header {
  text-align: center;
  margin-bottom: 4rem;
  margin-top: 0;
  padding-top: 0;
}

.page-title {
  color: #3a3a3a;
  font-size: 5rem;
  text-transform: uppercase;
}

.page-subtitle {
  color: #3a3a3a;
  font-size: 1.2rem;
  margin: 0 auto;
}

.page-content {
  padding: 0 var(--container-padding);
  margin-top: 2rem;
  text-align: center;
  min-height: 50vh;
}

/* Ajuste da grid para os cards horizontais */
.cards-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

/* Card de Trilha - Horizontal */
.card-item--trilha {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 1400px;
  height: 400px;
  border-radius: 40px;
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.card-item--trilha:hover {
  transform: scale(1.01);
}

.card-item--trilha__bg {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 45%;
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  z-index: 1;
  -webkit-mask-image: linear-gradient(to right, transparent, black 150px);
  mask-image: linear-gradient(to right, transparent, black 150px);
  transition: all 0.3s ease;
}

.card-item--trilha__content {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem;
  max-width: 60%;
}

.card-item--trilha__titulo {
  text-align: left;
  font-size: 2rem;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  line-height: 1.1;
}

.card-item--trilha__competencias {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 3rem;
}

.card-trilha-tag {
  background: rgba(255, 255, 255, 0.9);
  color: #3a3a3a;
  border: 1px solid #3a3a3a;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.card-item--trilha__cursos {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.card-item--trilha__cursos-list {
  display: flex;
  gap: 0.5rem;
}

.card-trilha-curso-thumb {
  width: 80px;
  height: 110px;
  overflow: hidden;
  transition: transform 0.2s ease;
  box-shadow: 0 0px 8px rgba(0, 0, 0, 0.40);
}

.card-trilha-curso-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-item--trilha__remaining {
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
}

.card-item--trilha__remaining-mobile {
  display: none;
}

@media (max-width: 768px) {
  .page-title {
    font-size: 3rem;
  }

  /* --- Card de Trilha no Mobile: Layout Vertical --- */
  .card-item--trilha {
    flex-direction: column;
    height: auto;
    min-height: 580px;
    border-radius: 28px;
  }

  /* Imagem de fundo: ocupa o topo do card como banner — maior */
  .card-item--trilha__bg {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    height: 400px;
    flex-shrink: 0;
    background-size: cover;
    background-position: center top;
    -webkit-mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
  }

  /* Área de conteúdo sobrepõe levemente o fade da imagem */
  .card-item--trilha__content {
    flex: none; /* Remove o flex: 1 do desktop que causava corte */
    position: relative;
    z-index: 2;
    padding: 0 1.5rem 2.5rem;
    max-width: 100%;
    margin-top: -80px;
    text-align: left;
    justify-content: flex-end;
  }

  .card-item--trilha__titulo {
    font-size: 1.6rem;
    text-align: left;
    margin-bottom: 0.8rem;
  }

  .card-item--trilha__competencias {
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
  }

  /* Tags menores no mobile */
  .card-trilha-tag {
    font-size: 0.6rem;
    padding: 0.25rem 0.65rem;
    letter-spacing: 0.03em;
  }

  /* Lista de cursos: linha horizontal sem quebrar */
  .card-item--trilha__cursos {
    align-items: center;
    gap: 0.6rem;
    flex-wrap: nowrap;
  }

  .card-item--trilha__cursos-list {
    flex-wrap: nowrap;
    gap: 0.4rem;
  }

  .card-trilha-curso-thumb {
    width: 62px;
    height: 85px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
  }

  .card-item--trilha__remaining {
    font-size: 1.5rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Exibir contador mobile e ocultar o badge desktop */
  .card-item--trilha__remaining-desktop {
    display: none;
  }
  
  .card-item--trilha__remaining-mobile {
    display: block;
  }

  /* Forçar a ocultação do 5º thumb inserido pelo JS na view mobile */
  .card-item--trilha__cursos-list .card-trilha-curso-thumb:nth-child(n+5) {
    display: none;
  }
}
