:root {
    --vh: 1vh;

    --primary-color: hsl(261, 43%, 23%);
    --primary-color-hover: hsl(261, 43%, 33%);
    --success-color: hsl(261, 43%, 23%);
    --info-color: hsl(207, 61%, 53%);
    --warning-color: hsl(44, 62%, 48%);
    --danger-color: hsl(348, 86%, 61%);

    --purple-color: hsl(267, 100%, 69%);

    --bg-primary-color: var(--primary-color);
    --bg-primary-color-hover:  var(--primary-color-hover);
    --text-on-bg-primary-color: rgb(255,255,255);
    --bg-success-color: var(--primary-color);
    --bg-success-color-hover: var(--primary-color-hover);
    --text-on-bg-success-color: rgb(255,255,255);
    --bg-info-color: hsl(207, 61%, 53%);
    --text-on-bg-info-color: rgb(255,255,255);
    --bg-warning-color: hsl(44, 100%, 77%);
    --text-on-bg-warning-color: rgba(0,0,0,.7);
    --bg-danger-color: hsl(348, 86%, 61%);
    --text-on-bg-danger-color: rgb(255,255,255);

    --help-text-size: 0.85rem;
    --help-text-color: #7a7a7a;

    --disabled-text-color: #b5b5b5;

    --button-border-radius: 20px;

    /* https://easings.net/fr */
    --easing-ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --easing-ease-in-back: cubic-bezier(0.36, 0, 0.66, -0.56);
    --easing-ease-in-out-quart: cubic-bezier(0.76, 0, 0.24, 1);
}

.has-text-primary {
    color: var(--primary-color) !important;
}

.hero.is-primary {
    background-color: var(--bg-primary-color);
}
.button.is-primary {
    background-color: var(--bg-primary-color);
}
.button.is-success {
    background-color: var(--bg-success-color);
}
.button.is-primary:hover, .button.is-primary:active {
    background-color: var(--bg-primary-color-hover);
}
.button.is-success:hover, .button.is-success:active {
    background-color: var(--bg-success-color-hover);
}
form .button:not(.is-link):not(.is-ghost)[disabled],
.button[form]:not(.is-link):not(.is-ghost)[disabled] {
    background: #363636 !important;
    border-color: #363636 !important;
}

.button.is-unstyled, button.is-unstyled {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
    font-weight: 300;
    --page-background-color: #f6f6f6;
    background: var(--page-background-color);
}

.d-none {
    display: none !important;
}

.w-100 {
    width: 100% !important;
}

.is-gap-0 {
    gap: 0 !important;
}
.is-gap-1 { gap: 0.25em !important; }
.is-gap-2 { gap: 0.5em !important; }
.is-gap-3 { gap: .75em !important; }
.is-gap-4 { gap: 1em !important; }
.is-gap-5 { gap: 1.5em !important; }
.is-gap-6 { gap: 2em !important; }
.is-row-gap-1 { row-gap: 0.25em !important; }
.is-row-gap-2 { row-gap: 0.5em !important; }
.is-row-gap-3 { row-gap: .75em !important; }
.is-row-gap-4 { row-gap: 1em !important; }
.is-row-gap-5 { row-gap: 1.5em !important; }
.is-row-gap-6 { row-gap: 2em !important; }
.is-column-gap-1 { column-gap: 0.25em !important; }
.is-column-gap-2 { column-gap: 0.5em !important; }
.is-column-gap-3 { column-gap: .75em !important; }
.is-column-gap-4 { column-gap: 1em !important; }
.is-column-gap-5 { column-gap: 1.5em !important; }
.is-column-gap-6 { column-gap: 2em !important; }


.is-divider-vertical[data-content]::after, .is-divider[data-content]::after {
    background-color: var(--page-background-color);
}

.has-text-warning {
    color: var(--warning-color) !important;
}
.has-text-purple {
    color: var(--purple-color) !important;
}

