/* Estilos globales para Código Mágico - Bosque Digital Encantado */
:root {
  --color-primary: #25a18e; /* Verde turquesa */
  --color-secondary: #264e86; /* Azul profundo */
  --color-accent: #ffc04a; /* Ámbar dorado */
  --color-accent2: #7b3fa3; /* Púrpura mágico */
  --color-text: #f0f7f4; /* Blanco bosque */
  --color-bg: #0a1f1c; /* Verde oscuro profundo */
  --color-dark: #051714; /* Verde oscuro más profundo */
  --color-wood: #8b4513; /* Marrón siena */
  --color-leaf: #52d681; /* Verde vibrante */
  --gradient-magic: linear-gradient(
    135deg,
    var(--color-secondary),
    var(--color-accent2)
  );
  --gradient-forest: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-leaf)
  );
  --shadow-magical: 0 5px 15px rgba(46, 139, 87, 0.4);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Poppins", sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Fondo con estrellas */
.stars-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-color: var(--color-bg);
  background-image: url("/images/forest-bg.webp"),
    url("/images/digital-overlay.webp");
  background-blend-mode: overlay;
  background-size: cover;
  opacity: 0.18;
}

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

/* Encabezado y navegación */
.main-header {
  padding: 1.5rem 0;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background: linear-gradient(
    to bottom,
    rgba(5, 23, 20, 0.95) 60%,
    rgba(5, 23, 20, 0.8) 100%
  );
  backdrop-filter: blur(10px);
  box-shadow: 0 5px 20px rgba(82, 214, 129, 0.25);
  transition: all 0.3s ease;
  border-bottom: 2px solid rgba(82, 214, 129, 0.2);
}

.main-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: "Cinzel", serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  position: relative;
  text-shadow: 0 0 10px rgba(82, 214, 129, 0.5),
    0 0 15px rgba(37, 161, 142, 0.3);
  letter-spacing: 1px;
}

.logo::before {
  content: "{ ";
  color: var(--color-accent);
  text-shadow: 0 0 5px rgba(255, 192, 74, 0.7);
}

.logo::after {
  content: " }";
  color: var(--color-accent);
  text-shadow: 0 0 5px rgba(255, 192, 74, 0.7);
}

nav ul {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

nav a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  padding: 0.3rem 0;
  letter-spacing: 0.5px;
  font-family: "Quicksand", sans-serif;
}

nav a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background: var(--gradient-forest);
  transition: width 0.3s ease;
  border-radius: 5px;
}

nav a:hover::after {
  width: 100%;
}

nav a:hover {
  color: var(--color-leaf);
}

.cta-button {
  background: var(--gradient-forest);
  padding: 0.7rem 1.4rem;
  border-radius: 5px;
  color: white;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(82, 214, 129, 0.4),
    0 0 20px rgba(37, 161, 142, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.cta-button::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: rotate(45deg);
  transition: all 0.8s ease;
  opacity: 0;
}

.cta-button:hover::before {
  animation: glitter 1.5s infinite;
  opacity: 1;
}

@keyframes glitter {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(50%, 50%) rotate(360deg);
  }
}

.cta-button:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(82, 214, 129, 0.5),
    0 0 15px rgba(37, 161, 142, 0.4);
}

/* Hero section */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding: 8rem 0 5rem;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%;
  background: url("/images/forest-silhouette.webp") bottom center;
  background-size: cover;
  opacity: 0.4;
  z-index: -1;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 3rem;
}

.hero-text h1 {
  font-family: "Cinzel", serif;
  font-size: 4.2rem;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  color: var(--color-text);
  text-shadow: 0 0 15px rgba(82, 214, 129, 0.5),
    0 0 30px rgba(37, 161, 142, 0.4);
  letter-spacing: 1px;
}

.hero-text h2 {
  font-size: 1.6rem;
  margin-bottom: 2rem;
  opacity: 0.95;
  color: var(--color-accent);
  font-family: "Quicksand", sans-serif;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.hero-text p {
  margin-bottom: 2.5rem;
  font-size: 1.1rem;
  line-height: 1.8;
  max-width: 90%;
}

.book-cover {
  position: relative;
  margin: 0 auto;
  max-width: 400px;
}

.book-cover img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(82, 214, 129, 0.4),
    0 0 50px rgba(38, 78, 134, 0.3);
  animation: float 6s ease-in-out infinite;
  transition: all 0.3s ease;
  transform-style: preserve-3d;
  transform: perspective(1000px) rotateY(-10deg);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.book-cover::before {
  content: "";
  position: absolute;
  width: 80%;
  height: 15px;
  bottom: -20px;
  left: 10%;
  background: rgba(82, 214, 129, 0.5);
  filter: blur(12px);
  border-radius: 50%;
  z-index: -1;
}

.book-cover::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: url("/images/leaf-overlay.webp");
  background-size: cover;
  opacity: 0.15;
  mix-blend-mode: screen;
  border-radius: 10px;
  pointer-events: none;
}

