body {
    font-family: Arial; 
    padding: 2rem 11rem 2rem 5rem;
    transition: background 0.3s, color 0.3s;
    margin-top: 50px;
}

@media screen and (max-width: 768px) {
  body {
    margin-top: 60px; /* ✅ Aumentado para vista móvil */
  }
}

.h1-flotante {
margin-top: 5px;    
  position: fixed;
  top: 1px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  background-color: #fff;
  padding: 8px 10px;
  border: 2px solid #000;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  font-size: 1.6rem;
  font-weight: bold;
  color: #000;
  text-align: center;

  /* ✅ CAMBIOS CLAVE */
  width: calc(80vw - 20px);    /* Ocupa casi todo el ancho visible */
  white-space: normal;          /* Permite salto de línea */
  overflow-wrap: break-word;   /* Rompe palabra si es necesario */
  word-break: break-word;      /* Asegura ajuste de palabras largas */
}

/* 🌙 Modo oscuro */
body.oscuro .h1-flotante {
  background-color: #333;
  color: #fff;
  border: 2px solid #fff; /* ✅ Borde claro de 2px */
}

/* 📱 Móviles */
@media screen and (max-width: 768px) { 
  .h1-flotante {
    margin-top: 0px;  
    font-size: 1.2rem;
    top: 8px;
    padding: 10px 10px;
    margin-right: 0px;                        /* 🟨 Margen completo: 10px arriba, abajo y lados */
    max-width: calc(80vw - 20px);       /* 🟩 Máximo ancho sin desbordar */
    white-space: normal !important;      /* ✅ Permite salto de línea */
    overflow-wrap: break-word;           /* ✅ Rompe palabras largas si es necesario */
    word-break: break-word;              /* ✅ Asegura ajuste automático */
    text-align: center;                  /* 🎯 Centra el texto si es largo */
  }
}

#indice {
    margin-bottom: 2rem;
    background: #f0f0f0;
    padding: 1rem;
    border: 1px solid #ccc;
}

.oscuro {
    background: #111;
    color: #eee;
}
.oscuro a {
    color: #80d0ff;
}

/* Botón modo oscuro flotante superior derecha */
#btn-modo-oscuro {
    position: fixed;
    top: 150px;
    right: 20px;
    z-index: 10000;
    background-color: #000;
    color: #fff;
    border: 2px solid #34aeff;
    border-radius: 50%;          /* ← circular */
    width: 45px;                 /* ← ancho fijo */
    height: 45px;                /* ← alto fijo */
    padding: 0;                  /* ← elimina padding interno */
    font-size: 1.2rem;          /* ← ajusta tamaño del icono */
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;                      /* ← elimina espacio entre icono y span */
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#btn-modo-oscuro span {
    display: none;
}

#btn-modo-oscuro:hover {
  background-color: #34aeff;
  color: #000;
  transform: scale(1.02);
}

/* 🌙 Modo oscuro - botón */
body.oscuro #btn-modo-oscuro {
  background-color: #000;
  color: #f5d200;
  border-color: #000;
  border: 1px solid #fff;
}

body.oscuro #btn-modo-oscuro:hover {
  background-color: #3f3f3f;
}

/* 📱 Móvil: botón circular sin texto */
@media screen and (max-width: 768px) {
  #btn-modo-oscuro {
    width: 35px;
    height: 35px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
    gap: 0;
  }
  #btn-modo-oscuro span {
    display: none;
  }
  #btn-modo-oscuro i {
    margin: 0;
    font-size: 1.4rem;
  }
}

/* (Resto de estilos sin cambios) */

#indice ul li a {
    background: #000;
    color: #fff;
    display: inline-block;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 5px;
    text-decoration: none;
}

/* Etiquetas por artículo */
a.etiqueta-articulo {
    margin: 3px;
    padding: 4px 8px;
    background: #0074b1;
    color: white;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

a.etiqueta-articulo:hover {
    background-color: #005f91;
    box-shadow: 0 2px 6px rgba(128, 128, 128, 0.4);
}

/* Estilos jerárquicos del índice */
#indice ul li.nivel1 {
    margin-left: 0;
    font-weight: bold;
    font-size: 1.2em;
}

#indice ul li.nivel2 {
    margin-left: 20px;
    font-weight: bold;
}

#indice ul li.nivel3 {
    margin-left: 40px;
    font-style: italic;
}

