/* La Biblioteca: una sección más de carlossaez.ai. Los colores, tipografías y botones
   vienen de /index.css; aquí solo va lo propio de esta página. Móvil primero. */

.bib-page { background: var(--bg); }
.bib { padding: 92px 0 72px; min-height: 70vh; }
.bib .container { max-width: 1100px; padding: 0 20px; }
.bib [hidden] { display: none !important; }

.bib-nav-link {
  font-size: 0.875rem; font-weight: 500; color: var(--text-secondary);
  padding: 8px 12px; border-radius: 6px; transition: color 0.2s, background 0.2s;
}
.bib-nav-link:hover { color: var(--text); background: rgba(20, 20, 26, 0.04); }

.bib-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bib-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Cabecera */
.bib-head { margin-bottom: 24px; }
.bib-head h1 {
  font-size: clamp(2.4rem, 9vw, 4rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1;
  background: linear-gradient(110deg, #ec4899 0%, #a855f7 45%, #6366f1 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  padding-bottom: 0.08em;
}
.bib-lead { margin-top: 12px; font-size: 1.1rem; color: var(--text-secondary); max-width: 34em; line-height: 1.55; }

.bib-sub { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 14px; color: var(--text); }

.bib-aviso {
  margin: 0 0 20px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--accent-glow); border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--accent-deep); font-size: 0.95rem; font-weight: 500;
}
.bib-aviso.es-error { background: rgba(239, 68, 68, 0.07); border-color: rgba(239, 68, 68, 0.25); color: #b91c1c; }

/* Puerta: formulario y lo que hay dentro */
.bib-puerta { display: grid; gap: 36px; }
.bib-form-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(20, 20, 26, 0.07), 0 2px 6px rgba(20, 20, 26, 0.04);
  padding: 24px; scroll-margin-top: 88px;
}
.bib-form-card h2 { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.bib-form-sub { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 18px; line-height: 1.5; }

.bib-field { margin-bottom: 12px; }
.bib-field label, .bib-reenviar label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.bib input[type="text"], .bib input[type="email"], .bib input[type="search"], .bib textarea {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.bib input:focus, .bib textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.bib textarea { resize: vertical; min-height: 84px; line-height: 1.5; }

.bib-check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 4px; font-size: 0.9rem; color: var(--text-secondary); line-height: 1.45; cursor: pointer; }
.bib-check input { width: 18px; height: 18px; margin-top: 1px; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }

.bib-form-card .btn { width: 100%; margin-top: 16px; padding: 14px 20px; font-size: 1rem; }
.bib .btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.bib-legal { margin-top: 12px; font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.bib-legal a { color: var(--text-secondary); border-bottom: 1px solid var(--border-strong); }
.bib-error { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(239, 68, 68, 0.07); border: 1px solid rgba(239, 68, 68, 0.25); color: #b91c1c; font-size: 0.88rem; }

.bib-hecho h2 { margin-bottom: 8px; }
.bib-hecho p { color: var(--text-secondary); line-height: 1.6; }
.bib-hecho strong { color: var(--text); overflow-wrap: anywhere; }

.bib-link {
  background: none; border: none; padding: 0; font: inherit; cursor: pointer;
  color: var(--accent-deep); font-weight: 600; border-bottom: 1px solid rgba(99, 102, 241, 0.35);
}
.bib-link:hover { border-bottom-color: var(--accent-deep); }
.bib-reenviar { margin-top: 16px; font-size: 0.92rem; }
.bib-reenviar form { margin-top: 12px; }
.bib-reenvio-fila { display: grid; gap: 8px; }

/* Recurso por el que viene el visitante */
.bib-destacado {
  position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center;
  padding: 14px; margin-bottom: 16px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.07), rgba(99, 102, 241, 0.08));
  border: 1px solid rgba(168, 85, 247, 0.28);
}
.bib-destacado img, .bib-destacado .bib-thumb-vacia { width: 96px; height: auto; aspect-ratio: 16 / 9; border-radius: 8px; object-fit: cover; }
.bib-destacado-marca { font-size: 0.8rem; font-weight: 700; color: #a21caf; margin-bottom: 2px; }
.bib-destacado h3 { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.bib-destacado p { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }
.bib-destacado .btn { margin-top: 10px; }

/* Tarjetas */
.bib-grid { display: grid; gap: 14px; }
.bib-card {
  display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: start;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
}
.bib-thumb { display: block; border-radius: 8px; overflow: hidden; background: var(--bg-raised); aspect-ratio: 16 / 9; }
.bib-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bib-thumb-vacia {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; border-radius: 8px;
  background: repeating-linear-gradient(135deg, var(--bg-raised) 0 10px, #ececea 10px 20px);
  color: var(--text-muted); font-size: 0.72rem; font-weight: 600; text-align: center; padding: 4px;
}
.bib-tipo { font-size: 0.78rem; font-weight: 600; color: var(--accent-deep); margin-bottom: 3px; }
.bib-tipo.es-pronto { color: var(--text-muted); }
.bib-card h3 { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; color: var(--text); }
.bib-card h3 a:hover { color: var(--accent-deep); }
.bib-card-resumen { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; margin-top: 4px; }
.bib-card .btn { margin-top: 10px; padding: 9px 16px; }

/* Barra de búsqueda y filtros */
.bib-barra { display: grid; gap: 12px; margin-bottom: 20px; }
.bib-filtros { display: flex; gap: 8px; flex-wrap: wrap; }
.bib-filtro {
  font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer;
  padding: 8px 14px; border-radius: 100px; border: 1px solid var(--border-strong);
  background: var(--bg-card); color: var(--text-secondary); transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.bib-filtro[aria-pressed="true"] { background: var(--text); color: #fff; border-color: var(--text); }
.bib-vacio { padding: 28px 0; color: var(--text-secondary); }

/* Newsletter: segunda oportunidad, discreta */
.bib-news {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin-top: 24px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 0.95rem; color: var(--text-secondary); line-height: 1.5;
}
.bib-news p { flex: 1 1 260px; }
.bib-news .btn { padding: 9px 16px; }
.bib-news.es-confirmar { margin: 0 0 20px; background: var(--accent-glow); border-color: rgba(99, 102, 241, 0.2); color: var(--text); }

.bib-proponer { margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--border); max-width: 620px; }
.bib-proponer h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.bib-proponer .btn { margin-top: 10px; }
.bib-salir { margin-top: 28px; font-size: 0.82rem; color: var(--text-muted); }

/* Recurso abierto */
.bib-volver { display: inline-block; margin-bottom: 18px; font-size: 0.92rem; font-weight: 600; color: var(--accent-deep); }
.bib-recurso h2.bib-titulo { font-size: clamp(1.6rem, 6vw, 2.3rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.12; margin-top: 4px; }
.bib-recurso .bib-resumen { margin-top: 12px; font-size: 1.05rem; color: var(--text-secondary); line-height: 1.6; max-width: 40em; }
.bib-acciones { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.bib-video { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; margin-top: 24px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); max-width: 520px; }
.bib-video img { width: 120px; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; }
.bib-video span { font-weight: 600; font-size: 0.95rem; }
.bib-video small { display: block; color: var(--text-muted); font-weight: 400; font-size: 0.82rem; margin-top: 2px; }

.bib-bloque-seccion { margin-top: 36px; max-width: 760px; }
.bib-bloque-seccion > h3 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 12px; }
.bib-lista { padding-left: 1.2em; color: var(--text-secondary); line-height: 1.65; }
.bib-lista li { margin-bottom: 8px; padding-left: 4px; }
.bib-lista li::marker { color: var(--accent); font-weight: 700; }
ul.bib-lista { list-style: disc; }

/* Bloque para copiar: lo más importante de la página */
.bib-copia { margin-bottom: 18px; border-radius: var(--radius); overflow: hidden; background: #16121d; box-shadow: 0 10px 30px rgba(22, 18, 29, 0.18); }
.bib-copia::before { content: ''; display: block; height: 3px; background: linear-gradient(90deg, #ec4899, #a855f7 50%, #6366f1); }
.bib-copia-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px 0 16px; }
.bib-copia-cab h4 { font-size: 0.92rem; font-weight: 600; color: #f5f3ff; line-height: 1.35; }
.bib-copia-clase { display: block; font-size: 0.74rem; font-weight: 600; color: #c4b5fd; margin-bottom: 1px; }
.bib-copiar {
  flex-shrink: 0; font: inherit; font-size: 0.86rem; font-weight: 700; cursor: pointer;
  padding: 9px 16px; border-radius: 8px; border: none; background: #fafaf9; color: #16121d; min-width: 92px;
  transition: background 0.2s, color 0.2s;
}
.bib-copiar:hover { background: #fff; }
.bib-copiar.es-copiado { background: #34d399; color: #052e1b; }
.bib-copia pre {
  margin: 0; padding: 14px 16px 18px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 0.86rem; line-height: 1.6; color: #ede9fe;
}
.bib-copia-nota { padding: 0 16px 16px; font-size: 0.84rem; color: #b6adc9; line-height: 1.5; }

.bib-copiar:focus-visible, .bib-filtro:focus-visible, .bib-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

/* Pantallas anchas */
@media (min-width: 560px) {
  .bib-reenvio-fila { grid-template-columns: 1fr auto; }
  .bib-card { grid-template-columns: 160px 1fr; padding: 14px; }
}
@media (min-width: 900px) {
  .bib { padding-top: 120px; }
  .bib .container { padding: 0 28px; }
  .bib-head { margin-bottom: 36px; }
  .bib-puerta { grid-template-columns: minmax(0, 1fr) 400px; gap: 56px; align-items: start; }
  .bib-puerta-form { order: 2; position: sticky; top: 92px; }
  .bib-puerta-lista { order: 1; }
  .bib-barra { grid-template-columns: minmax(0, 340px) 1fr; align-items: center; }
  .bib-dentro .bib-grid { grid-template-columns: 1fr 1fr; }
  .bib-dentro .bib-card { grid-template-columns: 1fr; }
  .bib-destacado { grid-template-columns: 200px 1fr; padding: 18px; gap: 20px; margin-bottom: 20px; }
  .bib-destacado img, .bib-destacado .bib-thumb-vacia { width: 200px; }
  .bib-puerta .bib-destacado { grid-template-columns: 112px 1fr; }
  .bib-puerta .bib-destacado img, .bib-puerta .bib-destacado .bib-thumb-vacia { width: 112px; }
}
