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

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #13131a;
  --bg-tertiary: #1a1a24;
  --accent-primary: #8b5cf6;
  --accent-secondary: #ec4899;
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --border-color: rgba(139, 92, 246, 0.2);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  --glow: 0 0 20px rgba(139, 92, 246, 0.4);
  /* Added new color variables for enhanced effects */
  --accent-tertiary: #3b82f6;
  --success: #22c55e;
  --warning: #f59e0b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* Header */
.header {
  background: rgba(19, 19, 26, 0.7);
  border-bottom: 1px solid var(--border-color);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

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

/* Enhanced logo with glitch effect */
.logo {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 3s ease infinite;
  background-size: 200% 200%;
  position: relative;
  cursor: pointer;
}

.logo:hover::before,
.logo:hover::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo:hover::before {
  animation: glitch-1 0.3s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.logo:hover::after {
  animation: glitch-2 0.3s infinite;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitch-1 {
  0%,
  100% {
    transform: translate(0);
  }
  33% {
    transform: translate(-2px, 2px);
  }
  66% {
    transform: translate(2px, -2px);
  }
}

@keyframes glitch-2 {
  0%,
  100% {
    transform: translate(0);
  }
  33% {
    transform: translate(2px, -2px);
  }
  66% {
    transform: translate(-2px, 2px);
  }
}

.nav {
  display: flex;
  gap: 30px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent-primary);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-primary);
}

/* Main */
.main {
  padding: 40px 0;
  min-height: calc(100vh - 200px);
}

/* Hero */
/* Enhanced hero section with decorative elements */
.hero {
  text-align: center;
  padding: 80px 0 60px;
  margin-bottom: 40px;
  perspective: 1000px;
  position: relative;
}

.hero-decoration {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.hero-circle {
  position: absolute;
  border-radius: 50%;
  border: 2px solid;
  opacity: 0.1;
  animation: pulse-ring 3s ease-out infinite;
}

.circle-1 {
  width: 300px;
  height: 300px;
  border-color: var(--accent-primary);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.circle-2 {
  width: 450px;
  height: 450px;
  border-color: var(--accent-secondary);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: 1s;
}

.circle-3 {
  width: 600px;
  height: 600px;
  border-color: var(--accent-tertiary);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: 2s;
}

@keyframes pulse-ring {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.2;
  }
  50% {
    opacity: 0.1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0;
  }
}

.hero-title {
  font-size: 56px;
  font-weight: 800;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary), var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
  animation: gradient-flow 4s ease infinite, float-in 1s ease;
  text-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
  position: relative;
  /* Added text glow effect */
  filter: drop-shadow(0 0 30px rgba(139, 92, 246, 0.5));
}

.hero-subtitle {
  font-size: 22px;
  color: var(--text-secondary);
  animation: fade-in 1s ease 0.3s both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.typing-text {
  display: inline-block;
}

.cursor {
  display: inline-block;
  animation: blink 1s infinite;
  color: var(--accent-primary);
  font-weight: 300;
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* Added scroll indicator animation */
.hero-scroll-indicator {
  margin-top: 40px;
  animation: bounce 2s infinite;
  opacity: 0.6;
}

.hero-scroll-indicator svg {
  color: var(--accent-primary);
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
  margin-bottom: 50px;
  animation: slide-up 0.8s ease 0.5s both;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Enhanced stat cards with glow effects and progress bars */
.stat-card {
  background: rgba(19, 19, 26, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
  opacity: 0;
  transition: opacity 0.4s;
}

.stat-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 20px 60px rgba(139, 92, 246, 0.4);
  border-color: var(--accent-primary);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-icon-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
}

.stat-icon {
  font-size: 48px;
  transition: transform 0.3s;
  position: relative;
  z-index: 1;
  display: inline-block;
}

.stat-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, var(--accent-primary), transparent);
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: 50%;
  filter: blur(20px);
}

.stat-card:hover .stat-icon {
  transform: scale(1.2) rotate(5deg);
}

.stat-card:hover .stat-glow {
  opacity: 0.6;
  animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.8;
  }
}

.stat-value {
  font-size: 42px;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
  /* Added number animation */
  transition: transform 0.3s;
}

.stat-card:hover .stat-value {
  transform: scale(1.1);
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  position: relative;
  z-index: 1;
}

.stat-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  width: 0%;
  transition: width 1s ease;
  border-radius: 0 0 20px 20px;
}

.stat-card:hover .stat-progress {
  width: 100%;
}

