/* Beginner3D UI — reset i style elementów HTML.
   Nic tutaj nie zna komponentów; wyłącznie surowe elementy. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

/* Klasy komponentow ustawiaja wlasny `display`, ktory bije domyslna regule
   przegladarki dla [hidden]. Bez tego ukryty panel nadal by sie rysowal. */
[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }
h4 { font-size: var(--text-base); }

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

button:disabled {
  cursor: not-allowed;
}

fieldset {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}

legend {
  padding: 0;
}

hr {
  height: var(--border-width);
  margin: 0;
  border: none;
  background: var(--border);
}

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

table {
  border-collapse: collapse;
  width: 100%;
}

dialog {
  padding: 0;
  border: none;
  background: none;
  color: inherit;
}

/* Przegladarka chowa zamkniety <dialog> wlasna regula `display: none`, ale
   przegrywa ona z kazdym `display` z arkusza aplikacji - a okno szczegolow
   ustawia `display: flex`. Bez tej reguly zamkniete okno zostaje na stronie
   i widac je jako pusty prostokat pod stopka. */
dialog:not([open]) {
  display: none;
}

dialog::backdrop {
  background: rgb(6 9 14 / 0.6);
  backdrop-filter: blur(2px);
}

/* Jeden, spójny pierścień fokusu w całej aplikacji. */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}

::selection {
  background: var(--accent);
  color: var(--text-inverted);
}

/* Treść tylko dla czytników ekranu. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Link „przejdź do treści” — widoczny dopiero po sfokusowaniu. */
.skip-link {
  position: absolute;
  top: var(--space-2xs);
  left: var(--space-2xs);
  z-index: var(--layer-toast);
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--text-inverted);
  font-weight: var(--weight-semibold);
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
