.brochure-section {
    scroll-margin-top: 105px;
    width: 100%;
    min-height: 100vh;
    padding: 70px 20px 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 50% 30%, #ffffff 0%, #f8f3eb 45%, #e9dfd1 100%);
}

/* Keep the brochure heading clear of the fixed sticky navigation when this
   section is reached through an in-page link or browser scroll restoration. */
html:has(#brochure) {
    scroll-padding-top: 105px;
}

.brochure-heading {
    text-align: center;
    margin-bottom: 45px;
    position: relative;
    z-index: 20;
}

.brochure-heading .small-title {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #87633e;
}

.brochure-heading h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1.1;
    font-weight: 800;
    color: #20170f;
}

.brochure-heading p {
    max-width: 650px;
    margin: 14px auto 0;
    font-size: 15px;
    line-height: 1.7;
    color: #71675c;
}

.book-stage {
    width: 100%;
    max-width: 1250px;
    min-height: 720px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
    perspective: 3000px;
    perspective-origin: center center;
}

.book-container {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: visible;
    perspective: 3000px;
    transform-style: preserve-3d;
}

.book-container.is-zoomed {
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}

.book-container.is-zoomed:active {
    cursor: grabbing;
}

#book {
    position: relative;
    margin: 0 auto;
    transform-style: preserve-3d;
    transform-origin: center center;
    transition: transform .35s ease;
    overflow: visible !important;
    isolation: isolate;
    border: 1px solid rgba(70, 48, 28, .08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45);
    filter: drop-shadow(0 22px 24px rgba(48, 32, 17, .18));
}

.pdf-page canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: fill;
    background: #ffffff;
}

.pdf-page-pending {
    background: linear-gradient(135deg, #f7f2eb, #ffffff 50%, #eee4d8);
}

.pdf-cover {
    position: relative;
    background: #ffffff;
    overflow: hidden;
    box-shadow: inset -10px 0 18px rgba(35, 23, 12, .07);
}

.pdf-cover::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(40, 25, 10, .15));
    pointer-events: none;
    z-index: 10;
}

.book-open #book::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 30px;
    height: 100%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 1000;
    background: linear-gradient(90deg,
        rgba(0, 0, 0, .20) 0%,
        rgba(0, 0, 0, .06) 24%,
        rgba(255, 255, 255, .34) 48%,
        rgba(0, 0, 0, .12) 66%,
        rgba(0, 0, 0, .25) 100%);
    opacity: .82;
    filter: blur(1px);
}

/* Page curvature and edge shading make the two-page state read as a book,
   rather than two flat images placed side by side. */
.book-open #book {
    background: #f8f5ef;
    box-shadow: 0 24px 35px rgba(26, 16, 8, .24), inset 0 0 0 1px rgba(73, 48, 28, .12);
}

.book-open #book::after {
    content: "";
    position: absolute;
    z-index: 999;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, .17), transparent 7%, transparent 43%, rgba(0, 0, 0, .12) 49.5%, transparent 54%, transparent 93%, rgba(0, 0, 0, .16)),
        linear-gradient(90deg, rgba(255, 255, 255, .16), transparent 20%, transparent 80%, rgba(255, 255, 255, .12));
    mix-blend-mode: multiply;
}

.book-open .stf__item {
    box-shadow: inset -13px 0 20px rgba(43, 25, 8, .08), inset 10px 0 14px rgba(255, 255, 255, .16);
}

.stf__parent,
.stf__block {
    overflow: visible !important;
    transform-style: preserve-3d !important;
}

.stf__item {
    overflow: hidden !important;
    background: #ffffff !important;
    transform-style: preserve-3d !important;
}

.brochure-loading {
    position: absolute;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(255, 255, 255, .99), rgba(244, 237, 227, .99));
    transition: opacity .5s ease, visibility .5s ease;
}

.brochure-loading.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-book {
    width: 58px;
    height: 45px;
    position: relative;
    perspective: 500px;
}

.loading-book::before,
.loading-book::after {
    content: "";
    position: absolute;
    top: 0;
    width: 27px;
    height: 42px;
    background: #765331;
    box-shadow: 0 7px 14px rgba(45, 30, 18, .20);
    border-radius: 2px;
}

.loading-book::before {
    left: 0;
    transform-origin: right center;
    animation: loadingLeft 1.2s infinite ease-in-out;
}

.loading-book::after {
    right: 0;
    transform-origin: left center;
    animation: loadingRight 1.2s infinite ease-in-out;
}

@keyframes loadingLeft {
    0%, 100% { transform: rotateY(0deg); }
    50% { transform: rotateY(-60deg); }
}

@keyframes loadingRight {
    0%, 100% { transform: rotateY(0deg); }
    50% { transform: rotateY(60deg); }
}

.loading-text {
    margin-top: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #67523c;
}

.book-controls,
.book-tool-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 30;
}

.book-controls {
    margin-top: 48px;
    gap: 15px;
}

.book-tool-controls {
    margin-top: 16px;
    gap: 10px;
}

.book-btn {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(70, 48, 28, .15);
    background: rgba(255, 255, 255, .95);
    color: #3c2b1c;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 9px 22px rgba(45, 30, 15, .13);
    transition: all .25s ease;
}

.book-btn:hover,
.book-tool-btn:hover {
    background: #3d2b1b;
    color: #ffffff;
    transform: translateY(-3px);
}

.book-btn:active {
    transform: translateY(-1px) scale(.96);
}

