/*
 * Nitronet design system (nitronet/design-system) first, then the layout of the application,
 * written with its tokens only.
 */
@import url("../nitronet-ds/styles-a8MEUYJ.css");
@import url("../nitronet-ds/components-VnduP7O.css");

/* ---------- Layout ---------- */
.site-header {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: var(--space-3);
    height: 56px; padding: 0 var(--space-5);
    background: var(--bg-page); border-bottom: 1px solid var(--border-subtle);
}
.site-header__app { font: var(--text-small); color: var(--fg-3); }
.site-header__app::before { content: "/ "; }
.site-header__actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
/* Account of the user: picture (or initial), 28px square like the small icon buttons next to it */
.site-header__user { display: inline-flex; text-decoration: none; }
.site-header__user:hover { text-decoration: none; }
.site-header__avatar {
    display: block; width: var(--control-h-sm); height: var(--control-h-sm); object-fit: cover;
    border: 1px solid var(--border-default); transition: border-color var(--dur-fast) var(--ease);
}
.site-header__user:hover .site-header__avatar { border-color: var(--border-strong); }
.site-header__avatar--initial {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--fg-1); font: var(--text-small); font-weight: var(--fw-semibold);
}
.site-header__logout { display: flex; margin: 0; }
/* The header sits at the top of the viewport: its tooltips open below, aligned on the right edge of their
   button (centered, the one of the last button overflows the page, even hidden, and adds a horizontal scrollbar) */
.site-header .nn-tooltip::after { bottom: auto; top: 100%; left: auto; right: 0; transform: none; margin: 6px 0 0; }

/* ---------- Theme switch: show the button leading away from the theme on screen ---------- */
.theme-switch { display: flex; margin: 0; }
.theme-switch .theme-switch__to-dark { display: none; }
:root[data-theme="light"] .theme-switch .theme-switch__to-light { display: none; }
:root[data-theme="light"] .theme-switch .theme-switch__to-dark { display: inline-flex; }
@media (prefers-color-scheme: light) {
    :root[data-theme="auto"] .theme-switch .theme-switch__to-light { display: none; }
    :root[data-theme="auto"] .theme-switch .theme-switch__to-dark { display: inline-flex; }
}

.site-main {
    display: flex; flex-direction: column; gap: var(--space-5);
    max-width: var(--prose-max); margin: 0 auto; padding: var(--space-7) var(--space-5);
}

.page-title { margin: 0; font: var(--text-h1); letter-spacing: var(--ls-tight); }
.page-meta { margin: calc(-1 * var(--space-4)) 0 0; font: var(--text-small); color: var(--fg-2); }

/* Flash messages (Twig flashes and toasts of the task list) take the width of the page */
.site-main .nn-toast { width: 100%; }

/* React root of the task list: its children are laid out by .site-main, like server-rendered ones */
.task-app { display: contents; }

/* ---------- New task ---------- */
.task-form { display: flex; align-items: flex-end; gap: var(--space-3); }
.task-form .nn-field { flex: 1; }
/* Keep the button aligned with the input when an error shows under it */
.task-form:has(.nn-error) { align-items: center; }

/* ---------- List: rows divided by 1px rules ---------- */
.task-list { margin: calc(-1 * var(--space-5)) 0 0; padding: 0; list-style: none; }
.task {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle);
}
.task form { margin: 0; display: flex; }
.task__title { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--fg-1); }
.task__meta { font: var(--text-small); color: var(--fg-3); white-space: nowrap; }
.task--done .task__title { color: var(--fg-3); text-decoration: line-through; }
.task__title { cursor: text; }
.task__title:focus-visible { outline: 1px solid var(--border-focus); outline-offset: 2px; }
.task__edit { flex: 1; min-width: 0; }
.task__delete:hover { color: var(--danger); }

.task-empty { margin: 0; padding: var(--space-5) 0; color: var(--fg-2); }
.task-footer { display: flex; justify-content: flex-end; margin: calc(-1 * var(--space-3)) 0 0; }

/* ---------- Sign-in ---------- */
.login { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-4); margin-top: var(--space-7); }
.login p { margin: 0; color: var(--fg-2); }
.login form { margin: 0; }

@media (max-width: 560px) {
    .task-form { flex-direction: column; align-items: stretch; }
    .task__meta { display: none; }
}
