/* ==========================================================================
   RESET BÁSICO Y ESTILOS GENERALES
   ========================================================================== */

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

html, body {
  height: 100%;
  overflow-x: hidden;
  font-family: 'Segoe UI', sans-serif;
  text-align: center;
  color: #ffffff;
}

/* ==========================================================================
   FONDO ANIMADO CUÁNTICO
   ========================================================================== */

body {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 1.5rem;
  background: radial-gradient(ellipse at bottom, #0f0c29, #302b63, #24243e);
  background-size: 400% 400%;
  animation: nonlinearFlow 30s ease-in-out infinite;
}

body::before {
  content: "";
  position: absolute;
  width: 200%;
  height: 200%;
  top: -50%;
  left: -50%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.06;
  z-index: 1;
  animation: fieldDrift 120s ease-in-out infinite;
}

/* Animaciones */

@keyframes nonlinearFlow {
  0%   { background-position: 0% 50%; filter: hue-rotate(0deg); }
  25%  { background-position: 100% 50%; filter: hue-rotate(60deg); }
  50%  { background-position: 50% 100%; filter: hue-rotate(180deg); }
  75%  { background-position: 0% 50%; filter: hue-rotate(300deg); }
  100% { background-position: 0% 50%; filter: hue-rotate(360deg); }
}

@keyframes fieldDrift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(50px, 50px) scale(1.2); }
  100% { transform: translate(0, 0) scale(1); }
}

/* ==========================================================================
   CONTENEDOR PRINCIPAL Y TÍTULOS
   ========================================================================== */

main {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 480px;
  padding: 1.5rem;
  border-radius: 1rem;
  background-color: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.4);
}

h1 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

/* ==========================================================================
   NAVEGACIÓN GENERAL
   ========================================================================== */

nav a {
  display: block;
  margin: 1rem 0;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.3s ease;
}

nav a:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   CONTADOR (BOTONES Y VALOR)
   ========================================================================== */

.contador-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

#valor {
  font-size: 2.5rem;
  font-weight: bold;
  width: 80px;
  text-align: center;
}

#incrementar,
#decrementar {
  width: 4rem;
  height: 4rem;
  font-size: 2rem;
  font-weight: bold;
  border: none;
  border-radius: 0.7rem;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(145deg, #2e2e90, #202060);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.15s ease;
}

#incrementar:hover {
  background: linear-gradient(145deg, #2c8a4e, #1e5a3a);
}

#decrementar:hover {
  background: linear-gradient(145deg, #8a2c2c, #5a1e1e);
}

#incrementar:active,
#decrementar:active {
  transform: scale(0.92);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   CONVERSOR DE TEMPERATURAS
   ========================================================================== */

.conversor-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

input[type="number"] {
  width: 100%;
  max-width: 260px;
  padding: 0.8rem 1rem;
  border-radius: 0.6rem;
  font-size: 1rem;
  border: 1px solid rgba(173, 216, 230, 0.6);
  text-align: center;
  color: #ffffff;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(173, 216, 230, 0.05));
  box-shadow: 0 0 10px rgba(173, 216, 230, 0.3);
  backdrop-filter: blur(6px);
  transition: all 0.3s ease;
}

input[type="number"]::placeholder {
  color: #bbdcee;
}

#convertir {
  padding: 0.8rem 1.5rem;
  font-weight: bold;
  color: #ffffff;
  border: none;
  border-radius: 0.6rem;
  cursor: pointer;
  background: linear-gradient(135deg, #6dd5fa, #2980b9);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

#convertir:hover {
  filter: brightness(1.1);
}

#convertir:active {
  transform: scale(0.96);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.3);
}

#fahrenheit {
  margin-top: 1.5rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: #a3d4ff;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   BOTÓN FLOTANTE: VOLVER AL HOME
   ========================================================================== */

.btn-home {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  font-size: 1.5rem;
  padding: 0.6rem 0.9rem;
  border-radius: 50%;
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.1);
  text-decoration: none;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
  z-index: 99;
}

.btn-home:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (min-width: 768px) {
  h1 {
    font-size: 2.2rem;
  }

  nav a {
    font-size: 1.1rem;
  }

  #incrementar,
  #decrementar {
    font-size: 2rem;
    width: 4rem;
    height: 4rem;
  }

  #valor {
    font-size: 3rem;
  }
}
