
/* =============================== */
/* base */
:root {
    --c_bg: #ffffff;
    --c_body_text: #303030;
    --c_tre: #c80000;
    --c_fink_1: #15284F;
    --c_fink_2: #3C8DFF;
    --c_fink_3: #D5D5D3;
    --c_fink_4: #F5622E;
    --s_ui: 1.0;    /* base scale for some fontsizes */
    --s_input: 1.0; /* base scale for input elements */
}

html, body {
    height: 100%;
    width: 100%;
    background-color: var(--c_bg);
    color: var(--c_body_text);
    overflow-x: hidden;
    overflow-y: scroll;
}

p {
    width: max-content;
}


:is(h1,h2,h3) {
    margin-bottom: 0.2em;
    margin-top: 0.2em;
    width: max-content;
    max-width: 90%;
}

a {
    color: var(--c_fink_1);
    text-decoration: none;
}
a:hover {
    color: color-mix(in srgb, var(--c_fink_1) 70%, var(--c_body_text) 30%);
    text-decoration: underline;
}
a:visited {
    color: color-mix(in srgb, var(--c_fink_1) 70%, var(--c_bg) 30%);
}

button {
    font-weight: bold;
    border-radius: 4px;
    height: max-content;
    width: max-content;
    cursor: pointer;
}
.io {
    margin-top: 15px;
    font-size: 1.2rem;
    background-color: var(--c_tre);
    outline: 2px var(--c_body_text) solid;
    color: #ffffff;
    padding: 2px;
    border-radius: 7px;
    box-shadow: 5px 5px 15px color-mix(in srgb, var(--c_fink_1) 60%, var(--c_bg) 40%);
    margin-bottom: 20px;
}
.io > * {
    font-size: inherit;
}
button.io:hover {
    cursor: pointer;
    background-color: color-mix(in srgb, var(--c_fink_1) 70%, var(--c_fink_3) 30%);
}
button.close {
    position: absolute;
    top: 5px;
    right: 5px;
    display: inline-block;
    background-color: var(--c_body_text);
    color: var(--c_tre);
    width: 1.5rem;
    height: 1.5rem;
    line-height: 1;
    border-radius: 50%;
    border: 1px var(--c_body_text) solid;
    align-content: center;
    text-align: center;
    vertical-align: middle;
    pad: 0;
    margin-left: 1em;
    font-size: 1.3rem;
}
button.close::before {
    content: "\00d7";
}

/* =============================== */
/* helpers */
.hidden {
    display: none;
}

/* base class for tooltips */
.tooltip {
    color: var(--c_body_text);
    /* hide info */
    position: fixed;
    visibility: hidden;
    opacity: 0;
    /* box positioning */
    z-index: 1000;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    /* text styling */
    font-size: 1rem;
    font-weight: normal;
    overflow-wrap: break-word;
    
    /* box styling */
    width: 80%;
    /* height: 5em; */
    height: auto;
    border-radius: 4px;
    background-color: color-mix(in srgb, var(--c_bg), var(--c_body_text) 20%);
    padding: 0.4em 0.5em;
    overflow-y: scroll;
    pointer-events: none;

    /* text styling */
    /* white-space: pre; */
    text-transform: none;    

    /* smoothing effects */
    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
}

:where(
    .hovertooltip:hover,
    .parameter:hover,
    .file-upload:hover,
    .cell:hover
    ) > .tooltip {
    /* show tooltip on hover */
    display: block;
    visibility: visible;
    opacity: 0.95;    
}

.overlay {
    height: 90%;
    position: fixed;
    margin: 0.5em;
    padding: 1em;
    border-radius: 10px;
    box-shadow: 
        0 0 20px var(--c_body_text);
    inset: 0;
    background: var(--c_bg);
    opacity: 0.9;
    justify-content: center;
    align-items: top;
    overflow-y: scroll;
    overflow-wrap: break-word;
    z-index: 1000;
}
.overlay.info {
    position: fixed;
    width: max-content;
    max-width: 70%;
    height: max-content;
    top: 50%;
    left: 50%;
    font-size: 1.8rem;
    border-radius: 7px;
    padding: 0.5rem;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c_tre);
    color: #ffffff;
    z-index: 1000;
    box-shadow: 10px 10px 15px var(--c_body_text);
}
p{
    width: auto;
    overflow-wrap: anywhere;
}
/* =============================== */
/* project specific */

