@import "/static/efficient-ui/MASTER.css";

:root {
    --gap-navbar: 1rem;
    --width-navbar-button: 0;
    --text-soft: #000000C0;
    --text-softer: #0000009A;
    --text-faint: #00000066;
    --text-softest: #00000033;
    --color-star: #FFC107;
    --color-shape-label: #0097A7;                    --color-shape-label-text: #ffffff;
    --shadow-card-inset: inset 0 3px 6px -4px rgba(0, 0, 0, 0.12), inset 0 3px 6px 0 rgba(0, 0, 0, 0.24), inset 0 1px 4px 0 rgba(0, 0, 0, 0.12);
    --1-star: #FF8079;
    --2-star: #FF8A65;
    --3-star: #FFAC1B;
    --4-star: #FBC02D;
    --5-star: #CDDC39;
    view-transition-name: root;
    --reserved-height-top: 0;
    --color-checkerboard-dark: #CFD8DC;
    --color-checkerboard-light: #FFFFFF;
    --color-divider: var(--text-softest);
}

.ripple-pad {
    background: #ffffff99;
    position: absolute;
    opacity: 1;
    transform: scale(0);
    animation: RippleEffect 375ms cubic-bezier(0, 0.55, 0.45, 1) forwards;
}

.button-flat .ripple-pad {
    background: var(--color-primary-3);
}

@keyframes RippleEffect {
    to {
        transform: scale(1);
        opacity: 0;
    }
}

button, input, .button:not(.link-button), select, .navbar a, .navrail a {
    position: relative;
    overflow: hidden;
}

nav#desktop-navbar {
    view-transition-name: navbar;
}

nav#mobile-navbar {
    view-transition-name: navbar-mobile;
}

p {
    color: var(--text-soft);
}

iconify-icon {
    /* Material design icons are done in 24px, so we scale them to 1.5 as the default font size is 16px */
    display: inline-block;
    width: 1em;
    height: 1em;
    font-size: 1.5em;
}

#annotation-zone, .annotation-zone {
    position: relative;
    user-select: none;
    overflow: hidden;
    transform-origin: 50% 50%;
    background-image: conic-gradient(var(--color-checkerboard-dark) 90deg, var(--color-checkerboard-light) 0 180deg, var(--color-checkerboard-dark) 0 270deg, var(--color-checkerboard-light) 0 360deg);
    background-size: 1rem 1rem;
    background-position: 0 0;
}

#annotation-zoom-container > #annotation-zone {
    overflow: visible;
}

#annotation-image, .annotation-image {
    user-drag: none;
    -webkit-user-drag: none;
    image-rendering: pixelated;
}

:not(#annotation-zoom-container) > #annotation-zone > svg, .annotation-zone > svg {
    width: 100%;
    height: 100%;
}

#annotation-zone > svg, .annotation-zone > svg {
    z-index: 1;
    position: absolute;
    top: 0;
    left: 0;
}

.annotation-ruler {
    z-index: 2;
    position: absolute;
    top: 0;
    left: 0;
    background: var(--color-accent);
    display: none;
}

#annotation-ruler-horizontal, #annotation-ruler-horizontal-secondary {
    height: 1px;
    width: 100%;
}

#annotation-ruler-vertical, #annotation-ruler-vertical-secondary {
    width: 1px;
    height: 100%;
}

.shape {
    stroke: var(--color-accent);
    fill: var(--color-accent);
    fill-opacity: 0.1;
    stroke-width: 2px;
    --shape-stroke-width: 2px;
    vector-effect: non-scaling-stroke;
    pointer-events: auto;
    transition: filter 0.25s cubic-bezier(0.61, 1, 0.88, 1),
                fill-opacity 0.25s cubic-bezier(0.61, 1, 0.88, 1),
                stroke-width 0.25s cubic-bezier(0.61, 1, 0.88, 1);
    stroke-linecap: square;
    stroke-linejoin: miter;
}

.shape-polyline {
    fill: none;
}

