/* The QR scanner (js/web-scanner.js): the app's scanner screen (QrScanPage) in the page. The camera full screen on ink,
   dimmed round a clear rounded window with green corner brackets (QrScanFrame's size and place), the heading on top
   and Cancel at thumb reach in the recorder's dark glass (recorder.css). */

.scanner {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    background: var(--color-ink);
    color: var(--color-white);
    font-family: var(--font-sans), system-ui, sans-serif;
    overscroll-behavior: contain;
    touch-action: none;

    /* QrScanFrame: about two thirds of the narrow side, 200 to 300 px, a little above the middle. */
    --scanner-size: clamp(200px, 68vmin, 300px);
}

.scanner__preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--color-ink);
}

/* The window: everything round it is shaded with ink at 62% (the app's mask) by a shadow far bigger than the screen. */
.scanner__window {
    position: absolute;
    left: calc(50% - var(--scanner-size) / 2);
    top: max(0px, calc(50% - var(--scanner-size) / 2 - 4vh));
    width: var(--scanner-size);
    height: var(--scanner-size);
    border-radius: 24px;
    box-shadow: 0 0 0 200vmax rgba(24, 28, 46, 0.62);
    pointer-events: none;
}

.scanner__corner {
    position: absolute;
    width: 34px;
    height: 34px;
    border: 0 solid var(--color-primary);
}

.scanner__corner--tl {
    top: -2px;
    left: -2px;
    border-top-width: 5px;
    border-left-width: 5px;
    border-top-left-radius: 24px;
}

.scanner__corner--tr {
    top: -2px;
    right: -2px;
    border-top-width: 5px;
    border-right-width: 5px;
    border-top-right-radius: 24px;
}

.scanner__corner--br {
    bottom: -2px;
    right: -2px;
    border-bottom-width: 5px;
    border-right-width: 5px;
    border-bottom-right-radius: 24px;
}

.scanner__corner--bl {
    bottom: -2px;
    left: -2px;
    border-bottom-width: 5px;
    border-left-width: 5px;
    border-bottom-left-radius: 24px;
}

.scanner__top,
.scanner__bottom {
    position: relative; /* over the preview and the mask */
    padding-left: max(var(--spacing-6), env(safe-area-inset-left));
    padding-right: max(var(--spacing-6), env(safe-area-inset-right));
}

.scanner__top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding-top: calc(28px + env(safe-area-inset-top));
    text-align: center;
}

.scanner__heading {
    margin: 0;
    font-size: 22px;
    line-height: 28px;
    font-weight: var(--font-weight-bold);
}

.scanner__hint {
    margin: 0;
    font-size: 15px;
    line-height: var(--leading-body);
    color: rgba(255, 255, 255, 0.85);
}

.scanner__bottom {
    display: flex;
    justify-content: center;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.scanner__cancel {
    height: 56px;
    min-width: 160px;
    padding: 0 28px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(24, 28, 46, 0.7);
    color: var(--color-white);
    font-family: inherit;
    font-size: var(--text-body);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
}

.scanner__cancel:focus-visible {
    outline: 3px solid var(--color-white);
    outline-offset: 3px;
}
