/* Reset & tokens */
:root{
  --bg:#0f172a;
  --panel:#111827;
  --text:#e5e7eb;
  --muted:#cbd5e1;
  --border:rgba(255,255,255,.08);
  --accent:#93c5fd;
  --green:#16a34a;
  --blue:#2563eb;
  --radius:16px;
  --shadow:0 10px 30px rgba(0,0,0,.5);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;background:var(--bg);color:var(--text);font:400 16px/1.5 Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial}
img{display:block;max-width:100%}
a{color:inherit}

/* Layout */
.container{max-width:1360px;margin:0 auto;padding:24px 28px}
.site-header{position:sticky;top:0;z-index:10;background:linear-gradient(180deg,rgba(15,23,42,.98),rgba(15,23,42,.92));border-bottom:1px solid var(--border);backdrop-filter:blur(6px)}
.site-header h1{margin:0 0 8px;font-weight:700;letter-spacing:.2px}
.top-nav{display:flex;gap:18px;flex-wrap:wrap;margin-bottom:12px}
.nav-link{padding:8px 10px;border-radius:10px;color:var(--muted);text-decoration:none;font-weight:700}
.nav-link.active,.nav-link:hover{color:var(--text);background:rgba(255,255,255,.06)}

.section{scroll-margin-top:120px;margin-top:18px}
.section h2{margin:12px 0 14px}

/* Grids */
.grid{display:grid;gap:18px}
.grid-fiction{grid-template-columns:repeat(3,1fr)}
.grid-geology{grid-template-columns:repeat(4,1fr)} /* PC: 1 fila de 4 */
@media (max-width:1200px){
  .grid-geology{grid-template-columns:repeat(3,1fr)}
}
@media (max-width:900px){
  .grid-fiction,.grid-geology{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:600px){
  .grid-fiction,.grid-geology{grid-template-columns:1fr}
}

/* Card */
.book-card{background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
.book-image{height:460px;display:flex;align-items:center;justify-content:center;background:#0b1220;border-bottom:1px solid var(--border)}
.book-cover{max-height:100%;max-width:100%;object-fit:contain}
.book-title{margin:0;padding:12px 14px 8px;font-weight:700;text-align:center}
.actions{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;padding:10px 14px 16px}

.btn{display:inline-flex;align-items:center;justify-content:center;padding:10px 14px;border-radius:12px;font-weight:700;text-decoration:none;border:none;cursor:pointer}
.btn-blue{background:var(--blue);color:#fff}
.btn-green{background:var(--green);color:#fff}
.btn-ghost{background:transparent;border:1px solid rgba(255,255,255,.4);color:#fff}
.price-badge{display:inline-flex;align-items:center;justify-content:center;padding:6px 10px;border-radius:999px;background:rgba(255,255,255,.12);}

/* Footer */
.site-footer{margin-top:36px;text-align:center;padding:18px;border-top:1px solid var(--border);color:var(--muted)}


/* Author card */
.author-card{display:grid;grid-template-columns:220px 1fr;gap:22px;align-items:flex-start;background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow);}
.author-photo{width:220px;height:220px;object-fit:cover;border-radius:16px;border:1px solid var(--border);background:#0b1220;}
.author-text p{ margin:0 0 10px; color:var(--muted); }
.author-text a{ color:var(--accent); text-decoration:none; }
.author-text a:hover{ text-decoration:underline; }

/* Donations */
.donate-actions{ display:flex; gap:12px; flex-wrap:wrap; margin:10px 0 8px; }
.donate-note{ color:var(--muted); font-size:.95rem; }

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  font-weight:800;
  background:#991b1b;
  color:#fff;
  letter-spacing:.5px;
}

/* ----- Mejoras visuales añadidas ----- */

/* Transición y efecto al pasar el cursor sobre las tarjetas */
.book-card {
  transition: transform .2s ease, box-shadow .2s ease;
}
.book-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
}

/* Alinear cabecera con flexbox */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.site-header h1 {
  flex: 1 1 auto;
}

/* contenedor para navegación y toggle de tema */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}
.nav-actions .top-nav {
  flex: 1 1 auto;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.nav-actions .theme-toggle {
  flex-shrink: 0;
}

/* Estilo del botón de tema */
.theme-toggle {
  font-size: .9rem;
  padding: 8px 12px;
}

/* Botón ghost refinado */
.btn-ghost {
  background: transparent;
  border: 1px solid currentColor;
  color: var(--text);
  transition: background .2s ease, border-color .2s ease;
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, .08);
}

/* Botones con feedback al hacer click */
.btn {
  transition: transform .1s ease;
}
.btn:active {
  transform: scale(.96);
}

/* Botón de volver arriba */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .3s ease, transform .3s ease;
  z-index: 50;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Indicador cuando no hay imagen de portada */
.book-image.no-image {
  position: relative;
  background: var(--panel);
}
.book-image.no-image::after {
  content: 'Sin portada';
  color: var(--muted);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1rem;
  font-weight: 600;
}

/* Variables para el tema claro */
body.light {
  --bg: #f7fafc;
  --panel: #ffffff;
  --text: #1e293b;
  --muted: #475569;
  --border: rgba(0, 0, 0, .1);
  --accent: #2563eb;
  --green: #16a34a;
  --blue: #2563eb;
}
body.light .site-header {
  background: linear-gradient(180deg, rgba(247, 250, 252, .95), rgba(247, 250, 252, .9));
  border-bottom: 1px solid var(--border);
}
body.light .nav-link.active,
body.light .nav-link:hover {
  background: rgba(0, 0, 0, .05);
}
body.light .book-image {
  background: var(--panel);
}
body.light .btn-ghost:hover {
  background: rgba(0, 0, 0, .05);
}
body.light .price-badge {
  background: rgba(0, 0, 0, .05);
  color: var(--text);
}
body.light .book-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .1);
}
body.light .book-card:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, .15);
}
body.light .badge {
  background: #991b1b;
  color: #fff;
}
