.mwg-gallery {
    --mwg-accent: #235865;
    --mwg-border: #c8b9a9;
    --mwg-text: #2f2a26;
    --mwg-muted: #756c64;
    --mwg-surface: #fffaf4;
    --mwg-overview-bg: transparent;
    --mwg-heading-font: "Cormorant Garamond", "Times New Roman", serif;
    width: 100%;
    color: var(--mwg-text);
    font-family: inherit;
}

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

/* ---------------------------------------------------------
 * Main /gallery/ overview
 * --------------------------------------------------------- */
.mwg-gallery--types {
    background: var(--mwg-overview-bg);
}

.mwg-gallery-overview {
    display: grid;
    gap: clamp(3.25rem, 7vw, 7rem);
    width: min(100%, 1180px);
    margin-inline: auto;
    padding: clamp(2.2rem, 5vw, 5rem) clamp(1.1rem, 3vw, 2rem);
}

.mwg-gallery-overview-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
    align-items: center;
    gap: clamp(2rem, 6vw, 6.5rem);
}

.mwg-gallery-overview-row--image-right .mwg-gallery-overview-media {
    grid-column: 2;
}

.mwg-gallery-overview-row--image-right .mwg-gallery-overview-content {
    grid-column: 1;
    grid-row: 1;
}

.mwg-gallery-overview-media {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1.06;
    overflow: hidden;
    border-radius: 1rem;
    background: #eee6df;
}

.mwg-gallery-overview-media--empty {
    display: grid;
    place-items: center;
    min-height: 280px;
}

.mwg-gallery-overview-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.mwg-gallery-overview-image-hint {
    max-width: 16rem;
    padding: 1rem;
    color: var(--mwg-muted);
    font-size: .8rem;
    line-height: 1.5;
    text-align: center;
}

.mwg-gallery-overview-content {
    max-width: 31rem;
}

.mwg-gallery-overview-title {
    margin: 0 0 1rem;
    color: var(--mwg-accent);
    font-family: var(--mwg-heading-font);
    font-size: clamp(2rem, 3vw, 3.25rem);
    font-weight: 400;
    line-height: 1.02;
    letter-spacing: -.015em;
}

.mwg-gallery-overview-description {
    margin: 0 0 1.5rem;
    color: #514b47;
    font-size: clamp(.85rem, 1vw, 1rem);
    line-height: 1.55;
}

.mwg-gallery-type-link,
.mwg-view-photo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    border: 0;
    border-radius: 0;
    background: var(--mwg-accent);
    color: #fff;
    padding: .62rem 1.4rem;
    font: inherit;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .055em;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
}

.mwg-gallery-overview .mwg-gallery-type-link {
    min-width: 11.5rem;
}

.mwg-gallery-type-link:hover,
.mwg-gallery-type-link:focus-visible {
    color: #fff;
    text-decoration: none;
    filter: brightness(.92);
}

.mwg-gallery-type-link:focus-visible,
.mwg-gallery-back:focus-visible,
.mwg-view-photo:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

/* ---------------------------------------------------------
 * Category result view — v0.3/v0.4 read-only foundation
 * --------------------------------------------------------- */
.mwg-gallery-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1rem;
}

.mwg-gallery-back {
    color: var(--mwg-accent);
    font-size: .875rem;
    text-decoration: none;
}

.mwg-gallery-back:hover,
.mwg-gallery-back:focus-visible {
    text-decoration: underline;
}

.mwg-gallery-context {
    color: var(--mwg-muted);
    font-size: .8125rem;
}

.mwg-case-list {
    display: grid;
    gap: .75rem;
}

.mwg-case-card {
    display: grid;
    grid-template-columns: minmax(0, 2.15fr) minmax(220px, .85fr);
    gap: 1.5rem;
    align-items: stretch;
    width: 100%;
    border: 1px solid var(--mwg-border);
    background: var(--mwg-surface);
    padding: .75rem;
}

.mwg-case-media {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
    min-width: 0;
}

.mwg-case-image {
    position: relative;
    min-width: 0;
    overflow: hidden;
    background: #eee;
}

.mwg-case-image-element {
    display: block;
    width: 100%;
    height: clamp(170px, 21vw, 280px);
    object-fit: cover;
    object-position: center;
}

