/*
 * The COAC theme on top of Bootstrap 5: black and white, the corporate
 * typefaces ("mn" for text, "gc" for headings) and square corners, like the
 * previous application and the logo. Only CSS variables and a few rules: no
 * Sass, so AssetMapper serves it as it is.
 */

:root {
    --coac-black: #000;
    --coac-grey-dark: #48484b;
    --coac-grey: #666;
    --coac-grey-mid: #999;
    --coac-grey-light: #ccc;
    --coac-grey-lighter: #eee;

    --coac-font-text: 'mn', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --coac-font-heading: 'gc', 'Helvetica Neue', Helvetica, Arial, sans-serif;

    --bs-body-font-family: var(--coac-font-text);
    --bs-body-color: var(--coac-black);
    --bs-body-bg: #fff;
    --bs-secondary-color: var(--coac-grey);
    --bs-border-color: var(--coac-grey-light);
    --bs-primary: var(--coac-black);
    --bs-primary-rgb: 0, 0, 0;
    --bs-link-color: var(--coac-black);
    --bs-link-color-rgb: 0, 0, 0;
    --bs-link-hover-color: var(--coac-grey-dark);
    --bs-link-hover-color-rgb: 72, 72, 75;
    --bs-border-radius: 0.125rem;
    --bs-border-radius-sm: 0.125rem;
    --bs-border-radius-lg: 0.25rem;
    --bs-focus-ring-color: rgba(0, 0, 0, 0.35);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--coac-font-heading);
    font-weight: 400;
}

a {
    text-underline-offset: 0.15em;
}

:focus-visible {
    outline: 2px solid var(--coac-black);
    outline-offset: 2px;
}

/* -- Primary buttons are black, as on the COAC website ------------------- */

.btn-primary,
.btn-dark {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--coac-black);
    --bs-btn-border-color: var(--coac-black);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--coac-grey-dark);
    --bs-btn-hover-border-color: var(--coac-grey-dark);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--coac-grey-dark);
    --bs-btn-active-border-color: var(--coac-grey-dark);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--coac-grey-mid);
    --bs-btn-disabled-border-color: var(--coac-grey-mid);
    --bs-btn-focus-shadow-rgb: 0, 0, 0;
}

/* -- Form controls in black, not in Bootstrap's blue ---------------------- */

.form-check-input:checked {
    background-color: var(--coac-black);
    border-color: var(--coac-black);
}

.form-check-input:focus,
.form-control:focus,
.form-select:focus {
    border-color: var(--coac-grey-dark);
    box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.2);
}

/* -- Header, menu and footer --------------------------------------------- */

.site-header {
    border-bottom: 2px solid var(--coac-black);
}

.site-header .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--coac-font-heading);
    font-size: 1.5rem;
    line-height: 1;
}

.site-header .navbar-brand img {
    height: 2.5rem;
    width: auto;
}

.site-header .navbar-brand .app-name {
    padding-left: 0.75rem;
    border-left: 1px solid var(--coac-black);
}

@media (max-width: 575.98px) {
    .site-header .navbar-brand {
        gap: 0.5rem;
        font-size: 1.125rem;
    }

    .site-header .navbar-brand img {
        height: 2rem;
    }

    .site-header .navbar-brand .app-name {
        padding-left: 0.5rem;
    }
}

.area-nav {
    background-color: var(--coac-black);
}

.area-nav .nav-link {
    color: #fff;
}

.area-nav .nav-link:hover,
.area-nav .nav-link:focus-visible {
    color: var(--coac-grey-light);
}

.area-nav .nav-link[aria-current="page"] {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 0.35em;
}

.area-nav :focus-visible {
    outline-color: #fff;
}

.site-footer {
    border-top: 1px solid var(--coac-grey-light);
    color: var(--coac-grey-dark);
    font-size: 0.8125rem;
}

.site-footer .data-protection dt {
    font-weight: 700;
}

.site-footer .data-protection dd {
    margin-bottom: 0.5rem;
}

