/* ============================================
   EL CÓDICE CELESTIAL - Modern Hermetic Theme
   Sobrescritura visual completa sin tocar HTML
   ============================================ */

/* ─── Variables de Paleta ─── */
:root {
  --ch-color-bg: #050505;
  --ch-color-bg-deep: #0A0E14;
  --ch-color-gold: #C5A059;
  --ch-color-gold-bright: #D4AF37;
  --ch-color-gold-dim: #8B734B;
  --ch-color-text: #E0E0E0;
  --ch-color-text-muted: #9E9E9E;
  --ch-color-border: rgba(197, 160, 89, 0.25);
  --ch-color-border-strong: rgba(197, 160, 89, 0.55);
  --ch-glass-bg: rgba(14, 11, 7, 0.62);
  --ch-glass-blur: blur(8px);
  --ch-font-title: 'Cinzel', 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
  --ch-font-body: 'Crimson Pro', 'EB Garamond', 'Montserrat', 'Lato', Georgia, serif;
  --ch-transition-fast: 0.25s ease;
  --ch-transition-slow: 0.6s ease;
}

/* ─── Reset de fondo y tipografía base ─── */
html {
  background-color: var(--ch-color-bg) !important;
  color: var(--ch-color-text) !important;
  scroll-behavior: smooth;
}

body {
  background-color: transparent !important;
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(197, 160, 89, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(100, 120, 180, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(10, 14, 20, 0.8) 0%, var(--ch-color-bg) 100%) !important;
  color: var(--ch-color-text) !important;
  font-family: var(--ch-font-body) !important;
  font-size: 17px !important;
  line-height: 1.75 !important;
  letter-spacing: 0.015em;
  overflow-x: hidden;
}

/* ─── Tipografía de títulos ─── */
h1, h2, h3, h4, h5, h6,
[data-heading="true"],
[class*="heading"],
[class*="title"] {
  font-family: var(--ch-font-title) !important;
  color: var(--ch-color-gold) !important;
  font-weight: 500 !important;
  letter-spacing: 0.04em !important;
  text-shadow: 0 0 40px rgba(197, 160, 89, 0.15);
}

h1 { font-size: 2.4rem !important; }
h2 { font-size: 1.9rem !important; }
h3 { font-size: 1.5rem !important; }

/* ─── Párrafos y texto ─── */
p, li, td, th, label, figcaption,
[class*="text"],
[class*="content"],
[class*="description"] {
  font-family: var(--ch-font-body) !important;
  color: var(--ch-color-text) !important;
}

span {
  font-family: inherit !important;
}

[class*="muted"],
[class*="secondary"],
[class*="subtitle"] {
  color: var(--ch-color-text-muted) !important;
}

/* ─── Enlaces ─── */
a, [class*="link"] {
  color: var(--ch-color-gold) !important;
  text-decoration: none !important;
  transition: all var(--ch-transition-fast);
  position: relative;
}

a::after,
[class*="link"]::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ch-color-gold), transparent);
  transition: width var(--ch-transition-fast);
}

a:hover,
[class*="link"]:hover {
  color: var(--ch-color-gold-bright) !important;
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
}

a:hover::after,
[class*="link"]:hover::after {
  width: 100%;
}

/* ─── Botones ─── */
button, [role="button"], [class*="button"], [class*="btn"],
input[type="submit"], input[type="button"] {
  background: transparent !important;
  border: 1px solid var(--ch-color-border-strong) !important;
  color: var(--ch-color-gold) !important;
  font-family: var(--ch-font-title) !important;
  font-size: 0.85rem !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  padding: 0.7rem 1.6rem !important;
  cursor: pointer;
  transition: all var(--ch-transition-fast);
  position: relative;
  overflow: hidden;
  border-radius: 2px !important;
}

button::before,
[role="button"]::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(197, 160, 89, 0.08), transparent, rgba(197, 160, 89, 0.04));
  opacity: 0;
  transition: opacity var(--ch-transition-fast);
}

button:hover,
[role="button"]:hover,
[class*="button"]:hover,
[class*="btn"]:hover {
  border-color: var(--ch-color-gold-bright) !important;
  color: var(--ch-color-gold-bright) !important;
  box-shadow: 0 0 20px rgba(197, 160, 89, 0.15), inset 0 0 20px rgba(197, 160, 89, 0.05) !important;
  transform: translateY(-1px);
}

button:hover::before,
[role="button"]:hover::before {
  opacity: 1;
}

button:active,
[role="button"]:active {
  transform: translateY(0);
}

/* ─── Inputs y formularios ─── */
input, textarea, select,
[class*="input"], [class*="field"] {
  background: rgba(10, 14, 20, 0.5) !important;
  border: 1px solid var(--ch-color-border) !important;
  color: var(--ch-color-text) !important;
  font-family: var(--ch-font-body) !important;
  border-radius: 2px !important;
  padding: 0.6rem 0.9rem !important;
  transition: all var(--ch-transition-fast);
}

input:focus, textarea:focus, select:focus,
[class*="input"]:focus, [class*="field"]:focus {
  outline: none !important;
  border-color: var(--ch-color-gold-dim) !important;
  box-shadow: 0 0 0 1px rgba(197, 160, 89, 0.15), 0 0 15px rgba(197, 160, 89, 0.08) !important;
}

