/* =========================================================
   base.css – font, reset, typografia, dostępność
   ========================================================= */

/* Inter hostowany lokalnie (plik w assets/fonts – patrz README).
   Jeśli pliku brak, przeglądarka użyje fontów zapasowych z --font. */
@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.6;
  overflow-x: clip; /* zabezpieczenie przed poziomym scrollem */
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1 0 auto;
}

img,
picture,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  max-width: 100%;
}

/* Ikony SVG wstawiane inline przez funkcję ikona() */
.icon {
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
  vertical-align: -0.2em;
}

/* --- Typografia --- */
h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
}

h1 {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
}

h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}

h3 {
  font-size: 1.2rem;
}

p,
li,
dd {
  overflow-wrap: break-word;
}

strong,
b {
  font-weight: 600;
}

a {
  color: var(--color-accent);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--color-accent-hover);
}

small,
.small {
  font-size: 0.875rem;
}

.muted {
  color: var(--color-text-muted);
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin-block: 2rem;
}

/* --- Elementy formularzy dziedziczą font --- */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

/* --- Dostępność --- */
:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

/* Ukrycie wizualne z zachowaniem dla czytników ekranu */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Link „przejdź do treści” – widoczny tylko po fokusie klawiaturą */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 1000;
  padding: 0.75rem 1.25rem;
  background: var(--color-accent);
  color: var(--color-text-dark);
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* Ograniczenie animacji dla osób, które sobie tego życzą */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
