:root {
  --color-text: #1a1a1a;
  --color-bg: #fefefe;
  --color-muted: #6b6b6b;
  --color-border: #d9d9d9;
  --color-chip-bg: #fafafa;
  --color-quote-bg: #f2f2f2;
  --font-serif: "Source Serif 4", ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --measure-wide: 73rem;
  --measure-text: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-text: #e8e8e8;
    --color-bg: #15151a;
    --color-muted: #9a9a9a;
    --color-border: #33333a;
    --color-chip-bg: #1e1e24;
    --color-quote-bg: #1e1e24;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

.site-header,
main,
.site-footer {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Text column: narrower than the full container */
.hero,
.post-header,
.post-tags,
.post-footer,
.tag-heading,
.footer-heading,
.footer-contact {
  max-width: var(--measure-text);
}

.post-content > * {
  max-width: var(--measure-text);
}

.post-content > figure,
.post-content > p:has(> img:only-child) {
  max-width: none;
}

.post-content > p:has(> img:only-child) img {
  width: 100%;  /* el max-width inline (ancho real) evita que se estiren más allá de su tamaño */
  display: block;
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-color: var(--color-border);
}

a:hover {
  text-decoration-color: currentColor;
}

/* Header */

.site-header {
  padding-top: 2.5rem;
  padding-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
}

/* Isotipo: cuadrado con la "n" serif. Se invierte con el tema
   (fondo = color de texto, glifo = color de fondo) para mantener contraste. */
.site-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.4rem;
  background: var(--color-text);
  color: var(--color-bg);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
  padding-bottom: 0.1em;  /* asienta ópticamente el glifo sobre la línea base */
}

.site-logo-word {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.3125rem;
  letter-spacing: 0.01em;
  color: var(--color-text);
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.95rem;
}

.site-nav a {
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
  text-decoration-color: currentColor;
}

main {
  padding-top: 1rem;
  padding-bottom: 4rem;
  min-height: 50vh;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  line-height: 1.2;
  font-weight: 700;
}

/* Hero (home) */

.hero {
  padding: 5rem 0 5rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.84px;
  line-height: 1;
  margin: 0;
}

.hero-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.84px;
  line-height: 1;
  color: var(--color-muted);
  margin: 0;
}

/* Listado de posts (home y tags) */

.year-heading {
  font-family: var(--font-sans);
  color: var(--color-muted);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 2.5rem 0 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px dotted var(--color-border);
}

.year-heading:first-child {
  margin-top: 0;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 0;
  border-bottom: 1px dotted var(--color-border);
}

.post-list-item-main {
  min-width: 0;
}

.post-list-title {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.48px;
  text-decoration: none;
}

.post-list-title:hover {
  text-decoration: underline;
}

.post-list-date {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.post-list-tag {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
  white-space: nowrap;
  text-decoration: none;
}

.post-list-tag:hover {
  text-decoration: underline;
}

/* Post individual */

.post-header {
  padding-top: 5rem;
  margin-bottom: 3.5rem;
}

.post-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.84px;
  margin: 0;
}

.post-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.84px;
  color: var(--color-muted);
  margin: 0;
}

.post-meta {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.post-content {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  line-height: 1.5;
}

.post-content p {
  margin-top: 0;
  margin-bottom: 3.5rem;
}

.post-content hr {
  max-width: var(--measure-text);
  margin: 3.5rem 0;
  border: none;
  border-top: 1px solid var(--color-border);
}

.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  margin-top: 2rem;
}

.post-content img {
  max-width: 100%;
  height: auto;
}

.post-content figure {
  margin: 1.75rem 0;
}

/* Markdown envuelve cada imagen del figure en un <p> con margin propio; lo anulamos
   y usamos un gap uniforme entre hijos, así imágenes consecutivas no se enciman ni
   el figcaption queda despegado de la última imagen. */
.post-content figure p {
  margin: 0;
}

.post-content figure > * + * {
  margin-top: 0.75rem;
}

.post-content figcaption {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-align: left;
  color: var(--color-muted);
}

.post-content pre {
  overflow-x: auto;
  padding: 1rem;
  background: var(--color-chip-bg);
  border: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-content blockquote {
  margin: 1.75rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--color-quote-bg);
  font-style: italic;
}

.post-content blockquote p {
  margin: 0.4rem 0;
}

.post-tags {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.tag-chip {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-decoration: none;
  border: 1px solid var(--color-border);
  background: var(--color-chip-bg);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
}

.tag-chip:hover {
  border-color: var(--color-text);
}

.post-footer {
  margin-top: 3rem;
  font-size: 0.95rem;
}

/* Tags index */

.tags-index-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tags-index-item {
  display: flex;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px dotted var(--color-border);
  text-decoration: none;
  font-family: var(--font-sans);
}

.tags-index-count {
  color: var(--color-muted);
}

/* Tag page heading */

.tag-heading {
  margin-bottom: 1.5rem;
}

/* Footer */

.site-footer {
  padding-top: 3rem;
  padding-bottom: 3.5rem;
  margin-top: 3rem;
  border-top: 1px dotted var(--color-border);
}

.footer-heading {
  font-size: 1.6rem;
  margin: 0 0 0.75rem;
}

.footer-contact {
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

.footer-nav {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.9rem;
}

.footer-nav a {
  text-decoration: none;
}

.footer-nav a:hover {
  text-decoration: underline;
}

.footer-bottom {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px dotted var(--color-border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

@media (max-width: 50rem) {
  :root {
    --measure-text: none;
  }

  .hero-title {
    font-size: 2rem;
  }

  .post-title {
    font-size: 1.5rem;
  }

  .post-list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
}
