/* ==========================================================================
   Projetos: galeria em grade com prévias em movimento (js/sections/portfolio.js)

   Inspiração: explorador de arquivos editorial. Cada projeto é uma janela com a aba do
   arquivo (nome e número), a prévia em vídeo do site rodando e as informações. O primeiro
   projeto é o destaque (linha inteira); os demais ficam em três colunas no desktop, duas no
   tablet e uma no celular. A página rola normalmente.
   A cidade noturna fica ao fundo do topo da seção; os cartões são opacos (o raio principal
   da página passa por trás deles).
   ========================================================================== */

.portfolio {
  --tile-r: 18px;
}

/* (seletor reforçado: a regra geral ".section > *" deixaria o fundo no fluxo da página) */
.portfolio.section > .portfolio__backdrop {
  --horizon: 62%; /* linha do horizonte da cidade */
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 0;
  height: min(100%, 64rem);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 60%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 60%, transparent);
}

.portfolio__city {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  opacity: 0.55;
}

.portfolio__head .section-intro {
  justify-items: start;
}

.portfolio__all {
  margin-top: 0.75rem;
}

/* só aparece com JavaScript (o túnel depende dele) */
.portfolio__all[hidden] {
  display: none;
}

.portfolio__all svg {
  width: 18px;
  height: 18px;
}

/* Grade ----------------------------------------------------------------------- */

.portfolio__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 2.4vw, 2rem);
  padding: 0;
  list-style: none;
}

.project-tile {
  --accent: var(--volt);
  min-width: 0;
}

.project-tile--featured {
  grid-column: 1 / -1;
}

.project-tile__inner {
  position: relative;
  display: grid;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgb(236 241 255 / 0.12);
  border-radius: var(--tile-r);
  background: linear-gradient(180deg, #0a1426, #050a14);
  box-shadow: inset 0 1px 0 rgb(236 241 255 / 0.06), 0 40px 80px -50px rgb(0 0 0 / 0.95);
  transition: border-color 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), translate 0.45s var(--ease-out);
}

/* com o mouse: o cartão sobe e a borda acende em azul elétrico */
.project-tile:hover .project-tile__inner,
.project-tile:focus-within .project-tile__inner,
.project-tile.is-cursor-hot .project-tile__inner {
  border-color: rgb(29 143 240 / 0.6);
  box-shadow: 0 0 0 1px rgb(29 143 240 / 0.2), 0 40px 90px -40px rgb(29 143 240 / 0.55);
  translate: 0 -6px;
}

/* aba da janela: três pontos, nome do arquivo e número */
.project-tile__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgb(236 241 255 / 0.03);
}

.project-tile__bar i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(236 241 255 / 0.2);
}

.project-tile__bar i:first-child {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.project-tile__file {
  overflow: hidden;
  margin-left: 0.6rem;
  color: var(--frost-soft);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-tile__num {
  margin-left: auto;
  color: var(--graphite);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
}

/* prévia: captura de espera + vídeo por cima */
.project-tile__media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  padding: 0;
  background: #0b0f18;
  cursor: pointer;
}

.project-tile__poster,
.project-tile__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: scale 0.8s var(--ease-out), opacity 0.5s var(--ease-out);
}

.project-tile__video {
  opacity: 0;
}

.project-tile.has-video .project-tile__video {
  opacity: 1;
}

.project-tile:hover .project-tile__poster,
.project-tile:hover .project-tile__video {
  scale: 1.025;
}

/* reflexo azul na base da prévia */
.project-tile__media::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 40%;
  background: linear-gradient(to top, rgb(5 10 20 / 0.55), transparent);
  pointer-events: none;
}

.project-tile__live {
  position: absolute;
  top: 0.8rem;
  left: 0.8rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid rgb(236 241 255 / 0.18);
  border-radius: var(--radius-pill);
  background: rgb(1 2 3 / 0.6);
  color: var(--frost);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  opacity: 0;
  translate: 0 -4px;
  transition: opacity 0.35s var(--ease-out), translate 0.35s var(--ease-out);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.project-tile__live .spark-dot {
  width: 5px;
  height: 5px;
}

.project-tile.is-playing.has-video .project-tile__live {
  opacity: 1;
  translate: 0 0;
}

/* informações */
.project-tile__body {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 0.6rem;
  padding: clamp(1.1rem, 2vw, 1.6rem);
}

.project-tile__category {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--volt-hi);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.project-tile__name {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1.2rem + 1vw, 2.2rem);
  font-weight: 400;
  line-height: 1.05;
}

.project-tile__desc {
  max-width: 44ch;
  color: var(--frost-soft);
  line-height: 1.6;
}

.project-tile__motion li {
  font-size: 0.75rem;
}

.project-tile__open {
  margin-top: 0.4rem;
}

.project-tile__open svg {
  width: 16px;
  height: 16px;
  transition: translate 0.3s var(--ease-out);
}

.project-tile__open:hover svg {
  translate: 3px 0;
}

/* destaque: prévia grande ao lado das informações */
@media (min-width: 900px) {
  .project-tile--featured .project-tile__inner {
    grid-template-columns: minmax(0, 1.7fr) minmax(18rem, 1fr);
    grid-template-rows: auto 1fr;
  }

  .project-tile--featured .project-tile__bar {
    grid-column: 1 / -1;
  }

  .project-tile--featured .project-tile__body {
    align-content: center;
    gap: 0.85rem;
    padding: clamp(1.5rem, 3vw, 3rem);
  }

  .project-tile--featured .project-tile__name {
    font-size: clamp(2.2rem, 1.4rem + 2.2vw, 3.6rem);
  }
}

@media (max-width: 1099px) {
  .portfolio__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* com duas colunas, o último cartão ocupa a linha inteira (nada fica sozinho de lado) */
  .project-tile:last-child:nth-child(even) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 699px) {
  .portfolio__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.portfolio__noscript,
.portfolio__grid--static img {
  width: 100%;
  height: auto;
}

@media (prefers-reduced-motion: reduce) {
  .project-tile__inner,
  .project-tile__poster,
  .project-tile__video {
    transition: none;
  }

  .project-tile:hover .project-tile__inner {
    translate: none;
  }
}

/* Aparelhos (também usados no modo túnel) */
.device {
  position: relative;
  border: 1px solid rgb(236 241 255 / 0.12);
  background: #070b14;
  box-shadow:
    inset 0 1px 0 rgb(236 241 255 / 0.08),
    0 50px 90px -50px rgb(0 0 0 / 0.95),
    0 30px 80px -46px rgb(29 143 240 / 0.55);
}

.device__screen {
  position: relative;
  overflow: hidden;
  background: #0b0f18;
}

.device__shot {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  will-change: transform;
}

.device--desktop {
  border-radius: 14px;

}

.device__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.device__bar i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(236 241 255 / 0.18);
}

.device__address {
  overflow: hidden;
  max-width: 55%;
  margin: 0 auto;
  padding: 2px 14px;
  border-radius: var(--radius-pill);
  background: rgb(236 241 255 / 0.05);
  color: var(--mist);
  font-size: 11px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device--desktop .device__screen {
  aspect-ratio: 16 / 10;
  border-radius: 0 0 13px 13px;
}

.device--phone {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22%;
  padding: 5px;
  border-radius: 24px;
  background: #04060b;

}

.device--phone .device__screen {
  aspect-ratio: 450 / 974;
  border-radius: 19px;
}

