/* Reset y base */
* { box-sizing: border-box; }
html { font-size: 16px; }
:root {
  --bg: #000000;
  --text: #ffffff;
  --muted: #cbd5e1;
  --border: #262626;
  --accent: #60a5fa;
  --accent-contrast: #0b1020;
  --card: #0a0a0a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --text: #ffffff;
    --muted: #cbd5e1;
    --border: #262626;
    --accent: #60a5fa;
    --accent-contrast: #0b1020;
    --card: #0a0a0a;
  }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; border-radius: 8px; }

/* Layout */
header { border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.6); position: sticky; top: 0; backdrop-filter: saturate(180%) blur(8px); height: auto; min-height: 0; }
.page-article header { backdrop-filter: none; background: transparent; height: auto; min-height: 0; overflow: visible; }
.page-article header::before { display: none !important; content: none !important; height: 0 !important; }
.page-article header .banner, .page-article header .banner-text { display: none !important; }
.page-article > header { position: sticky; top: 0; padding: 0 !important; margin: 0 !important; background: transparent !important; height: auto !important; min-height: 0 !important; }
.page-article main { max-width: 1200px; }
.page-article .topnav { max-width: 1200px; }
.page-article .article-layout, .page-article .article-layout * {
  filter: none !important;
  -webkit-filter: none !important;
  transform: none !important;
  opacity: 1 !important;
}
.topnav { max-width: 900px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.topnav a { color: var(--text); opacity: 0.9; }
.topnav a[href="/blog/"] { font-weight: 600; }
.nav-left, .nav-right { display: flex; gap: 16px; align-items: center; }
.nav-right a { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; color: #fff; opacity: 0.9; }
.nav-right a:hover { opacity: 1; background: rgba(255,255,255,0.08); }
.nav-right svg { display: block; width: 18px; height: 18px; fill: currentColor; }
main { max-width: 900px; margin: 0 auto; padding: 24px 20px 32px; width: 100%; }
body.page-books main { max-width: 1400px; }
body.page-article main { padding: 24px 20px 24px; }
body.page-article { padding-bottom: 0; min-height: 100vh; display: flex; flex-direction: column; }
footer { border-top: 1px solid var(--border); margin-top: 12px; padding: 6px 0 !important; margin-bottom: 0 !important; min-height: 0 !important; }
footer p { max-width: 900px; margin: 0 auto; padding: 4px 0 !important; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
.page-article main { flex: 1; }
.page-article footer { position: static; }

/* Hero */
.hero {
  position: relative;
  padding: 48px 0 24px;
  background: url('/images/header-background.jpg') center / cover no-repeat;
  border-bottom: 1px solid var(--border);
}
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.25)); }
.hero-inner { position: relative; max-width: 900px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 20px; }
.avatar { width: 112px; height: 112px; border-radius: 999px; border: 2px solid rgba(255,255,255,0.6); box-shadow: 0 8px 24px rgba(2,6,23,0.35); background: #fff; object-fit: cover; }
.intro h1 { margin: 0; font-size: 1rem; color: rgba(255,255,255,0.85); font-weight: 500; }
.intro-name { margin: 2px 0 6px; font-size: 2rem; letter-spacing: -0.02em; color: #fff; }
.intro-desc { margin: 0; color: rgba(255,255,255,0.85); max-width: 60ch; }
.section-title { margin: 8px 0 6px; font-weight: 700; color: var(--muted); font-size: 0.95rem; text-transform: none; }

/* Lista de posts */
#posts-list { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 16px; }
.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  align-items: start;
}
.post-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(2,6,23,0.08); border-color: rgba(37,99,235,0.35); }
.post-card h2 { margin: 0 0 6px; font-size: 1.25rem; letter-spacing: -0.01em; }
.post-card h2 a { color: var(--text); }
.post-card .meta { margin: 0 0 10px; color: var(--muted); font-size: 0.9rem; }
.post-card p { margin: 0 0 10px; }
.post-cover { width: 120px; height: 120px; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,0.02); grid-column: 1; }
.post-content { grid-column: 2; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: 0.8rem; color: var(--muted); border: 1px solid var(--border); padding: 3px 8px; border-radius: 999px; }

