/* ==========================================================================
   Karolina Dziurgot Fotografia - style strony publicznej (jeden plik, bez bundlera)
   ========================================================================== */

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('../fonts/montserrat-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('../fonts/montserrat-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Cormorant Garamond (OFL, @fontsource-variable 5.3.0) - tylko tytuł galerii klienta.
   display: block + preload obu plików (layout.php) - tytuł nie przeskakuje z kroju zapasowego, także ą/ś z latin-ext. */
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-display: block;
    font-weight: 300 700;
    src: url('../fonts/cormorant-garamond-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-display: block;
    font-weight: 300 700;
    src: url('../fonts/cormorant-garamond-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --color-black: #000;
    --color-star: #e0a526; /* gwiazdka w trybie wyboru zdjęć */
    --color-white: #fff;
    --color-gray: #f5f5f5;
    --color-border: #ddd;
    --color-text-muted: #555;
    --color-brand: #5c4033;
    --max-width: 1200px;
    --gutter: 20px;
    --radius: 8px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.3s var(--ease);
    --header-height: 82px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--header-height); }
body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--color-black);
    background: var(--color-white);
    overflow-x: hidden;
}
main { flex: 1; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }

.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 var(--gutter); }

.skip-link {
    position: absolute; left: 1rem; top: -100px; z-index: 3000;
    padding: 0.75rem 1rem; background: var(--color-black); color: var(--color-white);
}
.skip-link:focus { top: 1rem; }

