/* BmaxxCatalogs: Blätterkatalog. Eigenständige Seite, keine Abhängigkeit vom Shop-Theme. */

:root {
    --fb-accent: #2F7FB0;
    --fb-ink: #2b2f33;
    --fb-soft: #68707a;
    --fb-line: #dfe3e7;
    --fb-stage: #e6e9ec;
    --fb-bar: 56px;
    --fb-foot: 48px;
    --fb-flip: 620ms;
}

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

html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    color: var(--fb-ink);
    background: var(--fb-stage);
    -webkit-text-size-adjust: 100%;
}

[hidden] {
    display: none !important;
}

.fb {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    /* --fb-head: Höhe des Kopfbereichs. Auf schmalen Bildschirmen kommt die Zeile mit dem Anfrage-Hinweis dazu */
    grid-template-rows: var(--fb-head, var(--fb-bar)) minmax(0, 1fr) var(--fb-foot);
}

/* offene Seitenübersicht: auf breiten Bildschirmen rückt das Heft zur Seite */
@media (min-width: 900px) {
    .fb.has-thumbs .fb-stage {
        margin-right: 380px;
    }
}

/* ---------- Kopfleiste ---------- */

.fb-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px 0 6px;
    padding-left: max(6px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    background: #fff;
    border-bottom: 1px solid var(--fb-line);
    z-index: 5;
}

/* Logo des Shops ganz links, führt zur Startseite */
.fb-bar.has-logo {
    padding-left: max(14px, env(safe-area-inset-left));
}

.fb-logo {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding-right: 14px;
    border-right: 1px solid var(--fb-line);
    transition: opacity .15s ease;
}

.fb-logo img {
    display: block;
    width: auto;
    height: 20px;
    max-width: 190px;
    object-fit: contain;
}

.fb-logo:hover {
    opacity: .72;
}

.fb-bar.has-logo .fb-back {
    margin-left: -6px;
}

.fb-back {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 40px;
    max-width: 30vw;
    padding: 0 12px 0 6px;
    color: var(--fb-accent);
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
}

.fb-back span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fb-back:hover {
    background: #f1f4f6;
}

.fb-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fb-title span {
    font-weight: 400;
    color: var(--fb-soft);
}

/* ---------- Anfrage-Hinweis ---------- */

.fb-cta {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    margin: 0 4px;
}

.fb-cta__text {
    max-width: 34ch;
    font-size: 14px;
    color: var(--fb-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fb-cta__btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px 0 12px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    background: var(--fb-accent);
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.fb-cta__btn:hover,
.fb-cta__btn[aria-expanded="true"] {
    filter: brightness(.9);
}

/* neben der Anfrage tritt der Download zurück */
.fb.has-cta .fb-tool--text {
    color: var(--fb-accent);
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--fb-accent);
}

.fb.has-cta .fb-tool--text:hover {
    background: #f1f4f6;
    filter: none;
}

.fb-contact {
    position: absolute;
    top: calc(var(--fb-head, var(--fb-bar)) + 8px);
    right: 12px;
    z-index: 7;
    width: min(340px, calc(100% - 16px));
    max-height: calc(100% - var(--fb-head, var(--fb-bar)) - 16px);
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border: 1px solid var(--fb-line);
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(25, 35, 45, .22);
}

.fb-contact h2 {
    margin: 0 28px 6px 0;
    font-size: 17px;
    font-weight: 600;
}

.fb-contact p {
    margin: 0 0 12px;
    color: var(--fb-soft);
}

.fb-contact__ref {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    background: #f3f5f7;
    border-radius: 6px;
}

.fb-contact__ref strong {
    font-weight: 600;
    color: var(--fb-ink);
}

.fb-contact__main,
.fb-contact__alt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
}

.fb-contact__main {
    color: #fff;
    background: var(--fb-accent);
}

.fb-contact__main:hover {
    filter: brightness(.9);
}

.fb-contact__alt {
    justify-content: flex-start;
    margin-top: 8px;
    color: var(--fb-ink);
    border: 1px solid var(--fb-line);
}