.mwg-case-image-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    padding: .42rem .6rem;
    background: rgba(35, 88, 101, .92);
    color: #fff;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-align: center;
    text-transform: uppercase;
}

.mwg-case-info {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    padding: .25rem .35rem .25rem 0;
}

.mwg-case-procedure {
    margin: 0 0 .15rem;
    color: var(--mwg-text);
    font-family: var(--mwg-heading-font);
    font-size: 1.7rem;
    font-weight: 400;
    line-height: 1.1;
}

.mwg-case-id {
    margin: 0 0 .6rem;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .025em;
}

.mwg-case-details {
    display: grid;
    gap: .2rem;
    margin-bottom: .75rem;
    font-size: .75rem;
    line-height: 1.35;
}

.mwg-case-detail-label {
    font-weight: 600;
}

.mwg-view-photo {
    width: 100%;
    margin-top: auto;
}

.mwg-view-photo[disabled] {
    opacity: 1;
    cursor: default;
}

.mwg-empty,
.mwg-error {
    margin: 0;
    border: 1px solid var(--mwg-border);
    background: var(--mwg-surface);
    padding: 1rem;
}

.mwg-error {
    border-color: #b32d2e;
}

@media (max-width: 900px) {
    .mwg-gallery-overview-row {
        gap: clamp(1.5rem, 4vw, 3rem);
    }

    .mwg-case-card {
        grid-template-columns: 1fr;
    }

    .mwg-case-info {
        padding: .15rem 0 0;
    }

    .mwg-case-image-element {
        height: clamp(180px, 34vw, 300px);
    }

    .mwg-view-photo {
        max-width: 260px;
    }
}

@media (max-width: 700px) {
    .mwg-gallery-overview {
        gap: 3.5rem;
        padding-block: 2.2rem;
    }

    .mwg-gallery-overview-row {
        grid-template-columns: 1fr;
        gap: 1.35rem;
    }

    .mwg-gallery-overview-row--image-right .mwg-gallery-overview-media,
    .mwg-gallery-overview-row--image-right .mwg-gallery-overview-content {
        grid-column: 1;
        grid-row: auto;
    }

    .mwg-gallery-overview-row--image-right .mwg-gallery-overview-media {
        order: 0;
    }

    .mwg-gallery-overview-row--image-right .mwg-gallery-overview-content {
        order: 1;
    }

    .mwg-gallery-overview-media {
        aspect-ratio: 1 / 1;
        border-radius: .85rem;
    }

    .mwg-gallery-overview-content {
        max-width: none;
    }

    .mwg-gallery-overview-title {
        margin-bottom: .65rem;
        font-size: clamp(1.9rem, 9vw, 2.6rem);
    }

    .mwg-gallery-overview-description {
        margin-bottom: 1.1rem;
    }
}

@media (max-width: 600px) {
    .mwg-gallery-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .mwg-case-card {
        gap: .9rem;
        padding: .6rem;
    }

    .mwg-case-media {
        gap: .4rem;
    }

    .mwg-case-image-element {
        height: clamp(145px, 46vw, 220px);
    }

    .mwg-case-procedure {
        font-size: 1.45rem;
    }

    .mwg-view-photo {
        max-width: none;
    }
}

/* ---------------------------------------------------------
 * v0.4.1 — Elementor full-width compatibility
 *
 * Elementor's global image rules can override a shortcode's image height,
 * causing case cards to expand to the intrinsic image aspect ratio when the
 * containing Elementor section is full width. Keep Elementor full width, but
 * constrain the category-results content inside the plugin itself.
 * --------------------------------------------------------- */
.mwg-gallery:not(.mwg-gallery--types) {
    width: min(100%, 1180px);
    margin-inline: auto;
    padding-inline: clamp(1.1rem, 3vw, 2rem);
}

/* Higher specificity than Elementor's generic `.elementor img` rules. */
.mwg-gallery .mwg-case-image-element {
    width: 100%;
    height: clamp(170px, 21vw, 280px);
    object-fit: cover;
    object-position: center;
}

.mwg-gallery .mwg-gallery-overview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

@media (max-width: 900px) {
    .mwg-gallery .mwg-case-image-element {
        height: clamp(180px, 34vw, 300px);
    }
}

@media (max-width: 600px) {
    .mwg-gallery:not(.mwg-gallery--types) {
        padding-inline: .75rem;
    }

    .mwg-gallery .mwg-case-image-element {
        height: clamp(145px, 46vw, 220px);
    }
}


