/* web/css/colours.css
 *
 * Project colours, applied across surfaces that are styled in earlier
 * files — the Start-a-session dialog, the rail, the boards, Settings — and
 * Wispr Flow transforms. Late on purpose: these override those.
 *
 * Linked from web/index.html in the order the sections had in the old
 * web/styles.css, and concatenated in that order they reproduce it exactly, so
 * the cascade is unchanged. A rule that moves between these files moves in the
 * cascade too: check what it now comes before and after.
 */

/* ── project colours ───────────────────────────────────────────────────────
   A colour somebody gave a project, worn by everything that names one.

   **`--proj-accent` is set inline by script and every rule below hangs off
   `[data-tinted]`**, never off the property alone. That is the whole trick: a
   project with no colour, and a dialog with no project, get none of these rules
   and so render exactly as this app has always rendered them — rather than
   through a `color-mix` that happens to land near the blue it replaced. Two
   states, not a spectrum with an awkward middle.

   The mixing is `--snip-accent`'s idiom (see the snippets section above), and
   for its reason: one hue turned into a ground and an edge against the surface
   underneath, so a badly chosen colour comes out muted rather than loud. */

/* The dot that says "this project", wherever a project is named in a list. It
   is `currentColor`-sized rather than fixed so it sits on the text it precedes,
   and it collapses to nothing without a colour — a row of empty circles for the
   projects nobody has coloured would be noise standing in for information. */
.pdot { display: none; }
.picker-row[data-tinted] > .pdot,
#new-scrim[data-tinted] .new-project > .pdot {
    display: block;
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--proj-accent);
}

/* --- the Start-a-session dialog --------------------------------------- */

/* The head reads downward: which project, then what you are doing with it. */
.modal-head-text {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    min-width: 0;
}
.new-project {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-width: 0;
    /* Sentence case: it names one project, it does not head a list. */
    font: 500 var(--fs-sm)/var(--lh-snug) var(--sans);
    color: var(--text-3);
}
.new-project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Nothing picked is a state worth reading, not an empty space: the dialog no
   longer chooses a directory for you, so this line is where you find that out. */
.new-project.none { color: var(--text-3); font-style: italic; }
#new-scrim[data-tinted] .new-project { color: color-mix(in srgb, var(--proj-accent) 62%, var(--text)); }

/* The backdrop takes a wash of it, so the screen says which project before a
   word of the dialog has been read. Darker than the plain #00000099 it replaces
   rather than lighter — a tint that also lifted the backdrop would show less of
   the window behind it while claiming to say more.

   How strong, and whether at all, is `projects.backdropTint` and
   `projects.backdropStrength` — paintBackdropTint() turns them into the custom
   property and the attribute below. Off gives the plain dim every other dialog
   has; the head and the selection colours keep their tint either way.

   There used to be a 3px accent edge inset along the top of .modal as well. The
   tinted head painted over all of it except the rounded corners, where the
   anti-aliased clip let it bleed through as two odd-coloured fringes — so the
   only thing it ever drew was a flaw, and it went. */
#new-scrim[data-tinted] {
    background: color-mix(in srgb, var(--proj-accent) var(--backdrop-tint, 13%), var(--scrim-strong));
}
:root[data-plain-backdrop] #new-scrim[data-tinted] { background: var(--scrim); }
#new-scrim[data-tinted] .modal-head {
    background: color-mix(in srgb, var(--proj-accent) 13%, var(--s2));
    padding-bottom: var(--sp-6);
}

/* The selection states inside this dialog, which are all hard-coded blue. Kept
   under the tinted attribute *and* under #new-scrim, so blue goes on meaning
   "selected" in every other panel in the app: a colour that meant "this project"
   in one place and "you chose this" in another would be worth neither. */
#new-scrim[data-tinted] {
    --sel-bg: color-mix(in srgb, var(--proj-accent) 26%, var(--s2));
    --sel-bg-hover: color-mix(in srgb, var(--proj-accent) 34%, var(--s2));
    --sel-fg: color-mix(in srgb, var(--proj-accent) 82%, var(--text));
}
#new-scrim[data-tinted] .picker-row[aria-current="true"],
#new-scrim[data-tinted] .picker-tab[aria-selected="true"],
#new-scrim[data-tinted] .when-day:has(input:checked) {
    background: var(--sel-bg);
    color: var(--sel-fg);
}
#new-scrim[data-tinted] .picker-row[aria-current="true"]:hover {
    background: var(--sel-bg-hover);
}
#new-scrim[data-tinted] .when-opt:has(input:checked) {
    background: color-mix(in srgb, var(--proj-accent) 14%, var(--s2));
}
#new-scrim[data-tinted] .field textarea:focus,
#new-scrim[data-tinted] .field input[type="text"]:focus,
#new-scrim[data-tinted] .when-in:focus,
#new-scrim[data-tinted] .mkdir-name:focus {
    box-shadow: inset 0 0 0 2px var(--proj-accent);
}
#new-scrim[data-tinted] .when-day:focus-within {
    box-shadow: inset 0 0 0 2px var(--proj-accent);
}
#new-scrim[data-tinted] .when-pick input,
#new-scrim[data-tinted] .field label.check input {
    accent-color: var(--proj-accent);
}

