/* tasks.rhys.wtf, in rhys.wtf's design language. What every app's pages
   share (the dark scheme, header, apps mark and menu, footer and form
   controls) is base.css, linked before this (rhyswtf-web's
   apps/base.css); the palettes come after it, and type.css (the fonts
   and their tokens) last. Here: the palette's tokens and Tasks' own
   parts. Sizes are in rem and layouts are intrinsic: there is one media
   query, at the foot. */

:root {
    /* Gruvbox light palette — https://github.com/morhetz/gruvbox */
    --gruvbox-bg0-hard: #f9f5d7;
    --gruvbox-bg0: #fbf1c7;
    --gruvbox-bg0-soft: #f2e5bc;
    --gruvbox-bg1: #ebdbb2;
    --gruvbox-bg2: #d5c4a1;
    --gruvbox-bg3: #bdae93;
    --gruvbox-bg4: #a89984;

    --gruvbox-fg0: #282828;
    --gruvbox-fg1: #3c3836;
    --gruvbox-fg2: #504945;
    --gruvbox-fg3: #665c54;
    --gruvbox-fg4: #7c6f64;

    --gruvbox-gray: #928374;

    --gruvbox-red: #cc241d;
    --gruvbox-green: #98971a;
    --gruvbox-yellow: #d79921;
    --gruvbox-blue: #458588;
    --gruvbox-purple: #b16286;
    --gruvbox-aqua: #689d6a;
    --gruvbox-orange: #d65d0e;

    --gruvbox-red-faded: #9d0006;
    --gruvbox-green-faded: #79740e;
    --gruvbox-yellow-faded: #b57614;
    --gruvbox-blue-faded: #076678;
    --gruvbox-purple-faded: #8f3f71;
    --gruvbox-aqua-faded: #427b58;
    --gruvbox-orange-faded: #af3a03;

    /* Semantic tokens — change these to retheme without touching components.
       They reference only the --gruvbox-* slots, which palettes.css (loaded
       after this file) redefines for each palette but Gruvbox: keep it so. */
    --color-bg: var(--gruvbox-bg0);
    --color-surface: var(--gruvbox-bg0-hard);
    --color-border: var(--gruvbox-fg0);
    --color-text: var(--gruvbox-fg1);
    --color-text-strong: var(--gruvbox-fg3);
    --color-muted: var(--gruvbox-fg3);
    --color-link: var(--gruvbox-fg1);
    --color-link-hover: var(--gruvbox-blue-faded);
    --color-error: var(--gruvbox-red-faded);
    /* Empty part of progress bars. */
    --color-track: var(--gruvbox-bg1);
    /* Glyphs on an accent fill (app icons), the same in both schemes.
       palettes.css sets it for each palette. */
    --color-on-accent: #fbf1c7;

    --spacing: 1rem;
    --radius: 1rem;

    /* Form controls and scrollbars follow the palette in each scheme. */
    color-scheme: light;

    /* Gruvbox dark palette, held here and applied by the two blocks below
       (once for the OS preference, once for the explicit choice) so the
       values exist in exactly one place. The plain accents are the same in
       both schemes, as in Gruvbox itself; the "faded" slots, which this
       stylesheet uses for emphasis, take the dark scheme's bright variants. */
    --gruvbox-dark-bg0-hard: #1d2021;
    --gruvbox-dark-bg0: #282828;
    --gruvbox-dark-bg0-soft: #32302f;
    --gruvbox-dark-bg1: #3c3836;
    --gruvbox-dark-bg2: #504945;
    --gruvbox-dark-bg3: #665c54;
    --gruvbox-dark-bg4: #7c6f64;
    --gruvbox-dark-fg0: #fbf1c7;
    --gruvbox-dark-fg1: #ebdbb2;
    --gruvbox-dark-fg2: #d5c4a1;
    --gruvbox-dark-fg3: #bdae93;
    --gruvbox-dark-fg4: #a89984;
    --gruvbox-dark-red-bright: #fb4934;
    --gruvbox-dark-green-bright: #b8bb26;
    --gruvbox-dark-yellow-bright: #fabd2f;
    --gruvbox-dark-blue-bright: #83a598;
    --gruvbox-dark-purple-bright: #d3869b;
    --gruvbox-dark-aqua-bright: #8ec07c;
    --gruvbox-dark-orange-bright: #fe8019;
}

::selection {
    background: var(--gruvbox-bg2);
    color: var(--color-text);
}

input[type="text"],
input[type="search"],
input[type="url"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    min-width: 0;
    padding: 0.45rem 0.6rem;
    font-size: 1rem;
    font-family: var(--font-ui);
    border: 1px solid var(--color-border);
    border-radius: 0.6rem;
    background: var(--color-surface);
    color: var(--color-text);
}