.button.is-rounded {
    border-radius: var(--button-border-radius);
}
.button.is-rounded.is-icon {
    padding: 0 !important;
    width: 2.5em;
    aspect-ratio: 1;
}
span.button, div.button, .no-cursor {
    cursor: unset;
}
.icon.is-small {
    font-size: .75em;
}

.modal-card, .modal-content {
    margin: 0;
}

dialog .modal-background {
    position: fixed;
    background: transparent;
    inset: 0;
}

.button-reset {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.control > .select, .control > .select > select {
    width: 100%;
}

main {
    height: 100%;
    display: flex;
    flex-direction: column;
}
main > header {
    display: flex;
    flex-direction: row;
    column-gap: 2em;
    row-gap: 0.5em;
    align-items: center;
    justify-content: space-between;
    padding: 0.5em 1em;
    background-color: #fff;
    border-bottom: solid 1px #ccc;
    position: relative;
}
#notifications {
    position: fixed;
    left: 65px;
    right: 1em;
    top: calc(100 * var(--vh));
    top: 100dvh;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-end;
    max-width: calc(100vw - 2em);
    transform: translateY(-100%);
    pointer-events: none;
}
#notifications > .notification {
    margin-bottom: 1em;
    opacity: 0.9;
    border-radius: var(--button-border-radius);
    pointer-events: auto;
}
main > header .buttons {
    margin: 0 !important;
}
main > header .button {
    white-space: nowrap;
    margin: 0 !important;
}
#header-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0.5em;
    color: #363636;
    font-weight: bold;
    font-size: larger;
}
#header-brand img {
    max-height: 2em;
}
#header-brand > span {
    display: flex;
    flex-direction: column;
}
#header-brand > span > span:last-child {
    /*color: #ff2854;*/
    font-weight: normal;
}

#header-right {
    display: flex;
    flex-direction: row;
    gap: 0.5em;
    align-items: center;
    /*height: 100%;*/
}

main > header #user-links {
    display: flex;
    gap: 0.5em;
    align-items: center;
}
main h2 {
    margin: 0;
}
main > header > div:last-child p:last-child {
    margin-bottom: 0;
}

#header-center {
    display: flex;
    flex-direction: row;
    gap: 2em;
    justify-content: center;
    align-items: center;
    min-width: 0; /* trick to have truncated text */
}

@media screen and (max-width: 900px) {
    main > header {
        column-gap: 5px;
        padding: 5px;
    }
    #header-brand {
        order: 1;
    }
    #header-right {
        order: 2;
    }
    #header-center {
        order: 3;
        width: 100%;
    }
    main > header {
        flex-wrap: wrap;
    }
}
@media screen and (max-width: 600px) {
    .modal-card-foot {
        padding: 10px;
    }
    .modal-card-head {
        padding-block: 10px;
    }
    main > header {
        column-gap: 1em;
    }

    main > header .button {
        font-size: 0.75rem !important;
    }

    main > header .button.is-small {
        font-size: 0.66rem !important;
    }

    #header-brand span.is-size-6 {
        font-size: 0.75em !important;
    }

    #header-center {
        gap: 1em;
    }
}
@media screen and (max-width: 500px) {
    body[data-authenticated="false"].with-credits-buttons #header-right {
        flex-direction: column-reverse;
        align-items: stretch;
    }
    body.with-credits-buttons #top-sign-in {
        display: none;
    }
}
@media screen and (min-width: 320px) and (max-width: 600px) {
    #header-right #credits, #header-right #credits + .icon {
        font-size: 1.2em;
    }
}
@media screen and (max-width: 374px) {
    #top-sign-in {
        display: none;
    }
}

body[data-has-first-map="false"] .if-has-first-map {
    display: none !important;
}

main > section {
    margin: 1em;
}

form .field .help {
    font-size: var(--help-text-size);
}
form .field .help:not(.is-danger) {
    color: var(--help-text-color);
}

