/* To-do list (/to-do-list): what is its own. Panels, fields, buttons, the filter control, list rows, tags, the progress
   bar, the empty state and the colours come from the app kit (css/app-kit, docs/app-kit.md). Loaded only on this app's
   page (StylePaths). */

/* High priority red: the app's own (a little brighter than the kit's danger on a light stage). */
.todo-landing-app {
    --td-high: #dc2626;
}

.todo-landing-app[data-theme="dark"] > .filter-landing-stage {
    --td-high: #f87171;
}

/* The list panel spans the stage, also on phones, where the site sets align-items: start on the stage
   (seo-pages.css, body.filter-app-mode). */
.todo-landing-app > .filter-landing-stage > * {
    align-self: stretch;
}

/* --- Head: counts and progress --------------------------------------------------------------------------------- */

/* The counts stay at the end of the head row (the panel has no title). */
.todo-landing-app .td-counts {
    margin: 0;
    margin-inline-start: auto;
    color: var(--ak-muted);
    font-size: var(--ak-fs-sm);
    font-variant-numeric: tabular-nums;
}

.todo-landing-app .td-count-active {
    color: var(--ak-accent);
    font-weight: 700;
}

/* --- Add a task ------------------------------------------------------------------------------------------------ */

.todo-landing-app .td-add {
    display: flex;
    flex-direction: column;
    gap: var(--ak-space-2);
}

.todo-landing-app .td-add-opts {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--ak-space-2);
}

.todo-landing-app .td-mini {
    display: flex;
    flex: 1 1 8rem;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    color: var(--ak-muted);
    font-size: var(--ak-fs-xs);
}

/* The task text field is the big one (the kit's field selector is long, hence this one). */
.todo-landing-app input.ak-field.td-field--text:not([type="color"]):not([type="range"]):not([type="checkbox"]):not([type="file"]) {
    padding: 0.6rem 0.75rem;
    font-size: 1.05rem;
}

.todo-landing-app .td-add-btn {
    padding-inline: 1.1rem;
}

/* --- Task rows: the start edge in the priority colour ---------------------------------------------------------- */

.todo-landing-app .td-item {
    --td-pri: var(--ak-accent);
    padding: 0.5rem 0.4rem 0.5rem 0.6rem;
    border-inline-start: 4px solid var(--td-pri);
    transition: background-color var(--ak-duration) var(--ak-ease), border-color var(--ak-duration) var(--ak-ease);
}

.todo-landing-app .td-item:hover {
    border-inline-start-color: var(--td-pri);
    background: var(--ak-hover);
}

.todo-landing-app .td-item:focus-within {
    border-color: color-mix(in srgb, var(--ak-accent) 45%, var(--ak-border));
    border-inline-start-color: var(--td-pri);
}

.todo-landing-app .td-item--high {
    --td-pri: var(--td-high);
}

.todo-landing-app .td-item--low {
    --td-pri: var(--ak-muted);
}

.todo-landing-app .td-item--done {
    --td-pri: var(--ak-border);
    background: var(--ak-panel);
}

.todo-landing-app .td-item--editing,
.todo-landing-app .td-item--editing:hover {
    border-color: var(--ak-accent);
    border-inline-start-color: var(--td-pri);
    background: var(--ak-field);
}

.todo-landing-app .td-item--new {
    animation: td-item-new 1.2s ease-out;
}

@keyframes td-item-new {
    from {
        background-color: color-mix(in srgb, var(--ak-accent) 22%, var(--ak-field));
    }
}

.todo-landing-app .td-item--drag {
    opacity: 0.5;
}

.todo-landing-app .td-item--over {
    box-shadow: 0 -3px 0 var(--ak-accent);
}

.todo-landing-app .td-handle {
    display: inline-flex;
    color: var(--ak-muted);
    cursor: grab;
    user-select: none;
}

.todo-landing-app .td-check {
    flex: 0 0 auto;
    width: 1.2rem;
    height: 1.2rem;
    margin: 0;
    accent-color: var(--ak-accent);
    cursor: pointer;
}

.todo-landing-app .td-text {
    overflow-wrap: anywhere;
    border-radius: 0.25rem;
    cursor: text;
}

