/*
 * Audiogram maker (audiogram.js): upload, the part to use, live preview and export.
 * Used on /audiogram and the home page tab, with captions.css (the caption list and the fonts). Builds on spokly.css.
 */

.agm { display: flex; flex-direction: column; gap: 16px; }
.agm-upload, .agm-editor, .agm-trim { display: flex; flex-direction: column; gap: 12px; }
.agm-editor { gap: 20px; }
.agm-limit { margin: 0; }
.agm-trim-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }

/* The waveform with its two handles */
.agm-wave { position: relative; height: 96px; margin-inline: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-subtle); touch-action: pan-y; cursor: pointer; }
.agm-wave canvas { display: block; width: 100%; height: 100%; border-radius: 11px; }
.agm-shade { position: absolute; top: 0; bottom: 0; left: 0; background: var(--bg); opacity: .72; pointer-events: none; }
.agm-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--danger); pointer-events: none; }
.agm-handle { position: absolute; top: -5px; bottom: -5px; width: 24px; margin-left: -12px; border-radius: 8px; touch-action: none; cursor: ew-resize; }
.agm-handle::after { content: ""; position: absolute; top: 0; bottom: 0; left: 8px; width: 8px; border-radius: 4px; background: var(--primary); }
.agm-handle:hover::after, .agm-handle.is-drag::after { box-shadow: 0 0 0 3px var(--overlay); }
.agm-transport { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.agm-time { display: flex; flex-direction: column; gap: 4px; }

.agm-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 900px) { .agm-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr); } .agm-preview { position: sticky; top: calc(var(--nav-h) + 16px); } }
.agm-preview { display: flex; justify-content: center; min-width: 0; }
.agm-stage { max-width: 100%; border-radius: 14px; overflow: hidden; background: #000; box-shadow: var(--shadow); }
.agm-stage canvas { display: block; width: 100%; height: 100%; }
.agm-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.agm-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.agm-swatch { width: 32px; height: 32px; padding: 0; border: 1px solid var(--border-strong); border-radius: 50%; cursor: pointer; }
.agm-swatch.is-auto { background: conic-gradient(#FFFFFF 0 50%, #0C0A09 50% 100%); }
.agm-swatch[aria-checked="true"] { outline: 2px solid var(--text); outline-offset: 2px; }
.agm-custom { width: 36px; height: 32px; padding: 0; border: 0; background: none; cursor: pointer; }
.agm-image { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: -8px; }
.agm-image .small { min-width: 0; overflow-wrap: anywhere; }
.agm-file { position: relative; overflow: hidden; cursor: pointer; }
.agm-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.agm-title { min-height: 76px; line-height: 1.5; resize: none; }
.agm-caps, .agm-capbox, .agm-capedit { display: flex; flex-direction: column; gap: 12px; }
.agm-caps { padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.agm-check { margin: 0; font-size: 14px; font-weight: 500; }
.agm-next { display: flex; flex-direction: column; gap: 4px; }
