:root {
  --bg: #080c10; --bg2: #0d1117; --card: #0f1923; --hover: #162030;
  --text: #e2e8f0; --text2: #94a3b8; --muted: #64748b;
  --border: #1e2d3d; --border2: #2d4a5e;
  --blue: #38bdf8; --green: #06d6a0; --gold: #f59e0b;
  --display: 'Playfair Display', Georgia, serif;
  --body: 'DM Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
[data-theme='light'] {
  --bg: #ffffff; --bg2: #f8fafc; --card: #ffffff; --hover: #f1f5f9;
  --text: #0f172a; --text2: #475569; --muted: #64748b;
  --border: #e2e8f0; --border2: #cbd5e1; --blue: #0284c7; --green: #059669;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--body); line-height: 1.65; -webkit-font-smoothing: antialiased; transition: background-color .25s, color .25s; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 50; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--text2); } .small { font-size: .8rem; display: block; } .mono { font-family: var(--mono); font-size: .85rem; }

.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.15rem; color: var(--text); margin-right: auto; }
.brand:hover { text-decoration: none; color: var(--blue); }
.nav { display: flex; gap: 4px 16px; flex-wrap: wrap; font-size: .9rem; }
.nav a { color: var(--text2); padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current] { color: var(--text); text-decoration: none; border-color: var(--blue); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--border2); background: var(--card); color: var(--text2); cursor: pointer; font-size: 1rem; transition: border-color .2s, color .2s; }
.icon-btn:hover { border-color: var(--blue); color: var(--blue); }
.i-moon { display: none; } [data-theme='light'] .i-sun { display: none; } [data-theme='light'] .i-moon { display: block; }

.layout { max-width: 1120px; margin: 0 auto; padding: 32px 20px 64px; display: grid; gap: 32px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr) 300px; } }

.carousel { position: relative; margin-bottom: 28px; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: linear-gradient(135deg, rgba(56,189,248,.12), rgba(6,214,160,.06)), var(--card); }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: start; display: flex; flex-direction: column; justify-content: center; gap: 8px; min-height: 220px; padding: 32px 28px 56px; color: var(--text); }
.slide:hover { text-decoration: none; }
.slide-kicker { font-family: var(--mono); font-size: .75rem; color: var(--green); }
.slide-title { font-family: var(--display); font-size: clamp(1.4rem, 3.6vw, 2rem); font-weight: 700; line-height: 1.2; }
.slide-desc { color: var(--text2); max-width: 60ch; }
.carousel-ctl { position: absolute; right: 14px; bottom: 12px; display: flex; gap: 8px; }

.cards { display: grid; gap: 16px; }
.card { display: grid; background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; transition: border-color .2s; }
.card:hover { border-color: var(--blue); }
.card-thumb img { width: 100%; height: 180px; object-fit: cover; display: block; }
.card-body { padding: 20px 22px; }
.card-title { font-family: var(--display); font-size: 1.35rem; line-height: 1.25; }
.card-title a { color: var(--text); } .card-title a:hover { color: var(--blue); text-decoration: none; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 10px; font-size: .82rem; color: var(--text2); font-family: var(--mono); }
.badge { color: var(--gold); border: 1px solid var(--gold); border-radius: 999px; padding: 0 8px; }
.chips, .inline { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin-bottom: 10px; }
.chip { display: inline-flex; gap: 6px; align-items: center; font-size: .75rem; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border2); color: var(--text2); background: var(--bg2); }
.chip:hover { text-decoration: none; border-color: var(--blue); color: var(--blue); }
.chip-cat { border-color: color-mix(in srgb, var(--blue) 45%, transparent); color: var(--blue); }
.chip span { color: var(--muted); }
.card-desc { color: var(--text2); margin-bottom: 12px; }
.more { font-size: .85rem; border: 1px solid var(--blue); border-radius: 8px; padding: 4px 12px; display: inline-block; }
.more:hover { background: color-mix(in srgb, var(--blue) 14%, transparent); text-decoration: none; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 28px; font-size: .9rem; }

