/* =====================================================================
   Salutecnia · sección de vídeos (/videos y /videos/<slug>)
   La generan scripts/generar_videos.py. Misma marca que la portada:
   Bricolage Grotesque + DM Sans, naranja #E87C2A, tema claro/oscuro.
   ===================================================================== */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f8;
  --bg-card: #ffffff;
  --text-primary: #131314;
  --text-secondary: #5f5f63;
  --text-muted: #8e8e93;
  --accent: #E87C2A;
  --accent-hover: #d46b1c;
  --accent-text: #b85a14;          /* naranja legible sobre blanco (AA) */
  --accent-subtle: rgba(232, 124, 42, 0.1);
  --border: #e5e5e7;
  --nav-bg: rgba(255, 255, 255, 0.8);
  --code-bg: #f4f4f6;
  --shadow-md: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-lg: 0 18px 50px rgba(0,0,0,0.10);
  /* el escenario del vídeo es siempre oscuro, como una sala de cine */
  --stage-bg: #0e0e10;
  --stage-panel: #18181b;
  --stage-line: #2a2a2e;
  --stage-text: #f5f5f7;
  --stage-muted: #9a9aa0;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --measure: 68ch;
}

[data-theme="dark"] {
  --bg-primary: #131314;
  --bg-secondary: #1a1a1c;
  --bg-card: #1e1e20;
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-muted: #7c7c82;
  --accent-text: #f0954e;
  --border: #2c2c2e;
  --nav-bg: rgba(19, 19, 20, 0.8);
  --code-bg: #1b1b1e;
  --shadow-md: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-lg: 0 18px 50px rgba(0,0,0,0.45);
  --stage-bg: #0a0a0b;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-padding-top: 96px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  transition: background-color .4s ease, color .4s ease;
}
h1, h2, h3, h4 { font-family: 'Bricolage Grotesque', serif; line-height: 1.2; font-weight: 700; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ========== NAV (igual que la portada) ========== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: transform .35s cubic-bezier(.4,0,.2,1), background-color .4s ease;
}
.nav.hidden { transform: translateY(-100%); }
.nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 72px; }
.nav-logo img { height: 32px; width: auto; }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { font-size: .95rem; font-weight: 500; color: var(--text-secondary); transition: color .2s ease; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text-primary); }
.nav-links a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
.nav-socials { display: flex; align-items: center; gap: 2px; margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--border); }
.nav-socials a { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; color: var(--text-muted); transition: color .2s, background .2s; }
.nav-socials a:hover { color: var(--accent); background: var(--accent-subtle); }
.nav-socials svg { width: 16px; height: 16px; }
.nav-cta { display: inline-flex; align-items: center; padding: 10px 24px; background: var(--accent); color: #131314 !important; border-radius: 100px; font-weight: 600; font-size: .9rem; transition: background .2s ease, transform .2s ease; }
.nav-cta:hover { background: var(--accent-hover); transform: translateY(-1px); }
.theme-toggle { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-card); cursor: pointer; }
.theme-toggle:hover { border-color: var(--text-muted); }
.theme-toggle svg { width: 18px; height: 18px; color: var(--text-primary); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.mobile-theme-toggle { display: none; }
.hamburger { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 40px; height: 40px; cursor: pointer; background: none; border: none; padding: 8px; }
.hamburger span { display: block; width: 100%; height: 2px; background: var(--text-primary); border-radius: 2px; transition: transform .3s ease, opacity .3s ease; }
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-menu { display: none; position: fixed; top: 72px; left: 0; right: 0; bottom: 0; background: var(--bg-primary); z-index: 999; padding: 40px 24px; flex-direction: column; gap: 8px; }
.mobile-menu.open { display: flex; }
.mobile-menu a { font-size: 1.3rem; font-weight: 600; font-family: 'Bricolage Grotesque', serif; padding: 16px 0; border-bottom: 1px solid var(--border); color: var(--text-primary); }
.mobile-menu .nav-cta { margin-top: 24px; justify-content: center; font-size: 1.1rem; padding: 16px 32px; border-bottom: 0; }
@media (max-width: 860px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .mobile-theme-toggle { display: flex; }
}

/* ========== BOTONES ========== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 13px 24px; border-radius: 100px; font-weight: 600; font-size: .95rem; border: 1px solid transparent; cursor: pointer; transition: background .2s ease, border-color .2s ease, transform .15s ease, color .2s ease; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #131314; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border-color: var(--border); color: var(--text-primary); background: transparent; }
.btn-ghost:hover { border-color: var(--text-muted); }
.btn-yt { background: #FF0000; color: #fff; }
.btn-yt:hover { background: #d90000; }

/* ========== ETIQUETAS DE HERRAMIENTA ========== */
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.tag { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 100px; font-size: .8rem; font-weight: 600; background: var(--accent-subtle); color: var(--accent-text); border: 1px solid transparent; }
a.tag:hover { border-color: var(--accent); }

/* =====================================================================
   PÁGINA DE VÍDEO
   ===================================================================== */
.v-head { padding: 124px 0 36px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: .88rem; color: var(--text-muted); margin-bottom: 22px; list-style: none; }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--border); }
.crumbs a { color: var(--text-secondary); }
.crumbs a:hover { color: var(--accent-text); }
.v-head-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr); gap: 56px; align-items: end; }
.v-head h1, .lib-hero h1 { font-optical-sizing: none; font-variation-settings: 'opsz' 40; }
.v-head h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.012em;
  line-height: 1.06;
  max-width: 20ch;
  text-wrap: balance;
}
.v-head .keypoints { align-self: end; }
@media (max-width: 1000px) { .v-head-grid { grid-template-columns: 1fr; gap: 32px; } }
.v-lead { margin-top: 20px; font-size: clamp(1.05rem, 1.5vw, 1.2rem); line-height: 1.65; color: var(--text-secondary); max-width: 62ch; }
.v-meta { margin-top: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; font-size: .9rem; color: var(--text-muted); }
.v-meta .meta-item { display: inline-flex; align-items: center; gap: 7px; }
.v-meta svg { width: 16px; height: 16px; }
.v-meta .author { display: inline-flex; align-items: center; gap: 10px; color: var(--text-secondary); font-weight: 500; }
.v-meta .author img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }

