/* Bayan — slides: how render.ts's HTML looks (shapes, pictures, text, bullets), the editing canvas (selection frames,
 * handles, marquee, drawing, gridlines), thumbnails, the Slide Sorter, theme and layout previews, the slide show and
 * printing. A slide is drawn at 1 CSS px per point and scaled with a transform. */

/* ---------------- slides ---------------- */
.slide { position: relative; overflow: hidden; transform-origin: 0 0; flex: none; color: #000; font-kerning: normal; text-rendering: optimizeLegibility; }
.slide .deco { position: absolute; inset: 0; pointer-events: none; }
.slide .el { position: absolute; transform-origin: 50% 50%; }
.el-geo { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.el-geo .hit { fill: none; stroke: transparent; stroke-width: 12px; pointer-events: stroke; }
.el-pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; display: block; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.el-pic.missing { background: repeating-linear-gradient(45deg, #d9d9d9 0 10px, #ececec 10px 20px); }
.el.shadow { filter: drop-shadow(2.1px 2.1px 2.8px rgba(0, 0, 0, .4)); }
.el-tx { position: absolute; display: flex; flex-direction: column; box-sizing: border-box; overflow: visible; }
.tx { white-space: pre-wrap; overflow-wrap: break-word; outline: none; flex: none; min-height: 1em; tab-size: 4; }
.tx.nowrap { white-space: pre; width: max-content; min-width: 4px; }
.tx p { margin: 0; }
.tx > p[data-bu]::before, .tx > p[data-num]::before { display: inline-block; min-width: 18px; margin-inline-start: -18px; text-indent: 0; font-family: Arial, sans-serif; font-weight: normal; font-style: normal; }
.tx > p[data-bu]::before { content: attr(data-bu); }

/* editing canvas */
.slide.edit .el { cursor: move; }
.slide.edit .el-tx { cursor: text; }
.slide.edit .el.ph-empty { outline: 1px dashed rgba(110, 110, 110, .7); outline-offset: -1px; }
.slide.edit .el.editing .tx { cursor: text; }
.ph-pic { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px 0 0 -31px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: rgba(255, 255, 255, .8); color: #5a5a5a; cursor: pointer; z-index: 2; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.ph-pic:hover { color: #c43e1c; background: #fff; }
.ph-pic .ic { width: 40px; height: 40px; stroke-width: 1.1; }
#stage { position: relative; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .22); }
#slidehost { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#overlay { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
#gridlines { position: absolute; inset: 0; pointer-events: none; z-index: 4; display: none; background-image: linear-gradient(to right, rgba(128, 128, 128, .33) 1px, transparent 1px), linear-gradient(to bottom, rgba(128, 128, 128, .33) 1px, transparent 1px); background-size: var(--grid, 48px) var(--grid, 48px); }
#stage.grid #gridlines { display: block; }
.preview-layer { position: absolute; inset: 0; z-index: 3; overflow: hidden; }
.anim-tag { position: absolute; min-width: 18px; height: 16px; padding: 0 3px; box-sizing: border-box; border-radius: 3px; background: #f4f4f4; border: 1px solid #9a9a9a;
  color: #333; font: 600 10.5px/14px -apple-system, "Segoe UI", sans-serif; text-align: center; pointer-events: auto; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); direction: ltr; }
.anim-tag.entr { border-color: #2f9e44; } .anim-tag.emph { border-color: #c79200; } .anim-tag.exit { border-color: #d13438; }
.anim-tag.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sel-frame { position: absolute; transform-origin: 50% 50%; border: 1px solid #8a8a8a; pointer-events: none; }
.sel-frame.editing { border-style: dashed; }
.hd { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; box-sizing: border-box; background: #fff; border: 1px solid #5f5f5f; border-radius: 50%; pointer-events: auto; box-shadow: 0 0 0 .5px rgba(255, 255, 255, .8); }
.hd.nw { left: 0; top: 0; cursor: nwse-resize; } .hd.n { left: 50%; top: 0; cursor: ns-resize; } .hd.ne { left: 100%; top: 0; cursor: nesw-resize; }
.hd.e { left: 100%; top: 50%; cursor: ew-resize; } .hd.se { left: 100%; top: 100%; cursor: nwse-resize; } .hd.s { left: 50%; top: 100%; cursor: ns-resize; }
.hd.sw { left: 0; top: 100%; cursor: nesw-resize; } .hd.w { left: 0; top: 50%; cursor: ew-resize; }
.hd.rot { left: 50%; top: -24px; width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px; cursor: grab;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23444' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M15.6 10.5a5.6 5.6 0 1 1-1.8-4.4'/%3E%3Cpath d='M14.6 2.8v3.6H11'/%3E%3C/svg%3E") center / 72% no-repeat; }
.rot-line { position: absolute; left: 50%; top: -17px; height: 17px; border-left: 1px solid rgba(90, 90, 90, .6); }
.sel-frame.editing .hd.rot, .sel-frame.editing .rot-line { display: none; }
.hd.adj { background: #ffd34e; border-color: #8a6d00; cursor: pointer; }
.hd.end { cursor: move; }
.sel-line { position: absolute; height: 0; border-top: 1px dashed #6a6a6a; transform-origin: 0 0; }
.marquee { position: absolute; border: 1px solid rgba(70, 120, 200, .9); background: rgba(70, 120, 200, .12); }
.draw-preview { position: absolute; border: 1px solid #4472c4; background: rgba(68, 114, 196, .12); }
.draw-preview.line { height: 0; border-width: 1px 0 0; background: none; transform-origin: 0 0; }
body.drawing #workspace, body.drawing #workspace * { cursor: crosshair !important; }
body.moving, body.moving * { cursor: move !important; user-select: none !important; }
body.resizing, body.resizing * { cursor: nwse-resize !important; user-select: none !important; }
body.rotating, body.rotating * { cursor: grabbing !important; user-select: none !important; }
body.painting .slide.edit .el, body.painting .slide.edit .el * { cursor: copy !important; }

/* ---------------- thumbnails: slides pane, sorter, galleries ---------------- */
.thumb { position: relative; overflow: hidden; flex: none; background: #fff; }
.thumb > .slide { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
.sp-list { flex: 1; overflow-y: auto; padding: 10px 8px 18px; outline: none; position: relative; }
.sp-item { display: flex; gap: 6px; align-items: flex-start; padding: 4px 2px 8px; }
.sp-num { width: 18px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding-top: 2px; font-size: 12px; color: var(--fg-muted); }
.sp-star { font-size: 10px; line-height: 1; color: var(--fg-muted); }
.sp-item .thumb { border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); }
.sp-item:hover .thumb { box-shadow: 0 0 0 2px #c4c4c4; }
.sp-item.picked .thumb { box-shadow: 0 0 0 3px var(--checked-border); }
.sp-item.current .thumb { box-shadow: 0 0 0 3px var(--accent); }
.sp-item.current .sp-num { color: var(--accent-text); font-weight: 600; }
.sp-item.hidden .thumb, .so-item.hidden .thumb { opacity: .45; }
.sp-item.hidden .sp-num, .so-item.hidden .so-num { text-decoration: line-through; }
.sp-drop { position: absolute; height: 3px; background: var(--accent); border-radius: 2px; pointer-events: none; z-index: 2; }
.sp-drop.v { width: 3px; }
body.dragging-slides, body.dragging-slides * { cursor: grabbing !important; }
.so-grid { display: flex; flex-wrap: wrap; gap: 26px 30px; position: relative; padding: 4px; }
.so-item { display: flex; flex-direction: column; gap: 6px; }
.so-item .thumb { box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); }
.so-item:hover .thumb { box-shadow: 0 0 0 2px #c4c4c4; }
.so-item.picked .thumb { box-shadow: 0 0 0 3px var(--checked-border); }
.so-item.current .thumb { box-shadow: 0 0 0 3px var(--accent); }
.so-num { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--fg-muted); padding: 0 2px; }
.theme-pic { box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }
.slide .tp-aa { position: absolute; left: 0; right: 0; top: 16%; text-align: center; font-size: 220px; line-height: 1.1; }
.slide .tp-bars { position: absolute; left: 24%; right: 24%; bottom: 14%; height: 44px; display: flex; gap: 12px; }
.slide .tp-bars i { flex: 1; border-radius: 4px; }
.layout-preview .tx, .layout-preview .ph-pic { visibility: hidden; }
.layout-preview .el.ph-empty { outline: 6px solid rgba(120, 120, 120, .45) !important; outline-offset: -6px !important; background: rgba(150, 150, 150, .1); }

/* ---------------- slide show ---------------- */
.slideshow { position: fixed; inset: 0; z-index: 2400; background: #000; overflow: hidden; outline: none; cursor: default; user-select: none; -webkit-user-select: none; }
.slideshow.idle, .slideshow.idle * { cursor: none; }
.show-stage { position: absolute; left: 50%; top: 50%; transform-origin: 50% 50%; overflow: hidden; background: #000; }
.show-slide { position: absolute; inset: 0; }
.show-slide > .slide { position: absolute; left: 0; top: 0; }
.show-blank { position: absolute; inset: 0; z-index: 3; pointer-events: none; display: none; }
.slideshow[data-blank="black"] .show-blank { display: block; background: #000; }
.slideshow[data-blank="white"] .show-blank { display: block; background: #fff; }
.show-end { position: absolute; top: 12px; inset-inline: 0; color: #fff; font: 15px var(--font-ui); text-align: center; display: none; }
.slideshow.ended .show-end { display: block; }

/* ---------------- printing ---------------- */
#print-root { display: none; }
@media print {
  html, body { height: auto; overflow: visible; background: #fff !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  .print-page { position: relative; overflow: hidden; break-after: page; page-break-after: always; }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .print-page > .slide { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
