/*
 * HTML to Deluge String — /tools/html-to-deluge (loaded on this page only).
 *
 * Loads after json-viewer.css and reuses its tokens (--jv-*), panels and
 * controls. This file only holds what the JSON Viewer doesn't have.
 */

/* Input and output share the width equally. */
@media (min-width: 64em) {
    .html-to-deluge .json-viewer__workspace {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

.html-to-deluge .json-viewer__input[readonly] {
    cursor: text;
}

.html-to-deluge__empty {
    flex: 1;
    min-height: 22rem;
    background: var(--jv-surface-sunken);
}

/* Output options -------------------------------------------------------- */

.html-to-deluge__options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.875rem;
}

.html-to-deluge__field {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.html-to-deluge__label,
.html-to-deluge__check {
    color: var(--jv-text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.html-to-deluge__variable {
    width: 6rem;
    min-height: 2rem;
    padding: 0 0.625rem;
    border: 1px solid var(--jv-border-input);
    border-radius: var(--jv-radius-small);
    background: var(--jv-surface-sunken);
    color: var(--jv-text);
    font: 400 0.8125rem/1 var(--jv-font-mono);
}

.html-to-deluge__variable:focus-visible,
.html-to-deluge__check input:focus-visible {
    outline: 2px solid var(--jv-focus);
    outline-offset: 2px;
}

.html-to-deluge__variable[aria-invalid="true"] {
    border-color: var(--jv-error);
    box-shadow: inset 0 0 0 1px var(--jv-error);
}

/* Checkboxes, with any warning on the same row. */
.html-to-deluge__subbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.375rem 0.875rem;
    min-height: 2.75rem;
    padding: 0.375rem 0.75rem;
    border-bottom: 1px solid var(--jv-border);
}

/* One option per line: the labels are long enough that side by side they would wrap unevenly. */
.html-to-deluge__checks {
    display: flex;
    flex-direction: column;
}

.html-to-deluge__note {
    margin: 0;
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--jv-warning-border);
    border-radius: var(--jv-radius-small);
    background: var(--jv-warning-soft);
    color: var(--jv-warning);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.4;
}

.html-to-deluge__check {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2rem;
    cursor: pointer;
}

.html-to-deluge__check input {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--jv-primary);
}

/* How to use it --------------------------------------------------------- */

.html-to-deluge__help > p,
.html-to-deluge__examples p {
    max-width: 70ch;
    margin: 0 0 1rem;
    color: var(--jv-text-muted);
    line-height: 1.6;
}

.html-to-deluge__help code {
    font-family: var(--jv-font-mono);
    font-size: 0.875em;
}

/* minmax(0, ...) lets the code blocks scroll inside the column instead of widening the page. */
.html-to-deluge__examples {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    margin: 1.75rem 0 2.25rem;
}

@media (min-width: 64em) {
    .html-to-deluge__examples {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    }
}

.html-to-deluge__example-title {
    margin: 0 0 0.375rem;
    font-size: 1rem;
    font-weight: 700;
}

.html-to-deluge__code {
    margin: 0;
    padding: 1rem 1.125rem;
    overflow-x: auto;
    border: 1px solid var(--jv-border);
    border-radius: var(--jv-radius);
    background: var(--jv-surface-sunken);
    color: var(--jv-text);
    font: 400 0.8125rem/1.6 var(--jv-font-mono);
    tab-size: 4;
}

.html-to-deluge__code code {
    font-size: inherit;
}

.html-to-deluge__notes .json-viewer__shortcut dt {
    color: var(--jv-text);
    font-weight: 600;
}

.html-to-deluge__notes .json-viewer__shortcut dd {
    color: var(--jv-text-muted);
    line-height: 1.55;
}

/* Small screens: each note's label sits above its text instead of beside it. */
@media (max-width: 47.99em) {
    .html-to-deluge__notes .json-viewer__shortcut {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.25rem;
    }
}
