/* Readspresso — arkusz stylów dokumentów prawnych
   Wszystkie style muszą być tutaj: CSP serwisu to style-src 'self',
   więc atrybuty style="..." i bloki <style> są blokowane.
   Kroje pisma wyłącznie systemowe — font-src 'self' data:. */

:root {
  --bg: #fbf8f4;
  --surface: #ffffff;
  --surface-alt: #f4efe7;
  --fg: #14120f;
  --fg-muted: #57503f;
  --fg-subtle: #7c7466;
  --accent: #0f6f6a;
  --accent-strong: #0a544f;
  --border: #e0d8cb;
  --border-strong: #cabfad;
  --warn-bg: #fdf3e3;
  --warn-border: #d9a441;
  --warn-fg: #5c3d06;

  --measure: 44rem;
  --radius: 6px;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120f;
    --surface: #1d1a16;
    --surface-alt: #232019;
    --fg: #f2ece2;
    --fg-muted: #bdb4a5;
    --fg-subtle: #948b7c;
    --accent: #5fc9c1;
    --accent-strong: #8adcd5;
    --border: #332e26;
    --border-strong: #4a4238;
    --warn-bg: #2b2113;
    --warn-border: #a87c2b;
    --warn-fg: #f0d9ac;
  }
}

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0 1.25rem 5rem;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Układ ---------- */

.doc {
  max-width: var(--measure);
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 0.85rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
}

/* ---------- Nagłówek dokumentu ---------- */

.doc-head {
  padding: 2.5rem 0 1.5rem;
  border-bottom: 2px solid var(--border-strong);
  margin-bottom: 2rem;
}

.brand {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.brand a {
  color: inherit;
  text-decoration: none;
}

.brand a:hover {
  text-decoration: underline;
}

h1 {
  font-size: 1.9rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 0.75rem;
  font-weight: 700;
}

.subtitle {
  margin: 0 0 1.25rem;
  color: var(--fg-muted);
  font-size: 1.0625rem;
}

/* Metryka dokumentu: wersja, data wejścia w życie */
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
  color: var(--fg-muted);
  list-style: none;
}

.doc-meta > li {
  margin: 0;
}

.doc-meta strong {
  color: var(--fg);
  font-weight: 600;
}

/* Przełącznik języka */
.lang-switch {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--fg-subtle);
}

.lang-switch a {
  font-weight: 600;
}

/* ---------- Typografia treści ---------- */

h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 2.75rem 0 0.85rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  scroll-margin-top: 1.5rem;
}

h3 {
  font-size: 1.0625rem;
  margin: 1.75rem 0 0.6rem;
  font-weight: 650;
  scroll-margin-top: 1.5rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--accent-strong);
  text-underline-offset: 0.15em;
}

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

a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

strong {
  font-weight: 650;
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-alt);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  overflow-wrap: anywhere;
}

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

/* ---------- Paragrafy numerowane (§ / ust. / lit.) ---------- */

.par {
  margin-bottom: 0.5rem;
}

/* Ustępy: 1., 2., 3. */
ol.ust {
  counter-reset: ust;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

ol.ust > li {
  counter-increment: ust;
  position: relative;
  padding-left: 2.25rem;
  margin-bottom: 0.7rem;
}

ol.ust > li::before {
  content: counter(ust) ".";
  position: absolute;
  left: 0;
  top: 0;
  width: 1.75rem;
  text-align: right;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Litery: a), b), c) */
ol.lit {
  counter-reset: lit;
  list-style: none;
  margin: 0.5rem 0 0.5rem;
  padding: 0;
}

ol.lit > li {
  counter-increment: lit;
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.4rem;
}

ol.lit > li::before {
  content: counter(lit, lower-alpha) ")";
  position: absolute;
  left: 0.25rem;
  top: 0;
  color: var(--fg-subtle);
  font-weight: 600;
}

/* Punkty: 1), 2), 3) */
ol.pkt {
  counter-reset: pkt;
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
}

ol.pkt > li {
  counter-increment: pkt;
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.4rem;
}

ol.pkt > li::before {
  content: counter(pkt) ")";
  position: absolute;
  left: 0.25rem;
  top: 0;
  color: var(--fg-subtle);
  font-weight: 600;
}

/* Zwykłe listy wypunktowane */
ul.bullets {
  margin: 0.5rem 0 1rem;
  padding-left: 1.25rem;
}

ul.bullets > li {
  margin-bottom: 0.4rem;
}

/* Lista państw w załączniku do Regulaminu - w kolumnach, bo jest długa */
ul.country-list {
  margin: 0.5rem 0 1rem;
  padding-left: 1.25rem;
  columns: 13rem;
  column-gap: 2rem;
}

/* ---------- Tabele ---------- */

.table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 32rem;
  font-size: 0.9375rem;
}

caption {
  text-align: left;
  padding: 0.75rem 0.9rem;
  font-size: 0.875rem;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

thead th {
  background: var(--surface-alt);
  font-weight: 650;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-strong);
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: 0;
}

