/* Dividers (divider.js): resize by dragging the gap between two pieces. Tokens only; no literal colours.
   Loaded after the other base CSS and before the look, so a look restyles the handle with plain selectors.
   At rest the handle draws NOTHING and the layout rules below apply only once he has moved a divider
   (data-split on the grid): with nothing dragged every look renders exactly as it did before.
   Hooks: div.divider[data-divider=conv-side|watch][data-orientation=vertical|horizontal][data-dragging]
            [data-limit=min|max][aria-disabled=true] > i.dv-line (runs the gap) + i.dv-grip (the short handle)
          html[data-dragging=vertical|horizontal] while a pointer drag is on
          #main[data-split=cols] (--split-conv) · .watch[data-split=rows|cols] (--split-run)
   Tokens: --dv-hit (hit thickness; never thinner than the gap), --dv-grip-w, --dv-grip-len, --dv-line (line
           thickness), --dv-inset (the line stops this far from each end: set it to the piece radius). */
:root { --dv-hit: 12px; --dv-grip-w: 4px; --dv-grip-len: 40px; --dv-line: 2px; --dv-inset: 12px; }
@media (pointer: coarse) { :root { --dv-hit: 28px; --dv-grip-w: 6px; --dv-grip-len: 56px; } }

/* the size he chose: one variable on the grid that owns the two tracks */
body:not(.phone) #main[data-split]:not(.collapsed):not([data-side="empty"]) { grid-template-columns: var(--split-conv) minmax(0, 1fr); }
body:not(.phone) #sideBody .watch[data-split="rows"] { grid-template-rows: minmax(0, 1fr) var(--split-run); }
body:not(.phone) #sideBody .watch[data-split="cols"] { grid-template-columns: minmax(0, 1fr) var(--split-run); }
body:not(.phone) #sideBody .watch[data-split] > .rp { max-height: none; }

/* the handle lies over the gap (divider.js measures where the look put it): out of flow, it takes no space */
.divider { position: absolute; z-index: 6; box-sizing: border-box; margin: 0; padding: 0; border: 0; background: none;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.divider[hidden], .phone .divider { display: none; }
.divider[data-orientation="vertical"] { width: max(var(--dv-hit), var(--dv-gap, 0px)); height: var(--dv-len, 0px); transform: translateX(-50%); cursor: col-resize; }
.divider[data-orientation="horizontal"] { height: max(var(--dv-hit), var(--dv-gap, 0px)); width: var(--dv-len, 0px); transform: translateY(-50%); cursor: row-resize; }
/* at a limit the pointer shows the one way it still goes */
.divider[data-orientation="vertical"][data-limit="min"] { cursor: e-resize; }
.divider[data-orientation="vertical"][data-limit="max"] { cursor: w-resize; }
.divider[data-orientation="horizontal"][data-limit="min"] { cursor: s-resize; }
.divider[data-orientation="horizontal"][data-limit="max"] { cursor: n-resize; }
.divider[aria-disabled="true"] { cursor: default; }

.divider > i { position: absolute; display: block; pointer-events: none; border-radius: 999px; opacity: 0;
  transition: opacity 120ms linear, background-color 120ms linear, width 120ms cubic-bezier(.2, 0, 0, 1), height 120ms cubic-bezier(.2, 0, 0, 1); }
.divider > .dv-line { background: var(--accent); }
.divider > .dv-grip { background: var(--ink-3); }
.divider[data-orientation="vertical"] > .dv-line { left: 50%; top: var(--dv-inset); bottom: var(--dv-inset); width: var(--dv-line); transform: translateX(-50%); }
.divider[data-orientation="vertical"] > .dv-grip { left: 50%; top: 50%; width: var(--dv-grip-w); height: var(--dv-grip-len); transform: translate(-50%, -50%); }
.divider[data-orientation="horizontal"] > .dv-line { top: 50%; left: var(--dv-inset); right: var(--dv-inset); height: var(--dv-line); transform: translateY(-50%); }
.divider[data-orientation="horizontal"] > .dv-grip { top: 50%; left: 50%; height: var(--dv-grip-w); width: var(--dv-grip-len); transform: translate(-50%, -50%); }

/* hover: the grip appears. focus: the line (the focus mark of a divider) and the grip, in the accent.
   dragging: the same, the grip longer. at a limit: both let go of the accent — it goes no further that way. */
.divider:hover > .dv-grip { opacity: 1; }
/* its focus mark is the line: a look's general focus ring must not box a strip as tall as the window */
.divider:focus, .divider:focus-visible { outline: none !important; box-shadow: none !important; border: 0 !important; background: none !important; }
.divider:focus-visible > .dv-line, .divider[data-dragging] > .dv-line { opacity: 1; }
.divider:focus-visible > .dv-grip, .divider[data-dragging] > .dv-grip { opacity: 1; background: var(--accent); }
.divider[data-orientation="vertical"][data-dragging] > .dv-grip { height: calc(var(--dv-grip-len) + 16px); }
.divider[data-orientation="horizontal"][data-dragging] > .dv-grip { width: calc(var(--dv-grip-len) + 16px); }
.divider[data-dragging][data-limit] > .dv-line, .divider[data-dragging][data-limit] > .dv-grip,
.divider:focus-visible[data-limit] > .dv-grip { background: var(--ink-3); }
.divider[aria-disabled="true"] > .dv-grip { opacity: 0; }
.divider[aria-disabled="true"]:focus-visible > .dv-line { opacity: 1; background: var(--ink-3); }

/* touch (tablets): no hover there, so the grip shows at rest, and it carries a 44 px pad */
@media (pointer: coarse) {
  .divider > .dv-grip { opacity: 1; }
  .divider::after { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }
  .divider[data-orientation="vertical"]::after { height: 96px; }
  .divider[data-orientation="horizontal"]::after { width: 96px; }
}

/* while a pointer drag is on: one cursor everywhere, no selection, nothing under the pointer swallows it */
html[data-dragging="vertical"] { cursor: col-resize; }
html[data-dragging="horizontal"] { cursor: row-resize; }
html[data-dragging] body, html[data-dragging] body * { cursor: inherit !important; -webkit-user-select: none !important; user-select: none !important; }
html[data-dragging] iframe { pointer-events: none; }

@media (prefers-reduced-motion: reduce) { .divider > i { transition: opacity 80ms linear, background-color 80ms linear; } }
