:root {
  --bg-main: #0f1029;
  --bg-card: #16183b;
  --border-color: #26295c;
  --text-main: #f1f3f9;
  --text-muted: #9aa1c2;
  --accent: #3b49df;
  --accent-hover: #5361f5;
  --badge-bg: #252b63;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }

/* Header */
.site-header {
  width: 100%;
  z-index: 50;
  padding: 1.1rem 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(15, 16, 41, 0.92);
  backdrop-filter: blur(8px);
}
body.is-post .site-header {
  position: absolute;
  top: 0; left: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.65), transparent);
  border-bottom: none;
  backdrop-filter: none;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.brand-group { display: flex; align-items: baseline; gap: 1.2rem; }
.site-logo { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; color: #fff; }
.site-tagline { font-size: 0.9rem; color: rgba(255,255,255,0.75); }
.site-nav { display: flex; align-items: center; gap: 1.5rem; font-size: 0.95rem; }
.site-nav a:hover, .dropbtn:hover { color: #fff; opacity: 0.85; }

.dropdown { position: relative; display: inline-block; }
.dropbtn {
  background: none; border: none; color: inherit; font: inherit; cursor: pointer; padding: 0.25rem 0;
}
.dropdown-content {
  display: none; position: absolute; right: 0; top: 100%;
  background: var(--bg-card); border: 1px solid var(--border-color);
  min-width: 180px; border-radius: 8px; padding: 0.4rem 0;
  box-shadow: 0 10px 25px rgba(0,0,0,0.45); z-index: 100;
}
.dropdown-content a {
  display: block; padding: 0.5rem 1rem; font-size: 0.9rem; color: var(--text-main);
}
.dropdown-content a:hover { background: var(--badge-bg); }
.dropdown:hover .dropdown-content { display: block; }

/* Listado Portada */
.container { max-width: 1100px; width: 100%; margin: 1.1rem auto 2.5rem; padding: 0; flex: 1; }
.filter-banner { margin-bottom: 1.5rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.post-list { display: flex; flex-direction: column; }
.post-card {
  display: flex;
  gap: 1.6rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--border-color);
  align-items: flex-start;
}
.post-card:first-child { padding-top: 0.4rem; }
.post-card:last-child { border-bottom: none; }
.post-thumb {
  width: 240px; height: 145px; flex-shrink: 0;
  border-radius: 10px; overflow: hidden;
  background: linear-gradient(135deg, #109968, #63c728);
  display: flex; align-items: center; justify-content: center;
}
.post-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s ease; }
.post-card:hover .post-thumb img { transform: scale(1.03); }
.post-thumb-fallback { color: #fff; font-weight: 600; font-size: 0.95rem; text-align: center; padding: 0.5rem; }
.post-info { flex: 1; }
.post-title { font-size: 1.45rem; font-weight: 800; line-height: 1.25; margin-bottom: 0.45rem; color: #fff; }
.post-card:hover .post-title { color: #a5b0ff; }
.post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.7rem; }
.tag-pill {
  background: var(--badge-bg); color: #cfd6ff;
  padding: 0.15rem 0.7rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
}
.tag-pill:hover { background: var(--accent); color: #fff; }
.post-excerpt { color: #d5daf0; font-size: 0.96rem; line-height: 1.55; }

/* Paginacion */
.pagination { display: flex; justify-content: center; gap: 0.5rem; margin-top: 2.5rem; flex-wrap: wrap; }
.page-link {
  padding: 0.45rem 0.9rem; border-radius: 6px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  font-size: 0.9rem; font-weight: 600;
}
.page-link.active, .page-link:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Entrada Individual (Hero Fullscreen) */
.post-hero {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 460px;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}
.post-hero::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(10,12,30,0.48) 0%, rgba(10,12,30,0.82) 100%);
  z-index: 1;
}
.post-hero-content {
  position: relative; z-index: 2; max-width: 900px;
}
.post-hero h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 4px 24px rgba(0,0,0,0.65);
  line-height: 1.15;
  margin-bottom: 1rem;
}
.post-hero-meta {
  display: flex; justify-content: center; align-items: center; gap: 0.8rem; flex-wrap: wrap;
  color: rgba(255,255,255,0.88); font-size: 0.95rem;
}

.post-article {
  max-width: 1100px; width: 100%; margin: 3rem auto; padding: 0; flex: 1;
  font-size: 1.08rem; color: #e4e8f7;
}
.post-article h2, .post-article h3 { color: #fff; margin: 2rem 0 0.9rem; line-height: 1.3; }
.post-article p { margin-bottom: 1.25rem; }
.post-article a { color: #8b98ff; text-decoration: underline; }
.post-article ul, .post-article ol { margin: 0 0 1.3rem 1.6rem; }
.post-article blockquote {
  border-left: 4px solid var(--accent); padding: 0.6rem 1.2rem;
  background: var(--bg-card); margin: 1.5rem 0; border-radius: 0 8px 8px 0;
}
.post-article img { max-width: 100%; height: auto; border-radius: 8px; }
.post-article video { width: 100%; max-height: 540px; border-radius: 10px; background: #000; margin: 1.5rem 0; }

/* Video Embed Responsivo sin espacios extra */
.video-responsive {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
  margin: 1.25rem 0;
  background: #000;
  line-height: 0;
}
.video-responsive iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.post-article video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 540px;
  border-radius: 10px;
  background: #000;
  margin: 1.25rem 0;
}

/* Galeria PhotoSwipe (miniaturas max 150px) */
.pswp-gallery {
  display: flex; flex-wrap: wrap; gap: 10px; margin: 1.6rem 0; align-items: center;
}
.pswp-gallery a {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; overflow: hidden; border: 1px solid var(--border-color);
  transition: transform 0.2s;
}
.pswp-gallery a:hover { transform: scale(1.04); border-color: var(--accent); }
.pswp-gallery img {
  max-width: 150px; max-height: 150px; width: auto; height: auto; display: block; border-radius: 0;
}

/* Buscador modal opcional */
.search-box-wrap { margin-bottom: 1.5rem; display: none; }
.search-box-wrap.open { display: block; }
.search-input {
  width: 100%; padding: 0.75rem 1rem; border-radius: 8px;
  border: 1px solid var(--border-color); background: var(--bg-card); color: #fff; font-size: 1rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem 1.5rem; margin-top: 3rem;
  color: var(--text-muted); font-size: 0.9rem;
}
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
}

@media (max-width: 680px) {
  .post-card { flex-direction: column; }
  .post-thumb { width: 100%; height: 190px; }
  .post-hero { height: 65vh; min-height: 340px; }
}


/* Separacion de fecha y etiquetas debajo de la imagen destacada */
.post-submeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.2rem 2rem;
  padding-bottom: 1.3rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.95rem;
}
.post-date {
  font-weight: 600;
  letter-spacing: 0.02em;
}
.post-tags-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.post-submeta .tag-pill {
  text-decoration: none;
  color: #cfd6ff;
  padding: 0.25rem 0.85rem;
}

/* Tarjeta del Autor al final de la entrada */
.post-author-box {
  margin-top: 3.5rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.author-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--accent);
}
.author-avatar-fallback {
  background: var(--badge-bg);
  color: #fff;
  font-weight: 800;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.author-name {
  font-size: 1.12rem;
  font-weight: 800;
  color: #fff;
}
.author-role {
  font-size: 0.86rem;
  color: #a5b0ff;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.author-bio {
  font-size: 0.93rem;
  color: #d5daf0;
  margin: 0 !important;
  line-height: 1.5;
}
@media (max-width: 600px) {
  .post-author-box {
    flex-direction: column;
    text-align: center;
  }
}


/* Correccion Galeria Horizontal (150px max) y Lightwindow */
.pswp-gallery {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
  margin: 1.8rem 0 !important;
  align-items: center !important;
}
.pswp-gallery a,
.pswp-gallery a.pswp-item {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  margin: 0 !important;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  transition: transform 0.2s ease, border-color 0.2s ease;
  cursor: zoom-in;
}
.pswp-gallery a:hover {
  transform: scale(1.04);
  border-color: var(--accent);
}
.pswp-gallery img {
  max-width: 150px !important;
  max-height: 150px !important;
  width: auto !important;
  height: auto !important;
  display: block !important;
  border-radius: 0 !important;
}
.pswp-single a,
.author-avatar-link {
  cursor: zoom-in;
  display: inline-block;
}
@media (hover: none) and (pointer: coarse) {
  .post-hero {
    background-attachment: scroll;
  }
}


/* Soporte completo para alinear imagenes al centro, izquierda o derecha desde el editor */
.post-body [style*="text-align: center"] .pswp-single,
.post-body [style*="text-align:center"] .pswp-single,
.post-body [style*="text-align: center"] img,
.post-body [style*="text-align:center"] img,
.post-body .__se__float-center,
.post-body figure[style*="margin: auto"],
.post-body div[style*="text-align: center"] {
  display: block !important;
  margin-left: auto !important;
  margin-right: auto !important;
  text-align: center !important;
}
.post-body [style*="text-align: center"] a,
.post-body [style*="text-align:center"] a {
  display: inline-block !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.post-body [style*="text-align: right"] .pswp-single,
.post-body [style*="text-align:right"] .pswp-single {
  display: block !important;
  text-align: right !important;
}


/* Asegurar que el video de YouTube/iframe ocupe el 100% sin partirse a la mitad */
.post-body .video-responsive,
.video-responsive {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  aspect-ratio: 16 / 9 !important;
  height: auto !important;
  overflow: hidden !important;
  border-radius: 10px !important;
  margin: 1.4rem 0 !important;
  background: #000 !important;
}
.post-body .video-responsive iframe,
.video-responsive iframe {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  border: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Asegurar que la galeria siempre sea horizontal en filas y nunca en una sola columna */
.post-body .pswp-gallery,
.pswp-gallery {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100% !important;
  margin: 1.6rem 0 !important;
}
.post-body .pswp-gallery > a,
.pswp-gallery > a {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  border: 1px solid var(--border-color) !important;
  background: var(--bg-card) !important;
}
.post-body .pswp-gallery > a > img,
.pswp-gallery > a > img {
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: 150px !important;
  max-height: 150px !important;
  margin: 0 !important;
  border-radius: 0 !important;
}


@media (max-width: 1140px) {
  .site-header,
  .site-footer {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  .container,
  .post-article {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}


/* Botón Hamburguesa (oculto en escritorio) */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 7px;
  cursor: pointer;
  padding: 7px;
}
.hamburger-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}

@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
  }
  .site-tagline {
    display: none;
  }
  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-top: 0.9rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.12);
  }
  .site-nav.open {
    display: flex;
  }
  body.is-post .site-header {
    background: rgba(15, 16, 41, 0.94);
  }
  .dropdown {
    width: 100%;
  }
  .dropdown-content {
    position: static;
    width: 100%;
    margin-top: 0.4rem;
    box-shadow: none;
  }
  .dropdown:hover .dropdown-content {
    display: none;
  }
  .dropdown.open .dropdown-content {
    display: block;
  }
}

/* Ajustes especificos para celular en Portada y Entrada Individual */
@media (max-width: 680px) {
  .container {
    margin-top: 0.4rem;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .filter-banner {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .post-card {
    flex-direction: column;
    gap: 0.85rem;
    padding: 0 0 1.5rem 0;
  }
  .post-card:first-child {
    padding-top: 0;
  }
  .post-thumb {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    border-radius: 0 !important;
  }
  .post-info {
    padding: 0 1rem;
    width: 100%;
  }
  .post-title {
    font-size: 1.3rem;
    margin-bottom: 0;
  }
  /* Ocultar fecha, etiquetas y extracto en celular en el listado */
  .post-card .post-meta,
  .post-card .post-excerpt {
    display: none !important;
  }

  /* Imagen destacada en entrada individual ajustada a ancho completo sin recortes laterales en celular */
  body.is-post .site-header {
    position: relative;
  }
  .post-hero {
    height: auto !important;
    min-height: 230px !important;
    aspect-ratio: 16 / 9;
    background-size: 100% auto !important;
    background-size: contain !important;
    background-color: #090a1c;
    background-attachment: scroll !important;
    padding: 1.25rem;
  }
  .post-hero h1 {
    font-size: clamp(1.45rem, 6vw, 2.1rem);
    margin-bottom: 0;
  }
  .post-article {
    margin-top: 1.25rem;
  }
}
