/* ===========================
   Flipbook 18+ — style.css
   Desktop: 100vh, single/double
   Mobile (≤768px): tylko single, toolbar pod gazetką
   Proporcja strony: 1200×1705
   =========================== */

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

html,
body {
    height: 100%;
    width: 100%;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
    background: #f3f3f3;
    color: #1c1b1a;
    overflow-y: hidden;
    /* brak pionowego scrolla */
    overflow-x: auto;
    /* desktop: pozwól na poziomy scroll przy rozkładzie 2× */
}

/* ===== 18+ Overlay ===== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal {
    background: #fff;
    padding: 32px 28px;
    border-radius: 12px;
    width: 92%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}

.modal h2 {
    margin-bottom: 8px;
}

.modal p {
    margin-bottom: 20px;
    color: #333;
}

.modal .buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal button {
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s;
}

#age-yes {
    background: #1c1b1a;
    color: #FAc081;
}

#age-yes:hover {
    background: #7a5c3b;
    color: #fff;
}

#age-no {
    background: #d0d0d0;
    color: #000;
}

#age-no:hover {
    background: #a6a6a6;
    color: #fff;
}

/* ===== Flipbook container (GRID) =====
   Desktop: toolbar overlay (fixed), rzędy tylko dla spreadu
   Mobile: toolbar pod spodem (grid-rows: spread, toolbar)
*/
#flipbook-container {
    height: 100vh;
    width: 100%;
    display: grid;
    grid-template-rows: 1fr;
    /* desktop: tylko obszar stron */
    grid-template-areas:
        "spread";
    place-items: center;
}

/* ===== Toolbar =====
   Desktop: overlay (fixed u góry).
   Mobile: zwykły blok POD gazetką.
*/
.toolbar {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    align-items: center;
    z-index: 10;
    background: rgba(255, 255, 255, .85);
    padding: 6px 10px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
    backdrop-filter: blur(6px);
}

.toolbar button {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s;
    background: #1c1b1a;
    color: #FAc081;
}

.toolbar button:hover {
    background: #7a5c3b;
    color: #fff;
}

#spread-info {
    font-weight: 600;
}

/* ===== Obszar stron =====
   Desktop:
   - height: 100vh
   - single: aspect-ratio 1200/1705
   - double: aspect-ratio 2400/1705 (2× szerokość pojedynczej)
*/
#spread {
    grid-area: spread;
    height: 100vh;
    aspect-ratio: 1200 / 1705;
    /* pojedyncza strona domyślnie */
    background: #eaeaea;
    border-radius: 10px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: aspect-ratio .2s ease, transform .3s ease;
}

#spread.double {
    aspect-ratio: 2400 / 1705;
}

/* podwójny rozkład */

#spread.single #left-page {
    display: none;
}

#spread.single #right-page {
    display: block;
}

#spread.double #left-page {
    display: block;
}

#spread.double #right-page {
    display: block;
}

#spread img {
    height: 100%;
    width: auto;
    object-fit: contain;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
    user-select: none;
    -webkit-user-drag: none;
    transition: transform .3s ease, opacity .25s ease;
}

#spread.animating img {
    transform: scale(.985);
}

/* ===== Mobile (≤768px) =====
   - tylko pojedyncza strona (single)
   - toolbar POD gazetką (statyczny, nie fixed)
   - wyłącz poziomy scroll (bo nie ma rozkładu 2×)
*/
@media (max-width: 768px) {

    html,
    body {
        overflow-x: hidden;
    }

    /* brak poziomego scrolla na tel. */


    #flipbook-container {
        height: auto;
        width: 100%;
        grid-template-rows: 1fr auto;
        /* najpierw spread, potem toolbar */
        grid-template-areas:
            "spread"
            "toolbar";
        align-content: center;
    }

    .toolbar {
        position: static;
        transform: none;
        grid-area: toolbar;
        margin: 8px 0 12px 0;
        background: rgba(255, 255, 255, 1);
    }

    .toolbar button {
        padding: 7px 12px;
        font-size: 14px;
    }

    /* Na telefonie wymuś pojedynczy aspekt i brak double */
    #spread,
    #spread.single {
        aspect-ratio: 1200 / 1705;
    }

    #spread.double {
        aspect-ratio: 1200 / 1705;
    }

    /* nawet jeśli JS doda .double, wygląd pozostaje single */
}