/* ==========================================================================
   Más control, más caos — Estilos brutalist con animaciones
   © 2025 Ulises González - Rizo.ma
   ========================================================================== */

:root {
  --bg: #0a0a0a;
  --bg-deep: #0a1628;
  --text: #f5f5f5;
  --text-muted: #a0a0a0;
  --accent: #8b0000;
  --accent-bright: #dc143c;
  --accent-hover: #a00000;
  --control-blue: #3d7ab7;
  --control-dark: #1e3a5f;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Literata', Georgia, serif;
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base */
html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Container */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Secciones */
section {
  padding: 80px 0;
}

/* Tipografía */
h1, h2 {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 1.1;
  margin-bottom: 24px;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: 32px;
}

p {
  margin-bottom: 24px;
  color: var(--text-muted);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--text);
  text-decoration: none;
}

/* ==========================================================================
   HERO - Full viewport con portada animada
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Fade gradual del hero al contenido */
.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 200px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(10, 10, 10, 0.3) 30%,
    rgba(10, 10, 10, 0.7) 60%,
    var(--bg) 100%
  );
  z-index: 5;
  pointer-events: none;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.cover-svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 40px 0;
}

.hero .title {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 32px;
}

.title-line {
  display: block;
  opacity: 0;
  transform: translateY(30px);
}

.title-control {
  color: var(--text);
}

.title-chaos {
  color: var(--accent-bright);
}

.hero .subtitle {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 48px;
  opacity: 0;
  transform: translateY(20px);
}

/* Fallback sin JS */
.no-js .title-line,
.no-js .hero .subtitle {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   CTAs y Botones
   ========================================================================== */

.cta-primary,
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 36px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-bright) 100%);
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.02em;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform, box-shadow;
  box-shadow: 0 4px 15px rgba(139, 0, 0, 0.3);
}

/* Efecto de brillo que pasa por el botón */
.cta-primary::before,
.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 100%
  );
  transition: left 0.6s ease;
}

.cta-primary:hover::before,
.btn:hover::before {
  left: 100%;
}

.cta-primary:hover,
.btn:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
  box-shadow: 0 12px 35px rgba(139, 0, 0, 0.5);
  transform: translateY(-3px);
}

.cta-primary:active,
.btn:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 0, 0, 0.4);
}

.cta-primary:focus,
.btn:focus {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

/* CTA principal con borde animado */
.cta-primary {
  padding: 20px 40px;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent) 50%, var(--accent-bright) 100%);
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.cta-primary:hover {
  box-shadow: 0 15px 40px rgba(220, 20, 60, 0.5), 0 0 30px rgba(139, 0, 0, 0.3);
}

/* Botones secundarios con estilo diferente */
.comprar .btn {
  background: transparent;
  border: 2px solid var(--accent);
  box-shadow: none;
}

.comprar .btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(139, 0, 0, 0.4);
}

/* Botones con branding de plataformas */
.comprar .btn.btn-amazon {
  background: linear-gradient(135deg, #FF9900 0%, #FFB347 100%);
  border: 2px solid #FF9900;
  color: #000;
  box-shadow: 0 4px 15px rgba(255, 153, 0, 0.4);
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 700;
}

.comprar .btn.btn-amazon:hover {
  background: linear-gradient(135deg, #FFB347 0%, #FFCC66 100%);
  border-color: #232F3E;
  box-shadow: 0 12px 35px rgba(255, 153, 0, 0.5);
}

.comprar .btn.btn-leanpub {
  background: linear-gradient(135deg, #FFD700 0%, #FFE44D 100%);
  border: 2px solid #FFD700;
  color: #000;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
  font-family: 'Lato', sans-serif;
  font-weight: 700;
}

.comprar .btn.btn-leanpub:hover {
  background: linear-gradient(135deg, #FFE44D 0%, #FFF066 100%);
  border-color: #B8860B;
  box-shadow: 0 12px 35px rgba(255, 215, 0, 0.5);
}

.comprar .btn.btn-gumroad {
  background: linear-gradient(135deg, #ff90e8 0%, #ffb8f0 100%);
  border: 2px solid #ff90e8;
  color: #000;
  box-shadow: 0 4px 15px rgba(255, 144, 232, 0.4);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
}

.comprar .btn.btn-gumroad:hover {
  background: linear-gradient(135deg, #ffb8f0 0%, #ffc8f4 100%);
  border-color: #fff;
  box-shadow: 0 12px 35px rgba(255, 144, 232, 0.5);
}

.cta-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 32px 0;
  justify-content: center;
  align-items: center;
}

/* Botones con imagen de marca */
.btn-img {
  display: inline-block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border-radius: 8px;
  overflow: hidden;
}

.btn-img img {
  display: block;
  height: 50px;
  width: auto;
  border-radius: 8px;
}

.btn-img:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.btn-img:active {
  transform: translateY(0) scale(0.98);
}

/* ==========================================================================
   TENSIÓN
   ========================================================================== */

.tension {
  background: var(--bg);
}

.tension p {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  max-width: 600px;
}

.tension-lead {
  color: var(--text);
  font-weight: 400;
}

.tension-conclusion {
  color: var(--accent-bright);
  font-weight: 700;
  font-family: var(--font-sans);
}

.loop-visual {
  margin-top: 48px;
  display: flex;
  justify-content: center;
}

.loop-visual svg {
  opacity: 0.7;
}

/* ==========================================================================
   TESIS
   ========================================================================== */

.tesis {
  background: linear-gradient(180deg,
    var(--bg) 0%,
    rgba(139, 0, 0, 0.08) 50%,
    var(--bg) 100%);
}

blockquote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.25rem, 3.5vw, 1.75rem);
  line-height: 1.5;
  color: var(--text);
  border-left: 4px solid var(--accent);
  padding-left: 24px;
  margin: 0;
  max-width: 600px;
}

/* ==========================================================================
   CONTENIDO
   ========================================================================== */

.contenido-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
}

@media (min-width: 768px) {
  .contenido-grid {
    grid-template-columns: 1fr 1fr;
    gap: 64px;
  }
}

.contenido-col h2 {
  margin-bottom: 24px;
}

.contenido ul {
  list-style: none;
  padding: 0;
}

.contenido li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 20px;
  color: var(--text-muted);
  font-size: 1.125rem;
}

.contenido li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 8px;
  height: 8px;
  background: var(--accent);
}

