/* =========================================================
   OGL RESOURCES PAGE
   ========================================================= */

:root {

    --purple: #6d4ea2;
    --purple-dark: #52367f;
    --purple-light: #8b6abd;
    --purple-soft: #eee8f6;

    --black: #171717;
    --dark: #222222;

    --white: #ffffff;
    --off-white: #f8f7f4;
    --soft-white: #f3f2ef;

    --grey: #6f6f6f;
    --light-grey: #dddddd;

    --border: rgba(109, 78, 162, 0.15);

    --shadow: 0 18px 50px rgba(32, 20, 50, 0.08);

    --container: 1180px;

    --transition: 0.35s ease;

}


/* =========================================================
   RESET
   ========================================================= */

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


html {
    scroll-behavior: smooth;
}


body {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: var(--black);
    background: var(--white);

    line-height: 1.6;

    overflow-x: hidden;
}


img {
    max-width: 100%;
    display: block;
}


button,
input {
    font: inherit;
}


button {
    cursor: pointer;
}


a {
    color: inherit;
    text-decoration: none;
}


.container {
    width: min(
        calc(100% - 80px),
        var(--container)
    );

    margin-inline: auto;
}


.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* =========================================================
   HEADER
   ========================================================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;

    background: rgba(255, 255, 255, 0.96);

    border-bottom: 1px solid rgba(0, 0, 0, 0.06);

    backdrop-filter: blur(14px);
}


.header-container {
    width: min(
        calc(100% - 80px),
        var(--container)
    );

    min-height: 82px;

    margin-inline: auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
}


.logo {
    width: 48px;
    height: 48px;

    display: grid;
    place-items: center;

    background: var(--purple);
    color: var(--white);

    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.05em;

    transition: var(--transition);
}


.logo:hover {
    background: var(--purple-dark);
    transform: translateY(-2px);
}


.desktop-nav {
    display: flex;
    align-items: center;
    gap: 30px;
}


.desktop-nav a {
    position: relative;

    color: var(--dark);

    font-size: 14px;
    font-weight: 500;

    padding: 8px 0;

    transition: var(--transition);
}


.desktop-nav a::after {
    content: "";

    position: absolute;

    left: 0;
    bottom: 0;

    width: 0;
    height: 2px;

    background: var(--purple);

    transition: var(--transition);
}


.desktop-nav a:hover,
.desktop-nav a.active {
    color: var(--purple);
}


.desktop-nav a:hover::after,
.desktop-nav a.active::after {
    width: 100%;
}


.menu-toggle {
    display: none;

    width: 44px;
    height: 44px;

    border: 0;
    background: transparent;

    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 5px;
}


.menu-toggle span {
    width: 23px;
    height: 2px;

    background: var(--black);

    transition: var(--transition);
}


.mobile-nav {
    display: none;
}


/* =========================================================
   HERO
   ========================================================= */

.resources-hero {
    position: relative;

    min-height: 560px;

    display: flex;
    align-items: center;

    overflow: hidden;

    background:
        linear-gradient(
            135deg,
            var(--off-white) 0%,
            var(--white) 55%,
            #f1ebf7 100%
        );
}


.hero-content {
    position: relative;
    z-index: 2;

    max-width: 850px;

    padding: 100px 0 110px;
}


.eyebrow {
    display: inline-block;

    margin-bottom: 22px;

    color: var(--purple);

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 0.18em;
}


.hero-content h1 {
    max-width: 820px;

    font-size: clamp(48px, 7vw, 88px);

    line-height: 0.98;

    letter-spacing: -0.055em;

    font-weight: 700;
}


.hero-content h1 span {
    display: block;

    color: var(--purple);
}


.hero-content p {
    max-width: 680px;

    margin-top: 34px;

    color: var(--grey);

    font-size: 18px;

    line-height: 1.75;
}


.hero-background-shape {
    position: absolute;

    border-radius: 50%;

    pointer-events: none;
}


