/*
Copyright 2021-2022 Jens Hofschröer <structogramview@nigjo.de>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless requivar(--structoedit-warning) by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
@media screen {
  :root {
    --structoedit-warning: #e20808;
    --structoedit-menu: #92a9e7;
    --structoedit-menu-bg: #f0f0f5;
    --structoedit-menu-sel: #03071c;
    --structoedit-menu-sel-bg: #4169E1;
    --structoedit-mark: #a1b4ef;
    --structoedit-hovermark: #d3daee;
    --editor-bg: #e2e2f1;

    --githublink-text: #03071c;
    --githublink-bg: #f0f0f5;
    --githublink-shadow: #405180;
    --githublink-borderline: #1c3a94;
  }
}
body {
  padding: 0;
  margin: 0;
}
#control {
  display: flex;
  background-color: var(--structoedit-hovermark);
  margin-bottom: 4vh;
}
noscript {
  color: var(--structoedit-warning);
}
.structcode {
  width: 100%;
  height: 100%;
  resize: vertical;
  background: none;
  margin: 0;
  display: block;
}
.structcodemarks .mark {
  display: inline-block;
  background-color: var(--structoedit-mark);
}
.structcodemarks .selected {
  position: relative;
}
.structcodemarks .selected:before {
  background-color: var(--structoedit-hovermark);
  content: " ";
  width: 35em;
  display: inline-block;
  position: absolute;
}
.scroller {
  position: relative;
  max-height: calc(100% - 0.7em - 4px);
  overflow: hidden;
  overflow-y: auto;
  height: 100%;
}
.scroller > * {
  line-height: 1.2em;
  font-family: monospace;
  font-size: inherit;
  white-space: pre;
  position: relative;
  padding: 0.1em;
  border-width: 1px;
}
.structcodemarks {
  position: absolute;
  z-index: -1;
  margin: 1px;
  color: transparent;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
}
.structcodecmd {
  color: var(--structoedit-warning);
  font-weight: bold;
}
figure {
  position: relative;
  display: block;
  width: 44%;
  border: 1px solid var(--structoedit-menu);
  margin: 0;
}
figcaption {
  border: 1px solid var(--structoedit-menu);
  width: calc(100% + 2px);
  display: block;
  /* margin-top: .5em; */
  background-color: var(--structoview-bg-block);
  padding: 0.25em;
  font-family: sans-serif;
  position: absolute;
  left: -1px;
  top: -1.5em;
  box-sizing: border-box;
  line-height: 1em;
}
.chars {
  display: inline-block;
  position: absolute;
  right: 0.5em;
  font-size: 1.4em;
}
#xmlview {
  white-space: pre-wrap;
  font-family: Consolas;
}
figure[data-parsererror]:after {
  color: var(--structoedit-warning);
  content: attr(data-parsererror);
  display: block;
  position: absolute;
  bottom: calc(100% + 1.7em);
  border-right: 10px solid var(--structoedit-warning);
  padding-right: .5em;
}
.view {
  display: none;
}
#diagram {
  position: absolute;
  top: 0;
  left: 0;
  visibility: hidden;
}
nav {
  display: flex;
  justify-content: space-between;
  padding: 1.2em 5vw 1em 5vw;
}
nav a {
  text-decoration: none;
}
nav ul:not(.options) {
  width: 45%;
  display: flex;
  justify-content: space-between;
  position: relative;
  margin: 0;
  padding: 0;
}
nav ul.options {
  display: flex;
  padding: 0;
}
nav ul li ul {
  width: 100% !important;
}
nav ul[title] {
  padding-right: 0.5em;
  flex-direction: column;
  vertical-align: top;
  margin-top: 1em;
  top: 0.55em;
  margin-bottom: 1em;
}
nav ul:before {
  content: attr(title);
  position: absolute;
  top: -1.2em;
  left: 50%;
  transform: translate(-50%);
  font-size: 1.2em;
  color: var(--githublink-borderline);
  font-weight: 600;
}
nav li {
  list-style: none;
  margin: 0.25em;
  margin-bottom: 0;
}
nav ul[title] > li {
  margin: 0;
  padding: 0;
}
nav li.break {
  flex-basis: 100%;
  margin: 0;
}
nav .menuitem {
  color: var(--structoedit-menu-sel);
  background-color: var(--structoedit-menu-sel-bg);
}
nav .menuitem {
  cursor: pointer;
  display: block;
  padding: 0.5em;
  margin: 0.25em;
  box-sizing: border-box;
  white-space: pre;
  line-height: 1em;
}
nav label.menuitem {
  color: var(--structoedit-menu);
  background-color: var(--structoedit-menu-bg);
}
input#showHTML:checked ~ main #diagram {
  position: relative;
  visibility: visible;
}
input#showSVG:checked ~ main #viewSVG {
  display: inline-block;
}
input#showXML:checked ~ main #viewXML {
  display: inline-block;
}
main {
  display: flex;
  justify-content: center;
  gap: 3em;
  margin-top: 12vh;
}
input#showHTML:checked ~ nav label[for="showHTML"],
input#showSVG:checked ~ nav label[for="showSVG"],
input#showXML:checked ~ nav label[for="showXML"] {
  color: var(--structoedit-menu-sel);
  background-color: var(--structoedit-menu-sel-bg);
}
input#showHTML:focus ~ nav label[for="showHTML"],
input#showSVG:focus ~ nav label[for="showSVG"],
input#showXML:focus ~ nav label[for="showXML"] {
  box-sizing: border-box;
  outline: 1px dotted var(--structoedit-menu);
}
input[name="theme"] {
  display: none;
}
input[name="theme"] + label {
  position: relative;
}
input[name="theme"]:checked + label:after {
  content: "✓";
  position: absolute;
  left: 0;
  text-align: center;
  width: 100%;
}
body > input {
  position: absolute;
  appearance: none;
}
body > input:focus {
  outline-style: none;
}
body {
  font-family: Segoe UI, sans-serif;
  color: var(--structoview-text);
  background-color: var(--structoview-bg);
}
h1 {
  text-align: center;
  color: #CE8F18;
  text-transform: uppercase;
}
struct-diagram struct-sequence:hover,
struct-diagram struct-comment:hover,
struct-diagram struct-call:hover,
struct-diagram struct-break:hover,
struct-diagram struct-select:hover,
struct-diagram struct-decision:hover,
struct-diagram struct-loop:hover,
struct-diagram struct-iteration:hover,
struct-diagram struct-concurrent:hover {
  background: var(--structoedit-hovermark);
}
figcaption {
  color: var(--structoedit-menu-bg);
  background-color: var(--githublink-borderline);
}
footer {
  background-color: var(--githublink-borderline);
  color: var(--editor-bg);
  width: 100%;
  padding: 3vh 5vw;
  margin: 5vh 0 0 0;
  box-sizing: border-box;
}
footer a {
  color: var(--structoedit-mark);
}
@media screen and (max-width: 600px) {
  main {
    flex-direction: column;
    align-items: center;
  }
  figure {
    width: 80%;
    min-height: 80vh;
  }
  .scroller {
    height: 100% !important;
    min-height: 100%;
    display: block;
  }
  textarea {
    height: 100%;
  }
}
@media print {
  nav {
    display: none;
  }
  .structcode {
    display: none;
  }
  .structcodemarks {
    color: initial;
    position: initial;
  }
  figure {
    display: block;
  }
}
