/* ==================================================================
   Blog personal — hoja de estilos publica
   Tema oscuro por defecto, claro si el sistema lo pide.
   ================================================================== */

:root {
  --bg:        #0d0f13;
  --bg-soft:   #14171d;
  --bg-card:   #12151b;
  --border:    #232832;
  --border-sf: #1b1f27;
  --text:      #e6e9ef;
  --text-soft: #a3abb9;
  --text-dim:  #6f7885;
  --accent:    #4fd1c5;
  --accent-2:  #7c9cff;
  --code-bg:   #0a0c10;
  --radius:    14px;
  --radius-sm: 8px;
  --maxw:      1120px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:        #fbfbfc;
    --bg-soft:   #f2f3f6;
    --bg-card:   #ffffff;
    --border:    #e2e5ea;
    --border-sf: #ecedf1;
    --text:      #15181d;
    --text-soft: #4d5665;
    --text-dim:  #7d8695;
    --accent:    #0d9488;
    --accent-2:  #3b5bdb;
    --code-bg:   #14171d;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

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

main { flex: 1 0 auto; padding-bottom: 72px; }

/* ---------------------------- cabecera ---------------------------- */

.site-header {
  border-bottom: 1px solid var(--border-sf);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { text-decoration: none; }

.brand-mark {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 9px;
  font-size: 15px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; letter-spacing: -0.01em; }
.brand-text small { color: var(--text-dim); font-size: 12.5px; font-family: var(--font-mono); }

.site-nav { display: flex; gap: 22px; font-size: 14.5px; }
.site-nav a { color: var(--text-soft); }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a.active { color: var(--accent); }

/* ------------------------------ hero ------------------------------ */

.hero { padding: 72px 0 44px; max-width: 760px; }
.page-head { padding: 52px 0 32px; }

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  margin: 0 0 14px;
  letter-spacing: 0.04em;
}

.hero-title {
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  font-weight: 700;
}

.hero-text { color: var(--text-soft); font-size: 18px; margin: 0; }

.page-title {
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.025em;
  margin: 0 0 8px;
}

.page-sub { color: var(--text-dim); margin: 0; font-size: 15px; }

/* ---------------------------- estructura --------------------------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 48px;
  align-items: start;
  padding-top: 8px;
}

@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; gap: 40px; }
}

/* ---------------------------- tarjetas ----------------------------- */

.card {
  border: 1px solid var(--border-sf);
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 20px;
  transition: border-color .18s ease, transform .18s ease;
}

.card:hover { border-color: var(--border); transform: translateY(-2px); }

.card-meta, .post-meta {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dot { opacity: .5; }

.card-title { margin: 12px 0 10px; font-size: 23px; line-height: 1.25; letter-spacing: -0.02em; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); text-decoration: none; }

.card-excerpt { margin: 0 0 18px; color: var(--text-soft); font-size: 16px; }

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.readmore { font-size: 14px; font-family: var(--font-mono); white-space: nowrap; }

/* ----------------------------- etiquetas --------------------------- */

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags.inline { display: inline-flex; }

.tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-soft);
  background: var(--bg-soft);
  border: 1px solid var(--border-sf);
  border-radius: 999px;
  padding: 3px 11px;
}

.tag:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.tag-active { color: var(--accent); border-color: var(--accent); }
.tag-count { opacity: .55; margin-left: 3px; }

/* ------------------------------ lateral ---------------------------- */

.sidebar { display: flex; flex-direction: column; gap: 22px; position: sticky; top: 100px; }

@media (max-width: 880px) { .sidebar { position: static; } }

.side-box {
  border: 1px solid var(--border-sf);
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
}

.side-box h3 {
  margin: 0 0 14px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 600;
}

.side-text { margin: 0 0 12px; font-size: 14.5px; color: var(--text-soft); }
.side-link { font-size: 14px; font-family: var(--font-mono); }

.search { display: flex; gap: 8px; }

.search input {
  flex: 1;
  min-width: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
}

.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.search button {
  background: var(--accent);
  color: #06201d;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
}

.search button:hover { filter: brightness(1.08); }

/* ------------------------------ entrada ---------------------------- */

.post { max-width: 760px; margin: 0 auto; padding-top: 44px; }
.post.narrow { max-width: 720px; }

