/* ── Modal foundation ───────────────────────────────────────────────
   Globální chování VŠECH nativních <dialog> (viz dialog.js, patch showModal):
   Draggable za hlavičku — modal jde chytit myší za <header> a posunout po
   stránce (velikost pevná, mění se jen pozice přes transform).
   Tenhle soubor je JEN vizuál; logiku (kdy třídy naskočí) řídí dialog.js.
   Přidat do layoutu: <%= stylesheet_link_tag('modal') %>. */

/* ── 1) Drag za hlavičku ─────────────────────────────────────────── */

/* Hlavička = tažné madlo. Kurzor napoví, že se s modálem dá pohnout.
   Cílíme oba tvary, které se v markupu vyskytují: `dialog > header` i vnořený. */
dialog[open] > header,
dialog[open] header:first-child {
  cursor: grab;
  /* Tažení nesmí omylem označovat text v nadpisu. */
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* Interaktivní prvky v hlavičce (křížek, tlačítka, inputy) si drží vlastní
   kurzor a NEjsou madlem — drag je z nich vyloučen i v JS. */
dialog[open] > header button,
dialog[open] > header a,
dialog[open] > header input,
dialog[open] > header select,
dialog[open] > header textarea,
dialog[open] > header label,
dialog[open] header:first-child button,
dialog[open] header:first-child a,
dialog[open] header:first-child input,
dialog[open] header:first-child select,
dialog[open] header:first-child textarea,
dialog[open] header:first-child label {
  cursor: pointer;
  user-select: auto;
  -webkit-user-select: auto;
}

dialog[open] > header input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]),
dialog[open] > header textarea,
dialog[open] header:first-child input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]),
dialog[open] header:first-child textarea {
  cursor: text;
}

/* Během tažení: kurzor "chňap" a vypnuté animace pozice, ať posun sedí 1:1
   s myší (žádné doběhy transitionu na transformu). */
dialog.is-dragging {
  transition: none !important;
  will-change: transform;
}

dialog.is-dragging > header,
dialog.is-dragging header:first-child {
  cursor: grabbing;
}

/* Origin-item highlight ZRUŠEN — otevření modálu nemá side-efekt na seznam. */