/* titles */
.controls-title::after {
    content: "\25BC";
    font-size: 0.5em;
    margin-left: 0.5em;
    top: 0;
}
.controls-title:hover {
    cursor: pointer;
    text-decoration: underline;
    color: var(--c_fink_2);
}
/* content */
.content-wrapper {
    overflow-x: auto;
}

/* legend */
.legend-content {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: auto;
    grid-auto-columns: max-content;
    column-gap: 10px;
    align-content: center;
    align-items: center;
    outline: 1px red solid;
}

/* global controls */
.parameter {
    display: contents;
    width: max-content;
    height: max-content;
    padding: 0;
}
.parameter > * {
    margin-right: 5px;
    margin-left: 5px;
    height: max-content;
    justify-self: start;
}

.status {
    height: 5lh;
    /* min-width: 3em; */
    /* max-width: 95%; */
    width: 96%;
    /* justify-self: center; */
    overflow-y: auto;
    background-color: color-mix(in srgb, var(--c_fink_4) 10%, var(--c_bg) 90%);
    border-radius: 10px;
    padding: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
}
.status {
    white-space: pre;
}
.status::before {
    content: "Status:";
    font-weight: bold;
}

div.global-controls {
    display: grid;
    column-gap: 10px;
    /* grid-template-columns: repeat(auto-fit, minmax(320px, max-content)); */
    grid-template-columns: repeat(4, max-content);
    grid-auto-rows: auto;
    overflow-y: auto;
}

#resources {
    display: flex;
}


/* thumbnails */
.page-controls {
    display: grid;
    column-gap: 0;
    row-gap: 0;
    /* grid-template-columns: repeat(auto-fit, minmax(280px, max-content)); */
    grid-template-columns: repeat(4, max-content);
    grid-auto-rows: max-content;
    /* overflow-x: auto; */
}

.thumbnail-mosaic-wrapper {
    height: 80%;
    width: inherit;
    overflow-y: scroll;
    overflow-x: scroll;
}
section.thumbnail-mosaic {
    height: auto;
    width: 100%;
    overflow-x: hidden;
}

.mosaic-grid {
    height: 100%;
    width: fit-content;
    grid-auto-flow: column;
    display: grid;
    gap: 15px;
    grid-auto-columns: 1fr;
    align-items: center;
    justify-items: center;
    overflow-y: hidden;
    overflow-x: visible;
    background-color: transparent;
    padding: 1%;
    /* fallback (set in js) */
    grid-template-rows: repeat(3, minmax(0, 1fr));
    overflow-x: hidden;
}
.mosaic-grid .cell {
    height: 100%;
    width: 100%;
    display: grid;
    grid-auto-flow: column;
    /* grid-template-rows: minmax(0, 1fr); */
    grid-template-rows: repeat(3,minmax(0, max-content));
    gap: 10px;
    margin: 10px;
    background-color: color-mix(in srgb, var(--c_fink_4) 10%, var(--c_bg) 90%);
    outline: 1px var(--c_fink_3) solid;
    border-radius: 15px;
    align-items: center;
    justify-items: center;
    /* fallback (set in js) */
    grid-auto-columns: repeat(auto-fit, minmax(0, 1fr));
    box-shadow: 3px 3px 7px color-mix(in srgb, var(--c_fink_1) 60%, var(--c_bg) 40%);
}
.mosaic-grid .cell.col-highlight {
    /* highlight specific cells to guide the eye */
    background-color: color-mix(in srgb, var(--c_fink_4) 30%, var(--c_bg) 70%);
}
.mosaic-grid .cell:has(input[value="good"]:checked) {
    background-color: color-mix(in srgb, var(--c_fink_4) 90%, var(--c_bg) 10%);
    outline: 4px solid var(--c_body_text);
}
.mosaic-grid .cell:has(input[value="maybe"]:checked) {
    background-color: color-mix(in srgb, var(--c_fink_1) 70%, var(--c_bg) 30%);
    outline: 4px solid var(--c_body_text);
    color: var(--c_bg);
}
.mosaic-grid .cell:has(input[value="maybe"]:checked) > * > a {
    color: var(--c_bg);
}

