/* Lentelės, galerijos, iliustracijos, grafikai — redaktorius ir portalas */

.cms-content img,
.article__body img {
    max-width: 100%;
    height: auto !important;
}

.cms-table-bordered,
.cms-table-bordered td,
.cms-table-bordered th {
    border: 1px solid #c5cdd6 !important;
    border-collapse: collapse;
}
.cms-table-bordered td,
.cms-table-bordered th {
    padding: .5rem .75rem;
}
.cms-table-borderless,
.cms-table-borderless td,
.cms-table-borderless th {
    border: 0 !important;
    padding: .5rem .75rem;
}
.cms-table-striped tbody tr:nth-child(even) {
    background: #f4f6f8;
}

/* Numatytasis: mažesnės iliustracijos — kairėje, tekstas apgaubia */
img.cms-img-thumb,
img.cms-img-small,
img.cms-img-medium,
img.cms-img-large,
img.cms-img-left,
img.alignleft {
    float: left;
    margin: 0.4rem 1.25rem 1rem 0;
    clear: left;
}

img.cms-img-thumb,
img.cms-img-small {
    max-width: 150px;
    max-height: 150px;
    width: auto;
    height: auto;
}
img.cms-img-medium {
    max-width: 300px;
    max-height: 300px;
    width: auto;
    height: auto;
}
img.cms-img-large {
    max-width: 600px;
    max-height: 600px;
    width: auto;
    height: auto;
}

img.cms-img-right,
img.alignright {
    float: right;
    margin: 0.4rem 0 1rem 1.25rem;
    clear: right;
}

img.cms-img-center,
img.cms-img-full,
img.aligncenter {
    float: none;
    display: block;
    clear: both;
    margin: 1rem auto;
}

img.cms-img-full {
    max-width: 100%;
    height: auto;
    width: auto;
}

.cms-content h2,
.cms-content h3,
.cms-content h4,
.article__body h2,
.article__body h3,
.article__body h4 {
    clear: both;
}

.cms-content::after,
.article__body::after {
    content: "";
    display: table;
    clear: both;
}

@media (max-width: 700px) {
    img.cms-img-thumb,
    img.cms-img-small,
    img.cms-img-medium,
    img.cms-img-large,
    img.cms-img-left,
    img.cms-img-right,
    img.alignleft,
    img.alignright {
        float: none;
        display: block;
        margin: 1rem auto;
        clear: both;
        max-width: min(100%, 360px);
    }
}

figure.cms-figure {
    margin: 1rem 0;
    display: table;
}
figure.cms-figure.alignleft,
figure.cms-figure.cms-img-left {
    float: left;
    margin: 0.4rem 1.25rem 1rem 0;
}
figure.cms-figure.alignright,
figure.cms-figure.cms-img-right {
    float: right;
    margin: 0.4rem 0 1rem 1.25rem;
}
figure.cms-figure img { max-width: 100%; height: auto; display: block; float: none; margin: 0; }
figure.cms-figure figcaption {
    font-size: .9rem;
    color: #5c6770;
    padding-top: .4rem;
}

.cms-gallery {
    display: grid;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0;
    cursor: pointer;
    box-sizing: border-box;
    align-items: start;
    clear: both;
}
.cms-gallery-align-left {
    margin-left: 0;
    margin-right: auto;
}
.cms-gallery-align-center {
    margin-left: auto;
    margin-right: auto;
}
.cms-gallery-align-right {
    margin-left: auto;
    margin-right: 0;
}
.cms-gallery[data-mce-selected] {
    outline: 2px solid #0d6efd;
    outline-offset: 4px;
}
.cms-gallery-1 { grid-template-columns: minmax(0, 1fr); }
.cms-gallery-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cms-gallery-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cms-gallery-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cms-gallery-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cms-content .cms-gallery img,
.article__body .cms-gallery img,
.cms-gallery img {
    display: block;
    float: none;
    margin: 0;
    border-radius: 4px;
    width: 100%;
    max-width: 100%;
    height: auto !important;
    object-fit: contain;
    background: #fff;
}

.article__body img,
.cms-content img {
    background: #fff;
}
@media (max-width: 700px) {
    .cms-gallery-3,
    .cms-gallery-4,
    .cms-gallery-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.cms-chart {
    margin: 1.25rem 0;
    padding: 1rem;
    background: #f8f9fb;
    border-radius: 8px;
    clear: both;
}
.cms-chart svg { width: 100%; height: auto; display: block; }
.cms-chart figcaption {
    text-align: center;
    font-weight: 600;
    margin-top: .75rem;
}

.cms-duk {
    clear: both;
    margin: 2rem 0 1.25rem;
    padding: 1.25rem 1.35rem;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: #f8fafc;
}
.cms-duk > h2 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    line-height: 1.3;
    clear: none;
}
.cms-duk__item + .cms-duk__item {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e4e7ec;
}
.cms-duk__q {
    margin: 0 0 .4rem;
    font-size: 1.05rem;
    line-height: 1.35;
    clear: none;
}
.cms-duk__a {
    margin: 0;
    color: #334155;
    line-height: 1.5;
}
.cms-duk[data-mce-selected] {
    outline: 2px solid #0d6efd;
    outline-offset: 4px;
}

.gallery {
    display: grid;
    gap: 12px;
    width: 100%;
    margin: 1.25rem 0;
    box-sizing: border-box;
    clear: both;
}
.gallery-item {
    margin: 0;
    padding: 0;
    min-width: 0;
    width: auto;
    max-width: none;
    text-align: center;
}
.gallery-icon,
.gallery-icon a {
    display: block;
    line-height: 0;
}
.gallery img {
    width: 100%;
    height: auto;
    max-width: 100%;
    display: block;
    float: none;
    margin: 0;
    border-radius: 4px;
}
.gallery-caption {
    font-size: .85rem;
    color: #5c6770;
    padding-top: .35rem;
    line-height: 1.35;
}
.gallery-columns-1 { grid-template-columns: 1fr; }
.gallery-columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery-columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery-columns-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gallery-columns-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gallery-columns-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.gallery-columns-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.gallery-columns-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.gallery-columns-9 { grid-template-columns: repeat(9, minmax(0, 1fr)); }

@media (max-width: 700px) {
    .gallery-columns-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gallery-columns-4,
    .gallery-columns-5,
    .gallery-columns-6,
    .gallery-columns-7,
    .gallery-columns-8,
    .gallery-columns-9 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

body:not(.mce-content-body) .cms-content img,
body:not(.mce-content-body) .article__body img,
body:not(.mce-content-body) .cms-gallery img,
body:not(.mce-content-body) .gallery img {
    cursor: zoom-in;
}

.cms-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 24, 40, .88);
    padding: 16px;
}
.cms-lightbox[hidden] { display: none; }
.cms-lightbox img {
    max-width: min(1200px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    width: auto;
    height: auto;
    display: block;
    float: none;
    margin: 0;
    border-radius: 4px;
    cursor: default;
}
.cms-lightbox-close,
.cms-lightbox-prev,
.cms-lightbox-next {
    position: absolute;
    border: 0;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
.cms-lightbox-close { top: 16px; right: 16px; font-size: 32px; }
.cms-lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.cms-lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); }
.cms-lightbox-close:hover,
.cms-lightbox-prev:hover,
.cms-lightbox-next:hover {
    background: rgba(255, 255, 255, .28);
}
