:root {
    --gold-light: #FBF5B7;
    --gold-mid: #D4AF37;
    --gold-dark: #AA771C;
    --text-dark: #1A1A1A;
    --bg-box: rgba(255, 255, 255, 0.85);
}

/* Tryb wysokiego kontrastu - ELEGANCJA */
body.high-contrast {
    --gold-mid: #111111;
    --gold-dark: #FFD700;
    --gold-light: #444444;
    --text-dark: #FFD700;
    --bg-box: rgba(30, 30, 30, 0.85);
}

body.high-contrast .gold-background {
    background: linear-gradient(135deg, #050505, #1f1f1f, #0a0a0a, #2a2a2a, #000000);
    background-size: 400% 400%;
}

body.high-contrast {
    background-color: #050505;
}

body.high-contrast .content-box {
    border: 2px solid var(--gold-dark);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.05);
}

body.high-contrast .copyright,
body.high-contrast .landscape-copyright {
    color: var(--gold-dark);
    text-shadow: none;
}
body.high-contrast .skip-link,
body.high-contrast .subtle-btn {
    color: var(--gold-dark);
}
body.high-contrast .image-counter {
    color: var(--gold-dark);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-dark);
    overflow: hidden; 
    height: 100vh;
    height: 100dvh;
    background-color: var(--gold-mid);
    position: relative;
    overscroll-behavior: none; 
}

.gold-background {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #BF953F, #FCF6BA, #B38728, #FBF5B7, #AA771C);
    background-size: 400% 400%;
    animation: goldShimmer 12s ease infinite;
    z-index: -1;
}

@keyframes goldShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.contrast-toggle {
    position: fixed;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-dark);
    cursor: pointer;
    z-index: 500;
    opacity: 0.7;
    transition: opacity 0.3s, transform 0.3s;
}
.contrast-toggle:hover { opacity: 1; }
.contrast-toggle:active { transform: scale(0.9); }
body.high-contrast .contrast-toggle { color: var(--gold-dark); opacity: 1; }

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

.view {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; left: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 0;
}

.view.active {
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}
.view.hidden { display: none; }

.flex-view {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 4vh 20px;
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
    gap: 3vh; 
}

.flex-view header, 
.flex-view .content-box, 
.flex-view footer {
    flex-shrink: 0;
}

header { text-align: center; }
.logo-large { max-width: 250px; height: auto; display: block; margin: 0 auto; }
.logo-small { max-width: 150px; height: auto; display: block; margin: 0 auto; }
.logo-landscape { max-width: 140px; height: auto; display: block; }

.clickable-logo {
    cursor: pointer;
    transition: transform 0.3s;
}
.clickable-logo:active { transform: scale(0.95); }

.content-box {
    background: var(--bg-box);
    backdrop-filter: blur(5px);
    padding: 2.5rem 1.5rem;
    border-radius: 12px;
    border: 2px solid var(--gold-mid);
    text-align: center;
    max-width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    margin: 3vh 0; 
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--gold-dark);
}

p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.signature {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.gold-btn {
    background: linear-gradient(to right, #1A1A1A, #333);
    color: #FBF5B7;
    border: 1px solid var(--gold-mid);
    padding: 15px 30px;
    font-size: 1.1rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: transform 0.2s;
    /* NOWE: Wyrównanie dla ikon i tekstu przycisku */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.gold-btn:active { transform: scale(0.95); }

footer {
    text-align: center;
    width: 100%;
}
.copyright, .landscape-copyright {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gold-dark);
    opacity: 0.8;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5); 
    margin-top: 10px;
}

/* WIDOK ZDJĘCIA ODBLOKOWANY DLA SCROLLA */
#view-gallery {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2vh 10px;
    /* NOWE: Włączenie scrolla dla całej planszy w razie ciasnoty */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.gallery-main-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}
.frame-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    margin: 2vh 0;
}
.image-frame {
    position: relative;
    border: 4px solid var(--gold-light);
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    background: transparent;
    display: inline-block;
    line-height: 0;
    overflow: hidden;
    cursor: pointer;
}
#gallery-image {
    max-width: 100%;
    max-height: 60vh; 
    width: auto;
    height: auto;
    display: block;
    animation: fadeIn 0.4s ease;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-dark);
    font-size: 3rem;
    cursor: pointer;
    text-shadow: 0 0 10px var(--gold-light);
    padding: 10px 15px;
    border-radius: 5px;
    transition: opacity 0.3s, background 0.3s;
    z-index: 5;
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.4); }
body.high-contrast .nav-btn { color: var(--gold-dark); background: rgba(0,0,0,0.5); }
body.high-contrast .nav-btn:hover { background: rgba(0,0,0,0.8); }

#nav-prev { left: 5px; }
#nav-next { right: 5px; }

.zoom-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
@media (hover: hover) {
    .image-frame:hover .zoom-overlay { opacity: 1; }
}
.zoom-overlay.active-touch {
    opacity: 1;
}

