/* Estructura y estilos. Los colores y fuentes vienen de theme.css (variables). */

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

html { color-scheme: dark; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.7 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { flex: 1; padding-block: clamp(2rem, 6vw, 4rem); }

a { color: var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; transition: color .15s; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
img { max-width: 100%; height: auto; }
::selection { background: var(--accent-soft); }

.container { width: min(100% - 2.5rem, var(--content-width)); margin-inline: auto; }

/* ---------- Cabecera y pie ---------- */
.site-header { border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-block: 1.1rem; }
.brand { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; color: var(--text); text-decoration: none; }
.nav { display: flex; gap: 1.4rem; font: 0.9375rem var(--font-ui); }
.nav a { color: var(--text-muted); text-decoration: none; padding-block: 0.25rem; border-bottom: 1px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.site-footer { border-top: 1px solid var(--border); padding-block: 1.5rem; font: 0.875rem var(--font-ui); color: var(--text-muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ---------- Encabezados de página ---------- */
.page-head { margin-bottom: 2rem; }
.page-head h1, .author-head h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.lead { margin: 0; color: var(--text-muted); font-size: 1.125rem; }
.empty { color: var(--text-muted); }

/* ---------- Etiquetas ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; list-style: none; margin: 0; padding: 0; font: 0.875rem var(--font-ui); }
.tags a { color: var(--text-muted); text-decoration: none; }
.tags a:hover { color: var(--accent); }
.tags .count { opacity: 0.6; }
.tag-filter { margin-bottom: 2.5rem; }

/* ---------- Lista de entradas ---------- */
.entry { display: grid; gap: 0.3rem 1.5rem; padding-block: 1.6rem; border-top: 1px solid var(--border); }
.entry:last-child { border-bottom: 1px solid var(--border); }
.entry-date { font: 0.875rem var(--font-ui); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.entry-title { margin: 0; font-size: 1.5rem; line-height: 1.25; letter-spacing: -0.01em; }
.entry-title a { color: var(--text); text-decoration: none; }
.entry-title a:hover { color: var(--accent); }
.entry-summary { margin: 0.45rem 0 0.8rem; color: var(--text-muted); }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 1.1rem; font: 0.875rem var(--font-ui); color: var(--text-muted); }
.author-link { color: var(--text); text-decoration: none; font-weight: 600; }
.author-link:hover { color: var(--accent); }

@media (min-width: 40rem) {
  .entry { grid-template-columns: 6rem minmax(0, 1fr); }
  .entry-date { padding-top: 0.5rem; }
}

/* ---------- Entrada (página de lectura) ---------- */
.post-head { margin-bottom: 2.25rem; }
.post-head h1 { margin: 0 0 1rem; font-size: clamp(2rem, 6.5vw, 3rem); line-height: 1.12; letter-spacing: -0.025em; }
.meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0; font: 0.9375rem var(--font-ui); color: var(--text-muted); }
.meta a { color: var(--text); font-weight: 600; text-decoration: none; }
.meta a:hover { color: var(--accent); }

.post-foot { display: grid; gap: 1.5rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }

/* ---------- Texto del markdown ---------- */
.prose { font-size: 1.125rem; line-height: 1.75; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table { margin: 0 0 1.25em; }
.prose h2, .prose h3, .prose h4 { line-height: 1.25; letter-spacing: -0.01em; margin: 2.2em 0 0.6em; }
.prose h2 { font-size: 1.65rem; }
.prose h3 { font-size: 1.3rem; }
.prose h4 { font-size: 1.1rem; }
.prose a { text-decoration: underline; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.3em 0; }
.prose li::marker { color: var(--text-muted); }
.prose blockquote { margin-inline: 0; padding: 0.1em 0 0.1em 1.25em; border-left: 2px solid var(--accent); color: var(--text-muted); font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.prose img { display: block; margin: 1.75rem auto; border-radius: var(--radius); }

.prose table { display: block; overflow-x: auto; border-collapse: collapse; font: 0.9375rem/1.5 var(--font-ui); }
.prose th, .prose td { padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--border); text-align: left; }
.prose th { color: var(--text-muted); font-weight: 600; border-bottom-color: var(--text-muted); }

/* ---------- Código ---------- */
.prose code { font-family: var(--font-mono); font-size: 0.85em; }
.prose :not(pre) > code { background: var(--code-bg); border: 1px solid var(--border); border-radius: 4px; padding: 0.1em 0.35em; }
.codehilite { margin: 1.5rem 0; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.codehilite pre { margin: 0; padding: 1rem 1.15rem; font: 0.875rem/1.65 var(--font-mono); tab-size: 4; }
.codehilite code { font: inherit; }

/* Colores de sintaxis (Pygments). Se cambian en theme.css */
.codehilite [class^="k"] { color: var(--syn-keyword); }
.codehilite [class^="s"] { color: var(--syn-string); }
.codehilite [class^="c"] { color: var(--syn-comment); font-style: italic; }
.codehilite [class^="m"], .codehilite .il { color: var(--syn-number); }
.codehilite .nf, .codehilite .fm, .codehilite .nc, .codehilite .nn,
.codehilite .nd, .codehilite .nb, .codehilite .bp,
.codehilite .nt, .codehilite .na { color: var(--syn-function); }

/* ---------- Autores ---------- */
.avatar {
  flex: none; display: inline-grid; place-items: center; overflow: hidden;
  width: 3rem; height: 3rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font: 700 1.2rem var(--font-ui);
}
.avatar-lg { width: 5rem; height: 5rem; font-size: 2rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.who { min-width: 0; }
.author-name { font-weight: 700; }
.who small { display: block; color: var(--text-muted); font: 0.9rem/1.45 var(--font-ui); }

.author-box, .author-row { display: flex; align-items: center; gap: 1rem; color: var(--text); text-decoration: none; }
.author-box:hover .author-name, .author-row:hover .author-name { color: var(--accent); }

.author-list { border-bottom: 1px solid var(--border); }
.author-row { padding-block: 1.4rem; border-top: 1px solid var(--border); }
.author-row .count { margin-left: auto; padding-left: 1rem; font: 0.875rem var(--font-ui); color: var(--text-muted); white-space: nowrap; }

.author-head { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 2rem; }
.author-head > div { min-width: 0; }
.links { display: flex; flex-wrap: wrap; gap: 0.3rem 1.25rem; list-style: none; margin: 0.75rem 0 0; padding: 0; font: 0.9375rem var(--font-ui); }
.count-line { margin: 0 0 0.75rem; font: 0.875rem var(--font-ui); color: var(--text-muted); }

/* ---------- Móvil ---------- */
@media (max-width: 30rem) {
  body { font-size: 1rem; }
  .prose { font-size: 1.0625rem; }
  .entry-title { font-size: 1.3rem; }
  .author-head { gap: 1rem; }
  .avatar-lg { width: 4rem; height: 4rem; font-size: 1.6rem; }
  .author-row .count { display: none; }
}

@media (prefers-reduced-motion: reduce) { a { transition: none; } }
