/* ========== VARIABLES ========== */
:root {
  --bg-body: #FEFAF5;
  --bg-surface: #FFFFFF;
  --text-primary: #2C2C2C;
  --text-secondary: #6F7C6A;
  --border-light: #F0E5D8;
  --primary: #C9A87C;
  --primary-dark: #B58E63;
  --primary-light: #EADFCB;
  --secondary: #5D7A5C;
  --secondary-light: #8F9E8A;
  --card-shadow: rgba(93, 122, 92, 0.08);
  --hero-gradient-start: #0a0f1c;
  --hero-gradient-end: #0d1a2b;
  --tag-bg: rgba(201,168,124,0.12);
  --footer-bg: #EFE8DF;
  --modal-overlay: rgba(0,0,0,0.75);
  --transition-default: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

body.dark-mode {
  --bg-body: #1A2A1F;
  --bg-surface: #24332A;
  --text-primary: #F2EFE6;
  --text-secondary: #C5C9B6;
  --border-light: #3F4A3A;
  --primary: #D6B47A;
  --primary-dark: #C2A36B;
  --primary-light: #4A5A3E;
  --secondary: #ADC09F;
  --secondary-light: #7C8F72;
  --card-shadow: rgba(0,0,0,0.3);
  --hero-gradient-start: #0a0f1c;
  --hero-gradient-end: #0b1a2a;
  --tag-bg: rgba(214,180,122,0.18);
  --footer-bg: #162015;
  --modal-overlay: rgba(0,0,0,0.9);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.2s ease;
  overflow-x: hidden;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }
* { scrollbar-width: thin; scrollbar-color: var(--primary) var(--border-light); }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* ========== HEADER ========== */
header {
  background: rgba(var(--bg-body), 0.98);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition-default);
}
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  position: relative;
}
.logo {
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--secondary);
  font-family: 'Playfair Display', serif;
  flex-shrink: 0;
}
.logo span { color: var(--primary); }

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0 auto;
}
.nav-links a {
  text-decoration: none;
  font-weight: 500;
  color: var(--secondary);
  transition: 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--primary); }

.dark-mode-toggle {
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--secondary);
  background: var(--tag-bg);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 60px;
  transition: 0.2s;
  flex-shrink: 0;
}
.dark-mode-toggle:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.menu-icon {
  display: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--secondary);
  background: none;
  border: none;
  flex-shrink: 0;
}

@media (max-width: 1024px) {
  .navbar { justify-content: space-between; }
  .logo { flex: 0 0 auto; }
  .dark-mode-toggle { margin: 0 auto; order: 1; }
  .menu-icon { display: block; order: 2; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    padding: 1.8rem 0;
    margin: 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 999;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    text-align: center;
  }
  .nav-links.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  .nav-links li { width: 100%; text-align: center; }
  .nav-links a { font-size: 1.1rem; padding: 0.5rem; display: inline-block; }
}

/* ========== HERO ========== */
.blog-hero {
  position: relative;
  padding: 4rem 0;
  background: linear-gradient(120deg, var(--hero-gradient-start), var(--hero-gradient-end));
  overflow: hidden;
  text-align: center;
}
.tech-hero { min-height: 300px; display: flex; align-items: center; }
.hero-particles-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.tech-icon {
  position: absolute;
  font-size: 1.8rem;
  color: rgba(201,168,124,0.3);
  animation: floatTech 12s infinite ease-in-out;
}
.tech-icon:nth-child(1) { top: 15%; left: 5%; animation-duration: 14s; font-size: 2.2rem; }
.tech-icon:nth-child(2) { top: 70%; left: 85%; animation-duration: 18s; font-size: 1.6rem; }
.tech-icon:nth-child(3) { top: 40%; left: 92%; animation-duration: 12s; font-size: 2rem; }
.tech-icon:nth-child(4) { top: 80%; left: 10%; animation-duration: 16s; font-size: 1.9rem; }
.tech-icon:nth-child(5) { top: 25%; left: 80%; animation-duration: 20s; font-size: 2.4rem; }
.tech-icon:nth-child(6) { top: 55%; left: 20%; animation-duration: 11s; font-size: 1.7rem; }
.tech-icon:nth-child(7) { top: 10%; left: 45%; animation-duration: 15s; font-size: 2rem; }
.tech-icon:nth-child(8) { top: 60%; left: 60%; animation-duration: 13s; font-size: 1.8rem; }

