/* OBSCURA OS - Slides: charts, connectors and callouts,
 * and Reuse Slides (slides-objects.js).
 *
 * Kept out of the page's own style block, which is held to its size
 * (design-lint.mjs), and loaded after it. What a slide itself shows (a
 * chart, a callout) is styled on its own markup, so a slide
 * drawn as a picture for Export or a PDF looks as it does here. */

/* A connector is picked up by its line, not its box, and has a handle at
   each end instead of eight round it; joined ends are filled. */
.cv-el[data-kind="connector"] { pointer-events: none; }
.sl-editing .cv-el[data-kind="connector"] .cv-hit { pointer-events: fill; cursor: move; }
.sl-editing .cv-el[data-kind="connector"]:hover,
.sl-editing .cv-el[data-kind="connector"].cv-on { outline: none; }
.sl-editing .cv-el[data-kind="connector"].cv-on::before { display: none; }
.cv-on.cv-one[data-kind="connector"] > .cv-handle,
.cv-on.cv-one[data-kind="connector"] > .cv-rot { display: none; }
.cv-end {
  position: absolute; display: none; z-index: 2;
  width: calc(11px * var(--inv, 1)); height: calc(11px * var(--inv, 1));
  margin: calc(-5.5px * var(--inv, 1)) 0 0 calc(-5.5px * var(--inv, 1));
  background: var(--paper); border: calc(1.5px * var(--inv, 1)) solid var(--sl-sel); border-radius: 50%;
  pointer-events: auto; cursor: crosshair; touch-action: none;
}
.cv-end.is-joined { background: var(--sl-sel); border-color: var(--paper); }
.cv-on > .cv-end { display: block; }

/* While an end is dragged, every shape's connection points, and the one
   it would join filled. */
.cv-site {
  position: absolute; z-index: 3; pointer-events: none;
  width: calc(9px * var(--inv, 1)); height: calc(9px * var(--inv, 1));
  margin: calc(-4.5px * var(--inv, 1)) 0 0 calc(-4.5px * var(--inv, 1));
  background: var(--paper); border: calc(1.5px * var(--inv, 1)) solid var(--ink-soft); border-radius: 50%;
}
.cv-site.is-on { background: var(--sl-sel); border-color: var(--paper); }

/* A callout's pointer: the diamond at its tip, a colour apart from the
   blue of the sizing handles, as PowerPoint's yellow one is. */
.cv-adj {
  position: absolute; z-index: 3;
  width: calc(11px * var(--inv, 1)); height: calc(11px * var(--inv, 1));
  margin: calc(-5.5px * var(--inv, 1)) 0 0 calc(-5.5px * var(--inv, 1));
  background: var(--warn); border: calc(1px * var(--inv, 1)) solid var(--paper);
  transform: rotate(45deg); cursor: pointer; touch-action: none;
}
@media (pointer: coarse) {
  .cv-end, .cv-adj {
    width: calc(20px * var(--inv, 1)); height: calc(20px * var(--inv, 1));
    margin: calc(-10px * var(--inv, 1)) 0 0 calc(-10px * var(--inv, 1));
  }
}

/* Insert Chart's table of numbers: a row for each category and a column
   for each series, scrolling inside itself when it outgrows the dialog. */
.ch-grid-wrap { max-height: min(40vh, 300px); overflow: auto; margin: 10px 0 8px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); }
.ch-grid { border-collapse: collapse; min-width: 100%; }
.ch-grid th, .ch-grid td { padding: 0; border: 1px solid var(--rule); }
.ch-grid thead th:first-child { background: var(--paper-raised); }
.ch-grid input { display: block; width: 100%; min-width: 92px; height: 32px; padding: 2px 8px; border: 0; border-radius: 0; background: var(--paper); color: var(--ink); font: inherit; font-size: var(--text-xs); }
.ch-grid th input { font-weight: 600; }
.ch-grid td input { text-align: right; font-variant-numeric: tabular-nums; }
.ch-grid input:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ch-grid input[aria-invalid="true"] { outline: 2px solid var(--danger); outline-offset: -2px; }
.ch-tools { display: flex; flex-wrap: wrap; gap: 6px; }
dialog.sl-dialog #chSay { min-height: 1.5em; margin: 6px 0 0; color: var(--danger); }

/* Reuse Slides: the file's slides, each chosen or not by a click. */
.ru-grid { display: grid; grid-template-columns: repeat(auto-fill, 154px); justify-content: center; gap: 10px; max-height: min(52vh, 440px); overflow: auto; margin: 8px 0; padding: 4px 2px; }
.ru-thumb { position: relative; width: 154px; padding: 4px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink-soft); text-align: left; cursor: pointer; }
.ru-thumb .slide-frame { --k: .15; pointer-events: none; }
.ru-thumb:hover { border-color: var(--ink-soft); }
.ru-thumb[aria-pressed="true"] { border-color: var(--sl-sel); outline: 2px solid var(--sl-sel); outline-offset: -1px; color: var(--ink); }
.ru-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ru-n { display: block; margin-top: 3px; font-size: var(--text-2xs); font-variant-numeric: tabular-nums; }
.ru-thumb[aria-pressed="true"] .ru-n::after { content: " \00B7  chosen"; }

/* The video export's progress (slides-video.js): a flat bar in the accent. */
dialog.sl-dialog .sl-progress { display: block; width: 100%; height: 6px; margin: 10px 0 4px; accent-color: var(--accent-strong); }
dialog.sl-dialog .sl-progress[hidden] { display: none; }

/* SmartArt (slides-diagram.js): the dialog's gallery, outline and preview,
   and the layouts on the SmartArt Design tab. */
#dlgDiagram { width: min(820px, calc(100vw - 32px)); }
.dg-body { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; }
.dg-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; align-content: start; }
.dg-pick {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px; padding: 4px 2px;
  border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink-soft);
  font: var(--text-2xs)/1.2 var(--font-sans, inherit); cursor: pointer;
}
.dg-pick svg { width: 100%; height: 30px; fill: var(--accent-strong); stroke: none; }
.dg-pick svg .t, .dg-pick svg .o { fill: none; stroke: var(--accent-strong); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.dg-pick:hover { border-color: var(--rule-strong); color: var(--ink); }
.dg-pick[aria-checked="true"], .dg-pick[aria-pressed="true"] { border-color: var(--accent-strong); box-shadow: 0 0 0 1px var(--accent-strong); color: var(--ink); }
.dg-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dg-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dg-name { margin: 0; font-weight: 600; font-size: var(--text-xs); }
#dgText {
  width: 100%; min-height: 150px; resize: vertical; padding: 8px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); font: var(--text-xs)/1.5 var(--font-mono); tab-size: 3;
}
.dg-row { display: flex; gap: 10px; flex-wrap: wrap; }
.dg-row label { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); }
.dg-row select { min-height: 30px; padding: 2px 6px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); font: inherit; }
.dg-preview { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius-sm); }
.dg-preview > .slide-surface { position: absolute; left: 0; top: 0; width: 960px; height: 540px; transform-origin: 0 0; pointer-events: none; }
#rbDiagram .dg-pick { width: 52px; min-height: 44px; padding: 4px; }
#rbDiagram .dg-pick svg { height: 26px; }
@media (max-width: 640px) {
  .dg-body { grid-template-columns: minmax(0, 1fr); }
  .dg-gallery { grid-template-columns: repeat(5, 1fr); }
  .dg-gallery .dg-pick span { display: none; }
}
