
/* PAGE BANNER */

.charter-banner {
    position: relative;
    width: 100%;
    height: 420px;
    overflow: hidden;

    display: flex;
    align-items: center;
    justify-content: center;

    text-align: center;
}

.charter-banner-bg {
    position: absolute;
    inset: 0;

    background:
        linear-gradient(
            rgba(0, 0, 0, 0.25),
            rgba(0, 0, 0, 0.35)
        ),
        url("../images/1.png");

    background-size: cover;
    background-position: center;

    animation: bannerZoom 12s ease-in-out infinite alternate;
}

@keyframes bannerZoom {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.08);
    }
}

.charter-banner-content {
    position: relative;
    z-index: 2;
}

.banner-title {
    font-family: 'Noto Sans Sinhala', sans-serif;
    font-size: clamp(32px, 5vw, 65px);
    font-weight: 700;
    color: #ffffff;
    line-height: 1.5;

    animation: titleEntrance 1.2s ease both;
}

@keyframes titleEntrance {
    from {
        opacity: 0;
        transform: translateY(45px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* BREADCRUMB */

.charter-breadcrumb {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;

    z-index: 2;

    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;

    font-family: 'Noto Sans Sinhala', sans-serif;
    font-size: 15px;

    animation: fadeUp 1.5s ease both;
}

.charter-breadcrumb a {
    color: #ffffff;
    text-decoration: none;
}

.charter-breadcrumb span {
    color: #dfa66e;
}

.charter-breadcrumb i {
    color: white;
    font-size: 12px;
}

/*  DOCUMENT SECTION */

.charter-document-section {
    width: 100%;
    padding: 10px 3% 25px;
    background: #ffffff;
}

.charter-container {
    width: 100%;
    max-width: 1300px;
    margin: auto;
}

.flipbook-wrapper {
    width: 100%;
    background: #808080;
    padding: 20px 25px 12px;
    position: relative;
    overflow: hidden;
}

/* BOOK STAGE */

.flipbook-stage {
    position: relative;
    width: 100%;
    min-height: 540px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.flipbook-viewport {
    position: relative;
    width: 100%;
    min-height: 520px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: auto;
}

#flipbook {
    margin: auto;
    transform-origin: center center;
    transition: transform 0.35s ease;
}

/* PDF PAGES */

.pdf-page {
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.18);
}

.pdf-page canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.stf__parent {
    margin: 0 auto;
}

.stf__block {
    margin: auto;
}

/* PAGE NAVIGATION ARROWS */

.flip-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);

    z-index: 20;

    width: 48px;
    height: 58px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    background: transparent;
    color: white;

    font-size: 34px;
    cursor: pointer;

    transition: all 0.3s ease;
}

.flip-arrow:hover {
    color: #dfa66e;
    transform: translateY(-50%) scale(1.15);
}

.flip-prev {
    left: 0;
}

.flip-next {
    right: 0;
}

.flip-arrow:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

/* FLOATING TOOLBAR */

.flipbook-toolbar {
    position: relative;
    z-index: 25;

    width: max-content;
    max-width: 100%;
    min-height: 44px;

    margin: 10px auto 0;
    padding: 5px 12px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    background: #ffffff;
    border-radius: 5px;

    box-shadow: 0 3px 12px rgba(0,0,0,0.2);

    animation: toolbarEntrance 0.8s ease both;
}

@keyframes toolbarEntrance {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#pageCounter {
    color: #999;
    font-size: 12px;
    min-width: 45px;
}

.flipbook-toolbar button,
.flipbook-toolbar a {
    width: 30px;
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: transparent;
    border: none;
    text-decoration: none;

    color: #7c8b9a;
    font-size: 16px;
    cursor: pointer;

    transition: all 0.25s ease;
}

.flipbook-toolbar button:hover,
.flipbook-toolbar a:hover {
    color: #dfa66e;
    transform: translateY(-2px);
}

/* THUMBNAILS */

.thumbnail-panel {
    margin-top: 15px;
    padding: 15px;

    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;

    max-height: 260px;
    overflow-y: auto;

    background: rgba(0,0,0,0.2);
}

.thumbnail-panel[hidden] {
    display: none;
}

.thumbnail-item {
    padding: 5px;
    background: white;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.25s ease;
}

.thumbnail-item:hover {
    transform: translateY(-5px);
    border-color: #dfa66e;
}

.thumbnail-item.active {
    border-color: #dfa66e;
}

.thumbnail-item img {
    display: block;
    width: 75px;
    height: auto;
}

.thumbnail-item span {
    display: block;
    text-align: center;
    font-size: 11px;
    margin-top: 4px;
}

/* STATUS */

.book-status {
    text-align: center;
    color: white;
    font-size: 13px;
    padding: 10px;
}

.book-status:empty {
    display: none;
}

/* SCROLL ANIMATIONS */

