/* ============================================================
   RedLocal Blog — mismo lenguaje visual que www.redlocal.cl
   Variables calcadas de landing/styles.css
   ============================================================ */

:root {
  --paper: #fbfaf7;
  --paper-2: #f3f1ea;
  --paper-3: #ece9e0;
  --ink: #17161b;
  --ink-soft: #56535e;
  --ink-faint: #8a8790;
  --line: #e3dfd4;
  --line-strong: #cfc9ba;

  --signal: #e21d2d;
  --signal-strong: #c00f1e;
  --signal-wash: #fdecec;

  --structure: #1e4f9c;
  --structure-strong: #163b74;
  --structure-wash: #eaf1fb;

  --ok: #1b7a4b;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --maxw: 74rem;
  --header-h: 68px;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 1.25rem; }
.narrow { max-width: 46rem; }

/* ---------- Botones ---------- */
.btn {
  --btn-bg: var(--paper);
  --btn-fg: var(--ink);
  --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-sans); font-weight: 500; font-size: .95rem;
  padding: .7rem 1.15rem; border-radius: var(--radius);
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bd);
  cursor: pointer; transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { --btn-bg: var(--signal); --btn-fg: #fff; --btn-bd: var(--signal); }
.btn--primary:hover { --btn-bg: var(--signal-strong); --btn-bd: var(--signal-strong); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: var(--line-strong); }
.btn--ghost:hover { --btn-bd: var(--ink-faint); }
.btn--sm { padding: .55rem .9rem; font-size: .85rem; }

/* ---------- Tipografía utilitaria ---------- */
.kicker {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--signal);
}
.meta { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.meta a:hover { color: var(--ink); }
.section-title { font-size: clamp(1.7rem, 4vw, 2.5rem); max-width: 24ch; }
.section-lead { margin-top: 1rem; max-width: 60ch; color: var(--ink-soft); font-size: 1.08rem; }

/* ---------- Header (calcado de la landing) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.brand-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--signal); box-shadow: 0 0 0 4px var(--signal-wash); }
.brand-red { color: var(--ink); }
.brand-blue { color: var(--structure); }
.nav-links { display: none; gap: 1.5rem; font-size: .95rem; color: var(--ink-soft); }
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--ink); }
.nav-actions { display: flex; align-items: center; gap: .6rem; }
.nav-actions .btn--sm { display: none; }
.nav-toggle {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 42px; height: 40px; padding: 0 10px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: var(--paper); cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.mobile-menu { display: flex; flex-direction: column; gap: .25rem; padding: .5rem 1.25rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--paper); }
.mobile-menu a:not(.btn) { padding: .7rem .25rem; color: var(--ink-soft); border-bottom: 1px solid var(--line); }
.mobile-menu a:not(.btn):hover { color: var(--ink); }
.mobile-menu .btn { margin-top: .75rem; }

@media (min-width: 900px) {
  .nav-links { display: flex; }
  .nav-actions .btn--sm { display: inline-flex; }
  .nav-toggle { display: none; }
  .mobile-menu { display: none !important; }
}

/* ---------- Portada / listados ---------- */
.page-head { padding: clamp(2.5rem, 6vw, 4rem) 0 0; }
.page-head .section-title { margin-top: .5rem; }
.section { padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(3rem, 7vw, 5rem); }

.grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.grid-3 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: 1fr 1fr 1fr; } }

.card { background: var(--paper); }
.post-card { display: flex; flex-direction: column; }
.post-card-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--paper-2); }
.post-card-body { padding: 1.5rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.post-card-tag { color: var(--signal); }
.post-card-tag:hover { color: var(--signal-strong); }
.post-card-title { font-size: 1.12rem; line-height: 1.3; }
.post-card-title a:hover { color: var(--structure); }
.post-card-excerpt { color: var(--ink-soft); font-size: .96rem; }

/* ---------- Paginación ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2rem; }
.pagination-prev, .pagination-next { min-width: 8rem; }
.pagination-next { text-align: right; }

/* ---------- Artículo ---------- */
.article { padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(3rem, 7vw, 5rem); }
.article-header .meta a { color: var(--signal); }
.article-title { margin-top: .8rem; font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.08; }
.article-lead { margin-top: 1.2rem; font-size: 1.15rem; color: var(--ink-soft); max-width: 60ch; }
.article-image { margin: 2.5rem auto 0; }
.article-image img { border-radius: var(--radius-lg); border: 1px solid var(--line); }
.article-image figcaption { margin-top: .6rem; font-size: .85rem; color: var(--ink-faint); text-align: center; }
.article-content { margin-top: 2.5rem; }
.article-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); display: grid; gap: 1.25rem; }
.article-footer .meta a { color: var(--structure); }