.page-head { margin-bottom: 20px; }
.page-head h1 { font-family: var(--display); font-size: clamp(1.8rem, 4.4vw, 2.6rem); line-height: 1.15; }
.lead { color: var(--text2); font-size: 1.1rem; margin-top: 10px; max-width: 62ch; }
.empty { color: var(--text2); border: 1px dashed var(--border2); border-radius: 12px; padding: 28px; text-align: center; }

.prose { max-width: 72ch; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-family: var(--display); font-size: 1.5rem; margin-top: 2em; }
.prose h3 { font-family: var(--display); font-size: 1.2rem; margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.4em; } .prose li + li { margin-top: .3em; }
.prose blockquote { border-left: 3px solid var(--blue); padding: 2px 16px; color: var(--text2); }
.prose img { max-width: 100%; height: auto; border-radius: 10px; }
.prose :not(pre) > code { font-family: var(--mono); font-size: .88em; background: var(--hover); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.prose pre { font-family: var(--mono); font-size: .85rem; line-height: 1.55; padding: 16px 18px; border-radius: 12px; overflow-x: auto; border: 1px solid var(--border); }
.prose pre code { background: none; border: 0; padding: 0; }
.prose table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 12px; text-align: left; }
.toc { max-width: 72ch; margin-bottom: 24px; } .toc summary { cursor: pointer; font-weight: 600; }
.toc ul { list-style: none; padding-left: 14px; margin-top: 6px; } .toc a { color: var(--text2); font-size: .9rem; }

.sidebar { display: grid; gap: 16px; align-content: start; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.panel-title { font-family: var(--display); font-size: 1rem; margin-bottom: 10px; }
.profile { text-align: center; } .avatar { border-radius: 50%; border: 2px solid var(--green); margin-bottom: 10px; object-fit: cover; }
.profile .muted { font-size: .88rem; } .loc { margin-top: 6px; }
.links { display: flex; justify-content: center; gap: 14px; margin-top: 12px; font-size: .85rem; }
.plain { list-style: none; } .plain li + li { margin-top: 10px; } .plain a { color: var(--text); } .plain a:hover { color: var(--blue); }
.plain.inline li + li { margin-top: 0; } .plain.inline a { color: var(--text2); }
.terms { gap: 10px; }

.archive-year h2 { font-family: var(--display); margin: 20px 0 8px; }
.search { width: 100%; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border2); background: var(--card); color: var(--text); font: inherit; }
.results { margin-top: 20px; } .results li { border-bottom: 1px solid var(--border); padding-bottom: 12px; }