@keyframes floatTech {
  0% { transform: translate(0,0) rotate(0deg); opacity: 0.2; }
  50% { transform: translate(20px,-30px) rotate(10deg); opacity: 0.6; }
  100% { transform: translate(-10px,20px) rotate(-5deg); opacity: 0.2; }
}

.moving-gradient-bg {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(201,168,124,0.2) 0%, transparent 60%);
  animation: slowDrift 18s infinite alternate ease-in-out;
  pointer-events: none;
  z-index: 0;
}
@keyframes slowDrift {
  0% { transform: translate(0%,0%) rotate(0deg); opacity: 0.5; }
  100% { transform: translate(5%,8%) rotate(3deg); opacity: 1; }
}
.blog-hero .container { position: relative; z-index: 2; }
.hero-badge {
  background: var(--primary-light);
  padding: 0.3rem 1rem;
  border-radius: 50px;
  font-size: 0.8rem;
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--secondary);
  backdrop-filter: blur(4px);
}
.blog-hero h1 {
  font-size: 2.8rem;
  font-family: 'Playfair Display', serif;
  margin-bottom: 1rem;
  color: white;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.blog-hero p {
  font-size: 1.1rem;
  max-width: 650px;
  margin: 0 auto;
  color: rgba(255,255,255,0.85);
}

/* ========== FILTROS Y GRID ========== */
.filter-bar { margin-top: 2rem; margin-bottom: 1rem; text-align: center; }
.filter-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem; }
.filter-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: 0.2s;
}
.filter-btn.active, .filter-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.loading-spinner { text-align: center; padding: 3rem; color: var(--text-secondary); }
.loading-spinner-small {
  text-align: center;
  padding: 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Skeleton loading */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin: 3rem 0;
}
.skeleton-card {
  background: var(--bg-surface);
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  animation: pulse 1.5s ease-in-out infinite;
}
.skeleton-image {
  height: 160px;
  background: var(--primary-light);
  opacity: 0.5;
}
.skeleton-content {
  padding: 1.5rem;
}
.skeleton-category {
  width: 100px;
  height: 20px;
  background: var(--primary-light);
  border-radius: 40px;
  margin-bottom: 0.8rem;
}
.skeleton-title {
  width: 80%;
  height: 24px;
  background: var(--primary-light);
  border-radius: 8px;
  margin-bottom: 0.8rem;
}
.skeleton-excerpt {
  width: 100%;
  height: 60px;
  background: var(--primary-light);
  border-radius: 8px;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin: 3rem 0;
}
.post-card {
  background: var(--bg-surface);
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  transition: var(--transition-default);
  box-shadow: 0 12px 24px -12px var(--card-shadow);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.post-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 32px -12px rgba(0,0,0,0.15);
  border-color: var(--primary-light);
}
.post-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--primary-light);
}
.video-thumbnail {
  position: relative;
  width: 100%;
  height: 160px;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  transition: transform 0.2s;
}
.video-thumbnail::after {
  content: "\f04b";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  color: white;
  background: rgba(0,0,0,0.6);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
  pointer-events: none;
}
.video-thumbnail:hover::after {
  transform: translate(-50%, -50%) scale(1.1);
  background: rgba(201,168,124,0.9);
}
.video-container {
  position: relative;
  width: 100%;
  height: 160px;
  background-color: #000;
}
.video-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.post-video-placeholder {
  background: #1b2a1f;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 160px;
  position: relative;
}
.post-video-placeholder i { font-size: 3rem; color: var(--primary); }
.post-content { padding: 1.5rem; flex: 1; }
.post-category {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  background: var(--tag-bg);
  padding: 0.2rem 0.8rem;
  border-radius: 40px;
  margin-bottom: 0.8rem;
  color: var(--primary-dark);
  font-weight: 600;
}
.post-title { font-size: 1.3rem; font-family: 'Playfair Display', serif; margin-bottom: 0.8rem; line-height: 1.3; }
.post-excerpt { color: var(--text-secondary); margin-bottom: 1rem; font-size: 0.9rem; }
.post-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.post-stats i { margin-right: 0.3rem; }
.load-more-container { text-align: center; margin: 2rem 0; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  padding: 0.6rem 1.3rem;
  border-radius: 60px;
  color: var(--secondary);
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}
.btn-outline:hover { background: var(--primary); color: white; }

