/* Regulamin Konkursu Tax Games — /regulamin/
   Układ jak w zbiorze przepisów: numer paragrafu na marginesie, tekst w kolumnie do czytania,
   spis treści przyklejony z boku. Tokeny i wspólne komponenty (nagłówek, stopka, przyciski)
   pochodzą z /assets/styles.css — ten plik dokłada tylko podstronę regulaminu. */

.legal { position: relative; z-index: 1; padding-bottom: clamp(64px, 9vw, 112px); }

/* ---------- nagłówek strony ---------- */
.legal__head {
  padding-top: clamp(28px, 4vw, 48px); padding-bottom: clamp(32px, 4.5vw, 52px);
  border-bottom: 1px solid var(--line);
}
.legal__back {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 0;
  color: var(--ice); font-weight: 700; font-size: 15px; text-decoration: none;
}
.legal__back::before {
  content: ''; width: 7px; height: 7px; margin-left: 2px;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}
.legal__back:hover { color: #fff; }
.legal__title {
  margin-top: 20px; max-width: 13em;
  font-weight: 800; font-size: clamp(36px, 5.4vw, 64px); line-height: 1; letter-spacing: -0.03em;
  text-wrap: balance;
}
.legal__lead { margin-top: 16px; font-size: clamp(18px, 1.8vw, 22px); font-weight: 600; color: var(--ice-soft); }
.legal__meta {
  margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px;
  font-size: 15px; color: var(--ice-soft);
}
.legal__pdf svg { flex: none; }

/* ---------- spis treści + treść ---------- */
.legal__layout {
  display: grid; grid-template-columns: 240px minmax(0, 1fr); align-items: start;
  column-gap: clamp(32px, 5vw, 72px);
}
.legal__aside { position: sticky; top: 96px; max-height: calc(100vh - 112px); overflow: auto; padding-top: 40px; }
.legal__toc summary {
  list-style: none; margin-bottom: 14px;
  font-family: var(--display); font-weight: 700; font-size: 15px; color: #fff;
}
.legal__toc summary::-webkit-details-marker { display: none; }
.legal__toc ol { border-left: 1px solid var(--line-strong); }
.legal__toc a {
  display: grid; grid-template-columns: 2.9em minmax(0, 1fr);
  margin-left: -1px; padding: 7px 0 7px 16px; border-left: 2px solid transparent;
  color: var(--ice-soft); font-size: 14.5px; line-height: 1.35; text-decoration: none;
  transition: color .15s, border-color .15s;
}
.legal__toc a:hover { color: #fff; }
.legal__toc a[aria-current] { color: #fff; border-left-color: var(--blue); }
.legal__toc-num { color: var(--ice); font-weight: 700; font-variant-numeric: tabular-nums; }

.legal__body { min-width: 0; max-width: 788px; font-size: 17px; line-height: 1.7; color: rgba(255, 255, 255, 0.9); }

/* paragraf: „§ 1.” na marginesie, tekst w drugiej kolumnie */
.legal__section {
  display: grid; grid-template-columns: 88px minmax(0, 1fr);
  padding: 40px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 88px;
}
.legal__section > * { grid-column: 2; }
.legal__section:last-of-type { border-bottom: 0; }
.legal__section h2 {
  grid-column: 1 / -1; display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: baseline;
  margin-bottom: 18px;
}
.legal__par {
  font-family: var(--display); font-weight: 800; font-size: 40px; line-height: 1; letter-spacing: -0.02em;
  color: var(--ice); white-space: nowrap;
}
@supports (-webkit-text-stroke: 1px #fff) {
  .legal__par { color: transparent; -webkit-text-stroke: 1.25px var(--ice); }
}
.legal__name { font-family: var(--display); font-weight: 700; font-size: clamp(22px, 2.2vw, 26px); line-height: 1.2; color: #fff; }

.legal__list { display: flex; flex-direction: column; gap: 14px; }
.legal__list > li, .legal__sub > li { display: grid; grid-template-columns: 2.1em minmax(0, 1fr); }
.legal__num { color: var(--ice); font-weight: 700; font-variant-numeric: tabular-nums; }
.legal__sub { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.legal__body a:not(.btn) { color: var(--ice); text-underline-offset: 3px; overflow-wrap: anywhere; }
.legal__body a:not(.btn):hover { color: #fff; }

.legal__end {
  margin: 48px 0 0 88px; padding: 28px 32px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: rgba(255, 255, 255, 0.04);
}
.legal__end p { color: var(--ice-soft); }

.site-footer__links a[aria-current="page"] { color: var(--ice); }

/* ---------- węższe ekrany: spis zwijany nad treścią ---------- */
@media (max-width: 1023px) {
  .legal__layout { grid-template-columns: minmax(0, 1fr); }
  .legal__aside { position: static; max-height: none; overflow: visible; padding-top: 28px; }
  .legal__toc { border: 1px solid var(--line-strong); border-radius: var(--radius); background: rgba(255, 255, 255, 0.04); }
  .legal__toc summary {
    margin: 0; padding: 14px 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between;
  }
  .legal__toc summary::after {
    content: ''; width: 9px; height: 9px; margin-right: 4px;
    border-right: 2px solid var(--ice); border-bottom: 2px solid var(--ice);
    transform: translateY(-3px) rotate(45deg); transition: transform .2s;
  }
  .legal__toc[open] summary::after { transform: translateY(2px) rotate(-135deg); }
  .legal__toc ol { border-left: 0; padding: 0 18px 12px; }
  .legal__toc a { margin-left: 0; padding: 8px 0; border-left: 0; }
  .legal__body { max-width: none; }
}
@media (max-width: 640px) {
  .legal__section { grid-template-columns: minmax(0, 1fr); padding: 30px 0; }
  .legal__section > * { grid-column: 1; }
  .legal__section h2 { grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; }
  .legal__par { font-size: 30px; }
  .legal__body { font-size: 16.5px; }
  .legal__end { margin-left: 0; padding: 22px 20px; }
  .legal__end .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .legal__toc a, .legal__toc summary::after { transition: none; }
}

/* ---------- druk / PDF: czarno na białym, bez nawigacji ---------- */
@media print {
  @page { size: A4; margin: 18mm 18mm 20mm; }
  .legal ~ .site-footer, .legal__back, .legal__aside, .legal__pdf, .legal__end { display: none !important; }
  .legal, .legal__head { padding: 0; border: 0; color: #000; }
  .legal .wrap { padding-left: 0; padding-right: 0; }
  .legal__layout { display: block; }
  .legal__title { margin-top: 0; max-width: none; font-size: 22pt; color: #000; }
  .legal__lead, .legal__meta { color: #000; }
  .legal__lead { margin-top: 6pt; font-size: 13pt; }
  .legal__meta { margin-top: 6pt; font-size: 10pt; }
  .legal__body { max-width: none; font-size: 10.5pt; line-height: 1.5; color: #000; }
  .legal__section { display: block; padding: 13pt 0 0; border: 0; }
  .legal__section h2 { display: block; margin-bottom: 6pt; break-after: avoid; }
  .legal__par, .legal__name { font-size: 12.5pt; color: #000; -webkit-text-stroke: 0; }
  .legal__num, .legal__body a:not(.btn) { color: #000; text-decoration: none; }
  .legal__list > li, .legal__sub > li { break-inside: avoid; }
}