/* --- the rail's project cards ----------------------------------------- */

/* A stripe down the left edge rather than a wash over the card. The rail is
   304px of rows that are already carrying a state colour each, and a tinted card
   under them would be a second colour competing with the first; an edge is read
   as "which card" and never as "what is happening in it". */
.rail-group { position: relative; }
.rail-group[data-tinted] {
    box-shadow: inset var(--edge-w) 0 0 var(--proj-accent);
}
.rail-group[data-tinted] > .group-head {
    padding-left: 15px;
    color: color-mix(in srgb, var(--proj-accent) 55%, var(--text-2));
}
.rail-group[data-tinted] > .group-head .twist {
    color: color-mix(in srgb, var(--proj-accent) 45%, var(--text-4));
}

/* ⋮ — a sibling of the heading, not a child, because the heading is a <button>.
   Held over the card's top-right corner, with the head padded to match so the
   count never runs under it. Hidden until the card is hovered or something in it
   has the focus: one of these per project, always drawn, is a column of dots
   down a narrow rail saying nothing. */
.group-menu-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: var(--text-4);
    opacity: 0;
    transition: opacity var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.rail-group:hover > .group-menu-btn,
.rail-group:focus-within > .group-menu-btn,
.group-menu-btn[aria-expanded="true"] { opacity: 1; }
.group-menu-btn:hover { background: var(--s3); color: var(--text-2); }
.group-menu-btn[aria-expanded="true"] { background: var(--s3); color: var(--text); }
/* Room for it, so the count and the live pill stop short of the button rather
   than sliding under it. Only where there is a button to make room for. */
.rail-group:has(> .group-menu-btn) > .group-head { padding-right: 36px; }

/* `custom` order: the heading is the drag handle, and the grip says so. Drawn
   faint until the card is hovered, for the ⋮ button's reason. */
.group-head[draggable="true"] { cursor: grab; }
.group-grip {
    display: grid;
    place-items: center;
    margin: 0 -4px 0 -6px;
    color: var(--text-4);
    opacity: 0.35;
    transition: opacity var(--t-fast) var(--ease);
}
.rail-group:hover > .group-head .group-grip { opacity: 1; }
.rail-group.dragging { opacity: 0.55; outline: 1px dashed var(--text-4); outline-offset: -1px; }

/* The menu itself. .new-menu's surface and rows — it is the same kind of thing,
   one step further from the control that opened it — but fixed and placed from
   script, because the rail scrolls and renderRail() rebuilds the button under it.
   See showProjMenu(). */
.proj-menu {
    position: fixed;
    top: auto;
    left: auto;
    right: auto;
    width: 220px;
    max-height: none;
}

/* --- the boards and the dashboard ------------------------------------- */

/* Heads only, and lightly. These are wide surfaces holding cards that carry
   colours of their own — a task's state, a PR's — so the project's colour has to
   stay out of their way while still being the first thing read down the column.

   Painted on the column rather than on its head, as two background layers: a
   2px edge across the top and a wash that fades out under the heading. It used
   to be a tinted block on the head with an inset edge, and both showed their
   seams — the inset followed the corner radius down the sides like a tab
   outline, and the wash stopped in a hard line where the head met the cards.
   The column's own radius clips a background, so the edge tapers into the
   corners and the wash has no bottom to stop at. */
.tb-col[data-tinted] {
    background:
        linear-gradient(var(--proj-accent), var(--proj-accent)) top / 100% 2px no-repeat,
        linear-gradient(to bottom, color-mix(in srgb, var(--proj-accent) 12%, var(--s1)), var(--s1) 96px);
}
.dproj[data-tinted] {
    background:
        linear-gradient(var(--proj-accent), var(--proj-accent)) top / 100% 2px no-repeat,
        linear-gradient(to bottom, color-mix(in srgb, var(--proj-accent) 12%, var(--s2)), var(--s2) 96px);
}
.tb-col[data-tinted] > .tb-col-head h2 {
    color: color-mix(in srgb, var(--proj-accent) 55%, var(--text));
}
.dproj[data-tinted] > .dproj-head .dproj-name {
    color: color-mix(in srgb, var(--proj-accent) 55%, var(--text));
}

/* --- the colour picker ------------------------------------------------ */