.shape-one {
    width: 430px;
    height: 430px;

    right: -120px;
    top: -120px;

    background: rgba(109, 78, 162, 0.08);
}


.shape-two {
    width: 220px;
    height: 220px;

    right: 17%;
    bottom: -130px;

    border: 1px solid rgba(109, 78, 162, 0.2);
}


/* =========================================================
   INTRO
   ========================================================= */

.resources-intro {
    padding: 115px 0 95px;

    background: var(--white);
}


.intro-grid {
    display: grid;

    grid-template-columns: 0.9fr 1.1fr;

    gap: 100px;

    align-items: start;
}


.section-heading h2 {
    font-size: clamp(38px, 5vw, 62px);

    line-height: 1;

    letter-spacing: -0.045em;
}


.intro-text {
    max-width: 650px;

    padding-top: 15px;
}


.intro-text p {
    color: var(--grey);

    font-size: 18px;

    line-height: 1.8;
}


/* =========================================================
   RESOURCE LIBRARY
   ========================================================= */

.resource-library {
    padding: 90px 0 120px;

    background: var(--off-white);
}


.resource-tools {
    display: flex;

    justify-content: flex-end;

    margin-bottom: 28px;
}


.search-wrapper {
    position: relative;

    width: min(100%, 440px);
}


.search-wrapper input {
    width: 100%;

    height: 58px;

    padding: 0 48px;

    border: 1px solid var(--light-grey);

    border-radius: 0;

    outline: none;

    color: var(--black);

    background: var(--white);

    transition: var(--transition);
}


.search-wrapper input::placeholder {
    color: #999999;
}


.search-wrapper input:focus {
    border-color: var(--purple);

    box-shadow:
        0 0 0 3px rgba(109, 78, 162, 0.08);
}


.search-icon {
    position: absolute;

    left: 18px;
    top: 50%;

    transform: translateY(-50%);

    color: var(--purple);

    font-size: 24px;

    line-height: 1;
}


.clear-search {
    position: absolute;

    right: 14px;
    top: 50%;

    transform: translateY(-50%);

    width: 30px;
    height: 30px;

    border: 0;

    background: transparent;

    color: var(--grey);

    font-size: 22px;

    opacity: 0;

    pointer-events: none;

    transition: var(--transition);
}


.clear-search.visible {
    opacity: 1;
    pointer-events: auto;
}


.resource-filters {
    display: flex;

    align-items: center;

    gap: 10px;

    flex-wrap: wrap;

    margin-bottom: 40px;

    padding-bottom: 20px;

    border-bottom: 1px solid var(--border);
}


.filter-button {
    padding: 12px 22px;

    border: 1px solid transparent;

    background: transparent;

    color: var(--grey);

    font-size: 14px;
    font-weight: 600;

    transition: var(--transition);
}


.filter-button:hover {
    color: var(--purple);
}


.filter-button.active {
    background: var(--purple);

    color: var(--white);

    border-color: var(--purple);
}


.results-header {
    margin-bottom: 24px;
}


.results-header p {
    color: var(--grey);

    font-size: 14px;
}


/* =========================================================
   FEATURED RESOURCE
   ========================================================= */

.featured-resource {
    position: relative;

    min-height: 390px;

    display: flex;

    align-items: stretch;

    overflow: hidden;

    margin-bottom: 65px;

    background: var(--purple);

    color: var(--white);

    box-shadow: var(--shadow);
}


.featured-label {
    position: absolute;

    top: 0;
    left: 0;

    padding: 14px 22px;

    background: var(--black);

    color: var(--white);

    font-size: 10px;
    font-weight: 800;

    letter-spacing: 0.15em;
}


.featured-content {
    position: relative;
    z-index: 2;

    width: 72%;

    padding: 85px 70px 60px;
}


.resource-meta {
    display: flex;

    align-items: center;

    gap: 18px;

    margin-bottom: 22px;

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 0.12em;
}