/* ---------- Przyciski ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    min-height: 48px; padding: 12px 32px;
    border: 1px solid transparent; border-radius: 2px;
    font-weight: 500; letter-spacing: 0.5px; text-decoration: none; text-align: center;
    cursor: pointer;
    transition: background-color var(--transition), transform var(--transition), border-color var(--transition);
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--color-black); color: var(--color-white); }
.btn-primary:hover { background: #333; }
.btn-secondary { background: var(--color-gray); color: var(--color-black); border-color: var(--color-border); }
.btn-secondary:hover { background: #e8e8e8; }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 16px; font-size: 0.85rem; }
.btn[hidden] { display: none; }

/* ---------- Nagłówek i nawigacja ---------- */
.header {
    position: sticky; top: 0; z-index: 1000;
    background: var(--color-white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.nav { display: flex; align-items: center; justify-content: space-between; min-height: var(--header-height); gap: 1rem; }
.logo img { width: auto; height: 50px; }
.nav-menu { display: flex; gap: 2rem; list-style: none; }
.nav-link {
    position: relative; display: inline-block; padding: 0.5rem 0;
    color: var(--color-brand); text-decoration: none;
}
.nav-link::after {
    content: ''; position: absolute; left: 0; bottom: 2px;
    width: 100%; height: 2px; background: currentColor;
    transform: scaleX(0); transform-origin: left; transition: transform var(--transition);
}
.nav-link:hover::after, .nav-link[aria-current='page']::after { transform: scaleX(1); }
.nav-toggle, .nav-close, .nav-overlay { display: none; }

@media (max-width: 768px) {
    :root { --header-height: 66px; }
    .logo img { height: 40px; }
    .nav-toggle {
        display: flex; flex-direction: column; justify-content: center; gap: 6px;
        width: 44px; height: 44px; padding: 10px; background: none; border: 0; cursor: pointer;
    }
    .nav-toggle span { display: block; height: 2px; background: var(--color-brand); }
    .nav-panel {
        position: fixed; inset: 0 0 0 auto; z-index: 1500;
        width: min(80%, 320px); padding: 5rem 2rem 2rem;
        background: var(--color-white); box-shadow: -10px 0 27px rgba(0, 0, 0, 0.1);
        transform: translateX(100%); visibility: hidden;
        transition: transform var(--transition), visibility var(--transition);
        overflow-y: auto;
    }
    .nav-panel.open { transform: none; visibility: visible; }
    .nav-menu { flex-direction: column; align-items: center; gap: 1.25rem; font-size: 1.1rem; }
    .nav-close {
        display: block; position: absolute; top: 0.75rem; right: 0.75rem;
        width: 44px; height: 44px; background: none; border: 0; font-size: 2rem; line-height: 1; cursor: pointer;
    }
    .nav-overlay:not([hidden]) {
        display: block; position: fixed; inset: 0; z-index: 1400; background: rgba(0, 0, 0, 0.5);
    }
}

/* ---------- Stopka ---------- */
.footer { margin-top: 3rem; padding: 3rem 0; background: var(--color-black); color: var(--color-white); }
.footer-content { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2rem; }
.footer-info { text-align: right; font-size: 0.9rem; }
.footer-info p { margin: 0.25rem 0; }
.footer-info a { text-decoration: none; }
.footer-info a:hover { text-decoration: underline; }
.social-links { display: flex; gap: 0.5rem; }
.social-links a {
    display: flex; align-items: center; justify-content: center; width: 44px; height: 44px;
    transition: transform var(--transition), opacity var(--transition);
}
.social-links a:hover { transform: translateY(-3px); opacity: 0.8; }
.social-links svg { fill: currentColor; }

@media (max-width: 768px) {
    .footer-content { flex-direction: column; text-align: center; }
    .footer-info { text-align: center; }
}

/* ---------- Typografia stron ---------- */
.page { padding-top: 2.5rem; }
.page-title, .section-title {
    font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem); font-weight: 300; line-height: 1.2;
    text-align: center; margin-bottom: 1rem; overflow-wrap: anywhere; white-space: pre-line;
}
.section { padding-top: 3rem; }

/* Galeria klienta: mała nawigacja (Powrót po lewej, Dostęp VIP po prawej) nad dużym ozdobnym tytułem. */
.gallery-page { padding-top: 1rem; }
.gallery-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 32px; }
.gallery-nav-link {
    display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.1rem;
    font-size: 0.8rem; font-weight: 500; letter-spacing: 0.5px; color: var(--color-text-muted); text-decoration: none;
    transition: color 0.2s;
}
.gallery-nav-link:hover { color: var(--color-black); }
.gallery-nav-link .icon { width: 16px; height: 16px; }
.gallery-nav-link:first-child { margin-left: -0.35rem; }
.gallery-nav-link:first-child .icon { stroke-width: 2.5; }
.gallery-nav-vip { margin-left: auto; padding: 0.3rem 0.75rem; border: 1px solid var(--color-border); border-radius: 999px; color: var(--color-black); }
.gallery-nav-vip .icon { color: var(--color-star); fill: currentColor; }
.gallery-nav-vip:hover { border-color: var(--color-star); }
.gallery-title {
    margin: 0.25rem 0 1rem; text-align: center; overflow-wrap: anywhere; white-space: pre-line;
    font-family: 'Cormorant Garamond', 'Cormorant', Garamond, 'Times New Roman', serif;
    font-size: clamp(3.6rem, 2.6rem + 4vw, 5.25rem); font-weight: 600; line-height: 1.05; letter-spacing: 0.01em;
}
.gallery-title::after {
    content: ''; display: block; width: 48px; height: 1px; margin: 1rem auto 0; background: var(--color-brand); opacity: 0.6;
}
.gallery-downloads { gap: 0.5rem; padding: 0.5rem 0 0; }
@media (min-width: 769px) { .gallery-page { padding-top: 1.75rem; } .gallery-title { margin-bottom: 1.5rem; } }
.page-lead { max-width: 720px; margin: 0 auto 1rem; text-align: center; color: var(--color-text-muted); }
.page-center { text-align: center; }
.prose { max-width: 760px; margin: 0 auto; font-size: 1.05rem; line-height: 1.8; }
.prose p { margin-bottom: 1.5rem; }
.empty { padding: 2rem 0; text-align: center; color: var(--color-text-muted); }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; padding: 1.5rem 0; }
.breadcrumbs { font-size: 0.9rem; color: var(--color-text-muted); text-align: center; margin-bottom: 0.5rem; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

/* ---------- Strona główna ---------- */
.hero { display: flex; align-items: center; min-height: min(70vh, 640px); padding: 4rem 0; text-align: center; }
.hero-title { font-size: clamp(2rem, 1.2rem + 4vw, 3.5rem); font-weight: 300; letter-spacing: -1px; line-height: 1.15; margin-bottom: 1rem; }
.hero-title span { display: block; margin-top: 0.5rem; font-size: 0.45em; letter-spacing: 2px; text-transform: uppercase; color: var(--color-brand); }
.hero-subtitle { font-size: 1.25rem; font-weight: 300; color: #333; margin-bottom: 1.5rem; }
.hero-description { max-width: 760px; margin: 0 auto 2.5rem; font-size: 1.1rem; line-height: 1.8; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; }

/* ---------- Kafelki albumów (portfolio, galerie) ---------- */
.album-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 2rem; padding: 2rem 0; list-style: none;
}
.album-card {
    position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden;
    border-radius: var(--radius); background: var(--color-gray);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); color: var(--color-white); text-decoration: none;
    transition: transform var(--transition), box-shadow var(--transition);
}
.album-card img {
    /* Kadr okładki z panelu (Okładka → Kadruj): punkt x/y jak object-position i powiększenie wokół niego - zmienne --cover-card-*
       ustawia coverCropStyle() (includes/images.php); ten sam wzór liczy podgląd w panelu (admin/assets/modules/views/crop-editor.js). */
    --crop-x: var(--cover-card-x, 0.5); --crop-y: var(--cover-card-y, 0.5);
    width: 100%; height: 100%; object-fit: cover; object-position: calc(var(--crop-x) * 100%) calc(var(--crop-y) * 100%);
    transform-origin: calc(var(--crop-x) * 100%) calc(var(--crop-y) * 100%); scale: var(--cover-card-zoom, 1);
    transition: transform 0.6s var(--ease);
}
.album-card-overlay {
    position: absolute; inset: auto 0 0 0; padding: 1.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
}
.album-card-title { white-space: pre-line; font-size: 1.25rem; font-weight: 600; line-height: 1.3; margin-bottom: 0.25rem; }
.album-card-count { font-size: 0.95rem; font-weight: 300; opacity: 0.9; }
/* Kłódka galerii z hasłem - prawy dolny róg kafelka, tytuł nie wchodzi pod nią. */
.album-card.is-locked .album-card-overlay { padding-right: 3.75rem; }
.album-card-lock { position: absolute; right: 1.25rem; bottom: 1.4rem; display: flex; color: var(--color-white); filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5)); }
.album-card-lock .icon { width: 22px; height: 22px; stroke-width: 1.7; }
@media (hover: hover) {
    .album-card:hover { transform: translateY(-5px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); }
    .album-card:hover img { transform: scale(1.06); }
}
@media (max-width: 768px) { .album-grid { gap: 1.25rem; padding: 1.5rem 0; } }

