/* Public adapter for SunEditor's native output.
   Upstream suneditor-contents.min.css owns component markup and sizing.
   This file only integrates that output with Eventium's public layout. */
.wysiwyg-content.sun-editor-editable {
    display: block;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
}

/* Keep the same readable vertical rhythm as in the editor. The surrounding
   section stylesheet deliberately resets element margins, so spacing has to be
   owned here instead of depending on browser defaults or empty paragraphs. */
.wysiwyg-content.sun-editor-editable > :is(p, ul, ol, blockquote, pre) {
    margin: 0;
    line-height: 1.7;
}

.wysiwyg-content.sun-editor-editable > :is(h2, h3, h4) {
    margin: 0;
    line-height: 1.25;
}

.wysiwyg-content.sun-editor-editable
    > :is(p, ul, ol, blockquote, pre, table, details, .se-component, .wysiwyg-table-scroll, .wysiwyg-table-cards)
    + :is(p, ul, ol, blockquote, pre, table, details, .se-component, .wysiwyg-table-scroll, .wysiwyg-table-cards) {
    margin-top: 1em;
}

.wysiwyg-content.sun-editor-editable > * + :is(h2, h3, h4) {
    margin-top: clamp(24px, 1.75em, 40px);
}

.wysiwyg-content.sun-editor-editable
    > :is(h2, h3, h4)
    + :is(p, ul, ol, blockquote, pre, table, details, .se-component, .wysiwyg-table-scroll, .wysiwyg-table-cards) {
    margin-top: clamp(14px, 0.65em, 20px);
}

.wysiwyg-content.sun-editor-editable > .wysiwyg-media-alternative {
    overflow: hidden;
    border: 1px solid rgba(var(--event-primary-rgb, 42, 85, 189), .22);
    border-radius: 14px;
    background: rgba(var(--event-primary-rgb, 42, 85, 189), .045);
}

.wysiwyg-content.sun-editor-editable > .wysiwyg-media-alternative > summary {
    position: relative;
    padding: 14px 48px 14px 16px;
    color: var(--event-primary-text, #23489f);
    font-weight: 800;
    line-height: 1.45;
    cursor: pointer;
}

.wysiwyg-content.sun-editor-editable > .wysiwyg-media-alternative > summary::after {
    position: absolute;
    top: 50%;
    right: 16px;
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    content: '';
    transform: translateY(-65%) rotate(45deg);
    transition: transform .18s ease;
}

.wysiwyg-content.sun-editor-editable > .wysiwyg-media-alternative[open] > summary::after {
    transform: translateY(-30%) rotate(225deg);
}

.wysiwyg-content.sun-editor-editable > .wysiwyg-media-alternative > summary:focus-visible {
    outline: 3px solid rgba(var(--event-primary-rgb, 42, 85, 189), .3);
    outline-offset: -3px;
}

.wysiwyg-content.sun-editor-editable .wysiwyg-media-alternative__content {
    display: grid;
    gap: 12px;
    padding: 0 16px 16px;
}

.wysiwyg-content.sun-editor-editable .wysiwyg-media-alternative__content > p {
    margin: 0;
    line-height: 1.7;
}

@media (prefers-reduced-motion: reduce) {
    .wysiwyg-content.sun-editor-editable > .wysiwyg-media-alternative > summary::after {
        transition: none;
    }
}

.wysiwyg-content :where(.se-component, figure) {
    max-width: 100%;
}

/* SunEditor 3.2.6 emits se-embed-container for generic embeds but its public
   content stylesheet only contains the equivalent video selectors. */
.wysiwyg-content.sun-editor-editable .se-embed-container {
    height: auto;
    max-width: 100%;
    width: auto;
}

.wysiwyg-content.sun-editor-editable .se-embed-container > figure {
    position: relative;
    left: 0;
    max-width: 100%;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.wysiwyg-content.sun-editor-editable .se-embed-container iframe {
    position: relative;
    top: auto;
    left: auto;
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    aspect-ratio: inherit;
}

/* Generic iframe content that was imported before native SunEditor components
   were introduced still receives a safe responsive presentation. */
.wysiwyg-content :where(iframe:not(.se-video-container iframe):not(.se-embed-container iframe)) {
    display: block;
    width: min(100%, 960px) !important;
    max-width: 100%;
    height: auto !important;
    min-height: clamp(190px, 42vw, 540px);
    margin: 0 auto;
    border: 0;
    border-radius: 18px;
    aspect-ratio: 16 / 9;
    background: #050712;
}

.public-body .wysiwyg-content :where(img[data-eventium-open-image="1"]) {
    cursor: zoom-in;
}

.public-body .wysiwyg-content :where(img[data-eventium-open-image="1"]:focus-visible) {
    outline: 3px solid rgba(var(--event-primary-rgb), 0.3);
    outline-offset: 4px;
}

.wysiwyg-content :where(figure.se-scroll-figure-x) {
    -webkit-overflow-scrolling: touch;
}

.wysiwyg-content.sun-editor-editable .wysiwyg-table-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    border-radius: 18px;
    box-shadow: 0 0 0 1px rgba(121, 133, 177, 0.18);
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--event-primary-rgb), 0.36) rgba(var(--event-primary-rgb), 0.08);
}

