/* 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;
}

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-full { max-width: 100%; height: auto; width: auto; }
img.cms-img-left { float: left; margin: 0 1rem 1rem 0; }
img.cms-img-right { float: right; margin: 0 0 1rem 1rem; }

figure.cms-figure {
    margin: 1rem 0;
    display: table;
}
figure.cms-figure img { max-width: 100%; height: auto; display: block; }
figure.cms-figure figcaption {
    font-size: .9rem;
    color: #5c6770;
    padding-top: .4rem;
}

.cms-gallery {
    display: grid;
    gap: 15px;
    width: max-content;
    max-width: 100%;
    margin: 1rem 0;
    cursor: pointer;
    box-sizing: border-box;
    align-items: start;
    justify-items: start;
}
.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, var(--cms-tile, 300px)); }
.cms-gallery-2 { grid-template-columns: repeat(2, minmax(0, var(--cms-tile, 300px))); }
.cms-gallery-3 { grid-template-columns: repeat(3, minmax(0, var(--cms-tile, 300px))); }
.cms-gallery-4 { grid-template-columns: repeat(4, minmax(0, var(--cms-tile, 300px))); }
.cms-gallery-5 { grid-template-columns: repeat(5, minmax(0, var(--cms-tile, 300px))); }
.cms-gallery-size-thumb { --cms-tile: 150px; }
.cms-gallery-size-medium { --cms-tile: 300px; }
.cms-gallery-size-large { --cms-tile: 600px; }
.cms-gallery-size-full {
    --cms-tile: minmax(0, 1fr);
    width: 100%;
}
.cms-gallery img {
    display: block;
    border-radius: 4px;
    width: auto;
    height: auto;
    max-width: min(100%, var(--cms-tile, 300px));
    max-height: var(--cms-tile, 300px);
}
.cms-gallery-size-full img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.cms-chart {
    margin: 1.25rem 0;
    padding: 1rem;
    background: #f8f9fb;
    border-radius: 8px;
}
.cms-chart svg { width: 100%; height: auto; display: block; }
.cms-chart figcaption {
    text-align: center;
    font-weight: 600;
    margin-top: .75rem;
}

.gallery {
    display: grid;
    gap: 12px;
    width: 100%;
    margin: 1.25rem 0;
    box-sizing: border-box;
}
.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;
    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-gallery img,
body:not(.mce-content-body) .gallery img,
body:not(.mce-content-body) img[data-full] {
    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;
    border-radius: 4px;
}
.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);
}
