/* ================================================================
   1. TIPOGRAFÍAS Y RECURSOS EXTERNOS
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Gentium+Book+Plus:ital,wght@0,400;0,700;1,400&family=Playfair+Display:ital@0;1&display=swap');

@font-face {
  font-family: 'AcademyEngraved';
  src: url('../fonts/AcademyEngravedLetPlain.woff') format('woff'),
       url('../fonts/AcademyEngravedLetPlain.ttf') format('truetype');
}

@font-face {
    font-family: 'Ezra SIL';
    src: url('../font/SILEOTSR.ttf') format('truetype');
}

/* ================================================================
   2. LA CLAVE: PERMISOS DE PAGINACIÓN PARA PAGED.JS
================================================================ */
/* Quitamos html y body para no cegar al motor de Paged.js */
.print-container, .chapter-section, .bible-text {
    display: block;
    overflow: visible;
    break-inside: auto;      
    page-break-inside: auto; 
}

.words-container {

    direction: rtl;

    text-align: right;

    width: 100%;

    max-width: 100%;

    overflow: hidden;

    line-height: 1.2;

    box-sizing: border-box;
}

.mensaje-manual-p2 {
    display: none !important;
}

/* =========================================================
   DATOS INVISIBLES PARA RUNNING HEADERS
========================================================= */

.book-name-hidden {
    string-set: bookTitle content();

    position: absolute !important;
    width: 0 !important;
    height: 0 !important;

    overflow: hidden !important;
    opacity: 0 !important;
}
.chapter-number-data {
    string-set: chapNum content();

    position: absolute !important;
    width: 0 !important;
    height: 0 !important;

    overflow: hidden !important;
    opacity: 0 !important;
}

/* =========================================================
   IMPRESIÓN EDITORIAL NATIVA
========================================================= */

@page {

    size: letter;

    margin-top: 0.9in;
    margin-bottom: 0.7in;
    margin-left: 0.65in;
    margin-right: 0.65in;
}

/* =========================================================
   HEADER VISUAL
========================================================= */
.print-header {
    display: none !important;
}

/* =========================================================
   IMPRESIÓN LIMPIA
========================================================= */
@media print {

    .manual-footer {

        position: fixed;

        bottom: 0.18in;

        left: 0;

        right: 0;

        text-align: center;

        font-size: 9pt;

        color: #666;

        font-family: 'Gentium Book Plus', serif;

        letter-spacing: 0.5pt;
    }
}

@page {
    margin: 0.7in 0.6in 0.7in 0.6in;
}
/* ================================================================
   4. ESTRUCTURA BÍBLICA: A PRUEBA DE PAGED.JS
================================================================ */
body {
    background: white;
    color: black;
    font-family: 'Gentium Book Plus', serif;
    font-size: 12pt;
    line-height: 1.5;
    direction: rtl; 
    margin: 0;
    padding: 0;
}

.print-container { width: 100%; }

.book-cover {
    display: flex;
    margin-top: 45pt;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 10pt;
    padding-bottom: 1pt;
    text-align: center;
    break-after: avoid;
    page-break-after: avoid;
}
.chapter-section { margin-bottom: 10pt; }

.editorial-title {
    text-align: center;
    font-size: 16pt;
    color: #0e4e74;
    font-family: 'AcademyEngraved', serif;
    margin-top: 1pt; 
}

.editorial-subtitle {
    text-align: center;
    font-size: 14pt;
    margin-bottom: 10pt;
    font-family: 'Playfair Display', serif;
    font-style: italic;
}
.verse-row {

    display: block;

    position: relative;

    width: 100%;

    max-width: 100%;

    margin-top: 1pt;
    margin-bottom: 1pt;

    margin-right: 0;
    margin-left: 0;

    padding-right: 10pt;
    padding-left: 5pt;

    box-sizing: border-box;

    break-inside: auto;
    page-break-inside: auto;

    text-align: right;

    overflow: visible;

    white-space: normal;

    word-break: normal;

    overflow-wrap: break-word;
}

/* Evitamos que el último de todos empuje el papel hacia una hoja nueva */
.verse-row:last-child {
    margin-bottom: 0 !important;
}

.verse-number {

    position: absolute;

    top: 6pt;

    right: 0;

    width: 18pt;

    text-align: right;

    font-weight: bold;

    color: #2c3e50;

    font-size: 9pt;

    line-height: 1;
}