#indice ul li.nivel4 {
    margin-left: 60px;
    font-style: italic;
    font-size: 0.95em;
    color: #444;
}

#scrollTopBtn {
  position: fixed;
  bottom: 13px;
  right: 20px;
  background-color: #3f3f3f;
  color: white;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  cursor: pointer;
  display: none;
  z-index: 1999;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: background-color 0.3s;
  
  /* Centrar el ícono */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 24px; /* Tamaño del ícono */
}

#scrollTopBtn i {
  line-height: 1;   /* Evita desviaciones */
}

#scrollTopBtn:hover {
  background-color: #005a89;
}

body.oscuro #scrollTopBtn {
  background-color: #777;
  border: 1px solid #444;
  border-radius: 50%;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.oscuro #scrollTopBtn:hover {
  background-color: #4c4c4c;
}

.articulo {
  margin-top: 0em;
  margin-bottom: 0em;
  padding-top: 1em;
  border-top: 1px solid #ccc;
}

#indice ul li.nivel1 { margin-left: 0; font-weight: bold; font-size: 1.2em; }
#indice ul li.nivel2 { margin-left: 20px; font-weight: bold; }
#indice ul li.nivel3 { margin-left: 40px; font-style: italic; }
#indice ul li.nivel4 { margin-left: 60px; font-style: italic; font-size: 0.95em; color: #444; }

@media screen and (max-width: 750px) {
  body {
    font-size: 1.1rem;
    padding: 1rem;
  }
  h2, h3 { 
    font-size: 1.3rem;
  }
  button {
    font-size: 1rem;
    padding: 0.6rem 1rem;
  }
  #indice {
    padding: 0rem;
    margin-left: 5px;
    margin-right: 5px;
    padding-left: 5px;
    padding-right: 5px;
  }
  #indice ul li a {
    font-size: 1.05rem;
    padding: 6px 12px;
    margin-left: 4px;
    margin-right: 4px;
  }
  #indice ul li.nivel1 {
    font-size: 1.25rem;
    margin-left: 5px;
    margin-right: 5px;
    padding-left: 5px;
    padding-right: 5px;
  }
  #indice ul li.nivel2 {
    font-size: 1.15rem;
    margin-left: 10px;
    margin-right: 5px;
    padding-left: 5px;
    padding-right: 5px;
  }
  #indice ul li.nivel3,
  #indice ul li.nivel4 {
    font-size: 1rem;
    margin-left: 15px;
    margin-right: 5px;
    padding-left: 5px;
    padding-right: 5px;
  }
  .etiqueta-articulo {
    font-size: 1rem;
    padding: 5px 9px;
    margin: 4px 4px;
  }
  #scrollTopBtn {
    right: 5px;
    bottom:90px;
    width: 54px;
    height: 54px;
    font-size: 1.4rem;
    background-color: #3f3f3f;
  }
  body.oscuro #scrollTopBtn {
    border: 2px solid #0074b1;
    background-color: #4c4c4c;
  }
}

mark.resaltado {
  background-color: #b7ffb7;
  color: #000;
  font-weight: bold;
  padding: 0 2px;
  border-radius: 1px;
}

/* Buscador flotante */
#buscador-flotante {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  align-items: center;
  background-color: #0074b1;
  border: 2px solid #34aeff;
  border-radius: 50px;
  padding: 0px 10px;
  transition: width 0.3s ease, background 0.3s ease;
  overflow: hidden;
}

#buscador-flotante input {
  width: 0;
  opacity: 0;
  margin-left: 8px;
  font-size: 1.3rem;
  padding: 10px 2px;
  border: 1px solid #ccc;
  border-radius: 6px;
  transition: width 0.3s ease, opacity 0.3s ease;
}

#buscador-flotante.abierto {
  border-radius: 10px;
}

#buscador-flotante.abierto input {
  width: 400px;
  opacity: 1;
}

#buscador-flotante button {
  background-color: #000;
  border: 2px solid #34aeff;
  color: #34aeff;
  font-size: 2.0rem;
  padding: 6px 12px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, transform 0.2s ease;
  width: 30px;
  height: 30px;
  min-width: 30px;
}

#buscador-flotante button:hover {
  background-color: #fff;
  color: #000;
  transform: scale(1.1);
}