/* ---------------------------------------------------------
 * v0.6 — read-only filter controls
 * --------------------------------------------------------- */
.mwg-filter-form {
    margin: 0 0 1.15rem;
}

.mwg-filter-heading {
    margin: 0 0 .55rem;
    color: var(--mwg-text);
    font-size: .9rem;
    font-weight: 600;
}

.mwg-filter-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .85rem;
}

.mwg-filter {
    min-width: 0;
}

.mwg-filter select {
    width: 100%;
    min-width: 0;
    height: 2.35rem;
    border: 1px solid #cfc5ba;
    border-radius: 0;
    background-color: #fff;
    color: #5d5650;
    padding: 0 2rem 0 .75rem;
    font: inherit;
    font-size: .78rem;
    line-height: 1.2;
}

.mwg-filter--taxonomy select {
    border-color: var(--mwg-accent);
    background-color: var(--mwg-accent);
    color: #fff;
}

.mwg-filter select:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.mwg-filter select:focus-visible {
    outline: 2px solid var(--mwg-accent);
    outline-offset: 2px;
}

.mwg-filter-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .85rem;
    margin-top: .65rem;
}

.mwg-gallery .mwg-filter-form .mwg-filter-submit {
    min-height: 2.1rem;
    border: 0;
    background: var(--mwg-accent);
    color: #fff;
    padding: .5rem 1rem;
    font: inherit;
    font-size: .875rem;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
}

.mwg-filters-starting .mwg-gallery .mwg-filter-submit,
.mwg-gallery .mwg-filter-form--enhanced .mwg-filter-submit {
    display: none;
}

.mwg-filter-reset {
    color: var(--mwg-accent);
    font-size: .75rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.mwg-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 1050px) {
    .mwg-filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .mwg-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .6rem;
    }

    .mwg-filter-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 390px) {
    .mwg-filter-grid {
        grid-template-columns: 1fr;
    }
}

/* v0.7 progressive AJAX filtering. The GET form remains the fallback. */
.mwg-results {
    transition: opacity 180ms ease;
}

.mwg-gallery--loading .mwg-results {
    opacity: 0.42;
    pointer-events: none;
}

.mwg-gallery--loading .mwg-filter-form select {
    cursor: progress;
}

.mwg-filter-reset[hidden] {
    display: none !important;
}

/* ---------------------------------------------------------
 * v0.7.1 — compact case-card design refinement
 *
 * Matches the approved compact reference: low-profile row,
 * rounded paired images, small patient typography, and a
 * compact View Photo CTA. The Before/After ribbons are hidden
 * because they are not present in the approved card design.
 * --------------------------------------------------------- */
@media (min-width: 901px) {
    .mwg-case-card {
        grid-template-columns: minmax(0, 2fr) minmax(185px, .95fr);
        gap: clamp(1rem, 2vw, 1.45rem);
        align-items: center;
        padding: clamp(.75rem, 1.3vw, 1rem) clamp(.85rem, 1.6vw, 1.2rem);
    }

    .mwg-case-media {
        gap: clamp(.45rem, .8vw, .65rem);
        align-items: center;
    }

    .mwg-gallery .mwg-case-image-element {
        height: clamp(125px, 13.5vw, 165px);
        border-radius: .7rem;
    }

    .mwg-case-image {
        border-radius: .7rem;
        background: #e9e9e9;
    }

    .mwg-case-image-label {
        display: none;
    }

    .mwg-case-info {
        align-self: stretch;
        justify-content: flex-start;
        padding: .05rem 0;
    }

    .mwg-case-procedure {
        margin: 0 0 .12rem;
        font-size: clamp(1.05rem, 1.55vw, 1.35rem);
        line-height: 1.02;
    }

    .mwg-case-id {
        margin: 0 0 .65rem;
        font-size: .64rem;
        line-height: 1.2;
    }

    .mwg-case-details {
        gap: .08rem;
        margin: 0 0 .8rem;
        font-size: .62rem;
        line-height: 1.28;
    }

    .mwg-view-photo {
        width: auto;
        min-width: 6.35rem;
        max-width: 7.4rem;
        min-height: 1.65rem;
        margin-top: auto;
        align-self: flex-start;
        padding: .35rem .8rem;
        font-size: .54rem;
        letter-spacing: .04em;
        line-height: 1;
    }
}

