/* ==========================================================================
   RedSana — Biblioteca Digital & Modo Lectura (Google AI Studio + RedSana Theme)
   Soporte completo sin CDN externo para los 18 documentos HTML de /comunidad/libros/
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background-color: #f8fafc;
  color: #1e293b;
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 19px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background-color: #c52d29;
  color: #ffffff;
}

/* Base Elements */
main, body > nav {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
  padding: 36px 26px;
}

h1, h2, h3, h4, nav, footer, .font-sans {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

.font-serif {
  font-family: Georgia, 'Times New Roman', Times, serif;
}

h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.15;
  color: #0d1b2a;
  margin: 16px 0 24px;
}

h2 {
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1.3;
  margin: 44px 0 22px;
  color: #0d1b2a;
}

h3 {
  line-height: 1.35;
  color: #0d1b2a;
  margin: 24px 0 14px;
}

h4 {
  line-height: 1.35;
  color: #0d1b2a;
}

p {
  margin: 0 0 24px;
}

a {
  color: #b92525;
  text-decoration: underline;
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

a:hover {
  color: #7f1d1d;
}

a:focus-visible {
  outline: 3px solid #b92525;
  outline-offset: 4px;
}

header {
  text-align: center;
  padding: 24px 0;
  margin-bottom: 44px;
}

blockquote {
  margin: 32px 0;
  padding: 24px 28px;
  border-left: 4px solid #c52d29;
  background-color: #f1f5f9;
  font-style: italic;
  color: #0d1b2a;
  border-radius: 0 12px 12px 0;
}

footer {
  border-top: 1px solid #e2e8f0;
  padding-top: 32px;
  margin-top: 56px;
}

ul {
  padding-left: 22px;
  margin: 0 0 24px;
}

li {
  margin: 10px 0;
}

nav ul {
  list-style: none;
  padding-left: 0;
}

nav > ul > li {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 14px;
  margin-bottom: 16px;
}

nav ul ul {
  list-style: disc;
  padding-left: 22px;
  margin-top: 8px;
  margin-bottom: 4px;
}

nav ul ul li {
  border: 0;
  margin: 4px 0;
  padding: 0;
  color: #475569;
  font-size: 15.5px;
}

nav a {
  text-decoration: none;
}

nav a:hover {
  color: #c52d29;
}

svg {
  display: block;
  vertical-align: middle;
}

/* Barra de Herramientas Superior e Inferior */
.book-tools {
  max-width: 850px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  font: 600 14.5px Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  border-bottom: 1px solid #e2e8f0;
  background-color: rgba(255, 255, 255, 0.92);
}

.book-tools a {
  text-decoration: none;
  color: #0d1b2a;
}

.book-tools a:hover {
  color: #c52d29;
}

.book-tools a:first-child {
  margin-right: auto;
}

.book-end {
  max-width: 850px;
  margin: 28px auto 48px;
  padding: 24px;
  text-align: center;
}

.author-amazon-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #0d1b2a;
  color: #ffffff !important;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 9999px;
  text-decoration: none !important;
  box-shadow: 0 4px 12px rgba(13, 27, 42, 0.14);
}

.author-amazon-pill:hover {
  background-color: #c52d29;
  color: #ffffff !important;
  transform: translateY(-1px);
}

/* Grilla de Tarjetas en /comunidad/libros/index.html */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.card {
  padding: 28px;
  background: #ffffff;
  border: 1px solid #dce4ec;
  border-radius: 18px;
  box-shadow: 0 6px 20px rgba(13, 27, 42, 0.05);
  display: flex;
  flex-direction: column;
}

.card h2 {
  margin-top: 0;
}

.card h2 a {
  color: #0d1b2a;
  text-decoration: none;
}

.card h2 a:hover {
  color: #c52d29;
}

/* Prose / Modo Lectura Editorial */
.prose {
  color: #1e293b;
  max-width: 68ch;
}

.prose p {
  margin-top: 0;
  margin-bottom: 1.45em;
}

.prose-lg {
  font-size: 1.125rem;
  line-height: 1.85;
}

.prose-slate {
  color: #1e293b;
}