dialog {
    border: none;
    background: transparent;
    padding: 0;
    display: block !important;
}
dialog:not([open]) {
    display: none !important;
}
dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}
dialog > form {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}
dialog .modal-card-foot {
    justify-content: flex-end;
}
dialog .modal-card-foot.with-left-button {
    justify-content: space-between;
}
button.cancel {
    border: none;
    background: transparent;
}
button {
    cursor: pointer;
}

.buttons-switch { /* button is-rounded is-white is-active buttons-switch */
    padding: .25em !important;
    border: none;
    align-items: stretch;
}
.buttons-switch > .button {
    height: auto;
}
.buttons-switch > .prefix {
    padding-inline: 1em .5em !important;
    font-size: 1em;
}
.buttons-switch > span.button:not(.prefix) {
    padding: 1em !important;
}
.buttons-switch > .button:not(.prefix) > .icon + span {
    font-size: 1.333em;
}
.buttons-switch > button, .buttons-switch > a {
    padding: 1em !important;
    border: solid transparent 1px !important;
    transition: color 0.2s ease-in-out;
}
.buttons-switch > button:not(:hover):not(.is-info), .buttons-switch > a:not(:hover):not(.is-info) {
    color: #7a7a7a !important;
}

form .message-header {
    display: none;
}

label:has(input[type="checkbox"][disabled]) {
    color: var(--disabled-text-color);
}

#credits-dialog .modal-card-body > div > p:not(:last-child) {
    margin-bottom: 0.5em;
}

#credits-dialog .modal-card-body {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.modal-card-body .notification p:first-child {
    margin-top: 0;
}
.modal-card-body .notification p:last-child {
    margin-bottom: 0;
}
.modal-card-body .notification p {
    margin-block: 0.75em;
}

#map-edit-dialog.create-dialog div.field.styling .control {
    display: flex;
    gap: 0;
}
#map-edit-dialog.create-dialog div.field.styling label {
    display: inline-grid;
    grid-template-areas: "area";
    justify-items: center;
    align-items: center;
}
#map-edit-dialog.create-dialog div.field.styling input {
    grid-area: area;
    width: 16px;
    height: 16px;
}
#map-edit-dialog.create-dialog div.field.styling img {
    grid-area: area;
    width: 110px;
    border-radius: 4px;
    border: solid 5px transparent;
}
#map-edit-dialog.create-dialog div.field.styling input:checked + img {
    border: solid 5px var(--primary-color);
}
#map-edit-dialog.create-dialog div.field.styling input:focus-visible + img {
    outline: solid 2px var(--info-color);
    outline-offset: 2px;
}
#map-edit-dialog > .modal-card > section:last-of-type {
    padding-bottom: 50px;
}
#map-edit-dialog > .modal-card > footer:after {
    content: "";
    background: inherit;
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}
#map-edit-dialog > .modal-card > footer > * {
    z-index: 2;
}
#map-edit-dialog .map-form-cost-message {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    translate: 0 0px;
    z-index: 0 !important;
    transition: translate 0.3s ease-in-out, opacity 0.3s ease-in-out;
    opacity: 1;
    padding: 4px 20px;
}
#map-edit-dialog .map-form-cost-message.hidden,
#map-edit-dialog[data-total-cost="0"] #map-form-total-cost-container,
body[data-has-first-map=false]  #map-form-total-cost-container {
    translate: 0 100%;
    opacity: 0;
}

#map-form-not-enough-credits-error {
    background: #f14668 !important;
}

#map-edit-dialog.regenerate-map-checked .if-not-regenerate-map-checked,
#map-edit-dialog:not(.regenerate-map-checked) .if-regenerate-map-checked {
    display: none;
}

#map-edit-dialog #regenerate-message {
    display: block !important;
    position: absolute;
    z-index: 2;
    margin-inline: 10px;
    margin-top: -10px;
    left: 0;
    box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.5);
    transform: translateY(-500px);
    transition: transform 0.3s ease-in;
}
#map-edit-dialog[open].regenerate-map-checked #regenerate-message:not(.hidden) {
    display: block !important;
    transform: translateY(0);
    animation: regenerate-message-bounce .3s linear;
    transition: none;
}

