/*
Theme Name:   JoseGeek (Neve Child)
Theme URI:    https://josegeek.com/
Description:  Tema hijo de Neve para JoseGeek: cabecera y menú lateral móvil del sitio josegeek, botón de modo claro/oscuro, portada con tabla de últimas entradas (categoría, título, fecha), pie con tres columnas de widgets, SEO, datos estructurados para Google News y ajustes de velocidad.
Author:       JoseGeek
Author URI:   https://josegeek.com/
Template:     neve
Version:      1.2.0
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  josegeek
*/

/* ====== Colores (mismos del proyecto josegeek), claro y oscuro ====== */
:root {
  color-scheme: light;
  --jg-bg: #fff;          --jg-text: #333;        --jg-muted: #777;
  --jg-link: #337ab7;     --jg-link-h: #23527c;
  --jg-nav-bg: #f8f8f8;   --jg-nav-border: #e7e7e7; --jg-nav-text: #777; --jg-nav-text-h: #333;
  --jg-panel-bg: #fff;    --jg-border: #ddd;
  --jg-th-bg: #f5f5f5;    --jg-row-alt: #fafafa;  --jg-row-h: #f0f0f0;
  --jg-badge-bg: #e8e8e8; --jg-badge-text: #555;
  --jg-sombra-h: rgba(0,0,0,.22);
  --jg-amarillo: #FFDD33;
  --jg-fuente: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --jg-bg: #222;          --jg-text: #ccc;        --jg-muted: #999;
  --jg-link: #5aa2e0;     --jg-link-h: #8cc0ee;
  --jg-nav-bg: #1a1a1a;   --jg-nav-border: #080808; --jg-nav-text: #9d9d9d; --jg-nav-text-h: #fff;
  --jg-panel-bg: #2a2a2a; --jg-border: #444;
  --jg-th-bg: #303030;    --jg-row-alt: #262626;  --jg-row-h: #333;
  --jg-badge-bg: #3a3a3a; --jg-badge-text: #bbb;
  --jg-sombra-h: rgba(0,0,0,.7);

  /* Variables de Neve: así el contenido de entradas, páginas, comentarios y widgets también se oscurece */
  --nv-site-bg: #222;
  --nv-light-bg: #2a2a2a;
  --nv-dark-bg: #111;
  --nv-text-color: #ccc;
  --nv-text-dark-bg: #eee;
  --nv-primary-accent: #5aa2e0;
  --nv-secondary-accent: #8cc0ee;
  --nv-c-1: #9fd89f;
  --nv-c-2: #f1a7a5;
}

body { background: var(--jg-bg); color: var(--jg-text); }
:root[data-theme="dark"] body,
:root[data-theme="dark"] .neve-main { background-color: var(--jg-bg); color: var(--jg-text); }
:root[data-theme="dark"] h1, :root[data-theme="dark"] h2, :root[data-theme="dark"] h3,
:root[data-theme="dark"] h4, :root[data-theme="dark"] h5, :root[data-theme="dark"] h6 { color: #e6e6e6; }
:root[data-theme="dark"] input, :root[data-theme="dark"] textarea, :root[data-theme="dark"] select {
  background-color: #333; color: var(--jg-text); border-color: #555;
}
:root[data-theme="dark"] pre, :root[data-theme="dark"] code,
:root[data-theme="dark"] .wp-block-code, :root[data-theme="dark"] blockquote { background-color: #2a2a2a; color: var(--jg-text); }
:root[data-theme="dark"] .wp-block-table td, :root[data-theme="dark"] .wp-block-table th,
:root[data-theme="dark"] table td, :root[data-theme="dark"] table th { border-color: var(--jg-border); }
/* El contorno oscuro del logo desaparece sobre fondo negro: borde claro muy fino */
:root[data-theme="dark"] .jg-logo img { filter: drop-shadow(0 0 1px rgba(255,255,255,.6)); }

[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--jg-link); outline-offset: 2px; }
/* Neve da estilos a todos los <button>: se anulan en los botones propios */
.jg-hamburguesa, .jg-btn-tema, .jg-btn-cerrar, .jg-btn-tema-drawer {
  box-shadow: none; text-transform: none; letter-spacing: normal; min-height: 0; font-weight: normal;
}
.jg-header a, .jg-drawer a { text-decoration: none; }
.jg-container { width: 100%; max-width: 1170px; margin: 0 auto; padding: 0 15px; }

/* ====== Cabecera ====== */
.jg-header {
  position: sticky; top: 0; z-index: 100; margin: 0;
  font-family: var(--jg-fuente); font-size: 14px; line-height: 1.43;
  background: var(--jg-nav-bg); border-bottom: 1px solid var(--jg-nav-border);
}
.admin-bar .jg-header { top: var(--wp-admin--admin-bar--height, 32px); }
@media (max-width: 600px) { .admin-bar .jg-header { top: 0; } }
/* Cabecera fija desactivada desde Personalizar */
.jg-header.jg-header--normal, .admin-bar .jg-header.jg-header--normal { position: relative; top: auto; }
/* Neve pone overflow:hidden en .wrapper y body: eso anula la cabecera fija (sticky).
   "clip" recorta igual lo que se sale por los lados, pero sin romper el sticky. */
body { overflow-x: clip; }
body > .wrapper, body > .wrapper:not(.et-fb-iframe-ancestor) { overflow: visible; overflow-x: clip; }
body, .wrapper { margin-top: 0; padding-top: 0; }

.jg-header-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: max(56px, calc(var(--jg-logo-h-m, 28px) + 20px)); }
.jg-logo { display: block; grid-column: 2; line-height: 0; }
.jg-logo img { display: block; height: var(--jg-logo-h-m, 28px); width: auto; max-width: 60vw; object-fit: contain; }
.jg-logo-texto { line-height: 1.2; font-size: 20px; font-weight: bold; color: var(--jg-nav-text-h); }
.jg-logo-texto:hover { text-decoration: none; color: var(--jg-nav-text-h); }
.jg-menu, .jg-acciones { display: none; }

