:root {
    --container-max: 1300px;
    --space-1: .5rem;
    --space-2: 1rem;
    --space-3: 1.5rem;
    --space-4: 2rem;
    --radius: 8px;
    --feature-gap: 4rem;
}

.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--space-2);
    box-sizing: border-box;
}

.ratio-16x9 {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: clip;
}

.ratio-16x9 > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* HERO mit Overlay ------------------------------------------------------------------------------ */
.ref-hero {
    position: relative;
    height: clamp(520px, 60vw, 980px);
}
    .ref-hero > img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .ref-hero.ratio-16x9 {
        aspect-ratio: auto;
    }

.ref-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--theim-black) 0%, rgba(26, 26, 24, 0) 60%);
    pointer-events: none;
    z-index: 1;
}

.ref-hero__content {
    position: absolute;
    inset-inline: 0;
    bottom: clamp(4rem, 2vw, var(--space-4));
    z-index: 2;
}

/* FEATURE-BLOCK --------------------------------------------------------------------------------- */

.ref-feature {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: var(--feature-gap);
    
}

.ref-feature__media {
    margin: 0;
    border-radius: var(--radius);
    overflow: clip;
}
.ref-feature__media img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    background: var(--theim-black);
}

.ref-feature__text p {
    margin: 0;
}


/* GALERIE STATISCH -------------------------------------------------------------------------- */

/* Container steuert NUR die vertikalen Abstände */
.gfr {
    --gap: clamp(12px, 2vw, 24px);
    --row-h: clamp(220px, 32vw, 470px);
    display: grid;
    row-gap: var(--gap); /* Abstand zwischen den Reihen */
    padding-inline: 0;
    box-sizing: border-box;
}

    .gfr.container {
        padding-inline: var(--space-2);
    }

/* Reihen: KEINE Margins, nur das gap zwischen Bildern */
.gfr-row {
    display: flex;
    gap: var(--gap); /* Abstand zwischen Bildern in der Reihe */
    height: var(--row-h);
    margin: 0; /* <- wichtig: alte Margins killen */
    padding: 0;
}

/* Figures: Browser-Default-Margins auf 0 setzen */
.gfr-cell { /* figure.gfr-cell */
    margin: 0; /* <- wichtig */
    position: relative;
    flex: var(--w, 1) 1 0;
    min-width: 0;
    overflow: hidden;
    border-radius: 8px;
}

    .gfr-cell > img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

/* TEXTBLOCK --------------------------------------------------------------------------------- */

.ref-text p {
    max-width: 90ch;
}

/* GALERIE SWIPE ------------------------------------------------------------------------------ */

.ref-gallery__rail {
    --gutter-min: var(--space-2);
    --container-w: min(100svw - 2*var(--gutter-min), var(--container-max));
    --gutter: max(calc((100svw - var(--container-w)) / 2), var(--gutter-min));
    padding-inline-start: var(--gutter);
    padding-inline-end: 6rem;
    scroll-padding-left: var(--gutter);
    scroll-padding-right: var(--space-2);
    scrollbar-width: none;
    -ms-overflow-style: none;
    --measure: min(100svw - 2*var(--space-2), var(--container-max));
    grid-auto-columns: clamp( 260px, calc((var(--measure) - var(--feature-gap)) / 2), calc((var(--container-max) - var(--feature-gap)) / 2) );
    display: grid;
    grid-auto-flow: column;
    gap: var(--feature-gap);
    overflow-x: auto;
    padding-bottom: var(--space-1);
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: none;
    cursor: grab;
    overscroll-behavior-inline: contain;
}
.ref-gallery__rail.is-dragging {
    cursor: grabbing;
    user-select: none;
}
@supports not (width: 100svw) {
    .ref-gallery__rail {
        --container-w: min(100vw - 2*var(--gutter-min), var(--container-max));
        --gutter: max(calc((100vw - var(--container-w)) / 2), var(--gutter-min));
    }
}
.ref-gallery__rail::-webkit-scrollbar {
    width: 0;
    height: 0;
}
.ref-gallery__rail:focus {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

.ref-gallery__item {
    margin: 0;
    border-radius: var(--radius);
    overflow: clip;
    scroll-snap-align: none;
}

.ref-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* VIDEO-MODUL ------------------------------------------------------------------------- */
.ref-video {
    margin: 0;
}

/* Rahmen: nutzt deine ratio-16x9-Klasse */
.ref-video__frame {
    border-radius: var(--radius);
    overflow: clip;
    position: relative;
    background: #000; /* Letterboxing-Hintergrund */
    margin: 0;
}

/* Video füllt den Rahmen – wähle cover/contain je nach Wunsch */
.ref-video__el {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* zeigt das ganze Video; für randlos -> cover */
    display: block;
}

/* optionaler eigener Vollbild-Button (falls Browser keinen zeigt) */
.ref-video__fs {
    position: absolute;
    right: .5rem;
    bottom: .5rem;
    z-index: 3;
    padding: .4rem .5rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.35);
    background: rgba(0,0,0,.35);
    color: #fff;
    backdrop-filter: blur(4px);
    cursor: pointer;
}

    .ref-video__fs:hover {
        background: rgba(0,0,0,.55);
    }

