/* ==========================================================================
   THE CASTRO — Cards de projeto no estilo "janela de navegador + celular"
   (mesmo conceito do painel de prévias). Usado no portfólio e no destaque da
   home. Comportamento em js/cards.js: no hover a página inteira rola dentro
   da janela; a imagem longa só é baixada quando a pessoa passa o mouse.
   Sobrescreve o .projeto antigo (sections.css/portfolio.css) só quando o
   card tem a classe .projeto--janela.
   ========================================================================== */

.projeto.projeto--janela {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 0;
  padding: 0;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(1, 28, 29, .08);
  box-shadow: 0 17px 30px rgba(1, 28, 29, .06);
  color: var(--tc-primario);
  text-decoration: none;
  overflow: hidden;
  scale: 1 !important;
  transition: transform .55s var(--tc-ease), box-shadow .55s var(--tc-ease), border-color .4s ease, opacity .5s ease !important;
}
.projeto.projeto--janela::before { display: none; }
/* card filtrado sai do grid (sem isso o display:flex acima vencia e ficava buraco) */
.projeto.projeto--janela.is-hidden { display: none; }
.projeto.projeto--janela.ativo:hover,
.projeto.projeto--janela:hover {
  transform: translateY(-6px);
  border-color: rgba(81, 170, 150, .55);
  box-shadow: 0 30px 55px -18px rgba(1, 28, 29, .28), 0 0 0 1px rgba(81, 170, 150, .15);
}

/* Tela: navegador + celular */
.pj-tela { position: relative; margin: 12px 12px 0; }
.pj-navegador { border-radius: 12px; overflow: hidden; background: var(--tc-primario); }
.pj-barra { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; background: var(--tc-primario); }
.pj-barra b { width: 8px; height: 8px; border-radius: 50%; background: rgba(242, 240, 236, .2); transition: background .3s ease; }
.projeto--janela:hover .pj-barra b:nth-child(1) { background: #ff5f57; }
.projeto--janela:hover .pj-barra b:nth-child(2) { background: #febc2e; }
.projeto--janela:hover .pj-barra b:nth-child(3) { background: #28c840; }
.pj-barra span {
  margin-left: 8px; flex: 1; min-width: 0;
  font-family: var(--tc-sans); font-size: 11px; line-height: 18px; color: rgba(242, 240, 236, .62);
  background: rgba(242, 240, 236, .08); border-radius: 6px; padding: 0 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pj-janela { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #e9e6e0; }
.pj-janela img {
  position: absolute; top: 0; left: 0; width: 100%; height: auto; display: block;
  will-change: transform; transition: transform .9s var(--tc-ease);
}
.pj-rolando {
  position: absolute; right: 10px; top: 10px; z-index: 2;
  font-family: var(--tc-sans); font-size: 11px; padding: 3px 9px; border-radius: 99px;
  background: rgba(1, 28, 29, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #fff; opacity: 0; transition: opacity .3s ease; pointer-events: none;
}
.projeto--janela:hover .pj-rolando { opacity: 1; }

.pj-cel {
  position: absolute; right: -4px; bottom: -22px; z-index: 3;
  width: 22%; aspect-ratio: 390 / 844; padding: 4px; border-radius: 16px;
  background: var(--tc-primario);
  box-shadow: 0 0 0 1.5px rgba(242, 240, 236, .14), 0 18px 30px -8px rgba(1, 28, 29, .55);
  transform: rotate(4deg); transition: transform .6s var(--tc-ease); overflow: hidden;
}
.pj-cel img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 12px; display: block; }
.pj-cel::after { content: ""; position: absolute; top: 8px; left: 50%; translate: -50% 0; width: 30%; height: 6px; border-radius: 9px; background: var(--tc-primario); }
.projeto--janela:hover .pj-cel { transform: rotate(0deg) translateY(-12px) scale(1.06); }

/* Texto do card */
.pj-info { display: flex; flex-direction: column; gap: 6px; padding: 32px 22px 22px; flex: 1; text-align: left; }
.pj-info .projeto-categoria-tag { color: var(--tc-realce); margin-bottom: 2px; font-size: 11.5px; }
.pj-info .tc-h3 { margin: 0; color: var(--tc-primario); }
.pj-info p { margin: 0; font-size: 16px; line-height: 1.4; color: var(--tc-texto); }
.pj-ver {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  font-family: var(--tc-sans); font-size: 14px; font-weight: 600; color: var(--tc-teal);
}
.pj-ver svg { width: 13px; height: 13px; transition: transform .45s var(--tc-ease); }
.projeto--janela:hover .pj-ver svg { transform: translate(3px, -3px); }
.pj-entregue {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  font-family: var(--tc-sans); font-size: 13px; color: var(--tc-texto);
}
.pj-entregue::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--tc-realce); }
.projeto--janela.projeto--sem-link { cursor: default; }
.projeto--janela.projeto--sem-link:hover { transform: translateY(-3px); }

/* No destaque da home o card ocupa a mesma grade de 3 colunas */
.portfolio-grid .projeto.projeto--janela { min-height: 0; }

@media (max-width: 767px) {
  .pj-info { padding: 30px 18px 18px; }
  .pj-info p { font-size: 15px; }
  .pj-cel { width: 21%; bottom: -18px; }
}

@media (prefers-reduced-motion: reduce) {
  .projeto.projeto--janela, .pj-janela img, .pj-cel { transition: none !important; }
  .projeto--janela:hover .pj-cel { transform: rotate(4deg); }
}

/* --------------------------------------------------------------------------
   Destaque da home em carrossel com setas (celular e tablet). No PC fica a
   grade de 3 colunas. Folga no trilho para a sombra e o celular não cortarem.
   -------------------------------------------------------------------------- */
.pj-setas { display: none; }
@media (max-width: 1024px) {
  .portfolio .portfolio-grid {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 5vw;
    padding: 10px 5vw 44px;
    margin: 0 -5vw;
    width: calc(100% + 10vw);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .portfolio .portfolio-grid::-webkit-scrollbar { display: none; }
  .portfolio .portfolio-grid .projeto--janela { flex: 0 0 46%; scroll-snap-align: start; }
  .pj-setas { display: flex; justify-content: center; gap: var(--space-2); margin: calc(-1 * var(--space-3)) 0 var(--space-4); }
  .pj-seta {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    border: 1px solid rgba(1, 28, 29, .14);
    background: #fff;
    color: var(--tc-primario);
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(1, 28, 29, .08);
    transition: background 1s ease, color 1s ease, border-color 1s ease, opacity .4s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .pj-seta svg { width: 18px; height: 18px; }
  .pj-seta:active { background: var(--tc-teal); color: #fff; border-color: var(--tc-teal); }
  .pj-seta[disabled] { opacity: .35; cursor: default; }
}
@media (max-width: 767px) {
  .portfolio .portfolio-grid .projeto--janela { flex: 0 0 84%; }
}