.jg-hamburguesa {
  grid-column: 3; justify-self: end; position: relative; width: 42px; height: 42px; padding: 0;
  background: none; border: 0; border-radius: 6px; cursor: pointer; color: var(--jg-nav-text-h);
}
.jg-hamburguesa:hover { background: none; }
.jg-barras, .jg-barras::before, .jg-barras::after { position: absolute; height: 2px; background: currentColor; border-radius: 2px; }
.jg-barras { left: 10px; right: 10px; top: 20px; }
.jg-barras::before, .jg-barras::after { content: ""; left: 0; right: 0; }
.jg-barras::before { top: -7px; }
.jg-barras::after  { top: 7px; }

/* Botón claro/oscuro */
.jg-ico { width: 20px; height: 20px; flex: none; }
.jg-ico-sol { display: none; }
:root[data-theme="dark"] .jg-ico-sol { display: block; }
:root[data-theme="dark"] .jg-ico-luna { display: none; }
.jg-btn-tema {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--jg-border); border-radius: 50%; background: var(--jg-panel-bg); color: var(--jg-text); cursor: pointer;
}
.jg-btn-tema:hover, .jg-btn-tema:focus { background: var(--jg-row-h); color: var(--jg-text); }

/* ====== Menú lateral (móvil): sale por la izquierda ====== */
.jg-overlay {
  position: fixed; inset: 0; z-index: 99998; background: rgba(0,0,0,.5);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s;
}
.jg-drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 99999; display: flex; flex-direction: column;
  width: 280px; max-width: 85vw; overflow-y: auto;
  font-family: var(--jg-fuente); font-size: 14px; line-height: 1.43;
  background: var(--jg-panel-bg); border-right: 1px solid var(--jg-border);
  transform: translateX(-100%); visibility: hidden;
  transition: transform .25s ease, visibility 0s linear .25s;
}
.jg-menu-abierto { overflow: hidden; }
.jg-menu-abierto .jg-overlay { opacity: 1; visibility: visible; transition: opacity .25s ease, visibility 0s; }
.jg-menu-abierto .jg-drawer  { transform: none; visibility: visible; box-shadow: 4px 0 24px var(--jg-sombra-h); transition: transform .25s ease, visibility 0s; }

