/*
Theme Name: Tesmark Hub
Theme URI: https://tesmark.com/blog/
Author: Tesmark Services LLC
Author URI: https://tesmark.com
Description: Hub de recursos de IA de Tesmark. Mismo sistema visual que tesmark.com, optimizado para SEO, velocidad y conversión.
Version: 1.1.2
Requires at least: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: tesmark-hub
*/

/* ---------- Tipografías (las mismas que usa tesmark.com, servidas desde /fonts/) ---------- */
@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap; src: url("/fonts/montserrat-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 800; font-display: swap; src: url("/fonts/montserrat-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Urbanist"; font-weight: 400 500; font-display: swap; src: url("/fonts/urbanist-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Urbanist"; font-weight: 600; font-display: swap; src: url("/fonts/urbanist-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Urbanist"; font-weight: 700; font-display: swap; src: url("/fonts/urbanist-latin-700-normal.woff2") format("woff2"); }

/* ---------- Variables (las mismas del sitio principal) ---------- */
:root {
  --charcoal: #1E2028;
  --deep: #0F1117;
  --surface: #2A2D37;
  --blue: #5B8DB8;
  --blue-dark: #3F6E99;
  --blue-mist: #B8D4E8;
  --blue-wash: #EAF2F8;
  --gray: #6B6F7A;
  --line: #E2E3E8;
  --off: #F0F0F3;
  --white: #FFFFFF;
  --wa: #128C4B;
  --font-head: "Montserrat", system-ui, sans-serif;
  --font-body: "Urbanist", system-ui, sans-serif;
  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 28px;
  --wrap: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-body); font-size: 18px; line-height: 1.55; color: var(--charcoal); background: var(--white); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 800; letter-spacing: -0.045em; line-height: 1.08; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 10px; left: 10px; z-index: 100; width: auto; height: auto; clip: auto; background: var(--charcoal); color: var(--white); padding: 10px 16px; border-radius: 8px; }

.wrap { width: min(var(--wrap), 100% - 40px); margin-inline: auto; }
.wrap--text { width: min(760px, 100% - 40px); margin-inline: auto; }
.muted { color: var(--gray); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; padding: 15px 26px; border-radius: 999px; border: 2px solid var(--charcoal); text-decoration: none; cursor: pointer; background: var(--charcoal); color: var(--white); transition: background .15s; }
.btn:hover { background: var(--deep); }
.btn--ghost { background: transparent; color: var(--charcoal); }
.btn--ghost:hover { background: var(--off); }
.btn--light { background: var(--white); color: var(--charcoal); border-color: var(--white); }
.btn--light:hover { background: var(--blue-mist); border-color: var(--blue-mist); }
.btn--sm { padding: 10px 18px; font-size: 0.92rem; }

