/* ==========================================================================
   PORTAL CONSTITUCIONAL DE VENEZUELA - BLOQUE CONSTITUCIONAL
   Estilos Institucionales, Modernos y 100% Responsivos
   ========================================================================== */

:root {
  /* Paleta Institucional */
  --primary-navy: #0a192f;
  --navy-dark: #07111e;
  --navy-light: #172a45;
  --gold: #c5a059;
  --gold-dark: #9e7d3b;
  --gold-light: #dfc282;
  --gold-subtle: rgba(197, 160, 89, 0.12);
  --gold-glow: rgba(197, 160, 89, 0.25);
  
  /* Sistema de Colores Base (Modo Claro) */
  --bg-page: #f4f6f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-surface-alt: #edf2f7;
  --border-subtle: #e2e8f0;
  --border-card: #e5e9f0;
  
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --text-heading: #0a192f;
  
  /* Acentos de Redes Sociales */
  --whatsapp-color: #25d366;
  --whatsapp-hover: #1ebd5b;
  --twitter-color: #0f1419;
  --facebook-color: #1877f2;
  --share-btn-bg: #f7fafc;
  
  /* Tipografia */
  --font-serif: 'Merriweather', 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-title: 'Cinzel', 'Merriweather', Georgia, serif;
  
  /* Tamano de fuente ajustable */
  --reading-font-size: 1.0625rem; /* 17px */
  --reading-line-height: 1.8;
  
  /* Sombras y Transiciones */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px -3px rgba(10,25,47,0.08), 0 4px 6px -2px rgba(10,25,47,0.04);
  --shadow-gold: 0 0 15px rgba(197, 160, 89, 0.2);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
}

/* Modo Oscuro (Medianoche Constitucional) */
body.theme-dark {
  --bg-page: #070d18;
  --bg-surface: #0f1c2e;
  --bg-surface-elevated: #16263d;
  --bg-surface-alt: #132237;
  --border-subtle: #1e334f;
  --border-card: #1c304a;
  
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-heading: #f8fafc;
  
  --gold: #d4af37;
  --gold-dark: #b8952b;
  --gold-light: #e8c763;
  --gold-subtle: rgba(212, 175, 55, 0.15);
  --gold-glow: rgba(212, 175, 55, 0.3);
  
  --share-btn-bg: #16263d;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 10px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
}

/* Modo Sepia (Pergamino de Lectura) */
body.theme-sepia {
  --bg-page: #fbf7ee;
  --bg-surface: #f4ecdc;
  --bg-surface-elevated: #ede2cd;
  --bg-surface-alt: #e8ddc7;
  --border-subtle: #dfd2b9;
  --border-card: #d9cbaf;
  
  --text-primary: #382c1e;
  --text-secondary: #5c4b37;
  --text-muted: #826e56;
  --text-heading: #241a10;
  
  --gold: #9e7529;
  --gold-dark: #7a5818;
  --gold-light: #ba9343;
  --gold-subtle: rgba(158, 117, 41, 0.12);
  --gold-glow: rgba(158, 117, 41, 0.25);
  
  --share-btn-bg: #ece2ce;
}

/* Reset y Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color var(--transition-base), color var(--transition-base);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Scrollbars personalizadas y elegantes para todo el portal */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: var(--bg-surface-alt);
}

::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dark) var(--bg-surface-alt);
}

/* Barra de Identidad Nacional Superior */
.top-tricolor {
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, #FDD116 0%, #FDD116 33.3%, #0038A8 33.3%, #0038A8 66.6%, #CE1126 66.6%, #CE1126 100%);
  position: sticky;
  top: 0;
  z-index: 1001;
}

/* HEADER Y NAVEGACION PRINCIPAL */
.site-header {
  background-color: var(--primary-navy);
  color: #ffffff;
  border-bottom: 1px solid rgba(197, 160, 89, 0.3);
  position: sticky;
  top: 4px;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.header-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: #ffffff;
}

.brand-logo {
  height: 42px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1.2;
}

.brand-title span.gold-text {
  color: var(--gold-light);
}