.todo-landing-app .td-item--done .td-text {
    color: var(--ak-muted);
    text-decoration: line-through;
    text-decoration-color: color-mix(in srgb, var(--ak-muted) 70%, transparent);
}

/* The inline editor: a slim field in the row. */
.todo-landing-app input.ak-field.td-edit:not([type="color"]):not([type="range"]):not([type="checkbox"]):not([type="file"]) {
    min-height: 0;
    padding: 0.2rem 0.4rem;
    border-color: var(--ak-accent);
    font-size: inherit;
}

.todo-landing-app .td-meta {
    align-items: center;
    gap: 0.35rem;
}

.todo-landing-app .td-badge--high {
    --ak-tag: var(--td-high);
}

/* A tag on a task is a button that filters the list by it. */
.todo-landing-app .td-tagchip {
    margin: 0;
    border: 0;
    font-family: inherit;
    cursor: pointer;
}

.todo-landing-app .td-tagchip:hover {
    background: color-mix(in srgb, var(--ak-tag) 25%, transparent);
}

.todo-landing-app .td-tagchip:focus-visible,
.todo-landing-app .td-check:focus-visible,
.todo-landing-app .td-text:focus-visible {
    outline: 2px solid var(--ak-accent);
    outline-offset: 2px;
}

.todo-landing-app .td-icon {
    width: 2rem;
    min-width: 2rem;
    min-height: 2rem;
    color: var(--ak-muted);
}

.todo-landing-app .td-icon:hover {
    color: var(--ak-accent);
}

.todo-landing-app .td-icon--del:hover {
    color: var(--ak-danger);
}

/* --- Empty list: a small clipboard illustration above the message ---------------------------------------------- */

.todo-landing-app .td-empty {
    padding: 1.25rem 0.5rem 1rem;
    border: 1px dashed var(--ak-border);
    border-radius: var(--ak-radius);
}

.todo-landing-app .td-empty-art {
    display: block;
    width: 7.5rem;
    height: auto;
}

.todo-landing-app .td-art-glow {
    fill: color-mix(in srgb, var(--ak-accent) 11%, transparent);
}

.todo-landing-app .td-art-board {
    fill: var(--ak-field);
    stroke: var(--ak-border);
    stroke-width: 1.5;
}

.todo-landing-app .td-art-clip {
    fill: var(--ak-accent);
}

.todo-landing-app .td-art-box {
    fill: var(--ak-field);
    stroke: var(--ak-muted);
    stroke-width: 1.4;
}

.todo-landing-app .td-art-box--on {
    fill: var(--ak-accent);
    stroke: var(--ak-accent);
}

.todo-landing-app .td-art-tick {
    fill: none;
    stroke: var(--ak-field);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.todo-landing-app .td-art-line {
    stroke: var(--ak-border);
    stroke-width: 3;
    stroke-linecap: round;
}

.todo-landing-app .td-art-line--on {
    stroke: color-mix(in srgb, var(--ak-accent) 45%, var(--ak-border));
}

/* Phones: the add options two a row, the Add button across the full width. */
@container (max-width: 460px) {
    .todo-landing-app .td-add-btn {
        flex: 1 1 100%;
    }

    .todo-landing-app .td-item {
        gap: 0.45rem;
    }

    .todo-landing-app .td-icon {
        width: 1.75rem;
        min-width: 1.75rem;
        min-height: 1.75rem;
    }
}

/* Print (the app's Print button): only the list, on white. */
@media print {
    body:has(.todo-landing-app.td-printing) * {
        visibility: hidden;
    }

    .todo-landing-app.td-printing .td-list-panel,
    .todo-landing-app.td-printing .td-list-panel * {
        visibility: visible;
    }

    .todo-landing-app.td-printing .td-list-panel {
        position: absolute;
        inset: 0 0 auto 0;
        border: 0;
        background: #ffffff;
        color: #000000;
    }

    .todo-landing-app.td-printing .td-add,
    .todo-landing-app.td-printing .td-foot,
    .todo-landing-app.td-printing .td-progress,
    .todo-landing-app.td-printing .td-icon,
    .todo-landing-app.td-printing .td-handle {
        display: none !important;
    }

    .todo-landing-app.td-printing .td-item {
        break-inside: avoid;
        background: #ffffff;
    }
}