textarea {
    resize: vertical;
    line-height: 1.45;
}

.page {
    max-width: 46rem;
}

/* A category's colour, as --cat: the faded accent in light, the bright
   one in dark (the slots flip), so text in it reads on the page. */
.cat--red { --cat: var(--gruvbox-red-faded); }
.cat--orange { --cat: var(--gruvbox-orange-faded); }
.cat--yellow { --cat: var(--gruvbox-yellow-faded); }
.cat--green { --cat: var(--gruvbox-green-faded); }
.cat--aqua { --cat: var(--gruvbox-aqua-faded); }
.cat--blue { --cat: var(--gruvbox-blue-faded); }
.cat--purple { --cat: var(--gruvbox-purple-faded); }
.cat--gray { --cat: var(--gruvbox-gray); }

.dot {
    display: inline-block;
    width: 0.7em;
    height: 0.7em;
    margin-right: 0.4em;
    border-radius: 50%;
    background: var(--cat, var(--color-muted));
    flex: none;
}

.dot--title {
    width: 0.5em;
    height: 0.5em;
    vertical-align: 0.12em;
}

/* The lists, as links under the header. They wrap onto a second line
   when there are more than fit, so every list (and which one this is)
   is in sight without scrolling sideways. */
.tabs {
    border-top: 1px solid var(--gruvbox-bg2);
    border-bottom: 1px solid var(--gruvbox-bg2);
    background: var(--color-surface);
}

.tabs__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
    max-width: 46rem;
    margin: 0 auto;
    padding: 0.3rem var(--spacing);
    list-style: none;
}

.tabs__list > li {
    flex: none;
}

.tabs__link {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 2rem;
    font-family: var(--font-ui);
    font-size: 1rem;
    white-space: nowrap;
    text-decoration: none;
    color: var(--color-text);
}

.tabs__link:hover {
    background: var(--gruvbox-bg1);
    color: var(--color-text);
}

.tabs__link[aria-current="page"] {
    background: var(--color-text);
    color: var(--color-bg);
    font-weight: 600;
}

.tabs__count {
    margin-left: 0.4em;
    font-size: 0.85em;
    font-variant-numeric: tabular-nums;
    opacity: 0.75;
}

.tabs__list > .tabs__search {
    flex: 1 1 7rem;
    max-width: 12rem;
    margin-left: auto;
    padding-left: 0.5rem;
}

.tabs__q {
    padding: 0.3rem 0.7rem;
    border-radius: 2rem;
}

/* The last change, and its undo. */
.undo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 1rem;
    padding: 0.4rem 0.5rem 0.4rem 0.9rem;
    border: 1px solid var(--gruvbox-bg3);
    border-radius: 0.8rem;
    background: var(--color-surface);
    font-family: var(--font-ui);
    font-size: 0.95rem;
}

.undo__what {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.undo__button {
    flex: none;
    padding: 0.25rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: 2rem;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.list-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0 1rem;
    margin: 0.25rem 0 0.75rem;
}

.list-head .page-title {
    margin: 0;
    font-size: 2.2rem;
    line-height: 1.15;
}

.list-head__count {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--color-muted);
}

/* Quick add: a title and Enter. */
.add {
    display: flex;
    gap: 0.5rem;
    margin: 0 0 1rem;
}

.add__title {
    flex: 1 1 10rem;
}

.add__category {
    flex: 0 1 9rem;
    width: auto;
}

.add__button {
    flex: none;
}

.empty {
    margin: 1.5rem 0;
    font-family: var(--font-ui);
    color: var(--color-muted);
}

.empty--small {
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
}

.reorder-hint {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
}

.reorder-hint[hidden] {
    display: none;
}

/* A list of tasks: one card, a row each. */
.tasks {
    margin: 0 0 1.25rem;
    padding: 0;
    list-style: none;
    border: 1px solid var(--gruvbox-bg3);
    border-radius: 0.9rem;
    background: var(--color-surface);
    overflow: hidden;
}

.task {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.55rem 0.6rem;
    border-top: 1px solid var(--gruvbox-bg2);
    background: var(--color-surface);
    /* A move's redirect comes back to the row: clear of the top edge. */
    scroll-margin-top: 4rem;
}

.task:first-child {
    border-top: 0;
}

.task:target {
    background: var(--gruvbox-bg0-soft);
}

.task--dragging {
    opacity: 0.55;
    background: var(--gruvbox-bg1);
}

.task__main {
    flex: 1;
    min-width: 0;
    padding-top: 0.2rem;
}

.task__title {
    font-family: var(--font-ui);
    font-size: 1.05rem;
    line-height: 1.35;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.task__title:hover {
    text-decoration: underline;
}

.task__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.25rem;
}

