*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
  margin: 0;
}

body {
  background-color: var(--color-bg);
  background-image: var(--app-bg-image);
  background-size: var(--app-bg-size);
  background-attachment: fixed;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: var(--body-weight);
  line-height: 1.45;
  word-spacing: var(--word-spacing, normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Warstwa pod kontrolkami modułów z SDK (controls.module.css) — inaczej reguły elementów wygrywałyby z nimi. */
@layer reset, controls;

@layer reset {
  button,
  input,
  select {
    font: inherit;
    color: inherit;
    word-spacing: inherit; /* pola formularza nie dziedziczą odstępu między słowami z body */
  }
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* Fokus kontrolki zawsze widoczny (WCAG 2.4.7, P-197): komponenty zastępowały obwódkę poświatą ok. 1,2 : 1. `!important`,
   żeby żaden nie mógł jej zgasić; wiersze tabel i płótno tablicy mają własne, czytelne oznaczenie. */
:is(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--color-focus) !important;
}

* {
  scrollbar-color: var(--color-scrollbar) transparent;
}

::selection {
  background: var(--color-accent-soft);
}

/* Pojawienie się wiersza drzewa (rozwinięcie gałęzi): wsuwa się z góry, kolejne z małym opóźnieniem („rozwijanie").
   Używa `translate`, nie `transform`, bo wiersze WBS są ustawiane przez `transform`. */
@keyframes tree-row-enter {
  from {
    opacity: 0;
    translate: 0 -10px;
  }
}

.tree-row-enter {
  animation: tree-row-enter var(--motion-expand) var(--motion-ease) both;
  animation-delay: calc(min(var(--enter-index, 0), 14) * var(--motion-stagger));
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}

/* Trwa przeciąganie wiersza WBS: kursor w całym oknie mówi, czy w tym miejscu można upuścić. */
:root[data-row-drag] * {
  cursor: grabbing !important;
  user-select: none;
}

:root[data-row-drag='blocked'] * {
  cursor: no-drop !important;
}

/* Trwa przeciąganie paska na osi Gantta: przesunięcie albo zmiana krawędzi, bez zaznaczania tekstu. */
:root[data-bar-drag] * {
  cursor: grabbing !important;
  user-select: none;
}

:root[data-bar-drag='start'] *,
:root[data-bar-drag='end'] * {
  cursor: ew-resize !important;
}

:root[data-bar-drag='link'] * {
  cursor: crosshair !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
