/* ====== Reset / Base ====== */
* {
  box-sizing: border-box;
}
html:focus-within {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial,
    "Noto Sans", "Liberation Sans", sans-serif;
  line-height: 1.5;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
}
:root {
  --bg: #0b1020;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.14);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.7);
  --brand: #7c3aed;
  --brand-2: #22c55e;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  --radius: 18px;
  --radius-2: 26px;
  --max: 1200px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7fb;
    --surface: rgba(10, 18, 32, 0.04);
    --surface-2: rgba(10, 18, 32, 0.06);
    --border: rgba(10, 18, 32, 0.1);
    --text: rgba(10, 18, 32, 0.92);
    --muted: rgba(10, 18, 32, 0.66);
    --shadow: 0 18px 40px rgba(10, 18, 32, 0.12);
  }
}

[data-theme="dark"] {
  --bg: #0b1020;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.14);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.7);
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --surface: rgba(10, 18, 32, 0.04);
  --surface-2: rgba(10, 18, 32, 0.06);
  --border: rgba(10, 18, 32, 0.1);
  --text: rgba(10, 18, 32, 0.92);
  --muted: rgba(10, 18, 32, 0.66);
  --shadow: 0 18px 40px rgba(10, 18, 32, 0.12);
}

body {
  color: var(--text);
  background: radial-gradient(
      1200px 700px at 20% -10%,
      rgba(124, 58, 237, 0.35),
      transparent 55%
    ),
    radial-gradient(
      900px 600px at 80% 0%,
      rgba(34, 197, 94, 0.22),
      transparent 50%
    ),
    radial-gradient(
      700px 500px at 50% 110%,
      rgba(59, 130, 246, 0.18),
      transparent 55%
    ),
    var(--bg);
  min-height: 100dvh;
}

.skip-link {
  position: absolute;
  left: 10px;
  top: 10px;
  transform: translateY(-140%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.skip-link:focus {
  transform: translateY(0);
  outline: 2px solid rgba(124, 58, 237, 0.6);
}

/* ====== Header ====== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--border);
}

.header__bar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 220px;
}
.brand__mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(
    135deg,
    rgba(124, 58, 237, 0.95),
    rgba(34, 197, 94, 0.85)
  );
  box-shadow: 0 12px 25px rgba(124, 58, 237, 0.25);
}
.brand__title {
  font-weight: 800;
  letter-spacing: 0.2px;
}
.brand__subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: -2px;
}

.icon-btn,
.menu-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}
.icon-btn:hover,
.menu-btn:hover {
  background: var(--surface-2);
}
.icon-btn:focus-visible,
.menu-btn:focus-visible {
  outline: 2px solid rgba(124, 58, 237, 0.6);
  outline-offset: 2px;
}

.menu-btn {
  margin-left: auto;
}
.menu-btn__label {
  font-weight: 700;
  font-size: 14px;
}
.menu-btn__lines {
  width: 18px;
  height: 12px;
  display: inline-block;
  position: relative;
}
.menu-btn__lines::before,
.menu-btn__lines::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.menu-btn__lines::before {
  top: 0;
}
.menu-btn__lines::after {
  bottom: 0;
}

/* ====== Top nav ====== */
.topnav {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px 14px;
  display: none;
  gap: 8px;
  flex-wrap: wrap;
}
.topnav.is-open {
  display: flex;
}
.topnav__link {
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
}
.topnav__link:hover {
  background: var(--surface-2);
}
.topnav__link.is-active {
  background: color-mix(in srgb, var(--brand) 22%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
}
.topnav__hint {
  font-weight: 600;
  color: var(--muted);
}

/* ====== Layout ====== */
.layout {
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    order: 2;
  }
  .content {
    order: 1;
  }
}

/* ====== Panels / Sidebar ====== */
.panel {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel--soft {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.panel__head {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
}
.panel__title {
  font-weight: 800;
}
.panel__meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.sidenav {
  display: grid;
  padding: 10px;
  gap: 8px;
}
.sidenav__link {
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  color: var(--text);
  background: transparent;
}
.sidenav__link:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

.muted {
  color: var(--muted);
}
.sidebar p {
  padding: 12px 14px 14px;
  margin: 0;
}

/* ====== Hero ====== */
.hero {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 14px;
  margin-bottom: 16px;
}
@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

.hero__text {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow);
  padding: 18px;
}
.hero h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 2vw + 14px, 34px);
  letter-spacing: 0.2px;
}
.lead {
  margin: 0 0 12px;
  color: var(--muted);
}

.hero__card {
  border: 1px solid var(--border);
  background: linear-gradient(
    135deg,
    rgba(124, 58, 237, 0.18),
    rgba(34, 197, 94, 0.1)
  );
  border-radius: var(--radius-2);
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 10px;
}
.stat {
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border-radius: 16px;
  padding: 10px 12px;
}
.stat__label {
  color: var(--muted);
  font-size: 12px;
}
.stat__value {
  font-weight: 800;
}

/* ====== Search ====== */
.search {
  margin-top: 10px;
}
.search__label {
  display: block;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 6px;
}
.search__row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.search__input {
  flex: 1;
  min-width: 220px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--text);
  outline: none;
}
.search__input:focus {
  border-color: color-mix(in srgb, var(--brand) 50%, var(--border));
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.18);
}

