:root {
    --qc-orange-soft: #fff0e7;
    --qc-muted: #68707a;
    --qc-panel: #ffffff;
    --qc-border: rgba(30, 30, 30, 0.10);
    --qc-shadow: 0 18px 46px rgba(30, 30, 30, 0.12);

    /* Native Screenshot-Grösse.
     *      Die Screenshot-Card wird dadurch auf Bildbreite + Padding/Border begrenzt. */
    --ref-shot-native-width: 1126px;
    --ref-shot-card-padding: 7px;
    --ref-shot-card-max-width: 1142px; /* 1126 + 2*7px padding + ca. 2px border */
}

/* ============================================================
 *  Basis: Referenzseite innerhalb des bestehenden Startseiten-Carousels
 *  ============================================================ */
main {
    background: #ffffff;
}

body.referenzen-page main {
    justify-content: flex-start;
    align-items: stretch;
}

body.referenzen-page .references-carousel {
    width: 100%;
    margin: 0;
}

body.referenzen-page .carousel {
    margin-top: 0;
}

.referenzen-page .carousel,
.referenzen-page .carousel-slide,
.referenzen-page .carousel-item,
.referenzen-page .referenzen-slide {
    background: #ffffff !important;
}

.referenzen-page .carousel-item {
    color: var(--qc-dark);
    font-family: 'Rajdhani', 'Gudea', Arial, sans-serif;
    text-align: left;
    padding: 0 !important;
    box-sizing: border-box;
    align-items: stretch;
    justify-content: stretch;
    font-size: inherit !important;
}

.referenzen-page .carousel-item p {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* ============================================================
 *  Slide-Grundfläche
 *
 *  Layout-Steuerung im HTML:
 *  1) Single Box ohne Logozeile:
 *     class="referenzen_slide_container ref-layout-single ref-no-logo-strip" data-no-logo-strip="true"
 *
 *  2) Single Box mit Logozeile:
 *     class="referenzen_slide_container ref-layout-single"
 *
 *  3) 2-teilig ohne Logozeile:
 *     class="referenzen_slide_container ref-layout-split ref-no-logo-strip" data-no-logo-strip="true"
 *
 *  4) 2-teilig mit Logozeile:
 *     class="referenzen_slide_container ref-layout-split"
 *  ============================================================ */
.referenzen_slide_container {
    width: 100vw;
    height: 100%;
    max-height: none;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    isolation: isolate;
}

.ref-overlay-grid {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    display: grid;
    grid-template-rows: minmax(0, 1fr) clamp(74px, 8.6dvh, 112px);
    row-gap: clamp(18px, 2.2dvh, 34px);
    padding: clamp(8px, 1.2vw, 24px) clamp(42px, 5vw, 96px) clamp(8px, 1.3vw, 22px);
    background: transparent;
}

/* Ohne Logozeile: Hauptbereich nutzt die komplette Slide-Höhe */
.referenzen_slide_container.ref-no-logo-strip .ref-overlay-grid,
.referenzen_slide_container[data-no-logo-strip="true"] .ref-overlay-grid {
    grid-template-rows: minmax(0, 1fr);
    row-gap: 0;
}

.referenzen_slide_container.ref-no-logo-strip .ref-logo-strip,
.referenzen_slide_container[data-no-logo-strip="true"] .ref-logo-strip {
    display: none !important;
}

/* ============================================================
 *  Layout 1/2: Single Box, zentral
 *  ============================================================ */
.ref-layout-single .ref-overlay-grid {
    grid-template-columns: 1fr;
    place-items: center;
}

.ref-single-box {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    justify-self: center;

    width: min(1180px, 92vw);
    box-sizing: border-box;
    display: grid;
    grid-template-columns: clamp(140px, 17vw, 260px) minmax(0, 1fr);
    gap: clamp(28px, 4vw, 70px);
    align-items: center;

    padding: clamp(28px, 4vw, 68px);
    background: #ffffff;
    border: 1px solid var(--qc-border);
    border-radius: clamp(22px, 2.2vw, 34px);
    box-shadow: var(--qc-shadow);
}

.ref-quote-photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center center;
    border-radius: 50%;
    box-shadow: 0 14px 34px rgba(30, 30, 30, 0.14);
    border: 2px solid var(--qc-orange);
}

.ref-single-text {
    min-width: 0;
}

/* ============================================================
 *  Layout 3/4: Split-Layout, Hauptteil links und Seitenteil rechts
 *  ============================================================ */
.ref-layout-split .ref-overlay-grid,
.referenzen_slide_container:not(.ref-layout-single) .ref-overlay-grid {
    grid-template-columns: clamp(340px, 30vw, 520px) minmax(0, 1fr);
    column-gap: clamp(18px, 2vw, 38px);
    align-items: stretch;
}

