/* ─────────────────────────────────────────────────────────────
   Tokens
   ───────────────────────────────────────────────────────────── */
:root {
  /* Paleta clara — papel cálido, tinta suave */
  --bg:          #f6f3ec;
  --bg-soft:     #efeae0;
  --surface:     #fdfbf6;
  --fg:          #1f1d1a;
  --fg-soft:     #4a4641;
  --muted:       #8a8378;
  --rule:        #d8d1c2;
  --accent:      #7a1f1f;          /* oxblood */
  --accent-soft: #b04a3f;
  --highlight:   #f0e8d4;

  /* Tipografía — todo del sistema, sin descargar nada */
  --font-sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Charter", "Source Serif Pro", ui-serif, Georgia, "Times New Roman", serif;
  --font-mono:  ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --font-display: "Iowan Old Style", "Charter", ui-serif, Georgia, serif;

  /* Métricas */
  --measure: 38rem;       /* ~ 65ch para lectura cómoda */
  --radius: 2px;
  --rule-w: 1px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #131210;
    --bg-soft:     #1a1816;
    --surface:     #1c1a17;
    --fg:          #ece7dc;
    --fg-soft:     #c2bcb0;
    --muted:       #837d72;
    --rule:        #2a2723;
    --accent:      #d97757;
    --accent-soft: #e89478;
    --highlight:   #2a2519;
  }
}

/* ─────────────────────────────────────────────────────────────
   Reset / base
   ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
@media (max-width: 640px) { html { font-size: 16px; } }

img, svg, figure { max-width: 100%; height: auto; display: block; }
figure { margin: 2rem 0; }
figcaption {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.6rem;
  font-style: italic;
}

body {
  font-family: var(--font-serif);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.65;
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Sutil textura de papel (solo en claro) */
@media (prefers-color-scheme: light) {
  body {
    background-image: radial-gradient(circle at 25% 10%, rgba(0,0,0,0.012) 0%, transparent 40%),
                      radial-gradient(circle at 80% 80%, rgba(0,0,0,0.015) 0%, transparent 40%);
  }
}

a {
  color: var(--fg);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: color 120ms ease, background-size 200ms ease;
}
a:hover { color: var(--accent); background-size: 100% 2px; }

/* ─────────────────────────────────────────────────────────────
   Tipografía
   ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--fg);
  margin: 2.2em 0 0.6em;
}
h1 { font-size: clamp(2rem, 4vw, 2.6rem); letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.18rem; }
h4 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

p { margin: 0 0 1.2em; }

ul, ol { padding-left: 1.4em; margin: 0 0 1.2em; }
li { margin: 0.3em 0; }
li::marker { color: var(--muted); }

hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 3rem 0;
  position: relative;
}
hr::before {
  content: "✦";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  color: var(--muted);
  padding: 0 0.8rem;
  font-size: 0.8rem;
}

blockquote {
  margin: 1.6em 0;
  padding: 0.2em 0 0.2em 1.4rem;
  border-left: 2px solid var(--accent);
  color: var(--fg-soft);
  font-style: italic;
}
blockquote p:last-child { margin-bottom: 0; }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-soft);
  padding: 0.12em 0.42em;
  border-radius: var(--radius);
  color: var(--fg);
}

pre {
  background: var(--surface);
  padding: 1.1rem 1.3rem;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.55;
  margin: 1.6em 0;
  border: 1px solid var(--rule);
  font-size: 0.88rem;
}
pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* ─────────────────────────────────────────────────────────────
   Layout
   ───────────────────────────────────────────────────────────── */
.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}
/* ─────────────────────────────────────────────────────────────
   Header
   ───────────────────────────────────────────────────────────── */
.site-header {
  padding: 2rem 0 1.4rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  background: none;
}
.brand:hover { color: var(--accent); background: none; }
.brand .dot { color: var(--accent); }

.site-header nav {
  display: flex;
  gap: 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}
.site-header nav a {
  color: var(--muted);
  background: none;
}
.site-header nav a:hover { color: var(--fg); background: none; }
.site-header nav a.current { color: var(--fg); }

