/* ===========================================================================
   VIDEO COMPRESSOR — the tool's own interface.

   Same rules as background-remover-styling.css next door: every colour is a
   site token or derived from one, so the panel follows the reader's theme
   instead of carrying a palette of its own. --vc-* below are only for values
   that stay fixed regardless of theme.

   Controls (.vc-select / .vc-range / .vc-label / .vc-section / .vc-hint) copy
   the bitmap font editor's field idiom rather than the plain radio pills
   background-remover-styling.css uses, because this tool has a full settings
   grid rather than one or two choices — same reasoning as that file gives for
   keeping its own copy of the button styling rather than sharing a class.
   =========================================================================== */

.vc-app {
    --vc-surface: var(--color-primary-a10);
    --vc-surface-raised: var(--color-primary-a20);
    --vc-border: var(--color-card-border);
    --vc-border-strong: var(--color-primary-a20);

    --vc-mono: "JetBrains Mono", "Fira Mono", "Consolas", ui-monospace, monospace;
    --vc-sans: "Circular Spotify", "Inter", sans-serif;

    font-family: var(--vc-sans);
    color: var(--color-text-1);

    display: flex;
    flex-direction: column;
    background: var(--vc-surface);
    border: 1px solid var(--vc-border);
    border-radius: 16px;
    overflow: hidden;
}

.vc-app :is(button, input, select, a, summary):focus-visible {
    outline: 2px solid var(--color-selected-3);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   Toolbar
   --------------------------------------------------------------------------- */

.vc-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    background: var(--vc-surface-raised);
    border-bottom: 1px solid var(--vc-border);
}

.vc-toolbar-spacer {
    margin-left: auto;
}

.vc-file-name {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 8px;
    min-width: 0;
    max-width: 220px;
    font-family: var(--vc-mono);
    font-size: 12px;
    color: var(--color-text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .vc-file-name {
        max-width: 100%;
        width: 100%;
        white-space: normal;
    }
}

/* ---------------------------------------------------------------------------
   Buttons — identical contract to .br-btn / .bf-btn next door.
   --------------------------------------------------------------------------- */

.vc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--vc-border-strong);
    background: transparent;
    color: var(--color-text-2);
    font-family: var(--vc-sans);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background-color var(--dur-hover) var(--ease-soft),
        border-color var(--dur-hover) var(--ease-soft),
        color var(--dur-hover) var(--ease-soft),
        transform var(--dur-hover) var(--ease-pop);
}

@media (hover: hover) {
    .vc-btn:hover:not(:disabled) {
        background: var(--color-primary-a20);
        border-color: var(--color-primary-a30);
        color: var(--color-text-1);
    }
}

.vc-btn:active:not(:disabled) {
    transform: scale(0.97);
    transition-duration: var(--dur-press);
}

.vc-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.vc-btn--primary {
    background: var(--color-selected-2);
    border-color: var(--color-selected-2);
    color: #ffffff;
    padding: 8px 18px;
    font-size: 13px;
}

@media (hover: hover) {
    .vc-btn--primary:hover:not(:disabled) {
        background: var(--color-selected-3);
        border-color: var(--color-selected-3);
        color: #06121e;
    }
}

.vc-btn--accent {
    color: var(--color-accent-text);
    border-color: var(--color-selected-1);
}

@media (hover: hover) {
    .vc-btn--accent:hover:not(:disabled) {
        background: rgba(91, 148, 198, 0.14);
        border-color: var(--color-selected-2);
        color: var(--color-accent-text);
    }
}

.vc-btn--wide {
    flex: 1 1 0;
}

.vc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 12px 12px;
}

/* ---------------------------------------------------------------------------
   Quick preset pills — same radio-pill idiom as .br-choice / .bf-choice.
   --------------------------------------------------------------------------- */

.vc-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vc-choice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid var(--vc-border-strong);
    font-family: var(--vc-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-2);
    cursor: pointer;
    transition:
        border-color var(--dur-hover) var(--ease-soft),
        background-color var(--dur-hover) var(--ease-soft),
        color var(--dur-hover) var(--ease-soft);
}

.vc-choice input {
    accent-color: var(--color-selected-2);
    margin: 0;
}

.vc-choice-hint {
    color: var(--color-primary-a30);
    font-weight: 400;
    font-size: 11px;
}

.vc-choice:has(input:checked),
.vc-choice.is-checked {
    border-color: var(--color-selected-2);
    background: rgba(91, 148, 198, 0.16);
    color: var(--color-text-1);
}

/* Discord-flavoured pills borrow the site's own Discord tokens (see
   CSS/fixed-styling.css) rather than the generic selected-blue, so they read
   as "this one's about Discord specifically" even before you read the word,
   the same way the platform's own UI would tint them. */
.vc-choice[data-flavor="discord"]:has(input:checked),
.vc-choice[data-flavor="discord"].is-checked {
    border-color: var(--color-discord);
    background: var(--color-discord-bg);
    color: var(--color-discord-text);
}

.vc-app.is-busy .vc-choices,
.vc-app.is-busy .vc-inline-field {
    opacity: 0.5;
    pointer-events: none;
}

