/* G STONE catalog flipbook — overlay viewer */

/* The button reuses the theme's .btn / .btn-style-2 classes, so it needs no look
   of its own - only the bits a <button> element does not inherit from an <a>. */
.gfb-btn button.btn {
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    cursor: pointer;
}

.gfb-open-btn__wrap {
    width: auto;
    text-align: left;
}

/* ---------------- button row (catalog button beside the theme button) ----------------
   Elementor drives container layout through custom properties, and it does not emit
   _css_classes for containers - so the element id class is what gets targeted. */
.elementor-element-gsfbrow9 {
    --flex-direction: row;
    --align-items: center;
    --flex-wrap: wrap;
    --justify-content: flex-start;
    --gap: 20px;
    --row-gap: 20px;
    --column-gap: 20px;
}

.elementor-element-gsfbrow9 > .elementor-element,
.elementor-element-gsfbrow9 > .elementor-element:has(> .elementor-shortcode > .gfb-open-btn__wrap) {
    flex: 0 0 auto;
    width: auto;
    max-width: 100%;
}

/* The theme reserves 40px to the right of its button and 32px between icon and
   label. Inside this row that dead space is exactly what pushes the pair onto a
   second line, so it is reclaimed and replaced by the container gap.
   !important is required: Elementor prints these per-widget with a long selector. */
.elementor-element-gsfbrow9 .elementor-widget-container {
    margin: 0 !important;
}

/* The 30px the theme's widget used to hold above itself now lives on the row, so
   both buttons share one baseline instead of one sitting 15px lower. */
.elementor-element-gsfbrow9 {
    margin-top: 30px;
    /* The parent column already pads; the row's own 15px each side is the last
       thing standing between the pair and one line at 768px. */
    padding-inline: 0 !important;
}

.elementor-element-gsfbrow9 .btn.pxl-icon--left svg,
.elementor-element-gsfbrow9 .btn.pxl-icon--left i {
    margin-right: 14px !important;
}

.elementor-element-gsfbrow9 .btn {
    white-space: nowrap;
}

/* 768-1100px the page is still two columns and the right one is only ~350-480px
   wide, so the pair is compressed rather than allowed to wrap. */
@media (max-width: 1100px) {
    .elementor-element-gsfbrow9 { --gap: 20px; --column-gap: 20px; --row-gap: 20px; }

    .elementor-element-gsfbrow9 .btn {
        padding-left: 12px !important;
        padding-right: 14px !important;
        font-size: 13px !important;
    }

    .elementor-element-gsfbrow9 .btn.pxl-icon--left svg,
    .elementor-element-gsfbrow9 .btn.pxl-icon--left i {
        margin-right: 9px !important;
    }
}

/* ---------------- overlay ---------------- */

.gfb-overlay,
.gfb-overlay * { box-sizing: border-box; }

.gfb-overlay {
    --gfb-toolbar: rgba(16, 16, 16, .96);
    --gfb-toolbar-border: rgba(255, 255, 255, .13);
    --gfb-text: #f5f5f5;

    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    background:
        radial-gradient(circle at 50% 42%, rgba(255, 255, 255, .08), transparent 38%),
        linear-gradient(180deg, #363636, #1b1b1b);
    font-family: Arial, Helvetica, sans-serif;
    user-select: none;
    isolation: isolate;
    opacity: 0;
    transition: opacity .25s ease;
}

.gfb-overlay.is-mounted { display: block; }
.gfb-overlay.is-visible { opacity: 1; }

html.gfb-lock,
body.gfb-lock { overflow: hidden !important; }

.gfb-close {
    position: absolute;
    z-index: 80;
    top: 14px;
    right: 16px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    background: rgba(0, 0, 0, .38);
    color: #eee;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.gfb-close:hover { background: rgba(0, 0, 0, .7); color: #fff; }

/* The panel is 97% opaque, so the title would ghost through its header. */
.gfb-overlay.thumbs-open .gfb-title {
    opacity: 0;
}

.gfb-title {
    transition: opacity .18s ease;
    position: absolute;
    z-index: 70;
    top: 22px;
    left: 24px;
    color: rgba(255, 255, 255, .62);
    font-size: 12px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.gfb-stage {
    position: absolute;
    inset: 60px 0 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 72px 16px;
    overflow: hidden;
}

.gfb-book-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .35));
}

.gfb-book { margin: 0 auto; }

/* No position/overflow here: StPageFlip positions .stf__item itself and clips the
   fold with its own wrappers. Overriding either makes the flipping page drop into
   normal flow - it then renders below the book and the shadows double in height. */
.gfb-page {
    background: #f8f5ee;
}

.gfb-page img {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    max-width: none !important;
    box-shadow: none !important;
    object-fit: fill;
    pointer-events: none;
    -webkit-user-drag: none;
}

.gfb-edge {
    position: absolute;
    z-index: 20;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 92px;
    border: 0;
    background: rgba(0, 0, 0, .17);
    color: rgba(255, 255, 255, .82);
    cursor: pointer;
    opacity: .3;
    transition: opacity .18s ease, background .18s ease;
}

.gfb-overlay:hover .gfb-edge { opacity: .78; }
.gfb-edge:hover { background: rgba(0, 0, 0, .42); opacity: 1 !important; }

.gfb-edge span {
    display: block;
    font-size: 42px;
    line-height: 1;
    transform: translateY(-2px);
}

