/* 1. Base */
html,
body {
  height: 100%;
  /* Asegura que el html y el body ocupen toda la altura */
  margin: 0;
  /* Elimina el margen por defecto */
}

/* Fondo con gradiente sutil y patrón geométrico */
html {
  background-color: #0F172A;
  /* Color de fondo oscuro */
  background-image:
    radial-gradient(circle at 100% 0%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
  color: #f8fafc50;
  font-family: "Quicksand", sans-serif;
  font-size: 100%;
  line-height: 1.6;
  min-height: 100vh;
  min-width: 100vw;
  overflow-x: hidden;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  text-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
  scroll-behavior: smooth;
}

/* Actualización de variables de color */
:root {
  --primary-color: #2b87f7;
  --secondary-color: #7152d0;
  --accent-color: #13abed;
  --text-primary: #FFFFFF;
  --text-secondary: #E2E8F0;
  --bg-card: rgba(17, 25, 40, 0.75);
  --card-border: rgba(255, 255, 255, 0.125);
  --focus-outline: #247eeb;
  --transition: all 0.3s ease;
  --overlay-bg: rgba(17, 25, 40, 0.98);
  --wallpaper-opacity: 0.2;
}

/* Variables para tema claro */
:root[data-theme="light"] {
  --text-primary: #1A202C;
  --text-secondary: #2D3748;
  --bg-card: rgba(255, 255, 255, 0.9);
  --card-border: rgba(0, 0, 0, 0.1);
  --overlay-bg: rgba(255, 255, 255, 0.98);
  --wallpaper-opacity: 0.1;
}

/* Variables para tema oscuro */
:root[data-theme="dark"] {
  --text-primary: #FFFFFF;
  --text-secondary: #E2E8F0;
  --bg-card: rgba(255, 255, 255, 0.08);
  background-color: #0F172A;
  /* Asegura que el fondo oscuro se aplique */
}

a {
  color: currentColor;
  cursor: pointer;
  text-decoration: none;
}

/* 2. Shared */
.wallpaper {
  display: none;
  opacity: var(--wallpaper-opacity);
  transition: opacity 0.3s ease;
}

/* 3. Specific */
.wallpaper {
  background-image: url("../image/fondo.jpeg");
  background-position: center;
  background-size: cover;
  position: fixed;
}

.content {
  display: flex;
  min-height: 100vh;
  gap: 3rem;
  margin: 2rem auto;
  padding: 2rem;
  flex-direction: row-reverse;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 1400px;
}

.picture {
  display: flex;
  height: 25em;
  gap: 10%;
  flex-wrap: nowrap;
  align-content: space-around;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.276);
  border-radius: 20px;
  padding: 2rem;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.2),
    0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

.about {
  display: flex;
  max-width: 29rem;
  text-align: justify;
  flex-direction: column;
}

.name {
  text-align: center;
  padding-bottom: 1em;
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--text-primary);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background: none;
  background-clip: initial;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: initial;
}

.description {
  font-size: 1.125rem;
  line-height: 1.5;
  padding-bottom: 3rem;
  color: var(--text-primary);
  text-shadow: none;
  opacity: 1;
  font-weight: 700;
}

/* 4. Responsiveness */
@media screen and (max-width: 799px) {
  .content {
    display: flex;
    margin: 2rem auto;
    padding: 1rem;
    flex-direction: column;
    align-content: center;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .about {
    max-width: none;
  }

  .side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 2rem auto;
    padding: 1rem;
  }

  html {
    font-size: 95%;
  }

  .description {
    margin-top: 3rem;
    margin-bottom: 2rem;
  }

  .projects-wrapper {
    gap: 2rem;
    margin: 1.5rem 0;
  }

  .contact {
    margin-top: 2rem;
  }

  .picture {
    width: 100%;
    max-width: 280px;
    height: auto;
    min-height: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin: 0 auto;
  }

  .picture-image {
    width: 220px;
    height: 220px;
    object-fit: cover;
    border-radius: 16px;
    display: block;
    margin: 0 auto;
    border: none;
  }

  .button {
    width: 80%;
    max-width: 200px;
    margin: 1rem auto;
    display: block;
    text-align: center;
  }

  .about {
    text-align: center;
    padding: 0 1rem;
  }

  .description {
    text-align: center;
    margin: 2rem auto;
  }

  .name,
  .job {
    text-align: center;
    width: 100%;
  }
}