.fb-contact__alt:hover {
    border-color: var(--fb-accent);
    color: var(--fb-accent);
}

.fb-contact__alt span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fb-contact__close {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--fb-soft);
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.fb-contact__close:hover {
    background: #f1f4f6;
}

/* breite Bildschirme: Wird es eng, gibt zuerst der Titel des Katalogs nach, der Satz bleibt ganz lesbar */
@media (min-width: 1281px) {
    .fb.has-cta .fb-title {
        min-width: 180px;
    }

    /* der Satz ist auf 34 Zeichen Breite begrenzt, ein längerer Text wird dort abgeschnitten */
    .fb.has-cta .fb-cta {
        flex-shrink: 0;
    }
}

/* mittlere Breite: nur die Schaltfläche, sonst bliebe für den Titel des Katalogs kaum Platz */
@media (max-width: 1280px) {
    .fb-cta__text {
        display: none;
    }
}

.fb-tools {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 2px;
}

.fb-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    font: inherit;
    font-weight: 600;
    color: var(--fb-ink);
    text-decoration: none;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.fb-tool:hover,
.fb-tool[aria-expanded="true"] {
    background: #f1f4f6;
}

.fb-tool:disabled {
    color: #b4bbc2;
    cursor: default;
    background: transparent;
}

/* Suche: ab genug Breite mit Beschriftung, damit sie neben den Lupen zum Vergrößern auffällt */
.fb-tool--search {
    position: relative;
}

.fb-tool--search span {
    display: none;
}

.fb-tool[aria-busy="true"] {
    opacity: .55;
}

@media (min-width: 1281px) {
    .fb-tool--search {
        padding: 0 12px 0 8px;
    }

    .fb-tool--search span {
        display: inline;
    }
}

.fb-tool--text {
    padding: 0 14px 0 10px;
    margin-left: 6px;
    color: #fff;
    background: var(--fb-accent);
}

.fb-tool--text:hover {
    background: var(--fb-accent);
    filter: brightness(.9);
}

svg {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--fb-accent);
    outline-offset: 2px;
}

/* ---------- Bühne ---------- */

.fb-stage {
    position: relative;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    background:
        radial-gradient(120% 90% at 50% 0%, #f4f6f8 0%, var(--fb-stage) 62%, #d9dde1 100%);
}

.fb-zoom {
    position: absolute;
    inset: 0;
    transform-origin: 0 0;
    will-change: transform;
}

.fb-zoom.is-animated {
    transition: transform 220ms ease;
}

.fb-book {
    position: absolute;
    perspective: 2600px;
    transition: transform var(--fb-flip) cubic-bezier(.35, .08, .25, 1);
}

.fb-book.is-instant {
    transition: none;
}

.fb-page {
    position: absolute;
    top: 0;
    height: 100%;
    background: #fff;
    overflow: hidden;
}

.fb-page.is-empty {
    visibility: hidden;
}

.fb-page img,
.fb-flip__face img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* Vorschau in geringer Auflösung, bis das scharfe Bild da ist */
.fb-page img.is-preview,
.fb-flip__face img.is-preview {
    filter: blur(3px);
}

/* Schatten des Buchs: liegt hinter den Seiten, damit er im Falz nicht doppelt wirkt */
.fb-page--left {
    box-shadow: -10px 16px 34px rgba(25, 35, 45, .20);
}

.fb-page--right,
.fb-page--single {
    box-shadow: 10px 16px 34px rgba(25, 35, 45, .20);
}

.fb-page--single {
    box-shadow: 0 16px 34px rgba(25, 35, 45, .22);
}

/* Falz: leichte Schattierung zur Buchmitte */
.fb-page--left::after,
.fb-page--right::after,
.fb-flip__face::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 9%;
    pointer-events: none;
}

.fb-page--left::after,
.fb-flip__face--left::after {
    right: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .04) 62%, rgba(0, 0, 0, .12) 100%);
}

.fb-page--right::after,
.fb-flip__face--right::after {
    left: 0;
    background: linear-gradient(to left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .04) 62%, rgba(0, 0, 0, .12) 100%);
}