/* Desktop: gesamtes 2-Panel-Layout auf 80vw begrenzen und vertikal zentrieren */
@media (min-width: 1181px) {
    .ref-layout-split .ref-overlay-grid,
    .referenzen_slide_container:not(.ref-layout-single) .ref-overlay-grid {
        width: 80vw;
        margin-left: auto;
        margin-right: auto;
        align-items: center;
        box-sizing: border-box;
    }
}

.ref-content-card {
    grid-column: 1;
    grid-row: 1;
    align-self: stretch;

    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: clamp(10px, 0.8vw, 14px);

    width: 100%;
    max-width: 520px;
    min-height: 0;
    padding: clamp(10px, 1vw, 20px) 0;
    border: none;
    background: transparent;
}

.ref-side-panel {
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
    justify-self: stretch;

    display: flex;
    flex-direction: column;
    justify-content: stretch;
    align-items: stretch;
    gap: clamp(8px, 0.8vw, 14px);

    width: 100%;
    min-width: 0;
    min-height: 0;
}

@media (min-width: 1181px) {
    .ref-layout-split .ref-content-card,
    .referenzen_slide_container:not(.ref-layout-single) .ref-content-card,
    .ref-layout-split .ref-side-panel,
    .referenzen_slide_container:not(.ref-layout-single) .ref-side-panel {
        align-self: center;
        justify-content: center;
    }
}

.ref-side-panel > .ref-screenshot-card,
.ref-side-panel > .ref-shot-grid {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    align-self: stretch;
}

/* Screenshot-Card nicht über native Bildbreite hinaus skalieren.
 *  Auf kleineren Screens bleibt sie automatisch 100% der verfügbaren Breite. */
.ref-side-panel > .ref-screenshot-card {
    max-width: var(--ref-shot-card-max-width);
    align-self: center;
}

/* ============================================================
 *  Screenshot-Karten und animiertes Poster/WebP
 *  ============================================================ */
.ref-screenshot-card,
.ref-shot-mini {
    width: 100%;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;

    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;

    padding: var(--ref-shot-card-padding);
    background: #ffffff;
    border: 1px solid var(--qc-border);
    border-radius: clamp(22px, 2.2vw, 34px);
    box-shadow: var(--qc-shadow);
    overflow: hidden;
}

.ref-browser-topbar {
    display: none;
}

.ref-screenshot-card img,
.ref-shot-mini img,
.ref-animated-shot img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: contain;
    object-position: var(--shot-position, center center);
    background: #ffffff;
}

.ref-screenshot-card p,
.ref-shot-mini p {
    margin: 9px 0 0;
    color: #4b5563;
    font-family: 'Gudea', Arial, sans-serif;
    font-size: 12.5px;
    line-height: 1.32;
}

.ref-shot-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    height: 100%;
    min-height: 0;
    align-items: stretch;
}

.ref-animated-shot {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: #ffffff;
}

.ref-animated-poster {
    position: relative;
    z-index: 1;
}

.ref-animated-webp {
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.45s ease;
    pointer-events: none;
}

.ref-animated-webp.is-loaded {
    opacity: 1;
    visibility: visible;
}

/* Spezielle Card: Bild + Caption als Gruppe, Bild wird höhenstabil begrenzt */
.ref-screenshot-card.ref-screenshot-centered {
    height: 100%;
    max-height: 100%;
    min-height: 0;

    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: center;
    align-items: center;
    gap: 0;
    overflow: hidden;
}

.ref-screenshot-card.ref-screenshot-centered .ref-animated-shot {
    grid-row: 1;
    align-self: center;

    width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;

    aspect-ratio: auto;
    overflow: hidden;
}

.ref-screenshot-card.ref-screenshot-centered .ref-animated-shot img {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: var(--shot-position, center center);
}

.ref-screenshot-card.ref-screenshot-centered .ref-animated-webp {
    position: absolute;
    inset: 0;
}

.ref-screenshot-card.ref-screenshot-centered > p {
    grid-row: 2;
    margin: 0;
    align-self: start;
}

/* Desktop-Höhe der zentrierten Screenshot-Card */
@media (min-width: 1181px) {
    .ref-layout-split .ref-side-panel > .ref-screenshot-card.ref-screenshot-centered {
        flex: 0 1 auto;
        height: clamp(360px, 62dvh, 720px);
        max-height: calc(100dvh - 180px);
        align-self: center;
    }
}

/* ============================================================
 *  Dynamisches Logo-Band
 *  ============================================================ */