/* Artículo */
article h1 { font-size: 2rem; margin: 6px 0 8px; letter-spacing: -0.02em; }
article time { color: var(--muted); }
article p { margin: 0 0 14px; }
article pre, article code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
article pre { background: #0b1220; color: #e5e7eb; border-radius: 10px; padding: 14px; overflow: auto; }

/* Article layout with TOC */
.article-layout { display: grid; grid-template-columns: 1fr; gap: 28px; }
.article-main { min-width: 0; }
.article-aside { display: none; }
.article-meta { color: var(--muted); font-size: .95rem; display: flex; gap: 12px; align-items: center; margin: 4px 0 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { font-size: .8rem; padding: 4px 10px; border: 1px solid var(--border); color: var(--muted); border-radius: 999px; }
.toc { position: sticky; top: 72px; border-left: 1px dashed var(--border); padding-left: 16px; }
.toc h4 { margin: 0 0 8px; color: var(--muted); font-weight: 600; font-size: .95rem; }
.toc ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); text-decoration: underline; }

@media (min-width: 1024px) {
  .article-layout { grid-template-columns: minmax(0, 800px) 280px; }
  .article-aside { display: block; }
}

/* Libros */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 20px; margin-top: 10px; }
.book-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; transition: border-color .12s, box-shadow .12s, transform .12s; }
.book-card:hover { transform: translateY(-2px); border-color: rgba(96,165,250,.35); box-shadow: 0 6px 24px rgba(2,6,23,.18); }
.book-cover { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; }
.book-title { font-weight: 600; color: var(--text); }
.book-author { color: var(--muted); font-size: .9rem; }
.book-meta { color: var(--muted); font-size: .8rem; }
.rating { display: flex; align-items: center; gap: 6px; }
.rating .star { width: 16px; height: 16px; color: #555; fill: currentColor; }
.rating .star.filled { color: #facc15; }
.rating-label { color: var(--muted); font-size: .85rem; }

/* Responsivo */
@media (min-width: 720px) {
  .intro-name { font-size: 2.25rem; }
  .post-card h2 { font-size: 1.35rem; }
  .post-card { grid-template-columns: 160px 1fr; }
  .post-cover { width: 160px; height: 160px; }
}

/* Books intro single-line on desktop */
body.page-books .intro-text { max-width: none; }
@media (min-width: 1024px) {
  body.page-books .intro-text { white-space: nowrap; }
}

/* Pinturas */
.paintings-list { display: flex; flex-direction: column; gap: 16px; margin-top: 10px; }
.paint-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
.paint-card:hover { transform: translateY(-2px); border-color: rgba(96,165,250,.35); box-shadow: 0 6px 24px rgba(2,6,23,.18); }
.paint-left { float: left; width: 140px; }
.paint-cover { width: 140px; height: 140px; object-fit: cover; display: block; }
.paint-right { margin-left: 156px; padding: 12px 12px 12px 0; }
.paint-title { margin: 0 0 6px; font-size: 1.25rem; letter-spacing: -0.01em; }
.paint-meta { margin: 0 0 6px; color: var(--muted); font-size: .9rem; }
.paint-short { margin: 0 0 6px; }
.paint-divider { border: 0; border-top: 1px solid var(--border); margin: 10px 0; opacity: 0; transition: opacity .2s ease; }
.paint-body { max-height: 0; overflow: hidden; transition: max-height .25s ease, opacity .2s ease; opacity: 0; }
.paint-card.open .paint-body { max-height: 1000px; }
.paint-card.open .paint-body { opacity: 1; }
.paint-card.open .paint-divider { opacity: 1; }
.paint-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 10px; margin-top: 10px; }
.paint-figure { margin: 0; position: relative; overflow: hidden; border-radius: 8px; }
.paint-figure img, .paint-body img { display: block; width: 100%; height: auto; transform: scale(1); transition: transform .25s ease; }
.paint-figure:hover img, .paint-body img:hover { transform: scale(1.15); cursor: zoom-in; }

/* Lightbox for paintings */
.lightbox-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: none; align-items: center; justify-content: center; z-index: 1000; }
.lightbox-backdrop.open { display: flex; }
.lightbox-img { max-width: 92vw; max-height: 92vh; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
.lightbox-close { position: fixed; top: 14px; right: 18px; color: #fff; font-size: 28px; line-height: 1; cursor: pointer; opacity: .85; }
.lightbox-close:hover { opacity: 1; }

@media (max-width: 640px) {
  .paint-left { float: none; width: 100%; }
  .paint-cover { width: 100%; height: auto; }
  .paint-right { margin: 0; padding: 12px; }
}