.modal.pcolor { width: min(480px, 100%); }
.pcolor-name { font: 500 var(--fs-base)/var(--lh-snug) var(--sans); color: var(--text); }
.pcolor-path {
    margin-top: var(--sp-1);
    font: 400 var(--fs-xs)/var(--lh-base) var(--mono);
    color: var(--text-4);
    overflow-wrap: anywhere;
}

.pcolor-swatches { display: flex; flex-wrap: wrap; gap: var(--sp-4); }

/* One swatch: a filled disc of the colour, ticked when it is the one in force.
   The tick is drawn over the fill rather than beside it, so the row's height is
   the same whichever is chosen and nothing shifts as you go along it. */
.pcolor-swatch {
    display: grid;
    place-items: center;
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--pcolor, var(--s4));
    color: #000000b8;
    box-shadow: inset 0 0 0 1px #0000004d;
    transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.pcolor-swatch:hover { transform: scale(1.08); }
.pcolor-swatch.on { box-shadow: 0 0 0 2px var(--s2), 0 0 0 4px var(--pcolor, var(--text-3)); }
/* "No colour" is a swatch like the others rather than a button somewhere else,
   because clearing is a choice among the same choices. Drawn as an empty ring so
   it cannot be mistaken for a dark colour. */
.pcolor-swatch.none {
    background: transparent;
    color: var(--text-3);
    box-shadow: inset 0 0 0 1.5px var(--outline);
}
.pcolor-swatch.none.on { box-shadow: inset 0 0 0 1.5px var(--outline), 0 0 0 2px var(--s2), 0 0 0 4px var(--text-3); }

.pcolor-custom { display: flex; align-items: center; gap: var(--sp-5); margin-top: var(--sp-6); }
.pcolor-custom label { font: 400 var(--fs-md)/var(--lh-snug) var(--sans); color: var(--text-3); }
.pcolor-custom input[type="color"] {
    flex: none;
    width: 46px;
    height: 30px;
    padding: 0;
    border-radius: var(--r-sm);
    background: var(--bg);
    cursor: pointer;
}

/* --- the Projects group in Settings ----------------------------------- */

.pcolor-row {
    display: flex;
    align-items: center;
    gap: var(--sp-6);
    padding: var(--sp-4) var(--sp-6);
    border-radius: var(--r);
    background: var(--s2);
    margin-bottom: var(--sp-3);
}
.pcolor-row[data-tinted] {
    background: color-mix(in srgb, var(--proj-accent) 9%, var(--s2));
    box-shadow: inset var(--edge-w) 0 0 var(--proj-accent);
}
.pcolor-row-text { min-width: 0; flex: 1; }
.pcolor-row-name { font: 500 var(--fs-md)/var(--lh-snug) var(--sans); color: var(--text-2); }
.pcolor-row-path {
    font: 400 var(--fs-xs)/var(--lh-base) var(--mono);
    color: var(--text-4);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .pcolor-swatch:hover { transform: none; }
}

/* --- Wispr Flow transforms ---------------------------------------------- */

/* The button beside each message box. The live composer's is the input row's
   icon button (composer.css, .btn-attach) — repeated here rather than listed
   there because this file loads later and owns Wispr; keep the two in step. The
   dialog's is a small labelled-row button with only the mark
   in it. Both wraps are hidden until the bridge says a chord can land, and an
   author `display` would override the attribute. */
.wispr-wrap { position: relative; flex: none; }
.wispr-wrap[hidden] { display: none; }
.btn-wispr {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: var(--text-3);
    background: transparent;
    border-radius: var(--pill);
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn-wispr:hover,
.btn-wispr[aria-expanded="true"] { background: var(--s4); color: var(--text); }
.btn-wispr-small { display: inline-grid; place-items: center; }

/* A row's chord, in the slot send-later puts its time. */
.wispr-menu kbd.at { font: 400 var(--fs-xs)/var(--lh-snug) var(--mono); }

/* One transform in Settings: title, shortcut, delete. */
.wispr-set-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 150px) auto;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
    border-radius: var(--r);
    background: var(--s2);
    margin-bottom: var(--sp-3);
}
.wispr-set-row input[type="text"] {
    background: var(--s1);
    border: 1px solid var(--outline-soft);
    border-radius: var(--r-sm);
    padding: var(--sp-3) var(--sp-4);
    color: var(--text);
    font: 400 var(--fs-md)/var(--lh-tight) var(--sans);
    min-width: 0;
}
.wispr-set-row .wispr-set-combo { font-family: var(--mono); }
.wispr-set-error {
    grid-column: 1 / -1;
    font: 400 var(--fs-sm)/var(--lh-snug) var(--sans);
    color: var(--red);
}

