/*
  Husam's five colours on the Django admin (SPEC §3, §4.6):
    #192D2B and #142423, two near-black greens; #CDC9BE and #BDBBAE, two greiges;
    #D49F59, a gold. The other values are tints and shades of them, for surfaces the
    five can't cover with enough contrast. Every text-and-background pair reaches 4.5
    to 1 in both themes; tests/test_m2_daily_tasks.py checks each one.

  The admin's own themes: light by default, dark when the system asks for it unless
  the theme toggle says light, and dark when the toggle says dark.
*/
:root,
html[data-theme="light"] {
    --primary: #192D2B;
    --secondary: #192D2B;
    --accent: #D49F59;
    --primary-fg: #CDC9BE;

    --body-fg: #142423;
    --body-bg: #FFFFFF;
    --body-quiet-color: #4F5A57;
    --body-medium-color: #2E3B39;
    --body-loud-color: #142423;

    --header-color: #CDC9BE;
    --header-branding-color: #D49F59;
    --header-bg: #142423;
    --header-link-color: #CDC9BE;

    --breadcrumbs-fg: #142423;
    --breadcrumbs-link-fg: #142423;
    --breadcrumbs-bg: #BDBBAE;

    --link-fg: #8A5A1C;
    --link-hover-color: #192D2B;
    --link-selected-fg: #192D2B;

    --hairline-color: #E6E3DC;
    --border-color: #BDBBAE;

    --error-fg: #A0281E;

    --message-success-bg: #E6EDE4;
    --message-warning-bg: #F5E6CF;
    --message-error-bg: #F7E1DE;

    --darkened-bg: #F1EFEA;
    --selected-bg: #ECE9E1;
    --selected-row: #F5E6CF;

    --button-fg: #FFFFFF;
    --button-bg: #192D2B;
    --button-hover-bg: #142423;
    --default-button-fg: #142423;
    --default-button-bg: #D49F59;
    --default-button-hover-bg: #E2B577;
    --close-button-bg: #46524F;
    --close-button-hover-bg: #142423;
    --delete-button-bg: #A0281E;
    --delete-button-hover-bg: #861F17;

    --object-tools-fg: #FFFFFF;
    --object-tools-bg: #192D2B;
    --object-tools-hover-bg: #142423;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) {
        --primary: #192D2B;
        --secondary: #192D2B;
        --accent: #D49F59;
        --primary-fg: #CDC9BE;

        --body-fg: #CDC9BE;
        --body-bg: #142423;
        --body-quiet-color: #BDBBAE;
        --body-medium-color: #CDC9BE;
        --body-loud-color: #F4F2EC;

        --header-color: #CDC9BE;
        --header-branding-color: #D49F59;
        --header-bg: #0C1716;
        --header-link-color: #CDC9BE;

        --breadcrumbs-fg: #CDC9BE;
        --breadcrumbs-link-fg: #D49F59;
        --breadcrumbs-bg: #192D2B;

        --link-fg: #D49F59;
        --link-hover-color: #E8C08A;
        --link-selected-fg: #E8C08A;

        --hairline-color: #22403C;
        --border-color: #2F4B47;

        --error-fg: #F08A7E;

        --message-success-bg: #1F3A2A;
        --message-warning-bg: #3A2E1C;
        --message-error-bg: #4A1E1A;

        --darkened-bg: #192D2B;
        --selected-bg: #213B38;
        --selected-row: #3A2E1C;

        --button-fg: #142423;
        --button-bg: #D49F59;
        --button-hover-bg: #E2B577;
        --default-button-fg: #142423;
        --default-button-bg: #CDC9BE;
        --default-button-hover-bg: #E6E3DC;
        --close-button-bg: #BDBBAE;
        --close-button-hover-bg: #CDC9BE;
        --delete-button-bg: #E07A6B;
        --delete-button-hover-bg: #EA9A8E;

        --object-tools-fg: #142423;
        --object-tools-bg: #D49F59;
        --object-tools-hover-bg: #E2B577;

        color-scheme: dark;
    }
}