/* Natives UA-Outline am Video selbst aus: */
.ref-video__el {
  outline: none;
}

/* Standard: beim Klick mit der Maus KEIN Rahmen am Frame: */
.ref-video__frame:focus-within {
  outline: none;
}

/* Nur bei Tastaturbedienung (Tab): roten Rahmen am ganzen Frame zeigen */
body.using-keyboard .ref-video__frame:focus-within {
  outline: 2px solid var(--theim-red);
  outline-offset: 6px;
  border-radius: var(--radius);
}

/* ZITAT ------------------------------------------------------------------------------- */

.ref-quote {
    --quote-bias: 130%;
    --quote-mark-size: clamp(160px, 22vw, 620px);
    --quote-left: clamp(24px, 6vw, 120px);
}

.ref-quote__panel {
    background: #fff;
    height: 0;
    overflow: hidden;
    will-change: height;
}

.ref-quote__inner {
    position: relative;
    display: grid;
    align-content: center; /* vertikale Zentrierung des Textblocks */
    padding-block: clamp(48px, 6vw, 120px); /* SYMMETRISCH oben/unten */
    padding-left: clamp(100px, 14vw, 280px);
    /* genug Raum, damit das große Zeichen NICHT abgeschnitten wird */
    min-height: clamp(300px, calc(var(--quote-mark-size) * 0.75), 680px);
}

