/* The audio effect tools (the online bitcrusher first). Built on the simpleSPU page's
   stickers, keys and tags (/simplespu/retro.css), like the other free tools. Shared
   parts are .at-*, the bitcrusher's own sliders and presets .bc-*. */

.at-page [hidden] { display: none !important; }

/* ── Intro: short, so the tool is on the first screen ── */
main > section.at-intro {
    display: grid;
    justify-items: start;
    gap: 14px;
    max-width: 900px;
    padding-bottom: 26px;
}

.at-intro .section-text { max-width: 40em; }

main > section.at-app {
    display: grid;
    gap: 16px;
    max-width: 900px;
    padding-top: 0;
}

/* ── The file ── */
.at-drop {
    display: grid;
    justify-items: center;
    gap: 14px;
    padding: 24px 20px;
    text-align: center;
    background: var(--panel-raised);
    border: var(--line) dashed var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.at-drop.is-dragging { background: var(--teal-light); }
.at-drop-title { font-weight: 700; font-size: 1.1rem; }

.at-drop-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

/* Once a file is in, the drop zone shrinks to a "swap file" strip. */
.at-drop.is-compact {
    grid-template-columns: minmax(0, 1fr) auto;
    justify-items: start;
    align-items: center;
    padding: 10px 14px;
    text-align: left;
}

.at-drop.is-compact .at-drop-title { font-size: 0.98rem; }
.at-drop.is-compact .button { padding-top: 9px; padding-bottom: 8px; }

.at-loaded {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.at-loaded::before {
    content: "";
    flex: none;
    width: 14px;
    height: 12px;
    margin-top: 0.35em;
    background: var(--ok);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 6'%3E%3Cpath d='M6 0h1v1H6zM5 1h2v1H5zM0 2h1v1H0zM4 2h2v1H4zM0 3h2v1H0zM3 3h2v1H3zM1 4h3v1H1zM2 5h1v1H2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.at-loaded[data-busy]::before { background: var(--muted); }

.at-note {
    padding: 10px 14px;
    font-weight: 500;
    color: var(--ink);
    background: var(--cream);
    border: var(--line) solid var(--ink);
    border-radius: 10px;
}

.at-note[data-tone="error"] { background: #ffd9cb; }
.at-note[data-tone="ok"] { background: #d4ece8; }

/* ── The player ── */
.at-player {
    display: grid;
    gap: 16px;
    padding: 20px 22px 22px;
    transition: opacity 0.2s ease;
}

/* Shown before a file is in, so people see what they'll get. */
.at-player.is-locked { opacity: 0.5; }

.at-transport {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
}

.at-play { min-width: 118px; justify-content: center; }
.at-icon { width: 15px; height: 15px; fill: currentColor; }
.at-play .at-icon-pause,
.at-play.is-playing .at-icon-play { display: none; }
.at-play.is-playing .at-icon-pause { display: block; }

.at-time {
    font: 400 0.95rem/1 var(--font-display);
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.at-compare { margin-left: auto; }

.at-compare[aria-pressed="true"] {
    background: var(--teal-light);
    color: var(--ink);
}

.at-wave {
    --at-wave: var(--text);
    --at-wave-played: var(--accent);
    display: block;
    width: 100%;
    height: 84px;
    background: var(--panel-raised);
    border: var(--line) solid var(--ink);
    border-radius: 10px;
    cursor: pointer;
    touch-action: pan-y;
}

.at-wave:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* Comparing: the waveform goes teal so it's clear the original is playing. */
.is-original .at-wave { --at-wave-played: var(--teal-light); }

/* ── Saving ── */
.at-save {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px 14px;
    padding-top: 16px;
    border-top: var(--line) dashed var(--dim);
}

.at-select {
    display: grid;
    gap: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--muted);
}

.at-select select {
    min-width: 170px;
    font: 700 1rem/1.2 var(--font-body);
    color: var(--ink);
    background: var(--cream);
    border: var(--line) solid var(--ink);
    border-radius: 10px;
    padding: 10px 12px 9px;
    box-shadow: 0 4px 0 var(--ink);
}

.at-select.is-disabled { opacity: 0.5; }
.at-save-button { font-size: 1.05rem; padding-left: 24px; padding-right: 24px; }
.at-save-button .btn-icon { width: 18px; height: 18px; }
.at-download { color: var(--link); font-weight: 700; justify-self: start; }

/* ── Bitcrusher: presets ── */
.bc-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.bc-presets-label {
    margin-right: 4px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--muted);
}

.bc-preset {
    padding: 7px 12px 6px;
    font: 700 0.92rem/1.2 var(--font-body);
    color: var(--ink);
    background: var(--cream);
    border: var(--line) solid var(--ink);
    border-radius: 8px;
    box-shadow: 0 3px 0 var(--ink);
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.bc-preset:hover { background: #fff; }
.bc-preset:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.bc-preset[aria-pressed="true"] { background: var(--accent); }

/* ── Bitcrusher: sliders and screen ── */
.bc-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 18px;
    align-items: stretch;
}

.bc-knobs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 22px;
}

.bc-knob { display: grid; gap: 6px; }

.bc-knob-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-weight: 700;
}

.bc-knob output {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.bc-knob input[type="range"] {
    width: 100%;
    height: 28px;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.bc-knob input[type="range"]:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 6px; }

.bc-knob input[type="range"]::-webkit-slider-runnable-track {
    height: 10px;
    background: var(--track);
    border: var(--line) solid var(--ink);
    border-radius: 6px;
}

.bc-knob input[type="range"]::-moz-range-track {
    height: 6px;
    background: var(--track);
    border: var(--line) solid var(--ink);
    border-radius: 6px;
}

.bc-knob input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    margin-top: -8px;
    background: var(--accent);
    border: var(--line) solid var(--ink);
    border-radius: 6px;
    box-shadow: 0 2px 0 var(--ink);
}

.bc-knob input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent);
    border: var(--line) solid var(--ink);
    border-radius: 6px;
    box-shadow: 0 2px 0 var(--ink);
}

.bc-screen {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 6px;
    min-height: 150px;
    padding: 10px 12px 8px;
    background: var(--screen);
    border: var(--line) solid var(--ink);
    border-radius: 10px;
    box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.18);
}