@media (max-width: 600px) {
  #buscador-flotante {
    top: auto;
    bottom: 20px;
    left: auto;
    right: 16px;
    width: auto;
    max-width: 60px;
    padding: 0px 7px;
    border-radius: 50%;
    justify-content: center;
  }
  #buscador-flotante.abierto {
    left: 10px;
    right: 10px;
    max-width: none;
    width: auto;
    padding: 0px 8px;
    border-radius: 10px;
    justify-content: flex-start;
  }
  #buscador-flotante.abierto input {
    width: 100%;
  }
}

/* Ajuste para que el botón modo oscuro no se superponga en móvil */
@media screen and (max-width: 768px) { 
  #buscador-flotante {
    top: auto;
    bottom: 20px;
    right: 5px;
	width: 38px;
    height: 51px;
  }
  #btn-modo-oscuro {
    bottom: auto;
    top: 80px; /* Separación del buscador */
    right: 5px;
  }
}

body.oscuro #indice {
  background: #787775;
  border-color: #444;
}

.reforma-dof {
    font-style: italic;
    font-size: 0.85rem;
    color: #c0392b;
    text-align: right;
    display: block;
    margin-top: 0.3em;
    margin-bottom: 0.3em;
}

.hr-separador {
    margin-top: 1.5em;
    margin-bottom: 1.3em;
}

mark.resaltado.verde { background-color: #27ae60; color: #fff; }
mark.resaltado.amarillo { background-color: #f1c40f; color: #000; }
mark.resaltado.rojo { background-color: #e74c3c; color: #fff; }
mark.resaltado.azul { background-color: #3498db; color: #fff; }

.custom-button {
  display: inline-block;
  border-radius: 8px;
  background-color: #000;
  color: #fff !important;
  font-size: 20px;
  padding: 5px 10px;
  text-decoration: none;
  margin: 5px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  border: 1px solid transparent;
}
.custom-button:link {
  color: #fff !important;
}
.custom-button:visited {
  color: #fff !important;
}
.custom-button:hover {
  background: #cc0028;
  border-color: white;
}
.custom-button:active {
  background-color: #cc0028;
  color: #fff !important;
  box-shadow: none;
  transform: translateY(2px);
  border-color: white;
}
.title-shadow {
  color: black;
  text-shadow: 2px 2px 4px white, -2px -2px 4px white, 2px -2px 4px white, -2px 2px 4px white;
  font-size: 26px;
}
.custom-container {
  background: #00aaff;
  border: 2px solid #565f62;
  padding: 7px;
  border-radius: 4px;
  text-align: center;
  margin: 2px;
}

.logo-T {
  position: fixed;
  bottom: 30px;
  left: 80px;
  height: auto;
  z-index: 999;
  opacity: 1;
  padding: 5px;
  background: #fff;
  border: 2px solid #000;
  border-radius: 5px;
  transition: opacity 0.5s ease, visibility 0.5s ease, transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.logo-T2 {
  width: 80px;
  border-radius: 50px;
  padding: 0px;
}

.logo-T1 {
  width: 180px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.logo-T:hover {
  transform: scale(1.03);
  opacity: 1;
}

body.oscuro .logo-T {
  background: #333;
  border-color: #aaa;
  filter: brightness(0.95) contrast(1.1);
}

@media screen and (max-width: 768px) {
  .logo-T1 {
    bottom: 20px;
    left: 20px;
    right: auto;
    width: 200px;
  }
  .logo-T2 {
    bottom: 20px;
    left: 20px;
    right: auto;
    width: 80px;
  }
}

.logo-Themis {
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: 80px;
  height: 120px;
  padding: 5px;
  border: 1px solid #000;
  border-radius: 5px;
  background-color: #fff;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

body.oscuro .logo-Themis {
  background-color: #333;
  border-color: #aaa;
}

@media screen and (max-width: 767px) {
  .logo-Themis {
    display: none !important;
  }
}

#menu-compartir {
  position: absolute;
  display: none;
  background: #ffffff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 0px 20px !important;
  margin: 0px 0px !important;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  z-index: 9999;
  font-family: Arial, sans-serif;
  pointer-events: auto;
}

.com-r {
  font-size: 18px;
  margin: 5px 0;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

#menu-compartir a {
  text-decoration: none;
  padding: 5px !important;
  background-color: #333 !important;
  border-radius: 50% !important;
  width: 20px;
  height: 20px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: white !important;
  font-size: 18px;
  transition: background-color 0.3s ease;
}

#share-x:hover        { background-color: #000000 !important; }
#share-fb:hover       { background-color: #1877f2 !important; }
#share-wa:hover       { background-color: #25D366 !important; }
#share-ms:hover       { background-color: #0078FF !important; }
#share-tg:hover       { background-color: #0088cc !important; }
#share-ln:hover       { background-color: #0A66C2 !important; }
#share-tb:hover       { background-color: #36465D !important; }
#share-gmail:hover    { background-color: #D44638 !important; }
#share-outlook:hover  { background-color: #0072C6 !important; }
#share-notas:hover    { background-color: #ffa500 !important; }

body.oscuro #menu-compartir {
  background-color: #222;
  border-color: #555;
  border: 1px solid #009cf1;
}

#modal-notas {
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  background: #fff;
  border: 2px solid #000;
  padding: 20px;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  display: none;
  border-radius: 10px;
}

body.oscuro #modal-notas {
  background-color: #222;
  color: #eee;
  border-color: #fff;
}

#modal-notas .contenido-modal h2 {
  margin-top: 0;
  font-size: 1.3rem;
}

#btn-articulos-modal { 
    position: fixed;
    top: 80px;
    right: 20px;
    background-color: #000;
    color: white;
    border: 2px solid #34aeff;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 24px;
    cursor: pointer;
    z-index: 1998;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: background-color 0.3s, opacity 0.4s ease, visibility 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    opacity: 0;
    visibility: hidden;
}

#btn-articulos-modal.visible {
    opacity: 1;
    visibility: visible;
}

