/* Book: shelf, covers, index, chapter, editor, cover and access sheets. */

/* Shelf */
.estante .enEstante { animation: posa .6s var(--ease) both; }
.estante .enEstante:nth-child(2) { animation-delay: .05s; }
.estante .enEstante:nth-child(3) { animation-delay: .1s; }
.estante .enEstante:nth-child(4) { animation-delay: .15s; }
.estante .enEstante:nth-child(n+5) { animation-delay: .2s; }
@keyframes posa { from { opacity: 0; transform: translateY(10px); } }
.libro { -webkit-touch-callout: none; user-select: none; }
.libro::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 13%, rgba(255, 255, 255, .06) 13.5%, rgba(255, 255, 255, 0) 19%),
    linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(0, 0, 0, .08));
}
.libro .nombre { text-wrap: balance; hyphens: none; overflow-wrap: normal; }
.libro:active { transform: scale(.985); }
.libroFantasma {
  display: block; aspect-ratio: .72; border-radius: 3px 10px 10px 3px;
  background: linear-gradient(90deg, var(--surface-var) 0%, var(--surface) 50%, var(--surface-var) 100%) 0 0 / 200% 100%;
  animation: brillo 1.4s linear infinite;
}

/* Index */
.libroDe { flex: 1; min-width: 0; font: 400 17px/1.3 var(--serif); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
.portadilla { display: flex; align-items: flex-end; gap: 22px; margin: 4px 4px 28px; animation: aparece .4s var(--ease); }
.libro.miniatura { width: 108px; height: 150px; flex: none; }
.libro.miniatura .nombre { font-size: 14px; top: 12px; right: 8px; }
.libro.miniatura .arte { top: 34%; }
.portadillaTexto { min-width: 0; padding-bottom: 6px; }
.portadillaTexto .titulo { font-size: clamp(28px, 7vw, 38px); text-wrap: balance; }
.portadillaTexto .meta { margin: 8px 0 0; }
.indicePapel { padding-top: 28px; padding-bottom: 18px; }
.papel .indiceTitulo { font: 600 13px/1.4 var(--sans); letter-spacing: .4px; opacity: .55; margin: 0 0 4px; }
.indice li button { display: grid; grid-template-columns: 28px 1fr; column-gap: 10px; align-items: baseline; transition: opacity .2s; }
.indice li:last-child button { border-bottom: 0; }
.indice li button:hover .capTitulo { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: color-mix(in srgb, currentColor 30%, transparent); }
.capTitulo { grid-column: 2; }
.papel .indice { padding-left: 0; margin: 0; }
.indice li { margin: 0; padding: 0; }
.capFecha { grid-column: 2; margin-top: -2px; font-family: var(--sans); color: inherit; opacity: .66; }

/* Chapter */
.capitulo .estadoCap { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 14px; letter-spacing: .2px; opacity: .65; }
.estadoCap .punto { width: 6px; height: 6px; border-radius: 50%; background: var(--ruby); }
.papel ol, .papel ul { padding-left: 1.4em; margin: 0 0 14px; }
.papel li { margin: 4px 0; padding-left: 2px; }
.papel li::marker { color: color-mix(in srgb, currentColor 55%, transparent); }
.papel th { font-weight: 600; background: color-mix(in srgb, currentColor 4%, transparent); }
.papel hr { border: 0; height: 1px; background: color-mix(in srgb, currentColor 14%, transparent); margin: 22px 0; }

/* Writing */
.escribiendo { padding-bottom: 160px; }
.escribiendo .cabecera {
  position: sticky; top: 0; z-index: 5; margin: calc(-18px - env(safe-area-inset-top)) calc(-1 * var(--gutter)) 14px;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.estadoGuardado { flex: 1; text-align: right; padding-right: 8px; transition: opacity .3s; }
.boton.listo { min-height: 40px; padding: 0 20px; }
.hojaEditor { padding-top: 34px; padding-bottom: 60px; }
.libroElegido { margin-bottom: 22px; }
.campo.tituloPapel {
  padding: 0; min-height: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  font: 400 30px/1.25 var(--serif); color: inherit; margin: 0 0 18px;
}
.campo.tituloPapel:focus { box-shadow: none; }
.campo.tituloPapel:focus-visible { border-color: transparent; box-shadow: inset 0 -2px 0 var(--focus); }
.campo.tituloPapel::placeholder { color: color-mix(in srgb, currentColor 32%, transparent); }

.editorRico .superficie { position: relative; outline: none; min-height: 46vh; caret-color: var(--orange); word-wrap: break-word; }
.editorRico:focus-within { outline: 2px solid var(--focus); outline-offset: 10px; border-radius: 6px; }
@media (forced-colors: active) { .editorRico:focus-within { outline-color: Highlight; } }
.editorRico .superficie > :first-child { margin-top: 0; }
.editorRico .superficie.vacia::before {
  content: attr(data-placeholder); position: absolute; top: 0; left: 0; pointer-events: none;
  color: color-mix(in srgb, currentColor 34%, transparent);
}
.editorRico table { table-layout: fixed; }
.editorRico td, .editorRico th { min-width: 72px; vertical-align: top; }
.editorRico td:focus-within, .editorRico th:focus-within { background: color-mix(in srgb, var(--orange) 7%, transparent); }
.archivoChip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px 0 12px; border-radius: 999px; user-select: all;
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent); font: 600 14px/1 var(--sans); cursor: default;
}
.archivoChip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
.editorRico .crudo { display: inline-block; padding: 4px 12px; border-radius: 8px; font-size: 14px; opacity: .6; border: 1px dashed color-mix(in srgb, currentColor 30%, transparent); }

