/* ============================================================
   trabalhos.css — Mosaico de projetos com fade-in no hover
   ============================================================ */

#trabalhos .section__header {
  padding-inline: var(--container-pad);
}

/* ---- Grid mosaico — 3 colunas, altura automática por linha ---- */
/*
   Layout (desktop):
   ┌──────────────┬──────────┐
   │              │  card 2  │  ← linha 1
   │   card 1     ├──────────┤
   │  (2col×2row) │  card 3  │  ← linha 2
   ├──────┬───────┴──────────┤
   │card 4│     card 5       │  ← linha 3
   └──────┴──────────────────┘
*/
.works-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 280px 280px 280px;
  gap: 3px;
  margin-top: var(--spacing-xl);
}

/* ---- Posicionamento dos cards ---- */
/* Card 1: grande, ocupa 2 colunas e 2 linhas */
.work-card--large {
  grid-column: 1 / 3;
  grid-row: 1 / 3;
}

/* Card 2: alto, ocupa 2 linhas na última coluna */
.work-card--tall {
  grid-column: 3 / 4;
  grid-row: 1 / 3;
}

/* Cards 3, 4, 5: dividem a 3ª linha igualmente */
.work-card:nth-child(3) { grid-column: 1 / 2; grid-row: 3 / 4; }
.work-card:nth-child(4) { grid-column: 2 / 3; grid-row: 3 / 4; }
.work-card:nth-child(5) { grid-column: 3 / 4; grid-row: 3 / 4; }

/* ---- Card base ---- */
.work-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: var(--color-deep);
  display: flex;
  align-items: flex-end;
}

/* ---- Foto real ---- */
.work-card__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.6s ease;
  z-index: 0;
}

.work-card:hover .work-card__photo {
  transform: scale(1.07);
}

/* ---- Placeholder (sem foto) ---- */
.work-card__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  opacity: 0.07;
  color: var(--color-accent);
  transition: opacity 0.4s ease, transform 0.6s ease;
  pointer-events: none;
  z-index: 0;
}

.work-card--large .work-card__placeholder,
.work-card--tall  .work-card__placeholder { font-size: 9rem; }

.work-card:hover .work-card__placeholder {
  opacity: 0.13;
  transform: scale(1.08);
}

/* ---- Overlay escuro — mais intenso no hover ---- */
.work-card__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to top,
    rgba(4, 18, 28, 0.92) 0%,
    rgba(4, 18, 28, 0.35) 50%,
    rgba(4, 18, 28, 0.0)  100%
  );
  transition: background 0.4s ease;
  pointer-events: none;
}

.work-card:hover .work-card__overlay {
  background: linear-gradient(
    to top,
    rgba(4, 18, 28, 0.97) 0%,
    rgba(4, 18, 28, 0.65) 55%,
    rgba(4, 18, 28, 0.15) 100%
  );
}

/* ---- Info — fade-in completo no hover ---- */
.work-card__info {
  position: relative;
  z-index: 2;
  padding: 20px 24px;
  width: 100%;
}

.work-card--large .work-card__info,
.work-card--tall  .work-card__info { padding: 28px 32px; }

/* Tag: sempre visível */
.work-card__tag {
  font-family: var(--font-condensed);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 6px;
  opacity: 1;
  transition: opacity 0.35s ease;
}

/* Título: visível mas sobe no hover */
.work-card__title {
  font-family: var(--font-condensed);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: #fff;
  transform: translateY(6px);
  transition: transform 0.35s ease;
}

.work-card--large .work-card__title { font-size: 1.6rem; }
.work-card--tall  .work-card__title { font-size: 1.2rem; }

.work-card:hover .work-card__title {
  transform: translateY(0);
}

/* Subtítulo: aparece com fade-in no hover */
.work-card__sub {
  font-size: 0.8rem;
  color: rgba(200, 232, 245, 0.7);
  font-weight: 300;
  line-height: 1.5;
  margin-top: 8px;

  /* fade-in: invisível por padrão */
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease 0.05s, transform 0.4s ease 0.05s;
  max-height: 0;
  overflow: hidden;
}

.work-card:hover .work-card__sub {
  opacity: 1;
  transform: translateY(0);
  max-height: 120px;
}

/* Linha divisória decorativa — aparece no hover */
.work-card__tag::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 1px;
  background: var(--color-accent);
  margin-right: 0;
  vertical-align: middle;
  transition: width 0.35s ease, margin-right 0.35s ease;
}

.work-card:hover .work-card__tag::before {
  width: 18px;
  margin-right: 8px;
}



/* =====================================================
   RESPONSIVO
   ===================================================== */

/* Tablet landscape — mantém mosaico mas reduz altura */
@media (max-width: 1024px) {
  .works-grid {
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: 240px 240px 240px;
  }
}

/* Tablet portrait — 2 colunas */
@media (max-width: 768px) {
  .works-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 240px 200px 200px;
    gap: 2px;
  }

  .work-card--large { grid-column: 1 / 3; grid-row: 1 / 2; }
  .work-card--tall  { grid-column: 1 / 2; grid-row: 2 / 3; }

  .work-card:nth-child(3) { grid-column: 2 / 3; grid-row: 2 / 3; }
  .work-card:nth-child(4) { grid-column: 1 / 2; grid-row: 3 / 4; }
  .work-card:nth-child(5) { grid-column: 2 / 3; grid-row: 3 / 4; }

  .work-card__sub   { opacity: 0.75; transform: translateY(0); max-height: none; }
  .work-card__title { transform: translateY(0); }
}

/* =====================================================
   MOBILE ≤ 540px — somente 2 cards, flexbox puro
   ===================================================== */
@media (max-width: 540px) {

  /* Troca grid por flexbox para eliminar qualquer herança de posicionamento */
  .works-grid {
    display: flex !important;
    flex-direction: column;
    gap: 4px;
    margin-top: var(--spacing-lg);
  }

  /* Oculta os cards 3, 4 e 5 marcados como desktop-only */
  .work-card--desktop-only {
    display: none !important;
  }

  /* Os 2 cards visíveis: largura total, altura fixa */
  .work-card--large,
  .work-card--tall {
    width: 100%;
    height: 210px;
    /* Elimina qualquer resíduo de grid */
    grid-column: unset !important;
    grid-row: unset !important;
  }

  /* Texto: sempre visível em touch */
  .work-card__title {
    transform: translateY(0) !important;
    font-size: 1.05rem;
  }

  .work-card__sub {
    opacity: 0.8 !important;
    transform: translateY(0) !important;
    max-height: none !important;
    font-size: 0.78rem;
  }

  .work-card__info,
  .work-card--large .work-card__info,
  .work-card--tall  .work-card__info {
    padding: 16px 18px;
  }

  .work-card__tag { font-size: 0.6rem; }
  .work-card__tag::before { display: none; }
}