/**
 * Every dialog: the overlay and dialog shell, and the contents each one holds.
 * Buttons, inputs and selects come from controls.css.
 */

.vo-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-overlay);
    background: var(--scrim);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: var(--sp-11) var(--sp-7);
    overflow: auto;
}

.vo-overlay[data-open="true"] {
    display: flex;
}

/* The intro is closed by [hidden] rather than by data-open, so it is shown by
   default and the global [hidden] rule takes it away. */
.vo-overlay--intro {
    display: flex;
    align-items: center;
    z-index: var(--z-intro);
    background: var(--scrim-strong);
    padding: var(--sp-9);
}

.vo-dialog {
    display: flex;
    flex-direction: column;
    gap: var(--sp-7);
    width: var(--measure);
    max-width: 100%;
    padding: var(--sp-9);
    background: var(--bg-surface);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-dialog);
    font-family: var(--font-ui);
    color: var(--text);
}

/* A dialog of settings is a column of short rows; at the full measure each
   label sits alone at the end of an empty line. */
.vo-dialog--narrow {
    width: var(--measure-sm);
}

.vo-dialog--intro {
    width: var(--measure-md);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-overlay);
    max-height: 90vh;
    max-height: 90dvh;
    overflow: auto;
}

.vo-dialog__title {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
    color: var(--chrome-accent-dark);
}

.vo-dialog__hint {
    font-size: var(--fs-md);
    line-height: var(--lh-loose);
    color: var(--text);
    margin: 0;
}

.vo-dialog__body {
    font-size: var(--fs-md);
    line-height: var(--lh-loose);
    color: var(--text);
}

.vo-dialog__body p {
    margin: 0 0 var(--sp-6);
}

.vo-dialog__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
}

.vo-dialog__list li {
    padding: var(--sp-5) var(--sp-6);
    background: var(--bg-section);
    border-radius: var(--r-md);
    font-size: var(--fs-md);
    line-height: var(--lh-normal);
}

.vo-dialog__list strong {
    color: var(--chrome-accent-dark);
}

.vo-dialog__error {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-normal);
    color: var(--err-fg);
    margin: 0;
}

.vo-dialog__actions {
    display: flex;
    gap: var(--sp-5);
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Dismissal, not a call to action: it closes what the reader has finished
   with, so it is never the filled button. */
.vo-dialog__close {
    align-self: flex-end;
}

/* One step back inside the dialog, not a way out of it: it stands at the start
   of the row rather than across it. */
.vo-dialog__back {
    align-self: flex-start;
}

/* Export picker: PDF and image, each with one full-width button per preset. */
.vo-export__group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.vo-export__group-title {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    letter-spacing: var(--ls-caps);
    text-transform: uppercase;
    color: var(--text-muted);
}

.vo-export__options {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.vo-export__sheets {
    display: flex;
    gap: var(--sp-3);
}

.vo-export__sheets:empty {
    display: none;
}

.vo-export__sheet {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border: var(--bw) solid var(--border-control);
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    color: var(--text-control);
    cursor: pointer;
}

.vo-export__sheet:has(input:checked) {
    border-color: var(--chrome-accent);
    background: var(--brand-teal-tint);
    color: var(--chrome-accent-dark);
    font-weight: var(--fw-semibold);
}

/* A list of offers — a template, an example — each row pressable as a whole. */
.vo-picklist {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
}

/* A list of hundreds scrolls inside the dialog: let it grow instead and the
   Schließen button ends up a page below the fold. */
.vo-picklist--scroll {
    max-height: var(--picklist-h);
    overflow-y: auto;
    padding-right: var(--sp-3);
}

.vo-picklist li {
    padding: var(--sp-6) var(--sp-7);
    border: var(--bw) solid var(--border-soft);
    border-radius: var(--r-sm);
    background: var(--bg-surface);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease),
                border-color var(--t-fast) var(--ease);
}

.vo-picklist li:hover {
    background: var(--brand-teal-tint);
    border-color: var(--chrome-accent);
}

.vo-picklist__title {
    font-size: var(--fs-base);
    font-weight: var(--fw-bold);
    line-height: var(--lh-snug);
    color: var(--text);
    margin-bottom: var(--sp-3);
}

/* A code is read character by character and compared against another screen. */
.vo-picklist__title--code {
    font-family: var(--font-mono);
    font-weight: var(--fw-normal);
    letter-spacing: var(--ls-snug);
    margin-bottom: 0;
}

.vo-picklist__desc {
    font-size: var(--fs-sm);
    line-height: var(--lh-normal);
    color: var(--text-soft);
}

/* Darstellung — how what is filled in is drawn. The dialog's title names the
   panel, so it carries no heading of its own. */
.vo-set {
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
    font-family: var(--font-ui);
    font-size: var(--fs-sm);
    color: var(--text-soft);
}

.vo-set__row {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.vo-set__row--inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
}

.vo-set__group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
}

.vo-set__sep {
    height: var(--bw);
    background: var(--chrome-line);
}

.vo-set input[type="range"] {
    width: 100%;
    accent-color: var(--chrome-ink);
}

.vo-set input[type="color"] {
    width: var(--sp-11);
    height: var(--sp-9);
    padding: 0;
    border: var(--bw) solid var(--chrome-line-strong);
    border-radius: var(--r-sm);
    background: var(--bg-surface);
}

@media (max-width: 768px) {
    .vo-overlay {
        padding: var(--sp-9) var(--sp-6);
    }

    .vo-dialog {
        width: 100%;
        max-height: calc(100vh - var(--sp-11));
        max-height: calc(100dvh - var(--sp-11));
        overflow: auto;
        padding: var(--sp-7);
        gap: var(--sp-6);
    }

    .vo-overlay--intro {
        padding: var(--sp-6);
        align-items: flex-end;
    }

    .vo-dialog--intro {
        padding: var(--sp-8);
        max-height: 85dvh;
        border-radius: var(--r-xl);
    }

    .vo-dialog--intro .vo-dialog__title {
        font-size: var(--fs-xl);
    }

    .vo-dialog__actions {
        flex-direction: column-reverse;
        gap: var(--sp-4);
    }

    .vo-dialog__actions .vo-btn {
        width: 100%;
    }

    .vo-picklist li {
        padding: var(--sp-7) var(--sp-6);
        min-height: calc(var(--touch-h) + var(--sp-6));
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}