@media (max-width: 900px) {
    .mwg-case-image-label {
        display: none;
    }

    .mwg-case-image,
    .mwg-gallery .mwg-case-image-element {
        border-radius: .65rem;
    }

    .mwg-case-procedure {
        font-size: 1.35rem;
    }

    .mwg-case-details {
        gap: .12rem;
    }

    .mwg-view-photo {
        width: auto;
        min-width: 7rem;
        min-height: 1.9rem;
        align-self: flex-start;
        padding: .42rem .9rem;
        font-size: .6rem;
    }
}

@media (max-width: 600px) {
    .mwg-gallery .mwg-case-image-element {
        height: clamp(120px, 42vw, 185px);
    }

    .mwg-case-procedure {
        font-size: 1.25rem;
    }

    .mwg-view-photo {
        max-width: none;
    }
}


/* ---------------------------------------------------------
 * v0.7.2 — exact compact card + Elementor style isolation
 *
 * The View Photo control is intentionally non-interactive until the
 * modal release. It is rendered as an inert span so Elementor/theme
 * global button rules cannot enlarge or clip its text.
 * --------------------------------------------------------- */
@media (min-width: 901px) {
    .mwg-gallery .mwg-case-card {
        grid-template-columns: minmax(0, 66%) minmax(0, 34%);
        gap: 14px;
        align-items: stretch;
        padding: 12px 14px;
    }

    .mwg-gallery .mwg-case-media {
        gap: 10px;
        align-items: center;
    }

    .mwg-gallery .mwg-case-image,
    .mwg-gallery .mwg-case-image-element {
        border-radius: 7px;
    }

    .mwg-gallery .mwg-case-image-element {
        height: 145px;
        min-height: 145px;
        max-height: 145px;
    }

    .mwg-gallery .mwg-case-info {
        min-height: 145px;
        padding: 3px 0 2px;
    }

    .mwg-gallery .mwg-case-procedure {
        margin: 0 0 3px;
        font-size: clamp(18px, 1.35vw, 22px);
        line-height: 1.03;
    }

    .mwg-gallery .mwg-case-id {
        margin: 0 0 8px;
        font-size: 10px;
        line-height: 1.15;
    }

    .mwg-gallery .mwg-case-details {
        gap: 1px;
        margin: 0 0 9px;
        font-size: 10px;
        line-height: 1.22;
    }

    .mwg-gallery .mwg-view-photo {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 0 0 auto !important;
        width: 112px !important;
        min-width: 112px !important;
        max-width: 112px !important;
        height: 26px !important;
        min-height: 26px !important;
        max-height: 26px !important;
        margin: auto 0 0 !important;
        padding: 0 10px !important;
        overflow: visible !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: var(--mwg-accent) !important;
        box-shadow: none !important;
        color: #fff !important;
        font-family: inherit !important;
        font-size: 9px !important;
        font-style: normal !important;
        font-weight: 600 !important;
        letter-spacing: .035em !important;
        line-height: 1 !important;
        text-align: center !important;
        text-decoration: none !important;
        text-indent: 0 !important;
        text-transform: uppercase !important;
        white-space: nowrap !important;
        transform: none !important;
    }
}

@media (max-width: 900px) {
    .mwg-gallery .mwg-view-photo {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 112px !important;
        min-width: 112px !important;
        max-width: 112px !important;
        height: 28px !important;
        min-height: 28px !important;
        max-height: 28px !important;
        margin: 6px 0 0 !important;
        padding: 0 10px !important;
        overflow: visible !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: var(--mwg-accent) !important;
        box-shadow: none !important;
        color: #fff !important;
        font-family: inherit !important;
        font-size: 9px !important;
        font-style: normal !important;
        font-weight: 600 !important;
        letter-spacing: .035em !important;
        line-height: 1 !important;
        text-align: center !important;
        text-decoration: none !important;
        text-indent: 0 !important;
        text-transform: uppercase !important;
        white-space: nowrap !important;
        transform: none !important;
    }
}


/* ---------------------------------------------------------
 * v0.7.3 — square case photos + improved card typography
 *
 * Keeps the approved compact card treatment while making the
 * paired patient photos square and restoring comfortable text
 * sizing for the procedure, case ID, patient data and CTA.
 * --------------------------------------------------------- */
