/* ═══════════════════════════════════════════════════════════
   HN Services — Portfólio HORIZONTAL
   ─────────────────────────────────────────────────────────
   O scroll vertical dirige a translação horizontal do track
   (GSAP pin + scrub). 1 painel = 1 projeto: info à esquerda,
   moldura de browser com o vídeo do site à direita.

   Performance: só o painel ativo toca vídeo (JS). Sem
   backdrop-filter / mix-blend-mode no palco. Mobile (<=900px):
   o pin sai, os painéis empilham e cada vídeo toca ao entrar
   na tela (IntersectionObserver).

   Camadas (§4B): palco 1 · progresso/head 6 · lightbox 1200+
   ═══════════════════════════════════════════════════════════ */

.pf-root {
  position: relative;
  width: 100%;
  background: var(--bg);
  isolation: isolate;
}

/* ── Viewport preso ─────────────────────────────────────── */
.pf-pin {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

/* ── Cabeçalho fixo sobre o track ───────────────────────── */
.pf-head {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 6;
  pointer-events: none;
  width: min(1300px, 92vw);
  margin: 0 auto;
  padding-top: clamp(100px, 13vh, 124px);   /* SEMPRE abaixo da nav (~92px) */
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
}
.pf-head__label { color: var(--accent); display: block; margin-bottom: var(--space-3); }
.pf-head__title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.9vw, 2.4rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  padding-right: 0.25em;
  color: var(--white);
}
.pf-head__right { text-align: right; flex-shrink: 0; }
.pf-head__count {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2.2rem);
  letter-spacing: -0.02em;
  color: var(--white);
  display: block;
}
.pf-head__count i { font-style: normal; color: var(--accent); }
.pf-head__count b { font-weight: 400; color: rgba(245, 240, 232, 0.5); }
.pf-head__hint {
  display: block;
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(245, 240, 232, 0.62);
}

/* ── Track horizontal ───────────────────────────────────── */
.pf-track {
  display: flex;
  height: 100%;
  will-change: transform;
}
.pf-panel {
  flex: 0 0 100vw;
  height: 100%;
  display: grid;
  align-items: center;
  /* topo generoso: o conteúdo começa ABAIXO do cabeçalho fixo (label + título
     + contador), senão a moldura do vídeo encostava no título / contador. */
  padding: clamp(184px, 24vh, 250px) 0 clamp(48px, 6vh, 80px);
}
.pf-panel__inner {
  width: min(1300px, 90vw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(28px, 4vw, 60px);
  align-items: center;
}

/* ── Info ───────────────────────────────────────────────── */
.pf-info__top { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-4); }
.pf-info__idx { color: var(--accent); font-family: var(--font-mono); font-size: var(--text-sm); }
.pf-info__tier {
  font-family: var(--font-mono); font-size: var(--text-xs);
  letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(245, 240, 232, 0.72);
  padding: 3px var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}
