/* Control for elements that display only in either direct or calc mode */
:root {
  --radar-mode-display: block;
  --fan-mode-display  : none;

  --rel-dev-mode-display     : inline;
  --abs-dev-mode-display     : none;
  --non-none-dev-mode-display: inline;
  --none-dev-mode-display    : none;

  --font-color-faded                 : color-mix(in srgb, var(--ifm-font-color-base), var(--ifm-background-color) 75%);
  --background-color-shaded          : color-mix(in srgb, var(--ifm-background-color), var(--ifm-font-color-base) 20%);
  --background-color-secondary-shaded: color-mix(in srgb, var(--ifm-background-color-secondary), var(--ifm-font-color-base) 20%);
}

[chart-mode="fan"] {
  --radar-mode-display: none;
  --fan-mode-display  : block;
}

.radar-mode-only {
  display: var(--radar-mode-display) !important;
}

.fan-mode-only {
  display: var(--fan-mode-display) !important;
}

/* General element styling */

/* Remove the space after paragraphs which are followed by lists or which are the last child of their parent */
p:has(+ul, +ol),
p:last-child {
  margin-bottom: 0;
}

/* Customisation of input boxes */
input.mean-value,
input.abs-deviation-value,
input.rel-deviation-value,
.align-right {
  text-align: right;
}

/* Button styling */

button:disabled .text-icon {
  filter: invert(50%);
}

/* Button with a fixed small size */
button.fix-size-small {
  height : 2rem;
  width  : 1.5rem;
  padding: 0;
}

/* Images that appear as icons alongside text */
.text-icon {
  height: 1rem;
  color : var(--ifm-font-color-base);
  fill  : var(--ifm-font-color-base);
  stroke: var(--ifm-font-color-base);
  filter: invert(100%);
}

:root {
  --textarea-height: 5rem;
}

textarea {
  width : 100%;
  height: var(--textarea-height);
}

/* Draw outlines around the appropriate sections */
.square-border,
.rounded-border {
  border: 1px solid var(--ifm-font-color-base)
}

.rounded-border {
  display      : inline-block;
  border-radius: 0.5rem;
  margin       : 1rem 0;
  padding      : 0.5rem 1rem;
  max-width    : 95vw;
}

.faded-border {
  border-color: var(--font-color-faded);
}

/* Center sections horizontally */
*:has(>.center-section) {
  display       : flex;
  flex-direction: column;
  align-items   : center;
}

#data-input {
  margin-bottom: 0;
}

#glorius-plot {
  width : 700px;
  border: 1px solid black;
}

#plot-display {
  margin-top: 1rem;
}

.hidden {
  display: none !important;
}

/* Table styling */

table:has(+table) {
  margin-bottom: 0.5rem;
}

.label-table td:has(label) {
  text-align   : right;
  padding-right: 0.75rem;
}

.label-table td:not(:has(label)) {
  text-align: left;
}

.label-cell {
  font-weight: bold;
}

#title-input {
  width: 20rem;
}

.output-label-row {
  height: calc(2rem + 2px);
}

/* Style lists */
ul.no-bullet,
ol.no-bullet {
  list-style  : none;
  padding-left: 1rem;
}

/* Two-column display on all screens */
.multicol {
  display              : grid;
  grid-template-columns: 1fr 1fr;
  column-gap           : 1rem;
}

/* Set up two-column display on screens that are wide enough */
.multicol-on-big-screen {
  display        : flex;
  flex-direction : row;
  justify-content: stretch;
  gap            : 1rem;
  align-items    : flex-start;
  width          : 100%;
}

.multicol-on-big-screen.tiny-col-gap {
  column-gap: 2px;
}

.multicol-on-big-screen.tiny-row-gap {
  row-gap: 2px;
}

.multicol-on-big-screen.wrap {
  flex-wrap      : wrap;
  justify-content: flex-start;
  align-items    : end;
  column-gap     : 1rem;
  row-gap        : 0;
}

.multicol-on-big-screen.col-if-details-closed:has(details.col-if-closed-trigger:not(:open)) {
  flex-wrap      : nowrap;
  flex-direction : column;
  align-items    : center;
  justify-content: flex-start;
  column-gap     : 1rem;
  row-gap        : 0;
}