.task__meta:empty {
    display: none;
}

/* A blocked task is set back: quieter, with what it waits for under it. */
.task--blocked .task__title {
    color: var(--color-muted);
    font-style: italic;
}

.task--blocked .check {
    border-style: dashed;
    opacity: 0.6;
}

.task--closed .task__title {
    text-decoration: line-through;
    color: var(--color-muted);
}

.task__waiting {
    margin: 0.35rem 0 0;
    padding: 0;
    list-style: none;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--color-muted);
}

.task__waiting--clear {
    color: var(--gruvbox-green-faded);
    font-weight: 600;
}

.wait {
    padding: 0.1rem 0 0.1rem 0.6rem;
    border-left: 2px solid var(--gruvbox-bg3);
}

.wait__form {
    display: inline;
}

.wait__label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wait__met {
    margin-left: 0.3rem;
    padding: 0 0.55rem;
    border: 1px solid var(--color-border);
    border-radius: 2rem;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    cursor: pointer;
}

.chip {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border: 1px solid var(--gruvbox-bg3);
    border-radius: 2rem;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--color-muted);
    text-decoration: none;
    white-space: nowrap;
}

.chip--cat,
.chip--label {
    border-color: var(--cat);
    color: var(--cat);
    font-weight: 600;
}

.chip--label {
    border-style: dashed;
}

.chip--jarvis {
    border-color: var(--gruvbox-purple-faded);
    color: var(--gruvbox-purple-faded);
    font-weight: 600;
}

.chip--started {
    border-color: var(--gruvbox-aqua-faded);
    color: var(--gruvbox-aqua-faded);
}

.chip--overdue {
    border-color: var(--color-error);
    color: var(--color-error);
    font-weight: 600;
}

.chip--today {
    font-weight: 700;
    color: var(--color-text);
    border-color: var(--color-text);
}

/* The done button: an empty circle that shows its tick when pointed at. */
.task__check {
    flex: none;
    margin: 0;
}

.check {
    display: grid;
    place-items: center;
    width: 1.7rem;
    height: 1.7rem;
    margin-top: 0.15rem;
    padding: 0;
    border: 2px solid var(--color-muted);
    border-radius: 50%;
    background: none;
    color: transparent;
    cursor: pointer;
}

.check svg {
    width: 1rem;
    height: 1rem;
}

.check:hover,
.check:focus-visible {
    border-color: var(--gruvbox-green-faded);
    color: var(--gruvbox-green-faded);
}

/* The handle the browser bundle un-hides, to drag a row by. */
.drag-handle {
    flex: none;
    width: 1.6rem;
    height: 2rem;
    margin-left: -0.2rem;
    padding: 0.15rem;
    border: 0;
    border-radius: 0.4rem;
    background: none;
    color: var(--gruvbox-bg4);
    cursor: grab;
    touch-action: none;
}

.drag-handle[hidden] {
    display: none;
}

.drag-handle svg {
    display: block;
    width: 100%;
    height: 100%;
}

.drag-handle:hover,
.drag-handle:focus-visible {
    background: var(--gruvbox-bg1);
    color: var(--color-text);
}

.task--dragging .drag-handle {
    cursor: grabbing;
}

/* The buttons that put a list in order without script. */
.task__moves {
    display: flex;
    flex: none;
    gap: 0.15rem;
    margin: 0;
}

.move {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--gruvbox-bg3);
    border-radius: 0.5rem;
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
}

.move svg {
    width: 1.05rem;
    height: 1.05rem;
}

.move:hover:not(:disabled) {
    border-color: var(--color-border);
}

.move:disabled {
    opacity: 0.3;
    cursor: default;
}

/* With dragging (and the arrow keys on a handle), up and down step
   aside; "to the top" stays, as the one long move worth a button. */
:root[data-web="ready"] .task .move[data-move="up"],
:root[data-web="ready"] .task .move[data-move="down"] {
    display: none;
}

.section-title {
    display: flex;
    align-items: center;
    margin: 1.5rem 0 0.5rem;
    font-family: var(--font-display);
    font-weight: normal;
    font-size: 1.35rem;
    color: var(--color-text-strong);
}

.section-title a {
    text-decoration: none;
}

.section-title__count {
    margin-left: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--color-muted);
}

.sub-title {
    margin: 1rem 0 0.35rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
}

.group .help {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
}

.button--primary {
    background: var(--color-text);
    color: var(--color-bg);
    font-weight: 600;
}

.button--primary:hover {
    background: var(--color-text-strong);
    color: var(--color-bg);
}

/* A task's page. */
.crumbs {
    margin: 0 0 0.5rem;
    font-family: var(--font-ui);
}

