/* The Drone Zone — day theme (stark black & white, matches lab index) */

:root {
    --black: #000000;
    --white: #ffffff;
    --muted: rgba(0, 0, 0, 0.55);
    --quiet: rgba(0, 0, 0, 0.4);
    --serif: "Playfair Display", Georgia, serif;
    --sans: Lato, system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.drone-page {
    font-family: var(--sans);
    text-align: center;
    background-color: var(--white);
    color: var(--black);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* The two sounding waves, drawn across the page behind the card */
#waves {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.main-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 24px 36px;
    width: 100%;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--white);
    border: 2px solid var(--black);
    padding: clamp(28px, 6vw, 44px) clamp(20px, 5vw, 40px);
    max-width: 580px;
    width: 100%;
}

/* ---------- Header ---------- */

/* Name and title match the other Lab games (Crazy Pitches, Ear Doctor). */
#subtitle {
    text-transform: uppercase;
    font-size: 10pt;
    letter-spacing: 2px;
    margin: 0;
}

#title {
    font-family: "Dancing Script", cursive;
    font-weight: 700;
    font-size: clamp(2.5rem, 11vw, 3rem);
    margin: 0 0 8px;
    line-height: 1.1;
}

#instructions {
    font-size: 14px;
    font-style: italic;
    color: var(--muted);
    margin: 0;
    line-height: 1.45;
}

/* ---------- Buttons ----------
   Only Play is a box. Every other control is plain text: grey when it is a
   choice not taken, black and bold when it is the one in use. */

button {
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.25;
    color: var(--quiet);
    background: none;
    border: 0;
    border-radius: 0;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.12s ease, opacity 0.12s ease;
}

button[aria-pressed="true"] {
    color: var(--black);
    font-weight: 700;
}

button:disabled {
    opacity: 0.2;
    cursor: default;
}

button:focus-visible,
input[type="range"]:focus-visible {
    outline: 2px solid var(--black);
    outline-offset: 2px;
}

/* Hover only where there is a real pointer; on touch it sticks after a tap. */
@media (hover: hover) {
    button:hover:not(:disabled) {
        color: var(--black);
    }
}

/* ---------- The two pitches ---------- */

.pitches {
    --note-size: clamp(4rem, 19vw, 6rem);
    display: grid;
    grid-template-columns: auto 1fr 1fr auto;
    column-gap: 8px;
    width: 100%;
    max-width: 420px;
    margin-top: clamp(24px, 5vw, 36px);
}

/* Lower / raise: one on each side of the pair, level with the notes, because
   they move both notes together. */
.step-button {
    align-self: start;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 18px;
    color: var(--black);
    margin-top: calc((var(--note-size) - 44px) / 2);
}

@media (hover: hover) {
    .step-button:hover:not(:disabled),
    .reference button:hover:not(:disabled) {
        color: var(--muted);
    }
}

.voice {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.note {
    font-family: var(--serif);
    font-weight: 700;
    font-size: var(--note-size);
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--black);
    margin: 0;
    padding: 0;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}

.note .accidental {
    font-family: "Arial Unicode MS", "Apple Symbols", "Segoe UI Symbol", sans-serif;
    font-weight: 400;
    font-size: 0.62em;
    letter-spacing: 0;
    margin-left: 0.03em;
    vertical-align: 0.28em;
}

.note .octave {
    font-family: var(--sans);
    font-weight: 400;
    font-size: 0.26em;
    letter-spacing: 0;
    color: var(--muted);
    margin-left: 0.2em;
}

.hz {
    font-size: 14px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    margin: 8px 0 0;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}

.voice.is-muted .note,
.voice.is-muted .hz {
    opacity: 0.2;
}

/* ---------- Play ---------- */

#play-stop-button {
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.04em;
    border: 2px solid var(--black);
    background-color: var(--black);
    color: var(--white);
    transition: background-color 0.12s ease, color 0.12s ease;
}