/* ---------- Siatka zdjęć: mozaika / siatka (assets/js/gallery-view.js) ----------
   Widok i rozmiar są na <html> (data-gallery-view, data-gallery-size) - ustawia je skrypt w <head>.
   --row-base (px, bez jednostki - czyta go też JS) × --row-scale = docelowa wysokość wiersza mozaiki,
   --grid-cols = kolumny siatki. Wartości zależą od rozmiaru S/M/L i szerokości ekranu. */
:root { --row-base: 260; --row-scale: 1; --grid-cols: 5; --gap: 6px; }
:root[data-gallery-size='s'] { --row-scale: 0.7; --grid-cols: 8; }
:root[data-gallery-size='l'] { --row-scale: 1.4; --grid-cols: 3; }
@media (max-width: 1024px) {
    :root { --row-base: 200; --grid-cols: 4; }
    :root[data-gallery-size='s'] { --grid-cols: 6; }
    :root[data-gallery-size='l'] { --grid-cols: 2; }
}
@media (max-width: 768px) {
    :root { --row-base: 150; --grid-cols: 3; --gap: 4px; }
    :root[data-gallery-size='s'] { --grid-cols: 4; }
    :root[data-gallery-size='l'] { --grid-cols: 2; }
}
@media (max-width: 400px) { :root { --row-base: 120; } }

