/* The preview of a master plot's table (templates/table/preview.html). Its top bar is the
   sandbox bar (sandbox.css); here is what only the preview has: the spoiler switch with its
   hint, the bar's one row on small screens, and the silhouettes of what the game master hid.
   The bar uses Bootstrap variables with PhaseSix-like fallbacks like the sandbox bar, the
   silhouettes the table's own (table.css), like the game master's hidden look. */

/* ---- The bar ----------------------------------------------------------------------------- */

/* The switch and its hint show once the client knows the table holds something hidden (the
   button's own display would show it), and the switch stands out while spoilers are shown. */
.table-preview-page .sandbox-bar__button[hidden],
.table-preview-page .preview-bar__hint[hidden] {
  display: none;
}

.table-preview-page .sandbox-bar__button[aria-pressed="true"] {
  background: rgba(var(--bs-primary-rgb, 79, 143, 219), 0.22);
  border-color: rgba(var(--bs-primary-rgb, 79, 143, 219), 0.6);
}

.preview-bar__hint {
  margin-right: 4px;
  color: var(--bs-secondary-color, rgba(222, 226, 230, 0.75));
  white-space: nowrap;
}

/* Too little room for the hint: it stays the switch's description (aria-describedby), and the
   client says it once on the table (js/preview/main.js looks at its width). */
@media (max-width: 1400px) {
  .table-preview-page .preview-bar__hint {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

/* The preview's bar holds little, so it keeps its one row where the sandbox's wraps into two:
   the badge shows its mode alone and the way back gives way (it ends in an ellipsis). */
@media (max-width: 860px) {
  .table-sandbox-page.table-preview-page {
    --sandbox-bar-height: 48px;
  }

  .table-preview-page .sandbox-bar {
    display: flex;
    gap: 10px;
  }

  .table-preview-page .sandbox-bar__badge {
    flex-shrink: 0;
  }

  /* Out of sight, still read out: the note says what "Preview" means. */
  .table-preview-page .sandbox-bar__note {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
  }

  .table-preview-page .sandbox-bar__tools {
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-left: auto;
  }
}

/* On a phone the staff link shows its icon; its text stays its name (the sandbox bar drops
   such texts with display: none, which would leave the link without one). */
@media (max-width: 576px) {
  .table-preview-page .sandbox-bar__button .sandbox-bar__long {
    position: absolute;
    display: inline;
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
  }
}

/* The table's toasts sit above the HUD bar at every width, as on a phone (table.css): the hint
   is said as a toast on every load where the bar has no room for it, and a toast in the bottom
   row would lie over the HUD bar there. */
.table-preview-page .table-hud__toasts {
  bottom: 64px;
}

/* ---- Silhouettes ------------------------------------------------------------------------- */

/* What the game master hid, without spoilers (js/preview/VeilObject.js): a dashed outline at
   the object's place with a closed eye, the same for every kind. Quiet, so a table full of
   hidden material stays readable. It takes no pointer input: a press pans the table.
   The whole look is these rules; the three variables are its strength (set on the table root,
   where the table's own colours are). */
.table-preview-page .table-root {
  --veil-ink: rgba(var(--table-white-rgb), 0.42);
  --veil-sigil: rgba(var(--table-white-rgb), 0.5);
  --veil-fill: rgba(var(--table-white-rgb), 0.04);
}

.table-object[data-kind="veil"] {
  cursor: inherit;
  pointer-events: none;
}

.table-object__content.table-veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  box-shadow: none;
}

.table-veil__outline {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* The stroke keeps its width and its dashes on screen at every zoom (non-scaling-stroke). */
.table-veil__outline rect {
  fill: var(--veil-fill);
  stroke: var(--veil-ink);
  stroke-width: 1.25;
  stroke-dasharray: 5 4;
}

.table-veil__sigil {
  display: grid;
  place-items: center;
  color: var(--veil-sigil);
}

.table-veil__sigil[hidden] {
  display: none;
}

.table-veil__sigil > .table-icon {
  width: 100%;
  height: 100%;
}

/* GM info: the pin of the real one (gminfo.css), sealed: dashed, grey, with a lock. */
.table-gminfo__sigil.table-veil__seal {
  color: rgba(var(--table-white-rgb, 255, 255, 255), 0.7);
  background: rgba(var(--table-panel-rgb, 22, 26, 34), 0.85);
  border: 1.5px dashed rgba(var(--table-white-rgb, 255, 255, 255), 0.55);
}
