/**
 * PROMAKEART — SEÇÃO DE PORTFÓLIO & GALERIA 3D CONTÍNUA
 * Inspirada na experiência imersiva de movimento horizontal, perspectiva e profundidade (Jesper Landberg)
 * Identidade visual nativa Promakeart: fundo escuro editorial, 3D suave, tabs minimalistas
 */

/* ── Container da Seção ── */
.pm-sec-portfolio {
  position: relative;
  background: #07070a;
  color: #f4f1ea;
  padding: clamp(80px, 9vh, 140px) 0 clamp(90px, 10vh, 150px);
  overflow: hidden;
  isolation: isolate;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── Iluminação & Cenário de Profundidade ── */
.pm-portfolio-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.pm-portfolio-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 70% at 50% 40%, rgba(19, 16, 28, 0.75) 0%, #07070a 85%);
}

.pm-portfolio-glow {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: min(1000px, 90vw);
  height: 480px;
  background: radial-gradient(circle, rgba(255, 118, 7, 0.07) 0%, rgba(123, 47, 247, 0.06) 45%, transparent 70%);
  filter: blur(50px);
  opacity: 0.85;
}

.pm-portfolio-grid-floor {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 220px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(255, 95, 14, 0.04) 0%, transparent 75%),
    linear-gradient(to top, rgba(7, 7, 10, 0.95), transparent 90%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* ── Container & Cabeçalho ── */
.pm-portfolio-container {
  position: relative;
  z-index: 2;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pm-portfolio-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 var(--upw-pad, 24px);
}

.pm-portfolio-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font: 600 11px/1 var(--upw-mono, monospace);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.pm-portfolio-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff5f0e;
  box-shadow: 0 0 8px #ff5f0e;
}

.pm-portfolio-title {
  margin: 0;
  font: 900 clamp(32px, 4.4vw, 58px)/1.08 var(--upw-sans, sans-serif);
  letter-spacing: -.035em;
  color: #f4f1ea;
}

.pm-portfolio-title-italic {
  font-family: var(--upw-serif, serif);
  font-style: italic;
  font-weight: 400;
  background: linear-gradient(135deg, #ff7607 0%, #ff3b1f 52%, #cf28b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  padding: 0 4px;
}

.pm-portfolio-lead {
  margin: 0;
  font-size: clamp(15px, 1.25vw, 17.5px);
  line-height: 1.55;
  color: rgba(244, 241, 234, 0.65);
  max-width: 640px;
}

/* ── Abas Editoriais Minimalistas ── */
.pm-portfolio-tabs {
  display: inline-flex;
  align-items: center;
  gap: clamp(24px, 3.8vw, 44px);
  margin-top: 14px;
  position: relative;
  padding-bottom: 2px;
}

.pm-portfolio-tab {
  background: none;
  border: none;
  padding: 10px 4px 12px;
  font: 600 clamp(11.5px, 1.1vw, 13px)/1 var(--upw-mono, monospace);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, 0.42);
  cursor: pointer;
  position: relative;
  transition: color .25s ease, opacity .25s ease;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pm-portfolio-tab:hover {
  color: rgba(244, 241, 234, 0.85);
}

.pm-portfolio-tab.is-active {
  color: #ffffff;
}

.pm-portfolio-tab__indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #ff7607, #ff3b1f);
  border-radius: 2px;
  opacity: 0;
  transform: scaleX(0.25);
  transform-origin: center;
  transition: transform .35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity .3s ease;
}

.pm-portfolio-tab.is-active .pm-portfolio-tab__indicator {
  opacity: 1;
  transform: scaleX(1);
  box-shadow: 0 0 12px rgba(255, 118, 7, 0.65);
}

.pm-portfolio-tab:focus-visible {
  outline: 2px solid #ff7607;
  outline-offset: 4px;
  border-radius: 4px;
}

/* ── Palco da Galeria 3D ── */
.pm-portfolio-stage {
  position: relative;
  width: 100%;
  margin-top: clamp(34px, 4.5vh, 56px);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  overflow: hidden;
}

.pm-portfolio-stage,
.pm-portfolio-stage * {
  -webkit-user-drag: none;
  user-drag: none;
}

.pm-portfolio-stage.is-dragging,
.pm-portfolio-stage.is-dragging * {
  cursor: grabbing !important;
}

/* Dica de arrastar sutil */
.pm-portfolio-drag-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
  font: 500 11px/1 var(--upw-mono, monospace);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, 0.38);
  pointer-events: none;
  transition: opacity .3s ease;
}

