/*
 * @skammer/schism — required stylesheet.
 * Provides hit areas, cursors, and theming hooks. Override via CSS custom properties:
 *   --schism-handle-size      thickness of the resizer hit area (default 9px)
 *   --schism-handle-bg        background color of the visible 1px divider
 *   --schism-handle-bg-hover  hover/active divider background
 *   --schism-handle-color     color of the optional center indicator
 *   --schism-pane-bg          default pane background
 */

schism-group {
  --schism-handle-size: 9px;
  --schism-handle-bg: color-mix(in srgb, currentColor 15%, transparent);
  --schism-handle-bg-hover: color-mix(in srgb, currentColor 40%, transparent);
  --schism-handle-color: currentColor;
  --schism-pane-bg: transparent;

  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

schism-group[direction="vertical"] {
  flex-direction: column;
}

/* Panes are flex items; sizes are written via inline `flex-grow`. */
schism-pane {
  display: block;
  overflow: hidden;
  background: var(--schism-pane-bg);
  min-width: 0;
  min-height: 0;
}

/* Opt-in animated size transitions. Suppressed mid-drag for 1:1 pointer feel.
 * Honors prefers-reduced-motion. */
schism-group[animate] > schism-pane {
  transition: flex-grow var(--schism-animate-duration, 200ms)
    var(--schism-animate-easing, ease);
}

schism-group[animate][data-dragging] > schism-pane {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  schism-group[animate] > schism-pane {
    transition: none;
  }
}

/* Resizer = 1px visible bar; ::before provides the wider transparent hit area. */
schism-resizer {
  display: block;
  flex: 0 0 auto;
  position: relative;
  background: var(--schism-handle-bg);
  touch-action: none;
  user-select: none;
}

schism-resizer::before {
  content: "";
  position: absolute;
  background: transparent;
}

schism-group[direction="horizontal"] > schism-resizer {
  width: 1px;
}

schism-group[direction="horizontal"] > schism-resizer::before {
  inset: 0;
  inset-inline: calc((var(--schism-handle-size) - 1px) / -2);
  cursor: ew-resize;
}

schism-group[direction="vertical"] > schism-resizer {
  height: 1px;
}

schism-group[direction="vertical"] > schism-resizer::before {
  inset: 0;
  inset-block: calc((var(--schism-handle-size) - 1px) / -2);
  cursor: ns-resize;
}

schism-resizer:hover,
schism-resizer:focus-visible,
schism-resizer[data-active] {
  background: var(--schism-handle-bg-hover);
}

schism-resizer:focus-visible {
  outline: 2px solid var(--schism-handle-color);
  outline-offset: -2px;
}

schism-resizer[disabled] {
  cursor: default;
  pointer-events: none;
  opacity: 0.5;
}

/* While dragging, suppress pointer events on panes so iframes/buttons don't eat moves. */
schism-group[data-dragging] > schism-pane {
  pointer-events: none;
}