.align-start-if-open:not(:has(details:not(:open))) {
  align-self: start;
}

.multicol-on-big-screen.left-justify {
  justify-content: flex-start;
}

.multicol-on-big-screen+* {
  margin-top: 0;
}

.multicol-element {
  /* Flex basis is arbitray here as long as it's smaller than the smallest element */
  flex: 1 0 1rem;
}

.left-justify .multicol-element {
  /* If we want to left-justify, we don't want to grow elements */
  flex: 0 1 auto;
}

.small-screen-only {
  display: none;
}

.w20-on-big-fr-on-small {
  width: 20rem !important;
}

#save-data-container {
  flex: 0 1 max-content;
}

#load-data-container {
  flex: 0 1 max-content;
}

@media (max-width: 700px) {
  .multicol-on-big-screen:not(.wrap) {
    flex-direction: column;
    align-items   : stretch;
  }

  .multicol-on-big-screen.left-justify {
    justify-content: stretch;
  }

  .multicol-on-big-screen>.multicol-element:not(:first-child) {
    margin-top: 0;
  }

  .multicol-on-big-screen>.multicol-element:not(:last-child) {
    margin-bottom: 0;
  }

  .w20-on-big-fr-on-small {
    width: calc(100% - 6rem) !important;
  }

  .multicol-on-big-screen .big-screen-only {
    display: none;
  }

  .multicol-on-big-screen .small-screen-only {
    display: default;
  }

  .left-justify .multicol-element,
  .left-justify #save-data-container,
  .left-justify #load-data-container {
    flex: 1 0 1rem;
  }
}

@media (max-width: 900px) {
  .multicol-on-big-screen.m900:not(.wrap) {
    flex-direction: column;
    align-items   : stretch;
  }

  .multicol-on-big-screen.m900.left-justify {
    justify-content: stretch;
  }

  .multicol-on-big-screen.m900>.multicol-element:not(:first-child) {
    margin-top: 0;
  }

  .multicol-on-big-screen.m900>.multicol-element:not(:last-child) {
    margin-bottom: 0;
  }

  .m900 .w20-on-big-fr-on-small {
    width: calc(100% - 6rem) !important;
  }

  .multicol-on-big-screen.m900 .big-screen-only {
    display: none;
  }

  .multicol-on-big-screen.m900 .small-screen-only {
    display: default;
  }

  .m900.left-justify .multicol-element,
  .m900.left-justify #save-data-container,
  .m900.left-justify #load-data-container {
    flex: 1 0 1rem;
  }
}

@media (max-width: 950px) {
  .multicol-on-big-screen.m950:not(.wrap) {
    flex-direction: column;
    align-items   : stretch;
  }

  .multicol-on-big-screen.m950.left-justify {
    justify-content: stretch;
  }

  .multicol-on-big-screen.m950>.multicol-element:not(:first-child) {
    margin-top: 0;
  }

  .multicol-on-big-screen.m950>.multicol-element:not(:last-child) {
    margin-bottom: 0;
  }

  .m950 .w20-on-big-fr-on-small {
    width: calc(100% - 6rem) !important;
  }

  .multicol-on-big-screen.m950 .big-screen-only {
    display: none;
  }

  .multicol-on-big-screen.m950 .small-screen-only {
    display: default;
  }

  .m950.left-justify .multicol-element {
    flex: 1 0 1rem;
  }

  .m950.left-justify .multicol-element,
  .m950.left-justify #save-data-container,
  .m950.left-justify #load-data-container {
    flex: 1 0 1rem;
  }
}

/* Style the sensitivity table and related condition description table */
.sensitivity-table,
#rocrate-cond-desc-table {
  border-collapse: separate;
  border-spacing : 0 0;
}

.sensitivity-table th {
  max-width    : 8.5rem;
  padding-left : 0.25rem;
  padding-right: 0.25rem;
  text-align   : center;
}

.sensitivity-table th.rel-deviation-heading {
  /* We add a little extra padding to the relative deviation heading heading, so it wraps the same way as the absolute
  deviation heading */
  padding-left : 0.5rem;
  padding-right: 0.5rem;
}