/* ─── Contenedores tipo tarjeta / glass ─── */
[class*="card"], [class*="panel"], [class*="box"],
[class*="sheet"], [class*="drawer"], [class*="popover-content"],
[class*="dropdown-menu"], [class*="context-menu"] {
  background: var(--ch-glass-bg) !important;
  backdrop-filter: var(--ch-glass-blur) !important;
  -webkit-backdrop-filter: var(--ch-glass-blur) !important;
  border: 1px solid var(--ch-color-border) !important;
  border-radius: 4px !important;
}

/* Doble borde dorado sutil para separadores */
[class*="divider"], [class*="separator"], hr {
  border: none !important;
  height: 2px !important;
  background: linear-gradient(90deg, transparent, var(--ch-color-gold-dim), transparent) !important;
  position: relative;
  margin: 2rem 0;
}

[class*="divider"]::before, [class*="separator"]::before, hr::before {
  content: '◆';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--ch-color-gold-dim);
  font-size: 0.6rem;
  background: var(--ch-color-bg);
  padding: 0 0.6rem;
}

/* ─── Scrollbar personalizada ─── */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--ch-color-bg-deep);
}
::-webkit-scrollbar-thumb {
  background: var(--ch-color-gold-dim);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ch-color-gold);
}

/* ─── Animaciones de entrada (fade-in suave) ─── */
@keyframes ch-fade-in-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ch-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes ch-glow-pulse {
  0%, 100% { box-shadow: 0 0 5px rgba(197, 160, 89, 0.1); }
  50%      { box-shadow: 0 0 20px rgba(197, 160, 89, 0.2); }
}

/* ─── Animaciones de entrada suaves ─── */
.ch-animate {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}
.ch-animate.ch-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Root y fondo ─── */
#root {
  background: transparent !important;
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* Asegurar que el canvas esté detrás */
#ch-canvas-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

/* ─── Imágenes ─── */
img, [class*="image"] {
  border-radius: 2px !important;
  border: 1px solid var(--ch-color-border) !important;
}

/* ─── Navegación / Header ─── */
nav, header, [class*="navbar"], [class*="header"], [class*="nav"] {
  background: rgba(5, 5, 5, 0.85) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid var(--ch-color-border) !important;
}

/* ─── Footer ─── */
footer, [class*="footer"] {
  background: rgba(5, 5, 5, 0.9) !important;
  border-top: 1px solid var(--ch-color-border) !important;
  color: var(--ch-color-text-muted) !important;
}

/* ─── Tablas ─── */
table, [class*="table"] {
  border-collapse: collapse;
}
th, td {
  border-bottom: 1px solid var(--ch-color-border) !important;
  padding: 0.75rem 1rem !important;
}
th {
  font-family: var(--ch-font-title) !important;
  color: var(--ch-color-gold) !important;
  font-weight: 500 !important;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}

/* ─── Listas ─── */
ul li::marker, ol li::marker {
  color: var(--ch-color-gold-dim);
}

/* ─── Blockquote ─── */
blockquote, [class*="quote"] {
  border-left: 2px solid var(--ch-color-gold-dim) !important;
  background: rgba(197, 160, 89, 0.03) !important;
  padding: 1rem 1.5rem !important;
  font-style: italic;
  color: var(--ch-color-text-muted) !important;
}

/* ─── Code / pre ─── */
code, pre, [class*="code"] {
  background: rgba(10, 14, 20, 0.8) !important;
  border: 1px solid var(--ch-color-border) !important;
  color: var(--ch-color-gold-bright) !important;
  font-family: 'Courier New', Courier, monospace !important;
  border-radius: 2px !important;
}

/* ─── Badges / tags ─── */
[class*="badge"], [class*="tag"], [class*="pill"] {
  background: rgba(197, 160, 89, 0.08) !important;
  border: 1px solid var(--ch-color-border) !important;
  color: var(--ch-color-gold) !important;
  font-family: var(--ch-font-title) !important;
  font-size: 0.7rem !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  padding: 0.25rem 0.6rem !important;
  border-radius: 2px !important;
}

/* ─── Modales / overlays ─── */
[class*="modal"], [class*="overlay"], [class*="backdrop"], [class*="dialog"] {
  background: rgba(5, 5, 5, 0.92) !important;
  backdrop-filter: blur(10px) !important;
}

/* ─── Dropdown / menús ─── */
[class*="dropdown"], [class*="menu"], [class*="popover"] {
  background: rgba(10, 14, 20, 0.95) !important;
  border: 1px solid var(--ch-color-border) !important;
  backdrop-filter: blur(12px) !important;
}

/* ─── Resplandor dorado en hover para iconos ─── */
[class*="icon"] {
  transition: all var(--ch-transition-fast);
}
[class*="icon"]:hover {
  color: var(--ch-color-gold-bright) !important;
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.5));
}

/* ─── Resaltar selección ─── */
::selection {
  background: rgba(197, 160, 89, 0.25);
  color: var(--ch-color-gold-bright);
}

/* ─── Mobile optimizations ─── */
@media (max-width: 768px) {
  body {
    font-size: 16px !important;
    line-height: 1.65 !important;
  }
  h1 { font-size: 1.8rem !important; }
  h2 { font-size: 1.5rem !important; }
  h3 { font-size: 1.2rem !important; }
  
  [class*="card"], [class*="panel"], [class*="box"] {
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
  }
}

/* ─── Reducir motion si el usuario lo prefiere ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
