/*! loum.io · © 2025–2026 Louie Sellers · All rights reserved · Original at https://loum.io */
/* LoumOS: the tokens every loum.io app is built from. One copy, loaded before each app's own stylesheet.
   The parts built from them are shown, live, at /os/. Change a value here and every app follows.
   Phase_ carries a copy of this file (npm run loum:sync), so a part added here is a part it has too. */

:root {
    /* Surfaces, darkest to lightest: the page, a raised panel, a control on a panel */
    --bg: #121211;
    --raise: #1a1a19;
    --raise-2: #222220;

    /* Lines: dividers, then outlines and tracks */
    --line: #2a2a28;
    --line-strong: #3a3a37;

    /* Text by job: what you read, what explains it, labels and hints. Drawings at rest use --line-strong */
    --text: #e9e7e2;
    --muted: #9a978f;
    --faint: #6b6963;

    /* The recessed screen an instrument's drawing sits in (home tiles, Mixer's decks) */
    --well: #0d0d0c;

    /* One colour: the thing that's live, pressed, or about to take your file */
    --accent: #ff7a3d;
    --accent-soft: rgba(255, 122, 61, 0.35);
    --accent-dim: rgba(255, 122, 61, 0.14);

    /* Done: finished or paid, on a status dot or a status chip. Never decoration, never a second accent */
    --done: #8fc27c;

    /* One typeface, one size for UI (13), 500 for names and headings */
    --font: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

    /* Motion: ease-out for colour and position, the spring for anything landing or let go */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --spring: cubic-bezier(0.34, 1.4, 0.64, 1);

    --radius: 6px;
}

/* ---- Base: every app page ---- */

*, *::before, *::after { box-sizing: border-box; }

/* The scrollbar's space is kept on every page, so content sits at the same width whether or not it scrolls */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }

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

/* ---- Page: the header, the app, the credit at the bottom ---- */

.app-container {
    display: flex;
    flex-direction: column;
    max-width: 1120px;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0 auto;
    padding: 20px 32px 24px;
}

.app-container > * { min-width: 0; }

/* loum.io / App on the left, a short note on the right */
.header-section {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 20px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--line);
}

.crumbs {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.home-link {
    color: var(--muted);
    text-decoration: none;
    transition: color 160ms var(--ease-out);
}

.crumb-sep { color: var(--faint); }

.header-section h1 {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
}

.header-note {
    margin: 0;
    color: var(--faint);
}

/* A quiet sign-off, at the bottom of the screen when the app doesn't reach it */
.credit {
    margin-top: auto;
    padding-top: 48px;
    color: var(--faint);
    font-size: 12px;
}

.credit a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 2px;
    transition: color 160ms var(--ease-out), text-decoration-color 160ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .home-link:hover { color: var(--text); }

    .credit a:hover {
        color: var(--muted);
        text-decoration-color: currentColor;
    }
}

@media (max-width: 700px) {
    .app-container { padding: 16px 16px 24px; }

    .header-section {
        flex-direction: column;
        gap: 4px;
        margin-bottom: 20px;
        padding-bottom: 16px;
    }

    /* A comfortable tap target, without moving anything */
    .home-link {
        display: inline-block;
        padding: 10px 6px 10px 0;
        margin: -10px 0;
    }
}

/* On a phone the credit sits centred */
@media (max-width: 640px) { .credit { text-align: center; } }

/* ---- Parts ---- */
/* States sit in :where() so they add no weight: an app's own variant (a segmented control, an active tab) still wins */

/* Drop zone: dashed at rest, solid orange while files are over the page or over it */
.upload-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 200ms var(--ease-out), background-color 200ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .upload-zone:hover { border-color: var(--faint); }
}

.upload-zone.dragover,
body.dragging .upload-zone:not(.has-file) {
    border-color: var(--accent);
    border-style: solid;
    background: var(--accent-dim);
}

.upload-content p { margin: 0; }

.upload-title {
    font-size: 15px;
    font-weight: 500;
    transition: transform 320ms var(--spring);
}

.upload-zone.dragover .upload-title,
body.dragging .upload-zone:not(.has-file) .upload-title { transform: scale(1.04); }

.upload-content .upload-hint {
    margin-top: 6px;
    color: var(--muted);
}

/* Working: a thin bar runs along the bottom */
.upload-zone.loading {
    pointer-events: none;
    border-style: solid;
}

.upload-zone.loading::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 30%;
    background: var(--accent);
    border-radius: 2px;
    animation: scan 1.3s var(--ease-out) infinite;
}

@keyframes scan {
    from { transform: translateX(-100%); }
    to { transform: translateX(334%); }
}