.wysiwyg-content.sun-editor-editable .wysiwyg-table-scroll:focus-visible {
    outline: 3px solid rgba(var(--event-primary-rgb), 0.24);
    outline-offset: 4px;
}

.wysiwyg-content .wysiwyg-table-scroll::-webkit-scrollbar {
    height: 10px;
}

.wysiwyg-content .wysiwyg-table-scroll::-webkit-scrollbar-track {
    border-radius: 999px;
    background: rgba(var(--event-primary-rgb), 0.08);
}

.wysiwyg-content .wysiwyg-table-scroll::-webkit-scrollbar-thumb {
    border: 2px solid rgba(255, 255, 255, 0.88);
    border-radius: 999px;
    background: rgba(var(--event-primary-rgb), 0.36);
}

.wysiwyg-content.sun-editor-editable .wysiwyg-table-scroll > table {
    max-width: none;
    margin: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.wysiwyg-content.sun-editor-editable table {
    width: 100%;
    border-collapse: collapse;
    border-color: rgba(121, 133, 177, 0.18);
    border-radius: 18px;
    box-shadow: 0 0 0 1px rgba(121, 133, 177, 0.18);
}

.wysiwyg-content.sun-editor-editable table th,
.wysiwyg-content.sun-editor-editable table td {
    padding: 12px 14px;
    border: 1px solid rgba(121, 133, 177, 0.18);
    text-align: left;
    vertical-align: top;
}

.wysiwyg-content.sun-editor-editable table th {
    background: rgba(var(--event-primary-rgb), 0.08);
    font-weight: 800;
}

.wysiwyg-content.sun-editor-editable table thead {
    border-bottom: 2px solid rgba(var(--event-primary-rgb), 0.42);
}

.wysiwyg-content.sun-editor-editable table > caption:not(.visually-hidden) {
    padding: 16px 22px;
    border: 0;
    border-bottom: 1px solid rgba(121, 133, 177, 0.18);
    background: #fff;
    color: var(--text);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.5;
    text-align: center;
    caption-side: top;
}

.wysiwyg-content.sun-editor-editable .wysiwyg-table-cards {
    display: none;
}

.wysiwyg-content::after {
    content: "";
    display: block;
    clear: both;
}

@media (max-width: 720px) {
    .wysiwyg-content.sun-editor-editable .wysiwyg-table-scroll {
        width: calc(100% + (2 * min(12px, 3vw)));
        max-width: calc(100% + (2 * min(12px, 3vw)));
        margin-inline: calc(-1 * min(12px, 3vw));
        border-radius: 16px;
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-scroll--cards {
        display: none;
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-cards {
        display: grid;
        gap: 12px;
        margin-inline: calc(-1 * min(4px, 1vw));
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-cards__title {
        margin: 0;
        padding: 14px 16px;
        border: 1px solid rgba(121, 133, 177, 0.2);
        border-radius: 16px;
        background: rgba(var(--event-primary-rgb), 0.06);
        color: var(--text);
        font-size: 1rem;
        font-weight: 850;
        line-height: 1.45;
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-card {
        display: grid;
        gap: 0;
        overflow: hidden;
        border: 1px solid rgba(121, 133, 177, 0.2);
        border-radius: 18px;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.94));
        box-shadow: 0 14px 32px rgba(29, 46, 89, 0.07);
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-card__field {
        display: grid;
        gap: 6px;
        padding: 12px 14px;
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-card__field + .wysiwyg-table-card__field {
        border-top: 1px solid rgba(121, 133, 177, 0.16);
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-card__field--primary {
        background: rgba(var(--event-primary-rgb), 0.06);
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-card__label {
        color: var(--muted);
        font-size: 0.76rem;
        font-weight: 900;
        line-height: 1.2;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-card__value {
        min-width: 0;
        color: var(--text);
        font-weight: 650;
        line-height: 1.55;
        overflow-wrap: anywhere;
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-card__value > * {
        max-width: 100%;
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-card__field--primary .wysiwyg-table-card__value {
        font-size: 1.04rem;
        font-weight: 900;
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-scroll--wide > table {
        min-width: max(100%, 620px);
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-scroll--fit th,
    .wysiwyg-content.sun-editor-editable .wysiwyg-table-scroll--fit td {
        white-space: normal !important;
    }

    .wysiwyg-content.sun-editor-editable .wysiwyg-table-scroll th,
    .wysiwyg-content.sun-editor-editable .wysiwyg-table-scroll td {
        padding: 11px 13px;
    }

    .wysiwyg-content :where(.__se__float-left, .__se__float-right) {
        float: none;
        max-width: 100%;
        margin-right: 0;
        margin-left: 0;
    }
}