.book-btn:disabled,
.book-tool-btn:disabled {
    opacity: .30;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 5px 10px rgba(45, 30, 15, .05);
}

.book-tool-btn {
    min-width: 44px;
    height: 42px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid rgba(70, 48, 28, .15);
    border-radius: 8px;
    background: rgba(255, 255, 255, .94);
    color: #3c2b1c;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(45, 30, 15, .10);
    transition: all .25s ease;
}

.book-tool-btn i { font-size: 14px; }

.page-counter {
    min-width: 110px;
    height: 44px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 30px;
    background: rgba(255, 255, 255, .94);
    color: #493827;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(45, 30, 15, .10);
}

.drag-hint {
    margin-top: 18px;
    color: #766b5e;
    font-size: 12px;
    text-align: center;
    opacity: .8;
    position: relative;
    z-index: 20;
}

.brochure-error {
    padding: 30px;
    text-align: center;
    color: #743a30;
}

.brochure-section:fullscreen,
.brochure-section:-webkit-full-screen {
    box-sizing: border-box;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    padding: 0;
    justify-content: center;
    overflow: auto;
    background: radial-gradient(circle at 50% 25%, #ffffff 0%, #f8f3eb 52%, #e9dfd1 100%);
}

.brochure-section:fullscreen .brochure-heading,
.brochure-section:fullscreen .book-controls,
.brochure-section:fullscreen .drag-hint,
.brochure-section:-webkit-full-screen .brochure-heading,
.brochure-section:-webkit-full-screen .book-controls,
.brochure-section:-webkit-full-screen .drag-hint {
    display: none;
}

.brochure-section:fullscreen .book-tool-controls,
.brochure-section:-webkit-full-screen .book-tool-controls {
    display: flex;
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 300;
    margin: 0;
    padding: 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 10px 30px rgba(45, 30, 15, .20);
}

.brochure-section:fullscreen .book-stage,
.brochure-section:-webkit-full-screen .book-stage {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    max-width: none;
}

.brochure-section:fullscreen .book-container,
.brochure-section:-webkit-full-screen .book-container {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}

@media (max-width: 900px) {
    .brochure-section { padding: 55px 12px 75px; }
    .brochure-heading { margin-bottom: 32px; }
    .book-controls { margin-top: 35px; }
    .book-stage { min-height: 560px; }
}

@media (max-width: 600px) {
    .brochure-section { scroll-margin-top: 78px; }
    html:has(#brochure) { scroll-padding-top: 78px; }
    .brochure-section { min-height: auto; padding: 36px 12px 48px; }
    .brochure-heading { margin-bottom: 24px; padding: 0 8px; }
    .brochure-heading .small-title { font-size: 10px; letter-spacing: 2.5px; }
    .brochure-heading h1 { font-size: clamp(24px, 7vw, 30px); }
    .brochure-heading p { max-width: 320px; margin-top: 10px; font-size: 13px; line-height: 1.55; }
    .book-stage {
        width: 100%;
        min-height: clamp(410px, 122vw, 510px);
        overflow: hidden;
        perspective: none;
    }
    .book-container {
        width: 100%;
        min-height: inherit;
        align-items: center;
        perspective: none;
    }
    #book {
        max-width: 100%;
        filter: drop-shadow(0 12px 16px rgba(48, 32, 17, .16));
    }
    .book-open #book::before,
    .book-open #book::after { display: none; }
    .book-open .stf__item { box-shadow: none; }
    .stf__parent,
    .stf__block {
        max-width: 100% !important;
    }
    .book-controls { width: 100%; margin-top: 20px; gap: 12px; }
    .book-btn { width: 46px; height: 46px; font-size: 17px; }
    .page-counter { min-width: 104px; height: 44px; padding: 0 14px; font-size: 12px; }
    .book-tool-controls { width: 100%; margin-top: 14px; gap: 8px; flex-wrap: nowrap; }
    .book-tool-btn { flex: 1 1 0; min-width: 44px; height: 44px; padding: 0 6px; font-size: 12px; }
    .book-tool-btn span:not(#zoomLevel) { display: none; }
    .drag-hint { margin-top: 14px; padding: 0 16px; font-size: 11px; line-height: 1.4; }
}

@media (max-width: 400px) {
    .brochure-heading { margin-bottom: 25px; }
    .brochure-heading h1 { font-size: 25px; }
    .book-controls { gap: 7px; }
}

/* Phone layout: reserve the full portrait-page height so PageFlip is never
   clipped, and keep every control within the viewport. */
@media (max-width: 767.98px) {
    .brochure-section {
        width: 100%;
        padding-right: 12px;
        padding-left: 12px;
    }

    .book-stage {
        min-height: clamp(445px, 142vw, 700px);
        overflow: visible;
    }

    .book-container {
        min-height: clamp(445px, 142vw, 700px);
        overflow: visible;
    }

    .book-container.is-zoomed { overflow: hidden; }

    #book,
    .stf__parent,
    .stf__block {
        max-width: 100% !important;
    }

    .book-controls {
        flex-wrap: nowrap;
        margin-top: 1.25rem;
    }

    .book-tool-controls {
        max-width: 100%;
        padding: 0;
    }
}

@media (max-width: 359.98px) {
    .brochure-section { padding-right: 8px; padding-left: 8px; }
    .book-stage,
    .book-container { min-height: 445px; }
    .book-tool-controls { gap: 5px; }
    .book-tool-btn { min-width: 38px; }
    .page-counter { min-width: 96px; padding: 0 10px; }
}
