/* Sprachnachrichten — Secta Theme
   Design: --step-basiert, Mediaevalziffern im Text, tabular-nums im Timer.
   Schwarze Flaechen nur exakt quadratisch oder randlos. Kein border-radius auf Schwarz.
   Akzentfarbe nur als Linie/Kante/Fokusring. */

.secta-voice {
    max-width: var(--measure, 33em);
    margin: calc(var(--step, 15px) * 2) auto 0;
}

/* --- Vertrauens-Hinweis --- */

.voice-trust {
    color: #555;
    font-style: italic;
    margin: 0 0 calc(var(--step, 15px) * 2);
}

/* --- Fieldsets & Radios --- */

.voice-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 calc(var(--step, 15px) * 2);
}

.voice-legend {
    font-family: var(--font-ui, sans-serif);
    font-weight: 700;
    margin-bottom: var(--step, 15px);
    padding: 0;
}

.voice-radio {
    display: flex;
    align-items: baseline;
    gap: calc(var(--step, 15px) * 0.5);
    margin-bottom: calc(var(--step, 15px) * 0.5);
    cursor: pointer;
}

.voice-radio input[type="radio"] {
    accent-color: var(--color-accent, currentColor);
}

.voice-input {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 20em;
    padding: calc(var(--step, 15px) * 0.5) calc(var(--step, 15px) * 0.75);
    margin: 0 0 var(--step, 15px) calc(var(--step, 15px) * 1.5);
    border: 1px solid #999;
    font: inherit;
    background: transparent;
}

.voice-input:disabled {
    opacity: 0.4;
}

.voice-input:focus-visible {
    outline: 2px solid var(--color-accent, currentColor);
    outline-offset: 1px;
    border-color: transparent;
}

/* --- Buttons --- */

.voice-btn {
    display: inline-flex;
    align-items: center;
    gap: calc(var(--step, 15px) * 0.5);
    padding: var(--step, 15px) calc(var(--step, 15px) * 2);
    border: none;
    font: inherit;
    cursor: pointer;
    line-height: 1;
}

.voice-btn--primary {
    background: #000;
    color: #fff;
}

.voice-btn--primary:hover:not(:disabled) {
    background: #222;
}

.voice-btn--secondary {
    background: transparent;
    color: inherit;
    border: 1px solid currentColor;
}

.voice-btn--secondary:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.04);
}

.voice-btn:focus-visible {
    outline: 2px solid var(--color-accent, currentColor);
    outline-offset: 2px;
}

.voice-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.voice-btn--record {
    justify-content: center;
    margin: calc(var(--step, 15px) * 2) auto;
    display: flex;
}

.voice-btn--record svg {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

/* --- Actions row --- */

.voice-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--step, 15px);
    margin-top: calc(var(--step, 15px) * 2);
}

/* --- Headings --- */

.voice-heading {
    font-family: var(--font-ui, sans-serif);
    font-size: inherit;
    font-weight: 700;
    margin: 0 0 var(--step, 15px);
}

/* --- Tips --- */

.voice-tips {
    margin: 0 0 calc(var(--step, 15px) * 2);
    padding-left: 1.2em;
}

.voice-tips li {
    margin-bottom: calc(var(--step, 15px) * 0.5);
}

/* --- Timer --- */

.voice-timer {
    font-family: var(--font-ui, sans-serif);
    font-variant-numeric: tabular-nums;
    font-weight: 300;
    font-size: calc(var(--step, 15px) * 3);
    line-height: 1;
    text-align: center;
    margin: calc(var(--step, 15px) * 2) 0;
    letter-spacing: 0.05em;
}

/* --- Level meter --- */

.voice-level {
    height: var(--step, 15px);
    background: #eee;
    margin: var(--step, 15px) 0;
    overflow: hidden;
}

.voice-level__bar {
    height: 100%;
    width: 0;
    background: #000;
    transition: width 60ms linear;
}

.voice-timer--warning {
    color: #900;
}

/* --- Hint --- */

.voice-hint {
    text-align: center;
    color: #666;
    margin: var(--step, 15px) 0 0;
}

/* --- Error --- */

.voice-error {
    color: #900;
    margin: 0 0 var(--step, 15px);
}

/* --- Waveform & Trim --- */

.voice-waveform-wrap {
    position: relative;
    margin: calc(var(--step, 15px) * 2) 0 var(--step, 15px);
}

.voice-waveform {
    display: block;
    width: 100%;
    height: calc(var(--step, 15px) * 8);
    background: #f5f5f5;
}

.voice-trim {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.voice-trim__region {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    pointer-events: none;
}

.voice-trim__region--before {
    left: 0;
    width: 0;
}

.voice-trim__region--after {
    right: 0;
    width: 0;
}

.voice-trim__handle {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--color-accent, #c00);
    pointer-events: all;
    cursor: col-resize;
    touch-action: none;
}

.voice-trim__handle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 18px;
    height: 100%;
}

.voice-trim__handle::after {
    content: '';
    position: absolute;
    top: 0;
    left: calc(var(--step, 15px) * -0.5 + 1px);
    width: var(--step, 15px);
    height: var(--step, 15px);
    background: #000;
}

.voice-trim__handle[data-handle="end"]::after {
    top: auto;
    bottom: 0;
}

.voice-fallback-bar {
    color: #666;
    margin: var(--step, 15px) 0 0;
}

/* --- Preview controls --- */

.voice-preview-controls {
    display: flex;
    align-items: center;
    gap: var(--step, 15px);
    margin: var(--step, 15px) 0;
}

.voice-trim-times {
    font-family: var(--font-ui, sans-serif);
    font-variant-numeric: tabular-nums;
    font-size: 0.85em;
    color: #666;
    margin-left: auto;
}

/* --- Progress bar --- */

.voice-progress {
    height: var(--step, 15px);
    background: #eee;
    margin: calc(var(--step, 15px) * 2) 0;
    overflow: hidden;
}

.voice-progress__bar {
    height: 100%;
    width: 0;
    background: #000;
    transition: width 200ms linear;
}

/* --- Bestaetigung --- */

[data-state="done"] {
    text-align: center;
    padding-top: calc(var(--step, 15px) * 3);
}

[data-state="done"] .voice-heading {
    font-size: calc(var(--step, 15px) * 1.2);
    letter-spacing: 0.02em;
    margin-bottom: calc(var(--step, 15px) * 1.5);
}

.voice-done-summary {
    font-family: var(--font-ui, sans-serif);
    font-size: 0.85em;
    color: #666;
    margin-top: calc(var(--step, 15px) * 1.5);
}

/* --- Mobile --- */

@media (max-width: 40em) {
    .secta-voice {
        --step: 14px;
    }
}
