/* SP4 Lubań - style strony.
   Motywy sterowane klasami na <html>: .dark, .contrast, .zoomed (ustawia je theme.js). */

@font-face {
    font-family: Merriweather;
    src: url("../fonts/Merriweather-Regular.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: Merriweather;
    src: url("../fonts/Merriweather-Bold.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: Merriweather;
    src: url("../fonts/Merriweather-Black.ttf") format("truetype");
    font-weight: 900;
    font-display: swap;
}

/* ---------- Kolory ---------- */

:root {
    --bg: #f6f5f1;
    --surface: #ffffff;
    --surface-2: #efede6;
    --text: #1c1f24;
    --muted: #5a6170;
    --border: #dedbd1;
    --accent: #1d5bb8;
    --accent-hover: #164a96;
    --accent-text: #ffffff;
    --sun: #f2b100;
    --danger: #b42318;
    --success: #1f7a3d;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 16px rgb(0 0 0 / 0.06);
    --radius: 12px;
    --font-heading: Merriweather, Georgia, "Times New Roman", serif;
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: light;
}

:root.dark {
    --bg: #121418;
    --surface: #1b1e24;
    --surface-2: #252932;
    --text: #eceef2;
    --muted: #a3aab6;
    --border: #2f343e;
    --accent: #8ab4ff;
    --accent-hover: #b0ccff;
    --accent-text: #0b1220;
    --sun: #f5c542;
    --danger: #ff8f85;
    --success: #6fd394;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 4px 16px rgb(0 0 0 / 0.3);
    color-scheme: dark;
}

:root.contrast {
    --bg: #000000;
    --surface: #000000;
    --surface-2: #000000;
    --text: #ffffff;
    --muted: #ffffff;
    --border: #ffffff;
    --accent: #ffff00;
    --accent-hover: #ffff00;
    --accent-text: #000000;
    --sun: #ffff00;
    --danger: #ff6b6b;
    --success: #7dff7d;
    --shadow: none;
    color-scheme: dark;
}

:root.zoomed {
    font-size: 125%;
}

/* ---------- Podstawy ---------- */

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 1rem/1.6 var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    line-height: 1.3;
    margin: 0 0 0.5em;
}
h1 { font-size: clamp(1.6rem, 3vw + 1rem, 2.25rem); }
h2 { font-size: 1.3rem; }

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

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

:focus-visible {
    outline: 3px solid var(--sun);
    outline-offset: 2px;
}

.icon {
    width: 1.1em;
    height: 1.1em;
    vertical-align: -0.18em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 100;
    background: var(--accent);
    color: var(--accent-text);
    padding: 0.5rem 1rem;
    border-radius: 0 0 8px 8px;
}
.skip-link:focus { top: 0; }

.container {
    width: 100%;
    max-width: 1120px;
    margin-inline: auto;
    padding-inline: 1rem;
}

main.container {
    flex: 1;
    padding-block: 2rem 3rem;
}

/* ---------- Pasek administratora ---------- */

.admin-bar {
    background: var(--text);
    color: var(--bg);
    font-size: 0.875rem;
}
.admin-bar__inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    align-items: center;
    padding-block: 0.4rem;
}
.admin-bar a,
.admin-bar .link-button { color: inherit; }
.admin-bar form { margin-left: auto; }

.link-button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

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

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.site-header__inner {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.25rem 0.5rem;
    padding-block: 0.75rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}
.brand img { width: 3rem; height: 3rem; }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__name {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.4rem;
    line-height: 1.1;
}
.brand__number { color: var(--sun); }
.brand__sub {
    font-size: 0.8rem;
    color: var(--muted);
}

.site-nav {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.site-nav a {
    color: var(--text);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-weight: 500;
}
.site-nav a:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] {
    background: var(--accent);
    color: var(--accent-text);
}

.menu-toggle,
.icon-button,
.display-settings > summary {
    display: inline-grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 1.15rem;
}
.menu-toggle { display: none; }

.display-settings { position: relative; }
.display-settings > summary { list-style: none; }
.display-settings > summary::-webkit-details-marker { display: none; }
.display-settings__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    width: max-content;
    max-width: 80vw;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    display: grid;
    gap: 0.6rem;
    z-index: 20;
}
.display-settings__title { margin: 0; font-weight: 700; }