.resource-type {
    color: #dfd1f0;
}


.resource-date {
    color: rgba(255, 255, 255, 0.65);

    letter-spacing: 0.05em;
}


.featured-content h2 {
    max-width: 730px;

    font-size: clamp(34px, 4vw, 58px);

    line-height: 1.03;

    letter-spacing: -0.04em;
}


.featured-content > p {
    max-width: 680px;

    margin-top: 25px;

    color: rgba(255, 255, 255, 0.8);

    font-size: 16px;

    line-height: 1.7;
}


.featured-bottom {
    display: flex;

    align-items: center;

    gap: 30px;

    margin-top: 38px;
}


.reading-time {
    color: rgba(255, 255, 255, 0.65);

    font-size: 13px;
}


.read-resource {
    display: inline-flex;

    align-items: center;

    gap: 12px;

    padding: 13px 0;

    border: 0;

    background: transparent;

    color: var(--white);

    font-size: 14px;
    font-weight: 700;

    transition: var(--transition);
}


.read-resource span {
    font-size: 20px;

    transition: var(--transition);
}


.read-resource:hover {
    color: #e6d8f4;
}


.read-resource:hover span {
    transform: translateX(5px);
}


.featured-decoration {
    position: absolute;

    right: -40px;
    top: 50%;

    transform: translateY(-50%);

    width: 380px;
    height: 380px;

    border: 1px solid rgba(255, 255, 255, 0.18);

    border-radius: 50%;

    display: grid;
    place-items: center;
}


.featured-decoration::before,
.featured-decoration::after {
    content: "";

    position: absolute;

    border: 1px solid rgba(255, 255, 255, 0.12);

    border-radius: 50%;
}


.featured-decoration::before {
    width: 280px;
    height: 280px;
}


.featured-decoration::after {
    width: 180px;
    height: 180px;
}


.featured-decoration span {
    position: relative;
    z-index: 2;

    font-size: 70px;
    font-weight: 800;

    letter-spacing: -0.08em;

    opacity: 0.15;
}


/* =========================================================
   RESOURCE GRID
   ========================================================= */

.resource-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 24px;
}


.resource-card {
    position: relative;

    display: flex;

    flex-direction: column;

    min-height: 420px;

    padding: 34px;

    background: var(--white);

    border: 1px solid rgba(0, 0, 0, 0.05);

    transition:
        transform var(--transition),
        box-shadow var(--transition),
        border-color var(--transition);
}


.resource-card:hover {
    transform: translateY(-7px);

    border-color: rgba(109, 78, 162, 0.25);

    box-shadow: var(--shadow);
}


.card-top {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 15px;

    margin-bottom: 32px;
}


.card-category {
    color: var(--purple);

    font-size: 10px;
    font-weight: 800;

    letter-spacing: 0.14em;
}


.card-date {
    color: #999999;

    font-size: 11px;
}


.resource-card h3 {
    font-size: 27px;

    line-height: 1.15;

    letter-spacing: -0.025em;
}


.resource-card-description {
    margin-top: 18px;

    color: var(--grey);

    font-size: 14px;

    line-height: 1.7;
}


.card-footer {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 15px;

    margin-top: auto;

    padding-top: 35px;
}


.card-reading {
    color: #999999;

    font-size: 12px;
}


.card-link {
    display: inline-flex;

    align-items: center;

    gap: 8px;

    color: var(--purple);

    border: 0;

    background: transparent;

    font-size: 13px;
    font-weight: 700;

    transition: var(--transition);
}


.card-link span {
    font-size: 18px;

    transition: var(--transition);
}


.card-link:hover span {
    transform: translateX(5px);
}


.card-accent {
    position: absolute;

    right: 0;
    top: 0;

    width: 4px;
    height: 0;

    background: var(--purple);

    transition: var(--transition);
}


.resource-card:hover .card-accent {
    height: 100%;
}


/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state {
    padding: 80px 30px;

    text-align: center;

    background: var(--white);

    border: 1px solid var(--border);
}