/* --- El escenario: vídeo + capítulos sincronizados --- */
.stage { background: var(--stage-bg); color: var(--stage-text); padding: 28px 0; }
.stage-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.player { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-md); overflow: hidden; background: #000; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.chapters { background: var(--stage-panel); border: 1px solid var(--stage-line); border-radius: var(--radius-md); display: flex; flex-direction: column; height: 0; min-height: 100%; overflow: hidden; }
.chapters-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--stage-line); }
.chapters-head h2 { font-size: 1rem; font-weight: 700; color: var(--stage-text); }
.chapters-head span { font-size: .8rem; color: var(--stage-muted); }
.chapter-list { list-style: none; overflow-y: auto; flex: 1; padding: 6px; scrollbar-width: thin; scrollbar-color: #3a3a3f transparent; }
.chapter { position: relative; display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: start; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--stage-muted); text-align: left; cursor: pointer; font-size: .92rem; line-height: 1.4; transition: background .2s ease, color .2s ease; overflow: hidden; }
.chapter:hover { background: #222226; color: var(--stage-text); }
.chapter time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--stage-muted); padding-top: 1px; }
.chapter .bar { position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; border-radius: 2px; background: transparent; overflow: hidden; }
.chapter .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .5s linear; }
.chapter.is-active { background: rgba(232,124,42,.12); color: var(--stage-text); }
.chapter.is-active time { color: var(--accent); }
.chapter.is-active .bar { background: rgba(255,255,255,.08); }
.chapter.is-done time { color: #6f6f75; }
.stage-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; border-top: 1px solid var(--stage-line); }
.stage-actions .btn { padding: 9px 16px; font-size: .85rem; }
.stage-actions .btn-ghost { color: var(--stage-text); border-color: var(--stage-line); }
.stage-actions .btn-ghost:hover { border-color: var(--stage-muted); }

@media (max-width: 1000px) {
  .stage-grid { grid-template-columns: 1fr; }
  .chapters { height: auto; min-height: 0; }
  .chapter-list { max-height: 264px; }
}

