:root {
    --bg-color: #111111;
    --text-color: #eee;
    --card-bg: #222;
    --accent: #d4af37;
    --radius: 8px;
}

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

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease;
}

/* Motywy */
body.theme-classic {
    --bg-color: #ffffff;
    --radius: 0px;
}

/* Ekran Powitalny */
.landing-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #111;
    color: white;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-in-out, visibility 0.8s;
}
.landing-screen.hidden {
    opacity: 0;
    visibility: hidden;
}
.landing-bg-layer {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    pointer-events: none;
}
.landing-bg-layer.active {
    opacity: 1;
}
.landing-background-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 17, 17, 0.75); /* przyciemnienie zdjęcia tła */
    z-index: 2;
    pointer-events: none;
}
.landing-content {
    text-align: center;
    animation: fadeIn 1.5s ease-out;
    position: relative;
    z-index: 10;
    max-height: 100vh;
    max-height: 100dvh; /* Dynamiczny viewport na iOS */
    padding: 20px 0;
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.landing-titles-group {
    /* Podnosimy tytuły lekko do góry tworząc miejsce na wideo */
    margin-bottom: 25px;
}
.landing-title {
    font-size: 3.5rem;
    font-family: 'Parisienne', cursive;
    color: #e2c290;
    margin: 0 0 5px 0;
    font-weight: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.landing-subtitle {
    font-size: 1.2rem;
    font-family: 'Montserrat', sans-serif;
    color: #c9a96e;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 0; /* Reset margins from titles group */
}
.landing-thankyou {
    font-size: 1.4rem;
    font-family: 'Cormorant Garamond', serif;
    color: #ffffff;
    opacity: 0.9;
    letter-spacing: 1px;
    line-height: 1.4;
    max-width: 80%;
    margin: 0 auto 30px auto;
}

/* --- WIDEO NA EKRANIE POWITALNYM --- */
.landing-video-container {
    display: none; /* Domyślnie ukryte, nadpisywane przez warianty na body */
    margin: 0 auto 30px auto;
    background: rgba(128, 128, 128, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(128, 128, 128, 0.2);
    border-radius: 15px;
    padding: 8px;
    box-sizing: border-box; /* Kluczowe dla równego obramowania */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: max-content; /* Shrink-wrap: idealnie opina wideo w środku */
    max-width: 90%;
}
.landing-video-container video {
    border-radius: 10px;
    display: block;
    object-fit: cover;
    background: #000;
}

/* Warianty sterowane przez tag body */
body.landing-variant-video-h .landing-thankyou,
body.landing-variant-video-v .landing-thankyou {
    display: none;
}
body.landing-variant-video-h .landing-video-container,
body.landing-variant-video-v .landing-video-container {
    display: block; /* Pokazujemy kontener jako blok */
}

/* Kształty nadawane na same wideo, a kontener się dopasowuje */
body.landing-variant-video-h .landing-video-container video {
    width: 600px;
    max-width: 100%;
    height: auto;
    max-height: 30vh;
    aspect-ratio: 16 / 9;
}
body.landing-variant-video-v .landing-video-container video {
    height: 30vh;
    max-height: 400px; /* Zabezpieczenie na PC */
    width: auto;
    max-width: 100%;
    aspect-ratio: 9 / 16;
}

/* --- DEV MENU DLA WIDEO --- */
.landing-dev-menu {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}
.dev-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s;
}
.dev-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}
.dev-menu-content {
    display: none;
    position: absolute;
    bottom: 50px;
    right: 0;
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px;
    width: max-content;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}
.landing-dev-menu.open .dev-menu-content {
    display: flex;
}
.dev-menu-item {
    background: transparent;
    border: none;
    color: #ccc;
    padding: 8px 15px;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.9rem;
}
.dev-menu-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.dev-menu-item.active {
    background: var(--accent);
    color: #000;
    font-weight: bold;
}

.landing-btn-container {
    background: rgba(128, 128, 128, 0.15); /* Półprzezroczyste tło wokół (Glassmorphism) */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(128, 128, 128, 0.2);
    border-radius: 25px;
    padding: 11px 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    display: inline-block;
    margin-top: 10px;
}
.enter-btn {
    background: #e2c290;
    color: #111111;
    border: none;
    padding: 18px 35px;
    font-size: 1.25rem;
    font-family: 'Cormorant Garamond', serif;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto;
    font-weight: 600;
}
.enter-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    filter: brightness(1.1);
}
.enter-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: #555;
    color: #bbb;
}
.loading-spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}
.enter-btn:not(:disabled) .loading-spinner {
    display: none;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* (Usunięto klasy theme-modern i theme-masonry, aby utrzymać spójną, luksusową kolorystykę niezależnie od wybranego układu widoku) */

.gallery-header {
    background: rgba(128, 128, 128, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
    color: var(--text-color);
    padding: 12px 2.5%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.gallery-header h1 {
    margin: 0;
    font-size: 2.2rem;
    font-family: 'Parisienne', cursive;
    color: var(--accent);
    font-weight: normal;
}
.header-date {
    margin: -8px 0 0 0;
    font-size: 0.9rem;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 2px;
    color: #ccc;
}

/* Nowy panel 4 przycisków */
.controls-panel {
    display: flex;
    gap: 2%;
    width: 100%;
    max-width: 800px;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    flex: 1;
    min-width: 0; /* ZABEZPIECZENIE PRZED UCINANIEM KRAWĘDZI NA IPHONE: pozwala elementom flex zmniejszać się poniżej szerokości zawartości */
}
.dropdown-btn {
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 4px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
.dropdown-btn:hover, .dropdown-btn.active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    background: var(--accent);
    filter: brightness(1.1);
}
.dropdown-content {
    position: absolute;
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
    min-width: 150px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1000;
    padding: 10px;
}
.dropdown.open .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
/* Skrajny lewy dropdown — wyrównaj do lewej krawędzi */
.controls-panel .dropdown:first-child .dropdown-content {
    left: 0;
    transform: translateX(0);
}
.controls-panel .dropdown:first-child.open .dropdown-content {
    transform: translateX(0) translateY(0);
}
/* Skrajny prawy dropdown — wyrównaj do prawej krawędzi */
.controls-panel .dropdown:last-child .dropdown-content {
    left: auto;
    right: 0;
    transform: translateX(0);
}
.controls-panel .dropdown:last-child.open .dropdown-content {
    transform: translateX(0) translateY(0);
}
.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: #ccc;
    padding: 8px 15px;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    font-family: inherit;
}
.dropdown-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.dropdown-item.active {
    background: var(--accent);
    color: #000;
    font-weight: bold;
}
.dropdown-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 5px 0;
}
.dropdown-group {
    display: flex;
    flex-direction: column;
}

/* Kontener główny galerii */
.gallery-container {
    padding: 2.5%;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 1.1rem;
}

/* System Siatki (Grid) */
.gallery-grid {
    display: grid;
    gap: 8px;
    width: 100%;
    opacity: 0;
    filter: blur(10px);
    transition: opacity 0.5s ease-in-out, filter 1s ease-in-out;
}
.gallery-grid.loaded {
    opacity: 1;
    filter: blur(0);
}

/* Rozmiary siatki kontrolowane przyciskami (1 = Lista/Bardzo Duże, 4 = Małe) */
.grid-size-1 { grid-template-columns: repeat(1, 1fr); }
.grid-size-2 { grid-template-columns: repeat(2, 1fr); }
.grid-size-3 { grid-template-columns: repeat(3, 1fr); }
.grid-size-4 { grid-template-columns: repeat(4, 1fr); }

@media (min-width: 768px) {
    .grid-size-1 { grid-template-columns: repeat(2, 1fr); }
    .grid-size-2 { grid-template-columns: repeat(4, 1fr); }
    .grid-size-3 { grid-template-columns: repeat(6, 1fr); }
    .grid-size-4 { grid-template-columns: repeat(8, 1fr); }
}

.gallery-item {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--radius);
    background: #444; /* Placeholder color */
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Kaskada JS (Masonry) specjalny motyw */
.gallery-grid.is-js-masonry {
    display: flex; /* Zmieniamy na Flexbox, JS utworzy nam fizyczne kolumny */
    gap: 10px;
}
.masonry-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.gallery-grid.is-js-masonry .gallery-item {
    aspect-ratio: auto; /* odblokowujemy naturalne proporcje */
    width: 100%;
}

/* Stylizacja obrazków */
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

body.theme-vertical .gallery-grid:not(.is-js-masonry) .gallery-item {
    aspect-ratio: 3 / 4;
    background: #000;
}

body.theme-vertical .gallery-grid:not(.is-js-masonry) .gallery-item img {
    object-fit: contain;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item:active img {
    transform: scale(0.95);
}

/* Nakładka Wideo */
.video-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    backdrop-filter: blur(2px);
}

.video-overlay::after {
    content: '';
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 18px solid white;
    margin-left: 6px;
}

/* Modal Wideo Odtwarzacz */
#video-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
#video-modal.hidden {
    display: none;
}
#video-player {
    max-width: 90%;
    max-height: 80%;
    border-radius: 8px;
    background: black;
}
.video-modal-controls {
    align-self: flex-end;
    margin-right: 5%;
    margin-bottom: 15px;
    display: flex;
    gap: 15px;
    z-index: 10000;
}
.video-modal-close, .video-modal-download {
    color: white;
    cursor: pointer;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
}
.video-modal-close {
    font-size: 30px;
}
.video-modal-close:active, .video-modal-download:active {
    background: rgba(255,255,255,0.3);
}