.gallery-toolbar { display: none; }
.js .gallery-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem 0.75rem; margin-top: 1rem; }
.gallery-count { margin-right: auto; font-size: 0.8rem; color: var(--color-text-muted); }
.segmented { display: inline-flex; border: 1px solid var(--color-border); border-radius: 2px; overflow: hidden; }
.segmented button {
    display: inline-flex; align-items: center; gap: 0.35rem; min-width: 28px; min-height: 28px; padding: 0 0.6rem;
    justify-content: center; border: 0; background: var(--color-white); cursor: pointer; font-size: 0.75rem; font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}
.segmented button + button { border-left: 1px solid var(--color-border); }
.segmented button:hover { background: var(--color-gray); }
.segmented button[aria-pressed='true'] { background: var(--color-black); color: var(--color-white); }
.segmented .icon { width: 14px; height: 14px; }
@media (max-width: 600px) {
    .js .gallery-toolbar { gap: 0.35rem; margin-top: 0.25rem; }
    .gallery-count { font-size: 0.7rem; }
    .segmented button span { display: none; }
    .segmented button { min-width: 24px; min-height: 22px; padding: 0 0.3rem; font-size: 0.6rem; }
    .segmented .icon { width: 11px; height: 11px; }
}

.image-grid { --row-height: calc(var(--row-base) * var(--row-scale) * 1px); margin: 1rem 0 2rem; }
.image-item { position: relative; display: block; overflow: hidden; min-width: 0; border-radius: 4px; background: var(--color-gray); }
.image-item[hidden] { display: none; }
.image-link { display: block; width: 100%; height: 100%; cursor: zoom-in; }
/* Kadr (siatka, lekko w blokach mozaiki) trochę powyżej środka - twarze są zwykle w górnej części zdjęcia. */
.image-item img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; transition: transform 0.4s var(--ease), opacity 0.3s; }
@media (hover: hover) { .image-link:hover img { transform: scale(1.03); opacity: 0.92; } }

/* Mozaika - zapasowy układ bez JS: wiersze we flexie, flex-basis i flex-grow proporcjonalne do --ar
   (równa wysokość kafelków w wierszu), pseudo-element zabiera wolne miejsce w ostatnim wierszu. */
:root:not([data-gallery-view='grid']) .image-grid:not(.is-ready) { display: flex; flex-wrap: wrap; gap: var(--gap); }
:root:not([data-gallery-view='grid']) .image-grid:not(.is-ready)::after { content: ''; flex-grow: 1000000; }
:root:not([data-gallery-view='grid']) .image-grid:not(.is-ready) > .image-item {
    flex: calc(var(--ar) * 1000) 1 calc(var(--ar) * var(--row-height));
    aspect-ratio: var(--ar); max-height: calc(var(--row-height) * 1.6);
}
/* Z JS mozaika jest niewidoczna do pierwszego ułożenia (bez przeskoku); awaryjnie pokazuje się po 3 s. */
.js[data-gallery-view='mosaic'] .image-grid:not(.is-ready) { opacity: 0; animation: grid-fallback 0s 3s forwards; }
@keyframes grid-fallback { to { opacity: 1; } }
/* Mozaika ułożona przez gallery-view.js: pozycje i wymiary kafelków w stylu inline. */
[data-gallery-view='mosaic'] .image-grid.is-ready { position: relative; }
[data-gallery-view='mosaic'] .image-grid.is-ready > .image-item { position: absolute; }

/* Siatka - równe kwadraty. */
[data-gallery-view='grid'] .image-grid { display: grid; grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr)); gap: var(--gap); }
[data-gallery-view='grid'] .image-item { aspect-ratio: 1; }