.magical-runes {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: url("/images/magic-runes.webp");
  opacity: 0;
  mix-blend-mode: screen;
  animation: pulsate 3s infinite alternate;
  pointer-events: none;
  z-index: 1;
}

/* Secciones */
section {
  padding: 8rem 0 4rem;
  position: relative;
}

section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--color-primary),
    transparent
  );
}

.section-title {
  font-family: "Cinzel", serif;
  font-size: 2.8rem;
  margin-bottom: 3rem;
  text-align: center;
  color: var(--color-primary);
  position: relative;
  display: inline-block;
  text-shadow: 0 0 10px rgba(37, 161, 142, 0.3);
  letter-spacing: 0.5px;
}

.section-title::after {
  content: "";
  position: absolute;
  width: 80px;
  height: 3px;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gradient-forest);
  border-radius: 2px;
}

.text-center {
  text-align: center;
}

/* Cards y elementos interactivos */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.feature-card {
  background: rgba(10, 31, 28, 0.7);
  border: 1px solid rgba(82, 214, 129, 0.2);
  border-radius: 10px;
  padding: 2rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  z-index: 1;
  backdrop-filter: blur(4px);
}

.feature-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("/images/subtle-leaves.webp");
  background-size: cover;
  opacity: 0.05;
  z-index: -1;
  transition: opacity 0.3s ease;
}

.feature-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(46, 139, 87, 0.1),
    rgba(65, 105, 225, 0.1)
  );
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(82, 214, 129, 0.25);
  border-color: rgba(82, 214, 129, 0.4);
}

.feature-card:hover::before {
  opacity: 0.08;
}

.feature-card:hover::after {
  opacity: 1;
}

.feature-card h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--color-accent);
  font-family: "Cinzel", serif;
  letter-spacing: 0.3px;
}

.feature-card p {
  opacity: 0.9;
  line-height: 1.8;
}

.icon {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  color: var(--color-primary);
  position: relative;
  display: inline-block;
}

.icon::after {
  content: "";
  position: absolute;
  width: 40px;
  height: 40px;
  top: -10px;
  left: -10px;
  background: radial-gradient(
    circle,
    rgba(50, 205, 50, 0.2) 0%,
    transparent 70%
  );
  border-radius: 50%;
}

/* Testimonio */
.testimonial {
  background: rgba(10, 31, 28, 0.7);
  border: 1px solid rgba(46, 139, 87, 0.3);
  border-radius: 8px;
  padding: 3rem;
  margin: 4rem auto;
  max-width: 80%;
  position: relative;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(46, 139, 87, 0.2);
}

.testimonial::before {
  content: '"';
  position: absolute;
  top: -30px;
  left: 20px;
  font-size: 6rem;
  color: var(--color-primary);
  opacity: 0.6;
  font-family: "Cormorant Garamond", serif;
}

.testimonial::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("/images/subtle-leaves.webp");
  background-size: cover;
  opacity: 0.05;
  z-index: -1;
  border-radius: 8px;
}

.testimonial p {
  font-size: 1.3rem;
  line-height: 1.8;
  font-style: italic;
  margin-bottom: 1.5rem;
  font-family: "Cormorant Garamond", serif;
}

.testimonial-author {
  text-align: right;
  font-weight: 600;
  color: var(--color-accent);
}

/* Sección de compra */
.purchase-section {
  text-align: center;
  padding: 6rem 0;
  background: rgba(10, 31, 28, 0.8);
  border-radius: 12px;
  margin: 4rem 0;
  position: relative;
  overflow: hidden;
}

.purchase-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("/binary-forest.webp") center center;
  background-size: cover;
  opacity: 0.1;
  z-index: -1;
}

.purchase-section::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("/images/binary-pattern.webp");
  opacity: 0.05;
  mix-blend-mode: screen;
  z-index: -1;
}