@media (min-width: 901px) {
    .mwg-gallery .mwg-case-card {
        grid-template-columns: minmax(0, 2fr) minmax(245px, .95fr);
        gap: clamp(18px, 2vw, 26px);
        align-items: stretch;
        padding: 14px 16px;
    }

    .mwg-gallery .mwg-case-media {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        align-items: stretch;
    }

    .mwg-gallery .mwg-case-image {
        width: 100%;
        aspect-ratio: 1 / 1;
        border-radius: 10px;
        overflow: hidden;
    }

    .mwg-gallery .mwg-case-image-element {
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
        aspect-ratio: 1 / 1 !important;
        border-radius: 10px;
        object-fit: cover !important;
        object-position: center !important;
    }

    .mwg-gallery .mwg-case-info {
        min-height: 0;
        padding: 4px 0 3px;
    }

    .mwg-gallery .mwg-case-procedure {
        margin: 0 0 5px;
        font-size: clamp(23px, 1.8vw, 29px);
        line-height: 1.04;
    }

    .mwg-gallery .mwg-case-id {
        margin: 0 0 12px;
        font-size: 12px;
        line-height: 1.25;
        letter-spacing: .025em;
    }

    .mwg-gallery .mwg-case-details {
        gap: 2px;
        margin: 0 0 14px;
        font-size: 12px;
        line-height: 1.38;
    }

    .mwg-gallery .mwg-view-photo {
        width: 126px !important;
        min-width: 126px !important;
        max-width: 126px !important;
        height: 32px !important;
        min-height: 32px !important;
        max-height: 32px !important;
        padding: 0 12px !important;
        font-size: 10px !important;
        letter-spacing: .04em !important;
    }
}

@media (max-width: 900px) {
    .mwg-gallery .mwg-case-image {
        aspect-ratio: 1 / 1;
        overflow: hidden;
    }

    .mwg-gallery .mwg-case-image-element {
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
        aspect-ratio: 1 / 1 !important;
        object-fit: cover !important;
    }

    .mwg-gallery .mwg-case-procedure {
        font-size: clamp(21px, 4vw, 26px);
    }

    .mwg-gallery .mwg-case-id {
        font-size: 11px;
        margin-bottom: 9px;
    }

    .mwg-gallery .mwg-case-details {
        font-size: 11.5px;
        line-height: 1.4;
    }

    .mwg-gallery .mwg-view-photo {
        width: 124px !important;
        min-width: 124px !important;
        max-width: 124px !important;
        height: 31px !important;
        min-height: 31px !important;
        max-height: 31px !important;
        font-size: 10px !important;
    }
}

@media (max-width: 600px) {
    .mwg-gallery .mwg-case-procedure {
        font-size: 22px;
    }

    .mwg-gallery .mwg-case-id,
    .mwg-gallery .mwg-case-details {
        font-size: 12px;
    }
}


/* ---------------------------------------------------------
 * v0.7.4 — 16px patient info + balanced vertical spacing
 *
 * Groups the procedure title and case ID together, keeps the
 * patient information centered vertically, and anchors the CTA
 * to the bottom for an intentional top / middle / bottom rhythm.
 * --------------------------------------------------------- */
@media (min-width: 901px) {
    .mwg-gallery .mwg-case-info {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: flex-start;
        padding: 4px 0 3px;
    }

    .mwg-gallery .mwg-case-heading {
        width: 100%;
        flex: 0 0 auto;
    }

    .mwg-gallery .mwg-case-id {
        margin: 0;
        font-size: 16px;
        line-height: 1.25;
    }

    .mwg-gallery .mwg-case-details {
        width: 100%;
        margin: 0;
        gap: 3px;
        font-size: 16px;
        line-height: 1.35;
        flex: 0 0 auto;
    }

    .mwg-gallery .mwg-view-photo {
        margin: 0 !important;
        flex: 0 0 auto !important;
    }
}

