.portfolio-page {
  background: 
    radial-gradient(circle at 12% 16%, rgba(153, 102, 221, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 82% 18%, rgba(0, 255, 163, 0.08) 0%, transparent 34%),
    var(--portfolio-bg);
  min-height: 100vh;
  color: var(--portfolio-text);
}

/* --- HERO SECTION --- */
.portfolio-hero {
  position: relative;
  overflow: hidden;
  padding: 9rem 5% 4.5rem;
  text-align: center;
}

.portfolio-hero__glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 20%, rgba(153, 102, 221, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 75% 80%, rgba(192, 132, 252, 0.1) 0%, transparent 45%);
  pointer-events: none;
}

.portfolio-hero__container {
  max-width: 1020px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.portfolio-hero__title {
  margin-top: 0.35rem;
  font-size: clamp(2.5rem, 5.4vw, 4.35rem);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.portfolio-hero__subtitle {
  margin: 1.35rem auto 0;
  max-width: 760px;
  font-size: 1.1rem;
  color: var(--portfolio-muted);
  line-height: 1.75;
}

/* --- PORTFOLIO HEADER --- */
.portfolio {
  padding: 0 5% 6.25rem;
}

.portfolio__container {
  max-width: 1240px;
  margin: 0 auto;
}

.portfolio__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.7rem;
  padding: 1.2rem;
  border: 1px solid var(--portfolio-border);
  border-radius: 1.15rem;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.portfolio__head-main {
  max-width: 760px;
}

.portfolio__eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: var(--portfolio-text);
}

.portfolio__heading {
  font-size: clamp(1.8rem, 3.2vw, 2.85rem);
  line-height: 1.2;
}

.portfolio__description {
  color: var(--portfolio-muted);
  line-height: 1.7;
  font-size: 1rem;
}

.portfolio__head-meta {
  display: grid;
  gap: 0.55rem;
  min-width: 220px;
}

.portfolio__meta-item {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 2.15rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.02);
  color: #ececf2;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.portfolio__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 3.5rem;
}

.portfolio__tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: #dec7ff;
  letter-spacing: 0.02em;
  background: rgba(153, 102, 221, 0.12);
  border: 1px solid rgba(153, 102, 221, 0.35);
}

/* --- REFINED PROJECT LIST SYSTEM --- */
.portfolio__list {
  display: flex;
  flex-direction: column;
  gap: 5rem;
}

.portfolio__project {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 4rem;
  align-items: center;
  padding: 3rem;
  border-radius: 2rem;
  border: 1px solid var(--portfolio-border);
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.4s ease;
}

.portfolio__project:hover {
  border-color: rgba(153, 102, 221, 0.5);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(153, 102, 221, 0.15);
  transform: translateY(-6px);
  background: rgba(255, 255, 255, 0.035);
}

/* Diseño alternado (Cebreado) */
.portfolio__project:nth-child(even) {
  grid-template-columns: 1.2fr 0.8fr;
}
.portfolio__project:nth-child(even) .portfolio__project-content {
  order: 2;
}

.portfolio__project-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.portfolio__project-title {
  font-size: clamp(1.8rem, 2.5vw, 2.2rem);
  font-weight: 700;
  margin: 0;
}

.portfolio__project-desc {
  color: var(--portfolio-muted);
  line-height: 1.7;
  font-size: 1.05rem;
}

.portfolio__project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.portfolio__project-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #d7d7e1;
}

.portfolio__project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(153, 102, 221, 0.1);
  border: 1px solid rgba(153, 102, 221, 0.35);
  border-radius: 999px;
  color: #dec7ff;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.3s ease;
  align-self: flex-start;
}

.portfolio__project-link:hover {
  background: rgba(153, 102, 221, 0.25);
  border-color: rgba(153, 102, 221, 0.6);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(153, 102, 221, 0.25);
}

.portfolio__project-icon {
  width: 1.2rem;
  height: 1.2rem;
}

