/*
 * E-booki: przeglądarka z kartkowaniem (ebook-viewer.js) i kafelek zajawki na stronie głównej.
 * Kolory: niebieski serwisu #2781bf / #1b619f, beż i brąz z okładki "Teatr w Pułtusku".
 */

/* --- StPageFlip 2.0.7 (MIT, (c) 2020 Nodlik) - bazowe style biblioteki ------------------------- */
.stf__parent { position: relative; display: block; box-sizing: border-box; transform: translateZ(0); -ms-touch-action: pan-y; touch-action: pan-y; }
.sft__wrapper { position: relative; width: 100%; box-sizing: border-box; }
.stf__parent canvas { position: absolute; width: 100%; height: 100%; left: 0; top: 0; }
.stf__block { position: absolute; width: 100%; height: 100%; box-sizing: border-box; perspective: 2000px; }
.stf__item { display: none; position: absolute; transform-style: preserve-3d; }
.stf__outerShadow, .stf__innerShadow, .stf__hardShadow, .stf__hardInnerShadow { position: absolute; left: 0; top: 0; }

/* --- Strona e-booka ------------------------------------------------------------------------------ */
.ebook {
    --ebook-blue: #2781bf;
    --ebook-blue-dark: #1b619f;
    --ebook-beige: #efe6d6;
    --ebook-brown: #4a3426;
    padding: 24px 0 8px;
    font-family: Arial, Helvetica, sans-serif;
}
.ebook__header { margin-bottom: 16px; }
.ebook__kicker {
    display: inline-block;
    margin: 0 0 8px;
    padding: 3px 10px;
    background: var(--ebook-brown);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.ebook__title { margin: 0 0 6px; color: var(--ebook-blue-dark); font-size: 34px; font-weight: 500; line-height: 1.15; }
.ebook__subtitle { margin: 0; color: #555; font-size: 16px; line-height: 1.45; max-width: 780px; }

.ebook__viewer {
    position: relative;
    background: var(--ebook-beige);
    background-image: radial-gradient(ellipse at center, #f7f1e6 0%, var(--ebook-beige) 70%);
    border: 1px solid #e0d4bf;
}
.ebook__stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 56px;
    min-height: 320px;
}
.ebook__bookwrap { width: 100%; margin: 0 auto; }
.ebook__book { width: 100%; }
.ebook__book.stf__parent { box-shadow: 0 18px 40px -18px rgba(74, 52, 38, .55); }

.ebook__page { background: #fbf8f2; overflow: hidden; }
.ebook__page img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity .25s ease;
    -webkit-user-drag: none;
    user-select: none;
}
.ebook__page img.is-loaded { opacity: 1; }
.ebook__page::before {
    /* wskaźnik ładowania pod obrazkiem strony */
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 3px solid rgba(74, 52, 38, .2);
    border-top-color: var(--ebook-brown);
    border-radius: 50%;
    animation: ebook-spin .9s linear infinite;
}
.ebook__page.is-loaded::before { display: none; }
@keyframes ebook-spin { to { transform: rotate(360deg); } }

.ebook__nav {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 44px;
    height: 72px;
    margin-top: -36px;
    border: 0;
    background: rgba(255, 255, 255, .85);
    color: var(--ebook-brown);
    font-size: 26px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.ebook__nav:hover, .ebook__nav:focus { background: var(--ebook-blue); color: #fff; }
.ebook__nav[disabled] { opacity: .3; cursor: default; background: rgba(255, 255, 255, .6); color: var(--ebook-brown); }
.ebook__nav--prev { left: 6px; }
.ebook__nav--next { right: 6px; }

.ebook__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #e0d4bf;
}
.ebook__group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ebook__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d5dde5;
    background: #fff;
    color: var(--ebook-blue-dark);
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    justify-content: center;
}
.ebook__btn:hover, .ebook__btn:focus { background: var(--ebook-blue); border-color: var(--ebook-blue); color: #fff; text-decoration: none; }
.ebook__btn[disabled] { opacity: .4; cursor: default; background: #fff; color: var(--ebook-blue-dark); border-color: #d5dde5; }
.ebook__btn--primary { background: var(--ebook-blue); border-color: var(--ebook-blue); color: #fff; }
.ebook__btn--primary:hover, .ebook__btn--primary:focus { background: var(--ebook-blue-dark); border-color: var(--ebook-blue-dark); }
.ebook__btn .fa { font-size: 16px; }

.ebook__pageinfo { display: inline-flex; align-items: center; gap: 6px; margin: 0 6px; font-weight: normal; color: #444; }
.ebook__pageinfo input {
    width: 64px;
    height: 40px;
    padding: 0 6px;
    border: 1px solid #d5dde5;
    text-align: center;
    font-size: 15px;
    -moz-appearance: textfield;
}
.ebook__pageinfo input::-webkit-outer-spin-button,
.ebook__pageinfo input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ebook__spread { min-width: 64px; color: #777; font-size: 13px; }

.ebook__error { padding: 40px 20px; text-align: center; color: var(--ebook-brown); font-size: 16px; }

/* Pełny ekran */
.ebook__viewer:fullscreen { display: flex; flex-direction: column; width: 100%; height: 100%; border: 0; background: #2d241e; }
.ebook__viewer:-webkit-full-screen { display: flex; flex-direction: column; width: 100%; height: 100%; border: 0; background: #2d241e; }
.ebook__viewer:fullscreen .ebook__stage { flex: 1 1 auto; }
.ebook__viewer:-webkit-full-screen .ebook__stage { flex: 1 1 auto; }

/* Nakładki: miniatury i powiększenie */
.ebook__overlay {
    position: fixed;
    inset: 0;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    background: #231c17;
    color: #fff;
}
.ebook__overlay[hidden] { display: none; }
.ebook__overlay-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    background: #1d1713;
}
.ebook__overlay-title { margin: 0; font-size: 18px; font-weight: normal; color: #fff; }
.ebook__overlay .ebook__btn { background: transparent; border-color: rgba(255, 255, 255, .25); color: #fff; }
.ebook__overlay .ebook__btn:hover, .ebook__overlay .ebook__btn:focus { background: var(--ebook-blue); border-color: var(--ebook-blue); }
.ebook__overlay .ebook__btn[disabled] { background: transparent; color: #fff; }

.ebook__thumbs-grid {
    flex: 1 1 auto;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 14px;
    margin: 0;
    padding: 18px;
    list-style: none;
}
.ebook__thumb {
    display: block;
    width: 100%;
    padding: 0;
    border: 2px solid transparent;
    background: none;
    color: #ddd;
    font-size: 12px;
    text-align: center;
    cursor: pointer;
}
.ebook__thumb img { display: block; width: 100%; height: auto; aspect-ratio: 1400 / 1980; background: #4a3f37; }
.ebook__thumb span { display: block; padding: 4px 0 0; }
.ebook__thumb:hover, .ebook__thumb:focus { border-color: #fff; outline: none; }
.ebook__thumb.is-current { border-color: var(--ebook-blue); color: #fff; font-weight: bold; }

.ebook__zoom-scroll {
    flex: 1 1 auto;
    overflow: auto;
    padding: 16px;
    text-align: center;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
}
.ebook__zoom-scroll.is-dragging { cursor: grabbing; user-select: none; }
.ebook__zoom-img { display: inline-block; max-width: none; height: auto; background: #fbf8f2; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.ebook__zoom-level { min-width: 52px; text-align: center; font-size: 14px; color: #ddd; }

body.ebook-overlay-open { overflow: hidden; }

@media (max-width: 767px) {
    .ebook { padding-top: 14px; }
    .ebook__title { font-size: 26px; }
    .ebook__subtitle { font-size: 14px; }
    .ebook__stage { padding: 12px 8px; }
    .ebook__nav { width: 36px; height: 56px; margin-top: -28px; font-size: 20px; }
    .ebook__nav--prev { left: 0; }
    .ebook__nav--next { right: 0; }
    .ebook__btn-label { display: none; }
    .ebook__toolbar { justify-content: center; }
    .ebook__thumbs-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; padding: 12px; }
}

/* --- Opis publikacji pod przeglądarką ----------------------------------------------------------- */
.ebook-info { margin: 10px 0 30px; font-size: 15px; line-height: 1.6; }
.ebook-info h2 { color: #1b619f; font-size: 24px; margin: 10px 0 12px; }
.ebook-info__download {
    display: inline-block;
    margin-top: 6px;
    padding: 10px 18px;
    background: #2781bf;
    color: #fff;
    font-size: 15px;
}
.ebook-info__download:hover, .ebook-info__download:focus { background: #1b619f; color: #fff; text-decoration: none; }

/* --- Kafelek na stronie głównej ----------------------------------------------------------------- */
.ebook-teaser { margin: 16px 0 26px; }
.ebook-teaser__link {
    display: flex;
    gap: 16px;
    align-items: stretch;
    padding: 14px;
    background: #efe6d6;
    border-left: 5px solid #4a3426;
    color: #4a3426;
    text-decoration: none;
    transition: box-shadow .2s ease, transform .2s ease;
}
.ebook-teaser__link:hover, .ebook-teaser__link:focus {
    color: #4a3426;
    text-decoration: none;
    box-shadow: 0 10px 24px -12px rgba(74, 52, 38, .6);
    transform: translateY(-2px);
}
.ebook-teaser__cover {
    flex: 0 0 104px;
    width: 104px;
    height: auto;
    align-self: flex-start;
    box-shadow: 3px 4px 10px rgba(74, 52, 38, .35);
}
.ebook-teaser__body { display: flex; flex-direction: column; min-width: 0; }
.ebook-teaser__badge { font-size: 11px; font-weight: bold; letter-spacing: .08em; text-transform: uppercase; color: #8a6a4f; }
.ebook-teaser__title { margin: 2px 0 6px; font-size: 21px; font-weight: bold; line-height: 1.15; color: #4a3426; }
.ebook-teaser__text { font-size: 13px; line-height: 1.45; color: #5d4a3c; }
.ebook-teaser__btn {
    align-self: flex-start;
    margin-top: auto;
    padding: 7px 12px;
    background: #2781bf;
    color: #fff;
    font-size: 14px;
}
.ebook-teaser__link:hover .ebook-teaser__btn, .ebook-teaser__link:focus .ebook-teaser__btn { background: #1b619f; }
.ebook-teaser__text + .ebook-teaser__btn { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
    .ebook-teaser__link, .ebook__page img { transition: none; }
    .ebook-teaser__link:hover, .ebook-teaser__link:focus { transform: none; }
}