.mosaic-grid .cell .cell-header {
    font-size: calc(var(--s_ui) * 1em);
    display: grid;
    grid-auto-flow: column;
    text-align: center;
    flex: 1;
    column-gap: 10px;
    align-content: center;
    align-items: center;
}
.thumbnail-mosaic-wrapper .cell-header > * > * {
    -ms-transform: scale(var(--s_input));      /* IE 9 */
    -webkit-transform: scale(var(--s_input));  /* Chrome, Safari, Opera */
    transform: scale(var(--s_input));    
}

.mosaic-grid .cell .cell-header a {
}

.mosaic-grid .cell .cell-header .cell-name {
}
.mosaic-grid .cell .cell-header .selection-container {
    display: grid;
    grid-auto-flow: column;
    grid-template-columns: 1fr;
}

.invert-selection {
    font-weight: bold;
    color: #ffffff;
}
.good {
    accent-color: var(--c_fink_4);
    background-color: var(--c_fink_4);
}
.bad {
    accent-color: var(--c_fink_2);
    background-color: var(--c_fink_2);
}
.maybe {
    accent-color: var(--c_fink_1);
    background-color: var(--c_fink_1);
}

.mosaic-grid .cell .thumbnail-container {
    display: grid;
    grid-auto-flow: column;
}

.mosaic-grid .cell .thumbnail {
    background-color: var(--c_fink_1);
    width: 100%;
    height: 100%;
}

.plotly-wrapper {
    display: block;
    /* set dynamically in JS */
    /* width: 100px; */
    /* height: 100px; */
    overflow: hidden;
}
.plotly-plot {
    display: block;
    width: 100%;
    height: 100%;
}


/* =============================== */
/* layout */
#fileupload {
    grid-area: fileupload;
}

#statusbar {
    grid-area: statusbar;
}
#globalcontrols {
    grid-area: globalcontrols;
}
#schemadownload {
    grid-area: schemadownload;
}
#controls-wrapper {
    /* display: grid; */
    height: inherit;
    grid-template-areas: 
        "globalcontrols"
        "schemadownload"
        "statusbar"
        ;
}

#legend {
    grid-area: legend;
}
#navigation {
    grid-area: navigation;
}
#controls {
    grid-area: controls;
}
#settings {
    height: auto;
    min-height: auto;
    max-height: auto;
    width: 97vw;
    grid-area: settings;
    display: grid;
    overflow-y: scroll;
    background-color: var(--c_fink_3);
    border-radius: 15px;
    margin-top: 10px;
    padding: 5px;
    grid-template-areas: 
        "controls"
        "legend"
        "navigation"
    ;
}

#pagecontrols {
    height: auto;
    grid-area: pagecontrols;
}
#mosaicwrapper {
    height: 100%;
    grid-area: mosaicwrapper;
}

#thumbnails {
    grid-area: thumbnails;
    grid-template-rows: 1fr auto;
    display: grid;
    height: auto;
    min-height: 70vh;
    max-height: 70vh;
    width: 100vw;
    grid-template-areas: 
        "mosaicwrapper"
        "pagecontrols"
    ;
}
main .content {
    display: grid;
    width: 100%;
    height: 100%;
    grid-area: content;
    grid-template-rows: 3fr 1fr;
    grid-template-columns: 1fr;
    /* grid-auto-rows: minmax(60vh, max-content); */
    overflow-y: hidden;
    grid-template-areas: 
        "thumbnails"
        "settings"
        ;
}

#globalheader {
    grid-area: globalheader;
}

main {
    grid-area: main;
    display: grid;
    height: auto;
    max-height: 95vh;
    width: 100vw;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    grid-template-areas: 
        "globalheader"
        "content"
    ;
    overflow-y: hidden;
}

nav {
    grid-area: nav;
    height: max-content;
    /* outline: 1px solid green; */
}
footer {
    grid-area: footer;
    height: max-content;
    max-height: 2vh;
    /* outline: 1px solid blue; */
}
body {
    display: grid;
    height: 98%;
    grid-template-rows: 0fr 1fr auto;
    grid-auto-columns: 1fr;
    row-gap: 10px;
    grid-template-areas: 
        "nav"
        "main"
        "footer"
    ;
}

/* ################################################################## */
/* MEDIA QUERIES */
@media (max-width: 768px) {
    /* .tooltip {
        pointer-events: all;
    } */
    #globalheader{
        display: none;
    }

}