/* -- Administration ------------------------------------------------------- */

.back-link {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.back-link a {
    color: var(--coac-grey-dark);
}

/* Forms keep a readable width; the lists of checkboxes flow in columns. */
.admin-form {
    max-width: 48rem;
}

.checkbox-columns {
    columns: 16rem;
    column-gap: 2rem;
}

.checkbox-columns .form-check {
    break-inside: avoid;
}

fieldset.card > legend.card-header {
    float: none;
    width: 100%;
    font-family: var(--coac-font-heading);
}

.admin-section {
    color: var(--coac-black);
    border-color: var(--coac-grey-light);
    transition: border-color 0.15s ease-in-out;
}

.admin-section:hover,
.admin-section:focus-visible {
    border-color: var(--coac-black);
}

/* A table cell: laid out inline, since a flex cell breaks the row. */
.actions {
    text-align: end;
    white-space: nowrap;
}

.actions > a,
.actions > form {
    display: inline-block;
    margin: 0;
    vertical-align: middle;
}

.actions > * + * {
    margin-left: 0.5rem;
}

/* Rows that unfold: the arrow turns with aria-expanded (disclosure_controller). */
.expert-list-row,
.branch-row {
    cursor: pointer;
}

.disclosure-toggle {
    border: 0;
    background: none;
    padding: 0;
    color: inherit;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.disclosure-toggle::before {
    content: '';
    display: inline-block;
    width: 0.45em;
    height: 0.45em;
    margin: 0 0.6em 0.15em 0.1em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease-in-out;
}

.disclosure-toggle[aria-expanded="true"]::before {
    transform: rotate(45deg);
}

@media (prefers-reduced-motion: reduce) {
    .disclosure-toggle::before,
    .admin-section {
        transition: none;
    }
}

.expert-list-details > td,
.branch-regions > td {
    background-color: #f7f7f7;
}

.list-filter {
    border-top: 1px solid var(--bs-border-color);
    padding-top: .75rem;
}

.enrolment-search .search-actions {
    border-top: 1px solid var(--bs-border-color);
    padding-top: .75rem;
}

.list-filter-panel {
    margin-top: .75rem;
    columns: 22rem;
    column-gap: 2rem;
}

.list-filter-panel > .form-text {
    column-span: all;
}

.list-filter-group,
.list-filter-options {
    break-inside: avoid;
    margin-bottom: .75rem;
}

.list-filter-group > legend {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: .25rem;
}

.enrolment-export {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1rem;
}

.enrolment-export .form-text {
    margin-top: 0;
}

.list-filter-group .list-filter-options {
    margin-left: 1.5rem;
}

@media (min-width: 992px) {
    .architect-search .search-actions {
        margin-top: 2rem;
    }
}

.region-list {
    columns: 14rem;
}

/* -- Private area and message pages -------------------------------------- */

.convocation-card {
    border-color: var(--coac-black);
    border-width: 2px;
}

.section-card {
    color: var(--coac-black);
    border-color: var(--coac-grey-light);
    transition: border-color 0.15s ease-in-out;
}

a.section-card:hover,
a.section-card:focus-visible {
    border-color: var(--coac-black);
}

.section-card.is-disabled {
    background-color: #f7f7f7;
    color: var(--coac-grey);
}

.message-page {
    max-width: 40rem;
    margin-top: 2rem;
}

@media (prefers-reduced-motion: reduce) {
    .section-card {
        transition: none;
    }
}

/* -- Enrolment form ------------------------------------------------------- */

/* The guide of steps: a numbered line, the current one in black. */
.enrolment-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.enrolment-steps li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--coac-grey);
    counter-increment: step;
}