.switch {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
}
.switch input {
    appearance: none;
    width: 2.5rem;
    height: 1.4rem;
    border-radius: 999px;
    background: var(--border);
    position: relative;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
    transition: background 0.2s;
}
.switch input::after {
    content: "";
    position: absolute;
    top: 0.2rem;
    left: 0.2rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--surface);
    transition: transform 0.2s;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(1.1rem); }

@media (max-width: 760px) {
    .menu-toggle { display: inline-grid; }
    .site-nav {
        display: none;
        flex-direction: column;
        padding-top: 0.5rem;
    }
    .site-nav.is-open { display: flex; }
    .site-nav a { border-radius: 8px; padding: 0.7rem 0.75rem; }
    .brand__sub { display: none; }
}

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

.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.9rem;
}
.site-footer__inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 2rem;
    padding-block: 2rem;
}
.site-footer strong { color: var(--text); }

/* ---------- Elementy wspólne ---------- */

.page-header { margin-bottom: 1.5rem; }
.page-header p { color: var(--muted); margin: 0; }

.button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--accent);
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.button--secondary { background: transparent; color: var(--accent); }
.button--secondary:hover { background: var(--surface-2); color: var(--accent); }
.button--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.button--danger:hover { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.button--small { padding: 0.25rem 0.75rem; font-size: 0.85rem; }
.button[aria-busy="true"] { opacity: 0.6; pointer-events: none; }

.icon-button--danger { color: var(--danger); }

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid currentColor;
    margin: 0 0 1rem;
    background: var(--surface);
}
.flash--success { color: var(--success); }
.flash--error { color: var(--danger); }

.empty {
    color: var(--muted);
    text-align: center;
    padding: 2rem;
    grid-column: 1 / -1;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
details.panel > summary { cursor: pointer; font-weight: 600; }
details.panel[open] > summary { margin-bottom: 1rem; }

.field { display: grid; gap: 0.3rem; margin-bottom: 1rem; }
.field > span { font-weight: 600; font-size: 0.9rem; }
input[type="text"],
input[type="url"],
input[type="search"],
input[type="password"],
input[type="datetime-local"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}
textarea { resize: vertical; }
fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 0; padding: 0.75rem; min-width: 0; }
legend { font-weight: 700; padding-inline: 0.25rem; }
.hint { color: var(--muted); font-size: 0.875rem; margin-top: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.prose { max-width: 70ch; }
.prose p { margin: 0 0 1em; }
.prose a { overflow-wrap: anywhere; }

/* ---------- Komunikat na stronie głównej ---------- */

.site-alert {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--surface);
    border: 2px solid var(--sun);
    border-left-width: 8px;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}
.site-alert[hidden] { display: none; }
.site-alert__body { flex: 1; }
.site-alert h2 { margin-bottom: 0.25rem; }
.site-alert .prose p:last-child { margin-bottom: 0; }

/* ---------- Wyszukiwarka i filtry ---------- */

.search {
    position: relative;
    max-width: 36rem;
    margin-bottom: 1rem;
}
.search > .icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}
.search input {
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border-radius: 999px;
    background: var(--surface);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.filters a {
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
}
.filters a:hover { border-color: var(--accent); }
.filters a[aria-current] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text);
}

/* ---------- Kafelki aktualności ---------- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 1.25rem;
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.15s;
}
.card:hover { transform: translateY(-2px); }

.card__media {
    display: block;
    aspect-ratio: 16 / 10;
    background: var(--surface-2);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__media--video { aspect-ratio: 16 / 9; }
.card__media iframe { width: 100%; height: 100%; border: 0; display: block; }
.card__placeholder {
    display: grid;
    place-items: center;
    height: 100%;
    color: var(--muted);
    font-size: 2.5rem;
}

.card__body { padding: 1rem 1.25rem 1.25rem; flex: 1; }
.card__icon {
    display: inline-grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--accent);
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}
.card__meta {
    margin: 0 0 0.25rem;
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.card__title { font-size: 1.1rem; margin-bottom: 0.4rem; }
.card__title a { color: inherit; text-decoration: none; }
.card__title a:hover { color: var(--accent); text-decoration: underline; }
.card__excerpt { margin: 0; color: var(--muted); font-size: 0.95rem; overflow-wrap: anywhere; }
.card__admin { padding: 0 1.25rem 1rem; }

.load-more { text-align: center; margin-top: 2rem; }

/* ---------- Post i wiadomość wielojęzyczna ---------- */

.article { max-width: 860px; }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1rem;
    text-decoration: none;
}
.article__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    color: var(--muted);
    margin: 0 0 1.5rem;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
    gap: 0.75rem;
    margin-top: 2rem;
}
.gallery__item { margin: 0; position: relative; }
.gallery__item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}
.gallery__item form { position: absolute; top: 0.4rem; right: 0.4rem; }