/* Words for a mouse or for a finger: "click" or "tap" */
.for-touch { display: none; }

@media (hover: none) {
    .for-pointer { display: none; }
    .for-touch { display: inline; }
}

/* Buttons: outlined; .primary is the one main action; .quiet sits in a toolbar until it's needed;
   .rare keeps its outline and dims its words, for something used a couple of times a month */
.control-button {
    background: transparent;
    border: 1px solid var(--line-strong);
    color: var(--text);
    padding: 7px 14px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 140ms var(--ease-out), background-color 140ms var(--ease-out), border-color 140ms var(--ease-out), transform 160ms var(--spring);
}

.control-button:where(:disabled) {
    color: var(--faint);
    border-color: var(--line);
    cursor: default;
}

.control-button.primary {
    min-width: 76px;
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
    font-weight: 500;
}

.control-button.quiet {
    border-color: transparent;
    color: var(--muted);
    padding: 6px 12px;
}

.control-button.rare { color: var(--muted); }

@media (hover: hover) and (pointer: fine) {
    .control-button:where(:hover:not(:disabled)) { background: var(--raise-2); }

    .control-button.primary:where(:hover:not(:disabled)) {
        background: #fff;
        border-color: #fff;
    }

    .control-button.quiet:where(:hover:not(:disabled)) { color: var(--text); }
}

.control-button.primary:where(:disabled) {
    background: transparent;
    border-color: var(--line);
    color: var(--faint);
}

.control-button.quiet:where(:disabled) {
    border-color: transparent;
    color: var(--faint);
    opacity: 0.55;
}

/* Pressed: a key going down. A pixel lower and a shade darker, quick down, a spring back up.
   The same press for every button-like control: Mixer's transport, A/B's switch and steppers */
.control-button:where(:active:not(:disabled)) {
    transform: translateY(1px);
    background: var(--raise);
    transition-duration: 60ms;
}

.control-button.primary:where(:active:not(:disabled)) {
    background: color-mix(in srgb, var(--text) 82%, var(--bg));
    border-color: color-mix(in srgb, var(--text) 82%, var(--bg));
}

/* Toasts: a short line at the bottom, springing up */
.toasts {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: calc(100vw - 32px);
    z-index: 1100;
    pointer-events: none;
}

.success-message,
.error-message {
    padding: 10px 14px;
    background: var(--raise-2);
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    animation: toast 420ms var(--spring) both;
}

.error-message {
    border-color: rgba(255, 122, 61, 0.5);
    color: var(--accent);
}

@keyframes toast {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

/* Toast with an action: "Stage: Approved" and an Undo beside it. The words give way, the button never does.
   loumos.toast() and loumos.undo() in /loumos.js build these */
:where(.success-message, .error-message):has(.toast-action) {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 100%;
    pointer-events: auto;
}

.toast-action {
    position: relative;
    flex: none;
    height: 28px;
    padding: 0 8px;
    background: transparent;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
    transition: background-color 140ms var(--ease-out), transform 160ms var(--spring);
}

.toast-action:where(:active) {
    transform: translateY(1px);
    background: var(--raise);
    transition-duration: 60ms;
}

/* Cut off with "…" on one line. With /loumos.js loaded, hovering one that is really cut off shows it whole */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Segmented control: two to four views of the same thing. A tablist: role="tab" and aria-selected on each button */
.seg-control {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 4px;
}

.seg-control button {
    position: relative;
    height: 28px;
    padding: 0 10px;
    background: transparent;
    border: 0;
    border-radius: 4px;
    color: var(--faint);
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: color 140ms var(--ease-out), background-color 140ms var(--ease-out);
}

.seg-control button:where([aria-selected="true"]) {
    background: var(--raise-2);
    color: var(--text);
}

/* Chip: a small outlined word for a thing that exists (a version, a format, a status). No chip for a missing thing.
   .live is the one playing or chosen, .left-out is there but not in use ("+ vinyl"), and three say a status */
.state-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: none;
    height: 20px;
    padding: 0 6px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
    transition: color 140ms var(--ease-out), border-color 140ms var(--ease-out);
}

button.state-chip { cursor: pointer; }

.state-chip:where(.live, [aria-pressed="true"]) {
    border-color: var(--line-strong);
    color: var(--text);
}

.state-chip:where(.left-out, .not-sent) { color: var(--faint); }

.state-chip:where(.unpaid) { color: var(--accent); }

.state-chip:where(.paid) { color: var(--done); }

.state-chip:where(.unpaid, .paid) { border-color: color-mix(in srgb, currentColor 40%, transparent); }

/* The A, B or C in front of a version being compared: orange on the one you hear */
.chip-letter { color: var(--faint); }