.word-block {

    display: inline-flex;

    flex-direction: column;

    justify-content: flex-start;

    align-items: center;

    vertical-align: top;

    direction: rtl;

    text-align: center;

    margin: 0 4px 3px 4px;

    padding: 0 2px;

    min-width: 42px;

    max-width: 180px;

    box-sizing: border-box;

    overflow-wrap: break-word;

    word-break: keep-all;

    white-space: normal;
}

.word-block span { display: block; }

.word-block {

    outline: 1px solid rgb(194, 194, 194) !important;
}
/* Aplicamos YAHWEH de forma correcta, respetando tu clase span */
.he { 
    font-family: 'Ezra SIL', serif; 
    font-size: 18pt;   
}
.tr { 
    font-size: 10pt; 
    font-style: italic; 
    color: #444; 
}
.en { 
    font-size: 9pt; 
    color: #000; 
}
.es { 
    font-size: 9pt; 
    color: #555; 
    font-variant: small-caps; 
}
.tr,
.en,
.es {

    white-space: normal;
}
.yah-gold { 
    color: #000; 
    font-weight: 900; 
    border-bottom: 1px solid #b2945d; 
}

/* ================================================================
   5. NAVEGACIÓN Y BOTONES (SOLO PANTALLA)
================================================================ */
.print-nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    direction: ltr; 
    margin-bottom: 40px;
}

.btn-glossy-print {
    display: flex; align-items: center; padding: 5px 20px;
    background: linear-gradient(to bottom, #0056b3 0%, #1e90ff 50%, #0056b3 100%);
    border: none; border-radius: 30px; color: white; font-weight: bold; cursor: pointer;
    box-shadow: 0 0 0 3px #a0a0a0, 0 2px 5px rgba(0,0,0,0.4); position: relative; transition: 0.2s;
}

.btn-glossy-print::before {
    content: ""; position: absolute; top: 2px; left: 10%; right: 10%; height: 35%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.4) 0%, transparent 100%); border-radius: 30px;
}

.icon-container-print {
    width: 28px; height: 28px; background: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; margin-right: 10px;
}

.icon-container-print svg { width: 16px; height: 16px; fill: #0056b3; }

.ghost-btn {
    padding: 10px 20px; background: #032d59; color: white; border-radius: 6px;
    text-decoration: none; font-size: 0.85rem; font-weight: bold;
}
.ghost-btn:hover { filter: brightness(1.2); }

/* ================================================================
   6. REGLAS DE LIMPIEZA Y SCROLL (VERSIÓN FINAL AFINADA)
================================================================ */

html,
body {

    margin: 0;

    padding: 0;

    width: 100%;

    max-width: 100%;

    overflow-x: hidden;

    overflow-y: auto;

    height: auto;
}

/* A. En Pantalla: Ocultamos el borrador original */
/* Esto se activa solo cuando Paged.js termina de maquetar el libro */
html.pagedjs_paginated .print-container,
body.pagedjs_paginated .print-container {
    display: none !important;
}

.chapter-opener {

    text-align: center;

    font-size: 20pt;

    line-height: 1;

    margin-top: 5px;

    margin-bottom: 1px;

    color: #936700;

    font-family: 'Gentium Book Plus', serif;

    font-weight: bold;
}

.section-title {

    text-align: center;

    font-size: 14pt;

    margin-top: 5px;

    margin-bottom: 5px;

    color: #0e4e74;

    font-weight: bold;

    letter-spacing: 1px;
}

/* =========================================================
   DROP CAPS EDITORIALES


.dropcap-start .es:first-letter {

    float: left;

    font-size: 42pt;

    line-height: 0.85;

    padding-right: 8px;

    padding-top: 6px;

    color: #0e4e74;

    font-weight: bold;

    font-family: 'Gentium Book Plus', serif;
}
========================================================= */
/* =========================================================
   DEBUG SPREADS
========================================================= */

.spread-warning {

    outline: 2px dashed #d98c00;
}

.he-layout {

    line-height: 1.1;

    direction: rtl;

    text-align: center;

    max-width: 100%;

    overflow-wrap: normal;

    word-break: keep-all;

    white-space: nowrap;
}


