/* ==========================================================================
   Projetos — Só Portões
   Estilos específicos da página de galeria de projetos.
   Depende de: tokens.css, base.css, components.css
   ========================================================================== */

/* ==========================================================================
   1. HERO PROJETOS
   Compacto — sem watermark, centrado, menor altura que o hero da home
   ========================================================================== */

.hero--projetos {
  min-height: 48svh;
  align-items: center;
  padding-block: var(--space-4xl);
}

@media (max-width: 639px) {
  .hero--projetos {
    min-height: 40svh;
    padding-block: var(--space-3xl);
  }
}

.hero--projetos .hero__content {
  text-align: center;
  max-width: 640px;
  margin-inline: auto;
}

.hero--projetos .hero__eyebrow {
  justify-content: center;
}

.hero--projetos .hero__subtitle {
  font-size: var(--text-lg);
  max-width: 480px;
  margin-inline: auto;
}

/* Sem scroll indicator e sem watermark nesta página */
.hero--projetos .hero__scroll {
  display: none;
}

/* ==========================================================================
   2. BARRA DE FILTROS
   Pills/botões com active state amber, alinhados horizontalmente,
   com scroll horizontal no mobile
   ========================================================================== */

.projects-filters {
  background-color: var(--color-surface-container-lowest);
  border-bottom: 1px solid var(--color-outline-variant);
  position: sticky;
  top: 64px; /* altura da nav fixa */
  z-index: 40;
  padding-block: var(--space-md);
}

.projects-filters__inner {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.projects-filters__list {
  display: flex;
  gap: var(--space-sm);
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px; /* evita cortar outline no scroll */
}

.projects-filters__list::-webkit-scrollbar {
  display: none;
}

/* Pill de filtro */
.projects-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-outline-variant);
  background-color: transparent;
  font-family: var(--font-label);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-on-surface-variant);
  letter-spacing: 0.03em;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
  text-decoration: none;
  line-height: 1.4;
  flex-shrink: 0;
}

.projects-filter-pill:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background-color: rgb(217 119 6 / 0.06);
}

/* Estado ativo — amber sólido */
.projects-filter-pill--active,
.projects-filter-pill[aria-pressed="true"] {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-primary);
  box-shadow: 0 0 0 3px rgb(217 119 6 / 0.20);
}

.projects-filter-pill--active:hover,
.projects-filter-pill[aria-pressed="true"]:hover {
  background-color: var(--color-accent-light);
  border-color: var(--color-accent-light);
  color: var(--color-primary);
}

/* Contador de itens por categoria */
.projects-filter-pill__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding-inline: 5px;
  border-radius: var(--radius-full);
  background-color: rgb(0 0 0 / 0.08);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  line-height: 1;
}

.projects-filter-pill--active .projects-filter-pill__count,
.projects-filter-pill[aria-pressed="true"] .projects-filter-pill__count {
  background-color: rgb(5 17 37 / 0.15);
}

/* ==========================================================================
   3. SEÇÃO PRINCIPAL DA GALERIA
   ========================================================================== */

.projects-gallery {
  background-color: var(--color-surface);
  padding-block: var(--space-3xl) var(--space-4xl);
}

.projects-gallery__inner {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* Cabeçalho com contagem de resultados */
.projects-gallery__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.projects-gallery__count {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
}

.projects-gallery__count strong {
  font-weight: var(--font-weight-semibold);
  color: var(--color-on-surface);
}

/* ==========================================================================
   4. GRID DE PROJETOS — Masonry-like
   CSS columns no desktop, grid simples no mobile/tablet
   ========================================================================== */

/* Abordagem com CSS Grid auto-rows para efeito masonry */
.projects-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr;
  /* auto-rows permite alturas variadas */
  grid-auto-rows: auto;
}

/* Tablet: 2 colunas */
@media (min-width: 640px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }
}

/* Desktop: 3 colunas */
@media (min-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }
}