/* ========== SECCIÓN DATOS CURIOSOS ========== */
.curiosities-section {
  position: relative;
  padding: 4rem 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  overflow: hidden;
}
.floating-dots-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(var(--primary-light) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  opacity: 0.2;
  animation: floatDots 20s linear infinite;
  pointer-events: none;
}
@keyframes floatDots {
  0% { background-position: 0 0; }
  100% { background-position: 40px 40px; }
}
.section-header { text-align: center; margin-bottom: 2rem; }
.section-header h2 { font-size: 1.8rem; font-family: 'Playfair Display', serif; margin-bottom: 0.5rem; }
.section-header p { color: var(--text-secondary); }
.curiosity-card {
  max-width: 700px;
  margin: 2rem auto;
  background: rgba(var(--bg-body), 0.7);
  backdrop-filter: blur(8px);
  border-radius: 48px;
  padding: 2rem;
  text-align: center;
  border: 1px solid var(--border-light);
  transition: transform 0.3s;
}
.curiosity-icon { font-size: 3rem; color: var(--primary); margin-bottom: 1rem; }
.curiosity-text { font-size: 1.3rem; font-family: 'Playfair Display', serif; font-style: italic; margin-bottom: 1rem; }
.curiosity-author { font-size: 0.8rem; color: var(--primary-dark); }
.curiosity-navigation { display: flex; justify-content: center; gap: 1rem; margin-top: 1rem; }
.curiosity-nav {
  background: var(--tag-bg);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--primary);
  transition: 0.2s;
}
.curiosity-nav:hover { background: var(--primary); color: white; }

/* ========== MODAL CORREGIDO - CONTENIDO VISIBLE ========== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--modal-overlay);
  backdrop-filter: blur(12px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  animation: fadeModal 0.3s ease;
}
.modal-content {
  background: var(--bg-surface);
  width: 95vw;
  max-width: 1000px;
  height: 90vh;
  max-height: 90vh;
  border-radius: 2rem;
  padding: 2rem;
  position: relative;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
  flex-direction: column;
}
.modal-body-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
  margin-bottom: 1rem;
}
.modal-close {
  position: sticky;
  top: 0;
  right: 0;
  float: right;
  font-size: 2rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: 0.2s;
  z-index: 10;
  background: var(--bg-surface);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.modal-close:hover { color: var(--primary); background: var(--tag-bg); }

@keyframes fadeModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Título y meta */
.modal-content h3 {
  font-size: 1.8rem;
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
  line-height: 1.2;
  color: var(--text-primary);
}
.modal-content .post-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
/* Video más pequeño */
.modal-content .video-responsive {
  position: relative;
  padding-bottom: 0;
  height: auto;
  max-height: 40vh;
  width: 100%;
  margin: 1rem auto;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
}
.modal-content .video-responsive iframe {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 200px;
  max-height: 40vh;
  border: none;
}
/* Imagen más pequeña */
.modal-content img {
  max-width: 80%;
  max-height: 40vh;
  object-fit: contain;
  margin: 1rem auto;
  display: block;
  border-radius: 20px;
}
/* Contenido del artículo - Clase específica para asegurar visibilidad */
.post-full-content {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin: 1rem 0;
  background: rgba(var(--bg-body), 0.4);
  padding: 1rem;
  border-radius: 20px;
  text-align: justify;    /* TEXTO JUSTIFICADO */
  hyphens: auto;          /* División de palabras largas */
}
.post-full-content p {
  margin-bottom: 1rem;
}