/* Controls */
.controls {
  display: flex;
  gap: 20px;
  margin-bottom: 40px;
  flex-wrap: wrap;
  align-items: center;
}

/* Enhanced search box with clear button */
.search-box {
  flex: 1;
  min-width: 300px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 16px;
  color: var(--text-secondary);
  transition: color 0.3s;
}

.search-input:focus + .search-box svg {
  color: var(--accent-primary);
}

.search-input {
  width: 100%;
  padding: 14px 48px 14px 48px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 16px;
  transition: all 0.3s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
  transform: translateY(-2px);
}

.search-clear {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-clear:hover {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-primary);
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 12px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.filter-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-color: transparent;
  color: white;
}

.view-toggle {
  display: flex;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 4px;
}

.view-btn {
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-btn:hover {
  color: var(--accent-primary);
  background: rgba(139, 92, 246, 0.1);
}

.view-btn.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
}

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-secondary);
}

.spinner {
  border: 4px solid rgba(139, 92, 246, 0.1);
  border-left-color: var(--accent-primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* No Results */
.no-results {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 12px;
  margin: 20px 0;
}

/* Posts Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  padding: 20px 0;
}

.posts-grid.list-view {
  grid-template-columns: 1fr;
}

.posts-grid.list-view .post-card {
  display: flex;
  flex-direction: row;
}

.posts-grid.list-view .post-image {
  width: 300px;
  height: 200px;
  flex-shrink: 0;
}

.posts-grid.list-view .post-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Estilos base mejorados */
.post-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
  padding: 20px;
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.2);
}

.post-image-container {
  position: relative;
  width: 115%;
  height: 200px; /* Altura fija para todas las imágenes */
  margin: -20px -20px 20px -20px;
  overflow: hidden;
}

.post-image {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Mantiene la proporción y cubre todo el contenedor */
  object-position: center; /* Centra la imagen */
  transition: transform 0.3s ease;
}

.post-card:hover .post-image {
  transform: scale(1.05); /* Efecto zoom suave al hover */
}

.post-body {
  padding: 0;
}

.post-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.post-excerpt {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 16px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-type {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.post-type.md {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-primary);
}

.post-type.html {
  background: rgba(236, 72, 153, 0.1);
  color: var(--accent-secondary);
}

/* Mejoras responsivas */
@media (max-width: 768px) {
  .posts-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
  }

  .post-card {
    padding: 16px;
  }

  .post-image-container {
    margin: -16px -16px 16px -16px;
  }

  .post-title {
    font-size: 1.25rem;
  }
}

/* Badges mejorados */
.read-badge,
.notes-badge {
  position: absolute;
  top: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  z-index: 1;
}

.read-badge {
  right: 12px;
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.notes-badge {
  right: 90px;
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 30px 0;
  text-align: center;
  color: var(--text-secondary);
}

/* Animated Background */
/* Enhanced animated background with canvas particles */
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

#particlesCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.3;
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.25;
  animation: float 25s infinite ease-in-out;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-primary), transparent);
  top: -300px;
  left: -300px;
  animation-delay: 0s;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-secondary), transparent);
  bottom: -250px;
  right: -250px;
  animation-delay: 8s;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #3b82f6, transparent);
  top: 40%;
  left: 50%;
  animation-delay: 16s;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(150px, -100px) scale(1.15);
  }
  50% {
    transform: translate(-100px, 150px) scale(0.9);
  }
  75% {
    transform: translate(100px, 100px) scale(1.05);
  }
}

/* Scroll to Top Button */
/* Enhanced scroll to top button with ripple effect */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 999;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
  overflow: hidden;
}

.scroll-to-top::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.scroll-to-top:hover::before {
  width: 100px;
  height: 100px;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  animation: bounce-in 0.5s ease;
}

@keyframes bounce-in {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.scroll-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.6);
}

.scroll-to-top:active {
  transform: translateY(-2px) scale(0.95);
}

/* Responsive */
@media (max-width: 768px) {
  .hero-title {
    font-size: 36px;
  }

  .hero-subtitle {
    font-size: 16px;
  }

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

  .controls {
    flex-direction: column;
  }

  .search-box {
    min-width: 100%;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .posts-grid.list-view .post-card {
    flex-direction: column;
  }

  .posts-grid.list-view .post-image {
    width: 100%;
    height: 220px;
  }

  .nav {
    gap: 15px;
  }

  .scroll-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }

  .hero-circle {
    display: none;
  }

  .stat-card {
    padding: 24px;
  }

  .stat-icon {
    font-size: 36px;
  }

  .stat-value {
    font-size: 32px;
  }
}