.brand-subtitle {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Acciones en la cabecera (Escritorio) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-header-action {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-header-action:hover {
  background: rgba(197, 160, 89, 0.2);
  border-color: var(--gold);
  color: var(--gold-light);
}

.btn-header-action.active {
  background: var(--gold);
  color: var(--navy-dark);
  border-color: var(--gold-light);
  font-weight: 600;
}

.header-mobile-toggle {
  display: none;
}

/* HERO CONSTITUCIONAL Y BUSCADOR */
.hero-constitutional {
  background: linear-gradient(135deg, #07111e 0%, #0a192f 50%, #112240 100%);
  color: #ffffff;
  padding: 2.75rem 1.25rem 2.25rem;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid rgba(197, 160, 89, 0.2);
}

.hero-constitutional::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(circle at 50% 20%, rgba(197, 160, 89, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.hero-inner {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 2;
}

.hero-crest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(197, 160, 89, 0.15);
  border: 1px solid var(--gold);
  color: var(--gold-light);
  font-size: 1.4rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-gold);
}

.hero-heading {
  font-family: var(--font-title);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.hero-subheading {
  font-size: 0.98rem;
  color: rgba(255, 255, 255, 0.8);
  max-width: 680px;
  margin: 0 auto 1.75rem;
  font-weight: 300;
}

/* CAJA DE BUSQUEDA EN TIEMPO REAL */
.search-wrapper {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
}

.search-box-main {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.5rem 0.35rem 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 0 2px rgba(197, 160, 89, 0.4);
  transition: all var(--transition-base);
}

.search-box-main:focus-within {
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45), 0 0 0 3px var(--gold);
  transform: translateY(-1px);
}

.search-icon {
  color: var(--gold-dark);
  font-size: 1.25rem;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: #1a202c;
  background: transparent;
  padding: 0.5rem 0;
  width: 100%;
}

.search-input::placeholder {
  color: #8c9ba5;
  font-size: 0.95rem;
}

.search-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.btn-search-clear {
  background: #edf2f7;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #718096;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition-fast);
}

.btn-search-clear:hover {
  background: #e2e8f0;
  color: #2d3748;
}

.search-badge-hint {
  display: none;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

@media (min-width: 768px) {
  .search-badge-hint { display: inline-block; }
}

/* Accesos rapidos bajo el buscador */
.quick-tags-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.quick-tag-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 0.25rem;
}

.quick-tag-btn {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.quick-tag-btn:hover, .quick-tag-btn.active {
  background: var(--gold);
  border-color: var(--gold-light);
  color: var(--navy-dark);
  font-weight: 600;
}

/* ESTRUCTURA PRINCIPAL */
.main-app-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  flex: 1;
  width: 100%;
}

.app-grid {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 1.75rem;
  align-items: start;
}

/* BARRA LATERAL (SIDEBAR TOC) */
.sidebar-toc {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1rem 1.25rem;
  background: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-subtle);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-count-badge {
  background: var(--gold-subtle);
  color: var(--gold-dark);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--gold);
}

.toc-list {
  list-style: none;
  padding: 0.5rem 0;
}

.toc-item {
  border-bottom: 1px solid var(--border-subtle);
}

.toc-item:last-child {
  border-bottom: none;
}

.toc-link {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.86rem;
  transition: all var(--transition-fast);
}

.toc-link:hover {
  background: var(--gold-subtle);
  color: var(--gold-dark);
  padding-left: 1.25rem;
}

.toc-link.active {
  background: var(--gold-subtle);
  color: var(--gold-dark);
  font-weight: 700;
  border-left: 3px solid var(--gold);
}

.toc-badge {
  flex-shrink: 0;
  background: var(--primary-navy);
  color: var(--gold-light);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-family: var(--font-serif);
}

.toc-text {
  flex: 1;
  line-height: 1.35;
}

.toc-range {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* PANEL DE LECTURA Y HERRAMIENTAS */
.reading-toolbar {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.toolbar-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.toolbar-status strong {
  color: var(--text-heading);
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-tool {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.btn-tool:hover {
  background: var(--gold-subtle);
  border-color: var(--gold);
  color: var(--gold-dark);
}

.btn-reset-filter {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: none;
}

.btn-reset-filter:hover {
  background: #fecaca;
}

/* Botón flotante para abrir el índice en móvil */
.btn-mobile-toc-floating {
  display: none;
  background: var(--primary-navy);
  color: var(--gold-light);
  border: 1px solid var(--gold);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

/* TARJETAS DE ARTICULOS */
.articles-feed {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.article-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-left: 4px solid var(--primary-navy);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-left-color var(--transition-fast);
  position: relative;
}

.article-card:hover {
  box-shadow: var(--shadow-md);
  border-left-color: var(--gold);
}

.article-card.highlight-target {
  border-left: 5px solid var(--gold);
  box-shadow: 0 0 20px var(--gold-glow), var(--shadow-md);
  animation: pulseGold 2s ease-in-out;
}

@keyframes pulseGold {
  0% { transform: scale(1); background-color: var(--bg-surface); }
  50% { transform: scale(1.01); background-color: var(--gold-subtle); }
  100% { transform: scale(1); background-color: var(--bg-surface); }
}

.article-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.article-badge-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.article-badge {
  background: var(--primary-navy);
  color: #ffffff;
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(197, 160, 89, 0.4);
}

.article-badge span.num {
  color: var(--gold-light);
  font-weight: 800;
}

.article-location {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.article-location strong {
  color: var(--text-secondary);
}

/* CUERPO DEL ARTICULO */
.article-body {
  font-family: var(--font-serif);
  font-size: var(--reading-font-size);
  line-height: var(--reading-line-height);
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.article-body p {
  margin-bottom: 0.75rem;
}

.article-body p:last-child {
  margin-bottom: 0;
}

mark.gold-highlight {
  background-color: #fef08a;
  color: #713f12;
  padding: 0 0.2rem;
  border-radius: 2px;
  font-weight: 700;
}

body.theme-dark mark.gold-highlight {
  background-color: #854d0e;
  color: #fef08a;
}

/* BARRA DE ACCIONES Y COMPARTIR */
.article-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border-subtle);
}

.share-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.share-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 0.25rem;
}

.btn-share {
  background: var(--share-btn-bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-share:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-share.btn-share-whatsapp:hover {
  background: var(--whatsapp-color);
  border-color: var(--whatsapp-color);
  color: #ffffff;
}

.btn-share.btn-share-twitter:hover {
  background: #000000;
  border-color: #000000;
  color: #ffffff;
}

.btn-share.btn-share-facebook:hover {
  background: var(--facebook-color);
  border-color: var(--facebook-color);
  color: #ffffff;
}

.btn-action-text {
  background: var(--share-btn-bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
  font-weight: 500;
}

.btn-action-text:hover {
  background: var(--gold-subtle);
  border-color: var(--gold);
  color: var(--gold-dark);
  transform: translateY(-1px);
}

.btn-action-text.btn-card-generator {
  background: var(--primary-navy);
  color: var(--gold-light);
  border-color: rgba(197, 160, 89, 0.4);
}

.btn-action-text.btn-card-generator:hover {
  background: var(--gold);
  color: var(--navy-dark);
}

/* SECCIONES ESPECIALES */
.special-section-card {
  background: var(--bg-surface);
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  position: relative;
}

.special-card-header {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gold-subtle);
}

.special-card-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--gold-dark);
  letter-spacing: 1px;
}

.preambulo-text {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.9;
  text-align: justify;
  color: var(--text-primary);
  font-style: italic;
  position: relative;
  padding: 0 1rem;
}

.preambulo-text::before {
  content: '\201C';
  font-family: Georgia, serif;
  font-size: 3rem;
  color: var(--gold);
  opacity: 0.4;
  line-height: 0;
  vertical-align: -0.4em;
  margin-right: 0.2rem;
}

.preambulo-text::after {
  content: '\201D';
  font-family: Georgia, serif;
  font-size: 3rem;
  color: var(--gold);
  opacity: 0.4;
  line-height: 0;
  vertical-align: -0.4em;
  margin-left: 0.2rem;
}

/* Disposiciones */
.transitoria-item {
  padding: 1rem;
  border-left: 3px solid var(--gold);
  background: var(--bg-surface-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1rem;
}

.transitoria-title {
  font-weight: 700;
  color: var(--gold-dark);
  margin-bottom: 0.35rem;
  font-family: var(--font-title);
}

/* MODAL TARJETA SOCIAL (SIN SCROLLBAR MOLESTA + ESTILIZADO) */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(7, 17, 30, 0.82);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--gold);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  animation: modalPop 0.25s ease-out;
  overflow: hidden;
}

@keyframes modalPop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 1rem 1.25rem;
  background: var(--primary-navy);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(197, 160, 89, 0.3);
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.35rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.modal-body {
  padding: 1.25rem;
  text-align: center;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.canvas-preview-wrap {
  margin: 0 auto 1.25rem;
  max-width: 100%;
  max-height: 56vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-subtle);
  background: #0a192f;
}

#socialCardCanvas {
  max-width: 100%;
  max-height: 54vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  width: 100%;
  flex-shrink: 0;
}

.btn-modal-action {
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-share-image {
  background: linear-gradient(135deg, var(--gold) 0%, #d4af37 100%);
  color: var(--navy-dark);
  font-weight: 700;
  border: 1px solid var(--gold-light);
  box-shadow: 0 4px 15px rgba(197, 160, 89, 0.35);
}

.btn-share-image:hover {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(197, 160, 89, 0.45);
}

.btn-download-image {
  background: var(--primary-navy);
  color: var(--gold-light);
  border: 1px solid var(--gold);
  font-weight: 600;
}

.btn-download-image:hover {
  background: var(--navy-light);
  border-color: var(--gold-light);
  transform: translateY(-2px);
}

.btn-copy-image {
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  font-weight: 600;
}

.btn-copy-image:hover {
  background: var(--border-subtle);
  transform: translateY(-2px);
}

.x-logo-svg {
  fill: currentColor;
  display: inline-block;
  vertical-align: middle;
}

/* DRAWER / MENU LATERAL MOVIL */
.mobile-drawer-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(7, 17, 30, 0.75);
  backdrop-filter: blur(4px);
  z-index: 2500;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mobile-drawer-backdrop.open {
  display: block;
  opacity: 1;
}

.mobile-drawer-content {
  position: fixed;
  top: 0;
  left: -320px;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--bg-surface);
  z-index: 2600;
  display: flex;
  flex-direction: column;
  box-shadow: 5px 0 25px rgba(0,0,0,0.5);
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-drawer-backdrop.open .mobile-drawer-content {
  left: 0;
}

.mobile-drawer-header {
  padding: 1.1rem 1.25rem;
  background: var(--primary-navy);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(197, 160, 89, 0.3);
}

.drawer-logo {
  height: 32px;
  width: auto;
}

.drawer-title {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--gold-light);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.btn-drawer-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.mobile-drawer-body {
  padding: 1rem 0;
  overflow-y: auto;
  flex: 1;
}

.drawer-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  padding: 0 1.25rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.drawer-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0 1rem;
}

.drawer-action-btn {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.drawer-action-btn:hover {
  background: var(--gold-subtle);
  border-color: var(--gold);
  color: var(--gold-dark);
}

/* TOAST NOTIFICATION */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--primary-navy);
  color: #ffffff;
  border: 1px solid var(--gold);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.9rem;
  animation: toastSlideIn 0.3s ease-out;
}

.toast i {
  color: var(--gold-light);
  font-size: 1.1rem;
}

@keyframes toastSlideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* FOOTER */
.site-footer {
  background: var(--primary-navy);
  color: #ffffff;
  border-top: 1px solid rgba(197, 160, 89, 0.3);
  padding: 2.5rem 1.25rem 1.5rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  align-self: flex-start;
}

.footer-desc {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  max-width: 450px;
}

.footer-heading {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--gold-light);
  margin-bottom: 0.85rem;
  letter-spacing: 0.5px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.footer-links a:hover {
  color: var(--gold-light);
  padding-left: 4px;
}

.footer-bottom {
  max-width: 1320px;
  margin: 0 auto;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ESTADOS VACIOS */
.empty-results {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-subtle);
}

.empty-icon {
  font-size: 2.5rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.empty-title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--text-heading);
  margin-bottom: 0.5rem;
}

.empty-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.btn-back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-navy);
  color: var(--gold-light);
  border: 1px solid var(--gold);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  z-index: 999;
  transition: all var(--transition-fast);
}

.btn-back-to-top:hover {
  background: var(--gold);
  color: var(--navy-dark);
  transform: translateY(-3px);
}

.btn-back-to-top.show {
  display: flex;
}

/* ==========================================================================
   ADAPTACION RESPONSIVA (SMARTPHONES Y TABLETS)
   ========================================================================== */
@media (max-width: 991px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
  .sidebar-toc {
    display: none; /* Se visualiza a través del botón flotante y menú drawer en móviles */
  }
  .btn-mobile-toc-floating {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
  }
  .desktop-only {
    display: none !important;
  }
  .header-mobile-toggle {
    display: block;
  }
}

@media (max-width: 768px) {
  .hero-constitutional {
    padding: 2rem 1rem 1.75rem;
  }
  .hero-heading {
    font-size: 1.35rem;
    line-height: 1.3;
  }
  .hero-subheading {
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
  }
  .brand-logo {
    height: 36px;
  }
  .brand-title {
    font-size: 1rem;
  }
  .brand-subtitle {
    font-size: 0.65rem;
  }
  .search-box-main {
    padding: 0.25rem 0.5rem 0.25rem 1rem;
  }
  .search-input {
    font-size: 0.95rem;
  }
  .quick-tags-container {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    width: 100%;
  }
  .quick-tags-container::-webkit-scrollbar {
    height: 3px;
  }
  .main-app-container {
    padding: 1rem 0.75rem 2.5rem;
  }
  .article-card {
    padding: 1.15rem 1rem;
  }
  .article-badge {
    font-size: 0.85rem;
    padding: 0.25rem 0.65rem;
  }
  .article-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .share-group {
    justify-content: space-between;
    width: 100%;
  }
  .btn-action-text {
    flex: 1;
    justify-content: center;
  }
  .reading-toolbar {
    padding: 0.65rem 0.85rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .toolbar-status {
    font-size: 0.82rem;
    justify-content: space-between;
  }
  .toolbar-controls {
    justify-content: space-between;
    width: 100%;
  }
  .footer-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .modal-actions {
    flex-direction: column;
  }
  .btn-modal-action {
    width: 100%;
  }
  .toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }
  .toast {
    width: 100%;
    justify-content: center;
  }
}