/* --- Cuerpo: índice + artículo --- */
.v-body { padding: 64px 0 40px; }
.v-grid { display: grid; grid-template-columns: 230px minmax(0, var(--measure)); gap: 64px; justify-content: center; }
.toc { position: sticky; top: 100px; align-self: start; font-size: .9rem; }
.toc h2 { font-family: 'DM Sans', sans-serif; font-size: .85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 12px; }
.toc ol { list-style: none; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 6px 0 6px 16px; margin-left: -1px; border-left: 2px solid transparent; color: var(--text-secondary); line-height: 1.4; transition: color .2s ease, border-color .2s ease; }
.toc a:hover { color: var(--text-primary); }
.toc a.is-current { color: var(--text-primary); border-left-color: var(--accent); font-weight: 600; }
.toc .toc-yt { margin-top: 22px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-secondary); }
.toc .toc-yt svg { width: 18px; height: 18px; color: #FF0000; }
.toc .toc-yt:hover { color: var(--text-primary); }
@media (max-width: 1000px) {
  .v-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { display: none; }
}

.prose { font-size: 1.06rem; }
.prose > * + * { margin-top: 1.1em; }
.prose p { color: var(--text-secondary); }
.prose strong { color: var(--text-primary); font-weight: 700; }
.prose em { font-style: italic; }
.prose a { color: var(--accent-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose ul, .prose ol { padding-left: 1.3em; color: var(--text-secondary); }
.prose li + li { margin-top: .5em; }
.prose li::marker { color: var(--accent); }

.keypoints { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px 28px; }
.keypoints li { font-size: .98rem; }
.keypoints h2 { font-size: 1.15rem; margin-bottom: 14px; }
.keypoints ul { list-style: none; padding: 0; display: grid; gap: 12px; }
.keypoints li { position: relative; padding-left: 30px; color: var(--text-primary); line-height: 1.55; }
.keypoints li::before { content: ""; position: absolute; left: 0; top: .3em; width: 18px; height: 18px; border-radius: 50%; background: var(--accent-subtle); box-shadow: inset 0 0 0 5px var(--bg-secondary), inset 0 0 0 9px var(--accent); }

.sec { margin-top: 56px !important; }
.sec > * + * { margin-top: 1em; }
.sec > .sec-head + * { margin-top: .9em; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.sec-head h2 { font-size: clamp(1.4rem, 2.4vw, 1.75rem); letter-spacing: -0.015em; }
.jump { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 9px; border-radius: 100px; border: 1px solid var(--border); background: transparent; font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-secondary); cursor: pointer; transition: border-color .2s ease, color .2s ease, background .2s ease; }
.jump svg { width: 12px; height: 12px; color: var(--accent); }
.jump:hover { border-color: var(--accent); color: var(--text-primary); background: var(--accent-subtle); }

.steps { list-style: none; padding: 0 !important; counter-reset: paso; display: grid; gap: 14px; }
.steps li { counter-increment: paso; position: relative; padding: 2px 0 0 52px; min-height: 36px; color: var(--text-secondary); }
.steps li + li { margin-top: 0 !important; }
.steps li::before { content: counter(paso); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-family: 'Bricolage Grotesque', serif; font-weight: 800; font-size: 1.05rem; color: #131314; background: var(--accent); }

.note { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding: 16px 18px; border-radius: var(--radius-md); background: var(--bg-secondary); border: 1px solid var(--border); }
.note svg { width: 22px; height: 22px; color: var(--accent); margin-top: 2px; }
.note p { color: var(--text-primary) !important; }

.prompt { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--code-bg); overflow: hidden; }
.prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--border); }
.prompt-head h3 { font-family: 'DM Sans', sans-serif; font-size: .9rem; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.prompt-head h3 svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }
.copy { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 100px; border: 1px solid var(--border); background: var(--bg-card); font-size: .82rem; font-weight: 600; cursor: pointer; transition: border-color .2s ease, background .2s ease, color .2s ease; }
.copy svg { width: 14px; height: 14px; }
.copy:hover { border-color: var(--accent); }
.copy.is-done { background: var(--accent); border-color: var(--accent); color: #131314; }
.prompt pre { margin: 0; padding: 16px 18px 18px; white-space: pre-wrap; word-wrap: break-word; font-family: 'DM Sans', sans-serif; font-size: .95rem; line-height: 1.65; color: var(--text-primary); max-height: 340px; overflow: auto; }

.resource { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 22px 24px; border-radius: var(--radius-lg); background: var(--accent); color: #131314; }
.resource h2 { font-size: 1.2rem; }
.resource p { color: rgba(19,19,20,.78) !important; font-size: .95rem; margin-top: 4px; }
.resource .btn { background: #131314; color: #fff; }
.resource .btn:hover { background: #000; }
@media (max-width: 560px) { .resource { grid-template-columns: 1fr; } }

.faq details { border-bottom: 1px solid var(--border); }
.faq details:first-of-type { border-top: 1px solid var(--border); }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 2px; font-weight: 600; color: var(--text-primary); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex-shrink: 0; width: 10px; height: 10px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg) translateY(-3px); transition: transform .25s ease; }
.faq details[open] summary::after { transform: rotate(225deg) translateY(-1px); }
.faq details p { padding: 0 2px 20px; color: var(--text-secondary); }

.small-print { font-size: .88rem; color: var(--text-muted) !important; }
.links-list { list-style: none; padding: 0 !important; display: grid; gap: 8px; }
.links-list a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none !important; color: var(--text-primary) !important; font-weight: 500; }
.links-list a svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.links-list a:hover { color: var(--accent-text) !important; }

/* --- Autor --- */
.author-band { padding: 72px 0; background: var(--bg-secondary); border-top: 1px solid var(--border); }
.author-card { display: grid; grid-template-columns: 220px 1fr; gap: 44px; align-items: center; max-width: 960px; margin: 0 auto; }
.author-photo { position: relative; aspect-ratio: 1; border-radius: 28px; overflow: hidden; background: var(--accent); }
.author-photo img { width: 100%; height: 100%; object-fit: cover; }
.author-card h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -0.01em; }
.author-card p { margin-top: 12px; color: var(--text-secondary); max-width: 58ch; }
.author-card .iac { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; font-size: .9rem; color: var(--text-muted); }
.author-card .iac img { height: 26px; width: auto; filter: var(--logo-filter, none); }
[data-theme="dark"] .author-card .iac img { filter: brightness(0) invert(1); }
.author-facts { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 22px; }
.author-facts div { display: flex; flex-direction: column; }
.author-facts b { font-family: 'Bricolage Grotesque', serif; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; }
.author-facts span { font-size: .85rem; color: var(--text-muted); }
.author-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
@media (max-width: 720px) {
  .author-card { grid-template-columns: 1fr; gap: 24px; }
  .author-photo { width: 140px; border-radius: 22px; }
}

/* --- Tarjetas de vídeo (relacionados y biblioteca) --- */
.related { padding: 72px 0 88px; }
.related h2, .lib-section h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); letter-spacing: -0.01em; margin-bottom: 26px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 24px; list-style: none; }
@media (max-width: 960px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .cards { grid-template-columns: 1fr; } }
.card { display: flex; flex-direction: column; gap: 14px; }
.card-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-md); overflow: hidden; background: var(--bg-secondary); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.card:hover .card-thumb img { transform: scale(1.035); }
.card-thumb .dur { position: absolute; right: 10px; bottom: 10px; padding: 2px 8px; border-radius: 6px; background: rgba(0,0,0,.78); color: #fff; font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.card h3 { font-size: 1.12rem; line-height: 1.3; letter-spacing: -0.01em; transition: color .2s ease; }
.card:hover h3 { color: var(--accent-text); }
.card p { font-size: .92rem; color: var(--text-secondary); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.card-foot time { font-size: .82rem; color: var(--text-muted); white-space: nowrap; }

/* =====================================================================
   BIBLIOTECA (/videos)
   ===================================================================== */
.lib-hero { padding: 120px 0 24px; }
.lib-hero { overflow: hidden; }
.lib-hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.lib-hero h1 { font-size: clamp(2.6rem, 6.2vw, 5rem); font-weight: 800; letter-spacing: -0.01em; line-height: 1; max-width: 12ch; text-wrap: balance; }
.lib-visual { position: relative; height: 520px; }
.lib-visual .halo { position: absolute; left: 50%; bottom: 0; width: 400px; height: 400px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle at 50% 40%, #f39a52 0%, var(--accent) 55%, #c9631a 100%); }
.lib-visual .me { position: absolute; left: 50%; bottom: 0; height: 500px; width: auto; transform: translateX(-50%); filter: drop-shadow(0 20px 40px rgba(0,0,0,.25)); }
.float { position: absolute; width: 214px; border-radius: 14px; overflow: hidden; background: var(--bg-card); box-shadow: 0 22px 50px rgba(0,0,0,.28); border: 1px solid var(--border); transition: transform .35s cubic-bezier(.2,.7,.2,1); }
.float img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.float span { display: block; padding: 8px 12px 10px; font-size: .8rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.float span b { display: block; font-size: .74rem; font-weight: 500; color: var(--text-muted); margin-top: 2px; }
.float:hover { transform: translateY(-4px) rotate(0deg) !important; }
.float-1 { left: -6%; top: 6%; transform: rotate(-5deg); }
.float-2 { right: -6%; top: 34%; transform: rotate(4deg); }
.float-3 { left: -2%; bottom: 4%; transform: rotate(-3deg); }
@media (prefers-reduced-motion: no-preference) {
  .float { animation: rise .9s cubic-bezier(.2,.7,.2,1) both; }
  .float-1 { animation-delay: .25s; } .float-2 { animation-delay: .35s; } .float-3 { animation-delay: .45s; }
}
@media (max-width: 960px) {
  .lib-hero-grid { grid-template-columns: 1fr; }
  .lib-visual { height: 400px; max-width: 460px; width: 100%; margin: 0 auto; }
  .lib-visual .halo { width: 300px; height: 300px; }
  .lib-visual .me { height: 380px; }
  .float { width: 170px; }
}
@media (max-width: 600px) {
  .lib-visual { display: none; }
}
.lib-hero p { margin-top: 22px; font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--text-secondary); max-width: 56ch; }
.lib-numbers { display: flex; flex-wrap: wrap; gap: 36px; margin-top: 30px; }
.lib-numbers div { display: flex; flex-direction: column; }
.lib-numbers b { font-family: 'Bricolage Grotesque', serif; font-size: 2rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.05; }
.lib-numbers span { font-size: .88rem; color: var(--text-muted); }

.finder { padding: 8px 0 8px; }
.finder-row { display: grid; grid-template-columns: minmax(0, 1fr) 230px 210px; gap: 10px; }
@media (max-width: 860px) { .finder-row { grid-template-columns: 1fr 1fr; } .finder-row .search { grid-column: 1 / -1; } }
@media (max-width: 420px) { .finder-row { grid-template-columns: 1fr; } }
.search { position: relative; display: block; }
.select { position: relative; display: block; }
.select::after { content: ""; position: absolute; right: 20px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select select { appearance: none; -webkit-appearance: none; width: 100%; height: 100%; min-height: 52px; padding: 0 44px 0 20px; border-radius: 100px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary); font: inherit; font-size: .98rem; cursor: pointer; transition: border-color .2s ease, box-shadow .2s ease; text-overflow: ellipsis; }
.select select:hover { border-color: var(--text-muted); }
.select select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-subtle); }
.select select.is-set { border-color: var(--accent); background: var(--accent-subtle); font-weight: 600; }
.lib-numbers b { font-variant-numeric: tabular-nums; }
.search svg { position: absolute; left: 18px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search input { width: 100%; padding: 15px 18px 15px 50px; border-radius: 100px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary); font: inherit; font-size: 1.02rem; transition: border-color .2s ease, box-shadow .2s ease; }
.search input::placeholder { color: var(--text-muted); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-subtle); }
.filters { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 760px) { .filter-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-right: -24px; padding-right: 24px; } }
.filter-row::-webkit-scrollbar { display: none; }
.filter-row > span { flex-shrink: 0; width: 56px; font-size: .88rem; font-weight: 600; color: var(--text-muted); }
.chip { flex-shrink: 0; padding: 7px 15px; border-radius: 100px; border: 1px solid var(--border); background: transparent; font-size: .88rem; font-weight: 500; color: var(--text-secondary); cursor: pointer; white-space: nowrap; transition: border-color .2s ease, color .2s ease, background .2s ease; }
.chip:hover { border-color: var(--text-muted); color: var(--text-primary); }
.chip[aria-pressed="true"] { background: var(--text-primary); border-color: var(--text-primary); color: var(--bg-primary); }
.chip small { font-size: .78rem; opacity: .65; margin-left: 4px; font-variant-numeric: tabular-nums; }