/* Barra de acciones: like y comentarios lado a lado */
.modal-interactions {
  margin-top: 1rem;
  border-top: 2px solid var(--border-light);
  padding-top: 1.5rem;
}
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.like-btn, .post-stats-modal {
  flex: 1;
  justify-content: center;
  text-align: center;
}
.like-btn {
  background: var(--tag-bg);
  border: none;
  border-radius: 60px;
  padding: 0.6rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--secondary-light);
  cursor: pointer;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.like-btn i { font-size: 1.3rem; transition: transform 0.2s ease; }
.like-btn.liked i {
  font-weight: 900;
  color: #e74c3c;
  animation: heartExplosion 0.5s cubic-bezier(0.34, 1.2, 0.64, 1);
}
@keyframes heartExplosion {
  0% { transform: scale(1); }
  30% { transform: scale(1.5); color: #ff6b6b; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.like-btn:hover { background: var(--primary-light); transform: scale(1.02); }
.post-stats-modal {
  font-size: 1rem;
  color: var(--text-secondary);
  background: var(--tag-bg);
  padding: 0.5rem 1rem;
  border-radius: 60px;
}
.post-stats-modal i { margin-right: 0.3rem; }

/* Comentarios */
.comments-section-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
}
.comments-section {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}
.comments-section h4 { font-family: 'Playfair Display', serif; margin-bottom: 1rem; font-size: 1.3rem; text-align: center; }
.comments-list { max-height: 300px; overflow-y: auto; margin-bottom: 1.5rem; padding-right: 0.5rem; }
.comment-item {
  background: var(--bg-body);
  border-radius: 20px;
  padding: 1rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--primary);
  transition: 0.2s;
}
.comment-item:hover { transform: translateX(5px); }
.comment-name { font-weight: 700; font-size: 0.9rem; color: var(--primary-dark); margin-bottom: 0.3rem; }
.comment-date { font-size: 0.7rem; color: var(--text-secondary); margin-left: 0.5rem; font-weight: normal; }
.comment-text { font-size: 0.95rem; color: var(--text-primary); line-height: 1.4; }
.comment-form { display: flex; flex-direction: column; gap: 0.8rem; }
.comment-input, .comment-form textarea {
  background: var(--bg-body);
  border: 1px solid var(--border-light);
  border-radius: 28px;
  padding: 0.8rem 1rem;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  resize: vertical;
}
.comment-input:focus, .comment-form textarea:focus { outline: none; border-color: var(--primary); }
.btn-primary {
  background: var(--primary);
  padding: 0.8rem 1.5rem;
  border-radius: 60px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); }

@media (max-width: 480px) {
  
  .like-btn, .post-stats-modal {
    width: 100%;
  }
}

/* ========== FOOTER Y SCROLL ========== */
footer { background: var(--footer-bg); padding: 2rem 0; text-align: center; }
.copyright { margin-top: 0.5rem; font-size: 0.75rem; }
.scroll-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--primary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
  box-shadow: 0 5px 12px rgba(0,0,0,0.2);
}
.scroll-top.visible { opacity: 1; visibility: visible; }

@media (max-width: 768px) {
  .blog-hero h1 { font-size: 2rem; }
  .posts-grid { grid-template-columns: 1fr; }
  .curiosity-text { font-size: 1rem; }
  .filter-buttons { gap: 0.5rem; }
  .filter-btn { font-size: 0.75rem; padding: 0.4rem 0.8rem; }
  .section-header h2 { font-size: 1.5rem; }
  .tech-icon { font-size: 1.2rem; }
  .modal-content { padding: 1.5rem; width: 98vw; height: 95vh; border-radius: 1rem; }
  .modal-content h3 { font-size: 1.5rem; }
}

.fade-up {
  opacity: 0;
  transform: translateY(25px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.fade-up.visible { opacity: 1; transform: translateY(0); }