/*
Theme Name: Nodo — Blog de IA
Theme URI: https://nodoblog.es/
Author: Daniel Téllez Corona
Description: Tema minimalista y moderno para un blog de inteligencia artificial. Fondo oscuro, tipografía limpia, rejilla de tarjetas y cero ruido visual.
Version: 1.0.0
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.0
License: GNU GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nodo
*/

:root {
  --bg: #07080d;
  --bg-soft: #0d0f16;
  --surface: #12141d;
  --surface-2: #171a25;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --text: #e9ecf5;
  --text-dim: #9aa3b8;
  --text-faint: #6b7288;
  --accent: #4fd1ff;
  --accent-2: #a78bfa;
  --accent-3: #34d399;
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1180px;
  --readw: 720px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 18px 50px -12px rgba(0, 0, 0, .75);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Fondo con rejilla sutil y auroras de color */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(79, 209, 255, .10), transparent 60%),
    radial-gradient(800px 480px at 88% 0%, rgba(167, 139, 250, .10), transparent 62%),
    linear-gradient(180deg, #08090f 0%, #07080d 45%, #06070b 100%);
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-2); }

h1, h2, h3, h4 {
  line-height: 1.2;
  letter-spacing: -.022em;
  font-weight: 700;
  color: #fff;
  margin: 0 0 .5em;
}

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 8, 13, .72);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 66px;
}

.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 1.12rem; color: #fff; letter-spacing: -.03em; }
.brand:hover { color: #fff; }
.brand-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06070b;
  font-weight: 900;
  font-size: .95rem;
  box-shadow: 0 0 22px -4px rgba(79, 209, 255, .6);
}
.brand-text small { display: block; font-size: .66rem; font-weight: 600; color: var(--text-faint); letter-spacing: .12em; text-transform: uppercase; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav li { list-style: none; margin: 0; padding: 0; }
.nav a {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-dim);
}
.nav a:hover, .nav a.current-menu-item > a, .nav .current-menu-item > a { color: #fff; background: rgba(255, 255, 255, .06); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 9px;
  padding: 7px 10px;
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero { padding: 60px 0 30px; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
  background: rgba(79, 209, 255, .08);
  border: 1px solid rgba(79, 209, 255, .22);
  padding: 6px 13px; border-radius: 999px;
  margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(2.1rem, 5.2vw, 3.5rem);
  max-width: 17ch;
  margin-bottom: 18px;
}
.hero p.lead {
  font-size: 1.1rem;
  color: var(--text-dim);
  max-width: 62ch;
  margin: 0 0 26px;
}
.hero-meta { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; font-size: .84rem; color: var(--text-faint); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 21px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06070b;
  font-weight: 700;
  font-size: .9rem;
  border: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { color: #06070b; transform: translateY(-1px); box-shadow: 0 10px 30px -10px rgba(79, 209, 255, .7); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn.ghost:hover { color: #fff; background: rgba(255, 255, 255, .05); box-shadow: none; }

/* ---------- Categorías ---------- */
.cats { display: flex; flex-wrap: wrap; gap: 9px; padding: 26px 0 4px; border-bottom: 1px solid var(--border); margin-bottom: 38px; }
.cats a {
  font-size: .8rem; font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .02);
}
.cats a:hover { color: #fff; border-color: var(--border-strong); background: rgba(255, 255, 255, .06); }
.cats a .n { color: var(--text-faint); font-weight: 500; margin-left: 6px; font-size: .75rem; }

/* ---------- Rejilla de artículos ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 26px;
  padding-bottom: 60px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.card-media { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2, .7, .3, 1); }
.card:hover .card-media img { transform: scale(1.05); }
.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.card h3 { font-size: 1.16rem; margin: 10px 0 10px; }
.card h3 a { color: #fff; }
.card h3 a:hover { color: var(--accent); }
.card p { color: var(--text-dim); font-size: .93rem; margin: 0 0 16px; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .78rem; color: var(--text-faint); }

/* Etiqueta de categoría */
.badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--accent);
  background: rgba(79, 209, 255, .1);
  border: 1px solid rgba(79, 209, 255, .2);
}
.badge[data-c="Hardware"] { color: #f0a868; background: rgba(240, 168, 104, .1); border-color: rgba(240, 168, 104, .22); }
.badge[data-c="Investigación"] { color: var(--accent-2); background: rgba(167, 139, 250, .1); border-color: rgba(167, 139, 250, .22); }
.badge[data-c="Negocio"] { color: var(--accent-3); background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .22); }
.badge[data-c="Regulación"] { color: #f87ba0; background: rgba(248, 123, 160, .1); border-color: rgba(248, 123, 160, .22); }
.badge[data-c="Agentes"] { color: #6ee7d7; background: rgba(110, 231, 215, .1); border-color: rgba(110, 231, 215, .22); }

/* ---------- Artículo ---------- */
.article { padding: 46px 0 70px; }

.article-head { max-width: var(--readw); margin: 0 auto 34px; }
.article-head h1 { font-size: clamp(1.85rem, 4.4vw, 2.7rem); margin: 14px 0 16px; }
.article-head .dek { font-size: 1.08rem; color: var(--text-dim); margin: 0 0 20px; }
.article-meta { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; font-size: .82rem; color: var(--text-faint); }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-faint); display: inline-block; }

.article-cover { max-width: 980px; margin: 0 auto 38px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.article-cover img { width: 100%; }

.prose { max-width: var(--readw); margin: 0 auto; font-size: 1.06rem; }
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 0 0 1.35em; }
.prose h2 { font-size: 1.42rem; margin: 2.1em 0 .7em; padding-top: .2em; }
.prose h3 { font-size: 1.16rem; margin: 1.7em 0 .6em; color: var(--text); }
.prose ul, .prose ol { margin: 0 0 1.35em; padding-left: 1.3em; }
.prose li { margin-bottom: .5em; }
.prose li::marker { color: var(--accent); }
.prose blockquote {
  margin: 1.8em 0;
  padding: 4px 0 4px 22px;
  border-left: 3px solid var(--accent-2);
  color: var(--text-dim);
  font-style: italic;
}
.prose strong { color: #fff; font-weight: 650; }
.prose img { border-radius: var(--radius-sm); margin: 1.8em 0; }
.prose code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 5px;
}
.prose pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  overflow-x: auto;
}
.prose pre code { background: none; border: none; padding: 0; }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(79, 209, 255, .4); }