.empty-icon {
    margin-bottom: 20px;

    color: var(--purple);

    font-size: 48px;
}


.empty-state h3 {
    font-size: 28px;

    letter-spacing: -0.025em;
}


.empty-state p {
    max-width: 500px;

    margin: 12px auto 28px;

    color: var(--grey);

    font-size: 15px;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.primary-button,
.secondary-button {
    display: inline-flex;

    align-items: center;

    gap: 12px;

    border: 0;

    font-size: 13px;
    font-weight: 700;

    transition: var(--transition);
}


.primary-button {
    padding: 15px 23px;

    background: var(--purple);

    color: var(--white);
}


.primary-button:hover {
    background: var(--purple-dark);

    transform: translateY(-2px);
}


.primary-button span {
    font-size: 18px;
}


.secondary-button {
    padding: 13px 21px;

    background: transparent;

    color: var(--purple);

    border: 1px solid var(--purple);
}


.secondary-button:hover {
    background: var(--purple);

    color: var(--white);
}


/* =========================================================
   CTA
   ========================================================= */

.resource-cta {
    padding: 115px 0;

    background: var(--white);
}


.cta-box {
    position: relative;

    min-height: 390px;

    display: flex;

    align-items: center;

    overflow: hidden;

    padding: 70px;

    background: var(--black);

    color: var(--white);
}


.cta-content {
    position: relative;
    z-index: 2;

    max-width: 700px;
}


.cta-content .eyebrow {
    color: #bba5d6;
}


.cta-content h2 {
    font-size: clamp(38px, 5vw, 62px);

    line-height: 1;

    letter-spacing: -0.045em;
}


.cta-content p {
    max-width: 590px;

    margin: 24px 0 32px;

    color: rgba(255, 255, 255, 0.7);

    font-size: 16px;
}


.cta-content .primary-button {
    background: var(--purple);
}


.cta-mark {
    position: absolute;

    right: -70px;
    bottom: -150px;

    width: 500px;
    height: 500px;

    border: 1px solid rgba(255, 255, 255, 0.13);

    border-radius: 50%;

    display: grid;
    place-items: center;
}


.cta-mark::before {
    content: "";

    position: absolute;

    width: 370px;
    height: 370px;

    border: 1px solid rgba(255, 255, 255, 0.1);

    border-radius: 50%;
}


.cta-mark span {
    font-size: 90px;

    font-weight: 800;

    opacity: 0.08;
}


/* =========================================================
   FOOTER
   ========================================================= */

.site-footer {
    padding: 80px 0 25px;

    background: var(--off-white);

    border-top: 1px solid rgba(0, 0, 0, 0.05);
}


.footer-top {
    display: grid;

    grid-template-columns: 1fr 1.4fr;

    gap: 100px;

    padding-bottom: 60px;
}


.footer-logo {
    display: grid;

    width: 52px;
    height: 52px;

    place-items: center;

    background: var(--purple);

    color: var(--white);

    font-weight: 800;
}


.footer-brand p {
    max-width: 300px;

    margin-top: 22px;

    color: var(--grey);

    font-size: 14px;

    line-height: 1.7;
}


.footer-links {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 30px;
}


.footer-column {
    display: flex;

    flex-direction: column;

    gap: 12px;
}


.footer-column h3 {
    margin-bottom: 8px;

    font-size: 13px;

    color: var(--black);
}


.footer-column a {
    width: fit-content;

    color: var(--grey);

    font-size: 13px;

    transition: var(--transition);
}


.footer-column a:hover {
    color: var(--purple);

    transform: translateX(3px);
}


.footer-bottom {
    display: flex;

    justify-content: space-between;

    gap: 20px;

    padding-top: 25px;

    border-top: 1px solid rgba(0, 0, 0, 0.08);

    color: #888888;

    font-size: 11px;
}


/* =========================================================
   MODAL
   ========================================================= */

.resource-modal {
    position: fixed;

    inset: 0;

    z-index: 2000;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 30px;

    visibility: hidden;

    opacity: 0;

    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
}


.resource-modal.active {
    visibility: visible;

    opacity: 1;
}


.modal-overlay {
    position: absolute;

    inset: 0;

    background: rgba(20, 15, 25, 0.72);

    backdrop-filter: blur(5px);
}


.modal-container {
    position: relative;
    z-index: 2;

    width: min(100%, 800px);

    max-height: 90vh;

    overflow-y: auto;

    background: var(--white);

    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.2);

    transform: translateY(25px);

    transition: transform 0.35s ease;
}


