:root {
  --border-offset: 2rem;
  --frame-margin: 1rem;
  --accent: rgb(168, 0, 0);
  --text-dark: #111;
  --bg-light: rgb(228, 228, 228);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  background: var(--bg-light);
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  color: var(--text-dark);
  overflow: hidden;
  position: relative;
  margin: 0;
  min-height: 100vh;
  padding: 1rem;
}

body::before {
  content: "";
  position: absolute;
  inset: 1rem;
  border: 1px solid #000;
  z-index: 10;
  pointer-events: none;
}

.blob-outer-container {
  position: absolute;
  inset: 1rem;
  z-index: 0;
  filter: blur(60px);
  opacity: 0.9;
  pointer-events: none;
  overflow: hidden;
}

.blob-inner-container {
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: min(90vw, 1200px);
  height: min(90vh, 800px);
  overflow: hidden;
  background-color: #fff;
}

.blob {
  position: absolute;
  inset: -50%;
  background: conic-gradient(
    from 0deg,
    rgb(202, 2, 2),
    rgb(211, 0, 35),
    rgb(211, 0, 0),
    rgb(255, 127, 8),
    rgb(235, 0, 0),
    rgba(253, 15, 15, 0.788)
  );
  animation: spinBlob 20s linear infinite;
  will-change: transform;
}

@keyframes spinBlob {
  0% { transform: rotate(0deg) scale(2); }
  100% { transform: rotate(360deg) scale(2); }
}

.main-wrapper {
  position: relative;
  z-index: 5;
  margin: 0;
  padding: 0 2rem;
  padding-top: 1rem;
  min-height: calc(100vh - 2rem);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  overflow-x: hidden;
}

.main-wrapper::-webkit-scrollbar { 
  width: 8px; 
  height: 8px;
}
.main-wrapper::-webkit-scrollbar-track { 
  background: rgba(228, 228, 228, 0.5); 
}
.main-wrapper::-webkit-scrollbar-thumb { 
  background: rgba(168, 0, 0, 0.3); 
  border-radius: 10px; 
  transition: background 0.3s;
}
.main-wrapper::-webkit-scrollbar-thumb:hover { 
  background: rgba(168, 0, 0, 0.5); 
}

.main-wrapper {
  scrollbar-width: thin; 
  scrollbar-color: rgba(168, 0, 0, 0.3) rgba(228, 228, 228, 0.5);
}

.navbar-personalizado {
  margin-bottom: 2rem;
  padding: 1rem 0;
}

.navbar-lista {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  justify-content: flex-end;
  margin: 0;
}

.nav-link {
  color: var(--text-dark);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 400;
  transition: color 0.3s, transform 0.2s;
  position: relative;
}

.nav-link:hover {
  color: var(--accent);
  transform: translateX(2px);
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--accent);
  transition: width 0.3s;
}

.nav-link:hover::after { width: 100%; }

.btn-menu {
  display: none;
  background: none;
  border: none;
  color: var(--text-dark);
  font-size: 1.8rem;
  cursor: pointer;
  z-index: 1001;
}

.hero-section {
  min-height: calc(100vh - 8rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}

.container-aligned {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

h1 {
  font-family: 'Prata', serif;
  font-weight: 700;
  margin-bottom: 1.5rem;
  position: relative;
  display: inline-block;
}

h1::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 0;
  height: 2px;
  width: 0;
  background: #000;
  animation: underline-draw 1.5s forwards;
  animation-delay: 0.3s;
}

@keyframes underline-draw {
  to { width: 100%; }
}

p { margin-bottom: 1.5rem; line-height: 1.6; }
h5 { margin-bottom: 1.5rem; }

.btn-personalizado {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s;
}

.btn-personalizado:hover { 
  background: rgba(220, 38, 38, 0.2);
  color: var(--accent);
}

#proyectos, #habilidades, #contacto {
  background: rgba(255,255,255,0.4);
  backdrop-filter: blur(20px);
  padding: 4rem 2rem;
  margin: 3rem auto;
  border-radius: 8px;
  max-width: 1200px;
}

.section-title {
  margin-bottom: 1rem;
}

