/* Sheet frame layer — rendered inside #canvas SVG, world coordinates.
   `fill: none` keeps the interior fully transparent (canvas content
   stays visible) and `pointer-events: stroke` makes only the visible
   border catch clicks for selection / drag. */
.ui-sheet-frame__paper {
  fill: none;
  stroke: var(--arhix-document-selection);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.ui-sheet-frame__hit-area {
  fill: none;
  stroke: transparent;
  /* The stroke is centred on the visible frame: 20 px gives a stable
     10 px screen-space hit band on either side at every camera zoom. */
  stroke-width: 20;
  vector-effect: non-scaling-stroke;
  pointer-events: stroke;
}

/* Sheet title — rendered OUTSIDE the paper, above its top edge. Two
   text elements anchored to opposite sides (start / end) mirror the
   Pages-panel caption: page index + name on the left, format + scale
   on the right. Font size + position come from sheet.scale (paper-mm)
   so the title visually scales with the paper at the typical sheet-
   fit zoom level. */
.ui-sheet-frame__title {
  fill: var(--arhix-document-selection);
  pointer-events: none;
}

.ui-frame-title-placeholder {
  pointer-events: none;
}

.ui-sheet-frame._selected .ui-sheet-frame__paper {
  stroke-width: 2;
}

.ui-sheet-frame._inactive .ui-sheet-frame__paper {
  stroke: var(--arhix-document-muted);
  opacity: 0.55;
}

.ui-sheet-frame._inactive .ui-sheet-frame__title {
  fill: var(--arhix-document-muted);
  opacity: 0.65;
}

.ui-sheet-frame._stamp-draft .ui-sheet-frame__paper {
  stroke: var(--arhix-document-muted);
}

.ui-sheet-frame._stamp-draft .ui-sheet-frame__title {
  fill: var(--arhix-document-muted);
}

.ui-sheet-frame._preview .ui-sheet-frame__paper {
  stroke-dasharray: 3 2;
  opacity: 0.6;
}

.ui-sheet-frame._preview .ui-sheet-frame__hit-area {
  pointer-events: none;
}

.canvas-area._sheet-frame-mode {
  cursor: crosshair;
}

/* Canvas-level "Sheets" visibility toggle (left-panel ⋯ menu / canvas
   inspector "Листы"). Purely cosmetic in editor mode — hides the
   on-canvas sheet frame (paper outline, hit-area, margin guide and
   label) so the user can draw without the frame in the way. The
   presentation overlay, PDF export, page list and per-sheet stroke
   widths all keep working because getSheetsOnActiveCanvas() returns
   the real sheets regardless of this toggle. The `body:not(...)`
   guard means presentation mode overrides this — once the user
   enters the presentation, frames come back so the white paper +
   geometry-through-overlay-holes always renders correctly. */
body:not(.presentation-mode) .canvas-area._hide-sheet-frames .ui-sheet-frame {
  display: none;
}
