/* ========================================= */
/* 1. :root — zmienne globalne (jak na stronie głównej) + rozszerzenia */
/* ========================================= */
:root {
    --accent: #DCAA78;
    --kolorowe_tlo: var(--accent);
    --detal_kolor: var(--accent);

    --text-white: rgb(238, 239, 240);
    --jasne_tlo: var(--text-white);

    --bg-base: #222426;
    --ciemne_tlo: var(--bg-base);
    --bg-header: #050608;
    --bg-input: #111111;
    --bg-overlay: rgba(11, 12, 16, 0.95);

    --font-main: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

    --spacing-section: clamp(3.125rem, 10vw, 6.25rem);

    --accent-dark: #8c6a43;
    --header-h: 5.5rem;
}

/* ========================================= */
/* 2. Style bazowe                           */
/* ========================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--bg-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
}

a { text-decoration: none; color: inherit; transition: color .3s ease, border-color .3s ease, background .3s ease; }

::selection { background: var(--accent); color: #241a0e; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip-link {
    position: absolute; left: -999px; top: 0; z-index: 300;
    background: #fff; color: #111; padding: .75rem 1.25rem; font-weight: 700;
}
.skip-link:focus { left: 1rem; top: 1rem; border: 2px solid var(--accent); }

/* ========================================= */
/* 3. Typografia globalna                    */
/* ========================================= */
h1, h2, h3 { color: #111; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 1.5rem; }

p { max-width: 40.625rem; }

/* ========================================= */
/* 4. Pasek postępu czytania                 */
/* ========================================= */
#progress {
    position: fixed; top: 0; left: 0; z-index: 200;
    width: 100%; height: 3px;
    background: var(--accent);
    transform: scaleX(0); transform-origin: 0 50%;
}

/* ========================================= */
/* 5. Header (wzór 1:1 z strony głównej)     */
/* ========================================= */
.container { width: 100%; max-width: 75rem; margin-inline: auto; padding-inline: clamp(1.5rem, 4vw, 2.5rem); }

header.site-header {
    position: sticky; top: 0; z-index: 100;
    padding: 1.875rem 0;
    background: var(--bg-header);
    border-bottom: 1px solid var(--accent);
}
header.site-header .container { width: 71%; }

.nav-flex { display: flex; justify-content: space-between; align-items: center; }

.logo { font-weight: 700; font-size: 1.5rem; letter-spacing: .1em; color: var(--text-white); }
.logo:hover { color: var(--accent); }

.nav-links a {
    margin-left: 1.25rem; font-size: .85rem; text-transform: uppercase;
    font-weight: 500; letter-spacing: .05em; color: var(--accent);
}
.nav-links a:hover { color: var(--text-white); }

/* ========================================= */
/* 6. SEKCJA DOKUMENTU — jasna (wzór #section-6/7) */
/* ========================================= */
#polityka {
    --bg-section: rgb(238, 239, 240);
    --text-main: #3d4043;
    --text-heading: #111111;
    --border-color: rgba(0, 0, 0, 0.12);

    background-color: var(--bg-section);
    /* subtelna „papierowa" siatka — charakter dokumentu */
    background-image: radial-gradient(rgba(0, 0, 0, .04) 1px, transparent 1px);
    background-size: 28px 28px;
    padding: var(--spacing-section) 0 clamp(3.75rem, 8vw, 6rem);
    overflow: clip; 
}

/* --- nagłówek dokumentu --- */
.doc-head { position: relative; max-width: 54rem; }

.doc-watermark {
    position: absolute; right: -1.5rem; top: -3rem; z-index: 0;
    font-family: var(--font-mono); line-height: 1;
    font-size: clamp(7rem, 20vw, 14rem);
    color: rgba(0, 0, 0, .05);
    pointer-events: none; user-select: none;
}

.doc-eyebrow {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: .75rem;
    color: var(--accent-dark); font-size: .9rem;
    text-transform: uppercase; letter-spacing: .14em; font-weight: 700;
    margin-bottom: 1.25rem;
}
.doc-eyebrow::before { content: ""; width: 2.5rem; height: 2px; background: var(--accent); }

/* line-mask reveal tytułu */
.doc-title { font-size: clamp(2.4rem, 6vw, 3.75rem); line-height: 1.08; margin-bottom: 1.375rem; position: relative; z-index: 1; }
.mask { display: block; overflow: hidden; padding-bottom: .1em; }
.mask > span { display: inline-block; transform: translateY(115%); animation: rise .9s cubic-bezier(.2, .65, .2, 1) .15s forwards; }
@keyframes rise { to { transform: none; } }

.doc-intro { font-size: 1.2rem; line-height: 1.6; color: var(--text-main); max-width: 46ch; margin-bottom: 0; position: relative; z-index: 1; }

