/* A5 is a physical leaf. Two leaves form one open spread; print one leaf per sheet. */
.a5-measure{position:fixed;inset:0 auto auto -20000px;width:148mm;visibility:hidden;pointer-events:none;z-index:-100;contain:layout style}
.print-sheet.a5-leaf,.workbench-shell #book-preview .memory-page.a5-leaf{width:148mm!important;height:210mm!important;min-height:210mm!important;max-height:210mm!important;padding:14mm 14mm 13mm 18mm!important;box-sizing:border-box!important;aspect-ratio:148/210!important;position:relative;overflow:visible;font-family:var(--serif);flex:none;background:var(--book-paper,#fffaf0);color:var(--book-ink,#4e4c3e)}
.a5-spread>.a5-leaf:first-child{padding-inline:14mm 18mm!important}
.a5-spread>.a5-leaf:last-child{padding-inline:18mm 14mm!important}
.a5-leaf .a5-content{height:100%;display:flex;flex-direction:column;min-width:0}
.a5-leaf .memory-page-top{display:flex;justify-content:space-between;gap:3mm;flex:none}
.a5-leaf .book-kicker,.a5-leaf .book-date,.workbench-shell #book-preview .a5-leaf .book-kicker,.workbench-shell #book-preview .a5-leaf .book-date{font:8pt/1.5 var(--sans);letter-spacing:.2px;overflow-wrap:anywhere}
.a5-leaf h2,.workbench-shell #book-preview .a5-leaf h2,.workbench-shell #book-preview .a5-leaf[lang=ar] h2{font:400 19pt/1.5 var(--serif);letter-spacing:0;margin:4mm 0!important;overflow-wrap:anywhere;flex:none}
.a5-leaf h2 small{font:9pt var(--sans);opacity:.6;white-space:nowrap}
.a5-leaf .page-people,.workbench-shell #book-preview .a5-leaf .page-people{font:9pt/1.6 var(--sans)!important;margin:2mm 0 0!important;flex:none}
.a5-leaf .page-story.a5-body,.workbench-shell #book-preview .a5-leaf .page-story.a5-body{font-size:var(--a5-font)!important;font-family:var(--serif)!important;line-height:1.8!important;margin:2mm 0 3mm!important;padding:0!important;white-space:pre-wrap;overflow-wrap:anywhere;word-break:normal;background:none;flex:none;orphans:2;widows:2}
.a5-leaf[lang=ar] h2,.a5-leaf[lang=ar] .a5-body{font-family:MemoryArabic,serif!important}
.a5-leaf .page-art.a5-art,.workbench-shell #book-preview .a5-leaf .page-art.a5-art{position:static!important;display:flex!important;align-items:center;justify-content:center;gap:3mm;flex:none;margin:1mm 0 3mm!important;height:30mm!important;min-height:0}
.a5-leaf .page-art.a5-art.with-image,.workbench-shell #book-preview .a5-leaf .page-art.a5-art.with-image{height:46mm!important}
.a5-leaf .a5-art .full-photo,.workbench-shell #book-preview .a5-leaf .a5-art .full-photo{position:static;display:block;width:100%!important;height:100%!important;max-height:46mm!important;min-width:0;object-fit:contain!important;margin:0!important;border:0;box-shadow:none;flex:1}
.a5-leaf .a5-art .page-doodle,.workbench-shell #book-preview .a5-leaf .a5-art .page-doodle{position:static!important;width:28mm!important;height:28mm!important;max-height:28mm!important;max-width:35%!important;margin:0;transform:none;flex:none}
.a5-leaf .full-caption,.workbench-shell #book-preview .a5-leaf .full-caption{font:8.5pt/1.6 var(--sans)!important;margin:0 0 2mm!important;flex:none;white-space:pre-wrap}
.a5-leaf .a5-footer,.workbench-shell #book-preview .a5-leaf .a5-footer{display:flex;justify-content:space-between;font:8pt/1.5 var(--sans);color:var(--book-accent,#8c694c);margin-top:auto;padding-top:2mm;border-top:1px solid #b9b29f66;flex:none}
.a5-leaf .memory-attachments:not(.style-tab){position:absolute;bottom:5mm;inset-inline:18mm 14mm;max-height:6mm;overflow:hidden;margin:0;display:flex;flex-wrap:nowrap;gap:2mm}
.a5-leaf .memory-attachments:not(.style-tab) .memory-attachment{padding:1mm 2mm;font-size:7pt;max-width:30mm}
.a5-leaf .style-tab{max-height:145mm;overflow:hidden}
.a5-spread{display:flex;align-items:stretch;gap:0;width:296mm;direction:ltr;box-shadow:0 8px 24px #393d291a;position:relative}
.a5-spread>.a5-leaf{box-shadow:none;border-radius:0!important}
.a5-spread>.a5-leaf:first-child{box-shadow:inset -8px 0 12px -12px #5b473e80}
.a5-spread>.a5-leaf:last-child{box-shadow:inset 8px 0 12px -12px #5b473e80}
.a5-blank{width:148mm;height:210mm;background:var(--book-paper,#fffaf0);flex:none}
.a5-spread[dir=rtl]{direction:rtl}
.a5-spread[dir=rtl]>.a5-leaf:first-child{padding-inline:18mm 14mm!important}
.a5-spread[dir=rtl]>.a5-leaf:last-child{padding-inline:14mm 18mm!important}
.a5-viewport{width:100%;position:relative;overflow:hidden}
.a5-canvas{width:296mm;transform-origin:top left;transform:scale(var(--a5-scale,1));display:flex;flex-direction:column;gap:8mm}
.a5-layout-note{font:12px/1.8 var(--sans);color:var(--muted);margin:8px 0 12px}
#full-book:has(.a5-spread){display:block}
#full-book .a5-viewport{margin:18px 0}
.workbench-shell #book-preview.workbench-page-preview:has(.a5-viewport){max-width:none}
.workbench-shell .book-stage:has(.a5-viewport){padding:20px 14px}
.workbench-shell .a5-view-toggle{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px}
.a5-view-toggle button{font:12px var(--sans);padding:8px 12px;border:1px solid var(--line);border-radius:6px;min-height:36px}
.a5-view-toggle button[aria-pressed=true]{background:var(--accent);color:white}
.a5-viewport.is-single .a5-canvas{width:148mm}
.a5-viewport.is-single .a5-spread{flex-direction:column;width:148mm;gap:8mm}
.a5-viewport.is-single .a5-blank{display:none}
.a5-viewport.is-single .a5-spread>.a5-leaf{padding:14mm 14mm 13mm 18mm!important}
@media print{
 @page{size:A5 portrait;margin:0}
 #print-root .a5-leaf{break-before:page;break-after:page;break-inside:avoid;box-shadow:none;margin:0}
 #print-root .a5-spread,#print-root .a5-viewport,#print-root .a5-canvas{display:contents!important}
 #print-root .print-sheet.a5-blank{display:block!important;break-before:page;break-after:page;width:148mm;height:210mm;min-height:210mm;padding:0}
 #print-root .print-sheet:not(.a5-leaf){width:148mm;min-height:210mm;padding:16mm;box-sizing:border-box}
 #print-root .a5-layout-note,#print-root .a5-view-toggle{display:none}
 .a5-measure{display:none!important}
}