/* Floating toolbar */
.barraEditor {
  position: fixed; z-index: 40; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; max-width: calc(100% - 20px); padding: 6px; border-radius: 24px;
  background: color-mix(in srgb, var(--surface-hi) 90%, transparent); backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); box-shadow: var(--shadow-hi);
  transition: transform .22s var(--ease); animation: subeBarra .45s var(--ease) both;
}
@keyframes subeBarra { from { opacity: 0; translate: 0 14px; } }
.herramientas, .tablaHerramientas { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tablaHerramientas { justify-content: center; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); animation: aparece .2s var(--ease); }
.herramienta {
  display: inline-grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 15px; color: var(--ink-2);
  transition: background .2s, color .2s, transform .15s;
}
.herramienta:hover { color: var(--ink); background: color-mix(in srgb, var(--surface-var) 60%, transparent); }
.herramienta:active { transform: scale(.92); }
.herramienta.activa { color: var(--ink); background: var(--surface-var); }
.herramienta.estiloActual { display: inline-flex; gap: 2px; width: auto; padding: 0 8px 0 12px; }
.herramienta .aa { font: 500 17px/1 var(--serif); }
.separador { width: 1px; height: 22px; margin: 0 4px; background: color-mix(in srgb, var(--line) 90%, transparent); flex: none; }
.estilos {
  position: absolute; left: 6px; bottom: calc(100% + 8px); min-width: 210px; padding: 6px; border-radius: 18px;
  background: var(--surface-hi); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); box-shadow: var(--shadow-hi);
  display: flex; flex-direction: column; animation: aparece .18s var(--ease);
}
.estilos button { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 12px; text-align: left; }
.estilos button:hover { background: var(--surface-var); }
.estiloTitulo { font: 400 21px/1.2 var(--serif); }
.estiloSubtitulo { font: 500 17px/1.2 var(--serif); }
.estiloTexto { font: 400 15px/1.2 var(--sans); }
.estilos .icono { color: var(--orange-ink); }

/* File picker */
.archivosSala { margin: 0 -12px; }
.archivosSala .fila { border-radius: 14px; }
.archivoIcono { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--surface-var); color: var(--ink-2); flex: none; }