.lib-section { padding: 48px 0 24px; }
.result-line { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.result-line h2 { margin: 0; }
.result-line .count { font-size: .92rem; color: var(--text-muted); }
.clear { border: 0; background: none; color: var(--accent-text); font-weight: 600; cursor: pointer; font-size: .92rem; }

.featured { display: grid; grid-template-columns: 1.35fr 1fr; gap: 40px; align-items: center; padding: 8px 0 24px; }
.featured .card-thumb { border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.featured .new { display: inline-block; font-size: .85rem; font-weight: 600; color: var(--accent-text); margin-bottom: 10px; }
.featured h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); letter-spacing: -0.012em; line-height: 1.1; text-wrap: balance; }
.featured p { margin-top: 14px; color: var(--text-secondary); font-size: 1.02rem; }
.featured .btn { margin-top: 22px; }
.featured:hover h2 { color: var(--accent-text); }
@media (max-width: 860px) { .featured { grid-template-columns: 1fr; gap: 22px; } }

.empty { padding: 48px 24px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius-lg); color: var(--text-secondary); }
.empty b { display: block; font-family: 'Bricolage Grotesque', serif; font-size: 1.3rem; color: var(--text-primary); margin-bottom: 6px; }
[hidden] { display: none !important; }

/* ========== FOOTER (igual que la portada) ========== */
.footer { background: var(--bg-secondary); border-top: 1px solid var(--border); padding: 56px 0 32px; }
.footer-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 40px; margin-bottom: 40px; padding-bottom: 32px; border-bottom: 1px solid var(--border); }
.footer-brand p { color: var(--text-muted); font-size: .85rem; line-height: 1.6; max-width: 300px; margin-top: 12px; }
.footer-logo img { height: 28px; width: auto; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 48px; }
.footer-nav-col h4 { font-family: 'DM Sans', sans-serif; font-size: .8rem; color: var(--text-muted); margin-bottom: 12px; font-weight: 600; }
.footer-nav-col a { display: block; font-size: .88rem; color: var(--text-secondary); margin-bottom: 8px; transition: color .2s; }
.footer-nav-col a:hover { color: var(--accent-text); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; }
.footer-socials { display: flex; gap: 8px; }
.footer-socials a { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); color: var(--text-muted); transition: all .2s; }
.footer-socials a:hover { border-color: var(--accent); color: var(--accent); }
.footer-socials svg { width: 16px; height: 16px; }
.footer-copy { font-size: .82rem; color: var(--text-muted); }
@media (max-width: 768px) {
  .footer-top { flex-direction: column; gap: 32px; text-align: center; align-items: center; }
  .footer-brand p { margin-left: auto; margin-right: auto; }
  .footer-nav { gap: 32px; justify-content: center; }
  .footer-bottom { flex-direction: column; gap: 16px; text-align: center; }
}

/* ========== MOVIMIENTO ==========
   Un único momento orquestado: la cabecera entra al cargar.
   Todo lo demás solo se mueve cuando la persona hace algo. */
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise .8s cubic-bezier(.2,.7,.2,1) both; }
  .rise-2 { animation-delay: .08s; }
  .rise-3 { animation-delay: .16s; }
  .rise-4 { animation-delay: .24s; }
  @keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (max-width: 600px) {
  .v-head { padding-top: 104px; }
  .lib-hero { padding-top: 108px; }
  .sec-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .keypoints { padding: 22px 20px; }
  .v-body { padding-top: 40px; }
  .prose > .sec:first-child { margin-top: 0 !important; }
}
@media print {
  .nav, .stage, .toc, .author-band, .related, .footer, .finder { display: none !important; }
  .v-head { padding-top: 0; }
}

@media (max-width: 600px) {
  .lib-hero .lib-numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .lib-hero .lib-numbers b { font-size: 1.55rem; white-space: nowrap; }
  .lib-hero .lib-numbers span { font-size: .8rem; line-height: 1.35; }
}