/* --- VISUALS: PC & MOBILE MOCKUPS --- */
.portfolio__project-visuals {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

/* MOCKUP NAVEGADOR (PC) */
.portfolio__browser {
  width: min(97%, 860px);
  background: #1a1a1e;
  border-radius: clamp(0.4rem, 1.5vw, 0.75rem);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transition: transform 0.5s ease;
}

.portfolio__browser-header {
  background: #2a2a30;
  /* Fluid padding para que no se vea gigante en pantallas chicas */
  padding: clamp(0.35rem, 1.5vw, 0.6rem) clamp(0.5rem, 2vw, 1rem);
  display: flex;
  align-items: center;
  gap: clamp(0.4rem, 1.5vw, 1rem);
}

.portfolio__browser-dots {
  display: flex;
  gap: clamp(0.2rem, 1vw, 0.4rem);
}

.portfolio__browser-dots span {
  width: clamp(5px, 1.2vw, 8px);
  height: clamp(5px, 1.2vw, 8px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.portfolio__browser-address {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-size: clamp(0.5rem, 1.2vw, 0.65rem);
  color: #888;
  text-align: center;
  padding: clamp(0.15rem, 0.8vw, 0.2rem);
}

.portfolio__browser-body {
  background: #121216;
  display: block; /* Aspect-ratio removido para abrazar la imagen */
}

.portfolio__browser-body .portfolio__img {
  width: 100%;
  height: auto;
  display: block;
}

.portfolio__project:hover .portfolio__browser {
  transform: translateY(-5px);
}

/* MOCKUP TELÉFONO (SMARTPHONE) */
.portfolio__phone {
  position: absolute;
  right: 0;
  bottom: -1.5rem;
  width: clamp(100px, 24%, 210px);
  z-index: 10;
}

.portfolio__phone-frame {
  background: #000;
  /* Valores fluidos para evitar la deformación a forma de pastilla */
  border-radius: clamp(1rem, 4vw, 2rem);
  padding: clamp(0.2rem, 1vw, 0.4rem);
  border: clamp(1px, 0.4vw, 2px) solid #333;
  box-shadow: -15px 20px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}

/* Notch del teléfono */
.portfolio__phone-notch {
  position: absolute;
  top: clamp(0.2rem, 1vw, 0.4rem);
  left: 50%;
  transform: translateX(-50%);
  width: 35%;
  height: clamp(8px, 2.5vw, 16px);
  background: #000;
  border-bottom-left-radius: clamp(4px, 1.5vw, 12px);
  border-bottom-right-radius: clamp(4px, 1.5vw, 12px);
  z-index: 5;
}

/* Botones laterales físicos */
.portfolio__phone-frame::before {
  content: '';
  position: absolute;
  left: -3px;
  top: 20%;
  width: 3px;
  height: 15%;
  background: #444;
  border-radius: 2px 0 0 2px;
}

.portfolio__phone-screen {
  border-radius: clamp(0.8rem, 3.5vw, 1.5rem);
  overflow: hidden;
  background: #1d1d23;
  display: block; /* Aspect-ratio removido para que nunca se deforme la imagen */
}

.portfolio__phone-screen .portfolio__img {
  width: 100%;
  height: auto;
  display: block;
}

.portfolio__img {
  width: 100%;
  height: auto;
  display: block;
}

/* Ajuste móvil para tarjetas pares */
.portfolio__project:nth-child(even) .portfolio__phone {
  left: 0;
  right: auto;
}

/* --- EXTRA SECTION --- */
.portfolio-extra {
  padding: 0 5% 6.25rem;
}

.portfolio-extra__container {
  max-width: 1240px;
  margin: 0 auto;
}

.portfolio-extra__card {
  border: 1px solid var(--portfolio-border);
  border-radius: 1.25rem;
  background:
    radial-gradient(circle at 20% 20%, rgba(153, 102, 221, 0.12) 0%, transparent 36%),
    rgba(255, 255, 255, 0.025);
  padding: 2.2rem;
}

.portfolio-extra__title {
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  margin-bottom: 0.8rem;
}

.portfolio-extra__text {
  max-width: 920px;
  color: var(--portfolio-muted);
  line-height: 1.75;
}

.portfolio-extra__steps {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.portfolio-extra__step {
  display: flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.6rem 0.85rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.92rem;
}

.portfolio-extra__cta {
  display: inline-flex;
  margin-top: 1.65rem;
}

/* --- RESPONSIVE --- */
@media (max-width: 1200px) {
  .portfolio__project {
    gap: 2.8rem;
    padding: 2.3rem;
  }

  .portfolio__head {
    flex-direction: column;
    align-items: flex-start;
  }

  .portfolio__head-meta {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 992px) {
  .portfolio {
    padding-bottom: 5rem;
  }

  .portfolio__list {
    gap: 3rem;
  }

  .portfolio__project {
    grid-template-columns: 1fr !important;
    gap: 2rem;
    padding: 2.1rem;
    border-width: 0.85px;
  }

  .portfolio__project-content {
    order: 1 !important;
  }

  .portfolio__project-visuals {
    order: 2 !important;
    justify-content: center;
    margin-top: 0.4rem;
    width: 100%;
  }

  .portfolio__browser {
    width: 100%;
    border-width: 0.85px;
  }

  .portfolio__phone {
    width: clamp(118px, 28%, 200px);
    right: -2%;
    bottom: -3%;
  }

  .portfolio__project:nth-child(even) .portfolio__phone {
    left: -2%;
    right: auto;
  }

  .portfolio-extra {
    padding-bottom: 5rem;
  }

  .portfolio__head,
  .portfolio-extra__card {
    border-width: 0.85px;
  }
}

@media (max-width: 768px) {
  .portfolio-hero {
    padding-top: 7.8rem;
  }

  .portfolio__head {
    gap: 1.2rem;
    padding: 1rem;
  }

  .portfolio__head-meta {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .portfolio__description {
    font-size: 0.95rem;
  }

  .portfolio__project {
    padding: 1.65rem;
    border-radius: 1.4rem;
  }

  .portfolio__project-title {
    font-size: clamp(1.45rem, 5vw, 1.85rem);
  }

  .portfolio__project-desc {
    font-size: 0.96rem;
    line-height: 1.62;
  }

  .portfolio__phone {
    width: clamp(100px, 30%, 160px);
    bottom: -1rem;
  }
}

@media (max-width: 540px) {
  .portfolio {
    padding-left: 4%;
    padding-right: 4%;
  }

  .portfolio__tags {
    margin-bottom: 2.2rem;
  }

  .portfolio__project {
    padding: 1.2rem;
    gap: 1.35rem;
    border-radius: 1.2rem;
    border-width: 0.75px;
  }

  .portfolio__phone {
    width: clamp(90px, 32%, 140px);
    bottom: -0.5rem;
  }

  .portfolio-extra__steps {
    grid-template-columns: 1fr;
  }

  .portfolio-extra__card {
    padding: 1.4rem;
    border-width: 0.75px;
  }

  .portfolio-extra__cta {
    margin-top: 1.2rem;
  }
}

@media (max-width: 400px) {
  .portfolio__project {
    padding: 1rem;
  }

  .portfolio__browser-address {
    display: none;
  }
}

/* --- Lógica de Animación --- */

/* Estado Inicial */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), 
                transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform, opacity;
}

/* Estado Visible (Activado por JS) */
.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animación específica para los mockups dentro de los proyectos */
.portfolio__project.is-visible .portfolio__browser {
    animation: slideInUp 1s ease forwards;
}

.portfolio__project.is-visible .portfolio__phone {
    animation: slideInUp 1.2s ease forwards;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Optimización para móviles: animaciones más sutiles */
@media (max-width: 768px) {
    .reveal-on-scroll {
        transform: translateY(20px);
        transition-duration: 0.6s;
    }
}

/* --- ANIMACIONES DEL HERO --- */
.portfolio-hero__title .text-gradient {
    display: inline-block;
    background-size: 200% auto;
    animation: shine 4s linear infinite;
}

@keyframes shine {
    to { background-position: 200% center; }
}

/* --- ESTADOS DE REVELACIÓN --- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition: 
        opacity 0.8s ease-out, 
        transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1),
        border-color 0.4s ease; /* Para el hover suave */
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Escalonado para las etiquetas de cada proyecto */
.portfolio__project.is-visible .portfolio__project-tag {
    animation: fadeInTag 0.5s ease forwards;
}

@keyframes fadeInTag {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Mejoramos el hover de las tarjetas que agregues a futuro */
.portfolio__project:hover {
    border-color: rgba(153, 102, 221, 0.4);
    background: rgba(255, 255, 255, 0.04);
}