@media (max-width: 900px) {
    .mwg-gallery .mwg-case-info {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .mwg-gallery .mwg-case-id,
    .mwg-gallery .mwg-case-details {
        font-size: 16px;
    }

    .mwg-gallery .mwg-case-details {
        margin: .75rem 0 1rem;
        gap: 3px;
        line-height: 1.35;
    }
}

/* v0.8: scoped, themeable pagination. Existing cards keep their styling. */
.mwg-gallery .mwg-pagination {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-top: 1.5rem;
}

.mwg-gallery .mwg-pagination[hidden],
.mwg-gallery .mwg-pagination a[hidden] {
    display: none !important;
}

.mwg-gallery .mwg-pagination .mwg-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: .75rem 1.25rem;
    margin: 0;
    border: 1px solid var(--mwg-load-more-bg, var(--mwg-accent));
    border-radius: var(--mwg-load-more-radius, 0);
    background: var(--mwg-load-more-bg, var(--mwg-accent));
    color: var(--mwg-load-more-color, #fff);
    font-family: inherit;
    font-size: var(--mwg-load-more-font-size, .875rem);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: .03em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    box-shadow: none;
    cursor: pointer;
    transition: opacity 160ms ease;
}

.mwg-gallery .mwg-pagination .mwg-load-more:hover {
    opacity: .85;
}

.mwg-gallery .mwg-pagination a:focus-visible {
    outline: 2px solid var(--mwg-accent);
    outline-offset: 4px;
}

.mwg-gallery .mwg-load-more[aria-disabled="true"] {
    cursor: progress;
    opacity: .65;
}

.mwg-gallery .mwg-previous-page {
    align-self: flex-start;
    color: var(--mwg-accent);
    font-family: inherit;
    font-size: 1rem;
    text-decoration: underline;
}

/* Keep already-loaded photos stable while appending another batch. */
.mwg-gallery.mwg-gallery--appending .mwg-results {
    opacity: 1;
    pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
    .mwg-gallery .mwg-results,
    .mwg-gallery .mwg-pagination .mwg-load-more {
        transition: none;
    }
}

/* v0.9: progressive case viewer; the existing card CTA keeps its proportions. */
.mwg-gallery .mwg-photo-details { width: 100%; min-width: 0; }
.mwg-gallery summary.mwg-view-photo { cursor: pointer; list-style: none; }
.mwg-gallery summary.mwg-view-photo::-webkit-details-marker { display: none; }
.mwg-gallery summary.mwg-view-photo:focus-visible,
.mwg-gallery .mwg-viewer-dialog a:focus-visible,
.mwg-gallery .mwg-viewer-dialog button:focus-visible {
    outline: 2px solid var(--mwg-accent);
    outline-offset: 3px;
}
.mwg-gallery .mwg-photo-details:not([open]) > .mwg-viewer-content { display: none; }
.mwg-gallery .mwg-photo-details[open] > .mwg-viewer-content { margin-top: 1.25rem; }
/* Native expandable fallback uses the full card width, including without JS. */
.mwg-gallery .mwg-case-card:has(.mwg-photo-details[open]) { grid-template-columns: minmax(0, 1fr); }
.mwg-gallery .mwg-case-card:has(.mwg-photo-details[open]) .mwg-case-info { gap: 1rem; }
.mwg-gallery .mwg-viewer-content { color: var(--mwg-text); font: inherit; min-width: 0; }
.mwg-gallery .mwg-viewer-dialog {
    position: fixed;
    inset: 0;
    width: min(1040px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    max-height: 90vh;
    max-height: 90dvh;
    margin: auto;
    padding: 0;
    border: 1px solid var(--mwg-border);
    border-radius: var(--mwg-viewer-radius, 12px);
    background: var(--mwg-viewer-bg, var(--mwg-surface));
    color: var(--mwg-text);
    font-family: inherit;
    overflow: auto;
    overscroll-behavior: contain;
    box-shadow: 0 20px 80px rgb(0 0 0 / 25%);
}
.mwg-gallery .mwg-viewer-dialog::backdrop { background: var(--mwg-viewer-backdrop, rgb(28 23 20 / 72%)); }
.mwg-gallery .mwg-viewer-dialog:not([open]),
.mwg-gallery .mwg-viewer-content [hidden] { display: none !important; }
.mwg-gallery .mwg-viewer-content--modal { padding: clamp(20px, 3vw, 36px); padding-top: 12px; }
.mwg-gallery .mwg-viewer-dialog .mwg-viewer-close {
    position: sticky;
    z-index: 2;
    top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    margin: 8px 8px 0 auto;
    padding: 0;
    border: 1px solid var(--mwg-border);
    border-radius: 50%;
    background: var(--mwg-viewer-bg, var(--mwg-surface));
    color: var(--mwg-text);
    font: 400 28px/1 Arial, sans-serif;
    box-shadow: none;
    cursor: pointer;
    text-decoration: none;
    transform: none;
}
.mwg-gallery .mwg-viewer-header { padding: 0 0 16px; }
.mwg-gallery .mwg-viewer-title {
    margin: 0 0 6px;
    color: var(--mwg-accent);
    font-family: var(--mwg-heading-font);
    font-size: clamp(26px, 3vw, 38px);
    font-weight: 400;
    line-height: 1.15;
    overflow-wrap: anywhere;
}
.mwg-gallery .mwg-viewer-case-id { margin: 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.mwg-gallery .mwg-viewer-angles { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.mwg-gallery .mwg-viewer-angle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    max-width: 100%;
    margin: 0;
    padding: 8px 16px;
    border: 1px solid var(--mwg-border);
    border-radius: 4px;
    background: transparent;
    color: var(--mwg-text);
    font-weight: 500;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: normal;
    white-space: normal;
    overflow-wrap: anywhere;
    box-shadow: none;
    cursor: pointer;
}
.mwg-gallery .mwg-viewer-angle[aria-pressed="true"] { color: #fff; background: var(--mwg-accent); border-color: var(--mwg-accent); }
.mwg-gallery .mwg-viewer-position,
.mwg-gallery .mwg-viewer-hint { margin: 0 0 12px; color: var(--mwg-muted); font-size: 13px; line-height: 1.5; }
.mwg-gallery .mwg-viewer-hint { margin-top: 10px; }
.mwg-gallery .mwg-viewer-set + .mwg-viewer-set { margin-top: 20px; }
.mwg-gallery .mwg-viewer-content--modal .mwg-viewer-set { margin-top: 0; }
.mwg-gallery .mwg-viewer-set-title { margin: 0 0 8px; font: inherit; font-weight: 600; }
.mwg-gallery .mwg-viewer-content--modal .mwg-viewer-set-title { display: none; }
.mwg-gallery .mwg-viewer-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(8px, 1.5vw, 16px); }
.mwg-gallery .mwg-viewer-photo { min-width: 0; margin: 0; padding: 0; }
.mwg-gallery .mwg-viewer-photo figcaption { margin: 0; padding: 8px; background: var(--mwg-accent); color: #fff; text-align: center; font-size: 14px; font-weight: 600; }
.mwg-gallery .mwg-viewer-photo a { display: block; background: var(--mwg-viewer-image-bg, #eee9e4); }
.mwg-gallery .mwg-viewer-photo img.mwg-viewer-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: clamp(180px, 45vw, 440px);
    max-height: 52vh;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    object-fit: contain;
    object-position: center;
}
.mwg-gallery .mwg-viewer-facts { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--mwg-border); font-size: 16px; line-height: 1.5; }
.mwg-gallery .mwg-viewer-facts .mwg-case-detail { overflow-wrap: anywhere; }
.mwg-gallery .mwg-viewer-description { margin: 16px 0 0; font-size: 16px; line-height: 1.65; white-space: pre-line; overflow-wrap: anywhere; }
@media (max-width: 600px) {
    .mwg-gallery .mwg-viewer-dialog { width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: 94vh; max-height: 94dvh; }
    .mwg-gallery .mwg-viewer-content--modal { padding: 8px 14px 24px; }
    .mwg-gallery .mwg-viewer-facts { flex-direction: column; gap: 4px; }
    .mwg-gallery .mwg-viewer-photo img.mwg-viewer-image { height: clamp(160px, 48vw, 280px); }
    .mwg-gallery summary.mwg-view-photo { min-height: 44px !important; height: 44px !important; max-height: none !important; }
}
/* The root must include its padding even outside Elementor's global reset. */
.mwg-gallery { box-sizing: border-box; }

/* v0.9.1: content-sized photos and a compact, viewport-fitted popup. */
.mwg-gallery .mwg-viewer-dialog {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.mwg-gallery .mwg-viewer-dialog::-webkit-scrollbar { display: none; width: 0; height: 0; }
.mwg-gallery .mwg-viewer-dialog .mwg-viewer-close { margin-bottom: -44px; }
.mwg-gallery .mwg-viewer-content--modal { padding: 22px clamp(18px, 3vw, 30px); }
.mwg-gallery .mwg-viewer-content--modal .mwg-viewer-header { padding-right: 50px; padding-bottom: 12px; }
.mwg-gallery .mwg-viewer-photo a {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: transparent;
}
.mwg-gallery .mwg-viewer-photo img.mwg-viewer-image {
    width: auto;
    height: auto;
    min-height: 0;
    max-height: var(--mwg-viewer-photo-limit, 440px);
    max-width: 100%;
    background: transparent;
    object-fit: contain;
}
.mwg-gallery .mwg-viewer-photo figcaption { font-style: normal; }
.mwg-gallery .mwg-viewer-facts { margin-top: 12px; padding-top: 12px; }
.mwg-gallery .mwg-case-details:empty { display: none; }
.mwg-gallery .mwg-filter-form[hidden],
.mwg-gallery .mwg-filter-heading[hidden] { display: none !important; }
.mwg-gallery .mwg-filter-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
@media (max-width: 600px) {
    .mwg-gallery .mwg-viewer-content--modal { padding: 20px 14px; }
    .mwg-gallery .mwg-viewer-facts { flex-direction: row; gap: 6px 16px; }
}
@media (max-width: 390px) {
    .mwg-gallery .mwg-filter-grid { grid-template-columns: minmax(0, 1fr); }
}
/* Optional banner shortcode, independent of gallery/filter JavaScript. */
.mwg-gallery-hero {
    position: relative;
    isolation: isolate;
    width: 100%;
    overflow: hidden;
    background: var(--mwg-hero-bg, #84654f);
    color: var(--mwg-hero-color, #fffaf4);
    font-family: inherit;
}
.mwg-gallery-hero,
.mwg-gallery-hero * { box-sizing: border-box; }
.mwg-gallery-hero .mwg-gallery-hero-image {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: var(--mwg-hero-image-position, center);
    border-radius: 0;
}
.mwg-gallery-hero--image::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--mwg-hero-overlay, linear-gradient(90deg, #72533fed 0%, #72533fd9 43%, #72533f26 100%));
}
.mwg-gallery-hero-inner {
    width: min(100%, var(--mwg-hero-max-width, 1180px));
    min-height: var(--mwg-hero-min-height, 480px);
    margin-inline: auto;
    padding: clamp(2.5rem, 6vw, 5rem) clamp(1.1rem, 3vw, 2rem);
    display: flex;
    align-items: center;
}
.mwg-gallery-hero-content {
    width: 100%;
    max-width: var(--mwg-hero-content-width, 36rem);
    overflow-wrap: anywhere;
}
.mwg-gallery-hero-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: 2rem;
    font-size: .8rem;
    line-height: 1.5;
}
.mwg-gallery-hero-breadcrumbs a {
    color: inherit;
    text-decoration: none;
}
.mwg-gallery-hero-breadcrumbs a:hover { text-decoration: underline; }
.mwg-gallery-hero-breadcrumbs a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.mwg-gallery-hero .mwg-gallery-hero-title {
    margin: 0 0 1rem;
    color: inherit;
    font-family: var(--mwg-heading-font, "Cormorant Garamond", "Times New Roman", serif);
    font-size: var(--mwg-hero-title-size, clamp(2rem, 4vw, 3.5rem));
    font-weight: 400;
    line-height: 1.1;
}
.mwg-gallery-hero .mwg-gallery-hero-description {
    margin: 0;
    color: inherit;
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-line;
}
@media (max-width: 600px) {
    .mwg-gallery-hero-inner { min-height: var(--mwg-hero-mobile-min-height, 360px); }
    .mwg-gallery-hero--image::before { background: var(--mwg-hero-mobile-overlay, #72533fd9); }
}

/* v0.9.10: preserve patient photo proportions in every case-card layout.
 * Shared markup also covers cards returned by filters and Load More.
 */
.mwg-gallery .mwg-case-media {
    align-items: start;
    align-content: start;
}

.mwg-gallery .mwg-case-image {
    align-self: start;
    aspect-ratio: auto;
}

.mwg-gallery .mwg-case-image-element {
    display: block;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    /* --mwg-ratio is the photo's own width / height, set inline per image.
     * Needed because lazy images with sizes="auto" get `contain: size`, which
     * makes `height: auto` fall back to WordPress's 1500px placeholder. */
    aspect-ratio: var(--mwg-ratio, auto) !important;
    object-fit: contain !important;
}