.resource-modal.active .modal-container {
    transform: translateY(0);
}


.modal-close {
    position: absolute;

    top: 18px;
    right: 18px;

    z-index: 3;

    width: 40px;
    height: 40px;

    border: 0;

    background: var(--off-white);

    color: var(--black);

    font-size: 25px;

    transition: var(--transition);
}


.modal-close:hover {
    background: var(--purple);

    color: var(--white);
}


.modal-content {
    padding: 65px 60px 55px;
}


.modal-meta {
    display: flex;

    gap: 18px;

    margin-bottom: 20px;

    font-size: 10px;
    font-weight: 800;

    letter-spacing: 0.13em;
}


.modal-meta span:first-child {
    color: var(--purple);
}


.modal-meta span:last-child {
    color: #999999;
}


.modal-content h2 {
    max-width: 650px;

    font-size: clamp(34px, 5vw, 52px);

    line-height: 1.05;

    letter-spacing: -0.04em;
}


.modal-author {
    margin-top: 16px;

    color: var(--grey);

    font-size: 13px;
}


.modal-body {
    margin-top: 35px;

    color: #555555;

    font-size: 15px;

    line-height: 1.85;
}


.modal-body p + p {
    margin-top: 18px;
}


.modal-footer {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    margin-top: 40px;

    padding-top: 25px;

    border-top: 1px solid var(--light-grey);

    color: #888888;

    font-size: 12px;
}


/* =========================================================
   SCROLL REVEAL
   ========================================================= */

.reveal {
    opacity: 0;

    transform: translateY(28px);

    transition:
        opacity 0.8s ease,
        transform 0.8s ease;
}


.reveal.visible {
    opacity: 1;

    transform: translateY(0);
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1050px) {

    .desktop-nav {
        gap: 20px;
    }


    .desktop-nav a {
        font-size: 13px;
    }


    .intro-grid {
        gap: 50px;
    }


    .resource-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }


    .featured-content {
        width: 80%;
    }


    .featured-decoration {
        opacity: 0.6;
    }

}


@media (max-width: 800px) {

    .container,
    .header-container {
        width: min(
            calc(100% - 40px),
            var(--container)
        );
    }


    .desktop-nav {
        display: none;
    }


    .menu-toggle {
        display: flex;
    }


    .mobile-nav {
        display: flex;

        flex-direction: column;

        max-height: 0;

        overflow: hidden;

        background: var(--white);

        transition: max-height 0.4s ease;
    }


    .mobile-nav.open {
        max-height: 500px;
    }


    .mobile-nav a {
        padding: 16px 30px;

        border-top: 1px solid rgba(0, 0, 0, 0.05);

        color: var(--dark);

        font-size: 14px;

        transition: var(--transition);
    }


    .mobile-nav a:hover,
    .mobile-nav a.active {
        padding-left: 36px;

        color: var(--purple);

        background: var(--off-white);
    }


    .resources-hero {
        min-height: 500px;
    }


    .hero-content {
        padding: 85px 0;
    }


    .intro-grid {
        grid-template-columns: 1fr;

        gap: 25px;
    }


    .resources-intro {
        padding: 85px 0 70px;
    }


    .resource-library {
        padding: 70px 0 90px;
    }


    .resource-tools {
        justify-content: stretch;
    }


    .search-wrapper {
        width: 100%;
    }


    .featured-resource {
        min-height: 0;
    }


    .featured-content {
        width: 100%;

        padding: 80px 35px 50px;
    }


    .featured-decoration {
        right: -140px;

        opacity: 0.35;
    }


    .resource-grid {
        grid-template-columns: 1fr;
    }


    .cta-box {
        padding: 55px 35px;

        min-height: 360px;
    }


    .cta-mark {
        right: -200px;
    }


    .footer-top {
        grid-template-columns: 1fr;

        gap: 55px;
    }

}


