/* To the extent possible under law, the person who associated CC0
 * with this file has waived all copyright and related or neighboring
 * rights to this file.
 *
 * You should have received a copy of the CC0 legalcode along with
 * this work.  If not, see
 * http://creativecommons.org/publicdomain/zero/1.0/. */

/* $Id: quiz.css,v 1.5 2024/01/22 10:19:09 oj14ozun Exp oj14ozun $ */

:root {
    font-family: system-ui, "Open Sans", "Noto Sans", "Lato", Arial, sans-serif;

    --deafult-tint: ghostwhite;
    --highlight: red;
    --correct: honeydew;
    --wrong: mistyrose;
    --ambiguous: ivory;
    --radius: 6px;
}

* {
    box-sizing: border-box;
    text-rendering: optimizeLegibility;
    font-variant-ligatures: common-ligatures;
    font-kerning: auto;
}

body {
    margin: 0em auto 0 auto;
    padding: 1em;
    max-width: 50rem;
}

main {
    border: 2px solid rgba(0, 0, 0, 0.25);
    background: var(--deafult-tint);
    padding: 16px;
    position: relative;
    min-height: 48px;
    border-radius: var(--radius);
}

.answer main {
    background: var(--wrong);
}

.answer.right main {
    background: var(--correct);
}

.open main {
    background: var(--deafult-tint) !important;
}

/* QUESTION PANEL */

main img#media {
    margin: 0.5em auto;
}

main section#text {
    width: 90%;
}

main section#text > p:first-of-type {
    margin: 0;
}

/* INFO PANEL */

div#info,
div#info > aside {
    background: var(--default-tint);
    border-radius: var(--radius);
    display: inline;
}

div#info > aside > h1:first-of-type {
    margin-top: 0;
}

button#info-toggle {
    border: none;
    background: none;

    width: 32px;
    height: 32px;

    position: absolute;
    top: 0;
    right: 0;

    cursor: pointer;
    user-select: none;
}

:not(.open) #info > aside,
.open #text,
.open #metadata {
    display: none;
}

.open #info > aside {
    display: initial;
}

.open body > :not(.info-box),
.open main > :not(.info-box) {
    display: none !important;
}

/* METADATA PANEL */

.next div#metadata::after,
div#metadata {
    display: inline;
    position: absolute;
    bottom: 0;
    right: 0;
    padding: 4px 8px;
}

div#metadata {
    opacity: 80%;
    font-size: 70%;
}

/* ANSWERS */

#answers {
    margin-bottom: 0;
}

#answers li {
    padding-bottom: 1em;
}

#answers li::marker {
    opacity: 80%;
}

#answers li label {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 5px;
}

#answers li label p {
    margin: 0;
}

#answers li label .desc {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#answers li p.comment {
    display: none;
    flex: 1;
    width: 100%;
    border: 2px solid rgba(0, 0, 0, 0.25);
    border-radius: var(--radius);
    background: var(--wrong);
    padding: 8px;
}

.answer #answers li p.comment {
    display: block;
}

#answers li p.comment.correct {
    background: var(--correct);
}

#answers li p.comment.maybe {
    background: var(--ambiguous);
}

#answers li p.comment > p:first-of-type {
    margin: 0;
    /* avoid redundant padding due to markdown */
}

/* STATISTICS */

#stats,
#stats ~ * {
    font-size: 75%;
}

#stats > * {
    padding: 2px;
}

#stats > #correct {
    background: var(--correct);
}

#stats > #wrong {
    background: var(--wrong);
}

/* ACTION BUTTON */

button {
    padding: 8px;
    margin-bottom: 8px;
    border-width: 0;
    border-radius: var(--radius);
}

#action {
    float: right;
}

.tried #action::after {
    content: "Weiter";
}

#action::after {
    content: "Überspringen";
}

.answer #action::after {
    content: "Weiter";
}

:not(.tried) #action {
    animation: none;
}

.answer #action,
.tried #action {
    cursor: pointer;
    animation: blinker 2s linear infinite;
}

/* ETC. */

/* We use the new non-standardised pseudo property :has to allow
   reversing the direction of the standard subsequent sibling
   combinator, since the checkbox appears after the options section,
   where we want some words to be optionally highlighted. */