/* Cover sheet */
.portadaEditor { display: grid; gap: 22px; padding-bottom: 4px; }
.portadaVista {
  display: grid; place-items: center; padding: 26px 0 30px; border-radius: var(--r-m);
  background: radial-gradient(60% 70% at 50% 60%, color-mix(in srgb, var(--surface-var) 90%, transparent), transparent 75%);
}
.libro.muestra { width: 138px; pointer-events: none; transition: background .45s var(--ease); animation: none; }
.libro.muestra .lomo { transition: background .45s var(--ease); }
.libro.muestra .nombre { font-size: 18px; }
.rotulo { margin: 0 0 12px; font-weight: 600; }
.portadaOpciones { display: grid; }
.telas { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 24px; justify-items: center; }
.telas button {
  width: 100%; max-width: 46px; aspect-ratio: 1; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
  transition: transform .25s var(--ease), box-shadow .25s;
}
.telas button:hover { transform: scale(1.06); }
.telas button.elegida { box-shadow: 0 0 0 3px var(--surface-hi), 0 0 0 5px var(--ink); }
.grabados { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 8px; }
.grabados button {
  aspect-ratio: .8; border-radius: 4px 10px 10px 4px; display: grid; place-items: center; padding: 10px;
  transition: transform .25s var(--ease), box-shadow .25s, background .45s var(--ease); box-shadow: none;
}
.grabados button svg { width: 100%; height: 100%; }
.grabados button:hover { transform: translateY(-2px); }
.grabados button.elegida { box-shadow: 0 0 0 3px var(--surface-hi), 0 0 0 5px var(--ink); }
.boton.volver { justify-self: center; margin-top: 8px; }
@media (min-width: 640px) {
  .portadaEditor { grid-template-columns: 200px 1fr; align-items: start; }
  .portadaVista { height: 100%; }
}

/* Access sheet */
.acceso { display: grid; gap: 18px; padding-bottom: 4px; }
.acceso > .rotulo { margin: -6px 0 -4px; color: var(--ink-2); font-weight: 500; }
.buscaAcceso { display: grid; gap: 8px; }
.buscaAcceso .buscador { padding-left: 16px; box-shadow: none; }
.sugerencias { list-style: none; margin: 0; padding: 6px; border-radius: 18px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); animation: aparece .18s var(--ease); }
.sugerencias li { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 10px; border-radius: 12px; cursor: pointer; }
.sugerencias li:hover { background: var(--surface-var); }
.acceso .insignia { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--surface-var); color: var(--ink-2); flex: none; }
.acceso .cara { border: 0; font-size: 14px; }
.concedidos { box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.concedido { gap: 12px; padding: 10px 6px 10px 14px; }
.segmentado.nivel { flex: none; padding: 3px; border-radius: 12px; }
.segmentado.nivel button { min-height: 32px; padding: 0 10px; font-size: 14px; border-radius: 9px; }
.segmentado.nivel .pildora { top: 3px; bottom: 3px; border-radius: 9px; }
.pastilla { flex: none; min-height: 34px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-2); background: color-mix(in srgb, var(--surface-var) 70%, transparent); transition: background .2s, color .2s; }
.pastilla:hover { color: var(--ink); background: var(--surface-var); }
.tablaHerramientas { gap: 6px; padding: 2px 4px 8px; }
.concedido .filaTitulo, .concedido .pequeno { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buscaAcceso .buscador { background: color-mix(in srgb, var(--surface-var) 55%, transparent); border-color: transparent; }
.libroElegido { display: inline-block; min-width: 200px; max-width: 100%; }
.libroElegido .selectorBoton { min-height: 42px; border: 0; border-radius: 999px; padding: 0 14px; gap: 8px; color: inherit; background: color-mix(in srgb, currentColor 6%, transparent); }
.libro .arte { top: 30%; height: 54%; }
.libro.miniatura .arte { top: 32%; height: 52%; }
.fotoPersona { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; }
.duenio { padding: 4px 4px 4px 2px; }
.acceso .rol { flex: none; padding: 0 10px; color: var(--ink-3); }

/* Sala: the book's shelves */
.sala { display: flex; flex-direction: column; gap: 18px; }
.repisaNombre { margin: 0 4px 8px; font: 600 13px/1.4 var(--sans); letter-spacing: .4px; color: var(--ink-2); }
.repisaNombre button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.repisaLibros { padding: 6px; display: flex; flex-direction: column; }
.repisaLibros .pieza { width: 100%; text-align: left; gap: 12px; border-radius: 14px; }
.repisaVacia { margin: 10px 12px; }
.salaSubiendo { display: flex; align-items: center; gap: 8px; margin: 0 4px; }
.salaSubiendo .giratorio { width: 14px; height: 14px; }
.repisaHoja { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.repisaHoja .enlace { background: none; border: 0; padding: 8px; font: 600 15px var(--sans); color: var(--error); cursor: pointer; }