.shape-point {
    stroke: var(--color-accent);
    stroke-width: 2px;
    --shape-radius: 2px;
    fill-opacity: 1;
    r: 0.001;
    vector-effect: non-scaling-stroke non-scaling-size;
    transition: r 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                stroke-width 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                filter 0.25s cubic-bezier(0.61, 1, 0.88, 1);
}

.shape.selected {
    fill-opacity: 0.2;
    stroke-width: 4px;
    --shape-stroke-width: 4px;
    filter: drop-shadow(0 0 2px var(--text-soft));
}

.shape-point.selected {
    fill-opacity: 1;
    r: 0.001;
    --shape-radius: 0.001;
    stroke-width: 6px;
}

.shape-container, .shape-container-viewonly {
    pointer-events: none;
}

.shape-container-viewonly > .shape, :is(.thumbnail-list > li, .thumbnail-card) .shape {
    fill: var(--color-info);
    stroke: var(--color-info);
    fill-opacity: 0;
    stroke-opacity: 0;
    transition: fill-opacity 0.25s cubic-bezier(0.61, 1, 0.88, 1),
                stroke-opacity 0.25s cubic-bezier(0.61, 1, 0.88, 1);
}

.shape-container-viewonly > .shape-polyline, :is(.thumbnail-list > li, .thumbnail-card) .shape-polyline {
    fill: none;
}

.shape-container-viewonly > .shape-point, :is(.thumbnail-list > li, .thumbnail-card) .shape-point {
    stroke: var(--color-info);
    transition: r 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                stroke-width 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                filter 0.25s cubic-bezier(0.61, 1, 0.88, 1);
}

.shape-label {
    position: absolute;
    font-weight: 500;
    color: var(--color-shape-label-text) !important;
    pointer-events: auto;
    height: 28px;
    padding-left: 8px;
    padding-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-shape-label);
    width: max-content;
    box-shadow: var(--shadow-button);
    /* top-left corner is square to point to the shape */
    border-radius: 0 16px 16px 16px;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.61, 1, 0.88, 1),
                transform 0.375s cubic-bezier(0.16, 1, 0.3, 1);
    transform: scale(0);
    transform-origin: top left;
    z-index: 3;
    text-decoration: none;
}

.shape-label:hover {
    text-decoration: underline;
}

/* Only show region parts when checkbox is checked */
#annotation-zone:has(+ x-buttonbox #show-objects:checked) > .shape-label {
    opacity: 1;
    transform: scale(1);
}

/* Hide points with a bubble */
#annotation-zone:has(+ x-buttonbox #show-objects:checked) > .shape-container-viewonly > .shape-point:has(+ foreignObject) {
    r: 0;
    border-width: 0;
}

#annotation-zone:has(+ x-buttonbox #show-shapes:checked) > .shape-container-viewonly > .shape {
    fill-opacity: 0.1;
    stroke-opacity: 1;
}

.thumbnail-list > li:is(:hover, :focus, :has(:focus)) .shape {
    fill-opacity: 0.2;
    stroke-opacity: 1;
}

@keyframes move-out {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.5);
        opacity: 0;
    }
}

@keyframes move-in {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slide-in {
    from {
        transform: translateX(-1.5rem);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-1.5rem);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .thumbnail-list > li:is(:hover, :focus, :has(:focus)) > a > .annotation-zone,
    html:not(:has(.thumbnail-list > li:is(:hover, :focus, :has(:focus)) > a > .annotation-zone)) #annotation-zone {
        view-transition-name: thumbnail;
    }
    ::view-transition-old(root),
    ::view-transition-new(root) {
        transform-origin: top;
        animation-duration: 0.5s;
        animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
    }

    ::view-transition-old(root) {
        animation-name: move-out;
    }

    ::view-transition-new(root) {
        animation-name: move-in;
    }

    ::view-transition-group(thumbnail) {
        animation-duration: 0.5s;
        animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
    }

    #annotation-zone::view-transition-old(thumbnail) {
        animation-duration: 0s;
    }

    ::view-transition-group(navbar), ::view-transition-group(navbar-mobile) {
        animation-duration: 0.5s;
        animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
    }
}