.pf-info__name {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, 3.2rem);
  line-height: 1.03; letter-spacing: -0.03em;
  padding-right: 0.25em;
  color: var(--white);
  margin-bottom: var(--space-2);
}
.pf-info__cat { display: block; color: var(--accent); margin-bottom: var(--space-4); }
.pf-info__desc {
  color: rgba(245, 240, 232, 0.78);
  line-height: 1.65;
  margin-bottom: var(--space-5);
  font-size: var(--text-base);
  max-width: 44ch;
}
.pf-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin-bottom: var(--space-6); }
.pf-tags li {
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: rgba(245, 240, 232, 0.82);
  padding: 4px var(--space-3);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.pf-info__actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

/* ── Moldura de browser + vídeo ─────────────────────────── */
.pf-browser {
  position: relative;
  width: 100%;
  max-width: 600px;               /* menor: sobra espaço p/ o cabeçalho inteiro */
  justify-self: end;              /* ancora à direita, espelhando a info à esquerda */
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.95);
}
.pf-browser::after {              /* fio na cor do projeto */
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--accent);
  z-index: 2;
}
.pf-browser__bar {
  display: flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 var(--space-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.pf-browser__tl { width: 9px; height: 9px; border-radius: var(--radius-full); background: rgba(255, 255, 255, 0.16); }
.pf-browser__url {
  margin-left: var(--space-3);
  font-family: var(--font-mono); font-size: 0.72rem;
  color: rgba(245, 240, 232, 0.64);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-browser__view { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #0b0b0b; }
.pf-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
}

/* ── Barra de progresso ─────────────────────────────────── */
.pf-progress {
  position: absolute; left: 0; bottom: 0; z-index: 6;
  height: 3px; width: 100%;
  background: rgba(255, 255, 255, 0.07);
}
.pf-progress__fill {
  display: block; height: 100%; width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

/* ── Telas baixas (notebooks): cabeçalho mais enxuto ────────
   Em pouca altura o cabeçalho encolhe menos que o padding do painel,
   então a moldura chegava a encostar no título. Aqui reduzimos o
   cabeçalho e o espaço inferior para devolver folga no topo. */
@media (min-width: 901px) and (max-height: 820px) {
  /* cabeçalho continua abaixo da nav (padding-top NÃO muda); só encolhemos
     título, vídeo e espaços para caber tudo em pouca altura. */
  .pf-head__title { font-size: clamp(1.3rem, 2.1vw, 1.7rem); }
  .pf-head__count { font-size: clamp(1.3rem, 2.2vw, 1.9rem); }
  .pf-panel { padding-top: clamp(150px, 21vh, 178px); padding-bottom: clamp(24px, 3.5vh, 44px); }
  .pf-browser { max-width: 520px; }
  .pf-info__desc { margin-bottom: var(--space-3); }
  .pf-tags { margin-bottom: var(--space-3); }
}

/* ── Mobile / telas estreitas: carrossel horizontal NATIVO ──
   Sem pin/GSAP: o próprio track é um scroller horizontal por swipe,
   com scroll-snap. Cada painel empilha vídeo em cima, info embaixo. */
@media (max-width: 900px) {
  .pf-pin { height: auto; overflow: visible; }
  .pf-head {
    position: relative;
    width: 90vw;
    padding-top: 0;
    margin: 0 auto var(--space-6);
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
  }
  .pf-head__title { font-size: clamp(1.6rem, 7vw, 2.2rem); }
  .pf-head__hint { display: none; }

  .pf-track {
    flex-direction: row;
    height: auto;
    transform: none !important;                 /* GSAP não mexe aqui no mobile */
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;          /* momentum no iOS */
    gap: var(--space-4);
    padding: 0 7vw var(--space-4);
    scrollbar-width: none;                       /* Firefox */
  }
  .pf-track::-webkit-scrollbar { display: none; }

  .pf-panel {
    flex: 0 0 86vw;
    height: auto;
    padding: 0;
    scroll-snap-align: center;
  }
  .pf-panel__inner { grid-template-columns: 1fr; gap: var(--space-4); width: 100%; }
  .pf-browser { order: -1; }                     /* vídeo em cima, info embaixo */
  .pf-info__desc { max-width: none; }
  .pf-progress { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pf-video { /* fica no pôster; JS não anima */ }
}

/* ═══════════ Lightbox (site AO VIVO) — z-index 1200 ═══════════ */
.pf-lb {
  position: fixed; inset: 0; z-index: 1200;
  display: none;
  align-items: center; justify-content: center;
  padding: clamp(0.5rem, 3vw, 2rem);
  background: rgba(5, 5, 5, 0.85);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}
.pf-lb.is-mounted { display: flex; }
.pf-lb.is-in { opacity: 1; }

.pf-lb__panel {
  display: flex; flex-direction: column;
  width: min(1400px, 100%); height: min(88vh, 100%);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.95);
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transition: opacity 0.32s var(--ease-out), transform 0.32s var(--ease-out);
}
.pf-lb.is-in .pf-lb__panel { opacity: 1; transform: none; }

.pf-lb__bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  height: 50px; padding: 0 var(--space-3) 0 var(--space-5);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pf-lb__left { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.pf-lb__dot { width: 9px; height: 9px; border-radius: var(--radius-full); background: var(--accent); box-shadow: 0 0 10px var(--glow); flex-shrink: 0; }
.pf-lb__name { font-family: var(--font-display); color: var(--white); font-size: var(--text-base); }
.pf-lb__url { font-family: var(--font-mono); font-size: var(--text-xs); color: rgba(245, 240, 232, 0.62); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-lb__right { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }

.pf-lb__seg { display: flex; gap: 2px; background: rgba(255, 255, 255, 0.05); border-radius: var(--radius-sm); padding: 3px; }
.pf-lb__seg button {
  font-family: var(--font-mono); font-size: var(--text-xs);
  padding: 4px var(--space-3);
  color: rgba(245, 240, 232, 0.72);
  background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.pf-lb__seg button.is-active { background: rgba(255, 255, 255, 0.12); color: var(--white); }

.pf-lb__open {
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--white); text-decoration: none;
  padding: var(--space-2) var(--space-4);
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  transition: background 0.3s var(--ease-out);
}
.pf-lb__open:hover { background: rgba(255, 255, 255, 0.16); }
.pf-lb__close {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  color: rgba(245, 240, 232, 0.7);
  background: rgba(255, 255, 255, 0.05);
  border: 0; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 18px; line-height: 1;
  transition: background 0.3s var(--ease-out), color 0.3s var(--ease-out);
}
.pf-lb__close:hover { background: rgba(255, 80, 80, 0.25); color: var(--white); }

.pf-lb__stage {
  position: relative; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  background: #0b0b0b;
}
.pf-lb__loading {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: var(--text-sm);
  color: rgba(245, 240, 232, 0.72);
}
.pf-lb__wrap {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  transition: max-width 0.45s var(--ease-out);
}
.pf-lb.is-mobile .pf-lb__wrap { max-width: 400px; padding: var(--space-4) 0; }
.pf-lb__frame { width: 100%; height: 100%; border: 0; background: #fff; }
.pf-lb.is-mobile .pf-lb__frame { border-radius: var(--radius-lg); border: 8px solid var(--surface-2); }

@media (max-width: 767px) {
  .pf-lb { padding: 0; }
  .pf-lb__panel { height: 100%; border-radius: 0; }
  .pf-lb__url, .pf-lb__seg { display: none; }
}