/* ---------- Tryb wyboru zdjęć (galeria klienta, assets/js/selection.js) ---------- */
.icon { flex: none; width: 20px; height: 20px; }
.btn .icon { width: 18px; height: 18px; }
.selection-intro {
    max-width: 760px; margin: 0 auto 0.5rem; padding: 1.25rem 1.5rem;
    border: 1px solid var(--color-border); border-left: 3px solid var(--color-star); border-radius: var(--radius);
    background: #fffaf0; text-align: center;
}
.selection-eyebrow {
    display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin-bottom: 0.4rem;
    font-size: 0.85rem; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--color-brand);
}
.selection-eyebrow .icon { color: var(--color-star); fill: currentColor; }
.selection-intro p { color: #333; }
.selection-leave { margin-top: 0.5rem; }
.link-button { padding: 0.25rem; border: 0; background: none; font-size: 0.9rem; color: var(--color-text-muted); text-decoration: underline; cursor: pointer; }
.link-button:hover { color: var(--color-black); }

/* Gwiazdka na kafelku - zawsze widoczna (dotyk), wypełniona po wybraniu. */
.select-toggle {
    position: absolute; top: 6px; right: 6px; z-index: 1;
    display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
    border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.45); color: var(--color-white);
    cursor: pointer; touch-action: manipulation; transition: background-color 0.2s, transform 0.2s var(--ease), color 0.2s;
}
.select-toggle .icon { width: 22px; height: 22px; }
.select-toggle:hover { background: rgba(0, 0, 0, 0.65); transform: scale(1.08); }
.select-toggle[aria-pressed='true'] { background: var(--color-white); color: var(--color-star); }
.select-toggle[aria-pressed='true'] .icon { fill: currentColor; }
.select-toggle:disabled { cursor: default; transform: none; }
.is-selection-locked .select-toggle[aria-pressed='false'] { display: none; }
.image-item.is-selected::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    border: 3px solid var(--color-star); border-radius: inherit;
}
/* Ostatnio oglądane w lightboxie - krótkie podświetlenie po zamknięciu (czas = HIGHLIGHT_MS w lightbox.js) */
.image-item.is-last-viewed::before {
    content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit;
    box-shadow: inset 0 0 0 3px var(--color-brand); background: rgba(255, 255, 255, 0.18);
    animation: last-viewed 1.8s var(--ease) forwards;
}
@keyframes last-viewed { 0% { opacity: 0; } 12%, 65% { opacity: 1; } 100% { opacity: 0; } }

.has-selection-bar { padding-bottom: 5rem; }
.selection-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    background: var(--color-white); border-top: 1px solid var(--color-border); box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    padding-bottom: env(safe-area-inset-bottom);
}
.selection-bar-inner { display: flex; align-items: center; gap: 1rem; min-height: 68px; padding-top: 8px; padding-bottom: 8px; }
.selection-count { display: flex; align-items: center; gap: 0.5rem; margin-right: auto; font-size: 1.05rem; white-space: nowrap; }
.selection-count .icon { width: 24px; height: 24px; color: var(--color-star); fill: currentColor; }
.selection-count strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.selection-bar.is-full .selection-count { color: var(--color-brand); }
.selection-filter { display: inline-flex; border: 1px solid var(--color-border); border-radius: 2px; overflow: hidden; }
.selection-filter button { min-height: 44px; padding: 0 1rem; border: 0; background: var(--color-white); cursor: pointer; font-size: 0.95rem; }
.selection-filter button + button { border-left: 1px solid var(--color-border); }
.selection-filter button[aria-pressed='true'] { background: var(--color-black); color: var(--color-white); }
.selection-submit { padding: 10px 24px; }
.selection-submit[hidden], .selection-done[hidden] { display: none; }
.selection-done { font-weight: 600; color: var(--color-brand); }
@media (max-width: 600px) {
    .selection-bar-inner { flex-wrap: wrap; gap: 0.5rem 0.75rem; }
    .selection-count { font-size: 0.95rem; }
    .selection-filter button { padding: 0 0.75rem; min-height: 40px; font-size: 0.9rem; }
    .selection-submit { flex: 1 1 100%; min-height: 44px; }
    .has-selection-bar { padding-bottom: 8rem; }
    .select-toggle { top: 4px; right: 4px; width: 36px; height: 36px; }
    .select-toggle .icon { width: 20px; height: 20px; }
}