.crumbs a {
    text-decoration: none;
}

.detail__title {
    margin: 0 0 0.4rem;
    font-family: var(--font-display);
    font-weight: normal;
    font-size: 2rem;
    line-height: 1.2;
    color: var(--color-text-strong);
    overflow-wrap: anywhere;
}

.detail--closed .detail__title {
    text-decoration: line-through;
}

.detail__state {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.9rem 0;
}

.detail__state form {
    margin: 0;
}

.prose {
    margin: 0 0 1rem;
    padding: 0.2rem 1rem;
    border-left: 3px solid var(--gruvbox-bg3);
    font-size: 1.1rem;
    overflow-wrap: anywhere;
}

.prose pre {
    overflow-x: auto;
    padding: 0.6rem;
    background: var(--gruvbox-bg1);
    border-radius: 0.5rem;
}

.prose code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.panel {
    margin: 1.25rem 0 0;
    padding: 0.2rem 1rem 1rem;
    border: 1px solid var(--gruvbox-bg3);
    border-radius: 0.9rem;
    background: var(--color-surface);
    scroll-margin-top: 1rem;
}

.panel .section-title {
    margin-top: 0.8rem;
}

.panel__forms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
    gap: 0.75rem 1rem;
    margin-top: 0.75rem;
}

/* A label, a field and a button in a line; the field takes what's left
   and they wrap when there isn't room. */
.inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.5rem;
    margin: 0.75rem 0 0;
}

.panel__forms .inline {
    margin: 0;
}

.inline label {
    flex: 1 0 100%;
    font-size: 0.9rem;
    color: var(--color-muted);
}

.inline input {
    flex: 1 1 9rem;
    width: auto;
}

.inline input[type="url"] {
    flex-basis: 100%;
}

.inline input[type="number"] {
    flex: 0 0 5rem;
}

.blockers,
.found,
.cats,
.plain {
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
    font-family: var(--font-ui);
}

.plain li {
    padding: 0.15rem 0;
}

.blocker,
.found__item,
.cats__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 0.75rem;
    padding: 0.45rem 0;
    border-top: 1px solid var(--gruvbox-bg2);
}

.blocker:first-child,
.found__item:first-child,
.cats__item:first-child {
    border-top: 0;
}

.blocker__what {
    flex: 1 1 12rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.blocker--clear .blocker__what > a,
.blocker--clear .blocker__what > span:first-child {
    text-decoration: line-through;
    color: var(--color-muted);
}

.blocker__actions {
    display: flex;
    gap: 0.4rem;
}

.blocker__actions form,
.found__item form {
    margin: 0;
}

.found {
    margin-top: 0.75rem;
    padding: 0 0.75rem;
    border: 1px dashed var(--gruvbox-bg3);
    border-radius: 0.6rem;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr));
    gap: 0.75rem;
}

.labels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1rem;
    margin: 0;
    padding: 0.4rem 0.75rem 0.6rem;
    border: 1px solid var(--gruvbox-bg3);
    border-radius: 0.6rem;
}

.labels legend {
    padding: 0 0.3rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--color-muted);
}

.labels__one {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.labels__one input {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
}

.form > .button {
    align-self: flex-start;
}

.history {
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
    font-family: var(--font-ui);
    font-size: 0.95rem;
}

.history__item {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.75rem;
    padding: 0.3rem 0;
    border-top: 1px solid var(--gruvbox-bg2);
}

.history__item:first-child {
    border-top: 0;
}

.history__when {
    flex: 0 0 10.5rem;
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
}

.history__what {
    flex: 1 1 12rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.history__who {
    font-weight: 600;
}

.history__who--api {
    color: var(--gruvbox-purple-faded);
}

/* Settings: a category a line, its name, colour and buttons. */
.cats__form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    margin: 0;
}

.cats__form input[type="text"] {
    flex: 1 1 8rem;
    width: auto;
}

.cats__form select {
    flex: 0 0 6.5rem;
    width: auto;
}

.cats__form .help {
    flex: 1 1 10rem;
}

/* The one media query: on a narrow screen the page's own gutter is all
   the room there is, so the cards run closer to the edge and the header
   line stacks. */
@media (max-width: 30rem) {
    .page {
        padding: 0.75rem 0.6rem;
    }

    .list-head .page-title {
        font-size: 1.9rem;
    }

    .tabs__list {
        padding-left: 0.4rem;
        padding-right: 0.4rem;
    }

    .tabs__link {
        padding: 0.3rem 0.55rem;
    }

    .task {
        gap: 0.4rem;
        padding: 0.55rem 0.5rem;
    }

    .history__when {
        flex-basis: 100%;
        font-size: 0.85rem;
    }
}
