/* Robert's World — estilos. Cambia --accent para cambiar el color principal. */
:root {
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #18181b;
  --muted: #71717a;
  --border: #e4e4e7;
  --code-bg: #f4f4f5;
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --accent: #818cf8;
  --accent-soft: #1e1b4b;
  --bg: #0b0b0f;
  --surface: #15151b;
  --text: #ececf1;
  --muted: #9a9aa6;
  --border: #26262f;
  --code-bg: #1b1b23;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #818cf8;
    --accent-soft: #1e1b4b;
    --bg: #0b0b0f;
    --surface: #15151b;
    --text: #ececf1;
    --muted: #9a9aa6;
    --border: #26262f;
    --code-bg: #1b1b23;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; }
.wrap { width: min(100% - 2.5rem, 760px); margin-inline: auto; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem 1rem; z-index: 10; border-radius: 8px; }

/* Encabezado */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: #fff; font-family: var(--mono); font-size: 16px;
}
:root[data-theme="dark"] .brand-mark { color: #0b0b0f; }
.nav { display: flex; align-items: center; gap: 1.1rem; font-size: .95rem; }
.nav a { color: var(--muted); font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; }
.theme-toggle {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* Portada */
main { padding-block: 3rem 4rem; min-height: 70vh; }
.hero { padding-block: 1.5rem 2.5rem; }
.eyebrow { margin: 0 0 .5rem; color: var(--accent); font-family: var(--mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.hero h1, .page-title, .post-header h1 {
  margin: 0 0 .75rem; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; letter-spacing: -.03em; font-weight: 700;
}
.page-title { font-size: clamp(1.75rem, 4vw, 2.4rem); margin-bottom: 2rem; }
.lead { margin: 0; color: var(--muted); font-size: 1.15rem; max-width: 36rem; }
.search {
  display: flex; align-items: center; gap: .6rem; margin-top: 1.75rem; padding: .7rem 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--muted); max-width: 26rem;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: .95rem; }

/* Tarjetas */
.list { display: grid; gap: 1.25rem; }
.card {
  display: grid; grid-template-columns: 1fr; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-2px); }
.card-cover img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; }
.card-body { padding: 1.4rem 1.5rem 1.5rem; }
.card h2 { margin: .3rem 0 .4rem; font-size: 1.35rem; line-height: 1.3; letter-spacing: -.015em; }
.card h2 a { color: var(--text); }
.card p { margin: 0 0 .9rem; color: var(--muted); font-size: .98rem; }
.meta { display: flex; gap: .45rem; color: var(--muted); font-size: .85rem; font-family: var(--mono); }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag {
  display: inline-block; padding: .18rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 500;
  background: var(--accent-soft); color: var(--accent);
}
.tag:hover { text-decoration: none; filter: brightness(1.05); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .6rem; }
.tag.big { font-size: 1rem; padding: .45rem 1rem; }
.tag.big span { opacity: .6; margin-left: .25rem; font-family: var(--mono); font-size: .85em; }
.empty { color: var(--muted); }
.pager { display: flex; justify-content: space-between; margin-top: 2.5rem; font-weight: 500; }
.button {
  display: inline-block; margin-top: 1.5rem; padding: .7rem 1.2rem; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 600;
}
:root[data-theme="dark"] .button { color: #0b0b0f; }
.button:hover { text-decoration: none; filter: brightness(1.08); }

/* Artículo */
.post-header { margin-bottom: 2rem; }
.post-header .meta { margin-bottom: .75rem; }
.post-header .lead { margin-bottom: 1rem; }
.post-cover { width: 100%; border-radius: var(--radius); margin-bottom: 2.25rem; border: 1px solid var(--border); }
.prose { font-size: 1.07rem; }
.prose > * { margin-block: 0; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { margin-top: 2.2em; font-size: 1.55rem; letter-spacing: -.02em; line-height: 1.25; }
.prose h3 { margin-top: 1.8em; font-size: 1.22rem; letter-spacing: -.01em; }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .35em; }
.prose blockquote {
  padding: .2em 0 .2em 1.1em; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic;
}
.prose code {
  font-family: var(--mono); font-size: .86em; padding: .15em .4em; border-radius: 6px;
  background: var(--code-bg); border: 1px solid var(--border);
}
.prose pre {
  overflow-x: auto; padding: 1.1rem 1.25rem; border-radius: 12px;
  background: var(--code-bg); border: 1px solid var(--border); line-height: 1.55;
}
.prose pre code { padding: 0; border: 0; background: none; font-size: .88rem; }
.prose img { border-radius: 12px; margin-inline: auto; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin-block: 2.5em; }
.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { padding: .55rem .8rem; border-bottom: 1px solid var(--border); text-align: left; }
.prose th { font-weight: 600; }
.post-footer { margin-top: 3.5rem; padding-top: 1.75rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .95rem; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.5rem; }
.post-nav a {
  display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.1rem;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.post-nav a:hover { border-color: var(--accent); text-decoration: none; }
.post-nav a.right { text-align: right; }
.post-nav small { color: var(--muted); font-size: .8rem; }
.post-nav span { color: var(--text); font-weight: 600; line-height: 1.35; }

/* Pie */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .88rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.75rem; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.socials { display: flex; gap: .9rem; }
.socials a { color: var(--muted); }
.socials a:hover { color: var(--accent); }

@media (max-width: 560px) {
  body { font-size: 16px; }
  main { padding-top: 2rem; }
  .nav { gap: .8rem; font-size: .9rem; }
  .brand > span:last-child { display: none; }
  .post-nav { grid-template-columns: 1fr; }
  .card-body { padding: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