.sensitivity-table td,
#rocrate-cond-desc-table td {
  padding-top   : 0.25rem;
  padding-bottom: 0.25rem;
  min-height    : 3rem;
}

.sensitivity-table td:first-child button,
.rocrate-contrib-button-cell button {
  margin-left: 0;
}

.sample-button-container,
.plot-select-container {
  display        : flex;
  flex-direction : row;
  justify-content: center;
  align-items    : center;
}

.row-button-cell {
  align-items   : center;
  vertical-align: middle;
}

.row-button-cell:not(td) {
  display: inline-block;
}

.rocrate-contrib-row>* {
  display: inline-block;
}

.row-button-container {
  display        : flex;
  flex-direction : row;
  justify-content: space-between;
}

.condition-label-cell {
  padding-left : 0.125rem;
  padding-right: 0.5rem;
}

.baseline-value-cell,
.sample-value-cell,
.mean-value-cell,
.abs-deviation-value-cell,
.rel-deviation-value-cell {
  padding-left : 0.125rem;
  padding-right: 0.125rem;
}

input.condition-label {
  max-width: 10.5rem;
}

.baseline-line-container,
.sample-line-container,
.mean-line-container,
.abs-deviation-line-container,
.rel-deviation-line-container {
  display        : flex;
  flex-direction : column;
  justify-content: center;
  align-items    : center;
}

input.baseline-value,
input.sample-value,
input.mean-value,
input.abs-deviation-value,
input.rel-deviation-value {
  max-width: 5rem;
}

.baseline-input-line,
.sample-input-line,
.mean-input-line,
.abs-deviation-input-line,
.rel-deviation-input-line {
  display        : flex;
  flex-direction : row;
  justify-content: start;
  gap            : 0.25rem;
}

.sensitivity-table td.plot-select-cell,
.plot-select-container,
.plot-select {
  padding: 0;
}

.plot-select-container {
  height: 3rem;
  width : 100%;
}

.plot-select-container:hover,
.plot-select:hover {
  cursor          : pointer;
  background-color: var(--ifm-color-secondary);
  border-radius   : 0.5rem;
}

.plot-select-container:active,
.plot-select:active {
  background-color: var(--ifm-background-color);
}

.col-selected,
.col-selected-top,
.col-selected-bottom {
  border-right: 1px solid var(--ifm-font-color-base);
  border-left : 1px solid var(--ifm-font-color-base);
}

.col-selected-top {
  border-top   : 1px solid var(--ifm-font-color-base);
  border-radius: 0.5rem 0.5rem 0 0;
}

.col-selected-bottom {
  border-bottom: 1px solid var(--ifm-font-color-base);
  border-radius: 0 0 0.5rem 0.5rem;
}

/* RO-crate download button and loading spinner */
.rocrate-download-and-spinner {
  display       : flex;
  flex-direction: row;
  align-items   : center;
}

.loading-spinner {
  color: var(--ifm-color-primary);
  scale: 75%;
}

/* Classes to manually adjust margins etc. for individual elements */
.no-left-margin {
  margin-left: 0 !important;
}

.no-bottom-margin {
  margin-bottom: 0 !important;
}

.small-left-margin {
  margin-left: 0.25rem !important;
}

.med-left-margin {
  margin-left: 1rem !important;
}

.ml2 {
  margin-left: 2rem !important;
}

.small-right-margin {
  margin-right: 0.25rem !important;
}

.med-right-margin {
  margin-right: 1rem !important;
}

.w3 {
  width: 3rem !important;
}

.w4 {
  width: 4rem !important;
}

.w20 {
  width: 20rem !important;
}

.mw-32 {
  min-width: 32rem !important;
}

.full-width:not(.allow-overflow-x) {
  width: 100% !important;
}

.allow-overflow-x {
  max-width: max-content !important;
}

.max-width-15 {
  max-width: 15rem;
}

.text-align-right {
  text-align  : right;
  margin-right: 0.5rem;
}

.nowrap {
  white-space: nowrap;
}

