.catalog-reader{position:relative;width:100%;height:90svh;min-height:600px;max-height:1000px;margin:0;padding:0;background:#d7d4ce;border:1px solid #bcb5a7;overflow:hidden;border-radius:4px}
.catalog-toolbar{position:absolute;inset:0 0 auto;z-index:3;display:flex;align-items:center;flex-wrap:nowrap;gap:8px;height:56px;padding:6px 12px;box-sizing:border-box;background:#3d423e;color:#fff;font:14px/1.3 system-ui,sans-serif}
.catalog-scroll-hint{white-space:nowrap}.catalog-page-count{white-space:nowrap;font-size:12px;opacity:.8;min-width:42px}
.catalog-toolbar-space{flex:1}.catalog-toolbar output{color:#fff;font-variant-numeric:tabular-nums}
.catalog-toolbar button{width:auto!important;min-width:40px;flex:0 0 auto;white-space:nowrap;height:40px;padding:6px 12px;border:1px solid #ffffff66;border-radius:3px;background:transparent;color:#fff;cursor:pointer;font:inherit;line-height:20px;overflow-wrap:normal;word-break:normal}
.catalog-toolbar button:hover{background:#ffffff22}.catalog-toolbar button:focus-visible{outline:3px solid #e3c587;outline-offset:2px}.catalog-zoom{min-width:44px;text-align:center}
.catalog-reader .catalog-scroll{position:absolute;inset:56px 0 0;width:100%;height:auto;min-height:0;max-height:none;margin:0;padding:0;border:0;overflow:auto;overscroll-behavior:contain;background:#d7d4ce;scroll-behavior:auto}
.catalog-pages{position:relative;width:calc(100% * var(--catalog-zoom,.9));min-width:0;max-width:none;margin:0 auto;padding:10px 14px 18px;box-sizing:border-box}
.catalog-pages .catalog-sheet{position:relative;display:block;width:100%;max-width:none;margin:0 0 14px;padding:0;background:#fff;box-shadow:0 2px 5px #0002}
.catalog-sheet img{display:block;width:100%;height:auto;aspect-ratio:1181/788;object-fit:contain;background:#fff;max-width:none;user-select:none}
.catalog-sheet figcaption{margin:0!important;padding:7px 12px;background:#fffdf7;color:#6b6b60;font:11px/1.4 system-ui,sans-serif;text-align:right}
.catalog-page-error{display:block;padding:16px;text-align:center;font-size:14px;color:#45564b}
.catalog-reader [hidden]{display:none!important}
.catalog-fullscreen{position:fixed;inset:0;width:100vw;height:100dvh;max-width:100vw;max-height:100dvh;margin:0;padding:0;border:0;background:#d7d4ce;box-sizing:border-box;overflow:hidden}
.catalog-fullscreen::backdrop{background:#242824}.catalog-fullscreen .catalog-reader{width:100%;height:100dvh;min-height:0;max-height:none;margin:0;padding:0;border:0;border-radius:0}
html:has(.catalog-fullscreen[open]){overflow:hidden}
@media(max-width:750px){
 .catalog-toolbar{height:96px;display:grid;grid-template-columns:40px 46px 40px minmax(0,1fr) 76px;grid-template-rows:36px 40px;padding:6px 7px;gap:4px;font-size:12px}
 .catalog-scroll-hint{grid-area:1/1/2/4;font-size:12px}.catalog-page-count{grid-area:1/4;text-align:right}
 .catalog-toolbar-space{display:none}.catalog-toolbar [data-action="close"]{grid-area:1/5;min-width:0}
 .catalog-toolbar [data-action="minus"]{grid-area:2/1}.catalog-zoom{grid-area:2/2}.catalog-toolbar [data-action="plus"]{grid-area:2/3}.catalog-toolbar [data-action="fit"]{grid-area:2/4/3/6;min-width:0}
 .catalog-reader .catalog-scroll{top:96px}.catalog-pages{padding:8px 7px 14px}.catalog-pages .catalog-sheet{margin-bottom:10px}
 #catalog-viewer>.catalog-reader{height:72svh;min-height:440px;max-height:760px}
}

.catalog-reader .catalog-scroll{scrollbar-gutter:stable}.catalog-scroll:focus-visible{outline:3px solid #856322;outline-offset:-3px}

/* Pagine a tutta larghezza e lettore piu alto sui telefoni. */
@media(max-width:750px){
 #catalog-viewer>.catalog-reader{height:88svh;min-height:500px;max-height:none}
 .catalog-pages{padding:5px 4px 12px}
 .catalog-reader .catalog-scroll{scrollbar-gutter:auto}
}

/* I comandi di zoom restano nell'apertura a tutto schermo. */
@media(max-width:750px){
 #catalog-viewer>.catalog-reader .catalog-toolbar{height:40px;display:flex;gap:8px;padding:6px 10px}
 #catalog-viewer>.catalog-reader .catalog-toolbar-space{display:block;flex:1}
 #catalog-viewer>.catalog-reader .catalog-toolbar button,#catalog-viewer>.catalog-reader .catalog-zoom{display:none}
 #catalog-viewer>.catalog-reader .catalog-page-count{margin-left:auto}
 #catalog-viewer>.catalog-reader .catalog-scroll{top:40px}
}
