/* hackedindex.com: uklad na telefon i tablet (ekran ponizej 1024 px).
   Plansze z project/ maja style w atrybutach (plansza 1440 px), wiec ten arkusz nadpisuje je
   z !important po tym, jak przegladarka zapisuje style w DOM (np. "padding: 0px 120px",
   "repeat(12, minmax(0px, 1fr))"). Tam, gdzie styl nie wystarcza do wskazania elementu, plansza
   ma hak data-m (ten sam w EN i PL). Od 1024 px w gore strona to plansza 1440 px skalowana
   w live/site.js, bez zmian. Sprawdzenie: testy/mobile_check.py. */

@media (max-width: 1023px) {
  body { overflow-wrap: break-word; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  .sc-host > div { width: auto !important; height: auto !important; min-height: 100vh !important; }

  /* boczne marginesy 120 px planszy */
  [style*="px 120px"] { padding-left: 40px !important; padding-right: 40px !important; }
  [style*="padding: 96px 120px"], [style*="padding: 88px 120px"], [style*="padding: 80px 120px"],
  [style*="padding: 72px 120px"] { padding-top: 56px !important; }
  [style*="120px 96px"], [style*="padding: 96px 120px;"] { padding-bottom: 64px !important; }

  /* siatka 12 kolumn: jedna kolumna; 3, 4 i 5 kolumn: dwie */
  [style*="repeat(12,"] { grid-template-columns: minmax(0, 1fr) !important; row-gap: 32px !important; }
  [style*="repeat(12,"] > * { grid-column: 1 / -1 !important; }
  [style*="repeat(3,"], [style*="repeat(4,"], [style*="repeat(5,"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  /* element rozpiety na kilka kolumn i nieparzysty ostatni: cala szerokosc */
  [style*="repeat(3,"] > [style*="grid-column"], [style*="repeat(4,"] > [style*="grid-column"],
  [style*="repeat(5,"] > [style*="grid-column"],
  [style*="repeat(3,"] > :last-child:nth-child(odd), [style*="repeat(5,"] > :last-child:nth-child(odd) {
    grid-column: 1 / -1 !important;
  }

  /* duze liczby i tytuly */
  [style*="font-size: 176px"] { font-size: 112px !important; }
  [style*="font-size: 80px"] { font-size: 60px !important; }
  [style*="font-size: 64px"] { font-size: 48px !important; }
  [style*="font-size: 58px"], [style*="font-size: 56px"], [style*="font-size: 54px"],
  [style*="font-size: 52px"] { font-size: 42px !important; }
  [style*="font-size: 48px"] { font-size: 38px !important; }

  /* przyciski o stalej wysokosci: tekst moze zawinac sie w dwie linie */
  a[style*="height: 4"], a[style*="height: 5"], button[style*="height: 4"], button[style*="height: 5"] {
    height: auto !important; min-height: 46px; box-sizing: border-box; padding-top: 10px !important; padding-bottom: 10px !important;
  }

  /* pasek prototypu */
  .sc-host > div > div:first-child { height: auto !important; padding: 8px 16px; flex-wrap: wrap; text-align: center; line-height: 1.45; }

  /* naglowek: logo i przycisk w pierwszym rzedzie, przewijane menu i jezyk w drugim */
  header { height: auto !important; flex-wrap: wrap; padding: 10px 40px 0 !important; row-gap: 2px !important; column-gap: 12px !important; }
  header:has(> nav)::after { content: ''; order: 2; flex-basis: 100%; height: 0; }
  header > a:first-child { margin-right: auto; min-height: 48px; }
  header > button, header > a:last-child { order: 1; }
  header > nav:first-of-type {
    order: 3; flex: 1 1 0 !important; min-width: 0; overflow-x: auto; gap: 24px !important;
    scrollbar-width: none; padding-right: 24px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  header > nav:first-of-type::-webkit-scrollbar { display: none; }
  header > nav:first-of-type > a { padding: 12px 0 !important; flex-shrink: 0; }
  header > nav:nth-of-type(2) { order: 4; align-self: center; }
  header > div { flex-wrap: wrap; }

  /* uklady z hakiem data-m */
  [data-m="stack"] { flex-direction: column !important; align-items: flex-start !important; gap: 16px !important; }
  [data-m="stack"] > form { align-self: stretch; }
  [data-m="stack"] [role="status"] { width: auto !important; }
  [data-m="wrap"] { flex-wrap: wrap !important; }
  [data-m="left"] { justify-content: flex-start !important; }
  [data-m="crumb"] a { padding: 6px 0; }
  [data-m="chart"] { width: 100% !important; height: auto !important; }

  /* os czasu fali atakow: pionowa */
  [data-m="tl"] { grid-template-columns: minmax(0, 1fr) !important; row-gap: 28px !important; padding-top: 0 !important; }
  [data-m="tl"] > [style*="position: absolute"] { display: none !important; }
  [data-m="tl"]::before { content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: #D6D8D2; }
  [data-m="tl"] > div { padding-left: 32px; }
  [data-m="tl"] > div > span:first-child { position: absolute; left: 0; top: 2px; }

  /* tabele: przewijane w poziomie we wlasnym pudelku */
  /* position: relative trzyma w pudelku ukryte podpisy .sr-only (position: absolute) z komorek */
  *:has(> table) { overflow-x: auto !important; position: relative; -webkit-overflow-scrolling: touch; }
  table:has(th:nth-child(4)) { min-width: 600px; }
  table:has(th:nth-child(4)) :is(th, td) { padding-left: 14px !important; padding-right: 14px !important; }
  /* numer CVE w jednym kawalku (Radar: 3. kolumna, Fala atakow: pierwsza linia 2. kolumny) */
  [data-m="cards"] td:nth-child(3), [data-m="cards"] td:nth-child(2) > div > span:first-child { white-space: nowrap; }

  /* link pod wykresem slupkowym w hero */
  figure a { display: inline-block; padding: 5px 0; margin: -5px 0; white-space: nowrap; }

  /* slupki anatomii: liczba i procent zawsze w jednej linii obok podpisu */
  [style*="justify-content: space-between; gap: 12px; font-size: 14.5px;"] > span:last-child { white-space: nowrap; flex-shrink: 0; }

  /* stopka strony glownej: marka, cztery kolumny linkow, dolny wiersz */
  footer[style*="repeat(12,"] { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; row-gap: 28px !important; }
  footer[style*="repeat(12,"] > * { grid-column: auto !important; }
  footer[style*="repeat(12,"] > :first-child, footer[style*="repeat(12,"] > :last-child { grid-column: 1 / -1 !important; }
  footer a { padding: 4px 0; }
  footer > div:last-child { flex-wrap: wrap; }
  /* prosta stopka podstron: opis w pierwszej linii, podpis w drugiej, gdy brak miejsca */
  footer[style*="display: flex"] { flex-wrap: wrap; row-gap: 8px !important; }
  footer[style*="display: flex"] > span:last-child { white-space: nowrap; }
}

@media (max-width: 639px) {
  /* karty: mniejsze wnetrze */
  [style*="padding: 48px;"], [style*="padding: 40px 44px;"], [style*="padding: 36px 40px;"],
  [style*="padding: 32px;"], [style*="padding: 30px;"], [style*="padding: 28px;"],
  [style*="padding: 26px 32px;"], [style*="padding: 28px 32px;"] { padding: 22px 20px !important; }
  [style*="padding: 28px 32px 32px;"] { padding: 22px 20px 24px !important; }
  [style*="padding: 26px 28px"] { padding-left: 20px !important; padding-right: 20px !important; }
  [style*="padding: 8px 32px 4px;"] { padding-left: 20px !important; padding-right: 20px !important; }
  [style*="margin: 12px 32px"] { margin-left: 20px !important; margin-right: 20px !important; }

  [style*="px 120px"] { padding-left: 16px !important; padding-right: 16px !important; }
  [style*="padding: 96px 120px"], [style*="padding: 88px 120px"], [style*="padding: 80px 120px"],
  [style*="padding: 72px 120px"] { padding-top: 40px !important; }
  [style*="120px 96px"], [style*="padding: 96px 120px;"] { padding-bottom: 48px !important; }

  [style*="repeat(2,"], [style*="repeat(3,"], [style*="repeat(4,"], [style*="repeat(5,"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  [style*="font-size: 176px"] { font-size: 88px !important; }
  [style*="font-size: 80px"] { font-size: 48px !important; }
  [style*="font-size: 64px"] { font-size: 40px !important; }
  [style*="font-size: 58px"], [style*="font-size: 56px"], [style*="font-size: 54px"],
  [style*="font-size: 52px"] { font-size: 34px !important; }
  [style*="font-size: 48px"] { font-size: 32px !important; }
  [style*="font-size: 42px"], [style*="font-size: 40px"], [style*="font-size: 38px"] { font-size: 28px !important; }
  [style*="font-size: 36px"], [style*="font-size: 34px"], [style*="font-size: 32px"] { font-size: 26px !important; }

  header { padding: 8px 16px 0 !important; }
  header > button { display: none !important; }
  header > a:last-child, header > div > a:last-child { height: 40px !important; min-height: 40px; padding: 0 14px !important; font-size: 14px !important; }
  header > div { gap: 10px !important; }

  /* naglowek maila na Powiadomieniach: etykieta w jednym kawalku, opis pod nia, gdy brak miejsca */
  article > div:first-child[style*="justify-content: space-between"] { flex-wrap: wrap; row-gap: 6px !important; }
  article > div:first-child > span[style*="border-radius: 6px"] { white-space: nowrap; }

  /* kroki na stronie Sprawdz: trzy w jednej linii */
  ol[data-m="wrap"] { gap: 6px !important; }
  ol[data-m="wrap"] button { padding-left: 12px !important; padding-right: 12px !important; gap: 7px !important; font-size: 14px !important; }
  header > a:first-child > span + span { display: none; }

  /* pole i przycisk jeden pod drugim, przycisk na cala szerokosc */
  [data-m="form"] { flex-direction: column !important; align-items: stretch !important; }
  [data-m="form"] > input { width: 100% !important; min-width: 0; }
  [data-m="form"] > button { justify-content: center; }

  /* kropki 1 na 189: siatka dopasowana do szerokosci */
  [data-m="dots"] { grid-template-columns: repeat(27, minmax(0, 1fr)) !important; gap: 3px !important; }
  [data-m="dots"] > span { width: auto !important; height: auto !important; aspect-ratio: 1; }
  [data-m="bars"] { grid-template-columns: minmax(0, 1fr) !important; }
  [data-m="bars"] > * { grid-column: 1 / -1 !important; }

  /* wykres: na telefonie osobna, wezsza wersja z tymi samymi danymi */
  [data-m="chart"] { display: none !important; }
  [data-m="chart-m"] { display: block !important; width: 100% !important; max-width: 420px; height: auto !important; }

  footer[style*="repeat(12,"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  footer[style*="display: flex"], footer > div:last-child[style*="display: flex"] { flex-direction: column; gap: 8px !important; }
  footer[style*="display: flex"] > span:last-child { white-space: normal; }

  /* tabele z wieloma kolumnami (Radar, Fala atakow): kazdy wiersz to karta, podpis z data-l nad
     wartoscia, komorki bez podpisu na cala szerokosc. Selektory z "table ... tbody td", zeby
     przebic regule paddingu tabel z bloku 1023 px. */
  [data-m="cards"] { min-width: 0 !important; display: block; }
  [data-m="cards"] thead { display: none; }
  [data-m="cards"] tbody { display: block; }
  [data-m="cards"] tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: dense;
    gap: 12px 16px; padding: 18px 20px; border-bottom: 1px solid #ECEDE8;
  }
  [data-m="cards"] tr:last-child { border-bottom: 0; }
  table[data-m="cards"] tbody td { padding: 0 !important; border: 0 !important; text-align: left !important; grid-column: 1 / -1; }
  table[data-m="cards"] tbody td[data-l] { grid-column: auto; order: 1; }
  [data-m="cards"] td[data-l]::before {
    content: attr(data-l); display: block; margin-bottom: 4px;
    font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 11.5px; font-weight: 500;
    letter-spacing: 0.04em; text-transform: uppercase; color: #6B717C;
  }

  /* porownanie planow (Cennik): naglowek z trzema planami zostaje, kazda cecha to wiersz nad
     trzema kolumnami wyrownanymi z naglowkiem */
  [data-m="cmp"], [data-m="cmp"] thead, [data-m="cmp"] tbody { min-width: 0 !important; display: block; }
  [data-m="cmp"] tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px;
    padding: 14px 16px; border-bottom: 1px solid #ECEDE8; font-size: 13.5px;
  }
  [data-m="cmp"] td { hyphens: auto; -webkit-hyphens: auto; }
  [data-m="cmp"] thead tr { border-bottom-color: #D6D8D2; }
  [data-m="cmp"] tbody tr:last-child { border-bottom: 0; }
  [data-m="cmp"] thead th:first-child { display: none; }
  [data-m="cmp"] tbody th { grid-column: 1 / -1; }
  table[data-m="cmp"] tr > :is(th, td) { padding: 0 !important; border: 0 !important; width: auto !important; }

  /* Radar luk: wiersz luki i wiersz luk wykorzystywanych teraz w jednej kolumnie, liczby pod opisem */
  [data-m="cve"] { grid-template-columns: minmax(0, 1fr) !important; padding-left: 20px !important; padding-right: 20px !important; }
  [data-m="cve"] > :last-child { flex-direction: row !important; flex-wrap: wrap; align-items: center !important; text-align: left !important; max-width: none !important; }
  [data-m="cve"] > :last-child > span { max-width: none !important; text-align: left !important; }

  /* wtyczki na stronie glownej: nazwy w jednej linii, krotszy pasek udzialu */
  [data-m="plugins"] td:first-child { white-space: nowrap; }
  table[data-m="plugins"] tr > :last-child { width: auto !important; padding-left: 16px !important; }
  [data-m="plugins"] td:last-child > div > div { width: 64px !important; }
}
