/*
 * Reset, typografia, fokus i ograniczony ruch. Wartości wyłącznie z tokens.css.
 * Mobile-first: style bez zapytań @media są dla telefonu; większe ekrany dostają tylko dodatki (min-width w em).
 */

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

html {
  font-size: calc(var(--root-font-size) * var(--text-scale));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  /* dvh uwzględnia pasek adresu na telefonie; vh zostaje dla starszych przeglądarek. */
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  /* Długie słowo przy największym tekście łamie się zamiast wypychać stronę w bok. */
  overflow-wrap: break-word;
}

h1,
h2,
p,
ul,
fieldset,
legend {
  margin: 0;
  padding: 0;
}

h1 {
  font-size: var(--font-size-title);
  line-height: var(--line-height-tight);
}

h2 {
  font-size: var(--font-size-large);
  line-height: var(--line-height-tight);
}

p {
  max-width: var(--line-length);
}

ul {
  list-style: none;
}

fieldset {
  border: 0;
  min-width: 0;
}

/* Atrybut hidden ma ukrywać także elementy, którym style nadają display: grid albo flex. */
[hidden] {
  display: none !important;
}

a {
  color: var(--color-primary);
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
  color: inherit;
}

/* Bez opóźnienia dotknięcia i bez przybliżania przy podwójnym stuknięciu; powiększanie dwoma palcami działa dalej. */
a,
button,
input,
label {
  touch-action: manipulation;
}

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

/* Nagłówek dostaje fokus programowo po zmianie ekranu; obwódka wokół niego tylko by myliła. */
h1[tabindex="-1"]:focus {
  outline: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 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;
  }
}