.at-scope {
    --at-scope: var(--screen-text);
    display: block;
    width: 100%;
    height: 100%;
    min-height: 110px;
}

.bc-screen-text {
    font: 400 0.8rem/1 var(--font-display);
    color: var(--screen-text);
    letter-spacing: 0.02em;
    text-align: right;
}

/* ── Text below the tool ── */
main > section.at-how {
    max-width: 900px;
    padding-bottom: 0;
}

.at-how-body {
    display: grid;
    gap: 14px;
    max-width: 44em;
    margin-top: 18px;
    color: var(--muted);
}

.at-how-body strong { color: var(--text); }

.at-terms {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 10px 18px;
}

.at-terms dt { font-weight: 700; color: var(--text); }

/* ── simpleCrusher, one compact card ── */
main > section.at-cta {
    max-width: 900px;
    padding-bottom: 0;
}

.at-cta-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 22px 24px;
}

.at-cta-text h2 { font-size: clamp(1.15rem, 2.2vw, 1.4rem); }
.at-cta-text p { margin-top: 6px; color: var(--muted); max-width: 44em; }
/* main.js builds the form (data-waitlist); restyled here from the dark footer look. */
.at-waitlist { min-width: 0; }
.at-waitlist .email-signup { grid-template-columns: minmax(0, 1fr); max-width: 520px; gap: 10px; font-family: var(--font-body); }
.at-waitlist .email-signup input { width: 100%; }
.at-waitlist .email-signup-label { color: var(--text); font-size: 1rem; font-weight: 700; }
.at-waitlist .email-signup-row { gap: 12px; }

.at-waitlist .email-signup input {
    height: auto;
    font: 500 1rem/1.2 var(--font-body);
    color: var(--ink);
    background: var(--cream);
    border: var(--line) solid var(--ink);
    border-radius: 10px;
    padding: 12px 14px 11px;
    box-shadow: 0 4px 0 var(--ink);
}

.at-waitlist .email-signup input::placeholder { color: #8a7f80; }
.at-waitlist .email-signup input:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-color: var(--ink); }

.at-waitlist .email-signup button {
    height: auto;
    padding: 12px 18px 11px;
    font: 700 1rem/1.2 var(--font-body);
    color: var(--ink);
    background: var(--accent);
    border: var(--line) solid var(--ink);
    border-radius: 10px;
    box-shadow: 0 4px 0 var(--ink);
}

.at-waitlist .email-signup button:hover,
.at-waitlist .email-signup button:focus-visible { background: var(--accent-light); border-color: var(--ink); }
.at-waitlist .email-signup-status { color: var(--muted); font-size: 0.88rem; }
.at-waitlist .email-signup.is-error .email-signup-status { color: var(--accent-dark); }
.at-waitlist .email-signup.is-done .email-signup-status { color: var(--ok); font-weight: 700; }
.at-cta-more { font-size: 0.95rem; color: var(--muted); }

.at-cta-more a,
.at-guides a,
.at-how-body a { color: var(--link); font-weight: 700; }

.at-guides { margin-top: 28px; color: var(--muted); }

@media (max-width: 760px) {
    .bc-controls { grid-template-columns: minmax(0, 1fr); }
    .bc-screen { min-height: 0; }
    .at-scope { height: 96px; min-height: 0; }
}

@media (max-width: 640px) {
    .at-player { padding: 16px; gap: 14px; }
    .at-drop { padding: 20px 14px; }
    .at-drop-actions, .at-drop-actions > * { width: 100%; justify-content: center; }
    .at-drop.is-compact { grid-template-columns: minmax(0, 1fr); }
    .at-drop.is-compact .at-drop-actions > * { width: auto; }
    .at-drop.is-compact .at-drop-actions { justify-content: flex-start; }
    .at-drop.is-compact [data-at="example"] { display: none; }
    .bc-knobs { gap: 12px 16px; }
    .bc-knob-head { flex-wrap: wrap; gap: 0 8px; }
    .at-compare { margin-left: 0; }
    .at-save > * { width: 100%; }
    .at-select select { width: 100%; }
    .at-save-button { justify-content: center; }
    .at-terms { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    .at-terms dd { margin-bottom: 8px; }
    .at-cta-card { padding: 20px; }
}