.ref-logo-strip {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: stretch;

    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;

    display: flex;
    align-items: center;
    background: #ffffff !important;
    opacity: 1 !important;
}

.ref-logo-track {
    display: flex;
    align-items: center;
    width: max-content;
    animation: refLogoLoop 10s linear infinite;
    will-change: transform;
}

.ref-logo-strip:hover .ref-logo-track {
    animation-play-state: paused;
}

.ref-logo-group {
    display: flex;
    align-items: center;
    gap: clamp(34px, 5vw, 84px);
    padding-right: clamp(34px, 5vw, 84px);
    flex: 0 0 auto;
}

.ref-logo-item {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    height: 100%;
}

.ref-logo-item img {
    display: block;
    height: clamp(52px, 6.6dvh, 88px);
    width: auto;
    max-width: clamp(120px, 16vw, 240px);
    object-fit: contain;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

@keyframes refLogoLoop {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ============================================================
 *  Textbausteine
 *  ============================================================ */
.ref-topline {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ref-kicker {
    margin: 0;
    color: var(--qc-orange);
    font-family: 'Rajdhani', sans-serif;
    font-size: clamp(18px, 2.6dvh, 34px) !important;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.referenzen_slide_container h1,
.referenzen_slide_container h2,
.referenzen_slide_container h3 {
    color: var(--qc-dark);
    padding: 0;
    margin: 0;
    line-height: 1.02;
    font-weight: 800;
}

.referenzen_slide_container h1 {
    font-size: clamp(30px, 3vw, 58px);
}

.referenzen_slide_container h2 {
    font-size: clamp(20px, 2.5vw, 44px);
}

.referenzen-page .carousel-item .ref-subtitle {
    margin: 0;
    max-width: 16em;
    color: #38414c;
    font-family: 'Gudea', Arial, sans-serif;
    font-size: clamp(22px, 2.2vw, 38px);
    line-height: 1.20;
}

.ref-tech-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ref-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    border: 1px solid rgba(30, 30, 30, 0.10);
    background: #ffffff;
    color: var(--qc-dark);
    white-space: nowrap;
}

.ref-pill.large {
    padding: 9px 15px;
    font-size: clamp(14px, 1vw, 17px);
}

.ref-pill.orange {
    border-color: rgba(255, 102, 0, 0.34);
    background: var(--qc-orange-soft);
    color: #bd4800;
}

.ref-client-quote {
    position: relative;
    margin: 18px 0 0;
    padding: clamp(24px, 2.2vw, 38px) clamp(28px, 2.6vw, 46px);
    color: #1e1e1e;
    font-family: 'Gudea', sans-serif;
    line-height: 1.22;
    font-style: italic;
}

.referenzen-page .carousel-item .ref-client-quote p {
    margin: 0;
    text-align: left;
    hyphens: auto;
    overflow-wrap: break-word;
    word-break: normal;
    font-size: clamp(14px, 2vw, 24px) !important;
    max-width: 80em;
}

.ref-client-quote cite {
    display: block;
    margin-top: 8px;
    color: var(--qc-muted);
    font-style: normal;
    font-size: clamp(10px, 0.8vw, 14px);
}

.ref-client-quote::before,
.ref-client-quote::after {
    position: absolute;
    font-family: Georgia, serif;
    font-size: clamp(44px, 5vw, 82px);
    line-height: 1;
    color: rgba(255, 102, 0, 0.24);
    pointer-events: none;
}

.ref-client-quote::before {
    content: "“";
    top: -18px;
    left: 18px;
}

.ref-client-quote::after {
    content: "”";
    right: 20px;
    bottom: -4px;
}

.ref-impact-band {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.ref-impact-band div {
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(30, 30, 30, 0.08);
}

.ref-impact-band b {
    display: block;
    color: var(--qc-orange);
    font-size: 22px;
    line-height: 1;
}

.ref-impact-band span {
    display: block;
    margin-top: 4px;
    color: var(--qc-muted);
    font-family: 'Gudea', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.25;
}

/* Sonstige Bausteine */
.spacer-normal { margin: 25px; }
.spacer-large { margin: 40px; }

.alt-text {
    font-size: 16px !important;
    color: #a0a0a0;
    margin: 0;
    padding: 0;
    line-height: 18px;
}

.referenzen-empty-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 48px;
}

.referenzen-empty-container code {
    background: #f1f3f5;
    color: #bd4800;
    padding: 3px 7px;
    border-radius: 6px;
}

/* ============================================================
 *  Tablet
 *  ============================================================ */
@media (max-width: 1180px) {
    .ref-single-box {
        border: none;
        box-shadow: none;
    }

    .ref-content-card {
        /*display: none;*/
    }

    .ref-subtitle {
        display: none;
    }

    .referenzen-page .image-container img {
        height: 30px;
        max-height: 30px;
        width: auto;
        object-fit: contain;
    }

    .referenzen-page .ref-content-card .image-container {
        height: 70px;
    }

    .referenzen-page .ref-content-card .image-gallery {
        padding-top: 0;
        margin-top: 0;
        margin-bottom: 0;
        gap: 12px;
    }

    .referenzen-page .ref-content-card .image-gallery + .image-gallery {
        margin-top: -25px;
    }

    .spacer-normal,
    .spacer-large {
        margin: 5px;
    }

    .referenzen_slide_container {
        width: 100vw;
        height: 100%;
        min-height: 100%;
        overflow-y: auto;
    }

    .ref-overlay-grid,
    .ref-layout-split .ref-overlay-grid,
    .referenzen_slide_container:not(.ref-layout-single) .ref-overlay-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        width: 100%;
        height: auto;
        min-height: 100%;
        row-gap: clamp(18px, 3vw, 32px);
        padding: clamp(10px, 3vw, 28px) clamp(36px, 6vw, 72px) clamp(14px, 3vw, 32px);
    }

    .ref-content-card,
    .ref-side-panel,
    .ref-logo-strip {
        grid-column: 1;
    }

    .ref-content-card {
        grid-row: 1;
        max-width: 680px;
    }

    .ref-side-panel {
        grid-row: 2;
        display: block;
        width: 100%;
    }

    .ref-logo-strip {
        grid-row: 3;
        min-height: 88px;
    }

    .referenzen_slide_container.ref-no-logo-strip .ref-overlay-grid,
    .referenzen_slide_container[data-no-logo-strip="true"] .ref-overlay-grid {
        grid-template-rows: auto auto;
    }

    .referenzen_slide_container.ref-no-logo-strip .ref-side-panel,
    .referenzen_slide_container[data-no-logo-strip="true"] .ref-side-panel {
        grid-row: 2;
    }

    .ref-side-panel > .ref-screenshot-card,
    .ref-side-panel > .ref-shot-grid {
        width: 100%;
        max-width: 100%;
        align-self: stretch;
    }

    .ref-screenshot-card.ref-screenshot-centered {
        width: 100%;
        height: auto;
        min-height: 0;
        max-height: none;

        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
    }

    .ref-screenshot-card.ref-screenshot-centered .ref-animated-shot {
        width: 100%;
        height: auto;
        min-height: 0;
        max-height: none;
        aspect-ratio: 1126 / 923;
        flex: 0 0 auto;
    }

    .ref-screenshot-card.ref-screenshot-centered .ref-animated-shot img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center center;
    }

    .ref-screenshot-card.ref-screenshot-centered > p {
        margin-top: 9px;
    }

    .ref-single-box {
        grid-template-columns: 1fr;
        max-width: 760px;
        text-align: left;
    }

    .ref-quote-photo {
        width: clamp(90px, 23vw, 140px);
        justify-self: center;
    }
}

/* ============================================================
 *  Mobile
 *  ============================================================ */
@media (max-width: 760px) {
    .ref-overlay-grid,
    .ref-layout-split .ref-overlay-grid,
    .referenzen_slide_container:not(.ref-layout-single) .ref-overlay-grid {
        padding: 8px 16px 14px;
        row-gap: 18px;
    }

    .ref-logo-strip {
        height: 80px;
        min-height: 80px;
    }

    .ref-logo-group {
        gap: 28px;
        padding-right: 28px;
    }

    .ref-logo-item img {
        height: 66px;
        max-width: 180px;
    }

    .ref-content-card {
        padding: 18px 0;
    }

    .ref-topline {
        align-items: flex-start;
        flex-direction: column;
    }

    .ref-impact-band,
    .ref-shot-grid {
        grid-template-columns: 1fr;
    }

    .ref-screenshot-card,
    .ref-shot-mini {
        padding: 5px;
        border-radius: 14px;
        box-shadow: 0 10px 24px rgba(30, 30, 30, 0.11);
    }

    .referenzen-page .carousel-item .referenzen_slide_container h1 {
        font-size: clamp(26px, 8vw, 40px) !important;
    }

    .referenzen-page .carousel-item .ref-subtitle {
        font-size: clamp(18px, 5vw, 28px);
    }

    .referenzen-page .carousel-item .ref-client-quote p {
        font-size: clamp(17px, 4.6vw, 26px) !important;
    }

    .referenzen-page .carousel-controls button {
        display: none;
    }
}
