/* ==========================================================
   IWU – wspólny arkusz stylów
   ========================================================== */


:root {
    --brand: #003366;
    --brand-dark: #002244;
    --brand-light: #e8f0f8;
    --accent: #1a7fd1;
    --text: #2b2f36;
    --muted: #6b7280;
    --border: rgba(0, 51, 102, 0.12);
    --card-bg: rgba(255, 255, 255, 0.92);
    --danger: #dc3545;
    --radius: 14px;
    --shadow: 0 2px 6px rgba(0, 30, 60, 0.05), 0 12px 32px rgba(0, 30, 60, 0.07);
    --shadow-hover: 0 4px 10px rgba(0, 30, 60, 0.08), 0 18px 40px rgba(0, 30, 60, 0.12);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #eef3f8;
    background-image: linear-gradient(160deg, #f6f9fd 0%, #dde8f4 100%);
    background-attachment: fixed;
}

img { max-width: 100%; height: auto; }

a { color: var(--brand); }

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Nagłówek i nawigacja ---------- */

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.88);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.logo {
    font-size: 1.9rem;
    font-weight: 800;
    font-style: italic;
    letter-spacing: -0.5px;
    color: var(--brand);
    text-decoration: none;
    line-height: 1;
}

.nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav a {
    text-decoration: none;
    color: var(--text);
    font-size: 0.95rem;
    padding: 8px 14px;
    border-radius: 999px;
    transition: background 0.2s, color 0.2s;
}

.nav a:hover { background: var(--brand-light); color: var(--brand); }

.nav a.active {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
}

.nav a.btn-admin {
    border: 1px dashed #b8c2cc;
    color: var(--muted);
    background: #fff;
}

.nav a.btn-admin:hover { border-color: var(--brand); color: var(--brand); }

/* Menu mobilne (bez JavaScript) */
.nav-toggle { display: none; }

.nav-burger {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: #fff;
}

.nav-burger span,
.nav-burger span::before,
.nav-burger span::after {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--brand);
    border-radius: 2px;
    position: relative;
    transition: transform 0.25s, background 0.25s;
}

.nav-burger span::before,
.nav-burger span::after { content: ""; position: absolute; left: 0; }
.nav-burger span::before { top: -6px; }
.nav-burger span::after { top: 6px; }

.nav-toggle:checked + .nav-burger span { background: transparent; }
.nav-toggle:checked + .nav-burger span::before { top: 0; transform: rotate(45deg); }
.nav-toggle:checked + .nav-burger span::after { top: 0; transform: rotate(-45deg); }

/* ---------- Treść główna ---------- */

main {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
}

.page-title {
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    line-height: 1.2;
    color: var(--brand);
    margin-bottom: 14px;
}

.title-rule {
    border: 0;
    height: 4px;
    width: 72px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    margin-bottom: 28px;
}

/* ---------- Karty aktualności ---------- */

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 22px;
    margin-top: 10px;
}

.post-card {
    display: flex;
    flex-direction: column;
    --pad: 26px;
    background: var(--card-bg);
    padding: var(--pad);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-top: 4px solid var(--brand);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.post-date {
    order: -1;
    align-self: flex-start;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--brand);
    background: var(--brand-light);
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 12px;
}

.post-title {
    font-size: 1.3rem;
    line-height: 1.3;
    font-weight: 700;
    color: #111827;
    margin-bottom: 10px;
    overflow-wrap: anywhere;
}

.post-excerpt {
    color: #4b5563;
    margin-bottom: 18px;
    overflow-wrap: anywhere;
}

.btn-read-more {
    margin-top: auto;
    display: inline-block;
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.btn-read-more:hover { text-decoration: underline; }

.no-posts, .loading { color: var(--muted); }

/* ---------- Paginacja ---------- */

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 36px;
}

.page-btn {
    min-width: 42px;
    min-height: 42px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--brand);
    font: inherit;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.page-btn:hover { background: var(--brand-light); }
.page-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Karty treści (O nas, pojedynczy wpis) ---------- */

.about-card,
main > article {
    background: var(--card-bg);
    padding: clamp(22px, 4vw, 40px);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow);
}

.about-card h2 {
    font-size: 1.3rem;
    color: var(--brand);
    margin: 26px 0 10px;
}