html[data-theme="dark"] {
    --primary: #192D2B;
    --secondary: #192D2B;
    --accent: #D49F59;
    --primary-fg: #CDC9BE;

    --body-fg: #CDC9BE;
    --body-bg: #142423;
    --body-quiet-color: #BDBBAE;
    --body-medium-color: #CDC9BE;
    --body-loud-color: #F4F2EC;

    --header-color: #CDC9BE;
    --header-branding-color: #D49F59;
    --header-bg: #0C1716;
    --header-link-color: #CDC9BE;

    --breadcrumbs-fg: #CDC9BE;
    --breadcrumbs-link-fg: #D49F59;
    --breadcrumbs-bg: #192D2B;

    --link-fg: #D49F59;
    --link-hover-color: #E8C08A;
    --link-selected-fg: #E8C08A;

    --hairline-color: #22403C;
    --border-color: #2F4B47;

    --error-fg: #F08A7E;

    --message-success-bg: #1F3A2A;
    --message-warning-bg: #3A2E1C;
    --message-error-bg: #4A1E1A;

    --darkened-bg: #192D2B;
    --selected-bg: #213B38;
    --selected-row: #3A2E1C;

    --button-fg: #142423;
    --button-bg: #D49F59;
    --button-hover-bg: #E2B577;
    --default-button-fg: #142423;
    --default-button-bg: #CDC9BE;
    --default-button-hover-bg: #E6E3DC;
    --close-button-bg: #BDBBAE;
    --close-button-hover-bg: #CDC9BE;
    --delete-button-bg: #E07A6B;
    --delete-button-hover-bg: #EA9A8E;

    --object-tools-fg: #142423;
    --object-tools-bg: #D49F59;
    --object-tools-hover-bg: #E2B577;

    color-scheme: dark;
}

/* The admin gives a default button the same text colour as every other button. */
.button.default,
input[type="submit"].default,
.submit-row input.default {
    color: var(--default-button-fg);
}

/* Object tools: the admin pairs them with its close-button colours, not these. */
.object-tools a:link,
.object-tools a:visited {
    background: var(--object-tools-bg);
    color: var(--object-tools-fg);
}

.object-tools a:focus,
.object-tools a:hover {
    background: var(--object-tools-hover-bg);
}

/* A deliverable's open tasks, on the deliverable list. */
.open-tasks {
    margin: 0;
    padding-inline-start: 1.1em;
}

.open-tasks li {
    list-style: disc;
    padding: 0;
}

/* The questions for Husam, at the top of their pages (SPEC §4.7). */
.page-questions {
    display: grid;
    gap: 12px;
    margin: 0 0 20px;
}

.page-question {
    background: var(--darkened-bg);
    border-inline-start: 4px solid var(--accent);
    color: var(--body-fg);
    padding: 12px 16px;
}

.page-question.answered {
    border-inline-start-color: var(--border-color);
}

.page-question p {
    margin: 0 0 6px;
    padding: 0;
}

.page-question-label {
    color: var(--body-quiet-color);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.page-question-text {
    font-size: 1rem;
    font-weight: 600;
}

.page-question details > summary {
    color: var(--link-fg);
    cursor: pointer;
    margin: 4px 0;
}

.page-question form {
    display: grid;
    gap: 10px;
    margin-top: 8px;
}

.page-question-field-label {
    font-weight: 600;
    margin-bottom: 4px;
}

.page-question ul {
    margin: 0;
    padding: 0;
}

.page-question ul li {
    list-style: none;
    padding: 2px 0;
}

.page-question input[type="submit"] {
    justify-self: start;
}

.open-questions {
    background: var(--darkened-bg);
    border-inline-start: 4px solid var(--accent);
    margin: 0 0 20px;
    padding: 12px 16px;
}