/* ---------- Umblättern ---------- */

.fb-flip {
    position: absolute;
    top: 0;
    height: 100%;
    z-index: 3;
    transform-style: preserve-3d;
    transition: transform var(--fb-flip) cubic-bezier(.35, .08, .25, 1);
}

.fb-flip--next {
    transform-origin: left center;
}

.fb-flip--prev {
    transform-origin: right center;
}

.fb-flip--next.is-turned {
    transform: rotateY(-180deg);
}

.fb-flip--prev.is-turned {
    transform: rotateY(180deg);
}

.fb-flip__face {
    position: absolute;
    inset: 0;
    background: #fff;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.fb-flip__face--back {
    transform: rotateY(180deg);
}

/* Abdunklung der sich drehenden Seite, verstärkt den räumlichen Eindruck */
.fb-flip__shade {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: #000;
    opacity: 0;
    animation: fb-shade var(--fb-flip) ease-in-out;
}

@keyframes fb-shade {
    0% { opacity: 0; }
    50% { opacity: .16; }
    100% { opacity: 0; }
}

/* ---------- Pfeile ---------- */

.fb-nav {
    position: absolute;
    top: 50%;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin-top: -23px;
    padding: 0;
    color: var(--fb-ink);
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--fb-line);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(25, 35, 45, .14);
    cursor: pointer;
    transition: opacity .15s, background .15s;
}

.fb-nav:hover {
    color: #fff;
    background: var(--fb-accent);
    border-color: var(--fb-accent);
}

.fb-nav:disabled {
    opacity: 0;
    pointer-events: none;
}

.fb-nav--prev {
    left: max(12px, env(safe-area-inset-left));
}

.fb-nav--next {
    right: max(12px, env(safe-area-inset-right));
}

.fb-stage.is-zoomed .fb-nav {
    opacity: 0;
    pointer-events: none;
}

.fb-stage.is-zoomed {
    cursor: grab;
}

.fb-stage.is-dragging {
    cursor: grabbing;
}

/* ---------- Fußleiste ---------- */

.fb-foot {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    background: #fff;
    border-top: 1px solid var(--fb-line);
    z-index: 5;
}

.fb-slider {
    flex: 1 1 auto;
    min-width: 0;
    height: 24px;
    margin: 0;
    accent-color: var(--fb-accent);
    cursor: pointer;
}

.fb-pos {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--fb-soft);
    white-space: nowrap;
}

.fb-pos__input {
    width: 64px;
    height: 32px;
    padding: 0 6px;
    font: inherit;
    font-weight: 600;
    text-align: center;
    color: var(--fb-ink);
    background: #fff;
    border: 1px solid #b9c1c9;
    border-radius: 4px;
}

/* ---------- Seitenübersicht ---------- */

.fb-thumbs {
    position: absolute;
    top: var(--fb-head, var(--fb-bar));
    bottom: var(--fb-foot);
    right: 0;
    z-index: 6;
    width: min(380px, 100%);
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 14px 12px;
    align-content: start;
    background: #fff;
    border-left: 1px solid var(--fb-line);
    box-shadow: -8px 0 24px rgba(25, 35, 45, .12);
}

