/*
 * Камера Гермеса: шторка съёмки в чате и превью в голосовом разговоре.
 * Подключается после hermes-composer-tools.css. Сцена съёмки всегда тёмная (как видоискатель), остальное — токены app.css.
 */

/* ---------- шторка съёмки в чате ---------- */

.hermes-dashboard .camera-sheet {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    flex-direction: column;
    color: #f4f1f3;
    background: #0d0d0e;
    outline: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.hermes-dashboard .camera-sheet__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.hermes-dashboard .camera-sheet__video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #0d0d0e;
}

.hermes-dashboard .camera-sheet__video--mirror,
.hermes-dashboard .voice-camera__video--mirror {
    transform: scaleX(-1);
}

.hermes-dashboard .camera-sheet__flash {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0.55;
    pointer-events: none;
}

.hermes-dashboard .camera-sheet__state,
.hermes-dashboard .camera-sheet__notice {
    position: absolute;
    left: 50%;
    max-width: min(24rem, calc(100% - 2rem));
    margin: 0;
    padding: 0.625rem 0.875rem;
    border-radius: 0.875rem;
    color: #f4f1f3;
    background: rgb(23 23 24 / 0.82);
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: center;
    transform: translateX(-50%);
}

.hermes-dashboard .camera-sheet__state {
    top: 50%;
    translate: 0 -50%;
}

.hermes-dashboard .camera-sheet__notice {
    bottom: 1rem;
}

.hermes-dashboard .camera-sheet__state--error {
    width: min(24rem, calc(100% - 2rem));
    display: grid;
    gap: 0.75rem;
    justify-items: center;
}

.hermes-dashboard .camera-sheet__state--error p {
    margin: 0;
}

.hermes-dashboard .camera-sheet__retry {
    min-height: 2.75rem;
    padding: 0 1rem;
    border: 1px solid rgb(244 241 243 / 0.4);
    border-radius: 999px;
    color: inherit;
    background: transparent;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.hermes-dashboard .camera-sheet__live,
.hermes-dashboard .voice-camera__live {
    position: absolute;
    top: max(0.75rem, env(safe-area-inset-top, 0px));
    left: 0.75rem;
    display: none;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    color: #f4f1f3;
    background: rgb(23 23 24 / 0.7);
    font-size: 0.75rem;
    font-weight: 500;
}

.hermes-dashboard .camera-sheet__live--on,
.hermes-dashboard .voice-camera__live {
    display: inline-flex;
}

.hermes-dashboard .camera-sheet__live i,
.hermes-dashboard .voice-camera__live i {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #ff5a5a;
    animation: hermes-camera-pulse 1.6s ease-in-out infinite;
}

@keyframes hermes-camera-pulse {
    50% { opacity: 0.35; }
}

.hermes-dashboard .camera-sheet__bar {
    flex: none;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 1rem 1.25rem 1.25rem;
    background: #0d0d0e;
}

.hermes-dashboard .camera-sheet__side {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #f4f1f3;
    background: rgb(244 241 243 / 0.14);
    cursor: pointer;
}

.hermes-dashboard .camera-sheet__side--gap {
    visibility: hidden;
}

.hermes-dashboard .camera-sheet__side:first-child {
    justify-self: start;
}

.hermes-dashboard .camera-sheet__bar > :last-child {
    justify-self: end;
}

.hermes-dashboard .camera-sheet__side:disabled,
.hermes-dashboard .camera-sheet__switch:disabled {
    opacity: 0.4;
    cursor: default;
}

.hermes-dashboard .camera-sheet__side svg,
.hermes-dashboard .camera-sheet__switch svg {
    width: 1.5rem;
    height: 1.5rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hermes-dashboard .camera-sheet__shutter {
    display: grid;
    place-items: center;
    width: 4.5rem;
    height: 4.5rem;
    padding: 0;
    border: 3px solid #f4f1f3;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.hermes-dashboard .camera-sheet__shutter span {
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 50%;
    background: #f4f1f3;
    transition: transform 120ms ease;
}

.hermes-dashboard .camera-sheet__shutter:active:not(:disabled) span {
    transform: scale(0.88);
}

.hermes-dashboard .camera-sheet__shutter:disabled {
    opacity: 0.4;
    cursor: default;
}

.hermes-dashboard .camera-sheet__done {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 3rem;
    padding: 0 1.1rem;
    border: 0;
    border-radius: 999px;
    color: var(--hermes-accent-ink, #171718);
    background: var(--hermes-accent-hi, #a294ad);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.hermes-dashboard .camera-sheet__count {
    display: inline-grid;
    place-items: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    color: var(--hermes-accent-hi, #a294ad);
    background: var(--hermes-accent-ink, #171718);
    font-size: 0.8rem;
}

.hermes-dashboard .camera-sheet__switch {
    position: absolute;
    top: max(0.75rem, env(safe-area-inset-top, 0px));
    right: 0.75rem;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #f4f1f3;
    background: rgb(23 23 24 / 0.7);
    cursor: pointer;
}

.hermes-dashboard .camera-sheet :is(button):focus-visible {
    outline: 2px solid #f4f1f3;
    outline-offset: 2px;
}

/* ---------- превью камеры в голосовом разговоре ---------- */

.hermes-dashboard .voice-camera {
    position: relative;
    display: grid;
    gap: 0.5rem;
    width: min(100%, 20rem);
}

.hermes-dashboard .voice-camera[hidden] {
    display: none;
}

.hermes-dashboard .voice-camera__video {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 1rem;
    /* Человек видит весь кадр, который может уйти Гермесу: без обрезки по краям. */
    object-fit: contain;
    background: #0d0d0e;
}

.hermes-dashboard .voice-camera__live {
    top: 0.5rem;
    left: 0.5rem;
}

.hermes-dashboard .voice-camera__actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.hermes-dashboard .voice-camera__button {
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0 0.9rem;
    border: 1px solid var(--hermes-line);
    border-radius: 999px;
    color: var(--hermes-text);
    background: var(--hermes-panel-raised);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}

.hermes-dashboard .voice-camera__button:disabled {
    opacity: 0.5;
    cursor: default;
}

.hermes-dashboard .voice-camera__hint,
.hermes-dashboard .voice-camera__notice {
    margin: 0;
    color: var(--hermes-dim);
    font-size: 0.8rem;
    line-height: 1.35;
    text-align: center;
}

.hermes-dashboard .voice-camera__notice {
    max-width: 20rem;
    color: var(--hermes-text);
}

/* Превью, подсказка и действия не должны выталкивать сферу за экран на низких телефонах и в ландшафте. */
.hermes-dashboard .voice-mode__stage {
    justify-content: safe center;
    overflow-y: auto;
}

.hermes-dashboard .voice-mode__pill--active {
    border-color: rgb(var(--hermes-accent-rgb) / 0.8);
}

/* На телефоне сфера и так занимает сцену: превью делаем компактнее, чтобы не вытеснить её. */
@media (max-width: 720px) {
    .hermes-dashboard .voice-camera {
        width: min(100%, 11rem);
    }

    .hermes-dashboard .voice-camera__video {
        aspect-ratio: 3 / 4;
        max-height: 30vh;
    }
}
