/* =========================================================
   EXCERPT FLIPBOOK
   Ad-free, self-contained page-turning book viewer
========================================================= */

/* Button (was a link, now opens the book) */
button.author-excerpt-button {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.author-excerpt-button:hover span {
    transform: scale(1.18) rotate(-6deg);
}

html.fb-open,
body.fb-open {
    overflow: hidden !important;
}


/* ---------- OVERLAY ---------- */

.fb-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;

    display: flex;
    align-items: center;
    justify-content: center;

    background: radial-gradient(ellipse at center, #0f1b45 0%, #060b22 55%, #02040f 100%);

    opacity: 0;
    visibility: hidden;
    overscroll-behavior: contain;

    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.fb-overlay.active {
    opacity: 1;
    visibility: visible;
}

.fb-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 16px 22px;
}

.fb-topbar-title {
    font-family: "Cinzel", serif;
    font-size: 12px;
    letter-spacing: 3px;
    color: #e5b93f;
    text-transform: uppercase;
}

.fb-close {
    width: 44px;
    height: 44px;

    border: 1px solid rgba(229, 185, 63, 0.5);
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.04);
    color: #e5b93f;

    font-size: 26px;
    line-height: 1;
    cursor: pointer;

    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.fb-close:hover {
    background: #e5b93f;
    color: #080e27;
    transform: rotate(90deg);
}


/* ---------- STAGE + BOOK ---------- */

.fb-stage {
    position: relative;

    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 70px 0 80px;

    touch-action: none;
}

.fb-book {
    position: relative;

    width: calc(var(--pw) * 2);
    height: var(--ph);

    perspective: 2600px;

    user-select: none;
    -webkit-user-select: none;

    transition: transform 0.9s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.fb-book.single {
    width: var(--pw);
}

.fb-leaf {
    position: absolute;
    top: 0;
    left: 50%;

    width: var(--pw);
    height: 100%;

    transform-origin: left center;
    transform-style: preserve-3d;

    transition: transform 1s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.fb-book.single .fb-leaf {
    left: 0;
}

.fb-leaf.flipped {
    transform: rotateY(-180deg);
}

.fb-leaf.turning .fb-face {
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.55);
}

.fb-face {
    position: absolute;
    inset: 0;

    overflow: hidden;

    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;

    background: #f4ebd6;

    box-shadow: 0 28px 50px -24px rgba(0, 0, 0, 0.65);
}

.fb-face.fb-back {
    transform: rotateY(180deg);
}

.fb-face.fb-right {
    border-radius: 0 6px 6px 0;
}

.fb-face.fb-left {
    border-radius: 6px 0 0 6px;
}

/* Spine shadow */
.fb-face::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.fb-face.fb-right::after {
    background: linear-gradient(to right, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0) 10%),
                linear-gradient(to left, rgba(0, 0, 0, 0.10), rgba(0, 0, 0, 0) 3%);
}

.fb-face.fb-left::after {
    background: linear-gradient(to left, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0) 10%),
                linear-gradient(to right, rgba(0, 0, 0, 0.10), rgba(0, 0, 0, 0) 3%);
}


/* ---------- PAGE CONTENT ---------- */

/* The hidden measuring page uses a fixed size; real pages inherit
   --pw / --ph from the book so everything scales together. */
.fb-measure {
    --pw: 400px;
    --ph: 533.333px;
}

.fb-page {
    position: absolute;
    inset: 0;

    font-size: calc(var(--pw) / 21);

    background:
        radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, 0.35), rgba(0, 0, 0, 0) 70%),
        linear-gradient(#f6eedc, #eee2c4);
}

.fb-measure {
    position: absolute;
    left: -9999px;
    top: 0;

    width: var(--pw);
    height: var(--ph);

    visibility: hidden;
    pointer-events: none;

    font-size: calc(var(--pw) / 21);
}

.fb-page-inner {
    box-sizing: border-box;

    width: 100%;
    height: 100%;

    padding: 2.4em 2em 3.1em;
    overflow: hidden;

    color: #2a2116;

    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1em;
    font-weight: 500;
    line-height: 1.5;

    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.fb-page-inner p {
    margin: 0;
    text-indent: 1.4em;
}

.fb-page-inner p.cont,
.fb-page-inner .fb-h1 + p,
.fb-page-inner .fb-h2 + p {
    text-indent: 0;
}

.fb-page-inner .fb-h1 + p::first-letter {
    float: left;
    padding: 0.06em 0.1em 0 0;
    font-family: "Cinzel", serif;
    font-size: 3em;
    line-height: 0.85;
    color: #8a6a1c;
}

.fb-h1 {
    margin: 0 0 0.7em;

    font-family: "Cinzel", serif;
    font-size: 1.3em;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-align: center;
    text-transform: uppercase;
    color: #5a4310;
}

.fb-h2 {
    margin: 0 0 1em;

    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.15em;
    font-style: italic;
    font-weight: 600;
    text-align: center;
    color: #7a6230;
}

.fb-folio {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1.5em;

    font-family: "Cinzel", serif;
    font-size: 0.62em;
    letter-spacing: 0.2em;
    text-align: center;
    color: #8b7b55;
}


/* ---------- SPECIAL PAGES ---------- */

.fb-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;
}

