.document-header,
.document-nav,
.document-footer {
  padding: 1rem max(1rem, calc((100vw - 1180px) / 2));
  background: #34291e;
  color: #fff6dd;
}
.document-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.document-header a,
.document-nav a,
.document-footer a {
  color: #f8e7bf;
}
.document-brand {
  font:
    700 1.8rem Cinzel,
    Georgia,
    serif;
  text-decoration: none;
}
.document-brand small {
  display: block;
  font:
    0.85rem system-ui,
    sans-serif;
}
.document-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.3rem;
  border-top: 1px solid #9c7a47;
}
.document-nav a {
  font:
    600 0.95rem system-ui,
    sans-serif;
  text-decoration: none;
}
.document-nav a:hover,
.document-nav [aria-current] {
  text-decoration: underline;
  text-underline-offset: 6px;
}
.document-shell {
  max-width: 1100px;
  margin: 2rem auto;
  padding: clamp(1.2rem, 4vw, 3rem);
  background: #fffaf0ef;
  border: 1px solid #cbb58e;
  border-radius: 18px;
  box-shadow: 0 6px 24px #35251912;
  color: #36291c;
  overflow-wrap: anywhere;
  font:
    1.1rem/1.8 Georgia,
    serif;
}
.document-shell h1,
.document-shell h2 {
  font-family: Cinzel, Georgia, serif;
  line-height: 1.3;
}
.document-shell h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  margin: 1rem 0 1.5rem;
}
.document-shell h2 {
  font-size: 1.6rem;
  margin-top: 2rem;
}
.document-shell a {
  color: #744319;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.document-shell img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 650px;
  object-fit: contain;
  margin: auto;
}
.document-shell figure {
  margin: 1.5rem 0;
  padding: 1rem;
  background: #efe3ca;
  border-radius: 12px;
}
.document-shell figcaption {
  font:
    0.9rem/1.6 system-ui,
    sans-serif;
  margin-top: 1rem;
}
.document-breadcrumb {
  font:
    0.85rem/1.7 system-ui,
    sans-serif;
}
.document-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
  padding: 0;
  list-style: none;
}
.document-grid li {
  padding: 1rem;
  border: 1px solid #cbb58e;
  border-radius: 10px;
  background: #fbf1dd;
}
.document-grid img {
  width: 100%;
  height: 190px;
  object-fit: contain;
}
.document-shell table {
  width: 100%;
  border-collapse: collapse;
  font:
    0.95rem/1.6 system-ui,
    sans-serif;
}
.document-table {
  overflow-x: auto;
}
.document-shell th,
.document-shell td {
  padding: 0.7rem;
  border: 1px solid #cbb58e;
  text-align: left;
  vertical-align: top;
}
.document-shell th {
  background: #efe2c7;
}
.document-shell details {
  border: 1px solid #cbb58e;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}
.document-shell summary {
  cursor: pointer;
  font-weight: 700;
}
.document-shell input {
  max-width: 100%;
  padding: 0.6rem;
  border: 1px solid #9b8059;
  border-radius: 6px;
  background: white;
  color: #36291c;
}
.document-shell button,
.document-action {
  display: inline-block !important;
  border: 1px solid #86582d;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  background: #f3e1bb;
  color: #36291c;
  cursor: pointer;
}
.document-editorial {
  border-top: 1px solid #cbb58e;
  margin-top: 2rem;
  font:
    0.95rem/1.7 system-ui,
    sans-serif;
}
.document-transcription {
  white-space: pre-wrap;
  content-visibility: visible;
  contain-intrinsic-size: auto 1200px;
}
.document-transcription p {
  margin: 1rem 0;
}
.document-note {
  padding: 1rem;
  background: #eef1ec;
  border-left: 4px solid #536d60;
}
.document-footer {
  font:
    0.95rem/1.8 system-ui,
    sans-serif;
}
.document-filter {
  padding: 1rem;
  background: #f3e6cd;
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.document-shell :focus-visible {
  outline: 3px solid #3165ad;
  outline-offset: 4px;
}
.document-shell ul {
  padding-left: 1.5rem;
}
.document-shell .document-grid {
  padding-left: 0;
}
.document-shell mark {
  background: #ffe292;
  color: #36291c;
}
@media (max-width: 600px) {
  .document-shell {
    margin: 0.8rem;
    border-radius: 10px;
  }
  .document-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .document-nav {
    gap: 1rem;
  }
  .document-brand {
    font-size: 1.5rem;
  }
}

.document-transcription p:target {
  background: #f3df9e;
  outline: 2px solid #88672c;
  scroll-margin-top: 1rem;
}
.document-comparison {
  padding: 1rem;
  border-left: 3px solid #88672c;
  background: #eadcbf55;
  margin: 1.5rem 0;
}

.document-passage-link {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .document-passage-link {
    white-space: normal;
  }
}

/* Una cita profunda necesita la altura real de los bloques anteriores. */
html:has(.document-transcription:target, .document-transcription :target)
  .document-transcription {
  content-visibility: visible;
  contain-intrinsic-size: none;
}

html.js-reading .document-transcription {
  content-visibility: auto;
  contain-intrinsic-size: auto 1000px;
}

html:has(.document-transcription:target, .document-transcription :target),
html:has(.document-transcription:target, .document-transcription :target) body {
  scroll-behavior: auto !important;
}
.redes-sociales {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}
.redes-sociales ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.redes-sociales a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
}
.mapa-pueblos-figura {
  margin: 0;
}
.mapa-pueblos-figura svg {
  display: block;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  margin: 0 auto;
}
.mp-mar {
  fill: #e6d6aa;
}
.mp-rejilla {
  fill: none;
  stroke: #b39866;
  stroke-width: 0.6;
  stroke-dasharray: 3 5;
  opacity: 0.6;
}
.mp-tierra {
  fill: #f7edd2;
}
.mp-costa {
  fill: none;
  stroke: #6e5130;
  stroke-width: 0.7;
}
.mp-area {
  stroke: #f7edd2;
  stroke-width: 1.2;
  opacity: 0.85;
}
.mapa-pueblos-leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  padding: 0;
  list-style: none;
}
.mapa-pueblos-leyenda i {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  border: 1px solid #3d2a17;
}

