/* ============================================================
   AUGUSTO SANTANA — Página de projetos (catálogo estilo Netflix)
   Depende de css/style.css (design system, nav, footer, mockups)
   ============================================================ */

.page-projetos {
  --row-w: min(1560px, 100% - clamp(2.5rem, 7vw, 6rem));
  --card-radius: 8px;
}

/* Base de arte (moldura colorida + container p/ o mockup) */
.nf-art {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size;
  background: var(--bg-2);
}
.nf-art::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ============================================================
   LINHAS / CARROSSÉIS
   ============================================================ */
.nf-rows {
  position: relative;
  z-index: 3;
  padding-block: calc(var(--nav-h) + clamp(1.6rem, 4vw, 3rem)) clamp(3rem, 6vw, 5rem);
}

.nf-row {
  --per: 6;
  --gap: 0.55rem;
  position: relative;
  margin-bottom: clamp(1.8rem, 3.2vw, 3rem);
}
.nf-row[hidden] { display: none; }

.nf-row-head {
  width: var(--row-w);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}
.nf-row-title {
  font-family: var(--font-display);
  font-size: clamp(1.02rem, 1.5vw, 1.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.nf-row-title em {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dark-ink);
  background: var(--lime);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
}
.nf-pages { display: flex; gap: 3px; opacity: 0; transition: opacity 0.3s ease; }
.nf-row:hover .nf-pages { opacity: 1; }
.nf-pages i {
  width: 13px;
  height: 2px;
  background: rgba(255, 255, 255, 0.28);
  transition: background-color 0.3s ease;
}
.nf-pages i.is-on { background: var(--lime); }

.nf-slider { position: relative; }
.nf-track {
  width: var(--row-w);
  margin-inline: auto;
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  /* overflow-y: hidden recorta o card que cresce no hover — a folga
     vertical dá espaço para ele sem soltar um scroll na vertical. */
  padding-block: 16px;
  margin-block: -16px;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
}
.nf-track::-webkit-scrollbar { display: none; }

.nf-arrow {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 6;
  width: clamp(2rem, 3.4vw, 3.4rem);
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--text);
  background: rgba(7, 7, 12, 0.62);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s ease, background-color 0.25s ease, font-size 0.2s ease;
}
.nf-arrow--prev { left: 0; border-radius: 0 4px 4px 0; }
.nf-arrow--next { right: 0; border-radius: 4px 0 0 4px; }
.nf-slider:hover .nf-arrow:not([hidden]) { opacity: 1; }
.nf-arrow:hover { background: rgba(7, 7, 12, 0.86); font-size: 2.3rem; }
.nf-arrow[hidden] { display: none; }

/* ---------- Card ---------- */
.nf-card {
  flex: 0 0 max(var(--card-min, 0px), calc((100% - (var(--per) - 1) * var(--gap)) / var(--per)));
  position: relative;
  cursor: pointer;
  scroll-snap-align: start;
  transition: opacity 0.3s ease;
}
/* Pôster em retrato em qualquer tela: o navegador falso fica no topo, na
   proporção natural, e o resto do card vira arte com nome e segmento. */
.nf-card-art {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--card-radius);
  background: var(--bg-2);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s ease;
}
.nf-card-art .mock-win {
  top: 6%;
  left: 5%;
  right: 5%;
  bottom: auto;
  aspect-ratio: 4 / 3;
  border-radius: 2.4cqw;
}
.nf-card:focus-visible { outline: none; }
.nf-card:focus-visible .nf-card-art { outline: 2px solid var(--lime); outline-offset: 3px; }

