/* =========================
   base_step1.css (LIMPIO)
   ========================= */

/* ---------- Variables ---------- */
:root{
  --text: #111;
  --muted: #444;
  --link: #1a73e8;
}

/* ---------- Reset básico ---------- */
html, body{ margin:0; padding:0; }

/* ---------- Texto general ---------- */
body{
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  line-height: 1.6;
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  background: #fff;
}

p{
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

a{
  color: var(--link);
  text-decoration: none;
}
a:hover{ text-decoration: underline; }

/* ---------- Vista “hoja” en pantallas grandes ---------- */
@media (min-width: 992px){
  body{
    background: #f3f3f3;
    max-width: 210mm;
    margin: 14mm auto;
    padding: 22mm;
    border: 1px solid #e7e7e7;
    box-shadow: 0 10px 28px rgba(0,0,0,.12);
  }
}

@media print{
  body{
    max-width: none;
    margin: 0;
    padding: 18mm;
    border: none;
    box-shadow: none;
    background: #fff;
  }
}

/* =========================
   Figuras y tablas numeradas
   ========================= */
body{ counter-reset: fig tbl; }

/* FIGURAS */
figure{
  counter-increment: fig;
  margin: 1.1rem 0;
  text-align: center;
}

figure > figcaption::before{
  content: "Figura " counter(fig) ". ";
  font-weight: 700;
}

figure img{
  max-width: 75%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* imágenes fuera de <figure> */
img{
  max-width: 100%;
  height: auto;
}

/* TABLAS: numeración + estilo 3 líneas */
table{
  counter-increment: tbl;
  border-collapse: collapse;
  width: auto;
  margin: 1.2em auto;
  border: none;
  max-width: 85%;
  font-size: 1rem;          /* mismo tamaño que el cuerpo */
}

th, td{
  border: none;
  padding: 6px 10px;
  font-size: 1rem;
}

/* Caption */
table > caption{
  caption-side: top;
  text-align: justify;
  font-size: 1rem;
  line-height: 1.35;
  margin: 0 0 0.35em 0;
  color: #111;
  padding-left: 0;
}

table > caption::before{
  content: "Tabla " counter(tbl) ". ";
  font-weight: 700;
}

/* 3 líneas editorial */
thead th{ border-top: 2px solid #111; }
thead tr:last-child th{ border-bottom: 1px solid #111; }
tbody tr:last-child td{ border-bottom: 2px solid #111; }

/* =========================
   Encabezados de secciones
   ========================= */
/* Línea SOLO en secciones principales (no el título del artículo) */
h1:not(.title){
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.35em;
  margin-bottom: 0.8em;
  font-size: 1.40rem;
}

h2{ font-size: 1.20rem; }
h3{ font-size: 1rem; }

/* Numeración de secciones (Pandoc) */
span.header-section-number{
  display: inline !important;
  margin-right: 0.45em;
  font-weight: 700;
}

/* =========================
   Citas (APA / citeproc)
   ========================= */
span.citation a[role="doc-biblioref"]{
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
}
span.citation a[role="doc-biblioref"]:hover{
  text-decoration: underline;
}

/* =========================
   Header de la revista (logo + datos)
   ========================= */
   #journal-header{
     display: flex;
     align-items: center;
     gap: 20px;
     padding: 10px 0 14px 0;
     margin: 0 0 12px 0;
     border-bottom: 1px solid #ddd;
   }

   #journal-header .jh-left{ flex: 0 0 auto; }
   #journal-header .jh-right{
     flex: 1 1 auto;
     text-align: right;
     line-height: 1.2;
   }

   #journal-header .jh-logo{
     height: 80px !important;
     width: auto !important;
     max-height: none !important;
     display: block;
   }

   #journal-header .jh-journal{
     font-weight: 800;
     font-size: 1.05rem;
   }
   #journal-header .jh-issue{
     font-weight: 600;
     font-size: 0.95rem;
     margin-top: 2px;
   }
   #journal-header .jh-meta,
   #journal-header .jh-doi{
     font-size: 0.85rem;
     color: #444;
     margin-top: 2px;
   }

   @media (max-width: 620px){
     #journal-header{
       flex-direction: column;
       align-items: flex-start;
     }
     #journal-header .jh-right{ text-align: left; }
   }