@media screen and (max-width: 360px) {
  .button {
    font-size: 0.8rem;
    padding: 0.75rem 1rem;
    min-width: 140px;
    letter-spacing: 0.2em;
  }

  .picture {
    max-width: 240px;
    padding: 1rem;
  }

  .picture-image {
    width: 180px;
    height: 180px;
    border: none;
  }

  .about {
    padding: 0 0.5rem;
  }
}

@media screen and (min-width: 800px) and (max-width: 1024px) {
  .button {
    min-width: 180px;
    margin: 0.75rem auto;
  }
}

@media screen and (min-width: 800px) {
  .side {
    flex-grow: 0;
    flex-shrink: 0;
  }

  .about {
    flex-grow: 1;
    flex-shrink: 1;
  }

  .picture {
    width: 80%;
    height: 25em;
    justify-content: space-between;
  }

  .button {
    width: auto;
    min-width: 160px;
    margin: 0;
  }
}

.wallpaper,
.picture-shadow,
.picture-image {
  display: block;
  height: 100%;
  left: 0;
  top: 0;
  width: 100%;
}

.picture {
  width: 80%;
}

.job,
.button {
  font-family: "Montserrat", "Quicksand", sans-serif;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.job {
  color: var(--primary-color);
  font-size: 1.25rem;
  text-align: center;
  letter-spacing: 0.2em;
  font-weight: 700;
  opacity: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hr {
  background: linear-gradient(to right,
      transparent,
      var(--accent-color),
      transparent);
  height: 1px;
  opacity: 0.3;
  border-radius: 2px;
  border: none;
  content: "";
  margin-bottom: 1.5rem;
  margin-top: 1.5rem;
  transform-origin: initial;
  width: 17em;
}

.job {
  animation-name: slideUp;
}

.hr {
  animation-name: fillUp;
}

.description {
  font-size: 1.5rem;
}

button,
.social a {
  transform-origin: center;
  transition-duration: 100ms;
}

.button {
  background: var(--primary-color);
  border: none;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
  color: #FFFFFF;
  display: inline-block;
  font-size: 0.875rem;
  line-height: 1;
  text-shadow: none;
  user-select: none;
  vertical-align: top;
  white-space: normal;
  will-change: box-shadow, transform;
  min-width: 160px;
  margin: 1rem auto;
  text-align: center;
}

.button:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2);
}

.button:active {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
  transform: scale(0.98) translateY(-2px);
}

.social {
  display: flex;
  justify-content: space-evenly;
  flex-wrap: nowrap;
}

.social li {
  display: flex;
  height: 2rem;
  text-align: center;
  /* width: 2rem; */
}