.back { font-family: var(--font-mono); font-size: 13.5px; color: var(--text-dim); }
.back:hover { color: var(--accent); text-decoration: none; }

.post-title {
  font-size: clamp(30px, 4.6vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 20px 0 16px;
}

.post-cover { border-radius: var(--radius); margin-top: 28px; border: 1px solid var(--border-sf); }

/* --------------------------- texto largo --------------------------- */

.prose { margin-top: 34px; font-size: 17.5px; }

.prose > *:first-child { margin-top: 0; }

.prose h2 {
  font-size: 26px;
  letter-spacing: -0.02em;
  margin: 46px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-sf);
}

.prose h3 { font-size: 20px; margin: 34px 0 12px; letter-spacing: -0.01em; }
.prose h4 { font-size: 17px; margin: 26px 0 10px; color: var(--text-soft); }

.prose p { margin: 0 0 20px; }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 24px; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--accent); }

.prose blockquote {
  margin: 26px 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
  font-style: italic;
}

.prose hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }

.prose img { border-radius: var(--radius); border: 1px solid var(--border-sf); margin: 10px 0; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 24px;
  font-size: 15px;
  display: block;
  overflow-x: auto;
}

.prose th, .prose td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; }
.prose th { background: var(--bg-soft); font-family: var(--font-mono); font-size: 13px; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-soft);
  border: 1px solid var(--border-sf);
  border-radius: 5px;
  padding: 1px 5px;
}

.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.6;
}

.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; color: #e6e9ef; }

/* Coloreado de sintaxis (highlight.js), tonos sobrios */
.hljs-comment, .hljs-quote          { color: #6b7280; font-style: italic; }
.hljs-keyword, .hljs-selector-tag   { color: #c792ea; }
.hljs-string, .hljs-attr            { color: #9fd67a; }
.hljs-number, .hljs-literal         { color: #f78c6c; }
.hljs-title, .hljs-name,
.hljs-title.function_               { color: #82aaff; }
.hljs-built_in, .hljs-type          { color: #4fd1c5; }
.hljs-variable, .hljs-template-variable { color: #e6e9ef; }
.hljs-meta, .hljs-symbol            { color: #7c9cff; }
.hljs-deletion                      { color: #ff6b6b; }
.hljs-addition                      { color: #9fd67a; }

/* ------------------------- pie de la entrada ----------------------- */

.post-foot { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--border-sf); }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.post-nav-item {
  border: 1px solid var(--border-sf);
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text);
}

.post-nav-item:hover { border-color: var(--accent); text-decoration: none; }
.post-nav-item span { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.post-nav-item strong { font-size: 15px; font-weight: 600; line-height: 1.35; }
.post-nav-item.align-right { text-align: right; }

@media (max-width: 620px) {
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-item.align-right { text-align: left; }
}

.related { margin-top: 40px; }
.related h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); font-family: var(--font-mono); margin-bottom: 14px; }
.related ul { list-style: none; margin: 0; padding: 0; }
.related li { padding: 11px 0; border-bottom: 1px solid var(--border-sf); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.related-meta { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }

.contact-box {
  margin-top: 44px;
  padding: 22px 24px;
  border: 1px solid var(--border-sf);
  background: var(--bg-card);
  border-radius: var(--radius);
}

.contact-box h3 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); font-family: var(--font-mono); }

/* ---------------------------- paginacion --------------------------- */

.pager { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 34px; }
.pager-info { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); }

.pager-btn {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 14px;
  color: var(--text-soft);
  background: var(--bg-card);
}

.pager-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ------------------------------ varios ----------------------------- */

.empty, .notfound {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 28px;
  color: var(--text-soft);
  text-align: center;
}

.notfound { border: 0; text-align: left; padding: 80px 0; }
.notfound .pager-btn { margin-top: 18px; }

/* ------------------------------- pie ------------------------------- */

.site-footer { border-top: 1px solid var(--border-sf); padding: 34px 0; flex-shrink: 0; }

.footer-inner { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }

.footer-note { margin: 0; color: var(--text-soft); font-size: 14.5px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; font-size: 14px; font-family: var(--font-mono); }
.footer-copy { margin: 0; color: var(--text-dim); font-size: 13px; font-family: var(--font-mono); }

::selection { background: var(--accent); color: #06201d; }
