
:root {
  --color-active-highlight: rgb(209, 180, 237);
  --color-inactive-highlight: rgb(239, 225, 255);
  --color-tag-bg: rgb(209, 180, 237);
  --color-tag-border: rgba(96,88,57,1);
  --color-code-bg: rgba(245,245,245,1);
  --color-border: rgba(200,200,200,1);
  --radius: 4px;
  --color-doc-bg: rgba(250,250,248,1);
  --color-chart-bg: white;
  --color-element-decoration: rebeccapurple;
  --color-readonly-element-decoration: rgb(190, 140, 240);
  --color-text: rgba(5,5,10,1);
  --gutter: 1rem;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --font-mono: Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;
  --color-table-odd: rgba(255,255,255,1);
  --color-table-even: rgba(245,245,250,1);
}

/* @media (prefers-color-scheme: dark) {
  :root {
    --color-active-highlight: yellow;
    --color-tag-bg: rgba(96,88,57,1);
    --color-tag-border: rgba(247,230,143,1);
    --color-doc-bg: rgba(5,5,10,1);
    --color-chart-bg: black;
    --color-element-decoration: #d8d0f6;
    --color-text: rgba(250,250,248,1);
  }
} */

html,
body {
  padding: 0;
  background-color: var(--color-doc-bg);
}

body {
  color: var(--color-text);
  font-family: var(--font-sans);
  &[data-dragging_x="true"] {
    cursor: col-resize;
  }
}

main {
  line-height : 1.35;
  max-width: 690px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

hr {
  margin      : 2rem 0;
  border      : 0;
  border-top  : 1px solid var(--color-border);
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
}
p, h1, h2, h3, h4, h5, h6, blockquote {
  code {
    font-size           : 0.8em;
    background-color    : var(--color-code-bg);
    border              : 1px solid var(--color-border);
    border-radius       : var(--radius);
    padding             : 0 0.2em;
    font-family         : var(--font-mono);
  }
}


table {
  width           : 100%;
  max-height      : 80vh;
  overflow        : scroll;
  border          : 1px solid var(--color-border);
  border-spacing  : 0;
  border-radius   : var(--radius);
  td, th {
    padding: 0.5em 1em;
  }
  p {
    margin: 0;
  }
  tbody {
    tr:nth-of-type(odd) {
      td {
        background: var(--color-table-odd);
      }
    }
    tr:nth-of-type(even) {
      td {
        background: var(--color-table-even);
      }
    }

  }
  th {
    font-size: 0.8em;
    /* background-color: $light_border_color; */
  }

}

blockquote {
  border-left: 2px solid var(--color-text);
  margin-left: 2px;
  padding-left: var(--gutter);
}

.BaseElement {
  position: relative;
  text-decoration-style: dotted;
  text-decoration-line: underline;
  text-decoration-thickness: 0.1em;
  text-decoration-color: var(--color-element-decoration);

  &[data-is_active="false"] {
    background-color    : unset;
    transition-duration : 1s;
    transition-property : background-color;
  }
  &[data-is_active="true"] {
    background-color    : var(--color-active-highlight);
  }

  ._Name {
    display: none;
    position: absolute;
    bottom: calc(100% - 0.2em);
    left: 0;
    background-color: var(--color-tag-bg);
    border: 0.5px solid var(--color-tag-border);
    border-radius: var(--radius);
    font-size: 0.6em;
    font-family: var(--font-mono);
    font-weight: 500;
    font-style: normal;
    padding: 0.2em;
  }
  &:hover,
  &:focus {
    ._Name {
      display: block;
    }
  }
}

.StringElement {
  cursor          : text;
  text-decoration-color: var(--color-readonly-element-decoration);
}
.RangeElement {
  cursor          : col-resize;
  &:hover,
  &:focus {
    background-color: var(--color-inactive-highlight);
  }
  &[data-is_active="true"] {
    background-color: var(--color-active-highlight);
    ._Indicator {
      background-color: var(--color-element-decoration);
    }
  }
  ._Indicator {
    position: absolute;
    top: calc(100% - 1px);
    left: 0px;
    background-color: var(--color-readonly-element-decoration);
    height: 0.1em;
    display: inline-block;
  }
}
.SwitchElement {
  cursor          : pointer;
  margin-left     : 0.25em;

  ._Indicator {
    position: absolute;
    right: 100%;
  }

  &[aria-pressed="true"] {
    ._Indicator {
      color: rgb(0, 128, 102);
      top: -0.2em;
    }
  }
  &[aria-pressed="false"] {
    ._Indicator {
      color: rgb(255, 72, 0);
      top: 0.1em;
    }
  }
  &[aria-pressed="mixed"] {
    ._Indicator {
      color: grey;
      top: -0.05em;
    }
  }

}

.DatasetEmbed {
  position: relative;
  --editor__bg: white !important;
  ._Data {
    width: 100%;
    max-height: 392px; /* ensure the last line is cut off, as a hint to scroll */
    overflow: scroll;
    background-color: var(--color-chart-bg);
    white-space: pre;
    border-radius: 6px;
  }
  ._Config {
    display: none;
    position: absolute;
    bottom: calc(100% - 0.2em);
    left: 0;
    background-color: var(--color-tag-bg);
    border: 0.5px solid var(--color-tag-border);
    border-radius: var(--radius);
    font-size: 0.6em;
    font-family: var(--font-mono);
    font-weight: 500;
    font-style: normal;
    padding: 0.2em;
  }
  &:hover,
  &:focus {
    ._Config {
      display: block;
    }
  }
}
.ChartEmbed {
  border: 1px solid #ccc;
  display: inline-block;
  height: 400px;
  width: 100%;
  position: relative;
  ._Canvas {
    background-color: var(--color-chart-bg);
    height: 100%;
    width: 100%;
  }
  ._Config {
    display: none;
    position: absolute;
    bottom: calc(100% - 0.2em);
    left: 0;
    background-color: var(--color-tag-bg);
    border: 0.5px solid var(--color-tag-border);
    border-radius: var(--radius);
    font-size: 0.6em;
    font-family: var(--font-mono);
    font-weight: 500;
    font-style: normal;
    padding: 0.2em;
  }
  &:hover,
  &:focus {
    ._Config {
      display: block;
    }
  }
}

.prism-code-editor {
  font-size: 0.8rem;
}

.CodeEditor {
  display: inline-block;
  max-width: 50em;
  width: 100%;
}


#activemd_raw_source {
  background-color: white;
  color: black;
  border: 1px solid var(--color-border);
  padding: 0.5rem;
  display: none;
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  top: 1rem;
  height: 92vh;
  overflow: scroll;
}
#activemd_controls_hide_source {
  display: none;
}
#activemd_controls {
  text-align: center;
  font-size: 0.7rem;
  border-bottom: 1px solid var(--color-border);
}

body[data-show_source="true"] {
  position: relative;
  overflow: hidden;
  #activemd_active_doc {
    visibility: hidden;
    pointer-events: none;
  }
  #activemd_raw_source {
    display: block;
  }
  #activemd_controls_hide_source {
    display: inline;
  }
  #activemd_controls_view_source {
    display: none;
  }
  #activemd_controls_download_source {

  }
}

.ActiveCodeBlock {
  border: 1px solid #ccc;
}

.SectionHeader {
  position: relative;
  margin-top: 1rem;
  ._Link {
    position: absolute;
    right: 100%;
    margin-right: 0.35em;
    top: 50%;
    margin-top: -0.65em;
    opacity: 0.5;
    text-decoration: none;
    &:hover {
      opacity: 1;
    }
  }
}