/* Utilidades de Posicionamiento y Dimensiones */
.relative { position: relative; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.z-50 { z-index: 50; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-3 { gap: 0.75rem; }
.gap-6 { gap: 1.5rem; }

.w-full { width: 100%; }
.w-16 { width: 4rem; }
.w-5 { width: 1.25rem; }
.w-1\/6 { width: 16.666667%; }
.w-2\/6 { width: 33.333333%; }
.w-3\/6 { width: 50%; }
.w-4\/6 { width: 66.666667%; }
.w-5\/6 { width: 83.333333%; }
.w-1\/8 { width: 12.5%; }
.w-2\/8 { width: 25%; }
.w-3\/8 { width: 37.5%; }
.w-4\/8 { width: 50%; }
.w-5\/8 { width: 62.5%; }
.w-6\/8 { width: 75%; }
.w-7\/8 { width: 87.5%; }
.w-\[85\%\] { width: 85%; }

.h-1 { height: 0.25rem; }
.h-5 { height: 1.25rem; }
.min-h-\[80vh\] { min-height: 68vh; }

.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-none { max-width: none; }

/* Espaciado (Margin / Padding / Space-y) */
.m-0 { margin: 0 !important; }
.mx-auto { margin-left: auto; margin-right: auto; }
.ml-4 { margin-left: 1rem; }
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mt-16 { margin-top: 4rem; }
.mt-20 { margin-top: 5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-12 { margin-bottom: 3rem; }
.mb-16 { margin-bottom: 4rem; }
.mb-24 { margin-bottom: 6rem; }
.my-6 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.my-8 { margin-top: 2rem; margin-bottom: 2rem; }
.my-10 { margin-top: 2.5rem; margin-bottom: 2.5rem; }
.my-12 { margin-top: 3rem; margin-bottom: 3rem; }
.my-16 { margin-top: 4rem; margin-bottom: 4rem; }
.my-20 { margin-top: 5rem; margin-bottom: 5rem; }
.my-24 { margin-top: 6rem; margin-bottom: 6rem; }

.p-2 { padding: 0.5rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.pt-10 { padding-top: 2.5rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-16 { padding-bottom: 4rem; }
.pl-4 { padding-left: 1rem; }

.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }

/* Tipografía y Alineación */
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; line-height: 1.4; }
.text-base { font-size: 1rem; line-height: 1.6; }
.text-lg { font-size: 1.125rem; line-height: 1.7; }
.text-xl { font-size: 1.25rem; line-height: 1.75; }
.text-2xl { font-size: 1.5rem; line-height: 1.4; }
.text-3xl { font-size: 1.875rem; line-height: 1.3; }
.text-4xl { font-size: 2.25rem; line-height: 1.2; }
.text-5xl { font-size: 3rem; line-height: 1.12; }

.font-light { font-weight: 300; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.font-black { font-weight: 900; }

.italic { font-style: italic; }
.not-italic { font-style: normal; }
.uppercase { text-transform: uppercase; }

.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }
.leading-relaxed { line-height: 1.65; }
.leading-loose { line-height: 1.9; }

.tracking-tighter { letter-spacing: -0.04em; }
.tracking-tight { letter-spacing: -0.02em; }
.tracking-widest { letter-spacing: 0.1em; }

/* Paleta de Colores RedSana & Slate */
.text-accent { color: #c52d29; }
.text-navy { color: #0d1b2a; }
.text-white { color: #ffffff !important; }
.text-slate-300 { color: #cbd5e1; }
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; }
.text-slate-700 { color: #334155; }
.text-slate-800 { color: #1e293b; }

.bg-white { background-color: #ffffff; }
.bg-slate-50 { background-color: #f8fafc; }
.bg-slate-100 { background-color: #f1f5f9; }
.bg-slate-200 { background-color: #e2e8f0; }
.bg-navy { background-color: #0d1b2a; color: #ffffff; }
.bg-slate-900 {
  background-color: #0f172a;
  color: #f1f5f9;
  padding: 36px 24px;
}
.bg-slate-900 h2,
.bg-slate-900 h3,
.bg-slate-900 a {
  color: #ffffff;
}
.bg-slate-900 .text-slate-400,
.bg-slate-900 .text-slate-500 {
  color: #cbd5e1;
}

.bg-accent, .download {
  background-color: #bc2925;
  color: #ffffff !important;
  padding: 12px 24px;
  border-radius: 9999px;
  display: inline-block;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-weight: 700;
  text-decoration: none !important;
}

.bg-accent:hover, .download:hover {
  background-color: #991b1b;
  color: #ffffff !important;
}

/* Bordes, Radios y Sombras */
.border { border: 1px solid #e2e8f0; }
.border-4 { border: 4px solid #0d1b2a; }
.border-t { border-top: 1px solid #e2e8f0; }
.border-b { border-bottom: 1px solid #e2e8f0; }
.border-l-4 { border-left: 4px solid #0d1b2a; }
.border-navy { border-color: #0d1b2a !important; }
.border-accent { border-color: #c52d29 !important; }
.border-slate-200 { border-color: #e2e8f0; }
.border-slate-600 { border-color: #475569; }
.border-slate-700 { border-color: #334155; }

.rounded-sm { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-r-lg { border-top-right-radius: 0.5rem; border-bottom-right-radius: 0.5rem; }
.rounded-xl { border-radius: 0.85rem; }
.rounded-2xl { border-radius: 1.15rem; }
.rounded-full { border-radius: 9999px; }

.shadow-sm { box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05); }
.shadow-md { box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1); }
.shadow-lg { box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12); }
.shadow-xl { box-shadow: 0 20px 32px rgba(15, 23, 42, 0.14); }
.shadow-inner { box-shadow: inset 0 2px 6px rgba(15, 23, 42, 0.06); }

/* Transiciones y Estados Hover */
.transition-all { transition: all 0.2s ease; }
.transition-colors { transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease; }
.transform { transform: translateZ(0); }
.hover\:-translate-y-1:hover { transform: translateY(-3px); }
.hover\:bg-red-700:hover { background-color: #991b1b !important; }
.hover\:bg-slate-800:hover { background-color: #1e293b !important; }
.hover\:text-accent:hover { color: #c52d29 !important; }
.hover\:text-navy:hover { color: #0d1b2a !important; }
.hover\:shadow-lg:hover { box-shadow: 0 12px 24px rgba(15, 23, 42, 0.14); }
.hover\:shadow-xl:hover { box-shadow: 0 20px 32px rgba(15, 23, 42, 0.18); }

/* Breakpoint Desktop / Tablet (md: >= 768px) */
@media (min-width: 768px) {
  .md\:flex-row { flex-direction: row; }
  .md\:p-12 { padding: 3rem; }
  .md\:p-16 { padding: 4rem; }
  .md\:py-12 { padding-top: 3rem; padding-bottom: 3rem; }
  .md\:py-20 { padding-top: 5rem; padding-bottom: 5rem; }
  .md\:prose-xl { font-size: 1.22rem; line-height: 1.9; }
  .md\:text-base { font-size: 1rem; line-height: 1.6; }
  .md\:text-lg { font-size: 1.125rem; line-height: 1.75; }
  .md\:text-xl { font-size: 1.25rem; line-height: 1.75; }
  .md\:text-2xl { font-size: 1.5rem; line-height: 1.4; }
  .md\:text-3xl { font-size: 1.875rem; line-height: 1.3; }
  .md\:text-4xl { font-size: 2.25rem; line-height: 1.2; }
  .md\:text-5xl { font-size: 3rem; line-height: 1.15; }
  .md\:text-6xl { font-size: 3.5rem; line-height: 1.1; }
  .md\:text-7xl { font-size: 4.25rem; line-height: 1.08; }
}

/* Breakpoint Mobile (<= 640px) */
@media (max-width: 640px) {
  body {
    font-size: 18px;
  }
  main, body > nav {
    padding: 24px 18px;
  }
  header {
    margin-bottom: 28px;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .book-tools {
    padding: 12px 18px;
  }
}

@media print {
  .book-tools, .book-end, footer {
    display: none;
  }
  body {
    background: #ffffff;
    color: #000000;
  }
  main {
    max-width: none;
  }
  a {
    color: #000000;
  }
}