.purchase-section h2 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  color: var(--color-primary);
  text-shadow: 0 0 10px rgba(46, 139, 87, 0.3);
  font-family: "Cormorant Garamond", serif;
}

.purchase-section p {
  max-width: 700px;
  margin: 0 auto 3rem;
  font-size: 1.2rem;
  opacity: 0.9;
  line-height: 1.8;
}

.amazon-button {
  background: var(--color-wood);
  color: white;
  padding: 1rem 2rem;
  border-radius: 4px;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.amazon-button:hover {
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4), 0 0 15px rgba(139, 69, 19, 0.4);
  background: #9b5e1a;
}

.book-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 4rem 0;
}

.detail-item {
  background: rgba(10, 31, 28, 0.8);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid rgba(46, 139, 87, 0.3);
  position: relative;
  overflow: hidden;
}

.detail-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("/images/subtle-leaves.webp");
  background-size: cover;
  opacity: 0.05;
  z-index: -1;
}

.detail-item h4 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--color-accent);
  font-family: "Cormorant Garamond", serif;
}

.detail-item p {
  font-size: 1.1rem;
}

/* Sección del Autor */
.author-section {
  display: flex;
  gap: 2rem;
  padding: 2rem;
  background: rgba(10, 31, 28, 0.8);
  border: 1px solid rgba(46, 139, 87, 0.3);
  border-radius: 8px;
  margin-top: 2rem;
  position: relative;
  overflow: hidden;
}

.author-content h3 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--color-accent);
  font-family: "Cormorant Garamond", serif;
}

.author-content p {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  line-height: 1.8;
}

/* Footer */
footer {
  padding: 3rem 0;
  background-color: var(--color-dark);
  margin-top: 4rem;
  position: relative;
  overflow: hidden;
}

footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    to right,
    transparent,
    var(--color-primary),
    transparent
  );
}

footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  color: var(--color-text);
  opacity: 0.7;
  transition: all 0.3s ease;
}

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

/* Animaciones */
@keyframes float {
  0% {
    transform: perspective(1000px) rotateY(-8deg) translateY(0px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(82, 214, 129, 0.4),
      0 0 50px rgba(38, 78, 134, 0.3);
  }
  50% {
    transform: perspective(1000px) rotateY(-4deg) translateY(-15px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(82, 214, 129, 0.5),
      0 0 60px rgba(38, 78, 134, 0.4);
  }
  100% {
    transform: perspective(1000px) rotateY(-8deg) translateY(0px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(82, 214, 129, 0.4),
      0 0 50px rgba(38, 78, 134, 0.3);
  }
}

/* Luciérnagas mágicas */
.firefly {
  position: fixed;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(82, 214, 129, 0.8);
  box-shadow: 0 0 5px 2px rgba(82, 214, 129, 0.5),
    0 0 10px 2px rgba(38, 78, 134, 0.3);
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  animation: firefly-animation 6s linear infinite;
}

@keyframes firefly-animation {
  0% {
    opacity: 0;
  }
  25% {
    opacity: 0.8;
  }
  50% {
    opacity: 0.4;
  }
  75% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
  }
}

/* Magic sparkles */
.sparkles {
  pointer-events: none;
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 10px white, 0 0 20px var(--color-primary),
    0 0 30px var(--color-secondary);
  animation: sparkle-animation 1.5s forwards;
  opacity: 0;
}

@keyframes sparkle-animation {
  0% {
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1) rotate(180deg);
  }
  100% {
    opacity: 0;
    transform: scale(0) rotate(360deg);
  }
}

/* Efectos de fade-in para secciones */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 992px) {
  .hero-content {
    grid-template-columns: 1fr;
  }

  .hero-text {
    text-align: center;
    order: 2;
  }

  .book-cover {
    order: 1;
    max-width: 300px;
    margin-bottom: 2rem;
  }

  .hero-text h1 {
    font-size: 3rem;
  }

  .section-title {
    font-size: 2.2rem;
  }
}

@media (max-width: 768px) {
  .main-header .container {
    flex-direction: column;
    gap: 1rem;
  }

  nav ul {
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero {
    padding-top: 8rem;
  }

  .hero-text h1 {
    font-size: 2.5rem;
  }

  .testimonial {
    padding: 2rem;
    max-width: 100%;
  }

  footer .container {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
  }
}