/* Cajas del artículo: resumen, opinión, fuente */
.box {
  margin: 2.2em 0;
  padding: 24px 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}
.box h2, .box h3 { margin-top: 0; font-size: 1.02rem; letter-spacing: .02em; }
.box p:last-child { margin-bottom: 0; }
.box.resumen { border-left: 3px solid var(--accent); }
.box.opinion { border-left: 3px solid var(--accent-2); background: linear-gradient(180deg, rgba(167, 139, 250, .05), transparent), var(--surface); }
.box.fuente { border-left: 3px solid var(--accent-3); font-size: .92rem; }
.box.fuente a { font-weight: 600; word-break: break-word; }
.box-label {
  display: block;
  font-size: .68rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 9px;
}

/* Índice / info lateral */
.article-foot { max-width: var(--readw); margin: 40px auto 0; padding-top: 26px; border-top: 1px solid var(--border); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: .78rem; color: var(--text-dim);
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, .02);
}
.tag:hover { color: #fff; border-color: var(--border-strong); }

/* Compartir */
.share { display: flex; align-items: center; gap: 10px; margin-top: 26px; font-size: .85rem; color: var(--text-faint); }
.share a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px;
  border: 1px solid var(--border); color: var(--text-dim);
}
.share a:hover { color: #fff; border-color: var(--border-strong); background: rgba(255, 255, 255, .05); }

/* Navegación entre artículos */
.postnav { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: var(--readw); margin: 46px auto 0; }
.postnav a {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-dim);
}
.postnav a:hover { border-color: var(--border-strong); color: #fff; }
.postnav .lbl { display: block; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; }
.postnav .ttl { font-weight: 600; font-size: .94rem; color: var(--text); }
.postnav .next { text-align: right; }

/* ---------- Pie ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 30px; padding: 40px 0 34px; color: var(--text-faint); font-size: .87rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.footer-links a { color: var(--text-dim); }
.footer-links a:hover { color: #fff; }
.footer-menu { display: contents; margin: 0; padding: 0; list-style: none; }
.footer-menu li { display: inline; }

/* ---------- Formularios y varios ---------- */
input[type="text"], input[type="email"], input[type="search"], input[type="url"], textarea, select {
  width: 100%;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
}
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(79, 209, 255, .5); outline-offset: 1px; border-color: transparent; }