.multi-select, .single-select {
    display: flex;
    flex-flow: column nowrap;
    overflow-y: scroll;
    box-shadow: var(--shadow-card-inset);
    padding: 16px;
    gap: 8px;
}

.licence-selection, .image-type-selection {
    display: flex;
    flex-flow: column nowrap;
}

.licence-selection-info, .image-type-selection-info {
    margin-left: calc(var(--size-checkbox) + var(--gap-label-checkbox));
    /* Align with the checkbox above */
}

.licence-selection-info > p, .image-type-selection-info > p {
    font-weight: 300;
}

.licence-logo {
    width: 128px;
    float: right;
    margin-left: 1ch;
}

.licence-title, .image-type-title {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.licence-title > .licence-name, .image-type-title > .image-type-name {
    font: var(--h5-font);
    font-weight: 400;
}

.icon-explainer {
    display: grid;
    gap: 4px 8px;
    grid-template-columns: auto 1fr;
    align-items: center;
}

.icon-explainer *:nth-child(even) {
    font-weight: 300;
}

.required-asterisk::after {
    content: "*";
    color: var(--color-error);
}

small {
    /* BIG :D */
    font-size: 1em;
}

#pagination {
    display: flex;
    gap: 1em;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    font-weight: 600;
    flex: 1 0 auto;
}

#pagination > a {
    text-decoration: none;
    color: var(--color-accent-1);
}

#pagination-options > form {
    align-items: center;
    display: flex;
    gap: 1em;
}

#pagination-options {
    justify-content: center;
    align-items: center;
    gap: 1em;
    width: 100%;
}

.thumbnail-list {
    list-style: none;
    margin: 0 !important;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: 16px;
}

.thumbnail-list > li, .thumbnail-card {
    transition: box-shadow 0.25s cubic-bezier(0.61, 1, 0.88, 1);
    box-shadow: var(--shadow-card);
    background: var(--color-card);
}

:is(.thumbnail-list > li, .thumbnail-card) > a, :is(.thumbnail-list > li, .thumbnail-card) {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

:is(.thumbnail-list > li, .thumbnail-card) > .list-more {
    display: flex;
    flex-flow: row wrap;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
}

:is(.thumbnail-list > li, .thumbnail-card):is(:hover, :focus, :has(:focus)) {
    box-shadow: var(--shadow-card), 0 4px 32px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08);
}

:is(.thumbnail-list > li, .thumbnail-card) .annotation-zone {
    transition: transform 0.25s cubic-bezier(0.61, 1, 0.88, 1),
                box-shadow 0.25s cubic-bezier(0.61, 1, 0.88, 1);
}

:is(.thumbnail-list > li, .thumbnail-card):not(.thumbnail-card-no-zoom) .annotation-zone:hover {
    position: relative;
    transform: scale(2);
    z-index: 1;
    box-shadow: var(--shadow-textarea-active);
}

:is(.thumbnail-list > li, .thumbnail-card) .list-detail {
    padding: 8px;
    display: block;
}

a.button {
    text-decoration: none;
}

dt {
    font-weight: 600;
}

dd {
    margin-left: 40px;
}

#mobile-navbar, #mobile-navbar-spacer {
    display: none;
}

@media screen and (max-width: 896px) {
    #mobile-navbar {
        display: flex;
    }
    header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 3;
    }
    #mobile-navbar-spacer {
        display: block;
        height: var(--height-navbar);
    }
    #desktop-navbar {
        display: none;
    }
    :root {
        --reserved-height-top: var(--height-navbar);
    }
}

#hamburger > nav {
    display: flex;
    flex-direction: column;
    gap: 1em;
    padding: var(--padding-card);
    padding-top: var(--padding-card-top);
    box-shadow: var(--shadow-card);
    background: var(--color-card);
    justify-content: space-between;
    width: clamp(240px, calc(100vw - 56px), 448px);
}

#hamburger > nav > ul {
    display: flex;
    flex-direction: column;
    gap: 1em;
    margin: 0;
}

#hamburger > nav > ul > li {
    display: flex;
    gap: var(--gap-label-checkbox);
    align-items: center;
    margin: 0;
}