.vc-inline-field {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.vc-inline-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-2);
}

/* A plain <p>, not a <span> like the Advanced-panel hints next to it. This
   one isn't inside a flex column that would stack it for free, so it needs
   to be a block element on its own, and an explicit top margin rather than
   the browser default <p> margin fighting the 12px rhythm everything else
   on this panel uses. */
#vc-container-hint {
    margin: 6px 0 0;
}

.vc-estimate {
    margin: 12px 0 0;
    font-size: 12.5px;
    color: var(--color-text-2);
}

.vc-estimate strong {
    color: var(--color-text-1);
}

.vc-estimate[data-tone="warn"] {
    color: var(--color-warning-1);
}

/* ---------------------------------------------------------------------------
   Drop zone
   --------------------------------------------------------------------------- */

.vc-drop {
    margin: 12px;
    padding: 28px 20px;
    border: 2px dashed var(--vc-border-strong);
    border-radius: 12px;
    text-align: center;
    color: var(--color-text-2);
    font-size: 13px;
    line-height: 1.6;
    transition:
        border-color var(--dur-hover) var(--ease-soft),
        background-color var(--dur-hover) var(--ease-soft);
}

.vc-app.is-dragging .vc-drop {
    border-color: var(--color-selected-2);
    background: rgba(91, 148, 198, 0.1);
}

.vc-drop strong {
    display: block;
    color: var(--color-text-1);
    font-size: 15px;
    margin-bottom: 6px;
}

/* ---------------------------------------------------------------------------
   Panels
   --------------------------------------------------------------------------- */

.vc-panel {
    background: var(--color-primary-a0);
    border: 1px solid var(--vc-border);
    border-radius: 12px;
    padding: 14px;
    margin: 12px;
}

.vc-preset-panel {
    margin-bottom: 0;
}

.vc-panel-title {
    display: block;
    margin: 0 0 12px;
    font-family: var(--vc-sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-primary-a30);
}

.vc-panel-hint {
    margin: 10px 0 0;
    font-size: 11.5px;
    line-height: 1.55;
    color: var(--color-primary-a30);
}

/* ---------------------------------------------------------------------------
   Source / result previews — side by side once there is room, stacked below
   it. Both panels share the same box so a portrait clip and a landscape one
   still line up against each other.
   --------------------------------------------------------------------------- */

.vc-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

@media (max-width: 820px) {
    .vc-preview-grid {
        grid-template-columns: 1fr;
    }
}

.vc-video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #000000;
}

.vc-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: #000000;
}

/* Nothing to show in the result frame until a run has actually produced one,
   an empty black box read as broken rather than "waiting". Except while a
   run is actually in progress: .vc-stage-overlay (the spinner, phase text
   and progress bar) lives inside this same box, and .has-result is only
   ever added once run() has already finished. Without the :not(.is-busy)
   half of this, the busy overlay was unreachable the entire time a compress
   was running, hidden behind its own hidden ancestor, and a "Working…" pill
   in the toolbar was the only feedback there ever was. */
.vc-app:not(.is-busy) #vc-result-panel:not(.has-result) .vc-video-frame {
    display: none;
}

/* ---------------------------------------------------------------------------
   Busy overlay on the result frame — same contract as .br-stage-overlay.
   --------------------------------------------------------------------------- */

.vc-stage-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.72);
    text-align: center;
}

.vc-app.is-busy .vc-stage-overlay {
    display: flex;
}

.vc-spinner {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #ffffff;
    animation: vc-spin 0.8s linear infinite;
}

@keyframes vc-spin {
    to { transform: rotate(360deg); }
}

.vc-stage-overlay-text {
    font-family: var(--vc-sans);
    font-size: 12.5px;
    font-weight: 600;
    color: #ffffff;
    max-width: 44ch;
}

.vc-progress {
    width: min(260px, 100%);
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.22);
    overflow: hidden;
}

.vc-progress-bar {
    width: 0%;
    height: 100%;
    background: var(--color-selected-3);
    border-radius: inherit;
    transition: width 0.15s linear;
}

/* ---------------------------------------------------------------------------
   Advanced settings — a <details> disclosure rather than a second mode, so
   picking a preset and then nudging one field by hand is one continuous
   action instead of two mutually exclusive tabs fighting over which is "in
   charge". Closed by default: everything in here is optional.
   --------------------------------------------------------------------------- */

.vc-advanced {
    margin: 12px;
    border-radius: 12px;
    background: var(--color-primary-a0);
    border: 1px solid var(--vc-border);
    overflow: hidden;
}

.vc-advanced summary {
    padding: 12px 14px;
    font-family: var(--vc-sans);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-text-1);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color var(--dur-hover) var(--ease-soft);
}

.vc-advanced summary::-webkit-details-marker {
    display: none;
}

.vc-advanced summary::before {
    content: "▸";
    display: inline-block;
    font-size: 10px;
    color: var(--color-primary-a30);
    transition: transform var(--dur-hover) var(--ease-soft);
}

.vc-advanced[open] summary::before {
    transform: rotate(90deg);
}

@media (hover: hover) {
    .vc-advanced summary:hover {
        background: var(--vc-surface-raised);
    }
}