/* =========================
   Title block (títulos + autores + afiliación)
   ========================= */
#title-block-header{
  text-align: center;
  border: none;
  margin: 0 0 1.2rem 0;
  padding: 0 0 0.65em 0;
}

/* ✅ Importante: no dependemos de <br> */
header#title-block-header h1.title br{ display:none; }

/* Apaga tamaño base del h1 para controlar por bloques */
header#title-block-header h1.title{
  font-size: 0 !important;
  line-height: 1.25 !important;
  margin: 0 !important;
}

/* 1) Tipo de artículo (primer em) */
header#title-block-header h1.title > em:first-of-type{
  display: block !important;
  font-size: 14px !important;
  font-style: italic !important;
  font-weight: 400 !important;
  margin: 0 0 8px 0 !important;
  color: #555 !important;
}

/* 2) Título principal (strong) */
header#title-block-header h1.title > strong{
  display: block !important;
  font-size: 28px !important;
  font-weight: 800 !important;
  margin: 0 0 10px 0 !important;   /* espacio entre ES y EN */
  color: #111 !important;
  line-height: 1.22 !important;
}

/* 3) Título en inglés (último em directo del h1) */
header#title-block-header h1.title > em:last-of-type{
  display: block !important;
  font-size: 20px !important;
  font-style: italic !important;
  font-weight: 400 !important;
  margin: 0 0 30px 0 !important;   /* ✅ AQUÍ: espacio entre EN y autores */
  color: #444 !important;
}

/* Mantiene itálicas internas dentro del inglés sin cambiar tamaño */
header#title-block-header h1.title > em:last-of-type em{
  font-size: inherit !important;
  font-style: italic !important;
}

/* Autor */
#title-block-header p.author{
  display: block !important;
  margin: 10px 0 2px 0 !important;
  font-size: 1rem !important;
  line-height: 1.2 !important;
  text-align: center !important;
}

/* Afiliación (cuando está como p.affiliation o .affiliation) */
#title-block-header p.affiliation,
#title-block-header .affiliation,
.affiliation{
  margin: 8px 0 12px 0 !important;
  text-align: center !important;
  font-size: 0.88rem !important;
  line-height: 1.25 !important;
  color: #444 !important;
}

/* Superíndices */
#title-block-header sup{
  font-size: 0.7em;
  vertical-align: super;
  line-height: 0;
}

/* Ocultar el "2" suelto (paracol) si Pandoc lo mete como primer <p> */
div.paracol > p:first-child{
  display: none !important;
}

/* ===============================
   Bloque editorial (Recibido, Aceptado, etc.)
   =============================== */
.paracol{
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  margin: 15px 0 25px 0;
}
.paracol strong{ font-weight: 600; }
.paracol a{
  font-size: 13px;
  color: #555;
}
.paracol p{ margin: 6px 0; }

/* Resumen/Abstract como texto normal */
#abstract,
.abstract,
div.abstract,
section.abstract,
#resumen,
.resumen{
  font-size: 1rem !important;
  line-height: 1.6 !important;
  color: var(--text);
}

/* Resumen/Abstract sin numeración si viene como h1.unnumbered */
h1.unnumbered::before{
  content: none !important;
  counter-increment: none !important;
}

/* Tipo de artículo cuando Pandoc lo pone como <span> */
header#title-block-header h1.title > span:first-of-type{
  display: block !important;
  font-size: 14px !important;
  font-style: italic !important;
  font-weight: 400 !important;
  margin: 0 0 8px 0 !important;
  color: #111 !important;
}

/* Superíndice ¹ después del nombre (solo si hay UN autor) */
#title-block-header p.author:only-of-type::after{
  content: "1";
  font-size: 0.70em;
  vertical-align: super;
  line-height: 0;
  margin-left: 0.15em;
  color: #444;
}

@media (max-width: 768px){

  figure {
    margin: 1.2rem 0;
  }

  figure img {
    width: 100% !important;     /* ocupa todo el ancho del móvil */
    max-width: 100% !important;
  }

  figcaption {
    font-size: 0.95rem;         /* un poco más grande para lectura */
    line-height: 1.35;
  }
}