/* Projeto real: a janelinha exibe a captura do site no lugar do esqueleto */
.mock-win--shot { background: #fff; }
.mock-win--shot .mk-shot {
  flex: 1;
  width: 100%;
  min-height: 0;
  object-fit: cover;
  object-position: top center;
}

/* ---------- Hover: o pôster salta, os vizinhos recuam ---------- */
@media (hover: hover) and (pointer: fine) {
  .nf-card:hover,
  .nf-card:focus-visible { z-index: 5; }
  .nf-card:hover .nf-card-art,
  .nf-card:focus-visible .nf-card-art {
    transform: scale(1.055) translateY(-4px);
    box-shadow: 0 20px 46px rgba(0, 0, 0, 0.62);
  }
  /* o mock ganha um respiro de zoom junto com o card */
  .nf-card-art .mock-win { transition: transform 0.35s var(--ease-out); }
  .nf-card:hover .nf-card-art .mock-win { transform: translateY(-2%) scale(1.03); }
  .nf-card-title,
  .nf-card-sub { transition: transform 0.35s var(--ease-out); }
  .nf-card:hover .nf-card-title,
  .nf-card:hover .nf-card-sub { transform: translateY(-3px); }

  .nf-track:hover .nf-card { opacity: 0.5; }
  .nf-track:hover .nf-card:hover { opacity: 1; }
  .nf-card--rank .nf-rank { transition: -webkit-text-stroke-color 0.3s ease, transform 0.35s var(--ease-out); }
  .nf-card--rank:hover .nf-rank { transform: translateX(-4px); }
}

.nf-card-flag {
  position: absolute;
  z-index: 3;
  font-weight: 700;
  line-height: 1;
}
.nf-card-flag {
  top: 0.55rem;
  right: 0.55rem;
  padding: 0.28rem 0.5rem;
  border-radius: 3px;
  background: var(--lime);
  color: var(--dark-ink);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.nf-card-title {
  position: absolute;
  z-index: 3;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 2rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(0.95rem, 1.1vw, 1.15rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.75);
  pointer-events: none;
}
.nf-card-sub {
  position: absolute;
  z-index: 3;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 0.75rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.nf-card-art::after {
  content: '';
  position: absolute;
  inset: 48% 0 0;
  z-index: 2;
  border-radius: 0 0 var(--card-radius) var(--card-radius);
  background: linear-gradient(0deg, rgba(7, 7, 12, 0.85), transparent);
  pointer-events: none;
}

/* Linha Top 5 — o numeral ocupa 46% do card e volta 10% por cima da arte,
   sobrando 64% para ela. O card cresce exatamente nessa proporção, então a
   arte fica do tamanho de um card comum em qualquer largura de tela. */
.nf-row--top { --arte: 0.64; }
.nf-card--rank {
  flex: 0 0 calc((100% - (var(--per) - 1) * var(--gap)) / var(--per) / var(--arte));
}
.nf-card--rank { display: flex; align-items: stretch; container-type: inline-size; }
.nf-card--rank .nf-rank {
  flex: 0 0 46%;
  /* sem isto o glifo (largo no 2, 3, 4…) empurra a arte e cada card do Top 5
     sai de um tamanho; com min-width: 0 a caixa fica fixa e o número
     transborda para a esquerda, por trás do pôster vizinho */
  min-width: 0;
  position: relative;
  z-index: 0;
  display: grid;
  place-items: end end;
  margin-right: -10%;
  padding-bottom: 0.02em;
  font-family: var(--font-display);
  font-weight: 700;
  /* No pôster alto o numeral cresce junto: o tamanho é fração da largura
     do card (cqw), não do viewport. Ocupa quase toda a altura da arte. */
  font-size: 108cqw;
  line-height: 0.74;
  letter-spacing: -0.06em;
  color: var(--bg);
  -webkit-text-stroke: 3px rgba(255, 255, 255, 0.5);
  user-select: none;
  transition: -webkit-text-stroke-color 0.3s ease;
}
.nf-card--rank:hover .nf-rank { -webkit-text-stroke-color: var(--lime); }
/* z-index acima do numeral: o pôster nunca fica coberto pelo número do card seguinte */
.nf-card--rank .nf-card-art { flex: 1 1 auto; min-width: 0; z-index: 1; }

/* ============================================================
   POPUP — só a prévia do site (margens iguais, rola por dentro)
   ============================================================ */
.nf-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: clamp(1rem, 4vh, 3rem) clamp(1rem, 3vw, 2.5rem);
  visibility: hidden;
}
.nf-modal.is-open { visibility: visible; }
.nf-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 8, 0.8);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.nf-modal.is-open .nf-modal-backdrop { opacity: 1; }

.nf-modal-box {
  position: relative;
  width: min(1180px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: #141419;
  border: 1px solid var(--border);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  transition: opacity 0.35s ease, transform 0.45s var(--ease-out);
}
.nf-modal.is-open .nf-modal-box { opacity: 1; transform: none; }

/* Janela do navegador */
.nf-live {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #0b0b10;
}
.nf-live-chrome {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.7rem;
  background: #1d1d24;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}
.nf-live-dots { display: flex; gap: 0.35rem; padding-right: 0.25rem; }
.nf-live-dots i { width: 11px; height: 11px; border-radius: 50%; background: #3a3a45; }
.nf-live-dots i:nth-child(1) { background: #ff5f57; }
.nf-live-dots i:nth-child(2) { background: #febc2e; }
.nf-live-dots i:nth-child(3) { background: #28c840; }
.nf-live-url {
  flex: 1;
  min-width: 0;
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  background: #0e0e14;
  border: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 0.8rem;
  color: #b9bcc9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Seletor de tela: ícones, ao lado do recarregar */
.nf-live-devices {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: #0e0e14;
  border: 1px solid rgba(255, 255, 255, 0.09);
  flex-shrink: 0;
}
.nf-live-devices button {
  width: 30px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.nf-live-devices button svg { width: 15px; height: 15px; }
.nf-live-devices button:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.nf-live-devices button.is-on { background: var(--lime); color: var(--dark-ink); }
.nf-live-dim {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.nf-live-ic {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #b9bcc9;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.3s var(--ease-out);
}
.nf-live-ic svg { width: 16px; height: 16px; }
.nf-live-ic:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.nf-live-ic--fechar:hover { background: var(--lime); color: var(--dark-ink); transform: rotate(90deg); }

/* Palco: ocupa toda a altura restante; quem rola é o iframe */
.nf-live-palco {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  /* nada rola aqui: quem rola é o site dentro do iframe */
  overflow: hidden;
  overscroll-behavior: contain;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(213, 255, 63, 0.05), transparent 70%),
    #0b0b10;
}
.nf-live-viewport {
  flex-shrink: 0;
  transform-origin: top center;
  overflow: hidden;
  background: #fff;
  border-radius: 10px;
  transition: box-shadow 0.3s ease, border-radius 0.3s ease;
}
/* Moldura de aparelho: bisel visível dos quatro lados, cantos arredondados
   e a mesma sombra do popup para o vidro não parecer colado no fundo. */
.nf-live-viewport[data-tela='tablet'],
.nf-live-viewport[data-tela='mobile'] {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 11px #16161d,
    0 0 0 12px rgba(255, 255, 255, 0.06),
    0 26px 60px rgba(0, 0, 0, 0.55);
}
.nf-live-viewport[data-tela='tablet'] { border-radius: 16px; }
.nf-live-viewport[data-tela='mobile'] { border-radius: 26px; }
.nf-live-viewport[data-tela='desktop'] { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07); border-radius: 10px 10px 0 0; }

.nf-live-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
}

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 1280px) {
  .nf-row { --per: 5; }
}
@media (max-width: 1024px) {
  .nf-row { --per: 4; }
}
@media (max-width: 900px) {

  /* No celular a prévia já abre em mobile: o seletor de tela não faz sentido */
  .nf-live-devices, .nf-live-dim { display: none; }
  .nf-modal { padding: clamp(0.8rem, 3vh, 1.6rem) clamp(0.7rem, 3vw, 1.4rem); }
}

/* ---------- Mobile: menos pôsteres por linha, sem setas ---------- */
@media (max-width: 760px) {
  .nf-row { --per: 2.6; }
  .nf-arrow { display: none; }
  .nf-track {
    scroll-snap-type: x proximity;
    padding-inline: 0;
  }
  .nf-card-title { font-size: 1.05rem; }
}
@media (max-width: 560px) {
  .nf-row { --per: 1.85; }
    .nf-card-flag { font-size: 0.58rem; }
}

@media (prefers-reduced-motion: reduce) {
  .nf-track { scroll-behavior: auto; }
}