.gfb-edge--prev { left: 0; border-radius: 0 5px 5px 0; }
.gfb-edge--next { right: 0; border-radius: 5px 0 0 5px; }

.gfb-toolbar {
    position: absolute;
    z-index: 50;
    left: 0;
    right: 0;
    bottom: 0;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 12px;
    color: var(--gfb-text);
    background: var(--gfb-toolbar);
    border-top: 1px solid var(--gfb-toolbar-border);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, .18);
}

.gfb-toolbar__group { display: flex; align-items: center; gap: 2px; }

.gfb-tool,
.gfb-icon-btn {
    appearance: none;
    border: 0;
    outline: 0;
    background: transparent;
    color: #ddd;
    cursor: pointer;
}

.gfb-tool {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border-radius: 3px;
    font-size: 24px;
    line-height: 1;
    text-decoration: none;
    transition: background .14s ease, color .14s ease;
}

.gfb-tool:hover,
.gfb-tool:focus-visible { color: #fff; background: rgba(255, 255, 255, .1); }
.gfb-tool--link { text-decoration: none !important; }

.gfb-page-status {
    height: 30px;
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 4px;
    padding: 0 8px;
    color: #aaa;
    font-size: 12px;
}

.gfb-page-input {
    width: 42px;
    height: 26px;
    padding: 0 3px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 2px;
    outline: 0;
    background: #2b2b2b;
    color: #fff;
    text-align: center;
    font-size: 12px;
    user-select: text;
}

.gfb-page-input::-webkit-inner-spin-button,
.gfb-page-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.gfb-separator {
    width: 1px;
    height: 23px;
    margin: 0 4px;
    background: rgba(255, 255, 255, .14);
}

.gfb-loading {
    position: absolute;
    z-index: 100;
    inset: 0 0 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    background: #252525;
    color: #ddd;
    font-size: 13px;
    transition: opacity .25s ease, visibility .25s ease;
}

.gfb-overlay.is-ready .gfb-loading {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.gfb-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(255, 255, 255, .18);
    border-top-color: #eee;
    border-radius: 50%;
    animation: gfb-spin .8s linear infinite;
}

@keyframes gfb-spin { to { transform: rotate(360deg); } }

/* ---------------- thumbnails ---------------- */

.gfb-thumbs {
    position: absolute;
    z-index: 78;
    top: 0;
    bottom: 54px;
    left: 0;
    width: 250px;
    display: flex;
    flex-direction: column;
    background: rgba(24, 24, 24, .97);
    border-right: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 10px 0 28px rgba(0, 0, 0, .25);
    transform: translateX(-101%);
    transition: transform .22s ease;
}

.gfb-overlay.thumbs-open .gfb-thumbs { transform: translateX(0); }

.gfb-thumbs__head {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    color: #eee;
    font-size: 13px;
}

.gfb-icon-btn { width: 32px; height: 32px; font-size: 23px; }

.gfb-thumbs__grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
}

/* The theme styles bare <button> elements (overflow:hidden, single line-box
   height), which collapsed these to ~16px. The box is pinned to the page ratio
   so it no longer depends on how the theme treats buttons. */
.gfb-thumbs__grid .gfb-thumb {
    display: block !important;
    position: relative;
    height: auto !important;
    overflow: visible !important;
    aspect-ratio: 1900 / 1344;
    border: 1px solid rgba(255, 255, 255, .13);
    padding: 0;
    background: #333;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .22);
}

.gfb-thumbs__grid .gfb-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.gfb-thumb span {
    position: absolute;
    right: 4px;
    bottom: 4px;
    min-width: 20px;
    padding: 2px 4px;
    background: rgba(0, 0, 0, .72);
    color: #fff;
    font-size: 10px;
    text-align: center;
}

.gfb-thumb.is-active { outline: 2px solid #eee; outline-offset: 1px; }

@media (max-width: 767px) {
    .gfb-stage { inset: 54px 0 50px; padding: 8px 6px 12px; }
    .gfb-toolbar { height: 50px; gap: 1px; padding-inline: 4px; }
    .gfb-tool { width: 34px; height: 34px; font-size: 21px; }
    .gfb-toolbar [data-action="first"],
    .gfb-toolbar [data-action="last"] { display: none; }
    .gfb-separator { margin-inline: 1px; }
    .gfb-page-status { margin-inline: 0; gap: 4px; padding-inline: 3px; }
    .gfb-edge { width: 34px; height: 74px; opacity: .12; }
    .gfb-edge span { font-size: 32px; }
    .gfb-thumbs { width: min(78vw, 280px); bottom: 50px; }
    .gfb-title { font-size: 10px; left: 16px; top: 20px; }
    /* Below the two-column breakpoint the row is wide again, so the pair still
       fits side by side - just centre it the way the theme centres its own. */
    .elementor-element-gsfbrow9 { --justify-content: center; }

    /* The theme gives its widget full width below this breakpoint
       (elementor-widget-mobile__width-inherit), which alone would claim the
       whole line and push the catalog button off it. */
    .elementor-element-gsfbrow9 > .elementor-element {
        flex: 0 0 auto !important;
        width: auto !important;
    }

    .elementor-element-gsfbrow9 .btn {
        padding-left: 11px !important;
        padding-right: 13px !important;
        font-size: 12.5px !important;
    }

    .elementor-element-gsfbrow9 .btn.pxl-icon--left svg,
    .elementor-element-gsfbrow9 .btn.pxl-icon--left i {
        margin-right: 8px !important;
    }
}
