/* ============================================================
   STRONY PRAWNE (legal.css)
   Polityka prywatności, Regulamin
   Wymaga: global.css, ui-platonic.css
   Prefiks klas: lg-
   ============================================================ */

.lg-main {
    width: 100%;
    font-family: 'Inter', sans-serif;
    color: var(--Napisy);
}

/* ── MATH BG (spójne z resztą serwisu) ───────────────────── */
.math-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
    display: none;
}

body.math-on .math-bg { display: block; }

.math-bg span {
    position: absolute;
    font-size: 80px;
    color: var(--Fioletowy);
    opacity: 0.05;
    font-weight: 800;
    animation: lgFloaty 18s linear infinite;
}

@keyframes lgFloaty {
    0%   { transform: translateY(0) rotate(0); }
    50%  { transform: translateY(-30px) rotate(8deg); }
    100% { transform: translateY(0) rotate(0); }
}

/* ── PASEK POSTĘPU CZYTANIA ───────────────────────────────── */
.lg-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: transparent;
    z-index: 1000;
}

.lg-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--Niebieski), var(--Fioletowy));
    transition: width 0.1s linear;
}

/* ============================================================
   HERO
   ============================================================ */
.lg-hero {
    max-width: 1160px;
    margin: 0 auto;
    padding: 155px 5% 40px 5%;
}

.lg-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--SzaryTekst);
    text-decoration: none;
    margin-bottom: 22px;
    transition: color 0.25s ease, gap 0.25s ease;
}

.lg-back-link:hover {
    color: var(--FioletowyHover);
    gap: 11px;
}

.lg-hero-title {
    font-size: clamp(30px, 4.4vw, 46px);
    font-weight: 800;
    line-height: 1.15;
    color: var(--Napisy);
}

.lg-hero-sub {
    margin-top: 14px;
    max-width: 680px;
    font-size: 16px;
    line-height: 1.65;
    color: var(--SzaryTekst);
}

.lg-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.lg-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 15px;
    border-radius: 999px;
    background-color: #FFFFFF;
    border: 1px solid var(--Ramka);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--CiemnySzaryTekst);
}

.lg-meta-chip svg { flex-shrink: 0; color: var(--Fioletowy); }

.lg-hero-links {
    margin-top: 26px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--SzaryTekst);
}

.lg-hero-links a {
    font-weight: 700;
    color: var(--FioletowyHover);
    text-decoration: none;
}

.lg-hero-links a:hover { text-decoration: underline; }

.lg-hero-actions {
    margin-top: 26px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================================
   UKŁAD: TOC + TREŚĆ
   ============================================================ */
.lg-layout {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 5% 100px 5%;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 48px;
    align-items: start;
}

/* ── SPIS TREŚCI ───────────────────────────────────────────── */
.lg-toc-wrap {
    position: sticky;
    top: 110px;
}

.lg-toc-toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 12px;
    border: 1px solid var(--Ramka);
    background-color: #FFFFFF;
    font-family: 'Inter', sans-serif;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--Napisy);
    cursor: pointer;
}

.lg-toc-toggle svg { transition: transform 0.3s ease; flex-shrink: 0; }
.lg-toc-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.lg-toc {
    padding: 20px 4px 20px 18px;
    border-left: 2px solid var(--Ramka);
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.lg-toc-label {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: var(--SzaryTekst);
    margin-bottom: 14px;
}

.lg-toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.lg-toc-link {
    display: block;
    padding: 7px 12px;
    margin-left: -14px;
    border-left: 2px solid transparent;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--SzaryTekst);
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
    border-radius: 0 8px 8px 0;
}

.lg-toc-link:hover {
    color: var(--Napisy);
    background-color: var(--SidebarBG);
}

.lg-toc-link.active {
    color: var(--FioletowyHover);
    font-weight: 700;
    border-left-color: var(--Fioletowy);
    background-color: #F5F3FF;
}

/* ============================================================
   TREŚĆ
   ============================================================ */
.lg-content {
    min-width: 0;
    max-width: 740px;
}

.lg-lead {
    padding: 22px 26px;
    border-radius: 16px;
    background-color: var(--SidebarBG);
    border: 1px solid var(--Ramka);
    font-size: 16px;
    line-height: 1.7;
    color: var(--CiemnySzaryTekst);
    margin-bottom: 34px;
}

.lg-chapter {
    padding: 30px 0;
    border-bottom: 1px solid var(--Ramka);
    scroll-margin-top: 105px;
}

.lg-chapter:first-of-type { padding-top: 0; }
.lg-chapter:last-of-type { border-bottom: none; padding-bottom: 0; }

.lg-chapter-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.lg-chapter-num {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--Niebieski), var(--Fioletowy));
    color: #FFFFFF;
    font-size: 14.5px;
    font-weight: 800;
}

.lg-chapter-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--Napisy);
    line-height: 1.3;
}

.lg-chapter-body p {
    font-size: 15.5px;
    line-height: 1.75;
    color: var(--CiemnySzaryTekst);
    margin-bottom: 14px;
}

.lg-chapter-body p:last-child { margin-bottom: 0; }

.lg-chapter-body strong { color: var(--Napisy); }