/* pasek metadanych */
.doc-meta {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem;
    border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 0; margin-top: 2.75rem; position: relative; z-index: 1;
}
.doc-meta dt { font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: #7c7f82; margin-bottom: .35rem; }
.doc-meta dd { font-weight: 600; color: #111; font-size: .95rem; }

/* --- układ: TOC + treść --- */
.doc-layout {
    display: grid; grid-template-columns: 17.5rem minmax(0, 1fr);
    gap: clamp(2.5rem, 6vw, 5.5rem); align-items: start;
    margin-top: clamp(3rem, 8vw, 4.5rem);
}

/* --- spis treści (sticky + scrollspy) --- */
.toc { position: sticky; top: var(--header-h); }
.toc-label { display: block; font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: #7c7f82; margin-bottom: 1rem; padding-left: .9rem; }

.toc ol { list-style: none; border-left: 1px solid var(--border-color); }
.toc a { position: relative; display: flex; gap: .75rem; align-items: baseline; padding: .625rem .875rem; color: #6a6d70; font-size: .9rem; transition: color .3s ease, transform .3s ease; }
.toc a i { font-style: normal; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .05em; color: #b4b7ba; transition: color .3s ease; }
.toc a::before { content: ""; position: absolute; left: -1px; top: 0; width: 2px; height: 100%; background: var(--accent); transform: scaleY(0); transform-origin: top; transition: transform .35s ease; }
.toc a:hover { color: #111; transform: translateX(3px); }
.toc li.active a { color: #111; font-weight: 600; }
.toc li.active a i { color: var(--accent-dark); }
.toc li.active a::before { transform: scaleY(1); }

/* --- artykuły dokumentu --- */
.doc-article {
    padding-block: clamp(2rem, 5vw, 3rem);
    border-top: 1px solid var(--border-color);
    scroll-margin-top: var(--header-h);
    /* reveal przy scrollu (JS dodaje .in-view) */
    opacity: 0; transform: translateY(24px);
    transition: opacity .7s ease, transform .7s cubic-bezier(.2, .65, .3, 1);
}
.doc-article.in-view { opacity: 1; transform: none; }
.doc-content > .doc-article:first-child { border-top: none; padding-top: 0; }

.doc-sec-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.375rem; }
.sec-num { font-family: var(--font-mono); color: var(--accent-dark); font-size: .85rem; letter-spacing: .05em; white-space: nowrap; }
.doc-sec-head h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); line-height: 1.2; margin-bottom: 0; color: var(--text-heading); }

.doc-body p { max-width: 62ch; color: var(--text-main); font-size: 1.05rem; line-height: 1.75; margin-bottom: 1.125rem; }
.doc-body strong { color: #111; }

/* linki w jasnej sekcji — podkreślenie z akcentem */
.doc-content a { color: #2b2d2f; border-bottom: 1px solid rgba(0, 0, 0, .3); padding-bottom: 1px; }
.doc-content a:hover { color: var(--accent-dark); border-color: var(--accent-dark); }

/* --- callout „zero cookies" --- */
.callout { background: rgba(255, 255, 255, .65); border-left: 3px solid var(--accent); padding: 1.25rem 1.5rem; margin-bottom: 1.75rem; max-width: 62ch; }
.callout p { margin: 0 !important; font-weight: 600; color: #111 !important; font-size: 1.08rem !important; }

/* --- checklista z motywem "+" (jak contact-hints) --- */
.no-list { list-style: none; display: grid; gap: .875rem; max-width: 62ch; margin: 1.5rem 0 1.75rem; }
.no-list li { position: relative; padding-left: 1.75rem; color: var(--text-main); line-height: 1.6; font-size: 1rem; }
.no-list li::before { content: "+"; position: absolute; left: 0; top: -2px; color: var(--accent-dark); font-weight: 700; font-size: 1.15rem; }
.no-list strong { color: #111; }

/* --- tabela logów serwera --- */
.table-wrap { overflow-x: auto; margin: 1.5rem 0 1.75rem; max-width: 46rem; border: 1px solid var(--border-color); background: rgba(255, 255, 255, .5); }
.log-table { width: 100%; min-width: 0; border-collapse: collapse; font-size: .95rem;}
.log-table th { text-align: left; padding: .875rem 1.125rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: #6a6d70; background: rgba(255, 255, 255, .8); border-bottom: 1px solid var(--border-color); }
.log-table td { padding: .9rem 1.125rem; border-top: 1px solid var(--border-color); color: var(--text-main); line-height: 1.55; vertical-align: top; }
.log-table tr:first-child td { border-top: none; }
.log-table td:first-child { font-family: var(--font-mono); font-size: .82rem; color: #2b2d2f; white-space: nowrap; }
.log-table tbody tr { transition: background .3s ease; }
.log-table tbody tr:hover { background: rgba(220, 170, 120, .1); }

/* --- siatka praw RODO (wzór about-cards) --- */
.rights-grid { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin: 1.75rem 0 1.75rem; }
.rights-grid li { background: rgba(255, 255, 255, .65); border-top: 2px solid var(--accent); padding: 1.375rem 1.25rem; display: flex; flex-direction: column; gap: .5rem; transition: transform .3s ease, box-shadow .3s ease, background .3s ease; }
.rights-grid li:hover { transform: translateY(-4px); background: #fff; box-shadow: 0 16px 28px -20px rgba(0, 0, 0, .4); }
.rights-grid span { color: var(--accent-dark); text-transform: uppercase; font-size: .75rem; letter-spacing: .1em; font-weight: 700; }
.rights-grid small { font-family: var(--font-mono); font-size: .68rem; color: #9a9da0; margin-top: -.25rem; }
.rights-grid p { margin: 0 !important; max-width: none !important; font-size: .92rem !important; line-height: 1.55 !important; color: var(--text-main) !important; }

/* --- notka (UODO) --- */
.doc-note { font-size: .95rem; color: #6a6d70; border-left: 2px solid rgba(0, 0, 0, .18); padding-left: 1.125rem; max-width: 62ch; line-height: 1.65; }

/* --- wiersz kopiowania e-maila --- */
.copy-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: .75rem; }
.email { font-family: var(--font-mono); font-size: .95rem; background: #fff; border: 1px solid var(--border-color); padding: .625rem .875rem; color: #111; transition: border-color .3s ease; }
.email:hover { border-color: var(--accent-dark); }

.btn-copy { font-family: inherit; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; padding: .6875rem 1.25rem; background: transparent; border: 1px solid rgba(0, 0, 0, .3); color: #2b2d2f; cursor: pointer; transition: all .3s ease; }
.btn-copy:hover { background: var(--accent); border-color: var(--accent); color: #241a0e; }

.copy-feedback { min-height: 1.4rem; font-size: .85rem; color: var(--accent-dark); opacity: 0; transform: translateY(4px); transition: opacity .3s ease, transform .3s ease; margin-top: .75rem; }
.copy-feedback.show { opacity: 1; transform: none; }

/* ========================================= */
/* 7. Footer (wzór 1:1 z strony głównej)     */
/* ========================================= */
footer { padding: 3.75rem 0; font-size: .85rem; background: var(--bg-header); border-top: 1px solid var(--accent); }
.footer-line { color: var(--jasne_tlo); margin-bottom: 1.25rem; max-width: none; }
.footer-links a { color: var(--accent); margin: 0 .625rem; }
.footer-links a:hover, .footer-links a[aria-current="page"] { color: var(--jasne_tlo); }

/* ========================================= */
/* 8. RWD                                     */
/* ========================================= */
@media (max-width: 1024px) {
    :root { --spacing-section: clamp(3.125rem, 8vw, 5rem); }
    .hide-on-mobile { display: none !important; }
    header.site-header .container { width: 100%; }

    /* TOC → poziome „chipy" nad treścią */
    /* POPRAWKA: minmax(0, 1fr) zapobiega rozpychaniu ekranu (grid blowout) przez tabelę z logami */
    .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; margin-top: 3rem; }
    .doc-watermark { display: none; }

    .toc { position: static; }
    .toc-label { padding-left: 0; }
    .toc ol { display: flex; flex-wrap: wrap; gap: .5rem; border-left: none; }
    .toc a { border: 1px solid var(--border-color); background: rgba(255, 255, 255, .5); padding: .45rem .8rem; font-size: .78rem; gap: .5rem; }
    .toc a::before { display: none; }
    .toc li.active a { border-color: var(--accent-dark); background: #fff; }

    .rights-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root { --spacing-section: clamp(2.5rem, 10vw, 3.75rem); --header-h: 4.5rem; }

    header.site-header { padding: 1.25rem 0; transition: transform 0.35s ease-in-out;}
    header.site-header.header-hidden {transform: translateY(-100%);}
    .nav-flex { flex-direction: column; gap: 1rem; }
    .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem 1rem; }
    .nav-links a { margin-left: 0; }

    
    .doc-meta { grid-template-columns: 1fr; gap: 1.125rem; }
    .doc-article { scroll-margin-top: 6rem; }
}

@media (max-width: 560px) {
    .rights-grid { grid-template-columns: 1fr; }
    .copy-row    { align-items: stretch; flex-direction: column; }
    .btn-copy    { width: 100%; text-align: center; padding-block: .875rem; }
    .email       {max-width: 100%;overflow-wrap: break-word; word-break: break-all;}

    .doc-eyebrow {flex-wrap: wrap;}
    .doc-eyebrow::before {flex-shrink: 0; }
    .table-wrap {max-width: 100%; width: 100%;}
    .toc a {min-width: 0; overflow-wrap: break-word;}
    .doc-title { font-size: clamp(1.75rem, 8vw, 2.4rem);}
}


/* ========================================= */
/* 9. Druk — polityka często trafia do PDF   */
/* ========================================= */
@media print {
    #progress, header.site-header, footer, .toc, .btn-copy, .doc-watermark { display: none !important; }
    body, #polityka { background: #fff !important; color: #000; }
    #polityka { padding: 2rem 0; }
    .doc-article { opacity: 1 !important; transform: none !important; break-inside: avoid-page; border-color: #ccc; }
    .doc-content a, .toc a { color: #000; text-decoration: underline; }
}

/* ========================================= */
/* 10. prefers-reduced-motion                */
/* ========================================= */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .mask > span { animation: none; transform: none; }
    .doc-article { opacity: 1; transform: none; transition: none; }
    .toc a, .rights-grid li, #progress, .copy-feedback { transition: none; }
}
