/* BAZA: wyzerowanie, typografia, siatka strony, nagłówek z menu, przycisk, wstęp. Bez dekoracji: charakter daje projekt. */

@layer baza {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; hanging-punctuation: first; }
  body {
    min-height: 100svh;
    background: var(--tlo); color: var(--tekst);
    font: 400 var(--pismo-1)/1.55 var(--kroj-tekst);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    overflow-x: clip; /* clip zamiast hidden: nie psuje position: sticky w scenach */
    transition: background-color 0.9s var(--przejazd), color 0.9s var(--przejazd); /* płynna zmiana motywu sekcji */
  }
  img, picture, video, canvas, svg { display: block; max-width: 100%; }
  img, video { height: auto; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { background: none; border: 0; padding: 0; cursor: pointer; }
  a { color: inherit; text-decoration-thickness: 0.06em; text-underline-offset: 0.18em; }
  ul[class], ol[class] { list-style: none; padding: 0; }
  h1, h2, h3, h4 { font-family: var(--kroj-tytul); font-weight: 500; line-height: 1.02; letter-spacing: -0.02em; text-wrap: balance; }
  h1 { font-size: var(--pismo-5); line-height: 0.95; letter-spacing: -0.035em; }
  h2 { font-size: var(--pismo-4); }
  h3 { font-size: var(--pismo-3); line-height: 1.08; }
  p, li, figcaption { text-wrap: pretty; max-width: 68ch; }
  ::selection { background: var(--akcent); color: var(--na-akcencie); }
  :focus-visible { outline: 2px solid var(--akcent); outline-offset: 3px; }
  [hidden] { display: none !important; }

  /* --- pomocnicze ---------------------------------------------------------------------------------------------------- */
  .tylko-czytnik { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .pomin { position: fixed; top: 0.5rem; left: 0.5rem; z-index: 100; padding: 0.6rem 1rem; background: var(--tekst); color: var(--tlo); translate: 0 -200%; }
  .pomin:focus { translate: none; }
  .kontener { width: min(100% - 2 * var(--margines), var(--szerokosc)); margin-inline: auto; }
  .sekcja { padding-block: var(--odstep-sekcji); }
  .detal { font: 500 var(--pismo-0)/1.3 var(--kroj-detal); letter-spacing: 0.06em; text-transform: uppercase; color: var(--tekst-2); }
  .wstep-akapitu { font-size: var(--pismo-2); line-height: 1.35; }

  /* --- przycisk -------------------------------------------------------------------------------------------------------- */
  .przycisk {
    display: inline-flex; align-items: center; gap: 0.6em; min-height: 3rem; padding: 0.85em 1.5em;
    background: var(--tekst); color: var(--tlo); border-radius: var(--promien);
    font-weight: 500; line-height: 1.1; text-decoration: none;
    transition: background-color var(--czas) var(--wyjazd), color var(--czas) var(--wyjazd);
  }
  .przycisk:hover { background: var(--akcent); color: var(--na-akcencie); }
  .przycisk-linia { background: transparent; color: var(--tekst); box-shadow: inset 0 0 0 1px var(--linia); }

  /* --- nagłówek i menu ------------------------------------------------------------------------------------------------- */
  .naglowek {
    position: fixed; inset: 0 0 auto; z-index: 50;
    display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
    padding: 1rem var(--margines);
    transition: translate 0.5s var(--wyjazd); /* translate, nie transform: przy „none” nie psuje position: fixed w menu */
  }
  .naglowek.schowany { translate: 0 -110%; }
  /* min-height 2.75rem (44 px) i poziomy zapas: cel dotyku ma być wygodny także na tablecie, choć sam napis jest mały */
  .znak { display: inline-flex; align-items: center; min-height: 2.75rem; font: 500 1.125rem/1 var(--kroj-tytul); letter-spacing: -0.01em; text-decoration: none; }
  .menu { display: flex; align-items: center; gap: clamp(0.25rem, 1.2vw, 1.25rem); }
  .menu a { display: inline-flex; align-items: center; min-height: 2.75rem; padding-inline: 0.5rem; text-decoration: none; font-size: var(--pismo-0); }
  .menu a:last-child { margin-right: -0.5rem; }
  .menu-przycisk { display: none; }

  @media (max-width: 899px) {
    .menu-przycisk { display: grid; place-items: center; width: 3rem; height: 3rem; margin-right: -0.75rem; position: relative; z-index: 2; }
    .menu-przycisk span { grid-area: 1 / 1; width: 1.5rem; height: 2px; background: currentColor; transition: translate 0.4s var(--wyjazd), rotate 0.4s var(--wyjazd); }
    .menu-przycisk span:first-child { translate: 0 -4px; }
    .menu-przycisk span:last-child { translate: 0 4px; }
    .menu-otwarte .menu-przycisk span:first-child { translate: none; rotate: 45deg; }
    .menu-otwarte .menu-przycisk span:last-child { translate: none; rotate: -45deg; }
    .menu {
      position: fixed; inset: 0; z-index: 1; height: 100dvh;
      flex-direction: column; align-items: flex-start; justify-content: center; gap: 0.25rem;
      padding: 5rem var(--margines) 2rem; background: var(--tlo);
      clip-path: inset(0 0 100% 0); visibility: hidden;
      transition: clip-path 0.7s var(--przejazd), visibility 0s 0.7s;
    }
    .menu a { font: 500 var(--pismo-4)/1.1 var(--kroj-tytul); letter-spacing: -0.02em; padding: 0.15em 0; margin: 0; opacity: 0; translate: 0 0.6em; transition: opacity 0.5s, translate 0.6s var(--wyjazd); }
    .menu-otwarte .menu { clip-path: inset(0); visibility: visible; transition: clip-path 0.7s var(--przejazd), visibility 0s; }
    .menu-otwarte .menu a { opacity: 1; translate: none; transition-delay: calc(0.18s + var(--i, 0) * 0.05s); }
    .menu a:nth-child(2) { --i: 1; } .menu a:nth-child(3) { --i: 2; } .menu a:nth-child(4) { --i: 3; } .menu a:nth-child(5) { --i: 4; } .menu a:nth-child(6) { --i: 5; }
  }

  /* --- wstęp (ekran powitalny) ----------------------------------------------------------------------------------------- */
  .wstep { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: var(--tekst); color: var(--tlo); }
  .wstep-napis-ramka { overflow: clip; padding: 0.2em 0.1em 0.3em; }
  .wstep [data-wstep-napis] { font: 500 var(--pismo-3)/1 var(--kroj-tytul); letter-spacing: -0.02em; }
  .bez-wstepu .wstep, .bezpiecznik .wstep, html:not(.js) .wstep { display: none; }
  .trwa-wstep body { overflow: hidden; }

  /* --- stopka ---------------------------------------------------------------------------------------------------------- */
  .stopka { padding: var(--odstep-sekcji) 0 2rem; }

  /* --- „mniej ruchu”: systemowe ustawienie wyłącza przejścia CSS; animacje GSAP wyłącza rdzeń ------------------------ */
  @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; }
  }
}
