/* The font-size is based on viewport height, instead of viewport width, for better sizing results. It has a minimum width to prevent a really bad look (and shouldn't be an issue even on older phones). */
body {
  font-size: 2.5vh;
  font-family: serif;
  margin: auto;
  padding: 10px;
  padding-top: 80px;
  max-width: 40em;
  line-height: 1.3;
  min-width: 810px;
}

/* Images labeled as 'thumbnail' follow a different layout rule from the usual images. */
img[src*="#thumbnail"] {
  float: right;
  max-width: 25vw;
  max-height: auto;
  margin-left: 30px !important;
  margin-top: 10px !important;
  margin-bottom: 30px !important;
  pointer-events: none;
}

/* It avoid page breaks on printing and goes grey when it's not in focus. */
img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  max-height: 50vh;
  max-width: auto;
  box-shadow: 2px 3px 3px;
  filter: grayscale(100%);
  page-break-before: auto;
  page-break-after: auto;
  page-break-inside: avoid;
}

img:hover {
  filter: none !important;
  padding-left: 2px;
  box-shadow: 1px 1px 1px;
}

/* This is the top menu strip for the quiz and other icons. */
.menubar {
  z-index: 5;
  position: fixed;
  top: 0px;
  left: 0px;
  padding-top: 10px;
  padding-left: 100px;
  background: #fff;
  width: 100%;
  border-bottom: 1px solid black;
}

.menubar img {
  all: unset;
  display: inline-block;
  filter: grayscale(100%);
  box-shadow: 0 0 0;
  max-height: 8vh;
  max-width: auto; 
  margin-left: 10px;
  cursor: pointer;
}

.menubar img:hover {
  filter: none;
  padding-left: 0px;
}

/* Sometimes the page calls for a manual divider (usually to separate out one particular noteworthy section). It's basically a fancy HR inside special markdown text. */
.divider {
  display: block;
  width: 100%;
  border-bottom: 1px solid black;
}

h3 a:hover {
  color: #993399;
  text-shadow: 0 0;
}

a {
  color: #6666ff;
  text-shadow: 1px 0px #00f;
}

a:hover {
  color: #9933ff;
  text-shadow: 0 0;
}

/* These are 'asides' that are presented in the text, usually to add context from a different point of view or summarize the page it's on. */
blockquote {
  padding-left: .4em;
  margin: 0;
  font: 2.1vh Arial;
  line-height: 1.4;
  max-width: 39.5em;
  background: #333;
  color: #fff;
  text-shadow: 1px 1px #000;
  border-left: 5px solid #999;
}

blockquote p {
  padding: 3px;
  margin: 3px;
}

blockquote a {
  color: #9999ff;
  text-shadow: 0 0;
}

blockquote a:hover {
  color: #ccccff;
}

/* The markdown 'code' option has been co-opted to issue special commands that we don't want the user to see. */
code {
  display: none;
}

table {
  border-collapse: collapse;
  margin-top: 20px;
}

table td {
  padding-right: 1em;
  min-width: 3em;
  margin: 0px;
  padding-top: .5em;
  padding-left: .2em;
}

table tr {
  border-bottom: 1px solid black;
}
/* This makes the tables easier to read as every other row stands out. */
table tr:nth-child(even) {
  background: #eec
}
/* This is the basic HR (not the divider). HRs have a special function for our code, which is why it is separate from the divider class. */
hr {
  width: 80%;
  border-top: 1px dashed #666666;
}

/* h5 has a special function in our code and should function like a p tag when it's not in service. */
p, h5 {
  margin-right: 2em;
  margin-bottom: 1em;
  text-align: justify;
}

h1 {
  font-size: 2.2em;
}

h2 {
  font-size: 1.3em;
}

h3 {
  font-size: 1.1em;
}

h3 a {
  margin-left: 50px;
  color: #0000FF;
  text-shadow: 1px 0px 1px #004;
}

/* This CSS dictates the layout of our Table of Contents button. */
.contents {
  text-align: center;
  width: 18em;
  position: fixed;
  top: 80px;
  left: 20px;
  border-radius: 20px;
  background: #eef;
  padding: 20px;
  padding-top: 10px;
  padding-bottom: 10px;
  border: 1px solid black;
}

.contents h1 {
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #fff;
}

.contents h1:hover {
  background: #eec;
  cursor: pointer;
}