.fb-thumb {
    display: block;
    padding: 0;
    font: inherit;
    font-size: 12px;
    color: var(--fb-soft);
    text-align: center;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.fb-thumb img {
    display: block;
    width: 100%;
    height: auto;
    margin-bottom: 4px;
    background: #f1f4f6;
    border: 1px solid var(--fb-line);
}

.fb-thumb:hover img {
    border-color: var(--fb-accent);
}

.fb-thumb.is-current {
    color: var(--fb-ink);
    font-weight: 600;
}

.fb-thumb.is-current img {
    outline: 2px solid var(--fb-accent);
    outline-offset: 1px;
    border-color: var(--fb-accent);
}

/* ---------- schmale Bildschirme ---------- */

@media (max-width: 640px) {
    :root {
        --fb-bar: 50px;
        --fb-foot: 46px;
    }

    .fb-back span,
    .fb-tool--zoom,
    .fb-pos span:first-child {
        display: none;
    }

    .fb-back {
        padding: 0 6px;
    }

    .fb-title {
        font-size: 15px;
    }

    .fb-nav {
        display: none;
    }

    .fb-foot {
        gap: 10px;
        padding: 0 10px;
    }

    .fb-pos__input {
        width: 52px;
    }

    /* mit der Suche wird es in der Leiste eng: Download ohne Beschriftung, Vollbild entfällt */
    .fb.has-searchbtn .fb-tool--text {
        padding: 0 8px;
        margin-left: 2px;
    }

    .fb.has-searchbtn .fb-tool--text span,
    .fb.has-searchbtn .fb-tool[data-fb="fullscreen"] {
        display: none;
    }
}

/* Mit Logo wird es in der Leiste eng: Bis zur Breite eines Tablets stehen Logo und Titel
   übereinander, links der Pfeil zurück, rechts die Werkzeuge */
@media (max-width: 1000px) {
    .fb-bar.has-logo {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-rows: 24px 16px;
        align-content: center;
        align-items: center;
        gap: 0 6px;
        padding-left: max(6px, env(safe-area-inset-left));
    }

    .fb-bar.has-logo .fb-back {
        grid-column: 1;
        grid-row: 1 / 3;
        align-self: center;
        margin-left: 0;
    }

    .fb-logo {
        grid-column: 2;
        grid-row: 1;
        justify-self: start;
        align-items: flex-end;
        height: 24px;
        padding: 0 0 4px;
        border-right: 0;
    }

    .fb-logo img {
        height: 14px;
        max-width: 150px;
    }

    .fb-bar.has-logo .fb-title {
        grid-column: 2;
        grid-row: 2;
        font-size: 12px;
        font-weight: 500;
        line-height: 16px;
        color: var(--fb-soft);
    }

    .fb-bar.has-logo .fb-tools {
        grid-column: 3;
        grid-row: 1 / 3;
        align-self: center;
    }
}

/* Bis zur Breite eines Tablets steht der Anfrage-Hinweis in einer eigenen Zeile unter der Kopfleiste */
@media (max-width: 1000px) {
    .fb.has-cta {
        --fb-cta: 44px;
        --fb-head: calc(var(--fb-bar) + var(--fb-cta));
    }

    .fb.has-cta .fb-bar {
        position: relative;
        padding-bottom: var(--fb-cta);
    }

    .fb-cta {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        justify-content: space-between;
        height: var(--fb-cta);
        margin: 0;
        padding: 0 12px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        background: #f4f7f9;
        border-top: 1px solid var(--fb-line);
    }

    /* der Satz darf auf dem Handy in zwei Zeilen stehen, statt abgeschnitten zu werden */
    .fb-cta__text {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        max-width: none;
        font-size: 13px;
        line-height: 1.25;
        color: var(--fb-ink);
        white-space: normal;
    }

    .fb-cta__btn {
        height: 32px;
        padding: 0 12px 0 8px;
        font-size: 13px;
    }

    .fb-cta__btn svg {
        width: 18px;
        height: 18px;
    }
}

/* Handy im Querformat: wenig Höhe, die Zeile wird flacher */
@media (max-width: 1000px) and (max-height: 460px) {
    .fb.has-cta {
        --fb-cta: 36px;
    }

    .fb-cta__btn {
        height: 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --fb-flip: 1ms;
    }

    .fb-zoom.is-animated {
        transition: none;
    }
}

/* Finger statt Maus: Bedienelemente mindestens 44 Pixel groß */
@media (pointer: coarse) {
    :root {
        --fb-bar: 56px;
        --fb-foot: 56px;
    }

    .fb-back {
        min-width: 44px;
        height: 44px;
        justify-content: center;
    }

    .fb-tool {
        min-width: 44px;
        height: 44px;
    }

    .fb-slider {
        height: 44px;
    }

    .fb-pos__input {
        height: 44px;
        font-size: 16px;      /* ab 16 Pixel zoomt iOS beim Antippen nicht in die Seite */
    }
}
