/* Objects on the canvas: selection, handles, editing states. */

/* ---------- Blocks ---------- */
/* Blocks keep their stacking order (DOM order). Selecting or dragging must NOT
   lift a block above the others — a back object stays at the back while moved. */
.block{position:absolute;cursor:grab;touch-action:none}
/* The selection frame is an outline, not a border: a border takes 2 px from the
   object's inside, so thin lines (3 px) looked faded in the editor. */
.block.selected{outline:1px solid var(--accent)}
.block.dragging{cursor:grabbing;opacity:.75}
.block.editing{cursor:auto}
.block .rich{width:100%;height:100%;outline:none;padding:6px;color:inherit;overflow-wrap:anywhere}
.block .rich ul{list-style-type:var(--bullet,disc)}
.block .rich ol{list-style-type:var(--num,decimal)}
/* A soft, translucent selection so the applied text colour stays visible
   (the default solid blue hid it). No `color` override → text keeps its own. */
.block .rich::selection,.block .rich *::selection{background:rgba(63,100,151,.30)}
.block model-viewer{width:100%;height:100%}
/* A poll or activity fills its box, as when presenting (its grid is 100 % of this). */
.block .poll-blk{width:100%;height:100%;overflow:hidden}
/* Loading a 3D model: a small ring in its middle (not model-viewer's bar along the top, which a bleed moves off the frame). */
.block model-viewer::part(default-progress-bar){display:none}
.block .mv-loading{position:absolute;left:50%;top:50%;width:26px;height:26px;margin:-13px 0 0 -13px;box-sizing:border-box;border-radius:50%;
  border:3px solid rgba(128,128,128,.22);border-top-color:rgba(128,128,128,.75);animation:mv-spin 0.9s linear infinite;pointer-events:none}