/* FOR PRINTING */
@media print {
  body {
    padding: 0px;
    margin: 0px;
  }
/* We don't print the menu */
  .menubar {
    display: none;
  }
/* We unstyle the images */
  img {
    box-shadow: 0 0;
    filter: none;
  }
/* We unstyle the links */
  a {
    color: #000000;
    text-shadow: 0 0;
    white-space: pre-wrap;
  }

  h3 a {
    margin-left: 0px;
    color: #000;
    text-shadow: 0 0;
  }
/* We print the link content so people can read it. */
  a::after {
    content: "\A("attr(href) ")";
  }
}

/* LAYOUT FOR THE QUIZ */
/* This is just to center any block of text that acts as a one-line message. */
.centered {
  display: block;
  width: 50%;
  text-align: center;
  margin: auto;
}

textarea {
  margin-top: 10px;
  font-family: inherit;
  font-size: 2.5vh !important;
  padding: 5px;
  width: 98%;
  height: 8em;
}

/* This is the header for each question, containing the question title and the pips */
.header {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 16px 16px 0 0;
  background: #999;
  border-bottom: 2px dotted black;
  height: 1.5em;
  text-align: left;
  padding-right: 50px;
  font-size: 40px;
}

.header {
  color: #fff;
  text-shadow: 3px 3px 3px #000;
  padding-left: 20px;
  width: calc(100% - 50px - 20px);
  padding-top: 10px;
}

#title {
  display: inline-block;
  position: absolute;
  background: #999;
  z-index: 20;
}

.links {
  padding: 0;
  display: flex;
  float: right;
  justify-content: space-between;
  position: relative;
}

.pip {
  width: 25px;
  height: 25px;
  z-index: 6 !important;
  color: #fff;
  text-shadow: 2px 2px 2px #000;
}
/* Pip is unseen, pop is completed, pep is the current question */
.pop {
  color: #000 !important;
  text-shadow: 0 0 0 !important;
}

.pep {
  color: #ff0 !important;
  text-shadow: 0 0 0 !important;
}
/* We add a strike to the pips (hiding behind them), just to help visibility */
.strike {
  position: absolute;
  width: calc(100% - 5px - 20px);
  height: 2px;
  background: black;
  top: 27px;
  left: 5px;
  right: 0px;
  z-index: 1;
}
/* This is the bar at the very bottom for moving back and forth through the questions. */
.navigation {
  position: absolute;
  bottom: 0;
  left: 0;
  border-radius: 0 0 16px 16px;
  background: #ccc;
  width: 100%;
  text-align: center;
  z-index: 2;
}

.navigation div {
  display: inline-block;
  margin-right: 50px;
  margin-left: 50px;
}
/* These are the buttons themselves. They can be disabled or enabled for travel. */
.navbutton {
  background: #666;
  color: #fff;
  padding: 3px;
  padding-left: 20px;
  padding-right: 20px;
  border-radius: 20px;
}

.enabled:hover {
  background: #ff9;
  color: #000;
  cursor: pointer;
}

.disabled {
  background: #ccc;
  color: #bbb;
}


/* This is our little explainer bar that gives helpful tips. */
#explainer {
  color: #000;
  height: 2.4em;
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: 50px;
  padding: 10px;
  border: 1px solid black;
  width: auto;
  border-radius: 20px;
  text-align: left;
  background: rgba(255, 255, 255, 0.6);
  z-index: 3;
}

#explainer p {
  all: unset;
  inherit: none;
  border-bottom: 1px solid #c00;
}
/* The end button finishes the quiz and is a special color to celebrate! */
.endbutton {
  text-align: center !important;
  background: #66e !important;
  padding-top: 20px !important;
  font-size: 2.5vh !important;
}

.endbutton:hover {
  background: #99f;
  cursor: pointer;
  color: #fff !important;
  text-shadow: 1px 1px 1px #000;
  padding-top: 21px !important;
  margin-top: 1px !important;
}
/* Helpful tips are color-coded so you know if you're on the right track with your selected answer. */
.p-correct {
  border-bottom: 1px solid #0c0 !important;
}

.p-okay {
  border-bottom: 1px solid #bb0 !important;
}

/* This helps to hide the instructions behind the quiz, just to pop it out a bit. */
.overlay {
  height: 100%;
  width: 100%;
  min-width: 810px;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 8;
  display: none;
}

/* Our big red X button. */
.closebutton {
  border-radius: 5px;
  width: 35px;
  height: 35px;
  background: #f00;
  position: absolute;
  right: 7px;
  top: 5px;
  color: #fff;
  text-align: center;
  padding-top: 0px;
  font: 30px Console;
  box-shadow: inset -2px -2px 0px 1px #c00;
  z-index: 5;
}