/* ---------- Contenido Ghost (gh-content) ---------- */
.gh-content { font-size: 1.05rem; }
.gh-content > * + * { margin-top: 1.2rem; }
.gh-content h2 { margin-top: 2.4rem; font-size: 1.6rem; }
.gh-content h3 { margin-top: 2rem; font-size: 1.25rem; }
.gh-content a { color: var(--structure); border-bottom: 1px solid var(--structure-wash); }
.gh-content a:hover { border-color: var(--structure); }
.gh-content strong { font-weight: 600; }
.gh-content ul, .gh-content ol { padding-left: 1.4rem; }
.gh-content li + li { margin-top: .4rem; }
.gh-content blockquote {
  margin: 1.6rem 0; padding: .4rem 0 .4rem 1.2rem;
  border-left: 3px solid var(--signal); color: var(--ink-soft);
  font-family: var(--font-display); font-size: 1.15rem;
}
.gh-content hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
.gh-content img { border-radius: var(--radius); }
.gh-content figcaption { margin-top: .6rem; font-size: .85rem; color: var(--ink-faint); text-align: center; }
.gh-content code {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .1em .35em;
}
.gh-content pre {
  background: var(--ink); color: var(--paper);
  border-radius: var(--radius); padding: 1.1rem 1.3rem; overflow-x: auto;
}
.gh-content pre code { background: transparent; border: 0; padding: 0; color: inherit; }

/* Imágenes anchas del editor */
.kg-width-wide { position: relative; width: min(85vw, calc(var(--maxw) - 2.5rem)); margin-left: 50%; transform: translateX(-50%); }
.kg-width-full { position: relative; width: 100vw; margin-left: 50%; transform: translateX(-50%); }
.kg-width-full img { border-radius: 0; }

/* Bookmark cards (enlaces a fuentes) */
.kg-bookmark-card { width: 100%; }
.kg-bookmark-container {
  display: flex; flex-direction: row-reverse; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  color: var(--ink);
}
.kg-bookmark-content { flex-grow: 1; padding: 1rem 1.2rem; }
.kg-bookmark-title { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.kg-bookmark-description { margin-top: .3rem; font-size: .88rem; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kg-bookmark-metadata { margin-top: .6rem; font-size: .8rem; color: var(--ink-faint); display: flex; align-items: center; gap: .5rem; }
.kg-bookmark-icon { width: 16px; height: 16px; }
.kg-bookmark-thumbnail { flex-shrink: 0; max-width: 200px; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.kg-bookmark-author, .kg-bookmark-publisher { display: inline; }

/* ---------- Footer (calcado de la landing) ---------- */
.site-footer { margin-top: 0; background: var(--paper-2); border-top: 1px solid var(--line); }
.footer-grid { display: grid; gap: 2.5rem; padding: 3.5rem 1.25rem; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; padding-inline: 2rem; } }
.footer-tag { margin-top: 1rem; color: var(--ink-soft); font-size: .92rem; max-width: 34ch; }
.footer-h { margin-bottom: .9rem; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; font-size: .92rem; }
.footer-links a { color: var(--ink-soft); }
.footer-links a:hover { color: var(--ink); }
.footer-base { border-top: 1px solid var(--line); }
.footer-base-row { display: flex; flex-direction: column; gap: .4rem; padding: 1.5rem 1.25rem; font-size: .78rem; color: var(--ink-faint); }
@media (min-width: 640px) { .footer-base-row { flex-direction: row; align-items: center; justify-content: space-between; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