/* Destaque: card principal ocupa 2 colunas no desktop */
@media (min-width: 1024px) {
  .projects-grid .project-card--featured {
    grid-column: span 2;
  }
}

/* Destaque: card principal ocupa 2 colunas no tablet também */
@media (min-width: 640px) and (max-width: 1023px) {
  .projects-grid .project-card--featured {
    grid-column: span 2;
  }
}

/* ==========================================================================
   5. PROJECT CARD
   Imagem com aspect-ratio, overlay de hover com título e categoria
   ========================================================================== */

.project-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  background-color: var(--color-primary-container);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Imagem com proporção fixa */
.project-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

/* Card destaque tem proporção mais larga */
.project-card--featured .project-card__media {
  aspect-ratio: 16 / 9;
}

/* Card "tall" — proporção vertical (para variedade no grid) */
.project-card--tall .project-card__media {
  aspect-ratio: 3 / 4;
}

.project-card__img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-slow);
}

.project-card:hover .project-card__img {
  transform: scale(1.06);
}

/* Overlay de hover — gradiente de baixo para cima */
.project-card__overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(
    to top,
    rgb(5 17 37 / 0.92) 0%,
    rgb(5 17 37 / 0.55) 45%,
    rgb(5 17 37 / 0.10) 75%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-xl);
  opacity: 0;
  transition: opacity var(--transition-base);
}

/* Mobile: overlay sempre visível (sem hover em touch) */
@media (hover: none) {
  .project-card__overlay {
    opacity: 1;
    background: linear-gradient(
      to top,
      rgb(5 17 37 / 0.88) 0%,
      rgb(5 17 37 / 0.35) 50%,
      transparent 100%
    );
  }
}

.project-card:hover .project-card__overlay {
  opacity: 1;
}

/* Badge de categoria — sempre visível no topo */
.project-card__category {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px var(--space-sm);
  border-radius: var(--radius-full);
  background-color: var(--color-accent);
  font-family: var(--font-label);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.4;
  z-index: 3;
}

/* Info dentro do overlay */
.project-card__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  transform: translateY(8px);
  transition: transform var(--transition-base);
}

.project-card:hover .project-card__info {
  transform: translateY(0);
}

@media (hover: none) {
  .project-card__info {
    transform: none;
  }
}

.project-card__title {
  font-family: var(--font-headline);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-on-primary);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* Card destaque: título maior */
.project-card--featured .project-card__title {
  font-size: clamp(var(--text-xl), 2.5vw, var(--text-2xl));
}

.project-card__description {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-inverse-primary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Link CTA no overlay */
.project-card__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  font-family: var(--font-label);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent-light);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: gap var(--transition-fast);
}

.project-card__link .material-symbols-outlined {
  font-size: 16px;
  transition: transform var(--transition-fast);
}

.project-card:hover .project-card__link {
  gap: var(--space-sm);
}

.project-card:hover .project-card__link .material-symbols-outlined {
  transform: translateX(3px);
}

/* Placeholder enquanto imagem carrega */
.project-card__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-primary-container);
  color: rgb(255 255 255 / 0.15);
}

.project-card__placeholder .material-symbols-outlined {
  font-size: 48px;
}

/* ==========================================================================
   6. ESTADO VAZIO
   Exibido quando nenhum projeto corresponde ao filtro ativo
   ========================================================================== */

.projects-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  text-align: center;
  padding: var(--space-4xl) var(--container-pad);
  min-height: 320px;
}

.projects-empty__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background-color: var(--color-surface-variant);
  color: var(--color-on-surface-variant);
  opacity: 0.5;
}

.projects-empty__icon .material-symbols-outlined {
  font-size: 40px;
}

.projects-empty__title {
  font-family: var(--font-headline);
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-on-surface);
  letter-spacing: -0.02em;
}

.projects-empty__text {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-on-surface-variant);
  line-height: 1.6;
  max-width: 380px;
}