.enrolment-steps li::before {
    content: counter(step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 0.875rem;
}

.enrolment-steps li[aria-current="step"] {
    color: var(--coac-black);
    font-weight: 700;
}

.enrolment-steps li[aria-current="step"]::before {
    background-color: var(--coac-black);
    border-color: var(--coac-black);
    color: #fff;
}

/* Checkboxes wrapped in their label. */
.choices .form-check {
    margin-bottom: 0.375rem;
}

@media (min-width: 768px) {
    .choice-columns {
        columns: 2;
        column-gap: 2rem;
    }

    .choice-columns > li {
        break-inside: avoid;
    }
}

.list-group-title {
    margin: 1rem 0 0.5rem;
    font-family: var(--coac-font-heading);
    font-size: 1.1rem;
}

.choices.grouped {
    padding-left: 1rem;
    border-left: 2px solid var(--coac-grey-light);
}

/* A choice another one implies: checked and kept, so it looks settled. */
.form-check-input[data-locked="true"],
.form-check-input:disabled {
    opacity: 0.6;
}

.form-check:has(.form-check-input[data-locked="true"]) {
    color: var(--coac-grey-dark);
}

.list-section > .card-header {
    padding: 0;
    background-color: #fff;
}

.list-section > .card-header > .disclosure-toggle {
    padding: 0.75rem 1rem;
}

/* The card of each chosen expertise: its name on the left, whether it has any text on the right. */
.expertise-background-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    text-align: left;
}

.expertise-background-toggle > .background-state {
    margin-left: auto;
    font-weight: 400;
}

.background-state[data-background-state="filled"] {
    background-color: var(--coac-black);
    color: #fff;
}

.background-state[data-background-state="empty"] {
    border: 1px solid var(--coac-grey-dark);
    background-color: #fff;
    color: var(--coac-grey-dark);
}

.background-counter {
    margin-top: -0.75rem;
}

.catalogue-text > :last-child {
    margin-bottom: 0;
}

.catalogue-text + * {
    margin-top: 1rem;
}

/* Legal wording: smaller, in a box of its own. */
/* The commitments of being on the lists, each one ticked. */
.commitments {
    padding-left: 0;
    list-style: none;
}

.commitments li {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.commitments li::before {
    content: "✔";
    flex-shrink: 0;
}

/* A text the architect wrote, with its line breaks. */
.pre-line {
    white-space: pre-line;
}

.legal-text {
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--coac-grey-dark);
    background-color: #f7f7f7;
    color: var(--coac-grey-dark);
    font-size: 0.875rem;
}

.free-justice-group {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--coac-grey-light);
    border-radius: var(--bs-border-radius);
}

.free-justice-group + .free-justice-group {
    margin-top: 0.5rem;
}

.free-justice-group .form-check {
    margin-bottom: 0.25rem;
}

/* -- Voluntary declaration ------------------------------------------------ */

.course-details {
    background-color: #f7f7f7;
}

.quantity-input {
    max-width: 10rem;
}

@media (min-width: 768px) {
    .knowledge-options {
        columns: 2;
        column-gap: 2rem;
    }

    .knowledge-options .form-check {
        break-inside: avoid;
    }
}

/* -- Lists of checkboxes -------------------------------------------------- */

.choices {
    list-style: none;
    padding-left: 0;
}

/* -- Print: the content only, without the navigation nor the actions ------ */

@media print {
    .site-header .user-menu,
    .area-nav,
    .site-footer,
    .visually-hidden-focusable,
    .btn,
    .back-link,
    .actions,
    .enrolment-actions,
    .enrolment-export {
        display: none !important;
    }

    .site-header {
        border-bottom-width: 1px;
    }

    main {
        padding-top: 1rem !important;
    }

    .card {
        break-inside: avoid;
        border-color: var(--coac-grey-mid);
    }

    a {
        color: inherit;
        text-decoration: none;
    }
}

/* The editor of the mail to the enrolled of a convocation. */
.mail-editor {
    min-height: 16rem;
    background: var(--bs-body-bg);
}

/*
 * A mail carries no files: mail_editor_controller.js refuses them too. As
 * specific as this because the stylesheet of Trix loads later, with the editor,
 * and would otherwise show the group again.
 */
trix-toolbar .trix-button-row .trix-button-group.trix-button-group--file-tools {
    display: none;
}