.about-card p { color: #444b55; margin-bottom: 15px; }
.about-card ul { padding-left: 22px; color: #444b55; }
.about-card li { margin-bottom: 10px; }

/* Strona pojedynczego wpisu */
main > article h1 {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    line-height: 1.25;
    color: var(--brand);
    overflow-wrap: anywhere;
}

main > article .content {
    font-size: 1.05rem;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

main > p a { font-weight: 600; text-decoration: none; }
main > p a:hover { text-decoration: underline; }

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

footer {
    text-align: center;
    padding: 28px 20px;
    color: var(--muted);
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.7);
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* ---------- Panel administratora ---------- */

.admin-links { display: flex; gap: 6px; flex-wrap: wrap; }

.admin-links a {
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 999px;
}

.admin-links a.btn-site { color: var(--brand); }
.admin-links a.btn-site:hover { background: var(--brand-light); }
.admin-links a.btn-logout { color: var(--danger); }
.admin-links a.btn-logout:hover { background: #fdeaec; }

.admin-main { max-width: 900px; }

.card {
    background: var(--card-bg);
    padding: clamp(20px, 4vw, 32px);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow);
    margin-bottom: 28px;
}

.card h2 { color: var(--brand); font-size: 1.35rem; margin-bottom: 20px; }

.alert-success, .alert-danger, .error-msg {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.92rem;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger, .error-msg { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #3b4250;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cfd6de;
    border-radius: 10px;
    font-family: inherit;
    font-size: 16px; /* zapobiega powiększaniu strony na iOS */
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group textarea { resize: vertical; min-height: 120px; }

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(0, 51, 102, 0.12);
}

.btn-submit {
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 13px 26px;
    min-height: 46px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-submit:hover { background: var(--brand-dark); }
.btn-submit:active { transform: scale(0.98); }

.post-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #e9edf2;
}

.post-item:last-child { border-bottom: none; }
.post-info { min-width: 0; }
.post-info h3 { font-size: 1.05rem; color: #222; overflow-wrap: anywhere; }
.post-info p { font-size: 0.85rem; color: var(--muted); }

.btn-delete {
    flex-shrink: 0;
    background: var(--danger);
    color: #fff;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-delete:hover { background: #bd2130; }

/* ---------- Logowanie ---------- */

body.login-page {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.96);
    padding: clamp(28px, 6vw, 44px);
    border-radius: 18px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-card h2 { color: var(--brand); font-size: 1.8rem; font-style: italic; margin-bottom: 6px; }
.login-card > p { color: var(--muted); font-size: 0.92rem; margin-bottom: 26px; }
.login-card .form-group { text-align: left; }
.login-card .btn-submit { width: 100%; }

.back-link {
    display: inline-block;
    margin-top: 20px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
}

.back-link:hover { text-decoration: underline; }


/* ---------- Tło interaktywne ---------- */

#bg-canvas {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

/* ---------- Okładka na karcie ---------- */

.post-cover-link { display: block; order: -2; margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 18px; }

.post-cover {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    background: var(--brand-light);
}

/* ---------- Strona wpisu ---------- */

.post-main { max-width: 860px; }

.post-back {
    display: inline-block;
    margin-bottom: 18px;
    font-weight: 600;
    text-decoration: none;
    color: var(--brand);
}
.post-back:hover { text-decoration: underline; }

.post-full {
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: clamp(22px, 5vw, 56px);
}

.post-head { margin-bottom: 28px; }

.post-meta { margin-bottom: 12px; }
.post-meta time {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand);
    background: var(--brand-light);
    padding: 4px 12px;
    border-radius: 999px;
}

.post-full h1 {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    font-weight: 800;
    color: var(--brand);
    overflow-wrap: anywhere;
}

.post-lead {
    margin-top: 16px;
    font-size: clamp(1.1rem, 2.4vw, 1.3rem);
    line-height: 1.55;
    color: #4b5563;
    overflow-wrap: anywhere;
}

.post-content {
    max-width: 66ch;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #2f3541;
}
.post-content p { margin-bottom: 1.2em; overflow-wrap: anywhere; }

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 22px;
}

.post-nav-link {
    display: block;
    text-decoration: none;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 20px;
    color: var(--text);
    transition: border-color 0.2s, background 0.2s;
}
.post-nav-link:hover { border-color: var(--brand); background: #fff; }
.post-nav-link span { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 2px; }
.post-nav-link strong { display: block; color: var(--brand); overflow-wrap: anywhere; }
.post-nav-link.next { text-align: right; grid-column: 2; }
.post-nav-link.prev { grid-column: 1; }

.post-missing { text-align: center; }
.post-missing h1 { font-size: 1.8rem; margin-bottom: 10px; }
.post-missing p { color: var(--muted); margin-bottom: 14px; }

/* ---------- Wpis: zdjęcie główne i galeria ---------- */

.post-hero { margin: 0 0 30px; }
.post-hero a {
    display: block;
    border-radius: 14px;
    overflow: hidden;
    background: #0e1b2c;
    cursor: zoom-in;
}
.post-hero img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    transition: transform 0.4s ease;
}
.post-hero a:hover img { transform: scale(1.015); }

.post-gallery { margin-top: 38px; padding-top: 26px; border-top: 1px solid var(--border); }
.post-gallery h2 { font-size: 1.25rem; color: var(--brand); margin-bottom: 14px; }
.post-gallery h2 span { font-size: 0.9rem; font-weight: 500; color: var(--muted); margin-left: 6px; }

.post-gallery ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.post-gallery a {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: var(--brand-light);
    cursor: zoom-in;
}
.post-gallery img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, filter 0.3s ease;
}
.post-gallery a:hover img { transform: scale(1.07); filter: brightness(0.85); }
.post-gallery a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.post-actions { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--border); }
.btn-copy {
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--brand);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    min-height: 44px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.btn-copy:hover { background: var(--brand-light); border-color: var(--brand); }

/* ---------- Lightbox ---------- */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: rgba(5, 12, 24, 0.97);
}
.lightbox[hidden] { display: none; }
body.lb-open { overflow: hidden; }

.lb-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
    cursor: zoom-in;
    padding: 56px 70px 8px;
}
.lightbox.is-zoomed .lb-stage { cursor: grab; }
.lightbox.is-dragging .lb-stage { cursor: grabbing; }

