/* /soundscape/: the mixer. The shared styles are in /commons/growth/growth.css. */

.mixer-heading {
    margin-top: 10px;
    font-size: 34px;
    line-height: 1.2;
}

.starters {
    margin-top: 22px;
}

.starters .chips {
    margin-top: 8px;
}

.mixer {
    margin-top: 24px;
}

/* The sounds */

.sounds {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 10px;
}

/* Messages sit above the bar on this page */
.toast {
    bottom: calc(150px + env(safe-area-inset-bottom));
}

.sound {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--night-raised);
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sound--on {
    border-color: var(--violet-bright);
    box-shadow: 0 0 0 1px var(--violet-bright), 0 12px 30px -14px var(--violet-glow);
}

.sound-toggle {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 0;
    background: var(--night-high);
    text-align: left;
    cursor: pointer;
}

.sound-toggle img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.75;
    transition: opacity 0.2s ease, transform 0.4s ease;
}

.sound-toggle::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(7, 12, 36, 0) 35%, rgba(7, 12, 36, 0.88) 100%);
}

.sound--on .sound-toggle img {
    opacity: 1;
}

@media (hover: hover) {
    .sound-toggle:hover img {
        opacity: 1;
        transform: scale(1.04);
    }
}

.sound-toggle:focus-visible {
    outline: 2px solid var(--violet-bright);
    outline-offset: -2px;
}

.sound-title {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 10px;
    z-index: 1;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

/* Little bars that move while the layer plays */
.sound-eq {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    display: none;
    align-items: flex-end;
    gap: 3px;
    height: 16px;
    padding: 4px 5px;
    border-radius: 6px;
    background: rgba(7, 12, 36, 0.6);
    box-sizing: content-box;
}

.sound--on .sound-eq {
    display: flex;
}

.sound-eq i {
    width: 3px;
    height: 30%;
    border-radius: 2px;
    background: #fff;
}

.mixer--playing .sound--on .sound-eq i {
    animation: eq 1.1s ease-in-out infinite;
}

.mixer--playing .sound--on .sound-eq i:nth-child(2) {
    animation-delay: -0.4s;
}

.mixer--playing .sound--on .sound-eq i:nth-child(3) {
    animation-delay: -0.8s;
}

@keyframes eq {
    0%,
    100% {
        height: 25%;
    }

    50% {
        height: 100%;
    }
}

/* Volume for a layer */
.sound-volume {
    display: block;
    padding: 10px 12px 12px;
}

.sound-volume input {
    display: block;
    width: 100%;
    height: 24px;
    margin: 0;
    background: none;
    accent-color: var(--violet-bright);
    cursor: pointer;
}

.mixer--volume-locked .sound-volume {
    display: none;
}

/* The bar: play, what's in the mix, sleep timer, share. Stays in view while you pick sounds. */

.mix-bar {
    position: sticky;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 5;
    display: grid;
    gap: 12px;
    margin-top: 18px;
    padding: 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(12, 22, 64, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 20px 50px -16px rgba(0, 0, 0, 0.85);
}

.mix-bar-main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.mix-play {
    position: relative;
    flex: none;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: var(--violet);
    box-shadow: 0 10px 28px -8px var(--violet-glow);
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.mix-play:hover,
.mix-play:focus-visible {
    background: var(--violet-bright);
}

.mix-play:active {
    transform: scale(0.95);
}

.mix-play[disabled] {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
    cursor: default;
}

.mix-play svg {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 24px;
    height: 24px;
    fill: #fff;
}

.mix-play .icon-play {
    transform: translateX(2px);
}

.mix-play .icon-pause,
.mixer--playing .mix-play .icon-play {
    display: none;
}

.mixer--playing .mix-play .icon-pause {
    display: block;
}

.mix-bar-text {
    min-width: 0;
}

.mix-bar-title {
    font-weight: 600;
}

.mix-bar-detail {
    font-size: 14px;
    color: var(--text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mix-bar-tools {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mix-timer {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}

.mix-timer svg {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    pointer-events: none;
    color: var(--text-soft);
}

.mix-timer select {
    width: 100%;
    min-height: 44px;
    padding: 8px 32px 8px 38px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: rgba(255, 255, 255, 0.04) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='white' stroke-opacity='0.7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center / 16px;
    color: var(--text);
    font: inherit;
    font-size: 15px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.mix-timer select option {
    background: var(--night-raised);
}

.mix-share {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 8px 16px;
    font-size: 15px;
}

.mix-bar-note {
    font-size: 13px;
    color: var(--text-faint);
}

/* Beside the mixer */

.mixer-aside {
    display: grid;
    gap: 24px;
}

.about h2 {
    font-size: 20px;
    font-weight: 600;
}

.about p {
    margin-top: 10px;
    color: var(--text-soft);
}

@media (min-width: 560px) {
    .sounds {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 880px) {
    .mixer-heading {
        font-size: 44px;
    }

    .mix-bar {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        padding: 12px 14px;
    }

    .mix-bar-note {
        grid-column: 1 / -1;
    }

    .mix-timer {
        flex: 0 0 auto;
    }

    .mixer-aside {
        position: sticky;
        top: 24px;
    }

    .toast {
        bottom: calc(110px + env(safe-area-inset-bottom));
    }
}