@keyframes regenerate-message-bounce {
    0% { transform:translateY(-200px); }
    60% { transform:translateY(0%); }
    70% { transform:translateY(-15%); }
    80% { transform:translateY(0%); }
    85% { transform:translateY(-7%); }
    90% { transform:translateY(0%); }
    95% { transform:translateY(-3%); }
    100% { transform:translateY(0); }
}


#field__urls_to_fetch > label {
    margin-bottom: 0;
}
#field__urls_to_fetch .help {
    margin-bottom: .5em;
}
#field__urls_to_fetch textarea {
    display: none;
}
#field__urls_to_fetch .control {
    border-left: solid #dbdbdb 1px;
    border-radius: 4px;
}
#field__urls_to_fetch .control > div {
    display: flex;
    align-items: flex-start;
}
#field__urls_to_fetch .radio {
    margin-top: .2em;
    margin-left: .5em;
    margin-right: 1em;
    display: flex;
    max-width: calc(100% - 3em);
    gap: 0.3em;
    align-items: center;
}
#field__urls_to_fetch span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#field__urls_to_fetch .radio:after {
    color: var(--help-text-color);
    font-size: var(--help-text-size);
    margin-left: 0.3em;
    white-space: nowrap;
}

#map-edit-dialog #field__urls_to_fetch .radio[data-limit-error]:after {
    content: "(" attr(data-limit-error) ")" !important;
    color: var(--danger-color) !important;
}

details > summary {
    cursor: pointer;
}

.dropdown .dropdown-menu:focus-within {
  display:block
}
.button.dropdown-item {
    border: none;
    border-radius: 0;
}

.copy-chain-other-authors button {
    color: inherit;
}

.copy-chain-other-authors i {
    translate: 2px 0;
}
.copy-chain-other-authors .dropdown-menu {
    min-width: 5em;
    padding-bottom: 6px !important;
    left: auto;
    right: -12px;
}
.copy-chain-other-authors .dropdown-content {
    background-color: var(--dropdown-background);
    max-height: 21.5em;
    overflow: auto;
}

.copy-chain-other-authors .dropdown-item {
    font-size: 0.825rem;
    line-height: inherit;
    padding: .2rem 1rem;
    color: inherit;
}
.copy-chain-other-authors .dropdown-item p {
    display: flex;
    gap: 1em;
}
.copy-chain-other-authors .dropdown-item p {

}
.modal-message {
    .message-body {
        p:not(:last-child) {
            margin-bottom: .7em;
        }
    }
    .modal-close {
        right: 6px;
        top: 6px;
        position: absolute;
    }
}

#copy-map-dialog.is-owner {
    .hide-if-owner {
        display: none;
    }
}
#copy-map-dialog:not(.is-owner) {
    .show-if-owner {
        display: none;
    }
}

.is-color-inherit {
    color: inherit;
}

.select-replaced:after {
    display: none !important;
}
.select-replaced .dropdown {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
.select-replaced .dropdown-trigger {
    display: flex;
    justify-content: stretch;
}
.select-replaced .dropdown-trigger .button {
    display: grid;
    justify-content: space-between;
    grid-template-columns: auto 1fr;
    gap: 1em;
    width: 100%;
    padding-inline: 0.75em;
}
.select-replaced .dropdown-trigger .button {
    text-decoration: none;
}
.select-replaced .dropdown-trigger .button > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}
.select-replaced .dropdown-trigger .button > span:last-child {
    justify-self: end;
}

.select-replaced .dropdown-content {
    border: solid 1px #dbdbdb;
    max-height: 17em;
    overflow-y: auto;
    box-shadow: 0 0 2em .125em rgba(10,10,10,.5);
    padding: 5px;
}
.select-replaced .dropdown-menu {
    right: 0;
}
.select-replaced .dropdown-item {
    white-space: unset;
    padding: .375em;
    font-size: 1em;
}