.block .mv-loading.done{display:none}
@keyframes mv-spin{to{transform:rotate(360deg)}}
.block img,.block video{width:100%;height:100%;object-fit:contain;display:block;pointer-events:none}
.block audio{width:100%;pointer-events:none}
.block iframe{width:100%;height:100%;border:0;display:block;background:#fff}
.block .embed{width:100%;height:100%;display:flex;flex-direction:column;background:#fff}
.embed-bar{flex:0 0 auto;display:flex;align-items:center;gap:8px;padding:3px 8px;font-size:11px;
  color:var(--txt2);background:#f2f3f5;border-bottom:1px solid var(--line2)}
.embed-url{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.embed-open{color:var(--accent);text-decoration:none;pointer-events:auto;white-space:nowrap}
.embed-open:hover{text-decoration:underline}
.block .embed iframe{flex:1}
.block .ph-media{width:100%;height:100%;display:grid;place-items:center;border:2px dashed #8a8a8a88;border-radius:6px;background:#8a8a8a14}
.ph-media-btn{display:flex;flex-direction:column;align-items:center;gap:6px;border:0;background:none;color:inherit;opacity:.7;cursor:pointer;font:inherit;font-size:16px}
.ph-media-btn .ms{font-size:48px}
.ph-media-btn:hover{opacity:1}
.embed-card{border:0;background:none;color:var(--txt2);font:inherit;cursor:pointer;padding:0;white-space:nowrap;pointer-events:auto}
.embed-card:hover{color:var(--accent);text-decoration:underline}
.block .webcard{width:100%;height:100%}
.block .shape{width:100%;height:100%}
.block .chart{width:100%;height:100%}
.block .icon-blk,.block .timer-blk{width:100%;height:100%}
.block .math-blk{width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:inherit;overflow:visible}
/* KaTeX's display margin would push the equation off-centre and add a scrollbar. */
.block .math-blk .katex-display{margin:0}
/* A mistake in the LaTeX: its source, marked (the message on hover), not an empty box. */
.block .math-blk.math-error{outline:2px dashed #c0392b;outline-offset:-2px;font-family:monospace;white-space:pre-wrap;overflow:hidden}
.block.__conn{pointer-events:none}          /* only the line is clickable */
.block .connector{width:100%;height:100%}
.block.__conn.selected{border-color:transparent}
.block.__conn .handle-del,.block.__conn .handle-size,.block.__conn .handle-rot{display:none}
.block .tbl{border-collapse:collapse;width:100%;height:100%;color:inherit;table-layout:fixed}
.block .tbl td{border:1px solid var(--stroke,#fff);padding:var(--cell-pad,.15em .4em);vertical-align:top;outline:none;overflow-wrap:anywhere}
.block .tbl.lines td{border-width:0 0 1px 0}
.block .tbl.banded:not(.has-header) tr:nth-child(odd) td,.block .tbl.banded.has-header tr:nth-child(even) td{background:var(--band,rgba(127,127,127,.18))}
.block .tbl.first-col td:first-child{font-weight:700}
.block .tbl.has-header tr:first-child td{font-weight:700;background:var(--th-bg,rgba(127,127,127,.25));color:var(--th-fg,inherit)}
.block .code{margin:0;width:100%;height:100%;overflow:auto;background:#0b0e14;color:#e6e6e6;padding:10px;
  border-radius:4px;font-family:'Fira Code','Courier New',monospace;white-space:pre-wrap}
.block .code code{font-family:inherit;outline:none;display:block;min-height:100%}
.pv-block>svg{width:100%;height:100%}
.block.selected video,.block.selected audio{pointer-events:auto}
.block.animated::before{content:"✨";position:absolute;top:-9px;left:-7px;font-size:11px;z-index:5;
  background:#fff;border-radius:50%;padding:0 1px}
.block.processing::after{content:"Procesando…";position:absolute;inset:0;display:grid;place-items:center;
  background:#000a;color:#fff;font-size:14px;z-index:8}
.block.processing[data-progress]::after{content:"Procesando… " attr(data-progress)}
.handle-del{position:absolute;top:-30px;right:-30px;width:22px;height:22px;
  border-radius:50%;background:var(--danger);color:#fff;border:2px solid #fff;box-shadow:0 1px 4px #0004;
  cursor:pointer;display:none;padding:0;z-index:7}
.block.selected .handle-del{display:block}
/* The cross is drawn, not a "×" character: a glyph sits off-centre depending
   on the font and the button's padding. */
.handle-del::before,.handle-del::after{content:"";position:absolute;left:50%;top:50%;width:56%;height:2px;
  border-radius:1px;background:#fff;transform:translate(-50%,-50%) rotate(45deg)}
.handle-del::after{transform:translate(-50%,-50%) rotate(-45deg)}
.handle-rot{position:absolute;top:-30px;left:50%;transform:translateX(-50%);width:16px;height:16px;
  border-radius:50%;background:#fff;border:2px solid var(--accent);box-shadow:0 1px 4px #0004;
  cursor:grab;display:none;z-index:7}
.handle-rot::before{content:"";position:absolute;left:50%;top:100%;width:2px;height:14px;
  background:var(--accent);transform:translateX(-50%)}
.block.selected .handle-rot{display:block}
.handle-size{position:absolute;width:11px;height:11px;background:#fff;border:1.5px solid var(--accent);
  border-radius:2px;display:none;z-index:6}
.handle-size.nw{left:-6px;top:-6px;cursor:nwse-resize}
.handle-size.ne{right:-6px;top:-6px;cursor:nesw-resize}
.handle-size.sw{left:-6px;bottom:-6px;cursor:nesw-resize}
.handle-size.se{right:-6px;bottom:-6px;cursor:nwse-resize}
.block.selected .handle-size{display:block}
.block.locked{cursor:default}
.block.locked.selected{border-style:dashed}
.block.locked .handle-size,.block.locked .handle-rot{display:none}
.marquee{position:absolute;z-index:8;pointer-events:none;background:#3f649722;border:1px solid var(--accent)}
.deck-logo-ovl{position:absolute;z-index:6;pointer-events:none;object-fit:contain}
.caption-ovl{position:absolute;z-index:2;color:inherit;font-size:16px;text-align:center;opacity:.85;
  font-style:italic;pointer-events:none;overflow-wrap:anywhere}
.block .slideref{width:100%;height:100%;overflow:hidden;background:#111;border:1px solid #ffffff55;border-radius:4px}
.block .figindex{width:100%;height:100%;color:inherit;overflow:auto}
.block .figindex ul{margin:.4em 0 0;padding-left:1.4em}
.block .figindex li{margin:.15em 0}
.pguide{position:absolute;z-index:6;background:#00bcd4}
.pguide.v{top:0;bottom:0;width:1px;cursor:ew-resize}
.pguide.h{left:0;right:0;height:1px;cursor:ns-resize}
.pguide::before{content:"";position:absolute;inset:-4px}  /* easier to grab */
.pguide.v::before{left:-4px;right:-4px;top:0;bottom:0}
.pguide.h::before{top:-4px;bottom:-4px;left:0;right:0}
.guide{position:absolute;z-index:7;pointer-events:none;background:#ff3b8b}
.guide.v{top:0;bottom:0;width:1px}.guide.h{left:0;right:0;height:1px}
/* Curved text: the arc shows; the text under it is what gets edited (double-click). */
.block > .curve-arc{position:absolute;inset:0;pointer-events:none}
.block.curved:not(.editing) > .rich{visibility:hidden}
.block.curved.editing > .curve-arc{display:none}
/* Text round a picture marked "Texto alrededor" (the same rule as the presentation's WRAP_CSS). */
.rich[data-wrap]::before{content:"";height:var(--wh);width:var(--ww);shape-outside:inset(var(--wt) 0 0 0)}
.rich[data-wrap=l]::before{float:left}.rich[data-wrap=r]::before{float:right}
/* Text inside a shape: a text layer over it (see paintShapeText). */
.block > .shape-text{position:absolute;inset:0;overflow:hidden;box-sizing:border-box}
/* An object that is a link: a small mark while it is selected (when presenting, a click follows it). */
.block.linked.selected:not(.processing)::after{content:"link";font-family:'Material Symbols Rounded';position:absolute;left:-2px;top:-26px;z-index:5;font-size:18px;line-height:22px;width:22px;text-align:center;border-radius:50%;background:var(--accent);color:var(--on-accent);pointer-events:none}
.freeform-draw .ff-shape{fill:color-mix(in srgb,var(--accent) 35%,transparent);stroke:var(--accent);stroke-width:3;stroke-linejoin:round}
/* Attached files: a PDF's page with a badge, or the file's icon. */
.block .file-blk{width:100%;height:100%;position:relative}
.block .file-blk img{width:100%;height:100%;object-fit:contain;display:block;pointer-events:none;background:#fff}
.block .file-badge{position:absolute;right:6px;bottom:6px;display:flex;align-items:center;gap:3px;padding:2px 7px;border-radius:10px;background:#d93025;color:#fff;font:600 12px system-ui,sans-serif;pointer-events:none}
.block .file-badge .ms{font-size:15px}
/* Text ruler: over the text being written in, with its tab stops. */
#text-ruler{position:absolute;height:22px;z-index:40;background:#fdfdfd;border:1px solid #b9bec6;border-radius:3px;box-sizing:border-box;color:#555;font:10px system-ui,sans-serif;cursor:copy;user-select:none}
#text-ruler .tr-tick{position:absolute;bottom:0;width:1px;height:4px;background:#9aa0a8}
#text-ruler .tr-tick.big{height:7px}
#text-ruler b{position:absolute;top:1px;transform:translateX(-50%);font-weight:400}
#text-ruler .tr-kind{position:absolute;left:-26px;top:-1px;width:22px;height:22px;padding:0;border:1px solid #b9bec6;border-radius:3px;background:#fff;color:#222;font:700 13px/1 system-ui,sans-serif;cursor:pointer}
#text-ruler .tr-stop{position:absolute;bottom:-1px;transform:translateX(-50%);font:700 13px/1 system-ui,sans-serif;color:#1e2a3a;cursor:ew-resize;padding:0 2px}
#text-ruler .tr-stop.off{opacity:.3}
.block .diagram-blk{width:100%;height:100%}