/* ---------- Cabecera ---------- */
.site-head { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.admin-bar .site-head { top: 32px; }
.nav { display: flex; align-items: center; gap: 22px; height: 68px; }
.nav__logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav__logo img { height: 24px; width: auto; }
.nav__logo span { font-weight: 700; color: var(--gray); border-left: 1px solid var(--line); padding-left: 10px; font-size: 0.95rem; }
.nav__links { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; flex: 1; }
.nav__links a, .nav__links button { font: inherit; font-size: 0.98rem; font-weight: 600; color: var(--charcoal); background: none; border: 0; cursor: pointer; text-decoration: none; padding: 9px 13px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.nav__links a:hover, .nav__links button:hover, .nav__links a[aria-current="page"] { background: var(--off); }
.has-sub { position: relative; }
.sub { position: absolute; top: calc(100% + 8px); left: 0; min-width: 300px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px; margin: 0; list-style: none; display: none; box-shadow: 0 18px 40px -18px rgba(15,17,23,.35); }
.has-sub.open .sub { display: block; }
.sub a { display: block; border-radius: 12px; padding: 12px 14px; }
.sub a span { display: block; font-weight: 500; font-size: 0.88rem; color: var(--gray); }
.nav__links .only-mobile { display: none; }
.nav__burger { display: none; background: none; border: 0; padding: 8px; cursor: pointer; margin-left: auto; }
.nav__burger span { display: block; width: 24px; height: 2px; background: var(--charcoal); margin: 5px 0; }

/* ---------- Portada del hub ---------- */
.hub-hero { padding: 64px 0 34px; }
.hub-hero h1 { font-size: clamp(2.4rem, 5.6vw, 4.2rem); max-width: 16ch; }
.hub-hero .lead { font-size: clamp(1.1rem, 1.6vw, 1.3rem); color: #3B3E48; max-width: 60ch; margin-top: 18px; }
.search-form { display: flex; gap: 10px; margin-top: 28px; max-width: 620px; }
.search-form input { flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: 14px 20px; border: 2px solid var(--line); border-radius: 999px; background: var(--white); }
.search-form input:focus { border-color: var(--charcoal); outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; list-style: none; padding: 0; }
.chips a { display: inline-block; text-decoration: none; font-weight: 600; font-size: 0.95rem; padding: 8px 15px; border-radius: 999px; background: var(--off); }
.chips a:hover, .chips a[aria-current="page"] { background: var(--charcoal); color: var(--white); }

.sec { padding: 56px 0; }
.sec--tint { background: var(--off); }
.sec--dark { background: var(--charcoal); color: var(--white); }
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.sec-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
.sec-head p { margin-top: 10px; color: #474A55; max-width: 62ch; }
.sec-head a { font-weight: 700; text-underline-offset: 4px; }

/* Entrada destacada */
.featured { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; border-radius: var(--r-lg); overflow: hidden; background: var(--charcoal); color: var(--white); text-decoration: none; }
.featured__img { background: var(--surface); min-height: 320px; }
.featured__img img { width: 100%; height: 100%; object-fit: cover; }
.featured__body { padding: 38px; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.featured h2 { font-size: clamp(1.6rem, 2.8vw, 2.3rem); }
.featured p { color: #C2C6D1; }
.featured .cat { color: var(--blue-mist); }
.featured:hover h2 { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 2px; }

/* Tarjetas */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.card { display: flex; flex-direction: column; text-decoration: none; }
.card__img { border-radius: var(--r-md); overflow: hidden; background: var(--off); aspect-ratio: 16 / 10; margin-bottom: 14px; }
.card__img img { width: 100%; height: 100%; object-fit: cover; }
.card__img--empty { display: grid; place-items: center; background: var(--charcoal); }
.card__img--empty img { width: 40%; height: auto; object-fit: contain; opacity: .9; }
.card h3 { font-size: 1.2rem; letter-spacing: -0.03em; line-height: 1.22; margin: 6px 0 8px; }
.card p { font-size: 0.98rem; color: #474A55; }
.card:hover h3 { text-decoration: underline; text-underline-offset: 4px; }
.cat { font-weight: 700; font-size: 0.9rem; color: var(--blue-dark); }
.meta { font-size: 0.9rem; color: var(--gray); margin-top: 10px; }

/* Temas */
.topics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.topic { display: block; text-decoration: none; background: var(--white); border-radius: var(--r-md); padding: 24px; border: 2px solid transparent; }
.topic:hover { border-color: var(--charcoal); }
.topic h3 { font-size: 1.2rem; letter-spacing: -0.03em; margin-bottom: 8px; }
.topic p { font-size: 0.98rem; color: #474A55; }
.topic .n { display: block; margin-top: 12px; font-weight: 700; font-size: 0.9rem; color: var(--blue-dark); }

/* Banda de conversión */
.cta-band { background: var(--charcoal); color: var(--white); border-radius: var(--r-lg); padding: clamp(28px, 5vw, 52px); display: grid; grid-template-columns: 1.3fr .7fr; gap: 28px; align-items: center; }
.cta-band h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.cta-band p { margin-top: 12px; color: #C2C6D1; max-width: 54ch; }
.cta-band .actions { display: flex; flex-direction: column; gap: 10px; }
.spots { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.92rem; background: rgba(184,212,232,.16); color: var(--blue-mist); padding: 7px 14px; border-radius: 999px; align-self: flex-start; }
.spots::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--blue-mist); }

/* Paginación */
.pagination { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 44px; }
.pagination .page-numbers { min-width: 44px; height: 44px; display: inline-grid; place-items: center; padding: 0 14px; border-radius: 999px; background: var(--off); text-decoration: none; font-weight: 700; }
.pagination .current { background: var(--charcoal); color: var(--white); }

/* ---------- Entrada ---------- */
.crumbs { font-size: 0.92rem; color: var(--gray); padding-top: 34px; }
.crumbs a { text-decoration: none; font-weight: 600; color: var(--charcoal); }
.crumbs a:hover { text-decoration: underline; }
.post-head { padding: 18px 0 30px; }
.post-head h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); margin: 12px 0 18px; }
.post-head .lead { font-size: 1.2rem; color: #3B3E48; }
.byline { display: flex; align-items: center; gap: 12px; margin-top: 24px; font-size: 0.95rem; color: var(--gray); }
.byline img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: center 15%; }
.byline b { color: var(--charcoal); display: block; }
.post-cover { width: min(1000px, 100% - 40px); margin: 0 auto 36px; border-radius: var(--r-lg); overflow: hidden; }
.post-cover img { width: 100%; max-height: 520px; object-fit: cover; }

.post-layout { display: grid; grid-template-columns: 220px minmax(0, 720px); gap: 56px; justify-content: center; width: min(1060px, 100% - 40px); margin: 0 auto; }
.toc { position: sticky; top: 96px; align-self: start; font-size: 0.92rem; }
.toc p { font-weight: 700; margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc li a { display: block; padding: 6px 0 6px 14px; margin-left: -2px; border-left: 2px solid transparent; text-decoration: none; color: var(--gray); line-height: 1.35; }
.toc li a:hover { color: var(--charcoal); border-left-color: var(--charcoal); }

.prose { font-size: 1.12rem; line-height: 1.7; color: #24262E; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: clamp(1.5rem, 2.6vw, 1.95rem); margin-top: 2em; scroll-margin-top: 96px; }
.prose h3 { font-size: 1.3rem; letter-spacing: -0.03em; margin-top: 1.6em; scroll-margin-top: 96px; }
.prose a { color: var(--blue-dark); font-weight: 600; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .4em; }
.prose img, .prose figure img { border-radius: var(--r-md); }
.prose figure { margin: 1.6em 0; }
.prose figcaption { font-size: 0.9rem; color: var(--gray); margin-top: 8px; text-align: left; }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--blue); font-size: 1.2rem; font-weight: 600; }
.prose table { width: 100%; border-collapse: collapse; font-size: 1rem; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.prose th { font-family: var(--font-head); letter-spacing: -0.02em; }
.prose code { background: var(--off); padding: 2px 6px; border-radius: 6px; font-size: .92em; }
.prose pre { background: var(--charcoal); color: var(--white); padding: 18px; border-radius: var(--r-md); overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose .wp-block-image { margin: 1.6em 0; }

.updated { margin-top: 36px; font-size: 0.92rem; color: var(--gray); }

/* Caja "En resumen" al inicio de las entradas */
.prose .tsm-resumen { background: var(--off); border-left: 4px solid var(--blue); border-radius: 0 var(--r-md) var(--r-md) 0; padding: 22px 26px; margin-bottom: 2em; }
.prose .tsm-resumen p { margin: 0 0 8px; font-family: var(--font-head); letter-spacing: -0.02em; }
.prose .tsm-resumen ul { margin: 0; }
.prose .tsm-resumen li { font-size: 1.02rem; }
.prose blockquote { font-size: 1.05rem; font-weight: 500; background: var(--blue-wash); border-left-color: var(--blue); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 16px 20px; }

/* Caja de acción dentro de la entrada */
.post-cta { margin-top: 48px; background: var(--blue-wash); border-radius: var(--r-lg); padding: 30px; }
.post-cta .when { font-weight: 700; color: var(--blue-dark); font-size: 0.95rem; }
.post-cta h2 { font-size: 1.6rem; margin: 8px 0 10px; }
.post-cta p { color: #3B3E48; }
.post-cta .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* Autor */
.author { margin-top: 32px; display: grid; grid-template-columns: 88px 1fr; gap: 20px; align-items: start; border-top: 1px solid var(--line); padding-top: 32px; }
.author img { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; object-position: center 15%; }
.author h2 { font-size: 1.2rem; letter-spacing: -0.03em; }
.author .role { font-weight: 700; color: var(--blue-dark); font-size: 0.95rem; margin: 2px 0 8px; }
.author p { font-size: 1rem; color: #3B3E48; }
.author a { font-weight: 700; text-underline-offset: 3px; }

.share { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; align-items: center; font-weight: 700; font-size: 0.95rem; }
.share a { text-decoration: none; padding: 8px 14px; border-radius: 999px; background: var(--off); font-weight: 600; }
.share a:hover { background: var(--charcoal); color: var(--white); }

/* Archivo */
.archive-head { padding: 52px 0 30px; }
.archive-head h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.archive-head p { margin-top: 14px; font-size: 1.15rem; color: #3B3E48; max-width: 62ch; }
.empty { padding: 40px; background: var(--off); border-radius: var(--r-lg); }
.empty h2 { font-size: 1.5rem; margin-bottom: 10px; }

/* Menú de temas (debajo de la cabecera) */
.topic-nav { border-bottom: 1px solid var(--line); background: var(--white); }
.topic-nav .wrap { display: flex; align-items: center; gap: 16px; }
.topic-nav ul { list-style: none; margin: 0; padding: 10px 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; -webkit-mask-image: linear-gradient(90deg,#000 88%,transparent); mask-image: linear-gradient(90deg,#000 88%,transparent); }
@media (min-width: 1000px) { .topic-nav ul { flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; } }
.topic-nav ul::-webkit-scrollbar { display: none; }
.topic-nav a { display: inline-block; white-space: nowrap; text-decoration: none; font-weight: 600; font-size: 0.9rem; padding: 6px 12px; border-radius: 999px; color: var(--charcoal); }
.topic-nav a:hover { background: var(--off); }
.topic-nav a[aria-current="page"] { background: var(--charcoal); color: var(--white); }
.topic-search input { font: inherit; font-size: 0.93rem; width: 160px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; }
.topic-search input:focus { outline: none; border-color: var(--charcoal); }
@media (max-width: 720px) { .topic-search { display: none; } }

/* Gráficas propias dentro de las entradas */
.prose .tsm-chart { margin: 2em 0; padding: 22px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--white); }
.prose .tsm-chart svg { width: 100%; height: auto; display: block; }
.prose .tsm-chart figcaption { font-size: 0.85rem; color: var(--gray); margin-top: 12px; }
.prose .tsm-chart details { margin-top: 8px; font-size: 0.92rem; }
.prose .tsm-chart summary { cursor: pointer; font-weight: 600; color: var(--blue-dark); }
.prose .tsm-chart table { margin-top: 10px; font-size: 0.92rem; }

/* Dato destacado y ficha del estudio */
.prose .tsm-dato { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; background: var(--charcoal); color: var(--white); border-radius: var(--r-md); padding: 22px 26px; margin: 1.8em 0; }
.prose .tsm-dato b { font-family: var(--font-head); font-weight: 800; letter-spacing: -0.05em; font-size: clamp(2.2rem, 5vw, 3rem); line-height: 1; color: var(--blue-mist); }
.prose .tsm-dato span { font-size: 1.05rem; line-height: 1.45; }
.prose .tsm-estudio { font-size: 0.95rem; background: var(--off); border-radius: var(--r-md); padding: 16px 20px; margin: 1.6em 0; }
.prose .tsm-estudio p { margin: 0; }
.prose .tsm-estudio p + p { margin-top: 6px; }
@media (max-width: 640px) { .prose .tsm-dato { grid-template-columns: 1fr; } .prose .tsm-chart { padding: 14px; } }

/* ---------- Pie ---------- */
.site-foot { background: var(--deep); color: #C2C6D1; padding: 64px 0 34px; margin-top: 80px; font-size: 0.98rem; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 36px; }
.site-foot img { height: 24px; width: auto; margin-bottom: 16px; }
.site-foot h4 { color: var(--white); font-size: 1rem; letter-spacing: -0.02em; margin-bottom: 14px; }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin: 8px 0; }
.site-foot a { text-decoration: none; }
.site-foot a:hover { color: var(--white); text-decoration: underline; }
.site-foot address { font-style: normal; font-size: 0.9rem; margin-top: 16px; line-height: 1.5; color: #8A8F9C; }
.foot-legal { border-top: 1px solid #2A2D37; margin-top: 40px; padding-top: 22px; font-size: 0.86rem; color: #8A8F9C; display: flex; flex-wrap: wrap; gap: 10px 30px; justify-content: space-between; }

.wa-float { position: fixed; right: 18px; bottom: 18px; z-index: 40; background: var(--wa); color: var(--white); border-radius: 999px; height: 56px; padding: 0 20px 0 16px; display: inline-flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; box-shadow: 0 12px 28px -12px rgba(15,17,23,.6); }
.wa-float svg { width: 26px; height: 26px; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .nav__burger { display: block; }
  .nav__links { display: none; position: absolute; left: 0; right: 0; top: 68px; background: var(--white); flex-direction: column; align-items: stretch; padding: 14px 20px 20px; border-bottom: 1px solid var(--line); gap: 2px; }
  .nav.open .nav__links { display: flex; }
  .nav__links .only-mobile { display: block; }
  .nav__cta { display: none; }
  .nav__links a, .nav__links button { width: 100%; padding: 13px 12px; font-size: 1.05rem; }
  .sub { position: static; display: block; border: 0; box-shadow: none; padding: 0 0 0 14px; min-width: 0; }
  .featured, .cta-band { grid-template-columns: 1fr; }
  .featured__img { min-height: 0; aspect-ratio: 16/9; }
  .grid, .topics { grid-template-columns: repeat(2, 1fr); }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .post-layout { grid-template-columns: minmax(0, 720px); gap: 0; }
  .toc { position: static; background: var(--off); border-radius: var(--r-md); padding: 20px; margin-bottom: 30px; }
}
@media (max-width: 782px) { .admin-bar .site-head { top: 46px; } }
@media (max-width: 640px) {
  body { font-size: 17px; }
  .grid, .topics, .foot-grid { grid-template-columns: 1fr; }
  .featured__body { padding: 26px; }
  .search-form { flex-direction: column; }
  .btn { width: 100%; }
  .btn--sm, .nav .btn { width: auto; }
  .author { grid-template-columns: 1fr; }
  .wa-float span { display: none; }
  .wa-float { padding: 0 15px; }
  .nav__logo span { display: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .btn { transition: none; } }