.contenido li strong {
  color: var(--text);
  font-weight: 600;
}

/* ==========================================================================
   AUTOR
   ========================================================================== */

.autor p {
  max-width: 540px;
  font-size: 1.125rem;
}

/* ==========================================================================
   COMPRAR
   ========================================================================== */

.comprar {
  text-align: center;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

.comprar h2 {
  margin-bottom: 16px;
}

.precio {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0;
}

.comprar .cta-buttons {
  justify-content: center;
}

.formatos {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 24px;
}

/* Botón de descarga */
.cta-download {
  margin-top: 32px;
}

.btn-download {
  background: linear-gradient(135deg, var(--control-dark) 0%, var(--control-blue) 100%);
  border: none;
  box-shadow: 0 4px 20px rgba(61, 122, 183, 0.35);
}

.btn-download:hover {
  background: linear-gradient(135deg, var(--control-blue) 0%, #4a8bc7 100%);
  box-shadow: 0 12px 35px rgba(61, 122, 183, 0.5);
  transform: translateY(-3px);
}

.btn-download svg {
  transition: transform 0.3s ease;
}

.btn-download:hover svg {
  animation: bounce 0.5s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

footer {
  padding: 48px 0;
  border-top: 1px solid #222;
  background: var(--bg-deep);
}

footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.footer-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.footer-main .copyright {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-main .copyright a {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.footer-main .copyright a:hover {
  color: var(--text);
}

.footer-email {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.footer-email:hover {
  color: var(--accent-bright);
}

/* Social links */
.footer-social ul {
  display: flex;
  align-items: center;
  gap: 16px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.footer-social a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.footer-social a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.footer-social svg {
  width: 18px;
  height: 18px;
}

@media (min-width: 768px) {
  footer .container {
    flex-direction: row;
    justify-content: space-between;
  }

  .footer-main {
    flex-direction: row;
    gap: 16px;
    text-align: left;
  }
}

/* ==========================================================================
   ANIMACIONES SVG - Estados base
   ========================================================================== */

/* Espiral de caos */
.spiral-path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
}

/* Nodos */
.node {
  transform-origin: center;
}

/* Partículas */
.particle {
  transform-origin: center;
}

/* Conexiones rotas */
.broken-line {
  opacity: 0;
}

/* Círculos concéntricos */
.pulse-circle {
  transform-origin: center;
}

/* ==========================================================================
   RESPONSIVE - Desktop
   ========================================================================== */

@media (min-width: 768px) {
  section {
    padding: 120px 0;
  }

  .hero {
    min-height: 100vh;
  }

  h1 {
    margin-bottom: 32px;
  }

  .hero .subtitle {
    margin-bottom: 64px;
  }

  blockquote {
    padding-left: 32px;
  }

  .title-line {
    font-size: clamp(3rem, 10vw, 6rem);
  }
}

/* ==========================================================================
   ACCESIBILIDAD
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .title-line,
  .hero .subtitle {
    opacity: 1;
    transform: none;
  }

  .spiral-path {
    stroke-dashoffset: 0;
  }
}

/* Focus visible para navegación por teclado */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ==========================================================================
   UTILIDADES
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 8px 16px;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: var(--accent);
  color: var(--text);
  z-index: 9999;
}
