/* Galerie obrázků v textech (arc-gallery.js, Template::markdownToHtml).
   Výchozí rozložení je ve třídě arc-gallery--*, volba čtenáře v data-view. */

.arc-gallery { margin: 1.5rem 0; }
.arc-gallery img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0;
    border-radius: var(--radius-sm, 6px);
    cursor: zoom-in;
}
.arc-gallery:focus-visible { outline: 2px solid var(--color-primary, #8b7cf6); outline-offset: 3px; }

/* Mozaika */
.arc-gallery--masonry:not([data-view]),
.arc-gallery[data-view="masonry"] {
    columns: 3 200px;
    column-gap: .6rem;
}
.arc-gallery--masonry:not([data-view]) img,
.arc-gallery[data-view="masonry"] img {
    width: 100%;
    margin-bottom: .6rem;
    break-inside: avoid;
}

/* Karusel */
.arc-gallery--carousel:not([data-view]),
.arc-gallery[data-view="carousel"] {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    border-radius: var(--radius, 8px);
    background: rgba(0, 0, 0, .25);
}
.arc-gallery--carousel:not([data-view])::-webkit-scrollbar,
.arc-gallery[data-view="carousel"]::-webkit-scrollbar { display: none; }
.arc-gallery--carousel:not([data-view]) img,
.arc-gallery[data-view="carousel"] img {
    flex: 0 0 100%;
    width: 100%;
    height: min(70vh, 560px);
    object-fit: contain;
    border-radius: 0;
    scroll-snap-align: center;
}

/* Pás */
.arc-gallery--strip:not([data-view]),
.arc-gallery[data-view="strip"] {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding-bottom: .4rem;
}
.arc-gallery--strip:not([data-view]) img,
.arc-gallery[data-view="strip"] img {
    flex: none;
    width: auto;
    max-width: none;
    height: 220px;
    scroll-snap-align: start;
}

/* Ovládání (vkládá JS) */
.arc-gallery-frame { margin: 1.5rem 0; }
.arc-gallery-frame .arc-gallery { margin: 0; }
.arc-gallery-bar { display: flex; justify-content: flex-end; gap: .25rem; margin-bottom: .35rem; }
.arc-gallery-bar button,
.arc-gallery-nav {
    border: 1px solid var(--border, rgba(255, 255, 255, .2));
    background: var(--bg-card, rgba(0, 0, 0, .4));
    color: inherit;
    font: inherit;
    line-height: 1;
    cursor: pointer;
}
.arc-gallery-bar button { min-width: 2rem; padding: .3rem .45rem; border-radius: var(--radius-sm, 6px); font-size: .85rem; opacity: .65; }
.arc-gallery-bar button:hover,
.arc-gallery-bar button[aria-pressed="true"] { opacity: 1; border-color: var(--color-primary, #8b7cf6); }
.arc-gallery-stage { position: relative; }
.arc-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    font-size: 1.5rem;
    background: rgba(0, 0, 0, .55);
    color: #fff;
}
.arc-gallery-nav--prev { left: .5rem; }
.arc-gallery-nav--next { right: .5rem; }
.arc-gallery-nav:hover { background: rgba(0, 0, 0, .8); }
.arc-gallery-counter { margin-top: .35rem; text-align: center; font-size: .8rem; opacity: .7; }
.arc-gallery-frame[data-view="masonry"] .arc-gallery-nav,
.arc-gallery-frame:not([data-view="carousel"]) .arc-gallery-counter { display: none; }

/* Při úpravě textu (WYSIWYG) zobrazit galerii jako náhledy. */
[contenteditable="true"] .arc-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    columns: auto;
    overflow: visible;
    padding: .5rem;
    background: none;
    outline: 1px dashed currentColor;
}
[contenteditable="true"] .arc-gallery::before { width: 100%; font-size: .75rem; opacity: .7; }
[contenteditable="true"] .arc-gallery--masonry::before { content: 'Galerie · mozaika'; }
[contenteditable="true"] .arc-gallery--carousel::before { content: 'Galerie · karusel'; }
[contenteditable="true"] .arc-gallery--strip::before { content: 'Galerie · pás'; }
[contenteditable="true"] .arc-gallery img {
    flex: none;
    width: 120px;
    height: 90px;
    max-width: none;
    margin: 0;
    object-fit: cover;
}