.reveal {
    opacity: 0;
    transform: translateY(45px);
    transition:
        opacity 0.9s ease,
        transform 0.9s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(25px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* CONTACT ANIMATION */

.community-content h2 {
    animation: fadeUp 1s ease both;
}

.contact-btn {
    transition:
        background 0.3s ease,
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.contact-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* BACK TO TOP */

#backToTop {
    position: fixed;
    right: 35px;
    bottom: 35px;
    z-index: 100;

    width: 50px;
    height: 50px;

    border: none;
    background: #202636;
    color: #ffffff;

    cursor: pointer;
    transition: all 0.3s ease;
}

#backToTop:hover {
    background: #dfa66e;
    transform: translateY(-5px);
}

/* FULLSCREEN */

.flipbook-wrapper:fullscreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    background: #808080;
    overflow: auto;
}

/*  RESPONSIVE */

@media (max-width: 768px) {

    .charter-banner {
        height: 300px;
    }

    .banner-title {
        font-size: 34px;
    }

    .charter-document-section {
        padding: 10px 5px 20px;
    }

    .flipbook-wrapper {
        padding: 15px 5px;
    }

    .flipbook-stage {
        min-height: 380px;
    }

    .flipbook-viewport {
        min-height: 360px;
    }

    .flip-arrow {
        width: 30px;
        font-size: 24px;
    }

    .flipbook-toolbar {
        gap: 4px;
        padding: 5px;
    }

    .flipbook-toolbar button,
    .flipbook-toolbar a {
        width: 28px;
        font-size: 14px;
    }

    #backToTop {
        right: 15px;
        bottom: 15px;
        width: 42px;
        height: 42px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* PDF DOCUMENTS */

.document-block {
    width: 100%;
    margin-bottom: 45px;
}

.document-block .flipbook {
    margin: auto;
    transform-origin: center center;
    transition: transform 0.35s ease;
}

.document-block .flipbook-wrapper {
    background: #808080;
    padding: 20px 25px 12px;
}

.document-block .flipbook-stage {
    min-height: 540px;
}

.document-block .flipbook-viewport {
    overflow: auto;
}

.document-block .pdf-page {
    background: #ffffff;
    overflow: hidden;
}

.document-block .pdf-page img {
    display: block;
    width: 100%;
    height: 100%;
}

.document-block .flipbook-toolbar {
    margin: 10px auto 0;
}

.document-block .thumbnail-panel[hidden] {
    display: none;
}

@media (max-width: 768px) {
    .document-block .flipbook-wrapper {
        padding: 15px 5px;
    }

    .document-block .flipbook-stage {
        min-height: 380px;
    }
}

/* REMOVE BLACK RECTANGLE BORDER */

.flipbook-wrapper,
.flipbook-stage,
.flipbook-viewport,
.flipbook,
#flipbook,
.pdf-page,
.document-block,
.document-block .flipbook-wrapper,
.document-block .pdf-page,
.stf__parent,
.stf__block,
.stf__item,
.stf__page {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Remove border from PDF page images */
.pdf-page img,
.pdf-page canvas,
.document-block .pdf-page img {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Remove pseudo-element borders */
.pdf-page::before,
.pdf-page::after {
    border: none !important;
    box-shadow: none !important;
}
/* CENTER PDF BOOK INSIDE GREY RECTANGLE */

/* Grey rectangle */
.document-block .flipbook-wrapper {
    width: 100%;
    background: #808080;
    padding: 25px 60px 20px;
    box-sizing: border-box;
    overflow: hidden;
}

/* Center book stage */
.document-block .flipbook-stage {
    position: relative;
    width: 100%;
    min-height: 600px;

    display: flex;
    justify-content: center;
    align-items: center;
}

/* Center viewport */
.document-block .flipbook-viewport {
    position: relative;
    position: relative;
    width: 100%;
    min-height: 580px;

    display: flex;
    justify-content: center;
    align-items: center;

    margin: 0 auto;
    padding: 0;

    overflow: auto;
}

.document-block .flipbook-viewport {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.document-block .flipbook-viewport::-webkit-scrollbar {
    display: none;
}

/* Center flipbook */
.document-block .flipbook {
    position: relative;
    display: block;

    margin-left: auto !important;
    margin-right: auto !important;

    flex-shrink: 0;
    transform-origin: center center;
}

/* Center PageFlip library container */
.document-block .stf__parent {
    position: relative !important;

    margin-left: auto !important;
    margin-right: auto !important;

    left: auto !important;
    right: auto !important;

    max-width: 100%;
}

/* Remove unwanted alignment */
.document-block .stf__block {
    margin: 0 auto;
}

/* Keep PDF page clean */
.document-block .pdf-page {
    background: #ffffff;
    border: none !important;
    outline: none !important;
}

/* Navigation arrows */
.document-block .flip-prev {
    left: 5px;
}

.document-block .flip-next {
    right: 5px;
}

/* Center toolbar */
.document-block .flipbook-toolbar {
    width: max-content;
    max-width: 100%;
    margin: 15px auto 0;
}

/* Mobile */
@media (max-width: 768px) {

    .document-block .flipbook-wrapper {
        padding: 15px 35px;
    }

    .document-block .flipbook-stage {
        min-height: 400px;
    }

    .document-block .flipbook-viewport {
        min-height: 400px;
    }

    .document-block .flip-prev {
        left: 0;
    }

    .document-block .flip-next {
        right: 0;
    }
}