.jg-drawer-cab { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--jg-border); }
.jg-drawer-cab .jg-logo img { height: 26px; }
.jg-btn-cerrar { padding: 2px 10px; font-size: 30px; line-height: 1; background: none; border: 0; color: var(--jg-text); cursor: pointer; }
.jg-btn-cerrar:hover, .jg-btn-cerrar:focus { background: none; color: var(--jg-text); }
.jg-drawer-links, .jg-drawer-links ul { margin: 0; padding: 0; list-style: none; }
.jg-drawer-links a {
  display: block; padding: 14px 20px; font-size: 16px; color: var(--jg-text);
  border-bottom: 1px solid var(--jg-border); border-left: 4px solid transparent;
}
.jg-drawer-links ul a { padding-left: 36px; font-size: 15px; }
.jg-drawer-links a:hover { background: var(--jg-row-h); text-decoration: none; color: var(--jg-text); }
.jg-drawer-links a[aria-current="page"] { border-left-color: var(--jg-amarillo); background: var(--jg-row-alt); font-weight: bold; }
.jg-btn-tema-drawer {
  display: flex; align-items: center; gap: 10px; margin: 16px 20px 24px; padding: 10px 14px;
  font: inherit; color: var(--jg-text); background: var(--jg-panel-bg);
  border: 1px solid var(--jg-border); border-radius: 6px; cursor: pointer;
}
.jg-btn-tema-drawer:hover, .jg-btn-tema-drawer:focus { background: var(--jg-row-h); color: var(--jg-text); }
.jg-t-claro { display: none; }
:root[data-theme="dark"] .jg-t-claro  { display: inline; }
:root[data-theme="dark"] .jg-t-oscuro { display: none; }

/* ====== Menú de escritorio ====== */
@media (min-width: 900px) {
  .jg-header-inner { display: flex; align-items: center; gap: 24px; min-height: var(--jg-header-h, 60px); }
  .jg-logo { grid-column: auto; }
  .jg-logo img { height: var(--jg-logo-h, 34px); max-width: 420px; }
  .jg-menu { display: block; flex: 1; }
  .jg-menu > ul { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
  .jg-menu li { position: relative; }
  .jg-menu a { display: flex; align-items: center; height: var(--jg-header-h, 60px); padding: 0 12px; color: var(--jg-nav-text); }
  .jg-menu a:hover { color: var(--jg-nav-text-h); text-decoration: none; }
  .jg-menu a[aria-current="page"],
  .jg-menu .current-menu-ancestor > a { color: var(--jg-nav-text-h); box-shadow: inset 0 -3px 0 var(--jg-amarillo); }
  /* Submenús (si los hay) */
  .jg-menu .sub-menu {
    position: absolute; top: 100%; left: 0; z-index: 10; min-width: 200px; margin: 0; padding: 4px 0; list-style: none;
    background: var(--jg-panel-bg); border: 1px solid var(--jg-border); border-radius: 0 0 4px 4px;
    box-shadow: 0 8px 20px var(--jg-sombra-h); opacity: 0; visibility: hidden; transition: opacity .15s, visibility 0s linear .15s;
  }
  .jg-menu li:hover > .sub-menu, .jg-menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; transition: opacity .15s; }
  .jg-menu .sub-menu a { height: auto; padding: 8px 14px; color: var(--jg-text); }
  .jg-menu .sub-menu a:hover { background: var(--jg-row-h); }
  .jg-acciones { display: flex; align-items: center; gap: 10px; margin-left: auto; }
  .jg-hamburguesa, .jg-drawer, .jg-overlay { display: none; }
}

/* ====== Portada: tabla de entradas ====== */
.jg-listado { padding-top: 24px; padding-bottom: 10px; font-family: var(--jg-fuente); font-size: 14px; line-height: 1.43; }
.jg-listado a { color: var(--jg-link); text-decoration: none; }
.jg-listado a:hover, .jg-listado a:focus { color: var(--jg-link-h); text-decoration: underline; }
.jg-table-responsive { width: 100%; margin-bottom: 20px; }
.jg-tabla { width: 100%; margin: 0; border-collapse: collapse; table-layout: auto; background: var(--jg-panel-bg); color: var(--jg-text); }
.jg-tabla th, .jg-tabla td { padding: 8px; border: 1px solid var(--jg-border); vertical-align: middle; text-align: left; }
.jg-tabla th { background: var(--jg-th-bg); font-weight: bold; white-space: nowrap; }
.jg-tabla tbody tr:nth-child(even) { background: var(--jg-row-alt); }
.jg-tabla tbody tr:hover { background: var(--jg-row-h); }
.jg-tabla .jg-col-cat   { width: 160px; }
.jg-tabla .jg-col-fecha { width: 110px; white-space: nowrap; }
.jg-tabla td.jg-titulo  { overflow-wrap: anywhere; }
.jg-tabla td.jg-vacio   { text-align: center; color: var(--jg-muted); padding: 20px; }
.jg-tabla .jg-cat-link  { color: var(--jg-muted); }
.jg-tabla .jg-cat-link:hover, .jg-tabla .jg-cat-link:focus { color: var(--jg-link-h); }