#hamburger > nav > ul > li > a {
    display: contents;
    text-decoration: none;
    color: var(--color-card-text);
}

.star-rating-container {
    display: flex;
    flex-direction: row-reverse;
    font-size: 1.25em;
    align-items: center;
    justify-content: flex-end;   /* In this case, it means LEFT, not right, because of the row-reverse */
}

.star-rating-container > input {
    width: 0 !important;
    height: 0 !important;
    visibility: hidden;
}

.star-rating-container > label {
    cursor: pointer;
    color: var(--text-softest);
    transition: color 0.25s cubic-bezier(0.37, 0, 0.63, 1),
                filter 0.25s cubic-bezier(0.37, 0, 0.63, 1);
}

.star-rating-container > label:hover,
.star-rating-container > label:hover ~ label {
    color: var(--color-star);
    filter: drop-shadow(0 0 3px #00000040);
}

.star-rating-container > input:checked ~ label {
    color: var(--color-star);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    box-sizing: content-box;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    border: 0;
}

.rating-list {
    display: grid;
    grid-auto-columns: 1fr;
    gap: 0.5rem;
    grid-template-columns: auto;
    list-style: none;
    margin: 0 !important;
    padding: 0;
    min-width: 50%;
}

.rating-list > li {
    grid-column-start: 1;
    height: 28px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rch;
    border-radius: 0 4px 4px 0;
    margin: 0;
}

@media screen and (max-width: 768px) {
    .rating-box {
        flex-direction: column;
    }
}

.rating-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rch;
    font-size: 1.25em;
    width: 100%;
}

.rating-bar > .rating-bar-segment {
    position: relative;
    width: 1em;
    height: 1em;
    clip-path: url(#star-clip);
    background: var(--text-softest);
}

.rating-bar > .rating-bar-segment > .rating-bar-filling {
    background: var(--color-star);
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#picture-view {
    display: flex;
    flex-direction: row;
    gap: 1em;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    margin: 0;
}

#picture-view > x-frame {
    flex: 0 1 var(--width);
    max-width: unset;
    margin: 0;
}

#picture-actions {
    --width: 256px;
    position: sticky;
    top: var(--reserved-height-top);
    overflow: auto;
    max-height: 100vh;
    height: 100%;
    background: var(--color-card);
    padding: 1rem 0;
    box-shadow: var(--shadow-card);
}

@media screen and (max-width: 768px) {
    #picture-view {
        flex-direction: column;
    }
    #picture-view > x-frame {
        flex: 1 1 auto;
        margin: 0;
    }
    #picture-actions {
        --width: 768px;
        position: static;
        padding: 1rem;
    }
    #picture-actions > ul {
        width: 100%;
        list-style: none;
        margin: 0;
        padding: 0;
    }
    #picture-actions > ul > li {
        display: inline;
    }
    .action-list > li {
        padding: 0 !important;
    }
    #picture-view > x-frame > hgroup, #annotation-view-controls, #picture-details {
        margin-left: 1rem;
        margin-right: 1rem;
    }
    .mobile-padding {
        padding-left: 1rem;
    }
}

#annotation-view-controls {
    display: flex;
    flex-flow: row wrap;
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

#picture-view > x-frame > hgroup {
    margin-bottom: 1rem;
}

.action-list {
    list-style: none;
    margin: 0 !important;
    padding: 0;
}

.action-list > li {
    display: flex;
    margin: 0;
    width: 100%;
    padding: 0.25rem 1rem;
}

.action-list > li > a {
    text-decoration: none;
    color: var(--color-card-text) !important;
    display: flex;
    align-items: center;
    gap: 0.5rch;
    font-weight: 400;
}

.action-list > li > details > summary {
    color: var(--color-card-text) !important;
    display: flex;
    align-items: center;
    gap: 0.5rch;
    font-weight: 400;
}

#picture-buttons {
    padding: 0 1rem;
}

