/* =========================================================
   SCOPED BODY LAYOUT — só ativa nesta página, via :has()
   Evita tocar no body global do theme.css (usado por outras
   páginas com scroll normal).
   ========================================================= */

:root {
  --projects-footer-mobile-height: 55px;
}

body:has(.projects-page) {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
}

/* header: tamanho fixo (o que ele realmente medir), nunca encolhe.
   footer não precisa de regra aqui: em desktop é display:none
   (não é item flex), em mobile é position:fixed (fora do fluxo). */
body:has(.projects-page) #siteHeader {
  flex: 0 0 auto;
}

/* =========================================================
   PROJECTS PAGE CONTAINER — pega o espaço que sobrar
   ========================================================= */

.projects-page {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0; /* essencial: permite encolher em vez de estourar */
}

.projects-page-container-parent {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.projects-page-main-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  gap: 40px;
  justify-content: space-between;
  align-items: stretch;
}

/* =========================================================
   PROJECTS CAROUSEL
   ========================================================= */

.projects-carousel {
  display: flex;
  flex-direction: column;
  width: fit-content;
  max-width: 100%;
  height: 100%;
  overflow: hidden;
  padding-left: 40px;
}

/* =========================================================
   CAROUSEL TRACK
   ========================================================= */

.projects-carousel-track {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  gap: 24px;
  width: max-content;
  transition: transform 0.6s ease;
}

/* =========================================================
   PROJECT CARD
   ========================================================= */

.project-card {
  flex: 0 0 70vw;
  width: 70vw;
  max-width: 1000px;
  height: 100%;
}

.project-card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

/* =========================================================
   PROJECT IMAGE
   ========================================================= */

.project-card-image {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  border-radius: 10px;
}

.project-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-image: url("https://alvesthiago.dev/wp-content/themes/dev-thiago/assets/images/backgrounds/background-project-image.webp");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* =========================================================
   PROJECT INFORMATION
   ========================================================= */

.project-card-info {
  flex: 0 0 auto;
  margin-top: 18px;
}

.project-card-info h2 {
  margin: 0;
  font-family: var(--heading-font-family);
  font-size: var(--text-xx-28px);
  font-weight: 700;
  color: var(--heading);
}

.project-card-info p {
  margin-top: 8px;
  font-family: var(--text-font-family);
  font-size: var(--text-sm-14px);
  color: var(--muted);
}

/* =========================================================
   CAROUSEL CONTROLS
   ========================================================= */

.projects-carousel-controls {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  margin-top: 25px;
  padding-bottom: 25px;
}

.projects-carousel-controls button {
  width: 45px;
  height: 45px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--primary);
  color: var(--heading);
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.projects-carousel-controls button:hover {
  background: var(--heading);
  color: var(--bg);
}

.projects-carousel-controls p {
  font-family: var(--heading-font-family);
  font-size: var(--text-lg-20px);
  font-weight: 800;
  line-height: 0;

  text-align: center;
}

/* =========================================================
   WIDESCREENS
   ========================================================= */

@media (min-width: 1440px) {
  .project-card {
    flex-basis: 65vw;
    width: 65vw;
  }
}

/* =========================================================
   TABLET / MOBILE — NAV EMPILHADA EM LINHA ACIMA DO CARROSSEL
   ========================================================= */

@media (max-width: 900px) {
  .projects-page-main-content {
    flex-direction: column;
    align-items: stretch;
    padding: 24px 0;
    gap: 16px;
  }

  .projects-links {
    width: 100%;
    max-width: 100%;
    height: auto;
    flex: 0 0 auto;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .projects-links ul {
    flex-direction: row;
    flex-wrap: nowrap;
    width: max-content;
    gap: 20px;
    padding-bottom: 4px;
  }

  .projects-carousel {
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    /* reserva espaço pro footer fixo (position:fixed no mobile) */
    padding-bottom: var(--projects-footer-mobile-height);
  }

  .projects-carousel-controls {
    padding-bottom: 0;
  }

  .project-card {
    flex-basis: 78vw;
    width: 78vw;
  }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 720px) {
  .projects-page-main-content {
    padding: 16px 0;
    gap: 12px;
  }

  .project-card {
    flex-basis: 85vw;
    width: 85vw;
  }

  .projects-carousel {
    padding-left: 20px;
  }

  .projects-carousel-track {
    gap: 16px;
  }

  .project-card-info h2 {
    font-size: var(--text-md-18px);
    letter-spacing: -0.3px;
  }

  .project-card-image {
    min-height: 120px;
  }
}