.to-top {
    position: fixed; right: 16px; bottom: calc(16px + var(--bar-height, env(safe-area-inset-bottom))); z-index: 800;
    display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
    border: 1px solid var(--color-border); border-radius: 50%; background: rgba(255, 255, 255, 0.85); color: var(--color-text-muted);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); cursor: pointer;
    opacity: 0; visibility: hidden; transform: translateY(8px);
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition), color var(--transition);
}
.to-top.is-visible { opacity: 0.7; visibility: visible; transform: none; }
.to-top.is-visible:hover, .to-top:focus-visible { opacity: 1; color: var(--color-black); }
.to-top .icon { width: 20px; height: 20px; }
@media (min-width: 769px) { .to-top { right: 24px; bottom: calc(24px + var(--bar-height, 0px)); } }

.selection-toast {
    position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 3000; transform: translateX(-50%);
    width: max-content; max-width: calc(100% - 32px); padding: 0.75rem 1.25rem; border-radius: var(--radius);
    background: var(--color-black); color: var(--color-white); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    font-size: 0.95rem; text-align: center; animation: lightbox-in 0.2s ease;
}
.selection-toast.is-error { background: #b71c1c; }
.lightbox .selection-toast { bottom: calc(24px + env(safe-area-inset-bottom)); }

.confirm-dialog {
    width: min(92vw, 460px); margin: auto; padding: 2rem; border: 0; border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.confirm-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.confirm-dialog h2 { font-size: 1.35rem; font-weight: 500; margin-bottom: 0.75rem; }
.confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; }
.confirm-actions .btn { padding: 10px 20px; }

/* ---------- Formularz hasła ---------- */
.password-form { display: grid; gap: 1rem; max-width: 420px; margin: 1rem auto 2rem; padding: 2rem; background: var(--color-gray); }
.form-eyebrow { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--color-brand); }
.form-eyebrow .icon { width: 18px; height: 18px; }
.form-note { font-size: 0.9rem; font-weight: 600; color: var(--color-brand); }
.form-title { white-space: pre-line; font-size: 1.6rem; font-weight: 400; line-height: 1.3; overflow-wrap: anywhere; }
.form-error { padding: 0.75rem 1rem; border-left: 3px solid #c62828; background: #fdecea; color: #b71c1c; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-group input {
    width: 100%; min-height: 48px; padding: 12px;
    border: 1px solid var(--color-border); border-radius: 2px; background: var(--color-white);
    font: inherit; font-size: 1rem;
}
.form-group input:focus { outline: none; border-color: var(--color-black); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1); }

/* ---------- Kontakt ---------- */
.contact { text-align: center; }
.contact-list { display: grid; gap: 0.25rem; margin-bottom: 1.5rem; }
.contact-list dt { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: var(--color-text-muted); margin-top: 1rem; }
.contact-list dd { font-size: 1.25rem; }
.contact-list a { text-decoration: none; overflow-wrap: anywhere; }
.contact-list a:hover { text-decoration: underline; }
.contact .social-links { justify-content: center; color: var(--color-brand); }

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
    margin: 0; padding: 0; border: 0;
    /* --dismiss (0…1) ustawia lightbox.js przy ściąganiu zdjęcia w dół - tło i przyciski bledną. */
    background: rgba(0, 0, 0, calc(0.96 * (1 - var(--dismiss, 0)))); color: var(--color-white);
    overscroll-behavior: contain;
    /* Szybkie klikanie strzałek (dwuklik) nie zaznacza tekstu; bez szarego błysku stuknięcia na dotyku. */
    user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.lightbox::backdrop { background: rgba(0, 0, 0, calc(0.96 * (1 - var(--dismiss, 0)))); }
