/* =========================================================
   6. PORTFÓLIO (trabalhos.html) e botão que leva até ele
   ========================================================= */

.ver-todos { display: flex; justify-content: center; margin-top: 28px; }

.topo-portfolio { padding-top: 64px; }
.topo-portfolio p { color: var(--texto-suave); }

/* Filtros */
.filtros { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0; }
.filtros button {
  padding: 9px 18px; border: 1px solid var(--borda); border-radius: 99px; background: var(--cartao);
  color: var(--texto); font: 600 .92rem var(--fonte-texto); cursor: pointer; transition: background .3s, border-color .3s;
}
.filtros button:hover { border-color: var(--vermelho-claro); }
.filtros button[aria-pressed="true"] { background: var(--vermelho); border-color: var(--vermelho); color: #fff; }

/* Grade de projetos */
.grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.projeto {
  display: flex; flex-direction: column; overflow: hidden; padding: 0; text-align: left;
  border: 1px solid var(--borda); border-radius: 20px; background: var(--cartao);
  color: var(--texto); font: inherit; cursor: pointer;
  transition: transform .5s var(--suave), border-color .4s, box-shadow .5s;
  animation: surgir .7s var(--suave) both; animation-delay: calc(var(--i) * 60ms);
}
.projeto[hidden] { display: none; }
.projeto:hover { transform: translateY(-6px); border-color: var(--vermelho); box-shadow: 0 16px 36px rgba(209, 10, 44, .3); }
.capa {
  position: relative; display: grid; place-content: center; width: 100%; aspect-ratio: 1; overflow: hidden;
  padding: 16px; text-align: center; background: linear-gradient(145deg, var(--tom-video), var(--cartao) 75%);
}
.capa .aviso { font-size: .8rem; color: var(--texto-suave); overflow-wrap: anywhere; }
.capa img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--suave); }
.projeto:hover img { transform: scale(1.07); }
.legenda { display: block; padding: 16px 18px 20px; }
.legenda b { display: block; font: 600 .95rem/1.4 var(--fonte-titulo); }
.legenda small { color: var(--vermelho-claro); font-size: .85rem; }

/* Janela do projeto */
#projeto {
  width: min(900px, 94vw); max-width: none; max-height: 90vh; overflow-y: auto; padding: 0 24px 28px;
  border: 1px solid var(--borda); border-radius: 24px; background: var(--fundo); text-align: left; overscroll-behavior: contain;
}
#projeto[open] { animation: surgir .5s var(--suave); }
#projeto .barra { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; gap: 8px; padding: 16px 0 12px; background: var(--fundo); }
#projeto .barra button { margin: 0; }
#projeto h2 { margin-bottom: 8px; font-size: clamp(1.2rem, 3vw, 1.8rem); }
.p-cat { color: var(--vermelho-claro); font-weight: 700; font-size: .9rem; }
.p-desc { margin-top: 18px; color: var(--texto-suave); white-space: pre-line; }
.midias { display: grid; gap: 18px; margin-top: 22px; }
.midias iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 16px; background: #000; }
#projeto .midias video { width: 100%; max-width: 100%; height: auto; max-height: 70vh; border-radius: 16px; background: #000; }
.midias img { display: block; width: 100%; border-radius: 16px; }
.midias .vazio { padding: 40px 20px; border: 1px dashed var(--borda); border-radius: 16px; text-align: center; color: var(--texto-suave); }

@media (max-width: 800px) { .grade { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) {
  .grade { gap: 10px; }
  .legenda { padding: 12px; }
  .legenda b { font-size: .75rem; overflow-wrap: anywhere; }
  #projeto { padding-inline: 14px; }
}
@media (prefers-reduced-motion: reduce) { .projeto, #projeto[open] { animation: none; } }