@media print {
    #picture-actions, #annotation-view-controls {
        display: none;
    }
    .navbar {
        display: none;
    }
    :root {
        --color-background: #ffffff;
    }
    #annotation-zone, .thumbnail-list {
        width: 100vw;
        height: auto;
        position: relative;
        left: calc(-1 * (50vw - 50%));
    }
}

.navbar > ul {
    max-width: 100%;
}

#desktop-navbar > ul:first-child {  /* list containing title */
    flex: 0 1 auto;
    min-width: 0;
}

#desktop-navbar > ul:last-child {  /* list containing navigation */
    flex: 1 0 auto;
    justify-content: end;
}

#mobile-navbar-title, #desktop-navbar-title {
    font: var(--h5-font);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 0 1 auto;
    min-width: 0;
}

nav .button-flat {
    --color-flat-button-hover: transparent;
    --color-flat-button-active: transparent;
}

nav .button-flat .ripple-pad {
    background: #ffffff99;
}

.warning {
    background: var(--color-alert);
    color: var(--color-alert-text);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    --color-link-text: #000000;
    --color-link-hover-text: #000000;
    --color-link-visited-text: #000000;
    --color-link-visited-hover-text: #000000;
    --color-link-active-text: #000000;
}

.warning h2 {
    font: var(--h3-font);
}

#annotation-zone {
    box-shadow: var(--shadow-card);
}

#hamburger-site-name {
    font: var(--h4-font);
    text-transform: uppercase;
    color: var(--color-accent);
}

#object-types {
    z-index: 3;
    background: var(--color-callout);
    color: var(--color-callout-text);
    --color-background-text: var(--color-callout-text);
    --color-label-text: var(--color-callout-text);
    box-shadow: var(--shadow-card);
    border-radius: var(--radius-input);
    position: absolute;
    display: none;
    overflow: auto;
}

#object-types-content {
    padding: 1rem;
}

#annotation-controls {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem;
    align-items: stretch;
}

#annotation-controls > x-buttonbox {
    align-items: center;
}

#annotation-controls > x-buttonbox button:has(iconify-icon) {
    aspect-ratio: 1;
}

#annotation-controls > x-buttonbox button > iconify-icon {
    font-size: 1.5rem;
}

#annotation-helper-message {
    padding: 0.75rem;
    text-align: center;
    flex: 0 0 auto;
}

#annotation-zoom-container {
    flex: 1 1 auto;
    overflow: hidden;
    align-self: stretch;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
}

#annotation-zoom-container > #annotation-zone {
    transform: scale(1);
    transition: transform 0.125s cubic-bezier(0.28, 0.5, 0.31, 0.92);
    max-width: 100%;
    max-height: 100% !important;
    box-shadow: none;
}

#annotation-zoom-container > #annotation-zone > #annotation-image {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

#annotation-main-area {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow: auto;
    width: 100%;
}

body.fixed-content-area {
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.fixed-content-area > main {
    flex: 1 1 auto;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

#annotation-zoom-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

#zoom-indicator {
    width: 7ch;
    text-align: right;
}

#annotation-zoom-container {
    cursor: grab;
}

#object-types {
    cursor: auto;
}

.thumbnail-list-scroll {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: stretch;
    padding: 16px;
}

.thumbnail-list-scroll > li {
    flex: 0 0 192px;
    max-width: 192px;
}

#picture-actions {
    flex-shrink: 0;
}

.thumbnail-list-scroll > li > a .annotation-zone:hover {
    transform: none;
}

summary {
    cursor: pointer;
}

button, .button, input, select, textarea {
    box-sizing: border-box;
}

.button-danger {
    --color-button: var(--color-error);
    --color-button-hover: var(--color-error);
    --color-button-active: var(--color-error);
}

input[type="file"] {
    padding: 0.5rem;
    display: flex;
    font-style: italic;
}

.thumbnail-card-small > a > .annotation-zone {
    flex: 0 0 auto;
    max-width: 384px;
}

.thumbnail-card-small, .thumbnail-card-small > a {
    align-items: center;
}

.thumbnail-card-small {
    margin: auto;
}

hr {
    border: 0.25px solid var(--color-divider);
    width: 100%;
}

body {
    display: flex;
    flex-direction: column;
}
