/* ============================================================
   BIBLIOTECA DIGITAL UNIVERSITARIA — styles.css
   Estilos personalizados que complementan Tailwind CSS
   ============================================================ */

/* ——— FUENTES ——————————————————————————————————————————————— */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ——— VARIABLES DE TEMA ————————————————————————————————————— */
:root {
  --color-brand:       #0066CC;   /* blue-600 institucional */
  --color-brand-dark:  #004E99;   /* blue-700 institucional */
  --color-surface:     #ffffff;
  --color-surface-2:   #f8fafc;
  --color-border:      #e2e8f0;
  --color-text:        #0f172a;
  --color-text-muted:  #64748b;
  --font-display:      'Playfair Display', Georgia, serif;
  --font-body:         'DM Sans', system-ui, sans-serif;
}

.dark {
  --color-surface:    #0f172a;
  --color-surface-2:  #1e293b;
  --color-border:     #334155;
  --color-text:       #f1f5f9;
  --color-text-muted: #94a3b8;
}

/* ——— RESET BASE ————————————————————————————————————————————— */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-surface-2);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ——— TIPOGRAFÍA ————————————————————————————————————————————— */
.font-display {
  font-family: var(--font-display);
}

/* ——— ANIMACIONES DE ENTRADA ————————————————————————————————— */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.card-entrada {
  animation: fadeInUp 0.4s ease both;
}

/* ——— SKELETON SHIMMER ——————————————————————————————————————— */
.animate-pulse {
  background: linear-gradient(
    90deg,
    #f1f5f9 25%,
    #e2e8f0 50%,
    #f1f5f9 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite ease-in-out;
}

.dark .animate-pulse {
  background: linear-gradient(
    90deg,
    #1e293b 25%,
    #334155 50%,
    #1e293b 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite ease-in-out;
}

/* ——— HERO HEADER ——————————————————————————————————————————— */
.hero-pattern {
  background-image:
    radial-gradient(circle at 20% 50%, rgba(0, 102, 204, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(0, 78, 153, 0.10) 0%, transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(0, 102, 204, 0.08) 0%, transparent 50%);
}

.dark .hero-pattern {
  background-image:
    radial-gradient(circle at 20% 50%, rgba(0, 102, 204, 0.20) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(0, 78, 153, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(0, 102, 204, 0.12) 0%, transparent 50%);
}

/* ——— BARRA DE BÚSQUEDA ————————————————————————————————————— */
.search-input {
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.search-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2);
}

/* ——— TARJETAS ——————————————————————————————————————————————— */
.card-libro {
  transition:
    transform  0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s ease,
    border-color 0.2s ease;
}

.card-libro:hover {
  border-color: rgba(0, 102, 204, 0.4);
}

.dark .card-libro:hover {
  border-color: rgba(0, 102, 204, 0.5);
}

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

/* ——— VISOR PDF ——————————————————————————————————————————————— */
#iframe-visor {
  transition: opacity 0.3s ease;
}

.visor-container {
  /* Altura adaptable: pantalla completa menos el header */
  height: calc(100vh - 72px);
  min-height: 480px;
}

/* ——— SCROLLBAR PERSONALIZADA ——————————————————————————————— */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* ——— TRANSICIÓN DE TEMA ————————————————————————————————————— */
*, *::before, *::after {
  transition-property: background-color, border-color, color;
  transition-duration: 200ms;
  transition-timing-function: ease;
}

/* Excluir de transición animaciones propias */
.card-libro, .card-entrada, .animate-pulse {
  transition: all 0.25s ease;
}

/* ——— LINE CLAMP (fallback) ————————————————————————————————— */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ——— UTILITIES ——————————————————————————————————————————————— */
.text-balance { text-wrap: balance; }