*:has(~ #display-hl:checked) .desc .hl,
*:has(~ #display-hl:checked) #text .hl {
    color: var(--highlight);
    font-weight: bold;
}

/* HACK: Firefox doesn't yet support the pseudo-selector :has, we use
   this fact to hide the "Hebe Warnwörter hervor" option from being
   displayed in the first place, avoiding confusion. */
.display-hl {
    display: none;
}

.display-hl:has(~ #display-hl-hack) {
    display: initial;
}

/* This is the initial value, that indicates no link has been set and
   therefore the "report problems" and "permalink" links is not of interest. */
#report[href="#"] {
    display: none;
}

#perma[href="#"] {
    display: none;
}

/* Some browser engines reduce the size of fixed-with elements by
   default, and this appears to be a hack to circumvent this issue:
   https://github.com/necolas/normalize.css/issues/519#issuecomment-197131966
   */
code,
tt,
kbd {
    font-family: monospace, monospace;
}

pre {
    /* overflow-x: auto; */
}

footer {
    text-align: right;
    opacity: 80%;
    font-size: 80%;
    margin-left: auto;
}

footer > code {
    display: block;
}

.noscript {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* based on https://stackoverflow.com/questions/16344354/ */
@keyframes blinker {
    50% {
        opacity: 50%;
    }
}

/* basic "dark theme" support */
@media screen and (prefers-color-scheme: dark) {
    :root {
        --deafult-tint: darkslategray;
        --highlight: cyan;
        --correct: seagreen;
        --wrong: maroon;
        --ambiguous: sienna;
    }

    html {
        background: black;
        color: white;
    }

    a,
    button,
    input {
        filter: invert(90%);
    }
}

/* Example CSS for syntax highlighting in dark mode */
.sourceCode {
    display: block;
    background-color: #2e2e2e;
    padding: 5px;
    /* overflow-x: auto; */
    font-family: monospace;
    border-radius: 5px;
    color: #ddd;
}

.sourceCode pre {
    margin: 0;
}

/* Keyword */
.sourceCode .kw {
    color: #569cd6;
    font-weight: bold;
}

/* Data type */
.sourceCode .dt {
    color: #4ec9b0;
}

/* Comment */
.sourceCode .co {
    color: #6a9955;
}

/* String */
.sourceCode .st {
    color: #ce9178;
}

/* Number */
.sourceCode .nu {
    color: #b5cea8;
}

/* Operator */
.sourceCode .op {
    color: #d4d4d4;
}

/* Punctuation */
.sourceCode .pn {
    color: #d4d4d4;
}

/* Function or method */
.sourceCode .fu {
    color: #c586c0;
}

/* Class or type */
.sourceCode .cl {
    color: #4ec9b0;
    font-weight: bold;
}

/* Attribute name */
.sourceCode .at {
    color: #4ec9b0;
}

/* Tag name */
.sourceCode .ta {
    color: #569cd6;
    font-weight: bold;
}

/* Variable name */
.sourceCode .va {
    color: #9cdcfe;
}

/* Property name */
.sourceCode .pr {
    color: #9cdcfe;
}

/* Selector (CSS) */
.sourceCode .se {
    color: #569cd6;
    font-style: italic;
}

/* ID (CSS) */
.sourceCode .id {
    color: #569cd6;
}

/* Important (CSS) */
.sourceCode .im {
    color: #569cd6;
    font-weight: bold;
}

/* Doctype (HTML) */
.sourceCode .do {
    color: #9cdcfe;
}

/* Meta (HTML) */
.sourceCode .me {
    color: #6a9955;
}

/* Tag (HTML) */
.sourceCode .tag {
    color: #569cd6;
    font-weight: bold;
}

/* Attribute (HTML) */
.sourceCode .atn {
    color: #4ec9b0;
}

/* Attribute value (HTML) */
.sourceCode .atv {
    color: #ce9178;
}

/* Entity (XML/HTML) */
.sourceCode .ent {
    color: #dcdcaa;
}

/* CSS Selector */
.sourceCode .selector {
    color: #d7ba7d;
    font-style: italic;
}

/* CSS Property */
.sourceCode .property {
    color: #9cdcfe;
}

/* CSS Value */
.sourceCode .value {
    color: #ce9178;
}

/* .numberLines { */
/*   position: relative; */
/*   line-height: normal; */
/* } */

.numberLines code {
  counter-reset: line-number 0;
}

div.sourceCode:has(.numberLines) {
    position: relative;
    margin-left: 3.5em;
}

pre.numberLines > code > span {
  position: static;
}

pre.numberLines > code > span::before {
  counter-increment: line-number;
  content: counter(line-number);
  display: inline-block;
  position: absolute;
  left: -1em;
  transform: translateX(-100%);
  text-align: right;
  color: #ccc;
  white-space: nowrap;
}