.lightbox-toolbar, .lightbox-nav { opacity: calc(1 - var(--dismiss, 0)); }
.lightbox.dismiss-animating,
.lightbox.dismiss-animating::backdrop { transition: background-color 0.2s ease-out; }
.lightbox.dismiss-animating :is(.lightbox-toolbar, .lightbox-nav) { transition: opacity 0.2s ease-out; }
/* Kopia zdjęcia i tła odjeżdżająca po zamknięciu gestem w dół (lightbox.js: dismiss) - dialog jest już zamknięty, strona przyjmuje dotyk. */
.lightbox-ghost { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.lightbox-ghost img { position: absolute; max-width: none; object-fit: contain; transform-origin: 50% 50%; }
.lightbox[open] { display: block; animation: lightbox-in 0.25s ease; }
@keyframes lightbox-in { from { opacity: 0; } }
.lightbox-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.lightbox-track { display: flex; height: 100%; will-change: transform; }
.lightbox-track.animating { transition: transform 0.25s var(--ease); }
.lightbox-slide {
    position: relative; flex: 0 0 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    padding: 64px 16px 16px;
}
.lightbox-slide img {
    max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
    transform-origin: 0 0; pointer-events: none; -webkit-user-drag: none;
}
.lightbox-slide img:not([src]) { visibility: hidden; } /* slajd czeka na miniaturę */
.lightbox-slide .lightbox-placeholder { position: absolute; filter: blur(8px); opacity: 0.6; }
.lightbox.zoomed .lightbox-stage { cursor: grab; }
.lightbox.zoomed .lightbox-stage:active { cursor: grabbing; }

.lightbox-btn {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border: 0; border-radius: 50%;
    background: rgba(0, 0, 0, 0.55); color: var(--color-white);
    font-size: 1rem; font-weight: 600; line-height: 1; text-decoration: none; cursor: pointer;
    transition: background-color var(--transition), transform var(--transition), color var(--transition);
    touch-action: manipulation;
}
.lightbox-btn:hover { background: rgba(255, 255, 255, 0.18); }
.lightbox-btn:disabled, .lightbox-btn[aria-disabled='true'] { opacity: 0.4; cursor: progress; }
.lightbox-btn svg { width: 20px; height: 20px; fill: currentColor; }
.lightbox-btn[hidden] { display: none; }
.lightbox-hq.loaded { color: #7CFC00; }
.lightbox-btn .icon { width: 24px; height: 24px; fill: none; }
.lightbox-select[aria-pressed='true'] { color: var(--color-star); }
.lightbox-select[aria-pressed='true'] .icon { fill: currentColor; }
.lightbox-select:disabled { opacity: 1; cursor: default; }
.lightbox-close { font-size: 2rem; font-weight: 300; }

.lightbox-toolbar {
    position: absolute; top: 0; left: 0; right: 0; z-index: 2;
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
}
.lightbox-counter { margin-right: auto; padding: 0 8px; font-size: 0.95rem; font-variant-numeric: tabular-nums; opacity: 0.9; }
.lightbox-nav { position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); }
.lightbox-nav .icon { width: 26px; height: 26px; stroke-width: 2; }
.lightbox-nav:hover { transform: translateY(-50%) scale(1.08); }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-nav[hidden] { display: none; }

@media (max-width: 768px) {
    .lightbox-slide { padding: 56px 0; } /* tyle samo u góry (pasek przycisków) i u dołu - zdjęcie dokładnie na środku ekranu */
    .lightbox-btn { width: 44px; height: 44px; }
    /* Na dotyku nawigacja gestem - strzałki tylko przeszkadzają w oglądaniu. */
    @media (hover: none) { .lightbox-nav { display: none; } }
}
/* Tablety (dotyk) szersze niż 768 px: też równy odstęp góra/dół, żeby zdjęcie było na środku ekranu. */
@media (pointer: coarse) and (min-width: 769px) { .lightbox-slide { padding-bottom: 64px; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
    .image-item.is-last-viewed::before { animation: none !important; } /* statyczne podświetlenie, zdejmowane przez JS */
}
