/* SERVO :: imaging/style.css */

/* Saira, served locally: one variable file for every weight. */
@font-face {
    font-family: "Saira";
    font-style: normal;
    font-weight: 100 900;
    font-display: block;
    src: url("font/saira.woff2") format("woff2");
}

:root {
    /* Width of the inputs and buttons inside the sign-in card. */
    --control: 75%;

    /* Project palette; cyan and violet are the brand colors. */
    --cyan: #84fafa;
    --violet: #8765fe;
    --green: #76e63f;
    --orange: #f09d59;
    --ink: #212427;
    --paper: #c1c1c1;
    --steel: #5a6a7a;

    --bg: var(--ink);
    --panel: #272b2f;
    --raised: #1c1f22;
    --line: #39414a;
    --text: #e6e8ea;
    --muted: var(--steel);
    --wave: var(--paper);
    --on-violet: #fbfbc4;
    --err: #f87171;
    --radius: 10px;
    --ring: 0 0 0 3px rgba(132, 250, 250, .22);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font: 16px "Saira", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1 {
    font-size: 17px;
    font-weight: 400;
    margin-bottom: 16px;
}

h2 {
    font-size: 15px;
    font-weight: 400;
}

/* --- fields ---------------------------------------------------------- */

label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: .02em;
}

.field {
    margin-bottom: 16px;
}

input[type=text],
input[type=password],
input[type=number],
select,
textarea {
    width: 100%;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
    transition: border-color 150ms, box-shadow 150ms;
}

textarea {
    resize: vertical;
    min-height: 110px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: var(--ring);
}

input[type=file] {
    font: inherit;
    font-size: 13px;
    color: var(--muted);
    max-width: 100%;
}

input[type=file]::file-selector-button {
    font: inherit;
    color: var(--text);
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 12px;
    margin-right: 10px;
    cursor: pointer;
}

/* --- buttons --------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--raised);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 16px;
    font: inherit;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    transition: filter 150ms, border-color 150ms;
}

.btn:hover {
    border-color: var(--steel);
}

.btn.primary {
    background: var(--violet);
    color: var(--on-violet);
    border-color: var(--violet);
    min-width: 140px;
}

.btn.primary:hover {
    filter: brightness(1.1);
}

.btn.danger {
    color: var(--err);
}

.btn.quiet {
    background: transparent;
    color: var(--muted);
}

.btn.quiet:hover {
    color: var(--text);
}

/* Play and Stop share one width. */
.btn.play {
    min-width: 96px;
}

.btn:disabled,
.btn:disabled:hover {
    opacity: .4;
    filter: none;
    cursor: not-allowed;
}

.buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
}

/* --- toast ------------------------------------------------------------
 * Floats over the page; nothing moves when it appears.
 */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    max-width: calc(100% - 32px);
    width: max-content;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}

.toast[hidden] {
    display: none;
}

.toast.err {
    background: #3a2326;
    border-color: rgba(248, 113, 113, .45);
    color: #fca5a5;
}

.toast.ok {
    background: #1f3326;
    border-color: rgba(74, 222, 128, .45);
    color: #86efac;
}

/* --- sign-in card ---------------------------------------------------- */

body.gate {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 4vmin 16px;
}

.card {
    width: 100%;
    max-width: 400px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 32px 28px;
    text-align: center;
}

.brand {
    display: block;
    height: 64px;
    margin: 0 auto 24px;
}

.card input[type=text],
.card input[type=password] {
    width: var(--control);
    text-align: center;
}

.card button {
    width: var(--control);
    background: var(--violet);
    color: var(--on-violet);
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    font: inherit;
    font-size: 18px;
    letter-spacing: 1px;
    cursor: pointer;
}

.card button:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.foot {
    font-size: 14px;
}

.foot a {
    color: var(--muted);
}

.qr {
    width: min(240px, 100%);
    margin: 0 auto 16px;
    padding: 4px;
    border-radius: 8px;
    background: #fff;
    line-height: 0;
}

.qr svg {
    width: 100%;
    height: auto;
}

.secret {
    font: 14px ui-monospace, Consolas, monospace;
    color: var(--muted);
    margin-bottom: 16px;
    word-break: break-all;
}

/* One invisible input across six boxes that mirror its value. */
.code {
    position: relative;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    width: min(max(var(--control), 220px), 100%);
    margin: 0 auto;
}

.card .code input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: transparent;
    caret-color: transparent;
    z-index: 2;
}

.code input:focus {
    box-shadow: none;
}

.code .box {
    display: grid;
    place-items: center;
    aspect-ratio: 3 / 4;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    font: 600 16px/1 ui-monospace, Consolas, monospace;
}

.code .box.on {
    border-color: var(--cyan);
    box-shadow: var(--ring);
}

/* --- frame ----------------------------------------------------------- */

.top {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.top .logo {
    height: 28px;
}

.top nav {
    display: flex;
    gap: 4px;
}

.top nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
}

.top nav a:hover {
    color: var(--text);
}

.top nav a.on {
    color: var(--text);
    background: var(--raised);
}

.top .who {
    color: var(--muted);
    font-size: 14px;
}

.spacer {
    flex: 1;
}

main.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px;
    display: grid;
    gap: 16px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    min-width: 0;
}

.panel.empty {
    display: grid;
    place-items: center;
    padding: 48px 20px;
}

.row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.row .grow {
    flex: 1 1 240px;
}

.field.num {
    flex: 0 0 140px;
}

/* --- waveform -------------------------------------------------------- */

canvas.wave {
    display: block;
    width: 100%;
    height: 140px;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 8px;
}

form.editor canvas.wave {
    cursor: crosshair;
}

.bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.bar .field {
    margin-bottom: 0;
}

.stat {
    min-width: 140px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    align-self: center;
}

/* --- templates ------------------------------------------------------- */

.split {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.list {
    display: grid;
    gap: 2px;
    padding: 10px;
}

.list .item {
    color: var(--muted);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list .item:hover {
    color: var(--text);
}

.list .item.on {
    color: var(--text);
    background: var(--raised);
}

.part {
    margin-top: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.part .head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.editor .buttons {
    margin-top: 20px;
}

@media (max-width: 760px) {
    .split {
        grid-template-columns: minmax(0, 1fr);
    }

    .top {
        padding: 10px 16px;
        gap: 12px;
    }
}
