/* Escuela de marxismo — hoja de estilos
   Paleta tomada del cartel de Lissitzky de la portada: papel crudo, tinta negra y rojo.
   Sin dependencias externas: tipografías del sistema. */

:root {
  --paper: #f6f2e9;
  --paper-2: #ede7d9;
  --paper-3: #e1d9c7;
  --ink: #1c1b18;
  --ink-2: #44413a;
  --muted: #736d62;
  --red: #c9321f;
  --red-2: #9f2718;
  --rule: #d6cdbb;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Charter, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 68ch;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171613;
    --paper-2: #201e1a;
    --paper-3: #2b2823;
    --ink: #ece7db;
    --ink-2: #cdc6b6;
    --muted: #9a9384;
    --red: #e25a45;
    --red-2: #ef7f6b;
    --rule: #3a362f;
  }
}

/* ---------- base ---------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.2rem);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: min(100% - 2rem, 76rem);
  margin-inline: auto;
}

a {
  color: var(--red-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}
a:hover { color: var(--red); }

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- cabecera ---------- */

.site-header {
  border-bottom: 3px solid var(--ink);
  background: var(--paper);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  min-height: 4.75rem;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.6rem 0;
}
.brand img { width: 48px; height: 48px; }
.brand b { color: var(--red); }

.site-nav { margin-left: auto; }
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.35rem;
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.site-nav a {
  display: inline-block;
  color: var(--ink);
  text-decoration: none;
  padding: 0.35rem 0;
  border-bottom: 3px solid transparent;
}
.site-nav a:hover,
.site-nav a[aria-current] { border-color: var(--red); color: var(--red-2); }
.site-nav li.secondary { display: none; }

