/* ── ArtSCII web — terminal aesthetic ─────────────────────────────────── */

:root {
    --bg: #0e0e13;
    --panel: #14141b;
    --panel-2: #101016;
    --well: #0a0a0f;
    --border: #23232f;
    --text: #cfcfda;
    --muted: #6f6f82;
    --accent: #9ece6a;
    --accent-dim: rgba(158, 206, 106, 0.1);
    --danger: #bb6565;

    --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Menlo, Consolas,
        "Liberation Mono", monospace;

    color-scheme: dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.8125rem;
    line-height: 1.5;
    min-height: 100vh;
}

::selection {
    background: var(--accent-dim);
    color: var(--accent);
}

/* thin, quiet scrollbars */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #2a2a38;
    border: 3px solid var(--bg);
}

a {
    color: var(--text);
    text-decoration: none;
}
a:hover {
    color: var(--accent);
}

button {
    font-family: inherit;
}

:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ── Shell ─────────────────────────────────────────────────────────────── */

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--panel-2);
}

.logo {
    font-family: var(--mono);
    font-size: 0.5rem;
    line-height: 1.2;
    color: var(--accent);
    user-select: none;
    overflow: hidden;
}

.tagline {
    font-size: 0.75rem;
    color: var(--text);
    white-space: nowrap;
}

.dim {
    color: var(--muted);
}

/* ── Hero / drop zone ──────────────────────────────────────────────────── */

.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 8vh 1.25rem;
}

.drop {
    width: min(34rem, 100%);
    border: 1px dashed #33334a;
    background: var(--panel);
    transition:
        border-color 120ms ease,
        background-color 120ms ease;
}

.drop:hover,
.drop:focus-within {
    border-color: var(--accent);
}

.drop.dragging {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.drop-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 3.5rem 1.5rem;
    cursor: pointer;
    text-align: center;
}

.plus {
    font-size: 2rem;
    line-height: 1;
    color: var(--muted);
    user-select: none;
}

.drop-title {
    font-size: 0.9375rem;
    color: var(--text);
}

.drop-sub {
    font-size: 0.75rem;
    color: var(--muted);
}

.hint {
    font-size: 0.75rem;
    color: var(--muted);
}

/* ── Workspace ─────────────────────────────────────────────────────────── */

.workspace {
    flex: 1;
    display: grid;
    grid-template-columns: 18.75rem 1fr;
    min-height: 0;
}

.side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem;
    border-right: 1px solid var(--border);
    background: var(--panel-2);
    overflow-y: auto;
}

/* file summary */
.filebar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.thumb {
    width: 3rem;
    height: 3rem;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--well);
    flex-shrink: 0;
}

.filemeta {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.filename {
    font-size: 0.75rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.change {
    font-size: 0.6875rem;
    color: var(--muted);
    cursor: pointer;
    width: fit-content;
}
.change:hover {
    color: var(--accent);
}

/* settings group */
.group {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.group-title {
    font-size: 0.6875rem;
    color: var(--muted);
    user-select: none;
}

.row {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.row-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.75rem;
}

.row-head label {
    color: var(--muted);
}

.val {
    color: var(--text);
    font-size: 0.6875rem;
}

/* range inputs — thin track, square thumb */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 1rem;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 2px;
    background: var(--border);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    margin-top: -4px;
    background: var(--accent);
    border: none;
    border-radius: 0;
}
input[type="range"]::-moz-range-track {
    height: 2px;
    background: var(--border);
}
input[type="range"]::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border: none;
    border-radius: 0;
}

/* select */
.select-wrap {
    position: relative;
}
.select-wrap::after {
    content: "▾";
    position: absolute;
    right: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    font-size: 0.75rem;
}

select {
    appearance: none;
    width: 100%;
    padding: 0.5rem 0.625rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}
select:hover,
select:focus {
    border-color: var(--accent);
    outline: none;
}

/* bracket checkboxes — [x] style */
.checks {
    display: flex;
    gap: 1.5rem;
    padding-top: 0.125rem;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}
.check:hover {
    color: var(--text);
}

.check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.check .box::before {
    content: "[ ]";
    color: var(--muted);
}
.check input:checked + .box::before {
    content: "[x]";
    color: var(--accent);
}
.check input:focus-visible + .box::before {
    outline: 1px solid var(--accent);
    outline-offset: 2px;
}

/* sidebar footer: dims + actions */
.side-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.dims {
    font-size: 0.6875rem;
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 1.125rem;
    flex-wrap: wrap;
}

.btn {
    background: none;
    border: none;
    padding: 0.125rem 0;
    font-size: 0.75rem;
    color: var(--text);
    cursor: pointer;
}
.btn::before {
    content: "[ ";
    color: var(--muted);
}
.btn::after {
    content: " ]";
    color: var(--muted);
}
.btn:hover,
.btn:hover::before,
.btn:hover::after {
    color: var(--accent);
}

/* ── Preview ───────────────────────────────────────────────────────────── */

.preview {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.25rem;
    min-width: 0;
    min-height: 0;
}

.preview-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.625rem;
    font-size: 0.6875rem;
}

.zoom {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--muted);
}

.zoom button {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    width: 1.375rem;
    height: 1.375rem;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.zoom button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.zoom-val {
    min-width: 3ch;
    text-align: center;
}

.output-wrap {
    flex: 1;
    overflow: auto;
    background: var(--well);
    border: 1px solid var(--border);
    min-height: 20rem;
}

.output {
    margin: 0;
    padding: 1rem;
    font-family: var(--mono);
    line-height: 1.15;
    letter-spacing: 0.05em;
    white-space: pre;
    color: var(--text);
    width: fit-content;
    min-width: 100%;
}

/* ── Toast ─────────────────────────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.625rem 1rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-left: 3px solid var(--danger);
    color: #d9a0a0;
    font-size: 0.75rem;
    z-index: 10;
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.foot {
    padding: 0.625rem 1.25rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.6875rem;
    color: var(--muted);
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 52rem) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .side {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .side-foot {
        margin-top: 0;
    }

    .logo {
        font-size: 0.375rem;
    }

    .tagline {
        font-size: 0.6875rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