.lb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    transform-origin: center center;
    will-change: transform;
    border-radius: 4px;
    transition: opacity 0.2s;
}
.lb-img.is-loading { opacity: 0.35; }

.lb-btn {
    position: absolute;
    z-index: 3;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 999px;
    background: rgba(8, 18, 34, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}
.lb-btn:hover:not(:disabled) { background: rgba(8, 18, 34, 0.85); }
.lb-btn:disabled { opacity: 0.25; cursor: default; }
.lb-close { top: 10px; right: 12px; font-size: 2rem; }
.lb-zoom { top: 10px; right: 66px; font-size: 1.9rem; }
.lb-nav { top: calc(50% - 40px); font-size: 2.2rem; padding-bottom: 4px; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }

.lb-bottom {
    flex: 0 0 auto;
    padding: 6px 12px 12px;
    text-align: center;
}
.lb-counter { color: #cfd8e3; font-size: 0.88rem; min-height: 1.3em; margin-bottom: 6px; }

.lb-thumbs {
    list-style: none;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    justify-content: safe center;
    padding: 2px;
}
.lb-thumbs[hidden] { display: none; }
.lb-thumbs li { flex: 0 0 auto; }
.lb-thumbs button {
    display: block;
    width: 64px;
    height: 48px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 7px;
    overflow: hidden;
    background: #000;
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.2s, border-color 0.2s;
}
.lb-thumbs li.current button { opacity: 1; border-color: #fff; }
.lb-thumbs button:hover { opacity: 0.9; }
.lb-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-height: 560px) { .lb-thumbs { display: none; } }

/* ---------- Panel admina: zdjęcia ---------- */

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.form-group label.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    padding: 26px 16px;
    margin: 0;
    border: 2px dashed #b8c6d6;
    border-radius: 12px;
    background: #f7fafd;
    cursor: pointer;
    font-weight: 400;
    transition: border-color 0.2s, background 0.2s;
}
.dropzone strong { color: var(--brand); font-size: 1rem; }
.dropzone span { color: var(--muted); font-size: 0.85rem; }
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-light); }
.visually-hidden:focus-visible + .upload-hint,
input.visually-hidden:focus-visible ~ .upload-hint { outline: 3px solid var(--accent); }

.upload-hint { margin-top: 8px; font-size: 0.82rem; color: var(--muted); }

.upload-error {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f8d7da;
    color: #721c24;
    font-size: 0.88rem;
}