.lg-chapter-body a {
    color: var(--FioletowyHover);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--ContestFioletJasny2);
    text-underline-offset: 2px;
}

.lg-chapter-body a:hover { color: var(--Fioletowy); }

/* Listy wypunktowane (Polityka prywatności) */
.lg-ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin: 6px 0 16px 0;
}

.lg-ul li {
    position: relative;
    padding-left: 24px;
    font-size: 15px;
    line-height: 1.65;
    color: var(--CiemnySzaryTekst);
}

.lg-ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--Niebieski), var(--Fioletowy));
}

.lg-ul li strong { color: var(--Napisy); }

/* Listy numerowane (Regulamin — klauzule) */
.lg-ol {
    list-style: none;
    counter-reset: lg-clause;
    display: flex;
    flex-direction: column;
    gap: 13px;
    margin: 6px 0 16px 0;
}

.lg-ol > li {
    counter-increment: lg-clause;
    position: relative;
    padding-left: 34px;
    font-size: 15px;
    line-height: 1.65;
    color: var(--CiemnySzaryTekst);
}

.lg-ol > li::before {
    content: counter(lg-clause);
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--ContestFioletJasny);
    color: var(--ContestFioletCiemny);
    font-size: 12px;
    font-weight: 800;
}

.lg-ol > li strong { color: var(--Napisy); }

/* Listy zagnieżdżone — kroki proceduralne */
.lg-ol-nested {
    list-style: none;
    counter-reset: lg-step;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0 4px 0;
    padding-left: 8px;
    border-left: 2px solid var(--Ramka);
}

.lg-ol-nested > li {
    counter-increment: lg-step;
    position: relative;
    padding-left: 30px;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--SzaryTekst);
}

.lg-ol-nested > li::before {
    content: counter(lg-step, lower-alpha) ")";
    position: absolute;
    left: 6px;
    top: 0;
    font-weight: 700;
    color: var(--Fioletowy);
}

/* ── CALLOUT — RODO / OCHRONA MAŁOLETNICH ─────────────────── */
.lg-callout {
    display: flex;
    gap: 16px;
    padding: 22px 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, #F5F3FF 0%, #EFF6FF 100%);
    border: 1px solid var(--ContestFioletJasny2);
    margin-bottom: 16px;
}

.lg-callout-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--Niebieski), var(--Fioletowy));
    color: #FFFFFF;
}

.lg-callout-body p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--CiemnyFioletowy1);
    margin-bottom: 8px;
}

.lg-callout-body p:last-child { margin-bottom: 0; }
.lg-callout-body strong { color: var(--CiemnyFioletowy1); }

/* ── ZAŁĄCZNIK DO POBRANIA ─────────────────────────────────── */
.lg-attachment {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border-radius: 14px;
    border: 1px solid var(--Ramka);
    background-color: var(--SidebarBG);
    text-decoration: none;
    transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.lg-attachment:hover {
    border-color: var(--Fioletowy);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(116, 113, 217, 0.14);
}

.lg-attachment-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background-color: var(--JasnyNiebieski);
    color: var(--CiemnyNiebieski);
}

.lg-attachment-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--Napisy);
}

.lg-attachment-meta {
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--SzaryTekst);
}

.lg-attachment-download {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--FioletowyHover);
}

/* ── STOPKA DOKUMENTU ──────────────────────────────────────── */
.lg-doc-footer {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px dashed var(--Ramka);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.lg-doc-footer p {
    font-size: 13.5px;
    color: var(--SzaryTekst);
}

.lg-doc-contact {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

/* ── PRZYCISK "DO GÓRY" ────────────────────────────────────── */
.lg-top-btn {
    position: fixed;
    right: 26px;
    bottom: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--Niebieski), var(--Fioletowy));
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(116, 113, 217, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 90;
}

.lg-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lg-top-btn:hover { transform: translateY(-3px); }

/* ============================================================
   REDUKCJA RUCHU
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .math-bg span { animation: none; }
    .lg-progress-fill { transition: none; }
    .lg-top-btn, .lg-attachment, .lg-toc-link, .lg-back-link { transition: none; }
}

/* ============================================================
   RESPONSYWNOŚĆ
   ============================================================ */
@media (max-width: 960px) {
    .lg-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .lg-toc-wrap {
        position: static;
    }

    .lg-toc-toggle {
        display: flex;
    }

    .lg-toc {
        display: none;
        margin-top: 10px;
        border-left: none;
        border: 1px solid var(--Ramka);
        border-radius: 14px;
        padding: 16px;
        max-height: 320px;
    }

    .lg-toc.open { display: block; }

    .lg-content { max-width: 100%; }
}

@media (max-width: 640px) {
    .lg-hero { padding: 130px 6% 30px 6%; }
    .lg-layout { padding: 0 6% 70px 6%; }

    .lg-chapter-title { font-size: 18px; }
    .lg-chapter-num { width: 34px; height: 34px; font-size: 13px; }

    .lg-callout { flex-direction: column; }

    .lg-doc-footer { flex-direction: column; align-items: flex-start; }

    .lg-top-btn {
        right: 16px;
        bottom: 16px;
        width: 42px;
        height: 42px;
    }
}