.projects-empty__action {
  margin-top: var(--space-sm);
}

/* Botão "Ver todos" no estado vazio: texto escuro para fundo claro (ISSUE-009) */
.projects-empty .btn--secondary {
  color: var(--color-on-surface);
  border-color: var(--color-on-surface-variant);
}

.projects-empty .btn--secondary:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* ==========================================================================
   7. LIGHTBOX / MODAL DE PROJETO (overlay de detalhe)
   ========================================================================== */

.project-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.project-modal--open {
  opacity: 1;
  pointer-events: auto;
}

.project-modal__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgb(5 17 37 / 0.85);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.project-modal__box {
  position: relative;
  z-index: 1;
  background-color: var(--color-surface-container-lowest);
  border-radius: var(--radius-xl);
  overflow: hidden;
  max-width: 900px;
  width: 100%;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96) translateY(8px);
  transition: transform var(--transition-base);
}

.project-modal--open .project-modal__box {
  transform: scale(1) translateY(0);
}

.project-modal__image-wrap {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  flex-shrink: 0;
}

.project-modal__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-modal__body {
  padding: var(--space-xl);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.project-modal__category {
  font-family: var(--font-label);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-modal__title {
  font-family: var(--font-headline);
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-on-surface);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.project-modal__description {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-on-surface-variant);
  line-height: 1.7;
}

.project-modal__close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background-color: rgb(5 17 37 / 0.6);
  color: var(--color-on-primary);
  border: none;
  cursor: pointer;
  z-index: 2;
  transition:
    background-color var(--transition-fast),
    transform var(--transition-fast);
}

.project-modal__close:hover {
  background-color: var(--color-primary);
  transform: scale(1.08);
}

.project-modal__close .material-symbols-outlined {
  font-size: 22px;
}

/* ==========================================================================
   8. CTA FINAL — Solicitar orçamento
   ========================================================================== */

.projects-cta {
  background-color: var(--color-primary);
  padding-block: var(--space-3xl);
}

.projects-cta__inner {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  text-align: center;
}

@media (min-width: 768px) {
  .projects-cta__inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.projects-cta__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.projects-cta__title {
  font-family: var(--font-headline);
  font-size: clamp(var(--text-2xl), 3vw, var(--text-3xl));
  font-weight: var(--font-weight-black);
  color: var(--color-on-primary);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.projects-cta__subtitle {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-inverse-primary);
  line-height: 1.6;
}

.projects-cta__actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .projects-cta__actions {
    justify-content: flex-end;
  }
}

/* ==========================================================================
   9. SEO CONTENT — Projetos
   ========================================================================== */

.seo-content--projetos {
  background-color: var(--color-surface-container-low);
  padding-block: var(--space-3xl);
  border-top: 1px solid var(--color-surface-variant);
}

.seo-content--projetos .seo-content__inner {
  max-width: 900px;
}

/* ==========================================================================
   10. RESPONSIVIDADE ESPECÍFICA
   ========================================================================== */

/* Mobile: ajustes de padding e tamanhos */
@media (max-width: 479px) {
  .projects-filters {
    top: 56px;
  }

  .project-card__overlay {
    padding: var(--space-lg);
  }

  .project-card__title {
    font-size: var(--text-base);
  }

  .project-modal__box {
    max-height: 95dvh;
    border-radius: var(--radius-lg);
  }

  .project-modal__body {
    padding: var(--space-lg);
  }

  .projects-cta__actions {
    flex-direction: column;
    width: 100%;
  }

  .projects-cta__actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Tablet: 2 colunas com espaçamento maior */
@media (min-width: 640px) and (max-width: 1023px) {
  .projects-grid {
    gap: var(--space-lg);
  }
}

/* Desktop: grid mais espaçado, overlay só no hover */
@media (min-width: 1024px) {
  .projects-grid {
    gap: var(--space-xl);
  }

  .hero--projetos .hero__subtitle {
    font-size: var(--text-xl);
  }
}