.state-chip:where(.live, [aria-pressed="true"]) .chip-letter { color: var(--accent); }

/* Status dot: a ring is empty, grey is waiting on someone else, orange is yours to do, green is done */
.status-dot {
    display: inline-block;
    flex: none;
    width: 6px;
    height: 6px;
    border: 1px solid var(--muted);
    border-radius: 50%;
}

.status-dot:where(.waiting) { background: var(--muted); }

.status-dot:where(.yours) {
    background: var(--accent);
    border-color: var(--accent);
}

.status-dot:where(.done) {
    background: var(--done);
    border-color: var(--done);
}

/* Dot list: things in a row with a middle dot between them. The row hangs 16px to the left and that strip
   is clipped, so an item that starts a new line hides its dot. Items never break inside */
.dot-list {
    display: flex;
    flex-wrap: wrap;
    margin: 0 0 0 -16px;
    padding: 0;
    list-style: none;
    clip-path: inset(0 0 0 16px);
}

.dot-list > * {
    position: relative;
    padding-left: 16px;
    white-space: nowrap;
}

.dot-list > *::before {
    content: "·";
    position: absolute;
    left: 5px;
    color: var(--faint);
}

/* Copy button: the copy icon, then a tick for two seconds. data-copy holds the text; /loumos.js does the rest.
   A <span> inside is its word ("copy", then "copied"); without one it is the icon alone and needs an aria-label */
.copy-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 7px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--faint);
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: color 140ms var(--ease-out), background-color 140ms var(--ease-out), transform 160ms var(--spring);
}

.copy-button:where(:has(span)) {
    border-color: var(--line-strong);
    color: var(--muted);
}

.copy-button::before {
    content: "";
    flex: none;
    width: 12px;
    height: 12px;
    background: currentColor;
    -webkit-mask: var(--copy-icon) center / contain no-repeat;
    mask: var(--copy-icon) center / contain no-repeat;
    --copy-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8' y='8' width='14' height='14' rx='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E");
}

.copy-button:where(.copied) { color: var(--text); }

.copy-button.copied::before {
    --copy-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.copy-button:where(:active) {
    transform: translateY(1px);
    transition-duration: 60ms;
}

/* Switch: the small track with a knob. Put it in a button with role="switch" and aria-checked, its label in words
   beside it. .busy is on its way there ("matching 1/3"): the knob waits in the middle, and it wins over on.
   .on and .busy also work on the track itself */
.switch-track {
    position: relative;
    flex: none;
    width: 30px;
    height: 18px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    transition: background-color 200ms var(--ease-out), border-color 200ms var(--ease-out);
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform 280ms var(--spring), background-color 200ms var(--ease-out);
}

.switch-track.on,
:where([role="switch"][aria-checked="true"]) .switch-track {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.switch-track.on::after,
:where([role="switch"][aria-checked="true"]) .switch-track::after {
    transform: translateX(12px);
    background: var(--accent);
}

.switch-track.busy,
[role="switch"].busy .switch-track {
    background: transparent;
    border-color: var(--accent-soft);
    animation: busy 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.switch-track.busy::after,
[role="switch"].busy .switch-track::after {
    transform: translateX(6px);
    background: var(--accent);
}

@keyframes busy { 50% { opacity: 0.5; } }

/* The labelled switch on a transport: "match", "matching 1/3", "matched" */
.match-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
    height: 24px;
    margin-left: 6px;
    padding: 0 0 0 4px;
    background: transparent;
    border: 0;
    border-radius: 4px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: color 140ms var(--ease-out);
}

.match-switch:where([aria-checked="true"], .busy) { color: var(--accent); }

/* Seek line: a thin line you click or drag, with a knob. --at is how far along, 0% to 100%.
   /loumos.js moves it and sends a "seek" event; loumos.seekTo(line, ratio) sets it from playback */
.seek-line {
    --at: 0%;
    position: relative;
    flex: 1;
    min-width: 40px;
    height: 21px;
    cursor: pointer;
    touch-action: none;
}

.seek-line::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 10px;
    height: 1px;
    background: linear-gradient(to right, var(--accent) var(--at), var(--line-strong) 0);
}

.seek-line::after {
    content: "";
    position: absolute;
    left: var(--at);
    top: 7px;
    width: 7px;
    height: 7px;
    margin-left: -3px;
    border-radius: 50%;
    background: var(--accent);
}

/* Transport bar: one line under the app while something is loaded. Keys, what's playing, its versions as chips,
   the match switch, then time, line, length. The timeline takes a fixed share so nothing beside it moves */
.transport-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 41px;
    padding: 0 24px;
    background: var(--raise);
    border-top: 1px solid var(--line);
    font-size: 12px;
    user-select: none;
    -webkit-user-select: none;
    transition: border-color 200ms var(--ease-out);
}