@media (max-width: 550px) {

    .container,
    .header-container {
        width: calc(100% - 30px);
    }


    .header-container {
        min-height: 70px;
    }


    .logo {
        width: 44px;
        height: 44px;
    }


    .resources-hero {
        min-height: 470px;
    }


    .hero-content h1 {
        font-size: 50px;
    }


    .hero-content p {
        font-size: 16px;
    }


    .resources-intro {
        padding: 70px 0 60px;
    }


    .section-heading h2 {
        font-size: 42px;
    }


    .resource-library {
        padding: 60px 0 75px;
    }


    .resource-filters {
        gap: 6px;
    }


    .filter-button {
        padding: 10px 14px;

        font-size: 12px;
    }


    .featured-content {
        padding: 75px 25px 40px;
    }


    .featured-content h2 {
        font-size: 35px;
    }


    .featured-bottom {
        align-items: flex-start;

        flex-direction: column;

        gap: 12px;
    }


    .resource-card {
        min-height: 380px;

        padding: 28px;
    }


    .cta-box {
        padding: 50px 25px;
    }


    .cta-content h2 {
        font-size: 40px;
    }


    .footer-links {
        grid-template-columns: 1fr 1fr;
    }


    .footer-bottom {
        flex-direction: column;
    }


    .modal-content {
        padding: 60px 25px 35px;
    }


    .modal-footer {
        align-items: flex-start;

        flex-direction: column;
    }

}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }


    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }


    .reveal {
        opacity: 1;

        transform: none;
    }

}


/* =========================================================
   EMBEDDED PDF VIEWER
   ========================================================= */

.modal-container.pdf-viewer-active {
    width: min(100%, 1100px);
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-container.pdf-viewer-active .modal-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 55px 30px 20px;
}

.modal-container.pdf-viewer-active .modal-body {
    flex: 1;
    min-height: 0;
    margin-top: 20px;
    overflow: hidden;
}

.pdf-viewer-frame {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 300px;
    border: 1px solid var(--border);
    background: var(--off-white);
}

.modal-container.pdf-viewer-active .modal-footer {
    flex-shrink: 0;
    margin-top: 15px;
    padding-top: 15px;
}

@media (max-width: 550px) {
    .resource-modal {
        padding: 10px;
    }

    .modal-container.pdf-viewer-active {
        width: 100%;
        height: 94vh;
        max-height: 94vh;
    }

    .modal-container.pdf-viewer-active .modal-content {
        padding: 55px 15px 15px;
    }

    .modal-container.pdf-viewer-active .modal-content h2 {
        font-size: 25px;
    }

    .modal-container.pdf-viewer-active .modal-body {
        margin-top: 15px;
    }

    .pdf-viewer-frame {
        min-height: 250px;
    }
}


/* =========================================================
   OGL INTERACTIVE PDF FLIPBOOK
   ========================================================= */

.flipbook-viewer {
    width: 100%;
    margin: 20px auto 0;
}