/* Cuaderno de bitácora: imagen de portada del artículo */
.cuaderno-portada {
  margin: 0 0 1.5rem;
}
.cuaderno-portada img {
  display: block;
  width: 100%;
  max-height: 26rem;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #cbb58e;
}
.cuaderno-portada figcaption {
  margin-top: 0.45rem;
  font-size: 0.85rem;
  font-style: italic;
  color: #6d5a42;
}
a.cita-pasaje{margin-left:.1em;font-size:.8em;vertical-align:super;text-decoration:none;color:#8b1d1d}
.document-shell .family-avatar img { width: 100%; height: 100%; object-fit: cover; }
.document-shell .life-event figure { margin: 0; padding: 0; border: 0; background: transparent; }
.document-shell .life-event img { width: 100%; height: 195px; object-fit: cover; }
.document-shell .life-event figcaption details { padding: 0; border: 0; background: transparent; }
@media (max-width: 600px) { .document-shell .life-event img { height: 210px; } }

/* Evidencia documental: texto legible, acciones discretas y fragmentos con contexto. */
.evidence-passage{padding:1.25rem 0;border-top:1px solid #b69a71;scroll-margin-top:8rem;overflow-wrap:anywhere}.evidence-status{font:600 .85rem/1.5 system-ui,sans-serif;color:#714e2b}.evidence-quote{white-space:pre-wrap;border-left:3px solid #956d3f;margin:1rem 0;padding:.7rem 1rem;background:#fffaf0;color:#35271c;max-height:28rem;overflow:auto}.evidence-actions{display:flex;gap:.7rem 1rem;flex-wrap:wrap;align-items:center}.evidence-actions button{font:inherit;font-size:.9rem;padding:.4rem .65rem;border:1px solid #916f4d;border-radius:.35rem;background:#fffaf0;color:#703624;cursor:pointer}.evidence-actions a{font-size:.9rem}.evidence-copy-status{display:block;min-height:1.5em;font-size:.9rem}.evidence-actions :focus-visible{outline:3px solid #844b26;outline-offset:3px}