.closebutton:hover {
  box-shadow: 0 0 0 0;
  background: #e00;
  top: 7px !important;
  cursor: pointer;
}

/* We're just making sure that the question is on-top of the backgrounds behind it. */
.questions {
  position: relative;
  z-index: 3;
}

/* Labels are used for each possible answer. Images, as an answer itself, are styled differently from the text answers. */
.label-image {
  display: inline-block;
  margin: 5px;
  padding: 0px;
  clear: both;
  z-index: 3;
}

.label-image { max-height: 24vh; width: auto; }
.label-image img { max-height: 24vh; width: auto; }

.label-text {
  clear: both;
  display: block;
  background-color: #ddd;
  font-family: sans-serif, Arial;
  font-size: 2.5vh;
  border: 2px solid #444;
  border-radius: 15px;
  margin: 10px;
  padding: 5px;
  padding-left: 20px;
  z-index: 3;
}

/* The quizprogress is a special background that fills itself in with each passing question, just as a visual indicator of progress. */
.quizprogress {
  position: absolute;
  right: 10px;
  bottom: 20px;
  background-repeat: no-repeat;
  background-position: right bottom;
  background-color: rgba(255, 255, 255, 0.6);
  background-blend-mode: lighten;
  height: 300px;
  width: 300px;
  z-index: 0;
}

/* This is the container for the entire quiz itself. */
.quizwindow {
  position: relative;
  height: 82%;
  width: 85%;
  background: #fff;
  border-radius: 20px;
  box-shadow: 6px 6px 6px #000;
  margin: auto;
  margin-top: 30px;
  user-select: none;
  padding: 20px;
  padding-top: 2.5em;
  max-height: 82%;
  max-width: 45em;
}
/* Each answer is a checkbox and a label. Since the labels accept clicks, we get rid of the checkbox styling entirely. */
.quizwindow input[type="radio"], input[type="checkbox"] {
  opacity: 0;
  position: fixed;
  width: 0;
  margin: 0px;
  padding: 0px;
}

/* We scale down selected images. */
.quizwindow input[type="radio"]:checked+label img, input[type="checkbox"]:checked+label img {
  transform: scale(.95);
  opacity: 0.6;
}

/* An answer can be wrong, correct, or okay (wrong, but still good enough). They are colored as such. */
.quizwindow input[type="radio"].Wrong:checked+label, input[type="checkbox"].Wrong:checked+label {
  background-color: #fbb;
  border-color: #c44;
}

.quizwindow input[type="radio"].Correct:checked+label, input[type="checkbox"].Correct:checked+label {
  background-color: #bfb;
  border-color: #4c4;
}

.quizwindow input[type="radio"].Okay:checked+label, input[type="checkbox"].Okay:checked+label {
  background-color: #eeb;
  border-color: #bb4;
}

.quizwindow label:hover {
  background-color: #bbe;
  cursor: pointer;
}

.quizwindow input[type="radio"]:focus+label, input[type="checkbox"]+label {
  border: 2px dashed #444;
}

/* This helps style the question a little. */
.quizwindow p::first-letter {
  font-size: 5vh;
  initial-letter: 2;
}

.quizwindow p {
  font-size: 3vh;
  margin-bottom: 1.5em;
}

/* These next two entries help dictate how image answer labels behave. For images that are part of the question itself, we fall back on the #thumbnail behaviour. */
.quizwindow img {
  display: inline-block;
  filter: none;
  box-shadow: 0 0 0;
  margin: 0px;
  padding: 0px;
  transition: transform .10s ease;
}

.quizwindow img:hover {
  transform: scale(.95);
  opacity: 0.6;
  cursor: pointer;
  border: 0px;
  box-shadow: 0 0 0;
  margin: 0px;
  padding: 0px;
}

/* We do some resizing for small displays, just to make it work. */

@media only screen and (max-resolution: 90dpi) {
  .quizwindow img {
    width: 150px;
    height: auto;
  }
  .quizwindow {padding-top: 3em; }
  img[src*="#thumbnail"] { max-width: 20vw;  height: auto; }
}

@media only screen and (max-width: 1300px) {
  .quizwindow {padding-top: 3em; }
}
@media only screen and (max-width: 1000px) {
  .quizwindow img {
    width: 150px;
    height: auto;
  }
}

@media only screen and (max-height: 600px) {
  .quizwindow img {
    width: 100px;
    height: auto;
  }

  .questions {
    padding-top: 50px;
  }
}

/*END OF QUIZ CSS */