/* Móvil: cada fila pasa a ser una tarjeta (categoría y fecha arriba, título debajo) */
@media (max-width: 640px) {
  .jg-tabla, .jg-tabla tbody { display: block; border: 0; background: none; }
  .jg-tabla thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .jg-tabla tr {
    display: grid; grid-template-columns: 1fr auto; grid-template-areas: "cat fecha" "titulo titulo"; gap: 4px 12px;
    padding: 10px 12px; background: var(--jg-panel-bg); border: 1px solid var(--jg-border); border-top: 0;
  }
  .jg-tabla tr:first-child { border-top: 1px solid var(--jg-border); border-radius: 4px 4px 0 0; }
  .jg-tabla tr:last-child { border-radius: 0 0 4px 4px; }
  .jg-tabla td { display: block; width: auto !important; padding: 0; border: 0; font-size: 13px; }
  .jg-tabla td.jg-col-cat   { grid-area: cat; }
  .jg-tabla td.jg-col-fecha { grid-area: fecha; color: var(--jg-muted); font-size: 12px; }
  .jg-tabla td.jg-titulo    { grid-area: titulo; font-size: 15px; line-height: 1.35; }
  .jg-tabla td.jg-vacio     { grid-column: 1 / -1; }
}

/* ====== Categorías, etiquetas, autores y búsqueda ====== */
.jg-archivo { padding-top: 24px; padding-bottom: 10px; font-family: var(--jg-fuente); }
.jg-archivo-cab h1 { margin: 0 0 16px; font-size: 30px; font-weight: 700; line-height: 1.15; }
.jg-archivo-desc { margin: 0 0 20px; color: var(--jg-muted); font-size: 15px; line-height: 1.6; }
.jg-archivo-desc p { margin: 0 0 8px; }

/* Cabecera de la categoría (imagen o color) */
.jg-hero {
  position: relative; display: flex; align-items: flex-end; min-height: 170px; margin: 0 0 18px;
  overflow: hidden; border-radius: 6px; isolation: isolate;
}
.jg-hero-fondo { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.jg-hero--img { color: #fff !important; }
.jg-hero--img::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.25) 55%, rgba(0,0,0,0) 100%);
}
.jg-hero-texto { padding: 24px 32px; }
.jg-hero-titulo {
  margin: 0; color: inherit; font-size: 48px; font-weight: 800; line-height: 1.05;
  text-transform: uppercase; letter-spacing: -.5px; text-shadow: 0 2px 10px rgba(0,0,0,.25);
}
:root[data-theme="dark"] .jg-hero-titulo { color: inherit; }
.jg-badge--hero { margin-bottom: 14px; }