/* How to indicate text which has a tooltip on mouseover */
.mouseover-tooltip::before {
  display         : inline-flex;
  justify-content : center;
  align-items     : center;
  content         : "i";
  background-color: var(--ifm-color-info);
  color           : var(--ifm-hero-text-color);
  font-family     : serif;
  font-weight     : bold;
  width           : 1rem;
  height          : 1rem;
  border-radius   : 0.5rem;
  margin-right    : 0.125rem;
}

/* Style the details and summary boxes */

details {
  border        : 1px solid var(--ifm-font-color-base);
  margin-bottom : 0.5rem;
  padding       : 0.25rem;
  padding-bottom: 0;
}

details>summary+* {
  margin-top: 0.75rem;
}

details>*:last-child {
  margin-bottom: 0.25rem;
}

summary {
  display       : block;
  position      : relative;
  cursor        : pointer;
  user-select   : none;
  margin        : -0.25rem;
  margin-bottom : 0rem;
  padding       : 0.25rem;
  padding-bottom: 0.25;
}

summary>h1,
summary>h2,
summary>h3,
summary>h4,
summary>h5,
summary>h6 {
  display: inline;
}

.alert-text {
  color: var(--ifm-color-danger);
}

:root {
  --marker-height: 1rem;
}

.large-marker {
  --marker-height: 1.75rem;
}

details>summary:before,
.info-marker::before,
.alert-marker::before {
  display      : inline-block;
  text-align   : center;
  padding      : 0;
  font-size    : var(--marker-height);
  line-height  : var(--marker-height);
  color        : var(--ifm-hero-text-color);
  font-family  : serif;
  font-weight  : bold;
  width        : var(--marker-height);
  height       : var(--marker-height);
  border-radius: calc(var(--marker-height)/2);
  margin-right : calc(var(--marker-height)/8);
  position     : relative;
  top          : 0;
  right        : 0;
}

details>summary:before {
  content         : "+";
  background-color: var(--ifm-color-info);
}

.info-marker::before {
  content         : "?";
  background-color: var(--ifm-color-info);
}

.alert-marker::before {
  content         : "!";
  background-color: var(--ifm-color-danger);
}

details[open]>summary:before,
details[open]>summary.info-marker::before {
  /* n-dash is used here, which is slightly wider than a hyphen */
  content    : "–";
  top        : calc(var(--marker-height)*-1/8);
  line-height: calc(var(--marker-height)*3/4);
}

details summary:hover {
  background-color: var(--background-color-shaded);
}

.secondary details summary:hover {
  background-color: var(--background-color-secondary-shaded);
}

details summary:active {
  background-color: var(--ifm-background-color);
}

.secondary details summary:active {
  background-color: var(--ifm-background-color-secondary);
}

/* Style the popup tooltips */
.tooltip {
  --bs-tooltip-opacity: 1;
  max-width           : 17.5rem !important;
}

.tooltip-inner {
  max-width: 17.5rem !important;
}

.tooltip-on-light {
  --bs-tooltip-bg   : var(--ifm-color-primary);
  --bs-tooltip-color: var(--ifm-hero-text-color);
}

.tooltip-on-dark {
  --bs-tooltip-bg   : var(--ifm-color-primary);
  --bs-tooltip-color: var(--ifm-font-color-base);
}

[data-theme='dark'] .tooltip-on-light,
[data-theme='dark'] .tooltip-on-dark {
  --bs-tooltip-bg   : var(--ifm-color-primary-lightest);
  --bs-tooltip-color: var(--ifm-font-color-base);
}

/* Canvas styling */
.white-bg {
  background-color: white;
}

/* Quill styling */
*:has(>.ql-container) {
  --ql-height: 2rem;
}

*:has(>.ql-container.ql-full) {
  --ql-height: var(--textarea-height);
}

.ql-container.ql-snow {
  border: none;
}

*:has(>.ql-toolbar.ql-snow) {
  position: relative;
  height  : fit-content;
}

.ql-toolbar.ql-snow,
.ql-editor {
  padding: 1px 2px;
}

.ql-toolbar.ql-snow {
  height: 2rem;
}