.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: .85rem; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---- Paletas, tamaño de fuente y cabecera ampliada ---- */
html[data-fs='xs'] { font-size: 87.5%; } html[data-fs='sm'] { font-size: 93.75%; }
html[data-fs='md'] { font-size: 100%; } html[data-fs='lg'] { font-size: 112.5%; } html[data-fs='xl'] { font-size: 125%; }
:root { --accent: #38bdf8; --blue: var(--accent); }
[data-theme='light'] { --blue: color-mix(in srgb, var(--accent) 62%, #000); }
[data-palette='blue'] { --accent: #38bdf8; } [data-palette='bluegray'] { --accent: #90a4ae; }
[data-palette='brown'] { --accent: #bcaaa4; } [data-palette='cyan'] { --accent: #22d3ee; }
[data-palette='green'] { --accent: #4ade80; } [data-palette='indigo'] { --accent: #818cf8; }
[data-palette='orange'] { --accent: #fb923c; } [data-palette='pink'] { --accent: #f472b6; }
[data-palette='purple'] { --accent: #c084fc; } [data-palette='red'] { --accent: #f87171; }
[data-palette='teal'] { --accent: #2dd4bf; } [data-palette='yellow'] { --accent: #facc15; }
.pal-dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); }
.pal-blue .pal-dot { background: #38bdf8; } .pal-bluegray .pal-dot { background: #90a4ae; } .pal-brown .pal-dot { background: #bcaaa4; }
.pal-cyan .pal-dot { background: #22d3ee; } .pal-green .pal-dot { background: #4ade80; } .pal-indigo .pal-dot { background: #818cf8; }
.pal-orange .pal-dot { background: #fb923c; } .pal-pink .pal-dot { background: #f472b6; } .pal-purple .pal-dot { background: #c084fc; }
.pal-red .pal-dot { background: #f87171; } .pal-teal .pal-dot { background: #2dd4bf; } .pal-yellow .pal-dot { background: #facc15; }

.loading-bar { position: absolute; left: 0; top: 0; height: 3px; width: 0; background: var(--blue); opacity: 0; transition: width .4s ease, opacity .3s; }
.loading-bar.on { opacity: 1; }
.bar { display: flex; align-items: center; gap: 14px; min-height: 60px; padding-top: 8px; padding-bottom: 8px; }
.search-bar { margin-left: auto; flex: 0 1 240px; min-width: 120px; }
.search-bar input { width: 100%; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border2); background: var(--card); color: var(--text); font: inherit; font-size: .88rem; }
.tools { display: flex; align-items: center; gap: 6px; }
.socials { display: flex; gap: 6px; }
.fs-btn { font-size: .78rem; font-weight: 600; }
.nav { padding-top: 0; padding-bottom: 10px; }
.nav-toggle { display: none; }
@media (max-width: 899px) {
  .bar { flex-wrap: wrap; }
  .search-bar { order: 5; flex: 1 1 100%; margin-left: 0; }
  .brand { margin-right: auto; }
  .socials { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav { display: none; flex-direction: column; gap: 2px; padding-bottom: 12px; }
  .nav.open { display: flex; }
}
.dd { position: relative; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 170px; background: var(--card); border: 1px solid var(--border2); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgba(0,0,0,.35); display: grid; gap: 2px; }
.dd-menu[hidden] { display: none; }
.dd-menu a, .dd-menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: .88rem; cursor: pointer; }
.dd-menu a:hover, .dd-menu button:hover { background: var(--hover); text-decoration: none; }
.dd-menu .active, .dd-menu [aria-current='true'], .dd-menu .is-active { color: var(--blue); font-weight: 600; }
.pal-menu { grid-template-columns: 1fr 1fr; min-width: 270px; }
@media (max-width: 899px) {
  .dd { position: static; }
  .dd-menu, .pal-menu { left: 12px; right: 12px; top: calc(100% + 4px); min-width: 0; max-height: 70vh; overflow-y: auto; }
}

/* tarjetas y chips */
.card.has-thumb { grid-template-columns: 1fr; }
@media (min-width: 640px) { .card.has-thumb { grid-template-columns: 200px 1fr; } .card-thumb img { height: 100%; min-height: 160px; } }
.chip-tag::before { content: '#'; color: var(--muted); }
.chip-cat::before { content: ''; width: 10px; height: 8px; border-radius: 2px; background: currentColor; opacity: .7; }

/* carrusel con imagen y puntos */
.slide.has-img { background-size: cover; background-position: center; position: relative; }
.slide.has-img::before { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.75), rgba(0,0,0,.25)); }
.slide-inner { position: relative; display: flex; flex-direction: column; gap: 8px; }
.slide.has-img .slide-title, .slide.has-img .slide-desc { color: #fff; }
.dots { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 8px; pointer-events: none; }
.dot { pointer-events: auto; width: 10px; height: 10px; border-radius: 50%; border: 0; background: rgba(255,255,255,.4); cursor: pointer; padding: 0; }
.dot.on { background: var(--blue); }
.carousel-ctl { bottom: 8px; }

/* paginación */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 28px; }
.pagination a, .pagination span { min-width: 36px; padding: 6px 12px; text-align: center; border: 1px solid var(--border2); border-radius: 8px; font-size: .88rem; color: var(--text2); }
.pagination a:hover { text-decoration: none; border-color: var(--blue); color: var(--blue); }
.pagination .current { background: var(--blue); border-color: var(--blue); color: var(--bg); font-weight: 600; }
.pagination [aria-disabled] { opacity: .45; }

/* breadcrumb, compartir, licencia */
.breadcrumb { margin-bottom: 14px; font-size: .85rem; }
.breadcrumb ol { display: flex; flex-wrap: wrap; list-style: none; gap: 4px 0; }
.breadcrumb li + li::before { content: '/'; margin: 0 8px; color: var(--muted); }
.breadcrumb [aria-current] { color: var(--text2); }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 32px; }
button.chip { cursor: pointer; font: inherit; font-size: .75rem; }
.license { margin-top: 14px; font-size: .82rem; }
.pager a { max-width: 48%; }

/* barra lateral con pestañas */
.acc { background: var(--card); border: 1px solid var(--border); border-radius: 14px; }
.acc > summary { cursor: pointer; padding: 14px 18px; font-family: var(--display); font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.acc > summary::after { content: '+'; color: var(--muted); } .acc[open] > summary::after { content: '–'; }
.acc > summary::-webkit-details-marker { display: none; }
.acc-body { padding: 0 18px 18px; }
.tablist { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.tablist button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 10px; color: var(--text2); font: inherit; font-size: .85rem; cursor: pointer; }
.tablist button[aria-selected='true'] { color: var(--blue); border-color: var(--blue); }
[role='tabpanel'][hidden] { display: none; }

/* acciones flotantes */
.fab { position: fixed; right: 18px; bottom: 18px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.fab-toggle { width: 46px; height: 46px; color: var(--blue); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.fab-panel { display: grid; gap: 2px; background: var(--card); border: 1px solid var(--border2); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgba(0,0,0,.35); }
.fab-panel[hidden] { display: none; }
.fab-panel button { background: none; border: 0; border-radius: 8px; padding: 8px 14px; color: var(--text); font: inherit; font-size: .88rem; text-align: left; cursor: pointer; }
.fab-panel button:hover { background: var(--hover); }
.fab-panel button[hidden] { display: none; }
.to-top { position: fixed; right: 18px; bottom: 76px; z-index: 40; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.to-top[hidden] { display: none; }
.snackbar { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 60; background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: .88rem; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.snackbar.show { opacity: 1; transform: translate(-50%, 0); }
.dialog { margin: auto; max-width: min(560px, 92vw); max-height: 80vh; overflow: auto; background: var(--card); color: var(--text); border: 1px solid var(--border2); border-radius: 14px; padding: 18px 22px; }
.dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dialog ul { list-style: none; padding-left: 14px; } .dialog a { color: var(--text2); }

/* botón de copiar código y visor de imágenes */
.code-wrap { position: relative; margin: 1em 0; }
.code-wrap pre { margin: 0; padding-top: 40px; }
.copy-btn { position: absolute; top: 8px; right: 8px; z-index: 1; padding: 3px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.35); color: #e2e8f0; font: inherit; font-size: .72rem; cursor: pointer; opacity: .85; transition: opacity .2s, background .2s; }
.code-wrap:hover .copy-btn, .copy-btn:hover, .copy-btn:focus-visible { opacity: 1; background: rgba(0,0,0,.6); }
@media (hover: none) { .copy-btn { opacity: 1; } }
.prose img { cursor: zoom-in; }
.viewer { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.viewer img { max-width: 100%; max-height: 100%; border-radius: 8px; cursor: zoom-out; }

.post-cover { margin: 0 0 22px; border-radius: 14px; overflow: hidden; }
.post-cover img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; }
.post-cover-crop img { aspect-ratio: 3 / 2; }
.card-thumb-crop img { height: auto; aspect-ratio: 3 / 2; }
@media (min-width: 640px) { .card-thumb-crop img { height: 100%; aspect-ratio: auto; } }