/* ─────────────────────────────────────────────────────────────
   Hero (home)
   ───────────────────────────────────────────────────────────── */
.hero {
  padding: 3rem 0 3.5rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 3rem;
}
.hero .eyebrow {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.hero .eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--accent);
}
.hero h1 {
  font-size: clamp(2.6rem, 6vw, 4rem);
  margin: 0 0 0.5em;
  letter-spacing: -0.035em;
  line-height: 1.02;
}
.hero .tagline {
  font-size: 1.12rem;
  color: var(--fg-soft);
  max-width: 32em;
  margin: 0;
  line-height: 1.55;
}

/* ─────────────────────────────────────────────────────────────
   Posts list
   ───────────────────────────────────────────────────────────── */
.posts-list { margin: 0; }
.posts-list > h2 {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 0 0 1.4rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.posts-list > h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.post-card {
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
}
.post-card:last-child { border-bottom: 0; }

.post-card .meta {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  display: flex;
  gap: 0.8rem;
  align-items: center;
}
.post-card .meta time { font-variant-numeric: tabular-nums; }

.post-card h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 0.2rem 0 0.4rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.post-card h3 a {
  color: var(--fg);
  background: none;
}
.post-card h3 a:hover { color: var(--accent); background: none; }

.post-card .excerpt {
  color: var(--fg-soft);
  margin: 0;
  font-size: 1rem;
}

/* ─────────────────────────────────────────────────────────────
   Post (single)
   ───────────────────────────────────────────────────────────── */
.post-header {
  margin-bottom: 3rem;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--rule);
}
.post-header .eyebrow {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.post-header .eyebrow time { font-variant-numeric: tabular-nums; }
.post-header .eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--accent);
}
.post-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 0.8rem;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.post-header .summary {
  font-size: 1.12rem;
  color: var(--fg-soft);
  margin: 0;
  font-style: italic;
  max-width: 30em;
  line-height: 1.5;
}
.post-header .tags {
  margin-top: 1.2rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.post-header .tag {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  background: var(--bg-soft);
  padding: 0.2em 0.7em;
  border-radius: 100px;
  color: var(--fg-soft);
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.post-body {
  font-size: 1.06rem;
  line-height: 1.75;
}
.post-body h2 {
  margin-top: 2.4em;
  position: relative;
}
.post-body h2::before {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 0.06em;
  background: var(--accent);
  vertical-align: middle;
  margin-right: 0.6em;
  transform: translateY(-0.1em);
}
.post-body h3 { margin-top: 2em; }
.post-body p { hyphens: auto; }
.post-body a { color: var(--fg); }
.post-body a:hover { color: var(--accent); }

/* Drop cap en el primer párrafo de un post */
.post-body > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 3.2em;
  font-weight: 600;
  float: left;
  line-height: 0.85;
  margin: 0.08em 0.08em 0 -0.04em;
  color: var(--accent);
}

/* Imágenes dentro de un post → figure */
.post-body img {
  margin: 2rem auto;
  border-radius: var(--radius);
}

/* ─────────────────────────────────────────────────────────────
   Diagrams (SVG)
   ───────────────────────────────────────────────────────────── */
.diagram {
  margin: 2.4rem 0;
  padding: 1.6rem 1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.diagram figcaption {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--rule);
}

/* Capturas verticales: conservar su escala de teléfono y darles contexto. */
.screenshot {
  width: min(100%, 336px);
  margin: 2.4rem auto;
}
.screenshot img {
  width: 100%;
  margin: 0;
  border: 1px solid var(--rule);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--bg) 55%, transparent);
}
.screenshot figcaption {
  margin-top: 0.75rem;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  line-height: 1.45;
  text-align: center;
}

/* ─────────────────────────────────────────────────────────────
   Footer
   ───────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: 6rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans);
  color: var(--muted);
  font-size: 0.82rem;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.post-nav {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}
.post-nav a {
  color: var(--fg-soft);
  background: none;
}
.post-nav a:hover { color: var(--accent); background: none; }

/* Selección */
::selection {
  background: var(--accent);
  color: var(--surface);
}
