/* assets/css/app.css */
/* ==========================================================================
   Global base for tutokupisz.pl
   - Minimal, conflict-free foundations
   - No component-specific styles (Topbar/Header w modułach)
   ========================================================================== */

/* === CSS Variables (site-wide) ========================================== */
:root{
  --container-max: 1320px;
  --gutter: clamp(16px, 3vw, 24px);
  --radius: 16px;

  /* Colors (neutral defaults; komponenty nadpisują lokalnie) */
  --ink: #111827;
  --bg: #ffffff;
  --muted: #f6f8fb;
  --line: #e5e7eb;
  --accent: #0A84FF;       /* Linki mają stałe podkreślenie → spełnia WCAG 1.4.1 niezależnie od kontrastu */
  --accent-600: #0a6fe0;
}

/* === Normalize / Base =================================================== */
*,*::before,*::after{ box-sizing: border-box; }

html{
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
}

body{
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Noto Sans",sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Typografia – spójne odstępy (stabilizacja, mniejsze ryzyko CLS) */
:where(h1,h2,h3,h4,h5,h6){ margin: 0 0 .6em; line-height: 1.2; text-wrap: balance; }
:where(p,ul,ol){ margin: 0 0 1rem; }
:where(ul,ol){ padding-inline-start: 1.25rem; }

/* Kontener strony */
.container{
  max-width: var(--container-max);
  width: 100%;
  min-width: 0;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  margin: 0 auto;
}

/* Media – nigdy nie wyjdą poza viewport */
img,svg,video,canvas,iframe{
  display: block;
  max-width: 100%;
  height: auto;
}

/* Linki + dostępność
   — Stałe podkreślenie (rozróżnialność niezależnie od koloru) */
a{
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: .08em;
}
a:hover{
  text-decoration-thickness: .12em;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Elementy ukryte wizualnie (dla SR) – solidna implementacja */
.sr-only{
  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;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.not-sr-only{ position: static !important; width: auto !important; height: auto !important; clip: auto !important; clip-path: none !important; white-space: normal !important; overflow: visible !important; }

/* Skip link (WCAG) – pojawia się przy focusie */
.skip-link{
  position: absolute; left: 8px; top: 8px;
  transform: translateY(-150%);
  background: #fff; color: #000;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  z-index: 10000;
}
.skip-link:focus{ transform: none; }

/* === Proste utilsy / patterny (globalne) ================================ */

/* Grid helper */
.grid{ display: grid; gap: 16px; }

/* Button (bazowy; komponenty mogą go nadpisywać lokalnie)
   — Bez filter: brightness() (stabilniejszy compositing/INP) */
.btn{
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem;
  padding: .7rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover{
  background: var(--accent-600);
  border-color: var(--accent-600);
}
/* Focus – korzystamy ze wspólnego outline; nie nadpisujemy go box-shadowem */
.btn:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Karta */
.card{
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
}

/* Badge promocyjny (przykładowy) */
.badge-sale{
  position: absolute; top: 8px; left: 8px;
  background: #EF4444; color: #fff;
  border-radius: 999px; padding: .25rem .5rem; font-size: .75rem;
}

/* Stopka (szkielet – bez szczegółów komponentu) */
.footer{ background: #111827; color: #fff; padding: 40px 0; }
.footer a{ color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* === Ikony – UNIWERSALNE =============================================== */
/* Jeden system dla: inline SVG, IMG (svg/png/webp) oraz maski CSS. */
.icon{
  --icon-size: 1.25rem; /* 20px */
  inline-size: var(--icon-size);
  block-size: var(--icon-size);
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  vertical-align: middle;
  line-height: 1;
  color: currentColor;
}
.icon--sm{ --icon-size: 1rem; }      /* 16px */
.icon--md{ --icon-size: 1.25rem; }   /* 20px */
.icon--lg{ --icon-size: 1.5rem; }    /* 24px */

/* Ułatwienia dla przycisków ikonowych */
.icon-only{ inline-size: 2.25rem; block-size: 2.25rem; display: inline-flex; align-items: center; justify-content: center; }
.icon-only:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }

/* 1) INLINE SVG – rozmiar i blokowy rendering */
.icon > svg{
  inline-size: 100%;
  block-size: 100%;
  display: block;
}

/* Kolorowanie currentColor TYLKO gdy nie-native */
.icon:not(.icon--native) > svg{
  fill: currentColor;
  stroke: none;
}

/* Outline (stroke-mode) – TYLKO gdy nie-native */
.icon:not(.icon--native).icon--stroke > svg{
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Awaryjne nadpisania twardych styli */
.icon:not(.icon--native) > svg [fill]:not([fill="none"]){ fill: currentColor; }
.icon:not(.icon--native).icon--stroke > svg [stroke]{ stroke: currentColor; }
.icon:not(.icon--native) > svg [style*="fill"]{ fill: currentColor !important; }
.icon:not(.icon--native).icon--stroke > svg [style*="stroke"]{ stroke: currentColor !important; }

/* Jeśli klasa stroke trafi na <svg> bezpośrednio */
.icon:not(.icon--native) > svg.icon--stroke{
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 2) IMG – zewnętrzne svg/png/webp/jpg (kolory zostają) */
img.icon.icon--img{
  inline-size: var(--icon-size);
  block-size: var(--icon-size);
  object-fit: contain;
  display: inline-block;
  border: 0;
  background: transparent;
}

/* 3) MASK – ikonki koloryzowane przez currentColor */
.icon.icon--mask{
  background-color: currentColor;
  -webkit-mask: var(--icon-url) no-repeat center / contain;
          mask: var(--icon-url) no-repeat center / contain;
}

/* Dodatki UX dla ikon */
.icon[aria-disabled="true"]{ opacity: .5; }
@keyframes icon-spin { to{ transform: rotate(360deg); } }
.icon--spin{ animation: icon-spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce){
  .icon--spin{ animation: none; }
}

/* === Responsive safety kit (mobile) ==================================== */
html,body{ width: 100%; }
body{ overflow-x: hidden; }

/* Długie ciągi (np. e-mail bez spacji) nie rozszerzą layoutu */
a, .label{ word-break: break-word; overflow-wrap: anywhere; }

/* Selekcja (czytelność) – fallback + nowoczesny wariant */
::selection{ background: #dbeafe; color: #000; }
::selection{ background: color-mix(in oklab, var(--accent) 30%, white); color: #000; }

/* === Minimal header/topbar skeleton (bez stylowania komponentów) ======= */
/* UWAGA: brak reguł .topbar/.site-header tutaj — wszystko w modułach.
   Dzięki temu app.css nie blokuje i nie psuje komponentów. */


/* —————————————————————————————————————————————————————————
   Rejestracja – potwierdzenie: ukryj tytuł/breadcrumb WYŁĄCZNIE na tej stronie
   (wizualnie, ale zostaw dla czytników ekranu – SR-only).
   Dodaj klasę `tuto-ev-page` do <body> na ekranie "rejestracja – potwierdzenie".
   ————————————————————————————————————————————————————————— */
body.tuto-ev-page .entry-title,
body.tuto-ev-page .page-title,
body.tuto-ev-page .wp-block-post-title,
body.tuto-ev-page .page-header,
body.tuto-ev-page .woocommerce-breadcrumb{
  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;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* (opcjonalny) Fallback po ID strony – użyj tylko jeśli nie możesz dodać klasy na <body> */
/*
body.page-id-XXXXX .entry-title,
body.page-id-XXXXX .page-title,
body.page-id-XXXXX .wp-block-post-title,
body.page-id-XXXXX .page-header,
body.page-id-XXXXX .woocommerce-breadcrumb {
  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;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
*/

/* === Tryby dostępności / wysokiego kontrastu =========================== */
@media (prefers-contrast: more){
  a{ text-decoration-thickness: .14em; }
  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  textarea:focus-visible,
  select:focus-visible{
    outline-width: 3px;
  }
}

@media (forced-colors: active){
  /* Upewnij się, że kontrolki są widoczne w Windows HC */
  .btn{
    border: 1px solid ButtonText;
    background: ButtonFace;
    color: ButtonText;
  }
  .btn:hover{
    background: ButtonFace;
    border-color: ButtonText;
    color: ButtonText;
  }
  .icon,
  .icon-only{
    border: 1px solid CanvasText; /* Ikony maskowane stają się widoczne */
  }
  a{
    text-decoration: underline;
  }
}