.controls-area { text-align: center; }
.image-counter {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
}
#current-image-num, #landscape-current-num { color: var(--gold-dark); font-size: 1.3rem; }

.subtle-btn {
    background: none;
    border: 1px solid var(--gold-dark);
    color: var(--text-dark);
    padding: 8px 15px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
}
.subtle-btn:hover { background: var(--gold-dark); color: #fff; }
.subtle-btn:active { transform: scale(0.95); }

.skip-link {
    margin-top: 15px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gold-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.3s;
}
.skip-link:active { transform: scale(0.95); }

.gallery-footer .footer-text { text-align: center; text-transform: uppercase; color: var(--gold-dark); text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5); }
.footer-line-1 { display: block; font-size: 1rem; font-weight: 700; margin-bottom: 2px; }
.footer-line-2 { display: block; font-size: 0.7rem; font-weight: 600; letter-spacing: 2px; }

.invisible { visibility: hidden; pointer-events: none; }

.landscape-sidebar { display: none; }

.scrollable-view {
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    padding: 20px;
    align-items: center;
    justify-content: flex-start;
}
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 1200px;
    margin: 20px 0;
}
.grid-item {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border: 2px solid var(--gold-mid);
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s;
}
.grid-item:active { transform: scale(0.95); }
.grid-footer { margin-top: auto; padding-bottom: 20px; }

/* LIGHTBOX */
.lightbox-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; 
    height: 100vh;
    height: 100dvh; 
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s;
}
.lightbox-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
#lightbox-image {
    max-width: 85vw; 
    max-height: 85vh;
    max-height: 85dvh; 
    object-fit: contain;
    border: 2px solid var(--gold-dark);
    box-sizing: border-box; 
}
.lightbox-close {
    position: absolute;
    top: 20px; right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    z-index: 2001;
    text-shadow: 0 0 10px black;
}
.lightbox-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5); 
    border: none;
    color: white;
    font-size: 2.5rem; 
    cursor: pointer;
    text-shadow: 0 0 10px black;
    padding: 10px 15px;
    border-radius: 5px;
    transition: opacity 0.3s, background 0.3s;
    z-index: 2002; 
}
.lightbox-nav-btn:hover { background: rgba(0, 0, 0, 0.8); }

#lightbox-prev { left: 10px; }
#lightbox-next { right: 10px; }

.lightbox-nav-btn.hidden-btn {
    visibility: hidden;
    pointer-events: none;
}

@media (max-width: 768px) {
    .content-box { padding: 1.5rem 1rem; }
    h1 { font-size: 1.5rem; }
    .nav-btn { font-size: 2rem; padding: 5px; }
    #nav-prev { left: -10px; } 
    #nav-next { right: -10px; }
    .grid-container { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
    
    .lightbox-nav-btn { font-size: 2rem; padding: 5px 10px; }
    #lightbox-prev { left: 0px; }
    #lightbox-next { right: 0px; }
}

@media (max-height: 600px) and (orientation: landscape) {
    .portrait-only { display: none !important; }
    
    #view-gallery {
        flex-direction: row;
        align-items: flex-start; /* FIX: Odblokowuje scroll z samej góry */
        padding: 20px;
    }
    
    .gallery-main-area {
        width: 60%;
        margin: auto 20px; /* FIX: Pozwala obrazkowi rozpychać wysokość i włączyć scrolla */
    }
    
    #gallery-image { max-height: 85vh; }
    
    .landscape-sidebar {
        display: flex;
        flex-direction: column;
        justify-content: center;
        width: 20%;
        height: auto;
        min-height: 100%;
        margin: auto 0;
    }
    .landscape-left { align-items: flex-start; }
    .landscape-right { align-items: flex-end; text-align: right; justify-content: space-between; padding: 20px 0; }
    
    .landscape-text { margin: auto 0; }
    .landscape-text .footer-line-1 { font-size: 0.8rem; }
    .landscape-text .footer-line-2 { font-size: 0.55rem; }
    #btn-show-grid-landscape { font-size: 0.65rem; padding: 5px 10px; margin-bottom: 10px; }
    
    .content-box { padding: 1rem; }
    h1 { font-size: 1.2rem; margin-bottom: 0.5rem; }
    p { font-size: 0.85rem; margin-bottom: 0.5rem; }
    .gold-btn { padding: 8px 15px; font-size: 0.9rem; }

    .flex-view {
        display: block; 
        padding: 15px;
    }
    .flex-view header img {
        margin: 0 auto 15px auto; 
    }
    .flex-view .content-box {
        margin: 0 auto 20px auto; 
    }
    .flex-view footer {
        padding-bottom: 50px; 
    }

    #lightbox-image {
        max-width: 75vw; 
        max-height: 80vh; 
        max-height: 80dvh; 
    }
}