.btn {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--brand) 22%, var(--surface));
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}
.btn:hover {
  background: color-mix(in srgb, var(--brand) 28%, var(--surface-2));
}
.btn--ghost {
  background: var(--surface);
}
.btn--ghost:hover {
  background: var(--surface-2);
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 10px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}
.chip:hover {
  background: var(--surface-2);
}

/* ====== Accordion ====== */
.accordion {
  display: grid;
  gap: 12px;
}
.acc {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow);
  overflow: clip;
}
.acc__summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}
.acc__summary::-webkit-details-marker {
  display: none;
}
.acc__title {
  font-weight: 900;
  letter-spacing: 0.2px;
}
.acc__hint {
  color: var(--muted);
  font-size: 13px;
}
.acc__content {
  padding: 16px;
}

/* ====== Cards ====== */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 740px) {
  .cards {
    grid-template-columns: 1fr;
  }
}
.card {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  border-radius: 18px;
  padding: 14px 14px 12px;
  transition: transform 0.18s ease, background 0.18s ease;
}
@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }
}
.card:hover {
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--surface-2) 90%, transparent);
}
.card__head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
}
.card__name {
  margin: 0;
  font-size: 16px;
  font-weight: 950;
}
.card__desc {
  margin: 8px 0 0;
  color: var(--muted);
}
.badge {
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border));
  background: color-mix(in srgb, var(--brand) 18%, transparent);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.badge--soft {
  border-color: color-mix(in srgb, var(--brand-2) 28%, var(--border));
  background: color-mix(in srgb, var(--brand-2) 14%, transparent);
}

/* ====== Footer ====== */
.footer {
  margin: 18px 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.footer__grid {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.footer__title {
  font-weight: 950;
}
.footer__links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.footer__links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
}
.footer__links a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ====== Cookie ====== */
.cookie {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: var(--max);
  margin: 0 auto;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
  border-radius: var(--radius-2);
  box-shadow: var(--shadow);
  padding: 12px 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.cookie__text {
  display: grid;
  gap: 4px;
}
.cookie__text a {
  color: var(--muted);
  font-weight: 800;
}
.cookie__text a:hover {
  color: var(--text);
}
.cookie__actions {
  display: flex;
  gap: 10px;
}

/* ====== To top ====== */
.to-top {
  position: fixed;
  right: 16px;
  bottom: 86px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.to-top:hover {
  background: var(--surface-2);
}
.icon-btn--font {
  font-weight: 950;
  min-width: 44px;
  justify-content: center;
  letter-spacing: 0.2px;
}

/* Skala fontu sterowana JS */
html {
  font-size: calc(16px * var(--font-scale, 1));
}

/* Dla czytników ekranu (screen reader only) */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* ====== DODATKI: Brand jako link + Actions w header ====== */

/* 1) Brand jako link (żeby wyglądał i był klikalny) */
a.brand {
  text-decoration: none;
  color: inherit;
  border-radius: 16px;
  padding: 6px 8px;
}
a.brand:hover {
  background: var(--surface-2);
}
a.brand:focus-visible {
  outline: 2px solid rgba(124, 58, 237, 0.6);
  outline-offset: 2px;
}

/* 2) Header bar: rozsuń lewo/prawo (u Ciebie jest gap, ale nie ma justify) */
.header__bar {
  justify-content: space-between;
}

/* 3) Akcje po prawej (A-, A+, motyw, menu) */
.header__actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* 4) Ikonowe przyciski - ładniejsze i równe (Twoje mają padding, ale różne szerokości) */
.icon-btn {
  min-width: 44px;
  height: 42px;
  justify-content: center;
  user-select: none;
}

/* 5) Menu button: nie wypychaj margin-left:auto jeśli jest w actions */
.header__actions .menu-btn {
  margin-left: 0;
  height: 42px;
}

/* 6) Hamburger na 3 linie (u Ciebie są tylko 2, bo before + after) */
.menu-btn__lines {
  width: 18px;
  height: 12px;
  position: relative;
}
.menu-btn__lines::before,
.menu-btn__lines::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.menu-btn__lines::before {
  top: 0;
}
.menu-btn__lines::after {
  bottom: 0;
}
/* środkowa linia */
.menu-btn__lines {
  background: linear-gradient(currentColor, currentColor);
  background-size: 100% 2px;
  background-repeat: no-repeat;
  background-position: center;
}

/* ====== DODATKI: Mobile nav (Topnav) ====== */
/* Na desktopie możesz chcieć pokazywać nav zawsze (opcjonalnie). 
   Jeśli chcesz, żeby było jak teraz (tylko po kliknięciu menu), zostaw bez zmian. */

/* Wersja: na desktopie pokaż topnav zawsze, a na mobile chowaj */
@media (min-width: 821px) {
  .topnav {
    display: flex; /* zamiast none */
  }
}

/* Na mobile: topnav tylko gdy .is-open */
@media (max-width: 820px) {
  .topnav {
    display: none;
  }
  .topnav.is-open {
    display: flex;
  }

  /* Ukryj mały napis w brand (żeby się mieściło) */
  .brand__subtitle {
    display: none;
  }

  /* Trochę ciaśniej w headerze */
  .header__bar {
    padding: 12px 12px;
  }
}

/* ====== DODATKI: Font scale zgodny z Twoim CSS ======
   Masz już:
   html { font-size: calc(16px * var(--font-scale, 1)); }
   więc tylko dopiszmy bezpieczny default */
:root {
  --font-scale: 1;
}