/* Sounding: the button opens up, so "Stop" reads as the quieter state to return to */
#play-stop-button.playing {
    background-color: var(--white);
    color: var(--black);
}

@media (hover: hover) {
    #play-stop-button:hover:not(.playing) {
        background-color: #333333;
        border-color: #333333;
        color: var(--white);
    }

    #play-stop-button.playing:hover {
        background-color: var(--black);
        color: var(--white);
    }
}

/* ---------- Settings: a label on the left, its choices on the right ---------- */

.settings {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 24px;
    align-items: center;
    width: 100%;
    margin-top: 22px;
    text-align: left;
}

.row {
    display: contents;
}

.row-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 18px;
    min-height: 38px;
    min-width: 0;
}

.options button {
    padding: 8px 0;
    white-space: nowrap;
}

/* Invisible bold copy of the label: holds the button at its widest, so
   choosing one never nudges its neighbours. */
.options button[aria-pressed]::after {
    content: attr(data-label);
    display: block;
    height: 0;
    overflow: hidden;
    visibility: hidden;
    font-weight: 700;
}

.options input[type="range"] {
    width: 100%;
    margin: 0;
    accent-color: var(--black);
}

/* Seven waves on one line */
.waves-row {
    column-gap: 11px;
}

.reference {
    column-gap: 12px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.reference button {
    font-size: 16px;
    color: var(--black);
    padding: 6px 4px;
    margin: 0 -4px;
}

/* The less-used settings, folded away until asked for */
.more-button {
    grid-column: 1 / -1;
    justify-self: start;
    padding: 12px 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* The drawer keeps the list's two columns (subgrid) and opens by growing
   its one row from nothing to its natural height. */
.more {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: subgrid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s ease;
}

.more.is-open {
    grid-template-rows: 1fr;
}

.more-inner {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: subgrid;
    align-items: center;
    overflow: hidden;
    min-height: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.more.is-open > .more-inner {
    opacity: 1;
    transition: opacity 0.3s ease 0.1s;
}

/* ---------- Custom waveform mix (opens under Wave) ---------- */

.custom-mix-panel {
    grid-column: 2;
    display: grid;
    grid-template-rows: 0fr;
    padding: 0;
    pointer-events: none;
    transition: grid-template-rows 0.35s ease, padding 0.35s ease;
}

.custom-mix-panel.is-open {
    grid-template-rows: 1fr;
    padding: 8px 0 12px;
    pointer-events: auto;
}

.custom-mix-faders {
    display: flex;
    gap: 14px;
    overflow: hidden;
    min-height: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.custom-mix-panel.is-open > .custom-mix-faders {
    opacity: 1;
    transition: opacity 0.28s ease 0.1s;
}

.slider-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 56px;
}

.slider-wrapper label {
    font-size: 11px;
    letter-spacing: 0.02em;
    color: var(--muted);
}

.mix-fader {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 28px;
    height: 100px;
    accent-color: var(--black);
    margin: 0;
}

/* ---------- Phone: each label sits above its choices ---------- */

@media (max-width: 600px) {
    .main-container {
        padding: 8px;
    }

    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .settings {
        grid-template-columns: 1fr;
        margin-top: 12px;
    }

    .row-label {
        margin-top: 10px;
    }

    .options {
        column-gap: 16px;
        min-height: 34px;
    }

    .custom-mix-panel {
        grid-column: 1;
    }

    /* Narrow phones: the seven waves share the line, a touch smaller. */
    .waves-row {
        flex-wrap: nowrap;
        justify-content: space-between;
        column-gap: 4px;
    }

    .options.waves-row button {
        font-size: clamp(11.5px, 3.6vw, 14px);
    }
}

@media (max-width: 350px) {
    .hz {
        font-size: 11.5px;
    }

    .options {
        column-gap: 12px;
    }

    .options button {
        font-size: 13px;
    }

    .waves-row {
        column-gap: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
    }
}
