/* =========================================================
   PAPER VIEWER

   Shared by past papers and predicted papers.

   Every element carries two classes, e.g.
   "mwd-paper-tab mwd-past-paper-tab". All styling hangs off
   the shared .mwd-paper-* class; the typed class is there
   for the odd case where past and predicted should differ.

   See /inc/paper-viewer.php,
       /templates/paper-viewer.php,
       /assets/js/paper-viewer.js
   ========================================================= */

.mwd-paper-viewer {
    position: relative;
    width: 100%;
    height: 100%;
}


/* =========================================================
   FLOATING RESOURCE SWITCHER
   ========================================================= */

.mwd-paper-switcher {
    position: absolute;
    left: 50%;
    bottom: 60px;
    transform: translateX(-50%);

    z-index: 50;

    display: flex;
    align-items: center;
    gap: 4px;

    padding: 5px;

    background: rgba(30, 30, 34, 0.94);

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

    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 10px 30px rgba(0, 0, 0, 0.25);

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}


/* =========================================================
   PAPER / MARK SCHEME BUTTONS
   ========================================================= */

.mwd-paper-tab {
    appearance: none;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 4px;

    padding: 10px 18px;

    background: transparent;
    color: #fff;

    font: inherit;
    font-weight: 600;
    line-height: 1.2;

    white-space: nowrap;

    cursor: pointer;

    transition:
        background 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}


.mwd-paper-tab:hover {
    background: rgba(255, 255, 255, 0.1);
}


.mwd-paper-tab:active {
    transform: scale(0.98);
}


.mwd-paper-tab.is-active {
    background: #00b8e6;
    color: #fff;
}


.mwd-paper-tab:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}


/* =========================================================
   WALKTHROUGH DIVIDER
   ========================================================= */

.mwd-paper-switcher-divider {
    display: block;

    width: 1px;
    height: 24px;

    margin: 0 4px;

    flex: 0 0 auto;

    background: rgba(255, 255, 255, 0.18);
}


/* =========================================================
   YOUTUBE WALKTHROUGH
   ========================================================= */

.mwd-paper-walkthrough {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    padding: 10px 14px;

    border-radius: 4px;

    background: transparent;
    color: #fff;

    font: inherit;
    font-weight: 600;
    line-height: 1.2;

    text-decoration: none;
    white-space: nowrap;

    cursor: pointer;

    transition:
        background 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}


.mwd-paper-walkthrough:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
}


.mwd-paper-walkthrough:active {
    transform: scale(0.98);
}


.mwd-paper-walkthrough:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}


/* YouTube icon */

.mwd-youtube-icon {
    display: block;

    width: 21px;
    height: 21px;

    flex: 0 0 auto;

    color: #ff0033;
}


/* =========================================================
   PDF VIEWER AREA
   ========================================================= */

.mwd-paper-stage {
    position: relative;

    width: 100%;
    height: 100%;

    min-height: 700px;

    overflow: hidden;

    background: #29292d;
}


/*
 * Both panels stay mounted.
 *
 * We hide the inactive one without destroying it.
 *
 * This is what preserves its:
 *
 * - page
 * - scroll position
 * - zoom
 * - drawings
 *
 * when switching between Paper and Mark Scheme.
 */

.mwd-pdf-panel {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    visibility: hidden;
    opacity: 0;

    pointer-events: none;
}


.mwd-pdf-panel.is-active {
    visibility: visible;
    opacity: 1;

    pointer-events: auto;
}


.mwd-pdf-panel iframe {
    display: block;

    width: 100%;
    height: 100%;

    border: 0;
}


/* =========================================================
   NO JAVASCRIPT FALLBACK
   ========================================================= */

.mwd-paper-noscript {
    padding: 24px;

    color: #fff;

    font-size: 15px;
    line-height: 1.5;
}


.mwd-paper-noscript a {
    color: #00b8e6;
}


/* =========================================================
   TABLET / MOBILE
   ========================================================= */

@media (max-width: 767px) {

    .mwd-paper-switcher {
        bottom: calc(
            12px + env(safe-area-inset-bottom)
        );

        width: calc(100% - 24px);
        max-width: 520px;

        justify-content: center;

        padding: 5px;
    }


    .mwd-paper-tab {
        padding: 10px 12px;

        font-size: 13px;

        white-space: nowrap;
    }


    .mwd-paper-walkthrough {
        padding: 10px 10px;

        font-size: 13px;
    }


    .mwd-youtube-icon {
        width: 20px;
        height: 20px;
    }


    .mwd-paper-stage {
        width: 100%;
        height: 100%;

        min-height: 500px;
    }

}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 480px) {

    .mwd-paper-switcher {
        gap: 2px;
    }


    .mwd-paper-tab {
        flex: 1 1 auto;

        padding: 9px 8px;

        font-size: 12px;
    }


    .mwd-paper-switcher-divider {
        height: 22px;

        margin: 0 2px;
    }


    .mwd-paper-walkthrough {
        flex: 0 0 auto;

        padding: 9px 10px;
    }


    /*
     * On narrow phones, keep the YouTube action compact.
     * Its aria-label and title still describe the action.
     */
    .mwd-paper-walkthrough span {
        display: none;
    }


    .mwd-youtube-icon {
        width: 21px;
        height: 21px;
    }

}
