/*
 * Veda Image service styles.
 *
 * Loaded after the pinned shared design assets
 * (vendor/veda-design/0.1.0-pilot-a8b1e40/styles/: tokens, typography,
 * components). Only service-specific layout lives here. Never edit the vendored files; override them in this file.
 *
 * Nothing here targets Mirador's internal classes. The viewer sits inside
 * `.veda-embed`, which the shared CSS does not reach into.
 */

/* ============================================
   Shared parts
   No universal or bare element rules: Mirador and its Material UI
   portals (rendered directly under <body>) keep their own styles.
   ============================================ */

.vi-footer__note {
    margin: 0;
}

/* ============================================
   Index Page
   ============================================ */

.index-page .veda-main > .veda-stack {
    gap: var(--veda-space-5);
}

.vi-section > .veda-h2 {
    padding-block-end: var(--veda-space-2);
    border-block-end: var(--veda-border-width-strong) solid var(--veda-color-border-subtle);
}

.vi-section {
    display: flex;
    flex-direction: column;
    gap: var(--veda-space-4);
}

.vi-section > * {
    margin-block: 0;
}

.vi-section:empty {
    display: none;
}

/* In-page navigation above the comparisons: work links, then the
   comparisons. Links keep the 44px target and wrap inside the page width. */
.vi-jump {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 var(--veda-space-4);
}

.vi-jump[hidden] {
    display: none;
}

.vi-jump__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--veda-space-4);
    min-inline-size: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.vi-jump__list > li {
    min-inline-size: 0;
}

.vi-jump__link {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--veda-target-min);
    overflow-wrap: anywhere;
}

.work-title,
.vi-section > .veda-h2 {
    scroll-margin-block-start: var(--veda-space-4);
}

.preset-card__link {
    font-weight: 700;
}

.preset-card__editions {
    margin: 0;
    color: var(--veda-color-text-muted);
    font-size: var(--veda-font-size-sm);
    overflow-wrap: anywhere;
}

.work-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--veda-space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

/* A rule separates works; no frame, so groups never sit in a box in a box. */
.work-section {
    padding-block-start: var(--veda-space-4);
    border-block-start: var(--veda-border-width) solid var(--veda-color-border-subtle);
}

.work-title {
    margin-block-end: var(--veda-space-3);
}

.edition-groups {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--veda-space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.group-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--veda-space-1) var(--veda-space-3);
}

/* Flex items default to min-width: auto; let long labels wrap inside the card */
.group-header > *,
.edition-list > li,
.edition-list a {
    min-inline-size: 0;
    overflow-wrap: anywhere;
}

.group-category {
    color: var(--veda-color-text-muted);
    font-size: var(--veda-font-size-sm);
}

.group-label {
    margin: 0;
    font-size: var(--veda-font-size-md);
    font-weight: 600;
    line-height: var(--veda-line-height-heading);
}

.compare-link {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--veda-target-min);
    margin-inline-start: auto;
}

.edition-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--veda-space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

.edition-list a {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--veda-target-min);
}

/* ============================================
   Viewer Page
   ============================================ */

.viewer-page {
    display: flex;
    flex-direction: column;
    min-block-size: 100vh;
    min-block-size: 100dvh;
}

.viewer-page .veda-footer {
    margin-block-start: 0;
    padding-block: var(--veda-space-3);
}

.viewer-main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--veda-space-3);
    padding-block: var(--veda-space-3);
}

.viewer-main > * {
    margin-block: 0;
}

#header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--veda-space-2) var(--veda-space-4);
}

#header > * {
    margin: 0;
}

#doc-title {
    flex: 1 1 16rem;
    min-inline-size: 0;
}

.current-editions {
    display: flex;
    flex-wrap: wrap;
    flex-basis: 100%;
    gap: 0 var(--veda-space-5);
    margin: 0;
    padding: 0;
    list-style: none;
}

.current-editions[hidden] {
    display: none;
}

.current-editions > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 var(--veda-space-2);
    min-inline-size: 0;
}

.edition-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.edition-category {
    color: var(--veda-color-text-muted);
    font-size: var(--veda-font-size-sm);
}

.edition-single {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--veda-target-min);
}

/* Selector panel */
#selector-panel {
    max-block-size: 50vh;
    overflow: auto;
}

#selector-panel.hidden {
    display: none;
}

.selector-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
    gap: var(--veda-space-3) var(--veda-space-5);
}

.selector-category__title {
    margin-block-end: var(--veda-space-1);
}

/* At 200% text the legend, category titles and checkbox labels must wrap
   inside the selector instead of widening it. */
.selector-fieldset > .veda-legend,
.selector-category,
.selector-category__title,
.selector-item > span {
    min-inline-size: 0;
    overflow-wrap: anywhere;
}

.selector-items {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Viewer area: Mirador fills the embed; the page scrolls instead of clipping. */
.viewer-embed {
    flex: 1 0 auto;
    min-block-size: 24rem;
    overflow: hidden;
}

#viewer {
    position: absolute;
    inset: 0;
}

@media (min-width: 64rem) and (min-height: 40rem) {
    .viewer-embed {
        min-block-size: 28rem;
    }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 40rem) {
    .compare-link {
        margin-inline-start: 0;
    }

    .edition-list {
        flex-direction: column;
    }

    .viewer-embed {
        min-block-size: 70vh;
    }
}