.lightbox {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
}
.lightbox::backdrop { background: rgb(0 0 0 / 0.9); }
.lightbox img {
    position: absolute;
    inset: 0;
    margin: auto;
    max-width: 92vw;
    max-height: 86vh;
    object-fit: contain;
}
.lightbox button {
    position: absolute;
    background: rgb(0 0 0 / 0.5);
    color: #fff;
    border: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}
.lightbox__prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox__close { right: 1rem; top: 1rem; }
.lightbox__counter {
    position: absolute;
    bottom: 1rem;
    width: 100%;
    text-align: center;
    color: #fff;
    margin: 0;
}

.translation {
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
}
.translation__language {
    margin: 0 0 0.5rem;
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-tools {
    max-width: 860px;
    margin-top: 3rem;
    display: grid;
    gap: 1rem;
}
.admin-inline { display: grid; gap: 0.75rem; margin-top: 1rem; }

/* ---------- Dokumenty, wymagania, informator ---------- */

.file-group { margin-bottom: 2rem; }
.file-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.5rem;
}
.file-list--grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.file-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}
.file-list a { text-decoration: none; font-weight: 500; }
.file-list a:hover { text-decoration: underline; }

.faq { display: grid; gap: 0.75rem; max-width: 860px; }
.faq__item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}
.faq__item > summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 1.05rem;
}
.faq__item[open] > summary { margin-bottom: 0.75rem; }

/* ---------- Strony statyczne ---------- */

.timeline {
    position: relative;
    display: grid;
    gap: 1.25rem;
    margin: 0 0 3rem;
    padding-left: 1.5rem;
    border-left: 3px solid var(--sun);
    max-width: 860px;
}
.timeline .argument {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}
.timeline .argument::before {
    content: "";
    position: absolute;
    left: calc(-1.5rem - 8px);
    top: 1.35rem;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--sun);
}
.timeline .index {
    font-family: var(--font-heading);
    font-weight: 900;
    color: var(--accent);
    font-size: 1.2rem;
}
.about .tag {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.contact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}
.contact__method {
    display: grid;
    justify-items: center;
    gap: 0.25rem;
    text-align: center;
    padding: 2rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow);
}
.contact__method .icon { font-size: 2rem; color: var(--accent); margin-bottom: 0.5rem; }
.contact__method:hover { border-color: var(--accent); color: var(--text); }
.contact__label { font-family: var(--font-heading); font-weight: 700; font-size: 1.2rem; }

#rodo .inspector { margin: 1.5rem 0; display: grid; gap: 0.5rem; }
#rodo .inspector .line { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; }

#exam table {
    border-collapse: collapse;
    margin-bottom: 2rem;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}
#exam th, #exam td { padding: 0.5rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
#exam ul { max-width: 70ch; padding-left: 1.25rem; }
#exam li { margin-bottom: 0.75rem; }

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

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 1.25rem;
    align-items: start;
}
.admin-grid h2 { font-size: 1.1rem; }
.panel--wide { grid-column: 1 / -1; }
.columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
[id] { scroll-margin-top: 7rem; }

.login { max-width: 24rem; margin: 2rem auto; }

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.tabs a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    font-weight: 600;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

.flash--info { color: var(--muted); }

.table-wrap { overflow-x: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.admin-table th,
.admin-table td {
    padding: 0.6rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.admin-table th { font-size: 0.85rem; color: var(--muted); }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table__actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
.nowrap { white-space: nowrap; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.admin-narrow { max-width: 40rem; }
.edit-panel { max-width: 860px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; }
.inline-form .field { flex: 1 1 16rem; margin-bottom: 0; }
.category-list { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: 0.75rem; }
.category-list li { display: grid; gap: 0.75rem; }
.category-list .hint { margin: 0; }

/* ---------- Błędy i przerwa techniczna ---------- */

.error-page { text-align: center; padding: 3rem 1rem; }
.error-page__code {
    font-family: var(--font-heading);
    font-size: 4rem;
    font-weight: 900;
    color: var(--sun);
    margin: 0;
}
.error-page__details {
    text-align: left;
    white-space: pre-wrap;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
}

.maintenance {
    margin: auto;
    text-align: center;
    padding: 2rem;
}
.maintenance .brand__name { font-size: 2.5rem; margin: 0 0 1rem; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