/* Etiquetas de colores (categorías) */
.jg-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.jg-badges li { margin: 0; }
.jg-subcats { margin: 0 0 22px; }
a.jg-badge, .jg-archivo a.jg-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 3px;
  font-size: 12px; font-weight: 700; line-height: 1.3; text-transform: uppercase; letter-spacing: .2px;
  background: var(--jg-badge, #e31b23); color: var(--jg-badge-txt, #fff); text-decoration: none;
}
a.jg-badge:hover, a.jg-badge:focus, .jg-archivo a.jg-badge:hover { color: var(--jg-badge-txt, #fff); filter: brightness(1.12); text-decoration: none; }
.jg-subcats a.jg-badge span { font-size: 9px; }

/* Lista de entradas con imagen */
.jg-lista { display: flex; flex-direction: column; gap: 28px; margin: 0 0 30px; }
.jg-item { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; align-items: start; margin: 0; }
.jg-item-img { display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 6px; background: var(--jg-badge-bg); }
.jg-item-img img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.jg-item-img:hover img { transform: scale(1.04); }
.jg-item-cuerpo { min-width: 0; }
.jg-item-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 4px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--jg-muted);
}
.jg-archivo .jg-item-com { display: inline-flex; align-items: center; gap: 4px; color: var(--jg-muted); text-decoration: none; }
.jg-archivo .jg-item-com:hover { color: var(--jg-link); }
.jg-item-titulo { margin: 0 0 6px; font-size: 24px; font-weight: 800; line-height: 1.2; }
.jg-archivo .jg-item-titulo a { color: var(--jg-text); text-decoration: none; }
:root:not([data-theme="dark"]) .jg-archivo .jg-item-titulo a { color: #111; }
.jg-archivo .jg-item-titulo a:hover, .jg-archivo .jg-item-titulo a:focus { color: var(--jg-link); }
.jg-item-extracto { margin: 0; font-size: 15px; line-height: 1.5; color: var(--jg-muted); }
.jg-lista-vacia { padding: 30px 0; text-align: center; color: var(--jg-muted); }
.jg-archivo .pagination .nav-links { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 0 0 20px; }
.jg-archivo .pagination .page-numbers {
  display: inline-block; min-width: 34px; padding: 6px 10px; text-align: center; text-decoration: none;
  border: 1px solid var(--jg-border); border-radius: 4px; background: var(--jg-panel-bg); color: var(--jg-link);
}
.jg-archivo .pagination .page-numbers.current { background: var(--jg-th-bg); color: var(--jg-text); font-weight: bold; }

@media (max-width: 767px) {
  .jg-hero { min-height: 130px; }
  .jg-hero-texto { padding: 18px 20px; }
  .jg-hero-titulo { font-size: 30px; }
  .jg-item-titulo { font-size: 19px; }
}
@media (max-width: 600px) {
  .jg-lista { gap: 22px; }
  .jg-item { grid-template-columns: 120px minmax(0, 1fr); gap: 12px; }
  .jg-item-meta { margin-top: 6px; font-size: 11px; }
  .jg-item-titulo { font-size: 16px; }
  .jg-item-extracto { display: none; }
  a.jg-badge, .jg-archivo a.jg-badge { padding: 3px 7px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .jg-item-img img { transition: none; } }

/* Paginación */
.jg-listado .pagination .nav-links { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 0 0 20px; }
.jg-listado .pagination .page-numbers {
  display: inline-block; min-width: 34px; padding: 6px 10px; text-align: center;
  border: 1px solid var(--jg-border); border-radius: 4px; background: var(--jg-panel-bg); color: var(--jg-link);
}
.jg-listado .pagination .page-numbers.current { background: var(--jg-th-bg); color: var(--jg-text); font-weight: bold; }
.jg-listado .pagination a.page-numbers:hover { background: var(--jg-row-h); text-decoration: none; }
.jg-buscador { display: flex; gap: 8px; max-width: 520px; margin: 0 0 16px; }

/* ====== Pie ====== */
.jg-pie {
  margin-top: 20px; font-family: var(--jg-fuente); font-size: 13px; line-height: 1.5; color: var(--jg-muted);
  background: var(--jg-nav-bg); border-top: 1px solid var(--jg-nav-border);
}
.jg-pie a { color: var(--jg-link); }
.jg-pie a:hover { color: var(--jg-link-h); }
.jg-pie-widgets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-top: 24px; padding-bottom: 8px; }
.jg-pie-col .widget { margin-bottom: 16px; }
.jg-pie-col .jg-widget-titulo { margin: 0 0 8px; font-size: 15px; font-weight: bold; color: var(--jg-nav-text-h); }
.jg-pie-col ul { margin: 0; padding-left: 18px; }
.jg-pie-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding-top: 16px; padding-bottom: 16px; }
.jg-pie-widgets + .jg-pie-inner { border-top: 1px solid var(--jg-nav-border); }
.jg-pie-menu ul { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; }
.jg-pie-menu a { color: var(--jg-muted); }
.jg-pie-copy { margin-left: auto; text-align: right; }

@media (max-width: 767px) {
  .jg-pie-widgets { grid-template-columns: 1fr; gap: 8px; }
  .jg-archivo-cab h1 { font-size: 24px; }
}
@media (max-width: 640px) {
  .jg-pie-copy { order: -1; width: 100%; margin-left: 0; text-align: center; }
  .jg-pie-menu { width: 100%; }
  .jg-pie-menu ul { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .jg-drawer, .jg-overlay, .jg-menu .sub-menu { transition: none; }
}
