/* ============================================================================
   TYPO3 Fluid Styled Content - Complete Styles
   ============================================================================ */

/* Default Alignment */
.ce-align-left { text-align: left; }
.ce-align-center { text-align: center; }
.ce-align-right { text-align: right; }

/* Clear floats for new content elements */
.frame {
    clear: both;
}

/* Table */
.ce-table td, .ce-table th { vertical-align: top; }

/* Gallery Container */
.ce-gallery {
    margin-bottom: 50px;
}

/* Gallery positioning for text wrap */
.ce-left .ce-gallery { float: left; }
.ce-center .ce-outer { position: relative; float: right; right: 50%; }
.ce-center .ce-inner { position: relative; float: right; right: -50%; }
.ce-right .ce-gallery { float: right; }

/* Gallery elements */
.ce-gallery figure {
    display: block;
    margin: 0;
}
.ce-gallery figcaption {
    background: #000000;
    display: table-caption;
    caption-side: bottom;
}
.ce-gallery img {
    display: block;
    max-width: 100%;
    height: auto;
}
.ce-gallery iframe { border-width: 0; }

/* Gallery links */
.ce-gallery .ce-column a {
    display: block;
    line-height: 0;
}

/* Image borders */
.ce-border img,
.ce-border iframe {
    border: 0px solid #000000;
    padding: 0px;
}

/* Margins for text with images */
.ce-intext.ce-right .ce-gallery,
.ce-intext.ce-left .ce-gallery,
.ce-above .ce-gallery {
    display: inline-block;
    margin-bottom: 10px;
}
.ce-intext.ce-right .ce-gallery { margin-left: 10px; }
.ce-intext.ce-left .ce-gallery { margin-right: 10px; }
.ce-below .ce-gallery { margin-top: 10px; }

/* Clear floats */
.ce-above .ce-bodytext { clear: both; }

/* Lists in text */
.ce-intext.ce-left ol, .ce-intext.ce-left ul {
    padding-left: 40px;
    overflow: auto;
}

/* Uploads */
.ce-uploads {
    margin: 0;
    padding: 0;
}
.ce-uploads li {
    list-style: none outside none;
    margin: 1em 0;
    overflow: hidden;
}
.ce-uploads img {
    float: left;
    padding-right: 1em;
    vertical-align: top;
}
.ce-uploads span { display: block; }
.ce-uploads div { overflow: hidden; }

/* Desktop: Text with floating images */
.ce-intext > .ce-gallery {
    width: 41.6667%;
}
.ce-intext.ce-nowrap > .ce-bodytext {
    width: 58.3333%;
}

/* Gallery Row - Flexbox Layout */
.ce-gallery .ce-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 0;
}

/* Gallery Columns */
.ce-gallery .ce-column {
    flex: 0 1 auto;
    padding: 0;
    margin: 0;
}

/* Column max-widths based on data-ce-columns attribute */
.ce-gallery[data-ce-columns="1"] .ce-column {
    max-width: 100%;
}

.ce-gallery[data-ce-columns="2"] .ce-column {
    max-width: calc((100% - 15px) / 2);
}

.ce-gallery[data-ce-columns="3"] .ce-column {
    max-width: calc((100% - 30px) / 3);
}

.ce-gallery[data-ce-columns="4"] .ce-column {
    max-width: calc((100% - 45px) / 4);
}

.ce-gallery[data-ce-columns="5"] .ce-column {
    max-width: calc((100% - 60px) / 5);
}

.ce-gallery[data-ce-columns="6"] .ce-column {
    max-width: calc((100% - 75px) / 6);
}

/* Fallback for non-flex browsers (old selector style) */
[data-ce-columns="1"] .ce-column:not(.ce-gallery .ce-column) {
    width: 100%;
}
[data-ce-columns="2"] .ce-column:not(.ce-gallery .ce-column) {
    width: calc(50% - 5px);
}
[data-ce-columns="3"] .ce-column:not(.ce-gallery .ce-column) {
    width: calc(33.33333333% - 6.67px);
}
[data-ce-columns="4"] .ce-column:not(.ce-gallery .ce-column) {
    width: calc(25% - 7.5px);
}

.ce-column:last-child { margin-right: 0; }
.ce-row {
    margin-bottom: 10px;
    overflow: hidden;
}
.ce-row:last-child { margin-bottom: 0; }

/* Outer/Inner wrapper support */
.ce-gallery .ce-outer {
    width: 100%;
}

.ce-gallery .ce-inner {
    width: 100%;
}

/* Responsive: Tablet (max-width: 850px) */
@media all and (max-width: 850px) {
    .ce-intext.ce-left .ce-gallery {
        margin-right: 0 !important;
    }
    .ce-center .ce-outer,
    .ce-center .ce-inner {
        float: none;
        right: 0;
    }
    .ce-intext.ce-right .ce-gallery {
        margin-left: 0 !important;
    }
    .ce-intext > .ce-gallery {
        width: 100%;
    }
    .ce-intext > .ce-bodytext {
        width: 100%;
    }
    .ce-above .ce-gallery,
    .ce-below .ce-gallery {
        margin-right: -10px;
    }
    .ce-right.ce-above,
    .ce-right.ce-below {
        margin-left: -10px;
        margin-right: 0;
    }
    .ce-left.ce-above .ce-gallery,
    .ce-left.ce-below .ce-gallery {
        float: none;
    }
    .ce-above .ce-gallery[data-ce-columns="1"],
    .ce-below .ce-gallery[data-ce-columns="1"] {
        float: none;
    }
}

/* Responsive: Mobile landscape (max-width: 767px) */
@media (max-width: 767px) {
    .ce-gallery[data-ce-columns="3"] .ce-column,
    .ce-gallery[data-ce-columns="4"] .ce-column,
    .ce-gallery[data-ce-columns="5"] .ce-column,
    .ce-gallery[data-ce-columns="6"] .ce-column {
        flex-basis: calc(50% - 15px);
    }
}

/* Responsive: Mobile portrait (max-width: 480px) */
@media (max-width: 480px) {
    .ce-gallery .ce-column {
        flex-basis: 100%;
    }
}
