/* Mejoras de lectura (ver experiencia.js). */

/* 1 y 4 · Barra de herramientas compacta y fija, con el índice dentro. */
.research-tools.barra-lectura {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 0.4rem 0.6rem;
  gap: 0.4rem 0.8rem;
  margin: 0.6rem 0 1rem;
  box-shadow: 0 2px 8px rgb(60 43 29 / 0.12);
}
.research-tools.barra-lectura > * { flex: none; }
.research-tools.barra-lectura button { min-height: 40px; padding: 0.35rem 0.7rem; font-size: 0.9rem; }
.research-tools.barra-lectura details.research-index {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  flex: 1 1 auto;
  min-width: 0;
}
.research-tools.barra-lectura .research-index summary {
  min-height: 40px;
  padding: 0.35rem 0.7rem;
  border: 1px solid #92734c;
  border-radius: 6px;
  background: #fffaf0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  line-height: 1.9;
  max-width: 100%;
}
.research-tools.barra-lectura .indice-actual { font-weight: 400; color: #62513f; }
.research-tools.barra-lectura .research-index[open] ol {
  position: absolute;
  left: 0;
  top: calc(100% + 0.4rem);
  z-index: 41;
  width: min(34rem, calc(100vw - 2rem));
  max-height: 60vh;
  overflow: auto;
  margin: 0;
  padding: 0.8rem 0.8rem 0.8rem 2rem;
  columns: 1;
  background: #fffaf0;
  border: 1px solid #bda37b;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(60 43 29 / 0.2);
}
.research-index a[aria-current] { font-weight: 700; text-decoration-thickness: 2px; }
.research-index a[aria-current]::before { content: "▸ "; }

/* 4 · Volver arriba. */
.volver-arriba {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid #92734c;
  background: #3b2b1e;
  color: #fff0cd;
  font: 700 1.3rem/1 system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.25);
}
.volver-arriba:focus-visible { outline: 3px solid #245b76; outline-offset: 3px; }

/* 4 · Apartados secundarios plegados. */
details.apartado-plegado { margin: 1.5rem 0; border-top: 1px solid #d8c4a0; }
details.apartado-plegado > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.6rem; min-height: 44px; }
details.apartado-plegado > summary::-webkit-details-marker { display: none; }
details.apartado-plegado > summary::after { content: "＋"; margin-left: auto; font: 600 1.2rem system-ui; color: #7c321e; }
details.apartado-plegado[open] > summary::after { content: "－"; }
details.apartado-plegado > summary > h2 { margin: 0.6rem 0; }

/* 2 · Zona táctil de las citas (≥ 24 × 24 px) sin cambiar el tamaño del texto. */
a.cita, a.cita-pasaje, .cita-lote-boton { position: relative; }
a.cita::after, a.cita-pasaje::after, .cita-lote-boton::after {
  content: "";
  position: absolute;
  inset: -8px -5px;
}
a.cita-pasaje { padding: 0 0.15em; }

/* 3 y 13 · Grupos de citas y vista previa. */
.cita-lote { position: relative; display: inline; }
.document-shell .cita-lote-boton {
  display: inline !important;
  min-height: 0;
  height: auto;
  margin: 0 0.1em;
  box-shadow: none;
  padding: 0 0.25em !important;
  border: 1px solid #b06a4f !important;
  border-radius: 3px !important;
  background: #fff4ec;
  color: #8f2f1c;
  font: 600 0.72em/1.4 system-ui, sans-serif;
  vertical-align: super;
  cursor: pointer;
}
.cita-lote-boton[aria-expanded="true"] { background: #8f2f1c; color: #fff; }
.cita-panel {
  position: absolute;
  left: 0;
  top: 1.6em;
  z-index: 60;
  display: block;
  width: min(26rem, calc(100vw - 2rem));
  padding: 0.7rem 0.8rem;
  background: #fffaf0;
  color: #30261c;
  border: 1px solid #bda37b;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgb(60 43 29 / 0.22);
  font: 0.88rem/1.5 system-ui, sans-serif;
  text-align: left;
  white-space: normal;
}
.cita-panel[hidden] { display: none; }
.cita-panel.cita-panel-izquierda { left: auto; right: 0; }
a.cita + .cita-vista { pointer-events: none; }
.cita-fila { display: block; padding: 0.45rem 0; border-top: 1px solid #ead9b9; }
.cita-fila:first-child { border-top: 0; padding-top: 0; }
.cita-detalle { display: block; margin-bottom: 0.25rem; }
.cita-fila a { display: inline-block; margin-right: 1rem; min-height: 32px; line-height: 32px; font-weight: 600; vertical-align: middle; }
.cita-fila a::after { inset: 0; }

/* 5 · Lectura por bloques. */
.lectura-bloques {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 1rem 0;
  padding: 0.5rem;
  background: #fcf6e9;
  border: 1px solid #bda37b;
  border-radius: 10px;
  font: 0.95rem system-ui, sans-serif;
}
.lectura-bloques-pie { position: static; }
.lectura-bloques button, .lectura-bloques select {
  min-height: 44px;
  padding: 0.4rem 0.7rem;
  border: 1px solid #92734c;
  border-radius: 6px;
  background: #f6e9cc;
  color: #51331e;
  font: 600 0.9rem system-ui;
}
.lectura-bloques select { max-width: min(22rem, 100%); background: #fffaf0; font-weight: 400; }
.lectura-bloques button:disabled { opacity: 0.45; cursor: default; }
.lectura-estado { color: #62513f; }
html.lectura-por-bloques .document-transcription[hidden] { display: none !important; }

/* 9 · Títulos largos: título corto, subtítulo y sin versalitas. */
.document-shell h1.titulo-largo {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  font-variant: normal;
  text-transform: none;
  font-size: clamp(1.6rem, 3.4vw, 2.5rem);
  line-height: 1.2;
}
.document-shell h1 .titulo-sub {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.55em;
  font-weight: 400;
  color: #62513f;
}
.sr-sep { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 12 · Botón del año y navegación anterior / siguiente. */
.document-action.document-action-secundaria {
  display: inline-flex !important;
  line-height: 1.2;
  box-sizing: border-box;
  align-items: center;
  min-height: 44px;
  padding: 0.4rem 0.9rem;
  border: 1px solid #92734c;
  border-radius: 999px;
  background: #fff4dc;
  color: #4d301a;
  font: 600 0.92rem system-ui, sans-serif;
  text-decoration: none;
}
.nav-secuencial {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin: 2rem 0;
}
.nav-secuencial a {
  display: block;
  padding: 0.8rem 1rem;
  border: 1px solid #ceb991;
  border-radius: 10px;
  background: #fffaf0;
  color: #4d301a;
  text-decoration: none;
  font-weight: 600;
}
.nav-secuencial a[rel="next"] { text-align: right; }
.nav-secuencial small { display: block; font-weight: 400; color: #62513f; font-size: 0.82rem; }
.nav-secuencial a:hover, .nav-secuencial a:focus-visible { border-color: #7c321e; }

@media (max-width: 700px) {
  /* 1 · En móvil la barra ocupa una sola fila deslizable. */
  .research-tools.barra-lectura { flex-wrap: nowrap; overflow-x: auto; margin: 0.4rem -0.4rem 0.8rem; scrollbar-width: none; }
  .research-tools.barra-lectura::-webkit-scrollbar { display: none; }
  .research-tools.barra-lectura details.research-index { flex: none; position: static; }
  .research-tools.barra-lectura .research-index summary { overflow: visible; }
  .research-tools.barra-lectura .research-index[open] ol { position: fixed; left: 1rem; right: 1rem; top: 4rem; width: auto; }
  .research-tools.barra-lectura .indice-actual { display: none; }
  .research-tools.barra-lectura a { white-space: nowrap; }
  .nav-secuencial { grid-template-columns: 1fr; }
  .nav-secuencial a[rel="next"] { text-align: left; }
  .cita-panel { position: fixed; left: 1rem !important; right: 1rem !important; top: auto; bottom: 1rem; width: auto; }
  .lectura-bloques .lectura-todo { display: none; }
}

/* Enlaces dentro del panel de citas: sin el aspecto de superíndice. */
.cita-panel a.bibliographic-ref, .cita-panel a.cita-pasaje {
  top: 0;
  display: inline-block;
  margin: 0 1rem 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: #7c321e;
  font: 600 0.88rem/32px system-ui, sans-serif;
  vertical-align: baseline;
  text-decoration: underline;
  white-space: normal;
}