.fb-orn {
    font-size: 1.4em;
    color: #b8902b;
}

.fb-center h2 {
    margin: 0.5em 0 0.2em;

    font-family: "Cinzel", serif;
    font-size: 1.7em;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: #4a370d;
}

.fb-sub {
    margin: 0;
    font-style: italic;
    font-size: 1.1em;
    color: #7a6230;
    text-indent: 0 !important;
    text-align: center;
}

.fb-rule {
    width: 30%;
    height: 1px;
    margin: 1.4em 0;
    background: linear-gradient(to right, transparent, #b8902b, transparent);
}

.fb-author {
    margin: 0;
    font-family: "Cinzel", serif;
    font-size: 0.8em;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    text-indent: 0 !important;
    text-align: center;
    color: #4a370d;
}

.fb-center p.fb-note {
    margin: 0.8em 0 1.6em;
    text-indent: 0;
    text-align: center;
}

.fb-btn {
    display: inline-block;

    padding: 0.8em 1.6em;

    border: 1px solid #8a6a1c;

    font-family: "Cinzel", serif;
    font-size: 0.68em;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-decoration: none;
    text-transform: uppercase;
    color: #4a370d;

    transition: background 0.3s ease, color 0.3s ease;
}

.fb-btn:hover {
    background: #4a370d;
    color: #f4ebd6;
}


/* ---------- COVERS ---------- */

.fb-hard {
    background: linear-gradient(145deg, #0e1c4c, #04081b);
}

.fb-cover,
.fb-endpaper,
.fb-backcover {
    position: absolute;
    inset: 0;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;
    color: #e5b93f;
}

.fb-cover::before,
.fb-backcover::before {
    content: "";
    position: absolute;
    inset: 0.9em;
    border: 1px solid rgba(229, 185, 63, 0.55);
    pointer-events: none;
    z-index: 2;
}

.fb-cover img {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;
}

.fb-cover-title {
    position: relative;
    z-index: 1;

    padding: 0 2em;

    font-family: "Cinzel", serif;
    font-size: 1.9em;
    font-weight: 600;
    letter-spacing: 0.12em;
    line-height: 1.3;
    text-transform: uppercase;
}

.fb-cover-sub {
    position: relative;
    z-index: 1;

    margin-top: 1em;

    font-family: "Cormorant Garamond", serif;
    font-size: 1.1em;
    font-style: italic;
    color: #f0d78a;
}

.fb-cover-author {
    position: absolute;
    bottom: 2.2em;
    z-index: 1;

    font-family: "Cinzel", serif;
    font-size: 0.75em;
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

.fb-endpaper {
    background: repeating-linear-gradient(45deg, #0b1437 0 9px, #0e1a48 9px 18px);
}

.fb-backcover-text {
    position: relative;
    z-index: 1;

    font-family: "Cinzel", serif;
    font-size: 0.9em;
    letter-spacing: 0.3em;
    text-transform: uppercase;
}


/* ---------- CONTROLS ---------- */

.fb-arrow {
    position: absolute;
    top: 50%;
    z-index: 5;

    width: 52px;
    height: 52px;

    margin-top: -26px;

    border: 1px solid rgba(229, 185, 63, 0.5);
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.04);
    color: #e5b93f;

    font-size: 18px;
    cursor: pointer;

    transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease;
}

.fb-arrow:hover:not(:disabled) {
    background: #e5b93f;
    color: #080e27;
}

.fb-arrow:disabled {
    opacity: 0.25;
    cursor: default;
}

.fb-prev {
    left: 22px;
}

.fb-next {
    right: 22px;
}

.fb-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    z-index: 5;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
}

.fb-progress {
    width: min(320px, 60vw);
    height: 2px;
    background: rgba(255, 255, 255, 0.14);
}

.fb-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: #e5b93f;
    transition: width 0.6s ease;
}

.fb-count {
    font-family: "Inter", sans-serif;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #b9bfd3;
}

.fb-close:focus-visible,
.fb-arrow:focus-visible {
    outline: 2px solid #f0d78a;
    outline-offset: 3px;
}


/* ---------- MOBILE ---------- */

@media (max-width: 759px) {

    .fb-stage {
        padding: 64px 0 96px;
    }

    .fb-arrow {
        top: auto;
        bottom: 22px;
        margin-top: 0;
        width: 46px;
        height: 46px;
    }

    .fb-prev {
        left: 16px;
    }

    .fb-next {
        right: 16px;
    }

    .fb-topbar-title {
        font-size: 10px;
        letter-spacing: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .fb-leaf,
    .fb-book {
        transition-duration: 0.01s;
    }
}