.transport-bar > * { min-width: 0; }

/* Level matched: the bar's top line says so */
.transport-bar:where(.matched) { border-top-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.transport-keys {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: none;
    margin-left: -6px;
}

.transport-key {
    position: relative;
    display: grid;
    place-items: center;
    flex: none;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 4px;
    color: var(--muted);
    cursor: pointer;
    transition: color 140ms var(--ease-out), background-color 140ms var(--ease-out), transform 160ms var(--spring);
}

.transport-key svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* The play key is the bright one */
.transport-key:where(.play) { color: var(--text); }

.transport-key:where(:disabled) {
    color: var(--faint);
    cursor: default;
}

.transport-key:where(:active:not(:disabled)) {
    transform: translateY(1px);
    background: var(--raise);
    transition-duration: 60ms;
}

/* Play shows one icon, pause the other: aria-pressed="true" while playing */
.transport-key .icon-pause,
.transport-key[aria-pressed="true"] .icon-play { display: none; }

.transport-key[aria-pressed="true"] .icon-pause { display: block; }

.transport-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex: 1 1 160px;
}

.transport-title :where(.number) {
    flex: none;
    color: var(--faint);
}

.transport-chips {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: none;
}

.transport-time {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 1 30%;
    min-width: 120px;
    color: var(--muted);
}

.transport-time > span {
    flex: none;
    width: 38px;
}

.transport-time > span:first-child { text-align: right; }

/* Narrow: the title takes the first row with the keys, the versions the second, the line the third */
@media (max-width: 700px) {
    .transport-bar {
        flex-wrap: wrap;
        row-gap: 4px;
        padding: 8px 16px;
    }

    .transport-title { flex-basis: calc(100% - 90px); }

    .transport-chips { flex: 1 1 100%; }

    .transport-chips .match-switch { margin-left: auto; }

    .transport-time { flex: 1 1 100%; }
}

/* Tooltip: one style, one line. class="tip" and data-tip="the words" on something that doesn't clip.
   .tip-end grows leftwards, for things near the right edge (/loumos.js adds it by itself).
   .tip-float is the same box, placed by /loumos.js over text cut off with "…" */
.tip { position: relative; }

.tip-float,
.tip[data-tip]::after {
    z-index: 1200;
    width: max-content;
    padding: 6px 9px;
    background: var(--raise-2);
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    color: var(--text);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
}

.tip[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    left: 0;
    bottom: calc(100% + 4px);
    display: none;
}

.tip-end[data-tip]::after {
    left: auto;
    right: 0;
}

.tip-float {
    position: fixed;
    translate: 0 -100%;
    animation: tip-in 160ms var(--ease-out) both;
}

@keyframes tip-in {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: none; }
}

/* ---- Pointer and touch ---- */

/* Hover styles only where there is a real pointer, so a tap on a phone never leaves one stuck on */
@media (hover: hover) and (pointer: fine) {
    .control-button.rare:where(:hover:not(:disabled)) { color: var(--text); }

    .toast-action:where(:hover) { background: var(--raise); }

    .seg-control button:where(:hover:not([aria-selected="true"])) { color: var(--muted); }

    button.state-chip:where(:hover) { border-color: var(--line-strong); }

    button.state-chip:where(:hover:not(.unpaid, .paid)) { color: var(--text); }

    .copy-button:where(:hover) {
        background: var(--raise-2);
        color: var(--text);
    }

    .match-switch:where(:hover:not([aria-checked="true"], .busy)) { color: var(--text); }

    .transport-key:where(:hover:not(:disabled)) {
        background: var(--raise-2);
        color: var(--text);
    }

    /* A tooltip waits 400 ms, then arrives */
    .tip[data-tip]:hover::after {
        display: block;
        animation: tip-in 160ms var(--ease-out) 400ms both;
    }
}

/* Small controls keep their size and take a 44px touch, through ::after. .touch-target does it for anything else */
.touch-target { position: relative; }

@media (pointer: coarse) {
    .touch-target::after,
    .toast-action::after,
    .seg-control button::after,
    button.state-chip::after,
    .copy-button::after,
    .transport-key::after {
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        width: max(100%, 44px);
        height: max(100%, 44px);
        transform: translate(-50%, -50%);
    }

    .seek-line {
        height: 44px;
        margin: -12px 0;
    }

    .seek-line::before { top: 21px; }

    .seek-line::after { top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .upload-zone.loading::after {
        width: 100%;
        animation: none;
        opacity: 0.6;
    }

    .switch-track.busy,
    [role="switch"].busy .switch-track { animation: none; }
}