#btn-articulos-modal:hover {
    background-color: #005a89;
}

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
}

.modal-contenido {
    background-color: #fefefe;
    margin: 1% auto;
    padding: 7px;
    border: 2px solid #0074b1;
    border-radius: 10px;
    width: 80%;
    max-width: 800px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    position: relative;
}

.cerrar-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: sticky;
    top: 0;
    background: #fefefe;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cerrar-modal:hover,
.cerrar-modal:focus {
    color: black;
    text-decoration: none;
}

.lista-articulos-modal {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.lista-articulos-modal .etiqueta-articulo {
    margin: 2px;
    font-size: 1rem;
}

body.oscuro .modal-contenido {
    background-color: #222;
    border-color: #555;
    color: #eee;
}

body.oscuro .cerrar-modal {
    color: #ccc;
    background-color: #222;
}

body.oscuro .cerrar-modal:hover {
    color: #fff;
}

@media screen and (max-width: 768px) {
    #btn-articulos-modal {
        top: auto;
        bottom: 160px;
        right: 5px;
        width: 54px;
        height: 54px;
        font-size: 28px;
    }
    .modal-contenido {
        width:85%;
        height: auto;
        margin-top: 75px;
        margin-bottom: 20px;
        padding: 10px 5px;   /* ← nuevo: 10px arriba/abajo, 5px laterales */
    }
}

/* Aplica un margen superior de 20px al hacer scroll a cualquier elemento con ID (ancla) */
/* Escritorio */
:target {
  scroll-margin-top: 70px;
}

/* Móvil */
@media screen and (max-width: 768px) {
  :target {
    scroll-margin-top: 50px;
  }
}

.bloque-articulo {
    margin-bottom: 0rem; /* Espacio entre un artículo completo y el siguiente */
    padding-top: 20px;
	padding-bottom: 0px;
}

.articulo {
    border-top: 1px solid #eee; /* La línea divisoria ahora es más sutil */
    padding-top: 15px;
	padding-bottom: 0px;
    margin-bottom: 0rem; /* Menos espacio con sus propios párrafos hijos */
}

.articulo strong {
    color: #0074b1; /* Color distintivo para "Artículo X" */
}

/* 1. Modo oscuro: color especial para "Artículo X" */
body.oscuro .articulo strong {
    color: #00aaff;
}

/* 2. Ajustes para móvil: espacios más reducidos */
@media screen and (max-width: 768px) {
    .bloque-articulo {
        padding-top: 0px;      /* antes 20px → más compacto */
        margin-bottom: 0px;
        padding-bottom: 0px;
    }

    .articulo {
        border-top: 1px solid #ccc;   /* línea sutil pero visible */
        padding-top: 15px; 
        padding-bottom: 15px;		
        margin-bottom: 0;
    }

    /* Opcional: si los párrafos internos también tienen margen extra */
    .articulo p {
        margin-bottom: 0px;        /* ajusta según necesidad */
        margin-top: 0px;
    }
}