.text-cyber {
  color: var(--accent);
  font-weight: 600;
}

.text-black {
  color: var(--text-dark);
}

.project-card {
  border: 1px solid #000;
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(15px);
  transition: all 0.3s;
  height: 100%;
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: rgba(168,0,0,0.7);
}

.project-card img {
  transition: transform 0.3s;
}

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

.skill-card {
  border: 1px solid rgba(0,0,0,0.1);
  padding: 2.5rem;
  background: rgba(255,255,255,0.3);
  backdrop-filter: blur(15px);
  transition: all 0.4s;
  height: 100%;
}

.skill-card:hover {
  transform: translateY(-3px);
  border-color: rgba(220,38,38,0.3);
}

.code-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.code-tag {
  padding: 0.6rem 1.2rem;
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.code-tag:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.skill-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem;
  transition: all 0.3s;
}

.skill-item:hover {
  transform: translateX(5px);
  color: var(--accent);
}

.skill-icon {
  font-size: 1.2rem;
  color: var(--accent);
}

.form-control {
  border-radius: 0;
  border: 1px solid rgba(220,38,38,0.2);
  transition: all 0.3s;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 5px rgba(168,0,0,0.3);
}

.contacto-ilustracion-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.contacto-ilustracion {
  max-width: 100%;
  height: 700px;
  opacity: 0.9;
  margin: -200px 0;
}

footer {
  backdrop-filter: blur(15px);
  background: rgba(255,255,255,0.3);
  padding: 3rem 2rem;
  border-radius: 8px;
  margin: 4rem auto 2rem;
  text-align: center;
  max-width: 1200px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  transition: all 0.3s;
  text-decoration: none;
}

.social-link:hover {
  background: rgba(168,0,0,0.1);
  transform: scale(1.1);
  color: var(--accent);
}

#btn-back-to-top {
  position: fixed;
  bottom: 2.5rem;
  right: 2.5rem;
  width: 50px;
  height: 50px;
  background: rgba(255,255,255,0.95);
  border: 1px solid #000;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1001;
  transition: all 0.3s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#btn-back-to-top:hover {
  transform: translateY(-3px);
  background: #fff;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

#btn-back-to-top i {
  color: var(--accent);
}

@media (max-width: 992px) {
  .container-aligned { 
    padding: 0 1.5rem; 
  }

  .btn-menu {
    display: block;
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
  }

  .navbar-lista {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(25px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
    z-index: 1000;
  }

  .navbar-lista.active {
    opacity: 1;
    pointer-events: all;
  }

  .nav-link {
    font-size: 1.5rem;
  }
}

@media (max-width: 768px) {
  body {
    padding: 0.5rem;
    overflow: hidden;      /* evita crecimiento infinito del body */
    height: 100vh;         /* fuerzo tamaño exacto de viewport */
  }

  body::before {
    position: fixed;       /* que sea SIEMPRE del tamaño de la pantalla */
    top: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
  }

.main-wrapper {
    /* Mantiene las reglas de scroll vertical */
    max-height: calc(100vh - 1rem); 
    overflow-y: auto;
    
    /*Define un padding horizontal mucho más pequeño** */
    padding: 0 0 2rem 0;
  }

  .container-aligned {
    /* Reduce el padding interior del contenedor de 1.5rem (heredado de 992px) a 0.5rem */
    padding: 0 0.5rem;
  }

  .hero-section {
    min-height: calc(100vh - 6rem);
    padding: 2rem 0; /* Solo padding vertical */
  }

  #proyectos, #habilidades, #contacto {
    padding: 2.5rem 1rem;
    margin: 2rem auto;
  }

  .blob-inner-container {
    width: 95vw;
    height: 80vh;
  }
  
  .blob-outer-container {
    inset: 0.5rem;
  }
}

@media (max-width: 480px) {
  #proyectos, #habilidades, #contacto {
    padding: 2rem 1rem;
    margin: 1.5rem auto;
  }

  .code-tag {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  h1 {
    font-size: 2rem;
  }

  #btn-back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
  * { scroll-behavior: auto !important; }
}