/* Studio family topbar: Biblioteca / Autores / AIGOR / Perfil */
.studio-family-nav{
  min-height:58px;
  padding:10px 24px;
  display:flex;
  align-items:center;
  gap:12px;
  background:var(--studio-surface, var(--surface, #fff));
  border-bottom:1px solid var(--studio-border, var(--border, #e5e7eb));
  position:sticky;
  top:0;
  z-index:90;
  box-sizing:border-box;
}
.studio-family-logo{
  display:inline-flex;
  align-items:center;
  gap:8px;
  color:var(--studio-green, var(--green, #1f8f55));
  font-weight:800;
  font-size:18px;
  letter-spacing:-.02em;
  text-decoration:none;
  white-space:nowrap;
  flex:0 0 auto;
}
.studio-family-logo img{width:24px;height:24px;border-radius:6px;display:block;}
.studio-family-left,.studio-family-right{display:flex;align-items:center;gap:10px;min-width:0;}
.studio-family-right{margin-left:auto;}
.studio-family-pill{
  min-height:34px;
  padding:7px 16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  border:1px solid var(--studio-border, var(--border, #e5e7eb));
  border-radius:999px;
  background:var(--studio-surface, var(--surface, #fff));
  color:var(--studio-ink, var(--text, #111827));
  font:700 13px/1 var(--font-ui, system-ui, sans-serif);
  text-decoration:none;
  white-space:nowrap;
  cursor:pointer;
  box-sizing:border-box;
  box-shadow:0 1px 0 rgba(0,0,0,.02);
}
.studio-family-pill:hover,.studio-family-pill.active{
  border-color:rgba(31,111,74,.28);
  background:var(--studio-green-soft, #eaf4ef);
  color:var(--studio-green, var(--green, #1f8f55));
}
.studio-family-pill.primary{
  background:var(--studio-green, var(--green, #1f8f55));
  border-color:var(--studio-green, var(--green, #1f8f55));
  color:#fff;
}
.studio-family-pill.primary:hover{filter:brightness(.97);color:#fff;}
.studio-family-pill.aigor{
  background:var(--studio-aigor, var(--aigor, #7c3aed));
  border-color:var(--studio-aigor, var(--aigor, #7c3aed));
  color:#fff;
}
.studio-family-pill.aigor:hover,.studio-family-pill.aigor.active{filter:brightness(.98);color:#fff;background:var(--studio-aigor, var(--aigor, #7c3aed));}
.studio-family-count{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:18px;
  height:18px;
  padding:0 5px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  color:var(--studio-green, var(--green, #1f8f55));
  background:rgba(31,111,74,.10);
}
.studio-family-lang{
  min-height:34px;
  padding:0 12px;
  display:inline-flex;
  align-items:center;
  gap:7px;
  border:1px solid var(--studio-border, var(--border, #e5e7eb));
  border-radius:999px;
  background:var(--studio-surface, var(--surface, #fff));
  box-sizing:border-box;
}
.studio-family-lang-icon{font-size:14px;opacity:.88;}
.studio-family-lang-select{
  min-width:132px;
  max-width:190px;
  border:0;
  outline:0;
  background:transparent;
  color:var(--studio-ink, var(--text, #111827));
  font:700 13px/1 var(--font-ui, system-ui, sans-serif);
}
.studio-family-user{position:relative;flex:0 0 auto;}
.studio-family-user-btn{
  min-height:34px;
  max-width:230px;
  padding:4px 9px;
  display:flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--studio-border, var(--border, #e5e7eb));
  border-radius:999px;
  background:var(--studio-surface, var(--surface, #fff));
  color:var(--studio-ink, var(--text, #111827));
  font:700 13px/1 var(--font-ui, system-ui, sans-serif);
  cursor:pointer;
  box-sizing:border-box;
}
.studio-family-user-btn[aria-expanded="true"]{border-color:rgba(31,111,74,.35);box-shadow:0 0 0 3px rgba(31,111,74,.12);}
.studio-family-avatar{width:28px;height:28px;border-radius:50%;background:var(--studio-green-soft, #eaf4ef);color:var(--studio-green, #1f8f55);display:grid;place-items:center;font-weight:800;overflow:hidden;flex:0 0 auto;}
.studio-family-avatar img{width:100%;height:100%;object-fit:cover;display:block;}
.studio-family-user-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.studio-family-dropdown{
  display:none;
  position:absolute;
  right:0;
  top:calc(100% + 8px);
  min-width:210px;
  padding:7px;
  background:var(--studio-surface, #fff);
  border:1px solid var(--studio-border, #e5e7eb);
  border-radius:14px;
  box-shadow:0 18px 50px rgba(0,0,0,.14);
  z-index:1200;
}
.studio-family-dropdown.open{display:block;}
.studio-family-dropdown hr{margin:5px 0;border:0;border-top:1px solid var(--studio-border, #e5e7eb);}
.studio-family-dd-item{display:flex;align-items:center;gap:8px;padding:10px 11px;border-radius:10px;color:var(--studio-ink, #111827);text-decoration:none;font-size:13px;font-weight:650;}
.studio-family-dd-item:hover,.studio-family-dd-item.active{background:var(--studio-green-soft, #eaf4ef);color:var(--studio-green, #1f8f55);}
.studio-family-dd-item.danger:hover{background:var(--studio-danger-soft, #fff1f1);color:var(--studio-danger, #b94a48);}
@media(max-width:820px){
  .studio-family-nav{height:auto;min-height:58px;padding:10px 12px;gap:8px;flex-wrap:wrap;align-items:center;}
  .studio-family-logo{order:1;flex:1 1 100%;font-size:17px;padding-right:48px;}
  .studio-family-left{order:2;flex:1 1 100%;display:grid;grid-template-columns:1fr 1fr 1.15fr;gap:8px;}
  .studio-family-right{order:3;flex:1 1 100%;margin-left:0;display:grid;grid-template-columns:1fr 1.25fr auto;gap:8px;align-items:center;}
  .studio-family-pill{width:100%;min-height:36px;padding:8px 10px;font-size:12px;}
  .studio-family-lang{width:100%;min-width:0;justify-content:center;border-radius:12px;}
  .studio-family-lang-select{min-width:0;width:100%;font-size:12px;}
  .studio-family-user{justify-self:end;}
  .studio-family-user-btn{min-width:42px;width:42px;height:38px;padding:4px;justify-content:center;}
  .studio-family-user-name,.studio-family-caret{display:none;}
  .studio-family-dropdown{position:fixed;right:10px;top:calc(env(safe-area-inset-top, 0px) + 58px);width:min(260px, calc(100vw - 20px));max-height:calc(100vh - 84px);overflow:auto;}
}
@media(max-width:380px){
  .studio-family-left,.studio-family-right{grid-template-columns:1fr;}
  .studio-family-user{position:absolute;right:12px;top:10px;}
}


/* ── v33.5U: modo claro/oscuro consistente + navegación móvil compacta ── */
html[data-theme="dark"],
body[data-theme="dark"]{
  --studio-bg:#12110f;
  --studio-surface:#1d1c19;
  --studio-ink:#f4f0ea;
  --studio-muted:#b8b0a4;
  --studio-border:rgba(244,240,234,.12);
  --studio-border-strong:rgba(244,240,234,.22);
  --bg:#12110f;
  --surface:#1d1c19;
  --text:#f4f0ea;
  --muted:#b8b0a4;
  --border:rgba(244,240,234,.12);
  --green-l:rgba(31,111,74,.22);
  background:var(--studio-bg)!important;
  color:var(--studio-ink)!important;
}
html[data-theme="dark"] body,
body[data-theme="dark"]{
  background:linear-gradient(180deg,#12110f 0%,#171612 100%)!important;
  color:var(--studio-ink)!important;
}
html[data-theme="dark"] .lib-header,
html[data-theme="dark"] .lib-toolbar,
html[data-theme="dark"] .obras-grid,
html[data-theme="dark"] main,
html[data-theme="dark"] .authors-page,
html[data-theme="dark"] .profile-page,
html[data-theme="dark"] .settings-page,
html[data-theme="dark"] .chat-page{
  background:transparent!important;
  color:var(--studio-ink)!important;
}
html[data-theme="dark"] .obra-card-premium,
html[data-theme="dark"] .obra-card,
html[data-theme="dark"] .author-card,
html[data-theme="dark"] .profile-work-card,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .contact-card{
  background:#1e1d1a!important;
  color:var(--studio-ink)!important;
  border-color:var(--studio-border)!important;
  box-shadow:0 20px 50px rgba(0,0,0,.36)!important;
}
html[data-theme="dark"] .search-box,
html[data-theme="dark"] .filter-select,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{
  background:#191814!important;
  color:var(--studio-ink)!important;
  border-color:var(--studio-border)!important;
}
html[data-theme="dark"] .search-box input::placeholder,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{color:rgba(244,240,234,.46)!important;}
html[data-theme="dark"] .obra-title,
html[data-theme="dark"] .lib-header h1,
html[data-theme="dark"] .contact-name{color:var(--studio-ink)!important;}
html[data-theme="dark"] .obra-genre,
html[data-theme="dark"] .obra-stats,
html[data-theme="dark"] .contact-meta{color:var(--studio-muted)!important;}
html[data-theme="dark"] .obra-tag,
html[data-theme="dark"] .author-topic-pill{
  background:rgba(31,111,74,.10)!important;
  border-color:rgba(234,244,239,.18)!important;
  color:#cfe5d8!important;
}
html[data-theme="dark"] .obra-more-btn{
  background:rgba(255,255,255,.16)!important;
  border-color:rgba(255,255,255,.24)!important;
  color:#fff!important;
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  box-shadow:0 10px 26px rgba(0,0,0,.42), inset 0 0 0 1px rgba(255,255,255,.05)!important;
}
html[data-theme="dark"] .obra-more-btn:hover,
html[data-theme="dark"] .obra-more-btn[aria-expanded="true"]{background:rgba(255,255,255,.24)!important;}
html[data-theme="dark"] .obra-card-premium .obra-cover{
  box-shadow:inset 18px 0 26px rgba(0,0,0,.42), inset -12px 0 18px rgba(0,0,0,.22), 0 18px 38px rgba(0,0,0,.30)!important;
}
html[data-theme="dark"] .obra-card-premium .obra-cover::before{
  width:36px!important;
  opacity:.68!important;
  background:linear-gradient(to right, rgba(0,0,0,.46) 0%, rgba(0,0,0,0) 30%, rgba(255,255,255,.08) 48%, rgba(255,255,255,0) 72%)!important;
  mix-blend-mode:normal!important;
}
html[data-theme="dark"] .obra-card-premium .obra-cover::after{
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,.18))!important;
}
html[data-theme="dark"] .studio-family-nav{
  background:#171612!important;
  border-bottom-color:rgba(244,240,234,.10)!important;
  box-shadow:0 10px 28px rgba(0,0,0,.22);
}
html[data-theme="dark"] .studio-family-pill,
html[data-theme="dark"] .studio-family-lang,
html[data-theme="dark"] .studio-family-user-btn,
html[data-theme="dark"] .studio-family-menu-btn{
  background:#211f1b!important;
  color:var(--studio-ink)!important;
  border-color:rgba(244,240,234,.13)!important;
}
html[data-theme="dark"] .studio-family-pill.primary{background:var(--studio-green,#1f6f4a)!important;color:#fff!important;border-color:var(--studio-green,#1f6f4a)!important;}
html[data-theme="dark"] .studio-family-pill.aigor{background:var(--studio-aigor,#6d3bd1)!important;color:#fff!important;border-color:var(--studio-aigor,#6d3bd1)!important;}
html[data-theme="dark"] .studio-family-dropdown,
html[data-theme="dark"] .studio-family-mobile-panel{
  background:#1e1d1a!important;
  border-color:rgba(244,240,234,.13)!important;
  box-shadow:0 24px 70px rgba(0,0,0,.48)!important;
}
html[data-theme="dark"] .studio-family-dd-item{color:var(--studio-ink)!important;}
html[data-theme="dark"] .studio-family-dd-item:hover{background:rgba(31,111,74,.16)!important;}

.studio-family-mainline{display:flex;align-items:center;gap:10px;width:100%;min-width:0;}
.studio-family-menu-btn{display:none;min-height:36px;padding:7px 12px;border:1px solid var(--studio-border,var(--border));border-radius:999px;background:var(--studio-surface,var(--surface));color:var(--studio-ink,var(--text));font:800 13px/1 var(--font-ui,system-ui,sans-serif);gap:7px;align-items:center;justify-content:center;cursor:pointer;}
.studio-theme-toggle{min-width:92px;}
@media(max-width:820px){
  .studio-family-nav{padding:10px 12px;min-height:58px;}
  .studio-family-mainline{display:grid;grid-template-columns:1fr auto auto auto;gap:8px;align-items:center;}
  .studio-family-logo{order:0;flex:0 1 auto;font-size:17px;padding-right:0;min-width:0;}
  .studio-family-menu-btn{display:inline-flex;grid-column:2;grid-row:1;}
  .studio-family-left,
  .studio-family-right{display:contents!important;}
  .studio-family-left .studio-family-pill:not(.primary),
  .studio-family-right .studio-family-pill.aigor,
  .studio-family-right .studio-theme-toggle,
  .studio-family-right .studio-family-lang{display:none!important;}
  .studio-family-left .studio-family-pill.primary{grid-column:3;grid-row:1;width:auto;min-width:42px;padding:8px 12px;border-radius:999px;font-size:0;}
  .studio-family-left .studio-family-pill.primary::before{content:'+';font-size:19px;line-height:1;font-weight:900;}
  .studio-family-user{grid-column:4;grid-row:1;justify-self:end;position:relative;}
  .studio-family-user-btn{width:40px;height:38px;padding:4px;justify-content:center;}
  .studio-family-user-name,.studio-family-caret{display:none!important;}
  .studio-family-mobile-panel{display:none;position:absolute;left:12px;right:12px;top:calc(100% + 8px);padding:10px;border:1px solid var(--studio-border,var(--border));border-radius:18px;background:var(--studio-surface,var(--surface));box-shadow:0 20px 60px rgba(0,0,0,.20);z-index:1300;}
  .studio-family-nav.mobile-menu-open .studio-family-mobile-panel{display:grid;gap:8px;}
  .studio-family-mobile-panel .studio-family-pill,
  .studio-family-mobile-panel .studio-family-lang,
  .studio-family-mobile-panel .studio-theme-toggle{display:flex!important;width:100%;min-height:42px;justify-content:center;border-radius:14px;}
  .studio-family-mobile-panel .studio-family-lang-select{width:100%;max-width:none;}
  .studio-family-dropdown{position:fixed;right:10px;top:calc(env(safe-area-inset-top,0px) + 58px);width:min(260px,calc(100vw - 20px));}
}
@media(max-width:380px){
  .studio-family-mainline{grid-template-columns:1fr auto auto auto;}
  .studio-family-menu-btn span{display:none;}
}

/* ── v33.5W HOTFIX: panel móvil solo en móvil, nunca en escritorio ── */
@media (min-width:821px){
  .studio-family-nav .studio-family-mobile-panel,
  .studio-family-mobile-panel{
    display:none!important;
    visibility:hidden!important;
    pointer-events:none!important;
    position:absolute!important;
    left:-9999px!important;
    top:auto!important;
    width:0!important;
    height:0!important;
    max-width:0!important;
    max-height:0!important;
    padding:0!important;
    margin:0!important;
    overflow:hidden!important;
    opacity:0!important;
  }
  .studio-family-nav.mobile-menu-open .studio-family-mobile-panel{display:none!important;}
  .studio-family-nav .studio-family-menu-btn{display:none!important;}
  .studio-family-nav .studio-family-mainline{display:flex!important;align-items:center!important;gap:10px!important;width:100%!important;}
  .studio-family-nav .studio-family-left,
  .studio-family-nav .studio-family-right{display:flex!important;align-items:center!important;gap:10px!important;}
  .studio-family-nav .studio-family-right{margin-left:auto!important;}
  .studio-family-nav .studio-family-left .studio-family-pill,
  .studio-family-nav .studio-family-right .studio-family-pill,
  .studio-family-nav .studio-family-right .studio-family-lang,
  .studio-family-nav .studio-family-right .studio-family-user{display:inline-flex!important;}
}
@media (max-width:820px){
  .studio-family-nav .studio-family-mobile-panel{display:none!important;}
  .studio-family-nav.mobile-menu-open .studio-family-mobile-panel{display:grid!important;gap:8px!important;}
}


/* ── v33.5Z4 HOTFIX: buscador oscuro de Biblioteca + halo vivo en portadas ── */
/* El buscador de la biblioteca debe comportarse como una sola cápsula, no como
   un input blanco angosto dentro de una caja oscura. */
.lib-toolbar .search-box{
  min-width:min(320px, 100%);
  box-sizing:border-box!important;
  overflow:hidden;
}
.lib-toolbar .search-box > span{
  flex:0 0 auto;
}
.lib-toolbar .search-box input,
.lib-toolbar .search-box input#search-input,
#search-input[name="lithub_library_search"]{
  flex:1 1 auto!important;
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  display:block!important;
  border:0!important;
  outline:0!important;
  background:transparent!important;
  box-shadow:none!important;
  color:var(--studio-ink, var(--text, #111827))!important;
  -webkit-text-fill-color:var(--studio-ink, var(--text, #111827))!important;
}
html[data-theme="dark"] .lib-toolbar .search-box,
body[data-theme="dark"] .lib-toolbar .search-box{
  background:#151411!important;
  border-color:rgba(244,240,234,.18)!important;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.018)!important;
}
html[data-theme="dark"] .lib-toolbar .search-box input,
html[data-theme="dark"] .lib-toolbar .search-box input#search-input,
html[data-theme="dark"] #search-input[name="lithub_library_search"],
body[data-theme="dark"] .lib-toolbar .search-box input,
body[data-theme="dark"] .lib-toolbar .search-box input#search-input,
body[data-theme="dark"] #search-input[name="lithub_library_search"]{
  background:transparent!important;
  color:#f4f0ea!important;
  -webkit-text-fill-color:#f4f0ea!important;
  caret-color:#eaf4ef!important;
}
html[data-theme="dark"] .lib-toolbar .search-box input:-webkit-autofill,
html[data-theme="dark"] #search-input[name="lithub_library_search"]:-webkit-autofill,
body[data-theme="dark"] .lib-toolbar .search-box input:-webkit-autofill,
body[data-theme="dark"] #search-input[name="lithub_library_search"]:-webkit-autofill{
  -webkit-box-shadow:0 0 0 1000px #151411 inset!important;
  box-shadow:0 0 0 1000px #151411 inset!important;
  -webkit-text-fill-color:#f4f0ea!important;
  transition:background-color 9999s ease-in-out 0s;
}
html[data-theme="dark"] .lib-toolbar .search-box:focus-within,
body[data-theme="dark"] .lib-toolbar .search-box:focus-within{
  border-color:rgba(31,111,74,.60)!important;
  box-shadow:0 0 0 3px rgba(31,111,74,.18), inset 0 0 0 1px rgba(255,255,255,.03)!important;
}
@media(max-width:760px){
  .lib-toolbar .search-box{width:100%!important;max-width:none!important;}
}

/* Recupera el halo editorial que sigue suavemente el puntero sobre la portada.
   Debe coexistir con el efecto gris→color, lomo y sombra de libro. */
.obra-card-premium .obra-cover::after{
  opacity:1!important;
  mix-blend-mode:screen;
}
.obra-card-premium:hover .obra-cover::after,
.obra-card-premium:focus-within .obra-cover::after,
.obra-card-premium.is-touch-reveal .obra-cover::after{
  background:
    radial-gradient(circle at var(--book-glow-x, 50%) var(--book-glow-y, 42%), rgba(255,255,255,.30), rgba(255,255,255,.13) 13%, transparent 31%),
    radial-gradient(circle at var(--book-glow-x, 50%) var(--book-glow-y, 42%), rgba(31,111,74,.17), transparent 40%),
    linear-gradient(180deg, rgba(255,255,255,.045), rgba(0,0,0,.10))!important;
}
html[data-theme="dark"] .obra-card-premium:hover .obra-cover::after,
html[data-theme="dark"] .obra-card-premium:focus-within .obra-cover::after,
html[data-theme="dark"] .obra-card-premium.is-touch-reveal .obra-cover::after,
body[data-theme="dark"] .obra-card-premium:hover .obra-cover::after,
body[data-theme="dark"] .obra-card-premium:focus-within .obra-cover::after,
body[data-theme="dark"] .obra-card-premium.is-touch-reveal .obra-cover::after{
  background:
    radial-gradient(circle at var(--book-glow-x, 50%) var(--book-glow-y, 42%), rgba(255,255,255,.24), rgba(255,255,255,.10) 12%, transparent 30%),
    radial-gradient(circle at var(--book-glow-x, 50%) var(--book-glow-y, 42%), rgba(234,244,239,.13), transparent 42%),
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(0,0,0,.20))!important;
}
@media(prefers-reduced-motion: reduce){
  .obra-card-premium .obra-cover::after{mix-blend-mode:normal;}
}