/* Zeichen an die MITTE hängen – nicht mehr top-basiert */
.quote-mark {
    position: absolute;
    left: var(--quote-left);
    top: 50%; /* an der Mitte verankern */
    transform: translateY(calc(-1 * var(--quote-bias)));
    font-size: var(--quote-mark-size);
    line-height: .75;
    color: var(--theim-red, #FF6978);
    pointer-events: none;
    z-index: 0;
}

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

    .ref-quote__text .line {
        display: inline-block;
    }

/* PORTRAIT PM ------------------------------------------------------------------------------ */
.ratio-4x5 {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: clip;
}

.ratio-4x5 > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Stack-Utility für vertikale Abstände im Textblock */
.stack > * + * {
    margin-top: var(--space-2);
}

/* White stripe full-bleed */
.ref-contact {
    background: #fff; /* volle Seitenbreite weiß */
    color: var(--theim-black); /* Text dunkel auf hell */
    padding-block: clamp(54px, 8vw, 120px);
}

.ref-contact a {
    color: inherit;
    text-decoration: none;
}

.ref-contact a:hover {
    text-decoration: underline;
}

/* Grid innen auf Containerbreite */
.ref-contact__grid {
    display: grid;
    grid-template-columns: clamp(280px, 34vw, 400px) 1fr;
    gap: var(--feature-gap);
    align-items: center;
}

/* Bild-Styles */
.ref-contact__media {
    width: 100%;
    margin: 0;
    border-radius: var(--radius);
    overflow: clip;
}

.ref-contact .cookie-btn {
    border-color: var(--theim-black, #1A1A18);
    color: var(--theim-black, #1A1A18);
    background: transparent;
}

.ref-contact .cookie-btn:hover {
    background: var(--theim-black, #1A1A18);
    color: #fff;
}

/* Globaler Modul-Stack (ein Abstand für alle Module) -------------------------------------------------------- */

.ref-flow {
    --stack-gap: clamp(100px, 14vw, 160px);
}

    /* Alle direkten Kinder haben außen keine Margins */
    .ref-flow > * {
        margin-block: 0;
    }

    /* Schwacher Reset für Module, die intern eigene Margins gesetzt hatten */
    .ref-flow > :where(.ref-hero, .ref-feature, .ref-text, .ref-gallery, .gfr, .ref-quote, .ref-contact) {
        margin-block: 0;
    }

    /* Abstand NUR zwischen Nachbarn (oben/unten nicht doppelt) */
    .ref-flow > * + * {
        margin-block-start: calc(var(--stack-gap) * var(--gap-mult, 1));
    }

.case-back {
  --gap-mult: 0.4;
  text-align: center;
  margin-bottom: 5rem;
}

  .case-back .cookie-btn {
    text-decoration: none;
    display: inline-block;
  }


/* Breakpoint 1: grosse Desktops */
@media (max-width: 1400px) {
    :root {
        --container-max: 1150px;
        --feature-gap: 3rem;
    }

    .ref-hero__content {
        bottom: clamp(2rem, 1vw, var(--space-4));
    }
    .ref-contact__grid {
        grid-template-columns: auto 1fr; /* Breite folgt dem Figure */
    }
    .ref-contact {
        padding-block: clamp(44px, 6vw, 100px);
    }
    .ref-contact__media {
        max-width: 350px;
    }
}

/* Breakpoint 2: kleinere Desktops / große Tablets (≤1200px) */
@media (max-width: 1200px) {
    :root {
        --container-max: 950px;
        --feature-gap: 2.5rem;
    }
    .ref-hero__content {
        bottom: clamp(1rem, 0.5vw, var(--space-4));
    }
    .gfr {
        --row-h: clamp(200px, 30vw, 420px);
    }
    .ref-contact__media {
        max-width: 300px;
    }
}

/* Breakpoint 3: Tablets quer (≤992px) */
@media (max-width: 992px) {
    :root {
        --container-max: 750px;
        --feature-gap: 2rem;
    }
    .ref-hero__content {
        bottom: clamp(1rem, 0.5vw, var(--space-4));
    }
    .gfr {
        --row-h: clamp(180px, 28vw, 380px);
    }
    .ref-contact__media {
        max-width: 250px;
    }
}

/* Breakpoint 4: Tablets hoch / große Smartphones (≤768px) */
@media (max-width: 768px) {
    :root {
        --container-max: 650px;
    }
    .ref-hero__content {
        bottom: 0;
    }
    #main-content.ref-flow {
        padding-top: 130px;
        padding-top: calc(130px + env(safe-area-inset-top));
    }
    .ref-feature {
        grid-template-columns: 1fr;
        align-items: start;
    }
    .gfr-row {
        display: block;
        height: auto;
    }

    .gfr-cell {
        margin: 0 0 var(--gap) 0;
    }
        /* gleiche --gap wie oben */
        .gfr-cell:last-child {
            margin-bottom: 0;
        }

        .gfr-cell > img {
            position: static;
            width: 100%;
            height: auto;
        }

    .ref-quote__panel {
        height: auto; /* statt height:0 */
        overflow: visible; /* kein Clipping */
    }
}

/* Breakpoint 5: Smartphones (≤576px) */
@media (max-width: 576px) {
    :root {
        --container-max: 500px;
    }
    #main-content.ref-flow {
        padding-top: 100px;
        padding-top: calc(100px + env(safe-area-inset-top));
    }
    .ref-hero::after {
        background: linear-gradient(to top, var(--theim-black) 10%, rgba(26, 26, 24, 0) 80%);
    }
    .ref-contact__media {
        align-self: start;
    }
}

/* Breakpoint 6: sehr schmale Smartphones */
@media (max-width: 420px) {
    :root {
        --container-max: 350px;
    }
    #main-content.ref-flow {
        padding-top: 95px;
        padding-top: calc(95px + env(safe-area-inset-top));
    }
    .ref-hero::after {
        background: linear-gradient(to top, var(--theim-black) 15%, rgba(26, 26, 24, 0) 90%);
    }
    .ref-contact__grid {
        grid-template-columns: 1fr;
        align-items: start;
    }
    .ref-contact__media {
        max-width: 100%;
    }
}




