/* ============================================================
   BEMOREX — PORTFOLIO COMPONENTS
   Archivo: portfolio-components.css
   Uso: Importar en cualquier página de caso de estudio.

   Variables de personalización por proyecto
   (definir en el HTML de cada página):

     --pf-accent          Color principal del hero (ej: #d56582)
     --pf-accent-border   Borde del carrusel (ej: rgba(213,101,130,0.5))
     --pf-accent-shadow   Sombra del carrusel (ej: rgba(213,101,130,0.15))
     --pf-accent-text     Color del texto del carrusel (ej: rgba(213,101,130,0.8))

   Ejemplo de uso en HTML:
     <div id="smooth-content" style="
       --pf-accent:        #d56582;
       --pf-accent-border: rgba(213, 101, 130, 0.5);
       --pf-accent-shadow: rgba(213, 101, 130, 0.15);
       --pf-accent-text:   rgba(213, 101, 130, 0.8);
     ">
============================================================ */

/* ----------------------------------------------------------
   1. HERO: .title-area
   Componente de cabecera de cada proyecto.
   El color de fondo se controla con --pf-accent.
---------------------------------------------------------- */
.title-area {
  background: var(--pf-accent, var(--primary-color1));
  display: flex;
  align-items: center;
  overflow: hidden;
  min-height: 420px;
  position: relative;
}

.title-area::before {
  content: "";
  position: absolute;
  top: -80px;
  left: -80px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  pointer-events: none;
}

.title-section {
  padding: 5%;
  flex: 1;
}

.title-section--img {
  flex: 1.2;
  padding-top: 5%;
  align-self: stretch;
  display: flex;
  align-items: flex-end;
}

.title-tag {
  display: inline-block;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 12px;
}

.title-text {
  color: #fff !important;
  font-size: clamp(3rem, 6vw, 5.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 0 0 32px 0;
}

.title-meta {
  display: flex;
  flex-direction: column;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.meta-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.meta-row:last-child {
  border-bottom: none;
}

.meta-label {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: auto;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
}

.meta-value {
  font-size: 1rem;
  color: #fff;
  line-height: 1.4;
}

.meta-link {
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  transition:
    border-color 0.2s ease,
    opacity 0.2s ease;
}

.meta-link:hover {
  border-bottom-color: #fff;
  opacity: 0.85;
}

.title-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  border-radius: 15px;
}

/* ----------------------------------------------------------
   2. SECCIÓN LABEL
   Etiqueta superior de cada sección.
---------------------------------------------------------- */
.section-label {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-color);
  margin-bottom: 16px;
}

/* ----------------------------------------------------------
   3. CARRUSEL DE TECNOLOGÍAS
   Borde y sombra usan --pf-accent-border y --pf-accent-shadow.
   Fades usan --dark-white-color del sistema (responde a tema).
---------------------------------------------------------- */
.tech-carousel-section {
  padding: 48px 0;
}

.carousel-wrapper {
  position: relative;
  width: 100%;
}

.carousel-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 120px;
  z-index: 2;
  pointer-events: none;
}

.carousel-fade--left {
  left: 0;
  background: linear-gradient(to right, var(--dark-white-color), transparent);
}

.carousel-fade--right {
  right: 0;
  background: linear-gradient(to left, var(--dark-white-color), transparent);
}

.carousel {
  overflow: hidden;
  width: 100%;
}

.track {
  display: flex;
  gap: 16px;
  width: max-content;
  animation: scroll-track 24s linear infinite;
}

.carousel:hover .track {
  animation-play-state: paused;
}

.track-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 28px;
  border: 1px solid var(--pf-accent-border, rgba(255, 144, 0, 0.3));
  border-radius: 16px;
  background: transparent;
  min-width: 10%;
  box-shadow: 0 6px 20px var(--pf-accent-shadow, rgba(255, 144, 0, 0.1));
  transition: transform 0.25s;
  margin-top: 10px;
}

.track-item:hover {
  transform: translateY(-3px);
}

.track-item img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.track-item span {
  font-size: 1.5rem;
  color: var(--pf-accent-text, var(--text-color));
  white-space: nowrap;
}