.vc-adv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 4px 14px 16px;
}

@media (max-width: 640px) {
    .vc-adv-grid {
        grid-template-columns: 1fr;
    }
}

.vc-app.is-busy .vc-advanced {
    opacity: 0.5;
    pointer-events: none;
}

/* ---------------------------------------------------------------------------
   Field controls — copied from the bitmap font editor's .bf-section /
   .bf-label / .bf-select / .bf-range contract, kept as its own copy for the
   same reason background-remover-styling.css gives for its buttons.
   --------------------------------------------------------------------------- */

.vc-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* This class's own `display: flex` above is an author-origin rule, which beats
   the UA stylesheet's default `[hidden] { display: none }` at equal
   specificity regardless of source order — so the size/bitrate fields' hidden
   attribute (toggled in applyPreset()) would otherwise be silently ignored
   and both would stay visible at once. */
.vc-section[hidden] {
    display: none;
}

.vc-label {
    font-family: var(--vc-sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--color-text-2);
}

.vc-label-value {
    color: var(--color-text-1);
    font-family: var(--vc-mono);
}

.vc-hint {
    font-family: var(--vc-sans);
    font-size: 10.5px;
    line-height: 1.5;
    color: var(--color-primary-a30);
}

.vc-select {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid var(--vc-border-strong);
    background: var(--color-primary-a0);
    color: var(--color-text-1);
    font-family: var(--vc-sans);
    font-size: 12px;
    transition: border-color var(--dur-hover) var(--ease-soft);
}

.vc-select:focus {
    outline: none;
    border-color: var(--color-selected-2);
}

.vc-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--vc-border-strong);
    cursor: pointer;
}

.vc-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-selected-2);
    border: 2px solid var(--vc-surface);
    cursor: pointer;
}

.vc-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-selected-2);
    border: 2px solid var(--vc-surface);
    cursor: pointer;
}

/* Bigger grab target on touch. A 16px thumb is sized for a mouse cursor,
   not a fingertip, and a slider is the one control on this page where a
   slightly-off tap can't just be retried like a mis-tapped button can, it
   drags to the wrong value instead. */
@media (pointer: coarse) {
    .vc-range {
        height: 8px;
    }

    .vc-range::-webkit-slider-thumb {
        width: 26px;
        height: 26px;
    }

    .vc-range::-moz-range-thumb {
        width: 26px;
        height: 26px;
    }
}

/* ---------------------------------------------------------------------------
   Status, caution and the status bar — identical contract to .br-status /
   .br-caution / .br-statusbar.
   --------------------------------------------------------------------------- */

.vc-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 24px;
    font-size: 11.5px;
    font-weight: 600;
}

.vc-status:empty {
    display: none;
}

.vc-status[data-tone="ok"] {
    background: rgba(74, 222, 128, 0.14);
    color: #38b869;
}

:root:not([data-theme="light"]) .vc-status[data-tone="ok"] {
    color: #4ade80;
}

.vc-status[data-tone="error"] {
    background: rgba(231, 140, 140, 0.16);
    color: var(--color-warning-2);
}

:root:not([data-theme="light"]) .vc-status[data-tone="error"] {
    color: var(--color-warning-1);
}

.vc-status[data-tone="info"] {
    background: rgba(91, 148, 198, 0.16);
    color: var(--color-accent-text);
}

.vc-caution {
    margin: 0 12px 12px;
    padding: 9px 11px;
    border-radius: 8px;
    border-left: 3px solid var(--color-warning-2);
    background: rgba(231, 140, 140, 0.1);
    font-size: 11.5px;
    line-height: 1.55;
    color: var(--color-text-2);
}

.vc-caution strong {
    color: var(--color-text-1);
}

.vc-caution[hidden] {
    display: none;
}

.vc-statusbar {
    padding: 9px 12px;
    border-top: 1px solid var(--vc-border);
    background: var(--vc-surface-raised);
    font-size: 12px;
    color: var(--color-text-2);
}

/* ---------------------------------------------------------------------------
   Loaded / busy state gates — same pattern as .br-app's [data-needs-image].
   --------------------------------------------------------------------------- */

.vc-app:not(.has-video) [data-needs-video] {
    display: none;
}

.vc-app.has-video .vc-drop {
    display: none;
}

.vc-app.is-busy #vc-open,
.vc-app.is-busy #vc-drop-open,
.vc-app.is-busy #vc-run,
.vc-app.is-busy #vc-download {
    opacity: 0.5;
    pointer-events: none;
}

/* NOTE: there used to be a ".vc-app:not(.has-result) #vc-download" rule here
   meant to grey the button out until a compress had actually produced
   something. It never worked: run() only ever puts .has-result on
   #vc-result-panel (see #vc-result-panel:not(.has-result) .vc-video-frame
   above), never on .vc-app itself, so that condition was permanently true
   and, being an ID selector, permanently outranked .vc-btn:disabled below
   regardless of the button's real disabled state. #vc-download's disabled
   attribute is already toggled correctly by run()/handleFile() in
   video-compressor.js, so .vc-btn:disabled already covers this on its own
   with nothing extra needed here. */