.nav-toggle { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.nav-button {
  display: none;
  margin-left: auto;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.45rem 0.8rem;
  border: 2px solid var(--ink);
  cursor: pointer;
  user-select: none;
}
.nav-button span {
  width: 1.1rem;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}
.nav-toggle:focus-visible + .nav-button { outline: 2px solid var(--red); outline-offset: 2px; }

@media (max-width: 860px) {
  .site-header .wrap { gap: 0 0.75rem; min-height: 4rem; }
  .brand { font-size: 0.92rem; gap: 0.6rem; }
  .brand img { width: 40px; height: 40px; }
  .nav-button { display: inline-flex; }
  .site-nav {
    display: none;
    flex-basis: 100%;
    margin: 0;
    padding: 0.5rem 0 1rem;
    border-top: 1px solid var(--rule);
  }
  .nav-toggle:checked ~ .site-nav { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav a { display: block; padding: 0.7rem 0; border-bottom: 1px solid var(--rule); font-size: 0.95rem; }
  .site-nav a[aria-current] { border-bottom-color: var(--rule); color: var(--red); }
  .site-nav li.secondary { display: block; }
  .site-nav li.secondary a { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--ink-2); }
  .site-nav li.secondary.first { margin-top: 0.75rem; }
}

/* ---------- pie ---------- */

.site-footer {
  margin-top: auto;
  border-top: 3px solid var(--ink);
  padding: 2.25rem 0 3rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
}
.slogan {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.45;
  color: var(--ink-2);
  max-width: var(--measure);
  margin: 0 0 1.5rem;
}
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
}
.footer-links a { color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { color: var(--red); }
.colophon { margin: 0; }

/* ---------- cabecera de artículo ---------- */

.article-header {
  margin: 2.75rem 0 2.25rem;
  max-width: 62rem;
}
.breadcrumb {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.breadcrumb a { color: inherit; text-decoration: none; }
.breadcrumb a:hover { color: var(--red); }

.article-title {
  font-family: var(--sans);
  font-weight: 800;
  font-size: clamp(1.85rem, 1.3rem + 2.4vw, 3.1rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0.6rem 0 0.9rem;
  text-wrap: balance;
}
.article-title sup { font-size: 0.5em; }
.lede {
  font-size: 1.2rem;
  line-height: 1.45;
  color: var(--ink-2);
  max-width: var(--measure);
  margin: 0 0 0.9rem;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  font-family: var(--sans);
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: 0.75rem;
}
.article-meta .author { letter-spacing: 0.02em; }
.article-header::after {
  content: "";
  display: block;
  width: 5rem;
  height: 5px;
  background: var(--red);
  margin-top: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.38em 0.85em;
  border: 2px solid var(--ink);
  border-radius: 2px;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.button:hover { background: var(--ink); color: var(--paper); }
.button-icon { font-weight: 400; }

/* ---------- rejilla del artículo con índice ---------- */

.article-body { max-width: var(--measure); }

.toc {
  font-family: var(--sans);
  font-size: 0.86rem;
  margin: 0 0 2.25rem;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 0.7rem 1rem;
  max-width: var(--measure);
}
.toc summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.toc ol { list-style: none; margin: 0.75rem 0 0.25rem; padding: 0; }
.toc ol ol { margin: 0.2rem 0 0.3rem; padding-left: 0.9rem; border-left: 1px solid var(--rule); }
.toc li { margin: 0.4em 0; line-height: 1.35; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--red); }
.toc > details > ol > li > a { font-weight: 600; }

@media (min-width: 1100px) {
  .article.has-toc {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18rem;
    column-gap: 3.5rem;
    align-items: start;
  }
  .article.has-toc .article-header { grid-column: 1 / -1; }
  .article.has-toc .article-body,
  .article.has-toc .pager { grid-column: 1; }
  .article.has-toc .toc {
    grid-column: 2;
    grid-row: 2 / span 2;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow: auto;
    margin: 0;
    overscroll-behavior: contain;
  }
  .toc summary { pointer-events: none; list-style: none; }
  .toc summary::-webkit-details-marker { display: none; }
}

/* ---------- pager ---------- */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin: 3.5rem 0 3rem;
  padding-top: 1.25rem;
  border-top: 3px solid var(--ink);
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.35;
  max-width: var(--measure);
}
.pager a {
  flex: 0 1 48%;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.pager a:hover { color: var(--red); }
.pager small {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.pager .next { margin-left: auto; text-align: right; }

/* ---------- prosa ---------- */

.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.15em; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  font-family: var(--sans);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 2.2em 0 0.65em;
  scroll-margin-top: 1rem;
  text-wrap: balance;
}
.prose h1 { font-size: 1.9rem; letter-spacing: -0.02em; }
.prose h2 { font-size: 1.5rem; }
.prose h2::before {
  content: "";
  display: block;
  width: 3rem;
  height: 4px;
  background: var(--red);
  margin-bottom: 0.65rem;
}
.prose h3 { font-size: 1.2rem; }
.prose h4 { font-size: 0.98rem; letter-spacing: 0.05em; text-transform: uppercase; }
.prose h5, .prose h6 { font-size: 0.95rem; }
.prose h1 + h2::before, .prose h2 + h3, .prose h3 + h4 { margin-top: 1em; }

.prose blockquote {
  margin: 1.5em 0;
  padding: 0.15em 0 0.15em 1.25em;
  border-left: 4px solid var(--red);
  color: var(--ink-2);
  font-size: 0.96em;
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose ul, .prose ol { padding-left: 1.5em; margin: 0 0 1.15em; }
.prose li { margin: 0.35em 0; }
.prose li > ul, .prose li > ol { margin: 0.35em 0 0.35em; }
.prose ul { list-style: square; }
.prose ::marker { color: var(--red); }

.prose figure { margin: 2em 0; text-align: center; }
.prose figcaption {
  font-family: var(--sans);
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 0.7em;
}

.prose hr {
  border: 0;
  width: 4rem;
  height: 3px;
  background: var(--red);
  margin: 3em auto;
}

.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--paper-2);
  padding: 0.1em 0.3em;
}
.prose pre {
  overflow-x: auto;
  background: var(--paper-2);
  padding: 1em 1.25em;
  border-left: 4px solid var(--rule);
}
.prose pre code { background: none; padding: 0; }

.prose u { text-decoration-color: var(--red); text-underline-offset: 0.15em; }
.prose sup { line-height: 0; }

.table-wrap { overflow-x: auto; margin: 1.6em 0; }
.prose table {
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.88rem;
  line-height: 1.4;
  min-width: 50%;
}
.prose th, .prose td {
  padding: 0.5em 0.85em;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.prose thead th { border-bottom: 2px solid var(--ink); font-weight: 700; }
.prose tbody tr:nth-child(even) { background: var(--paper-2); }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }

/* notas al pie */
.fn-ref {
  font-family: var(--sans);
  font-size: 0.68em;
  line-height: 0;
  vertical-align: super;
}
.fn-ref a { text-decoration: none; font-weight: 700; padding: 0 0.1em; }
.footnotes {
  margin-top: 3.5em;
  padding-top: 1.5em;
  border-top: 1px solid var(--rule);
  font-size: 0.86em;
  line-height: 1.5;
  color: var(--ink-2);
}
.footnotes::before {
  content: "";
  display: block;
  width: 3rem;
  height: 4px;
  background: var(--red);
  margin: -1.5em 0 1.5em;
  position: relative;
  top: -2px;
}
.footnotes ol { padding-left: 1.6em; margin: 0; }
.footnotes li { margin-bottom: 0.7em; }
.footnotes li p { margin-bottom: 0.5em; }
.footnote-backref { text-decoration: none; font-family: var(--sans); }
.footnotes li:target, .fn-ref:target a {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  outline: 0.35em solid color-mix(in srgb, var(--red) 12%, transparent);
}

/* ---------- portada ---------- */

.home-prose { max-width: none; margin-top: 2.5rem; }
.home-prose > figure:first-child {
  margin: 0 auto 2.75rem;
  max-width: 52rem;
}
.home-prose > figure:first-child img { display: block; width: 100%; }
.home-prose > figure:first-child figcaption { text-align: right; }
.home-prose > p {
  font-size: 1.25rem;
  line-height: 1.5;
  max-width: var(--measure);
}
.home-prose > ul {
  list-style: none;
  padding: 0;
  margin: 2.25rem 0 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.25rem;
}
.home-prose > ul > li {
  margin: 0;
  padding: 1.25rem 1.4rem 1.4rem;
  border: 1px solid var(--rule);
  border-top: 5px solid var(--red);
  background: var(--paper-2);
  font-size: 0.98rem;
  line-height: 1.5;
}
.home-prose > ul > li a {
  font-family: var(--sans);
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--red);
}
.home-prose > ul > li a:hover { color: var(--red); }

/* ---------- índices de sección ---------- */

.index-page .article-body { max-width: 60rem; }
.index-page .prose > ul, .index-page .prose > ol { max-width: var(--measure); }
.index-page .prose li { margin: 0.5em 0; }

/* ---------- impresión ---------- */

@media print {
  html { background: #fff; color: #000; font-size: 11pt; }
  .site-header, .site-footer, .toc, .pager, .skip-link, .button, .breadcrumb { display: none !important; }
  .article-body, .article-header { max-width: none; }
  a { color: inherit; text-decoration: none; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #555; }
}

/* ---------- colecciones (Communia) ---------- */

.article-meta time { font-variant-numeric: tabular-nums; }
.article-meta .category {
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--red-2);
}
.article-meta .category:hover { color: var(--red); }

.article-footer { max-width: var(--measure); margin-top: 2.5rem; }
.tags {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tags a {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.15em 0.6em;
  text-decoration: none;
  background: var(--paper-2);
}
.tags a:hover { border-color: var(--red); color: var(--red); }

/* cajas "lee también" heredadas del blog */
.prose #destacado, .prose .destacado {
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.5;
  background: var(--paper-2);
  border-left: 4px solid var(--ink);
  padding: 0.9em 1.2em;
  margin: 1.75em 0;
}
.prose #destacado ul, .prose .destacado ul { margin: 0.5em 0 0; padding-left: 1.2em; }
.prose #destacado p:last-child, .prose .destacado p:last-child { margin-bottom: 0; }
.prose iframe { max-width: 100%; }

/* índices cronológicos */
.listing-body { max-width: 60rem; }
.listing-body h2 {
  font-size: 1.7rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.listing-body h2 small {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.listing-body h3 {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.75em 0 0.5em;
}
.entries {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5em;
}
.entries li {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: baseline;
  padding: 0.5rem 0;
  margin: 0;
  border-bottom: 1px solid var(--rule);
}
.entries time {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.entries li > a:first-of-type {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.02rem;
  line-height: 1.35;
}
.entries li > a:first-of-type:hover { color: var(--red); }
.entries .cat {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  margin-left: 0.6rem;
  white-space: nowrap;
}
.entries .cat:hover { color: var(--red); }
.listing .toc ol { columns: 2; column-gap: 1rem; }
.listing .toc li { break-inside: avoid; }
@media (max-width: 480px) {
  .entries li { grid-template-columns: 2.2rem minmax(0, 1fr); }
  .entries .cat { display: block; margin: 0.2rem 0 0; }
}

/* ---------- diccionarios ---------- */

.dictionary-intro { margin-bottom: 2rem; }
.dictionary-intro p { font-size: 1.12rem; }

.dictionary-tools {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  padding: 0.75rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 2rem;
}
.dict-search { display: flex; align-items: center; gap: 0.75rem; flex: 1 1 22rem; }
.dict-search label {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.dict-search input {
  flex: 1;
  font: inherit;
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.5em 0.8em;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--paper-2);
  color: var(--ink);
  min-width: 0;
}
.dict-search input:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.letters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.9rem;
}
.letters a {
  display: inline-block;
  min-width: 1.8rem;
  padding: 0.25rem 0.3rem;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 2px solid transparent;
}
.letters a:hover { color: var(--red); border-color: var(--red); }

.letter-group { scroll-margin-top: 5.5rem; }
.letter {
  font-family: var(--sans);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--red);
  margin: 2.25rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 3px solid var(--ink);
}
.terms { margin: 0; }
.term {
  display: grid;
  grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
  gap: 0.35rem 2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}
.term dt a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.08rem;
  line-height: 1.25;
  color: var(--ink);
  text-decoration: none;
}
.term dt a:hover span { color: var(--red); }
.term dt img {
  width: 5.5rem;
  height: 2.75rem;
  object-fit: cover;
  flex: none;
  border-radius: 2px;
  filter: saturate(0.85);
}
.term dd { margin: 0; color: var(--ink-2); font-size: 0.98rem; line-height: 1.5; }
.no-results { font-family: var(--sans); color: var(--muted); padding: 2rem 0; }
@media (max-width: 720px) {
  .term { grid-template-columns: 1fr; }
  .dictionary-tools { position: static; }
}

.illustration { margin: 0 0 2em; }
.illustration img { display: block; width: 100%; height: auto; border-radius: 2px; }
.related h2 {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.6rem;
}
.dictionary .article-header { margin-bottom: 1.5rem; }