.flipbook-loading,
.flipbook-error {
    padding: 35px 20px;
    text-align: center;
    color: var(--text, #46365F);
}

.flipbook-error a {
    display: inline-block;
    margin-top: 12px;
    color: var(--primary, #6d4ea2);
    text-decoration: underline;
}

.flipbook-stage {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: var(--off-white, #f8f6fb);
    border: 1px solid var(--border, #e5deee);
    border-radius: 8px;
    padding: 12px;
}

.flipbook-pages {
    margin: 0 auto;
}

.flipbook-pages .page {
    background: #ffffff;
    overflow: hidden;
    box-sizing: border-box;
}

.flipbook-pages .page canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.flipbook-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 18px 8px 5px;
}

.flipbook-controls button {
    padding: 10px 18px;
    border: 1px solid var(--primary, #6d4ea2);
    border-radius: 6px;
    background: #ffffff;
    color: var(--primary, #6d4ea2);
    cursor: pointer;
    font: inherit;
    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.flipbook-controls button:hover:not(:disabled) {
    background: var(--primary, #6d4ea2);
    color: #ffffff;
}

.flipbook-controls button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#flipbookPageNumber {
    min-width: 80px;
    text-align: center;
    color: var(--text, #46365F);
    font-size: 14px;
}

/* Flipbook modal layout */

.modal-container.pdf-viewer-active {
    width: min(100%, 1100px);
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.modal-container.pdf-viewer-active .modal-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 55px 30px 20px;
}

.modal-container.pdf-viewer-active .modal-body {
    flex: 1;
    min-height: 0;
    margin-top: 20px;
}

.modal-container.pdf-viewer-active .modal-footer {
    flex-shrink: 0;
    margin-top: 15px;
    padding-top: 15px;
}

@media (max-width: 550px) {
    .modal-container.pdf-viewer-active {
        width: 100%;
        height: 94vh;
        max-height: 94vh;
    }

    .modal-container.pdf-viewer-active .modal-content {
        padding: 55px 12px 15px;
    }

    .flipbook-stage {
        padding: 4px;
    }

    .flipbook-controls {
        gap: 8px;
    }

    .flipbook-controls button {
        padding: 9px 12px;
    }
}

/* =========================================================
   OGL FULL-PAGE FLIPBOOK READER
   ========================================================= */

.resource-modal:has(.modal-container.pdf-viewer-active) {
    padding: 0;
}

.resource-modal:has(.modal-container.pdf-viewer-active)
.modal-overlay {
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.modal-container.pdf-viewer-active {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    background: #ffffff;
}

.modal-container.pdf-viewer-active .modal-content {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 80px 32px 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-container.pdf-viewer-active .modal-meta {
    flex-shrink: 0;
}

.modal-container.pdf-viewer-active .modal-content h2 {
    flex-shrink: 0;
    margin-bottom: 8px;
}

.modal-container.pdf-viewer-active .modal-author {
    flex-shrink: 0;
    margin-bottom: 0;
}

.modal-container.pdf-viewer-active .modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-top: 16px;
    overflow: hidden;
}

.modal-container.pdf-viewer-active .flipbook-viewer {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
}

.modal-container.pdf-viewer-active .flipbook-stage {
    flex: 1;
    min-height: 0;
    padding: 12px;
    border: none;
    border-radius: 0;
    background: #f7f4fb;
}

.modal-container.pdf-viewer-active .flipbook-pages {
    margin: auto;
}

.modal-container.pdf-viewer-active .flipbook-controls {
    flex-shrink: 0;
    padding: 16px 8px 8px;
}

.modal-container.pdf-viewer-active .modal-footer {
    flex-shrink: 0;
    margin-top: 12px;
    padding-top: 12px;
}

/* Keep the close button visible above the full-page reader. */
.modal-container.pdf-viewer-active .modal-close {
    position: fixed;
    top: 18px;
    right: 24px;
    z-index: 20;
}

/* Mobile layout */
@media (max-width: 600px) {
    .modal-container.pdf-viewer-active .modal-content {
        padding: 72px 12px 12px;
    }

    .modal-container.pdf-viewer-active .flipbook-stage {
        padding: 4px;
    }

    .modal-container.pdf-viewer-active .modal-close {
        top: 12px;
        right: 14px;
    }

    .modal-container.pdf-viewer-active .modal-footer {
        padding-bottom: 4px;
    }
}

/* =========================================================
   FULL-PAGE READER: COMPACT HEADER, LARGER PDF AREA
   ========================================================= */

.modal-container.pdf-viewer-active .modal-content {
    padding: 66px 20px 10px;
    gap: 0;
}

.modal-container.pdf-viewer-active .modal-meta {
    margin-bottom: 6px;
    font-size: 11px;
}

.modal-container.pdf-viewer-active .modal-content h2 {
    font-size: clamp(18px, 2vw, 27px);
    line-height: 1.25;
    margin: 0 40px 5px 0;
}

.modal-container.pdf-viewer-active .modal-author {
    font-size: 12px;
    line-height: 1.4;
    margin: 0;
}

.modal-container.pdf-viewer-active .modal-body {
    flex: 1;
    min-height: 0;
    margin-top: 8px;
}

.modal-container.pdf-viewer-active .flipbook-viewer {
    flex: 1;
    min-height: 0;
    width: 100%;
    margin: 0;
}

.modal-container.pdf-viewer-active .flipbook-stage {
    width: 100%;
    height: 100%;
    flex: 1;
    min-height: 0;
    padding: 4px;
}

.modal-container.pdf-viewer-active .flipbook-controls {
    padding: 8px 4px 2px;
}

.modal-container.pdf-viewer-active .modal-footer {
    margin-top: 5px;
    padding-top: 6px;
}

@media (max-width: 600px) {
    .modal-container.pdf-viewer-active .modal-content {
        padding: 62px 10px 8px;
    }

    .modal-container.pdf-viewer-active .modal-content h2 {
        font-size: 19px;
        line-height: 1.25;
    }
}


/* =========================================================
   FIX FLIPBOOK CLIPPING
   ========================================================= */

.modal-container.pdf-viewer-active {
    overflow: auto;
}

.modal-container.pdf-viewer-active .modal-content {
    height: auto;
    min-height: 100%;
    overflow: visible;
}

.modal-container.pdf-viewer-active .modal-body {
    flex: 1 1 auto;
    min-height: 300px;
    overflow: visible;
}

.modal-container.pdf-viewer-active .flipbook-viewer {
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
}

.modal-container.pdf-viewer-active .flipbook-stage {
    height: auto;
    min-height: 420px;
    overflow: visible;
    padding: 12px;
}

.modal-container.pdf-viewer-active .flipbook-pages {
    max-width: 100%;
    margin: auto;
}

.modal-container.pdf-viewer-active .flipbook-pages .page {
    max-width: 100%;
    overflow: hidden;
}

.modal-container.pdf-viewer-active .flipbook-pages .page canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

@media (max-width: 600px) {
    .modal-container.pdf-viewer-active .flipbook-stage {
        min-height: 320px;
        padding: 4px;
    }
}

/* =========================================================
   OGL SIMPLE PDF READER
   Scrollable pages without flipbook controls
   ========================================================= */

.modal-container.pdf-viewer-active .flipbook-viewer {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    margin: 0;
}

.modal-container.pdf-viewer-active .flipbook-stage.simple-pdf-reader {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-height: 300px;
    max-height: none;
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    background: #f4f0f8;
    border: none;
    border-radius: 0;
    scrollbar-gutter: stable;
}

.modal-container.pdf-viewer-active .flipbook-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.modal-container.pdf-viewer-active .simple-pdf-page {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(40, 25, 60, 0.12);
}

.modal-container.pdf-viewer-active .simple-pdf-page canvas {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.modal-container.pdf-viewer-active .flipbook-controls {
    display: none !important;
}

.modal-container.pdf-viewer-active #flipbookOpenOriginal {
    display: none !important;
}

@media (max-width: 600px) {
    .modal-container.pdf-viewer-active .flipbook-stage.simple-pdf-reader {
        padding: 6px;
    }

    .modal-container.pdf-viewer-active .flipbook-pages {
        gap: 12px;
    }
}