.upload-previews {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.upload-previews:empty { display: none; }

.upload-item {
    position: relative;
    border: 1px solid #dbe3ec;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}
.upload-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.upload-name {
    display: block;
    padding: 6px 8px 0;
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upload-actions { display: flex; gap: 4px; padding: 6px 8px 8px; }
.upload-actions button {
    flex: 1;
    min-height: 34px;
    border: 1px solid #cfd6de;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--brand);
}
.upload-actions button:hover:not(:disabled) { background: var(--brand-light); }
.upload-actions button:disabled { opacity: 0.35; cursor: default; }
.upload-actions button:last-child { color: var(--danger); }

.post-item-thumb {
    width: 64px; height: 48px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.post-info { flex: 1; }
.post-info p a { color: var(--brand); }

/* ---------- Statut ---------- */

.read-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 300;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    transform-origin: 0 50%;
    transform: scaleX(0);
}

.statut-main { max-width: 1100px; }

.statut-hero { margin-bottom: 30px; }
.statut-hero .page-title { margin-bottom: 6px; }

.statut-subtitle {
    color: var(--muted);
    font-size: 1.1rem;
}

.statut-layout {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 36px;
    align-items: start;
}

/* Spis treści */
.statut-toc {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding-right: 4px;
}

.statut-toc summary {
    list-style: none;
    cursor: pointer;
    font-weight: 700;
    color: var(--brand);
    font-size: 1.05rem;
    margin-bottom: 10px;
}
.statut-toc summary::-webkit-details-marker { display: none; }

.statut-toc ol { list-style: none; border-left: 2px solid var(--border); }

.statut-toc li { padding: 2px 0 6px 14px; margin-left: -2px; border-left: 2px solid transparent; }
.statut-toc li.open { border-left-color: var(--brand); }

.toc-ch {
    display: block;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    padding: 4px 0;
}
.toc-ch span { display: block; font-weight: 400; color: var(--muted); font-size: 0.88rem; }
.toc-ch:hover, .toc-ch.current { color: var(--brand); }
.toc-ch.current span { color: var(--brand); }

.toc-par { display: none; flex-wrap: wrap; gap: 4px; padding: 2px 0 6px; }
li.open .toc-par { display: flex; }

.toc-par a {
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 7px;
}
.toc-par a:hover { color: var(--brand); border-color: var(--brand); }
.toc-par a.current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Panel z tekstem */
.statut-panel {
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: clamp(22px, 5vw, 56px);
    font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    font-size: 1.07rem;
    line-height: 1.75;
}

.statut-chapter { scroll-margin-top: 90px; }
.statut-chapter + .statut-chapter { margin-top: 56px; padding-top: 44px; border-top: 1px solid var(--border); }

.chapter-head { margin-bottom: 26px; }

.chapter-label {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 2px;
}

.chapter-head h2 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    line-height: 1.2;
    font-weight: 800;
    color: var(--brand);
}

/* Paragraf: numer w marginesie, treść obok */
.statut-par {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 8px 18px;
    padding: 18px 0;
    scroll-margin-top: 90px;
}

.par-num {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.75;
}

.par-num a { color: var(--brand); text-decoration: none; white-space: nowrap; }
.par-num a:hover { text-decoration: underline; }
.statut-par:target .par-num a { background: #fff3bf; border-radius: 4px; padding: 0 4px; margin-left: -4px; }

.par-body { max-width: 68ch; color: #2f3541; }

.clause { display: flex; gap: 10px; margin-bottom: 10px; }
.clause-num { flex: 0 0 auto; min-width: 1.8em; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.clause > div { min-width: 0; overflow-wrap: break-word; hyphens: auto; }
.clause.sub { margin: 8px 0 0; }
.clause.sub .clause-num { color: var(--accent); }
.clause-plain { margin-bottom: 10px; }

/* ==========================================================
   Responsywność
   ========================================================== */

@media (max-width: 720px) {
    .header { padding: 10px 0; }
    .logo { font-size: 1.6rem; }

    .nav-burger { display: inline-flex; }

    .nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 4px;
        padding-top: 10px;
    }

    .nav-toggle:checked + .nav-burger + .nav { display: flex; }

    .nav a {
        padding: 12px 16px;
        border-radius: 10px;
        text-align: left;
    }

    main { padding: 28px 16px; }
    .container { padding: 0 16px; }

    .posts-grid { grid-template-columns: 1fr; gap: 16px; }
    .post-card { --pad: 20px; }

    .post-item { flex-direction: column; align-items: stretch; }
    .btn-delete { text-align: center; padding: 12px; }

    .btn-submit { width: 100%; }

    body { background-attachment: scroll; }
}

@media (max-width: 960px) {
    .statut-layout { grid-template-columns: 1fr; gap: 18px; }
    .statut-toc {
        position: static;
        max-height: none;
        background: rgba(255, 255, 255, 0.94);
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 14px 16px;
    }
    .statut-toc summary { margin-bottom: 0; }
    .statut-toc details[open] summary { margin-bottom: 10px; }
    .statut-toc summary::after { content: "  +"; color: var(--accent); }
    .statut-toc details[open] summary::after { content: "  –"; }
}

@media (max-width: 720px) {
    .statut-panel { border-radius: 14px; font-size: 1.02rem; padding: 22px 18px; }
    .statut-par { grid-template-columns: 1fr; gap: 0; padding: 12px 0; }
    .par-num { line-height: 1.4; margin-bottom: 4px; }
    .statut-chapter + .statut-chapter { margin-top: 36px; padding-top: 30px; }
}

@media (max-width: 720px) {
    .lb-stage { padding: 56px 6px 4px; }
    .lb-nav { width: 42px; height: 42px; }
    .lb-prev { left: 6px; }
    .lb-next { right: 6px; }
    .post-gallery ul { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .lb-thumbs button { width: 52px; height: 40px; }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav-link.next, .post-nav-link.prev { grid-column: 1; text-align: left; }
    .post-full { border-radius: 14px; padding: 22px 18px; }
    .post-content { font-size: 1.05rem; }
    .post-item-thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
    .post-card:hover { transform: none; }
}

/* ---------- Panel admina: edycja wpisów i zdjęcie główne ---------- */

.post-item-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn-edit {
    background: var(--brand);
    color: #fff;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}
.btn-edit:hover { background: var(--brand-dark); }

.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn-cancel { color: var(--muted); font-weight: 600; text-decoration: none; padding: 10px 6px; }
.btn-cancel:hover { color: var(--brand); text-decoration: underline; }

fieldset.existing-images {
    border: 1px solid #dbe3ec;
    border-radius: 12px;
    padding: 14px 16px 16px;
    margin-bottom: 20px;
    min-width: 0;
}
.existing-images legend { padding: 0 8px; font-weight: 600; font-size: 0.9rem; color: #3b4250; }

.existing-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.existing-item, .upload-item { display: flex; flex-direction: column; }
.existing-item {
    border: 2px solid #dbe3ec;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s, opacity 0.2s;
}
.existing-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.existing-item.is-removed { opacity: 0.45; border-style: dashed; }
.existing-item.is-removed img { filter: grayscale(1); }

.pick-cover, .pick-remove {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 36px;
}
.pick-cover { color: var(--brand); }
.pick-remove { color: var(--danger); border-top: 1px solid #eef1f5; }
.pick-cover input, .pick-remove input { width: 17px; height: 17px; accent-color: var(--brand); flex-shrink: 0; }
.pick-remove input { accent-color: var(--danger); }

/* wybrane zdjęcie główne jest wyraźnie zaznaczone */
.existing-item:has(.pick-cover input:checked),
.upload-item:has(.pick-cover input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(0, 51, 102, 0.18); }
.existing-item:has(.pick-cover input:checked) .pick-cover,
.upload-item:has(.pick-cover input:checked) .pick-cover { background: var(--brand-light); }

.upload-item { border-width: 2px; }

@media (max-width: 720px) {
    .post-item-actions { width: 100%; }
    .post-item-actions a { flex: 1; text-align: center; padding: 12px; }
    .btn-edit, .btn-delete { padding: 12px; }
}

/* etykiety "Główne" w podglądzie nie dziedziczą stylu etykiet formularza */
.form-group label.pick-cover,
.form-group label.pick-remove {
    display: flex;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand);
}
.form-group label.pick-remove { color: var(--danger); }

/* ukryty input pliku nie może poszerzać strony */
.form-group { position: relative; }
.visually-hidden { left: 0; top: 0; }

@media (max-width: 720px) {
    .existing-list, .upload-previews { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Usuwanie wpisu jako formularz POST */
.inline-form { display: contents; }
button.btn-delete { border: 0; cursor: pointer; font-family: inherit; line-height: inherit; }