.social a {
  align-items: center;
  display: flex;
  font-size: 1.5rem;
  height: 2rem;
  color: var(--text-primary);
  transition: var(--transition);
  width: 2rem;
  will-change: opacity, transform;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social a:hover {
  color: var(--primary-color);
  transform: translateY(-3px);
}

.social a:active {
  opacity: 1;
  transform: scale(1.1);
}

/* animaciones */
@keyframes bounceIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.wallpaper,
.picture-shadow,
.picture-image,
.name,
.job,
.hr,
.description,
.contact,
.social li {
  animation-duration: 1s;
  animation-timing-function: cubic-bezier(0, 0.5, 0, 1);
  animation-fill-mode: both;
}

.contact {
  animation-name: bounceIn;
}

@keyframes fillUp {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

@keyframes picImage {
  from {
    opacity: 0;
    transform: scale(1.2) translateY(-1rem);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes picShadow {
  from {
    opacity: 0;
    transform: scale(1.2) translateY(4rem);
  }

  to {
    opacity: 1;
    transform: scale(1.1) translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-1rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes zoomOut {
  from {
    opacity: 0;
    transform: scale(1.05);
  }

  to {
    opacity: 0.2;
    transform: scale(1);
  }
}

.picture-shadow,
.picture-image {
  animation-duration: 750ms;
  animation-timing-function: cubic-bezier(0, 0.5, 0.25, 1.25);
}

.wallpaper {
  animation-name: zoomOut;
  animation-timing-function: ease-out;
}

.picture-shadow {
  animation-name: picShadow;
}

.picture-image {
  animation-name: picImage;
  border-radius: 16px;
  transition: var(--transition);
}

.name {
  animation-name: slideDown;
}

.job {
  animation-name: slideUp;
}

.hr {
  animation-name: fillUp;
}

.description {
  animation-name: slideUp;
}

.social li {
  animation-duration: 500ms;
  animation-name: slideUp;
  animation-timing-function: cubic-bezier(0.5, 0, 0.5, 1.5);
}

.name {
  animation-delay: 100ms;
}

.job {
  animation-delay: 200ms;
}

.hr {
  animation-delay: 300ms;
}

.description {
  animation-delay: 400ms;
}

.picture-image {
  animation-delay: 500ms;
}

.picture-shadow {
  animation-delay: 500ms;
}

.contact {
  animation-name: bounceIn;
  animation-delay: 600ms;
}

.social li:nth-child(1) {
  animation-delay: 800ms;
}

.social li:nth-child(2) {
  animation-delay: 900ms;
}

.social li:nth-child(3) {
  animation-delay: 1s;
}

.social li:nth-child(4) {
  animation-delay: 1.1s;
}

.social li:nth-child(5) {
  animation-delay: 1.2s;
}

.wallpaper {
  animation-name: zoomOut;
  animation-timing-function: ease-out;
}

.picture-shadow {
  animation-name: picShadow;
}

.picture-image {
  animation-name: picImage;
}

.wallpaper {
  animation-timing-function: ease-out;
}

.wallpaper.is-loaded {
  animation-delay: 1s;
  animation-name: zoomOut;
}

.picture.is-loaded .picture-shadow {
  animation-name: picShadow;
}

.picture.is-loaded .picture-image {
  animation-name: picImage;
}

wallpaper,
.picture-shadow,
.picture-image {
  opacity: 0;
}

/* Estilos para la sección de proyectos */
.projects-section {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.section-title {
  text-align: center;
  color: var(--text-primary);
  font-size: 2rem;
  margin-bottom: 3rem;
  font-weight: 700;
}

.projects-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
}

.project-card {
  flex: 0 1 calc(33.333% - 2rem);
  min-width: 300px;
  max-width: 400px;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.project-image {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.project-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 25, 40, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  opacity: 0;
  transform: translateY(100%);
  transition: all 0.3s ease;
}

.project-card:hover .project-overlay {
  opacity: 1;
  transform: translateY(0);
}

.project-card:hover .project-image img {
  transform: scale(1.1);
}

.project-overlay h4 {
  color: var(--text-primary);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.project-description {
  color: var(--text-secondary);
  text-align: center;
  margin: 1rem 0;
  line-height: 1.6;
}

.project-tags {
  color: var(--primary-color);
  font-size: 0.9rem;
  margin: 1rem 0;
}

.project-button {
  background: var(--primary-color);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  margin-top: 1rem;
  transition: all 0.3s ease;
}

.project-button:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
}

/* Media Queries */
@media screen and (min-width: 1200px) {
  .projects-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media screen and (min-width: 768px) and (max-width: 1199px) {
  .content {
    gap: 2rem;
  }

  .projects-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .project-card {
    max-width: 500px;
    margin: 0 auto;
  }
}

@media screen and (max-width: 767px) {
  .content {
    flex-direction: column;
    padding: 1rem;
    gap: 2rem;
  }

  .picture {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }

  .about {
    text-align: center;
    padding: 0 1rem;
  }

  .projects-container {
    flex-direction: column;
    align-items: center;
  }

  .project-card {
    flex: 0 1 100%;
    max-width: 350px;
    width: 100%;
  }

  .projects-section {
    padding: 1rem;
  }
}

@media screen and (max-width: 360px) {
  .content {
    padding: 0.5rem;
  }

  .picture {
    padding: 1rem;
  }

  .project-card {
    max-width: 300px;
  }

  .project-overlay {
    padding: 1rem;
  }
}

/* Mejoras en interactividad y focus */
a,
button,
.button {
  position: relative;
  outline: none;
}

a:focus,
button:focus,
.button:focus {
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Soporte para reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .project-item:hover {
    transform: none;
  }

  .button:hover {
    transform: none;
  }
}

/* Asegurar contraste en modo oscuro */
@media (prefers-color-scheme: dark) {
  html {
    background-color: #050A14;
    background-image: linear-gradient(135deg,
        #050A14 0%,
        #0F172A 100%);
  }

  :root {
    --bg-card: rgba(255, 255, 255, 0.08);
    --text-secondary: #E2E8F0;
  }
}

/* Asegurar contraste en modo claro */
@media (prefers-color-scheme: light) {
  html {
    background-color: #F8FAFC;
    background-image:
      radial-gradient(circle at 100% 0%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
      radial-gradient(circle at 0% 100%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    color: #1E293B;
  }

  :root {
    --text-primary: #1A202C;
    --text-secondary: #2D3748;
    --bg-card: rgba(255, 255, 255, 0.9);
  }

  /* .picture, */
  .project-item {
    background: rgba(255, 255, 255, 0.95);
    box-shadow:
      0 4px 6px rgba(0, 0, 0, 0.1),
      0 1px 3px rgba(0, 0, 0, 0.1);
  }

  .button {
    background: var(--primary-color);
    color: white;
    border: none;
  }

  .description,
  .project-description {
    color: var(--text-secondary);
  }

  .name,
  .project-content h4 {
    color: var(--text-primary);
  }
}

/* Agregar elementos decorativos sutiles */
.content::before {
  content: '';
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
  z-index: -1;
}

.content::after {
  content: '';
  position: fixed;
  bottom: 0;
  left: 0;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.05) 0%, transparent 70%);
  z-index: -1;
}

/* Estilos para el texto destacado */
.highlight {
  color: var(--primary-color);
  font-weight: 700;
  opacity: 1;
}

.highlight-alt {
  color: var(--secondary-color);
  font-weight: 700;
  opacity: 1;
}

/* Mejorar la tipografía de la descripción */
.description h3 {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.intro-text {
  font-size: 1.4rem;
  color: var(--accent-color);
  font-weight: 700;
  letter-spacing: 0.5px;
  opacity: 1;
}

.experience-text,
.journey-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  font-weight: 600;
  opacity: 1;
}

/* Ajustar el job title */
.job {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  font-size: 1.4rem;
  margin: 1rem 0;
  font-weight: 700;
  opacity: 1;
}

.job span {
  display: inline-block;
  padding: 0.2rem 0;
}

/* Animación sutil para los highlights */
.highlight::after,
.highlight-alt::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.highlight:hover::after,
.highlight-alt:hover::after {
  transform: scaleX(1);
}

/* Estilos para el popup */
.email-popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.popup-content {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  padding: 2rem;
  border-radius: 16px;
  position: relative;
  max-width: 400px;
  width: 90%;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.popup-content h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

#emailText {
  color: var(--primary-color);
  font-size: 1.2rem;
  margin: 1rem 0;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  word-break: break-all;
}

.copy-button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  margin-top: 1rem;
  transition: var(--transition);
}

.copy-button:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
}

.close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
}

/* Animación del popup */
.email-popup.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Estilos para el botón copiado */
.copy-button.copied {
  background-color: var(--secondary-color);
  pointer-events: none;
}

/* Mejorar animación del popup */
.email-popup {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.email-popup.show {
  opacity: 1;
  visibility: visible;
}

.popup-content {
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.email-popup.show .popup-content {
  transform: scale(1);
}

/* Estilos para el botón de tema */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--text-primary);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  z-index: 1000;
  transition: all 0.3s ease;
  color: var(--text-primary);
}

.theme-toggle:hover {
  transform: scale(1.1);
  background: var(--text-primary);
  color: var(--project-bg);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
  transition: all 0.3s ease;
}

/* Control de visibilidad de iconos */
.sun-icon {
  display: none;
}

.moon-icon {
  display: block;
}

/* Estado para tema claro */
[data-theme="light"] .sun-icon {
  display: block;
}

[data-theme="light"] .moon-icon {
  display: none;
}