.pm-portfolio-drag-hint svg {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.pm-portfolio-stage.is-dragging .pm-portfolio-drag-hint {
  opacity: 0.15;
}

/* ── Viewport com Perspectiva 3D ── */
.pm-portfolio-viewport {
  position: relative;
  width: 100%;
  height: 480px;
  perspective: 1250px;
  perspective-origin: 50% 50%;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Trilho dos Cards (Loop Infinito) ── */
.pm-portfolio-track {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  will-change: transform;
  transition: opacity .35s ease, transform .35s ease;
}

.pm-portfolio-track.is-transitioning {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

/* ── Card 3D Individual ── */
.pm-portfolio-card {
  position: absolute;
  top: 50%;
  left: 0;
  width: 500px;
  height: 430px;
  margin-top: -215px; /* metade da altura */
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  border-radius: 20px;
  background: #111019;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 24px 60px -15px rgba(0, 0, 0, 0.82),
    0 0 1px 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: grab;
  transition:
    border-color .32s ease,
    box-shadow .32s ease,
    background .32s ease;
  outline: none;
}

.pm-portfolio-card:hover {
  border-color: rgba(255, 118, 7, 0.45);
  box-shadow:
    0 32px 75px -10px rgba(0, 0, 0, 0.95),
    0 0 28px rgba(255, 118, 7, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.pm-portfolio-card.is-img-missing {
  display: none !important;
}

/* Moldura e Imagem do Mockup */
.pm-portfolio-card__frame {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  background: #09080e;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-portfolio-card__frame picture {
  width: 100%;
  height: 100%;
  display: block;
}

.pm-portfolio-card__frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(17, 16, 25, 0.8) 0%, transparent 40%);
  pointer-events: none;
  z-index: 2;
}

.pm-portfolio-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pm-portfolio-card:hover .pm-portfolio-card__img {
  transform: scale(1.035);
}

/* Rodapé / Metadados do Card */
.pm-portfolio-card__meta {
  padding: 15px 20px 16px;
  background: #111019;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.pm-portfolio-card__title {
  font: 700 15px/1.2 var(--upw-sans, sans-serif);
  color: #f4f1ea;
  margin: 0;
  letter-spacing: -.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-portfolio-card__tag {
  font: 600 10px/1 var(--upw-mono, monospace);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, 0.52);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

/* ── Responsividade / Breakpoints ── */

/* Telas Grandes (>= 1600px) */
@media (min-width: 1600px) {
  .pm-portfolio-viewport {
    height: 520px;
  }
  .pm-portfolio-card {
    width: 530px;
    height: 460px;
    margin-top: -230px;
  }
}

/* Desktop Médio / Notebook (1025px - 1440px) */
@media (max-width: 1440px) {
  .pm-portfolio-viewport {
    height: 460px;
  }
  .pm-portfolio-card {
    width: 480px;
    height: 410px;
    margin-top: -205px;
  }
}

/* Tablets (769px - 1024px) */
@media (max-width: 1024px) {
  .pm-portfolio-viewport {
    height: 420px;
    perspective: 1000px;
  }
  .pm-portfolio-card {
    width: 400px;
    height: 360px;
    margin-top: -180px;
    border-radius: 18px;
  }
  .pm-portfolio-card__title {
    font-size: 14px;
  }
  .pm-portfolio-card__tag {
    font-size: 9.5px;
    padding: 4px 8px;
  }
}

/* Mobile & Telas Menores (<= 768px) */
@media (max-width: 768px) {
  .pm-sec-portfolio {
    padding: 60px 0 70px;
  }
  .pm-portfolio-header {
    gap: 12px;
  }
  .pm-portfolio-stage {
    margin-top: 24px;
  }
  .pm-portfolio-drag-hint {
    margin-bottom: 12px;
    font-size: 10px;
  }
  .pm-portfolio-viewport {
    height: clamp(340px, 86vw, 420px);
    perspective: 800px;
  }
  .pm-portfolio-card {
    width: clamp(280px, 80vw, 340px);
    height: clamp(300px, 84vw, 370px);
    margin-top: calc(clamp(300px, 84vw, 370px) * -0.5);
    border-radius: 16px;
  }
  .pm-portfolio-card__meta {
    padding: 12px 16px;
  }
  .pm-portfolio-card__title {
    font-size: 13.5px;
  }
  .pm-portfolio-card__tag {
    font-size: 9px;
    padding: 3px 7px;
  }
}

/* Telas Muito Estreitas (<= 360px) */
@media (max-width: 360px) {
  .pm-portfolio-viewport {
    height: 330px;
  }
  .pm-portfolio-card {
    width: 260px;
    height: 290px;
    margin-top: -145px;
  }
  .pm-portfolio-tabs {
    gap: 16px;
  }
  .pm-portfolio-tab {
    font-size: 11px;
    letter-spacing: .12em;
  }
}

/* ── Acessibilidade: Movimento Reduzido ── */
@media (prefers-reduced-motion: reduce) {
  .pm-portfolio-track {
    transition: none !important;
  }
  .pm-portfolio-card {
    transition: none !important;
  }
  .pm-portfolio-tab__indicator {
    transition: none !important;
  }
}
