/* =============================================================================
 * NOTICIAS ORO - Estilos personalizados
 * Complementa Tailwind CDN (play script). Aquí viven variables de tema,
 * tipografías, animaciones, y clases utilitarias que Tailwind Play no cubre.
 * =============================================================================
 */

/* ---- Tipografías ---- */
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.font-serif,
.site-serif {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif !important;
}
.font-sans,
.site-sans {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif !important;
}

/* ---- Variable de color primario (controlada por admin) ---- */
:root {
  --primary-color: #D4AF37;
}

.text-primary { color: var(--primary-color); }
.bg-primary { background-color: var(--primary-color); }
.border-primary { border-color: var(--primary-color); }
.fill-primary { fill: var(--primary-color); }

/* ---- Dark mode ---- */
html.dark { color-scheme: dark; }

/* ---- Transiciones suaves globales ---- */
body,
header,
footer,
main,
aside,
.card,
.dark-transition {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* ---- Animaciones ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes pulseRing {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes marquee {
  0% { transform: translateX(0%); }
  100% { transform: translateX(-100%); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
@keyframes bounceSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.anim-fade-in-up { animation: fadeInUp 0.5s ease-out both; }
.anim-fade-in { animation: fadeIn 0.4s ease-out both; }
.anim-slide-in-right { animation: slideInRight 0.4s ease-out both; }
.anim-scale-in { animation: scaleIn 0.3s ease-out both; }
.anim-pulse-ring { animation: pulseRing 2s ease-in-out infinite; }
.anim-marquee { animation: marquee 25s linear infinite; display: inline-block; padding-right: 3rem; }
.anim-shake { animation: shake 0.4s ease-in-out; }
.anim-bounce-soft { animation: bounceSoft 0.8s ease-in-out infinite; }

/* Delay helpers */
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.10s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.20s; }
.delay-5 { animation-delay: 0.25s; }
.delay-6 { animation-delay: 0.30s; }

/* ---- Glassmorphism header ---- */
.glass-header {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-color: rgba(255, 255, 255, 0.9);
}
html.dark .glass-header {
  background-color: rgba(17, 24, 39, 0.9);
}

/* ---- Prose overrides para artículos ---- */
.article-prose p { margin-bottom: 2rem; color: rgb(31 41 55); line-height: 1.75; font-size: 1.175rem; }
html.dark .article-prose p { color: rgb(229 231 235); }
.article-prose p.first-paragraph::first-letter {
  font-family: 'Playfair Display', serif;
  font-size: 4.5rem;
  font-weight: 700;
  float: left;
  line-height: 0.85;
  margin: 0.4rem 0.7rem 0 0;
  color: #000;
}
html.dark .article-prose p.first-paragraph::first-letter { color: #fff; }

.article-prose h2 {
  font-size: 2rem;
  font-weight: 700;
  margin: 3rem 0 1.5rem;
  color: #000;
  letter-spacing: -0.02em;
  font-family: 'Playfair Display', serif;
}
html.dark .article-prose h2 { color: #fff; }

.article-prose blockquote {
  border-left: 6px solid var(--primary-color);
  padding: 1.25rem 0 1.25rem 2rem;
  margin: 2.5rem 0;
  font-style: italic;
  font-size: 1.625rem;
  font-family: 'Playfair Display', serif;
  color: #000;
  background: rgba(212, 175, 55, 0.05);
  line-height: 1.4;
}
html.dark .article-prose blockquote {
  color: #fff;
  background: rgba(212, 175, 55, 0.08);
}

.article-prose figure { margin: 3rem 0; }
.article-prose figure img {
  width: 100%;
  height: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ---- Line clamp ---- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Scrollbar minimal ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.35); }
html.dark ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); }
html.dark ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9999;
  padding: 0.875rem 1.25rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  animation: slideInRight 0.35s ease-out both;
  color: white;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.toast.success { background-color: #10b981; }
.toast.error { background-color: #ef4444; }
.toast.info { background-color: #3b82f6; }

/* ---- Reading progress ---- */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background-color: var(--primary-color);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 60;
  transition: transform 0.1s ease-out;
}

/* ---- Block editor drop zones ---- */
.block-item {
  transition: all 0.2s ease;
  border: 2px dashed transparent;
}
.block-item:hover { border-color: rgba(0, 0, 0, 0.08); }
html.dark .block-item:hover { border-color: rgba(255, 255, 255, 0.1); }

/* ---- Utility: evitar overflow horizontal en móviles ---- */
html, body { overflow-x: hidden; }

/* ---- Aspect ratio helpers ---- */
.aspect-16-9 { aspect-ratio: 16 / 9; }
.aspect-4-3 { aspect-ratio: 4 / 3; }
.aspect-1-1 { aspect-ratio: 1 / 1; }

/* ---- Tarjetas con hover lift ---- */
.card-lift { transition: transform 0.3s ease, box-shadow 0.3s ease; }
.card-lift:hover { transform: translateY(-4px); box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.18); }

/* ---- Loading spinner ---- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Wireframes del SiteBuilder ---- */
.wireframe-cell { background: rgba(148, 163, 184, 0.35); border-radius: 4px; }
html.dark .wireframe-cell { background: rgba(148, 163, 184, 0.25); }

/* ---- Admin: item de sidebar activo ---- */
.admin-nav-item.active {
  background-color: rgb(37, 99, 235);
  color: white;
}

/* ---- Ticker de última hora ---- */
.ticker-container {
  overflow: hidden;
  white-space: nowrap;
  display: flex;
}
.ticker-content {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 40s linear infinite;
}

/* ---- Focus visible para accesibilidad ---- */
:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ---- Paywall gradient ---- */
.paywall-fade {
  background: linear-gradient(to top, #ffffff 40%, rgba(255, 255, 255, 0) 100%);
}
html.dark .paywall-fade {
  background: linear-gradient(to top, rgb(17, 24, 39) 40%, rgba(17, 24, 39, 0) 100%);
}

/* ---- Tooltip (.has-tooltip + data-tooltip="texto") ---- */
.has-tooltip {
  position: relative;
}
.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0f172a;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
  z-index: 60;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.has-tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 5px solid transparent;
  border-top-color: #0f172a;
  opacity: 0;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
  pointer-events: none;
  z-index: 60;
}
.has-tooltip:hover::after,
.has-tooltip:focus-visible::after,
.has-tooltip:hover::before,
.has-tooltip:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Spinner para estados de carga en botones ---- */
.btn-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -0.15em;
  margin-right: 0.4em;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
button.is-loading,
button:disabled.is-loading {
  cursor: wait;
  opacity: 0.75;
}

/* ---- Atajos de teclado ---- */
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