.ql-toolbar.ql-snow,
.symbol-palette {
  display   : none;
  border    : 1px solid #3A3A3A;
  position  : absolute;
  z-index   : 1;
  background: var(--ifm-input-bg-color);
}

.ql-toolbar.ql-snow {
  border-bottom-width: 2px;
  bottom             : calc(var(--ql-height) - 2px);
}

.ql-toolbar.ql-snow.visible {
  display: block;
}

.symbol-palette.visible {
  bottom               : calc(2rem + var(--ql-height) - 3px);
  display              : grid;
  grid-template-columns: repeat(10, 1.5rem);
}

.ql-toolbar.ql-snow .ql-formats {
  margin-right: 0.25rem;
}

.ql-toolbar.ql-snow .ql-formats button,
.symbol-palette button {
  background: none;
  border    : none;
  cursor    : pointer;
  display   : block;
  float     : left;
  height    : 1.5rem;
  padding   : 0.1875rem 0.3125rem;
  color     : var(--ifm-font-color-base);
  margin    : 0;
}


.ql-toolbar.ql-snow .ql-formats button {
  width: 1.75rem;
}

.symbol-palette button {
  width     : 1.5rem;
  padding   : 0.1875rem 0;
  text-align: center;
}


.ql-toolbar.ql-snow .ql-formats button:hover .ql-stroke,
.ql-toolbar.ql-snow .ql-formats button .ql-stroke {
  stroke: var(--ifm-font-color-base);
}

.ql-toolbar.ql-snow .ql-formats button:hover .ql-fill,
.ql-toolbar.ql-snow .ql-formats button .ql-fill {
  fill: var(--ifm-font-color-base);
}

.ql-toolbar.ql-snow .ql-formats button:hover.ql-active,
.ql-toolbar.ql-snow .ql-formats button.ql-active {
  color: #06c;
}

.ql-toolbar.ql-snow .ql-formats button:hover.ql-active .ql-stroke,
.ql-toolbar.ql-snow .ql-formats button.ql-active .ql-stroke {
  stroke: #06c;
}

.ql-toolbar.ql-snow .ql-formats button:hover.ql-active .ql-fill,
.ql-toolbar.ql-snow .ql-formats button.ql-active .ql-fill {
  fill: #06c;
}

.ql-toolbar.ql-snow .ql-formats button:hover,
.symbol-palette button:hover {
  color           : var(--ifm-font-color-base);
  background-color: var(--ifm-color-secondary);
}

.ql-toolbar.ql-snow .ql-formats button:active,
.symbol-palette button:active {
  background-color: var(--ifm-background-color);
}

.button-text {
  translate: 0 -2px;
}

.ql-toolbar.ql-snow .button-text {
  font-weight: bold;
}

.ql-editor {
  background-color: var(--ifm-input-bg-color);
  border          : 2px inset var(--ifm-input-border-color);
  font-family     : 'Fira Sans', sans-serif;
  font-size       : var(--ifm-font-size-base);
  min-width       : 10.5rem;
  height          : var(--ql-height);
  scrollbar-color : var(--ifm-hero-text-color) var(--ifm-color-primary);
}

.ql-editor.ql-blank::before {
  font-family: var(--ifm-font-family-base);
  font-size  : var(--ifm-font-size-base);
  color      : var(--ifm-font-color-base-f2);
}

.condition-input .ql-editor {
  width: 12rem;
}

.rocrate-cond-desc-label {
  text-align  : right;
  margin-right: 0.5rem;
}

.rocrate-cond-desc-input .ql-editor {
  width: 20rem;
}

#rocrate-title-input .ql-editor,
#rocrate-desc-input .ql-editor {
  width: calc(min(95vw - 8.5rem, 50rem));
}

.announcement-panel {
  background-color: #ff89a2;
  color           : black;
  display         : flex;
  flex-direction  : column;
  align-items     : center;
  padding         : 0.5rem;
  margin          : 0.5rem;
  border          : 1px solid var(--ifm-font-color-base);
  border-radius   : 0.5rem;
  height          : auto !important;
  font-size       : 1rem;
  text-align      : center;
}