/* The video recorder (js/web-recorder.js): the camera full screen on ink, with the controls in the app's camera style
   (the QR scanner's): white Sen text, dark glass buttons with a faint white edge, Close/Cancel at thumb reach. The
   record button is the snap colour, as video challenges are. */

.recorder {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--color-ink);
    color: var(--color-white);
    font-family: var(--font-sans), system-ui, sans-serif;
    overscroll-behavior: contain;
    touch-action: none;
}

.recorder__preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--color-ink);
}

.recorder__top,
.recorder__bottom {
    position: relative; /* over the preview */
    padding-left: max(var(--spacing-6), env(safe-area-inset-left));
    padding-right: max(var(--spacing-6), env(safe-area-inset-right));
}

.recorder__top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding-top: calc(28px + env(safe-area-inset-top));
    padding-bottom: var(--spacing-8);
    text-align: center;
    /* a soft shade so the text reads on a bright scene */
    background: linear-gradient(to bottom, rgba(24, 28, 46, 0.6), rgba(24, 28, 46, 0));
}

.recorder__heading {
    margin: 0;
    font-size: 22px;
    line-height: 28px;
    font-weight: var(--font-weight-bold);
}

.recorder__hint {
    margin: 0;
    font-size: 15px;
    line-height: var(--leading-body);
    color: rgba(255, 255, 255, 0.85);
}

.recorder__timer {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    height: 36px;
    padding: 0 var(--spacing-4);
    border-radius: var(--radius-pill);
    background: rgba(24, 28, 46, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-size: var(--text-body);
    font-weight: var(--font-weight-bold);
    font-variant-numeric: tabular-nums;
}

.recorder__timer[hidden] {
    display: none;
}

.recorder__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-snap);
    animation: recorder-blink 1s steps(2, start) infinite;
}

@keyframes recorder-blink {
    to { visibility: hidden; }
}

.recorder__bottom {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--spacing-4);
    padding-top: var(--spacing-8);
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(24, 28, 46, 0.6), rgba(24, 28, 46, 0));
}

.recorder__cancel {
    justify-self: start;
    height: 56px;
    min-width: 112px;
    padding: 0 var(--spacing-6);
    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;
}

/* A white ring round the snap-coloured mark: a dot to start, a rounded square to stop. */
.recorder__record {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    padding: 0;
    border-radius: 50%;
    border: 4px solid var(--color-white);
    background: rgba(24, 28, 46, 0.35);
    cursor: pointer;
}

.recorder__record:disabled {
    opacity: var(--opacity-muted);
    cursor: default;
}

.recorder__record-mark {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-snap);
    transition: width 0.15s, height 0.15s, border-radius 0.15s;
}

.recorder__record--on .recorder__record-mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.recorder__cancel:focus-visible,
.recorder__record:focus-visible {
    outline: 3px solid var(--color-white);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .recorder__dot { animation: none; }
    .recorder__record-mark { transition: none; }
}