@keyframes scroll-track {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* ----------------------------------------------------------
   4. DIAGONAL SCROLLING SCREENSHOTS
   Columnas de capturas con scroll automático vertical.
---------------------------------------------------------- */
.diagonal-section {
  display: flex;
  gap: 20px;
  padding: 100px;
  transform: rotate(-5deg);
  overflow: hidden;
}

.scroll-box {
  width: 250px;
  flex-shrink: 0;
  height: 500px;
  overflow: hidden;
  border-radius: 20px;
  border: solid 3px var(--title-color);
  background: #000;
  position: relative;
}

.scroll-box img {
  width: 100%;
  position: absolute;
}

.scroll-up-down img {
  animation: scrollUpDown 12s ease-in-out infinite;
  top: 0;
}

.scroll-down-up img {
  animation: scrollDownUp 12s ease-in-out infinite;
  top: -60%;
}

@keyframes scrollUpDown {
  0% {
    top: 0;
  }
  50% {
    top: -60%;
  }
  100% {
    top: 0;
  }
}

@keyframes scrollDownUp {
  0% {
    top: -60%;
  }
  50% {
    top: 0;
  }
  100% {
    top: -60%;
  }
}

@media (max-width: 992px) {
  .diagonal-section {
    padding: 60px 20px;
    gap: 12px;
  }

  .scroll-box {
    width: 180px;
    height: 360px;
  }
}

@media (max-width: 576px) {
  .diagonal-section {
    padding: 40px 12px;
    gap: 8px;
  }

  .scroll-box {
    width: 130px;
    height: 280px;
    border-radius: 14px;
  }
}

/* ----------------------------------------------------------
   5. ANIMACIÓN V DE TELÉFONOS
   Requiere JS: phones-v-animation.js
   Estados: inicial → crossing → animated
---------------------------------------------------------- */
.phones-v-wrapper {
  position: relative;
  height: 520px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.phone-left,
.phone-right {
  position: absolute;
  bottom: 0;
  width: 200px;
}

.phone-left img,
.phone-right img {
  width: 100%;
  height: auto;
  border-radius: 24px;
}

/* Estado inicial: fuera de pantalla */
.phone-left {
  transform: translateX(-340px) translateY(-40px);
  opacity: 0;
}
.phone-right {
  transform: translateX(340px) translateY(-40px);
  opacity: 0;
}

/* Estado final: forma de V */
.phones-v-wrapper.animated .phone-left {
  transform: translateX(-80px) rotate(-12deg);
  opacity: 1;
  transition:
    transform 1.1s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.6s ease;
}

.phones-v-wrapper.animated .phone-right {
  transform: translateX(80px) rotate(12deg);
  opacity: 1;
  transition:
    transform 1.1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.08s,
    opacity 0.6s ease 0.08s;
}

/* Fase de cruce */
.phones-v-wrapper.crossing .phone-left {
  transform: translateX(20px) translateY(-20px) rotate(6deg);
  opacity: 1;
  z-index: 2;
  transition:
    transform 0.55s cubic-bezier(0.4, 0, 0.6, 1),
    opacity 0.3s ease;
}

.phones-v-wrapper.crossing .phone-right {
  transform: translateX(-20px) translateY(-20px) rotate(-6deg);
  opacity: 1;
  z-index: 1;
  transition:
    transform 0.55s cubic-bezier(0.4, 0, 0.6, 1) 0.05s,
    opacity 0.3s ease 0.05s;
}

/* ----------------------------------------------------------
   7. MUESTRA TIPOGRÁFICA
   Bloque oscuro para mostrar la fuente del proyecto.
   Fondo hardcodeado intencional — siempre oscuro por diseño.
---------------------------------------------------------- */
.pf-typo-sample {
  background: var(--pf-typo-bg, #1a1a1a);
  border-radius: 16px;
  padding: 48px;
}

.pf-typo-sample__label {
  font-size: 0.65rem !important;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35) !important;
  margin-bottom: 20px;
}

.pf-typo-sample__name {
  font-size: clamp(2.5rem, 6vw, 5rem) !important;
  font-weight: 700;
  line-height: 1;
  color: #fff !important;
  margin-bottom: 16px;
  letter-spacing: -0.03em;
}

.pf-typo-sample__chars {
  font-size: 0.9rem !important;
  color: rgba(255, 255, 255, 0.35) !important;
  letter-spacing: 0.04em;
  margin-bottom: 28px;
  line-height: 1.8 !important;
}

.pf-typo-sample__weights {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.pf-typo-sample__weights span {
  color: rgba(255, 255, 255, 0.45) !important;
  font-size: 0.8rem;
}

/* ----------------------------------------------------------
   8. SWATCHES DE COLOR
   Bloque rectangular para mostrar la paleta del proyecto.
   El color de fondo se aplica con style="background-color: #xxx"
   directamente en el HTML.
---------------------------------------------------------- */
.pf-color-swatch {
  height: 220px;
  border-radius: 16px;
  margin-bottom: 20px;
}
/* ----------------------------------------------------------
   9. PULSO HORIZONTAL DE CELULARES
---------------------------------------------------------- */
.phones-pulse-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 60px 40px;
  overflow: hidden;
}

.phone-pulse-item {
  flex-shrink: 0;
  width: 200px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: phonePulse 3s ease-in-out infinite;
}

.phone-pulse-item:nth-child(1) {
  animation-delay: 0s;
}
.phone-pulse-item:nth-child(2) {
  animation-delay: 0.3s;
}
.phone-pulse-item:nth-child(3) {
  animation-delay: 0.6s;
}
.phone-pulse-item:nth-child(4) {
  animation-delay: 0.9s;
}
.phone-pulse-item:nth-child(5) {
  animation-delay: 1.2s;
}

.phone-pulse-item img {
  width: 100%;
  height: auto;
  display: block;
}

@keyframes phonePulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

/* --- Móvil: scroll horizontal ----------------------------- */
@media (max-width: 768px) {
  .phones-pulse-section {
    justify-content: flex-start;
    /* Crítico: reemplaza overflow:hidden por scroll horizontal */
    overflow-x: auto;
    overflow-y: visible;
    padding: 40px 24px;
    gap: 16px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .phones-pulse-section::-webkit-scrollbar {
    display: none;
  }

  .phone-pulse-item {
    scroll-snap-align: center;
    width: 160px;
    /* Resetea el transform para que no quede congelado */
    animation: none;
    transform: scale(1);
  }
}

/* ----------------------------------------------------------
   10. CARRUSEL DE CAPTURAS DE CELULAR — RESPONSIVE
---------------------------------------------------------- */
.phone-carousel-section {
  padding: 20px 0;
}

.phone-carousel-wrapper {
  position: relative;
  width: 100%;
}

.phone-carousel-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 140px;
  z-index: 2;
  pointer-events: none;
}

/* En móvil los fades son más estrechos */
@media (max-width: 768px) {
  .phone-carousel-fade {
    width: 48px;
  }
}

.phone-carousel-fade--left {
  left: 0;
  background: linear-gradient(to right, var(--dark-white-color), transparent);
}

.phone-carousel-fade--right {
  right: 0;
  background: linear-gradient(to left, var(--dark-white-color), transparent);
}

.phone-carousel {
  overflow: hidden;
  width: 100%;
}

.phone-track {
  display: flex;
  gap: 60px;
  width: max-content;
  animation: phone-scroll-track 18s linear infinite;
  padding-top: 20px;
  padding-bottom: 20px;
}

@media (max-width: 768px) {
  .phone-track {
    gap: 12px;
    animation-duration: 20s;
  }
}

.phone-carousel:hover .phone-track {
  animation-play-state: paused;
}

.phone-track-item {
  flex-shrink: 0;
  width: 200px;
  border-radius: 20px;
  overflow: hidden;
  border: 4px solid var(--text-color, rgba(255, 144, 0, 0.2));
  box-shadow: 0 8px 28px var(--text-color, rgba(0, 0, 0, 0.2));
  transition: transform 0.25s;
}

@media (max-width: 768px) {
  .phone-track-item {
    width: 130px;
    border-radius: 14px;
  }
}

.phone-track-item:hover {
  transform: translateY(-6px);
}

/* En móvil el hover no aplica — es touch */
@media (max-width: 768px) {
  .phone-track-item:hover {
    transform: none;
  }
}

.phone-track-item img {
  width: 100%;
  height: auto;
  display: block;
}

@keyframes phone-scroll-track {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}
/* ----------------------------------------------------------
   CARD STACK ANIMATION — sin position absolute
---------------------------------------------------------- */
.card-stack-wrapper {
  display: flex;
  align-items: flex-start;
  justify-content: flex-center;
  padding: 40px 0 0 0;
  gap: 0;
}

.card-stack-left {
  width: 400px;
  z-index: 1;
  position: relative;
}

.card-stack-right {
  width: 380px;
  z-index: 2;
  position: relative;
  margin-top: 100px;
  margin-left: -65px;
}
.card-stack-left,
.card-stack-right {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 10px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  opacity: 0;
  transform: translateY(80px);
  transition:
    opacity 0.8s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-stack-left.card-stack--visible,
.card-stack-right.card-stack--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Izquierda: arriba */
.card-stack-left {
  height: 280px;
  z-index: 1;
  position: relative;
}

/* Derecha: baja 160px y retrocede 120px para solapar 1/4 */
.card-stack-right {
  z-index: 2;
  position: relative;
  margin-top: 160px;
  margin-left: -160px; /* solapamiento de ~1/4 de la card izquierda */
}

.card-stack-left img,
.card-stack-right img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Responsive */
@media (max-width: 768px) {
  .card-stack-left {
    width: 220px;
    height: 150px;
  }
  .card-stack-right {
    width: 170px;
    height: 175px;
    margin-top: 100px;
    margin-left: -55px;
  }
}

.rounded-20 {
  border-radius: 20px;
}