.search-form { display: flex; gap: 10px; max-width: 480px; margin: 26px 0; }
.page-title { padding: 44px 0 6px; }
.page-title h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.page-title p { color: var(--text-dim); }

.empty { text-align: center; padding: 70px 0; color: var(--text-dim); }

.pagination { display: flex; justify-content: center; gap: 8px; padding: 0 0 60px; }
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--border);
  color: var(--text-dim); font-size: .88rem;
}
.pagination .page-numbers.current { background: var(--accent); color: #06070b; border-color: transparent; font-weight: 700; }
.pagination .page-numbers:hover { border-color: var(--border-strong); color: #fff; }

.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link:focus {
  position: absolute; left: 12px; top: 12px; z-index: 999;
  width: auto; height: auto; clip: auto; background: var(--accent); color: #06070b;
  padding: 10px 16px; border-radius: 8px;
}

/* ---------- Articulos relacionados ---------- */
.related { max-width: var(--readw); margin: 52px auto 0; padding-top: 34px; border-top: 1px solid var(--border); }
.related-title { font-size: 1.05rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); margin: 0 0 22px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ---------- Tablas comparativas ---------- */
.table-wrap {
  margin: 30px 0;
  /* El header es sticky: sin esto, al saltar a la tabla el menu la tapa. */
  scroll-margin-top: 90px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 14px 34px -18px rgba(0, 0, 0, .8);
}

.prose table,
.entry-content table {
  scroll-margin-top: 90px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 30px 0;
  font-size: .93rem;
  line-height: 1.55;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 14px 34px -18px rgba(0, 0, 0, .8);
}

.prose table thead,
.entry-content table thead { background: var(--surface-2); }

.prose table th,
.entry-content table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--surface-2);
  border-bottom: 2px solid var(--border-strong);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.prose table th:last-child,
.entry-content table th:last-child { border-right: 0; }

.prose table td,
.entry-content table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

.prose table td:last-child,
.entry-content table td:last-child { border-right: 0; }

/* Filas alternas: separan visualmente las columnas sin ruido. */
.prose table tbody tr:nth-child(even),
.entry-content table tbody tr:nth-child(even) { background: rgba(255, 255, 255, .022); }

.prose table tbody tr:hover,
.entry-content table tbody tr:hover { background: rgba(79, 209, 255, .06); }

.prose table tbody tr:last-child td,
.entry-content table tbody tr:last-child td { border-bottom: 0; }

/* La primera columna acts as the row label. */
.prose table tbody td:first-child,
.entry-content table tbody td:first-child {
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, .03);
  white-space: normal;
}

/* Tabla dentro de un contenedor con scroll: sin borde duplicado. */
.table-wrap table {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.table-wrap table th:first-child { border-top-left-radius: var(--radius-sm); }
.table-wrap table th:last-child { border-top-right-radius: var(--radius-sm); }

@media (max-width: 720px) {
  .prose table, .entry-content table { font-size: .86rem; }
  .prose table th, .entry-content table th { padding: 11px 12px; }
  .prose table td, .entry-content table td { padding: 10px 12px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .nav { display: none; }
  .nav-toggle { display: block; }
  .nav.open { display: flex; position: absolute; top: 66px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--bg-soft); border-bottom: 1px solid var(--border); padding: 12px; gap: 2px; }
  .nav.open a { padding: 11px 14px; }
  .grid { grid-template-columns: 1fr; gap: 20px; }
  .postnav { grid-template-columns: 1fr; }
  .postnav .next { text-align: left; }
  .related-grid { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 20px; }
  body { font-size: 16px; }
  .prose { font-size: 1.02rem; }
}