tbody th {
  font-weight: 600;
}

/* Klucze w tabelach § 3 i § 7 to identyfikatory, nie proza. `overflow-wrap:
   anywhere` (potrzebne w akapitach) łamał je po jednym znaku na wiersz —
   "entitl / ement: / <skrót". Tabela i tak przewija się w poziomie. */
tbody th code,
td.mono {
  overflow-wrap: normal;
  white-space: nowrap;
}

/* ---------- Wyróżnienia ---------- */

.callout {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 1.5rem 0;
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout-title {
  font-weight: 700;
  margin: 0 0 0.4rem;
}

/* Ostrzeżenie — informacja przedkontraktowa o utracie danych */
.callout.warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  border-left-color: var(--warn-border);
  color: var(--warn-fg);
}

.callout.warn a {
  color: inherit;
}

/* Karta z danymi identyfikacyjnymi */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  margin: 1.25rem 0;
}

.card > :last-child {
  margin-bottom: 0;
}

/* Lista definicyjna dla danych rejestrowych */
dl.facts {
  display: grid;
  grid-template-columns: minmax(9rem, max-content) 1fr;
  gap: 0.45rem 1.25rem;
  margin: 0;
}

dl.facts dt {
  color: var(--fg-muted);
  font-size: 0.9375rem;
}

dl.facts dd {
  margin: 0;
  font-weight: 550;
  overflow-wrap: anywhere;
}

@media (max-width: 34rem) {
  dl.facts {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  dl.facts dd {
    margin-bottom: 0.6rem;
  }
}

/* ---------- Spis treści / indeks dokumentów ---------- */

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 2rem;
}

.toc h2 {
  margin: 0 0 0.6rem;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.toc ol,
.toc ul {
  margin: 0;
  padding-left: 1.15rem;
}

.toc li {
  margin-bottom: 0.3rem;
}

.doc-list {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.doc-list > li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}

.doc-list .doc-title {
  font-size: 1.0625rem;
  font-weight: 650;
  margin: 0 0 0.3rem;
}

.doc-list .doc-title a {
  text-decoration: none;
}

.doc-list .doc-title a:hover {
  text-decoration: underline;
}

.doc-list .doc-desc {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
  color: var(--fg-muted);
}

.doc-list .doc-langs {
  margin: 0;
  font-size: 0.875rem;
  color: var(--fg-subtle);
}

/* ---------- Formularz odstąpienia (wzór do wydruku) ---------- */

.form-model {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.form-model p {
  margin-bottom: 0.85rem;
}

.form-model .fill {
  color: var(--fg-subtle);
  font-style: italic;
}

.form-model .rule {
  display: block;
  border-bottom: 1px solid var(--border-strong);
  height: 1.5rem;
  margin: 0.25rem 0 0.75rem;
}

/* ---------- Przypisy ---------- */

.footnotes {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.footnotes ol {
  padding-left: 1.25rem;
  margin: 0;
}

.footnotes li {
  margin-bottom: 0.5rem;
}

.footnotes li:target {
  background: var(--surface-alt);
}

sup.fn a {
  text-decoration: none;
  font-weight: 700;
  padding: 0 0.15em;
}

/* ---------- Stopka ---------- */

.doc-foot {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border-strong);
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.doc-foot p {
  margin-bottom: 0.6rem;
}

.doc-foot nav {
  margin-top: 1rem;
}

/* Nota o prawach autorskich — ostatnia linia stopki, ciszej niż reszta. */
.doc-foot .copyright {
  margin-top: 1rem;
  margin-bottom: 0;
  color: var(--fg-subtle);
}

.doc-foot nav a {
  margin-right: 1rem;
  white-space: nowrap;
}

/* ---------- Wydruk ---------- */

@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --surface-alt: #fff;
    --fg: #000;
    --fg-muted: #333;
    --fg-subtle: #555;
    --accent: #000;
    --accent-strong: #000;
    --border: #999;
    --border-strong: #333;
    --warn-bg: #fff;
    --warn-border: #000;
    --warn-fg: #000;
  }

  @page {
    margin: 18mm 16mm;
  }

  body {
    padding: 0;
    font-size: 10.5pt;
    line-height: 1.45;
  }

  .doc {
    max-width: none;
  }

  .skip-link,
  .lang-switch,
  .doc-foot nav {
    display: none;
  }

  a {
    text-decoration: none;
  }

  /* Adresy odsyłaczy zewnętrznych na wydruku — poza kotwicami i mailto */
  .doc a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
    overflow-wrap: anywhere;
  }

  h1 {
    font-size: 18pt;
  }

  h2 {
    font-size: 12.5pt;
    margin-top: 16pt;
  }

  h3 {
    font-size: 11pt;
  }

  h2,
  h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  .par,
  .callout,
  .card,
  .form-model,
  table,
  li {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
  }

  table {
    min-width: 0;
  }

  thead {
    display: table-header-group;
  }

  .doc-foot {
    margin-top: 20pt;
  }
}
