/* Global variables */
:root {
  /* Set sans-serif & mono fonts */
  --sans-font: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --mono-font: 'Source Code Pro', 'Ubuntu Mono', Consolas, Menlo, Monaco, 'Andale Mono', monospace;
}

/* Dark Theme (Default) */
:root, html[data-theme='dark'] {
  --background-color: #1d2021;
  --text-color: #ebdbb2;
  --h1-color: #458588;
  --h2-color: #d3869b;
  --link-color: #7daea3;
  --meta-color: #928394;
  --code-color: #3c3836;
  --code-text-color: #fbf1c7;
  --border-color: #7c6f64;
  --th-color: #282828;
  --tr1-color: #3c3836;
  --tr2-color: #504945;
  --toc-color: #73986D;
  --aside-bg-color: #2e2e33;
  --footer-border-color: #d3869b;
  --li-marker-color: #e78a4e;
  --note-bg-color: #1d2021;
  --blue-color: #458588;
  --red-color: #ea6962;
  --green-color: #a9b665;
  --yellow-color: #d8a657;
  --footer-color: #d5c4a1;
}

/* Light Theme */
@media (prefers-color-scheme: light) {
  :root, html[data-theme='light'] {
    --background-color: #f9f5ef;
    --text-color: #282828;
    --h1-color: #45707a;
    --h2-color: #cc2455;
    --link-color: #076678;
    --meta-color: #928394;
    --code-color: #ebdbb2;
    --code-text-color: #181818;
    --border-color: #a89984;
    --th-color: #f9f5d7;
    --tr1-color: #ebdbb2;
    --tr2-color: #d5c4a1;
    --toc-color: #4c7a5d;
    --aside-bg-color: #ebdbb2;
    --footer-border-color: #875f87;
    --li-marker-color: #c35e0a;
    --note-bg-color: #f9f5d7;
    --blue-color: #45707a;
    --red-color: #c14a4a;
    --green-color: #6c782e;
    --yellow-color: #b47109;
    --footer-color: #504945;
  }
}

/* yusei-magic-regular - latin */
@font-face {
  font-display: swap;
  font-family: 'Yusei Magic';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/yusei-magic-v14-latin-regular.woff2') format('woff2');
}

/* quicksand-regular - latin */
@font-face {
  font-display: swap;
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/quicksand-v31-latin-regular.woff2') format('woff2');
}

/* quicksand-600 - latin */
@font-face {
  font-display: swap;
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 600;
  src: url('../fonts/quicksand-v31-latin-600.woff2') format('woff2');
}

/* space-mono-regular - latin */
@font-face {
  font-display: swap;
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/space-mono-v13-latin-regular.woff2') format('woff2');
}

/* source-code-pro-regular - latin */
@font-face {
  font-display: swap;
  font-family: 'Source Code Pro';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/source-code-pro-v23-latin-regular.woff2') format('woff2');
}

/* work-sans-regular - latin */
@font-face {
  font-display: swap;
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/work-sans-v19-latin-regular.woff2') format('woff2');
}

/* work-sans-500 - latin */
@font-face {
  font-display: swap;
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 500;
  src: url('../fonts/work-sans-v19-latin-500.woff2') format('woff2');
}

body {
  font-family: var(--sans-font);
  font-size: 20px;
  line-height: 1.6;
  word-break: break-word;
  min-width: 18rem;
  max-width: 38rem;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  background: var(--background-color);
  color: var(--text-color);
}

h1 {
  color: var(--h1-color);
  margin-top: 4rem;
  margin-bottom: 0;
  text-align: center;
  font-family: "Quicksand";
}

h2 {
  color: var(--h2-color);
  margin-top: 5rem;
  margin-bottom: 2.5rem;
  scroll-margin-top: 8rem;
  text-align: right;
  border-bottom: 1px solid var(--border-color);
  font-family: "Yusei Magic";
}

h3 {
    margin-top: 3rem;
}

@media only screen and (max-width: 480px) {
  body {
    padding: .75rem .75rem 1rem .75rem;
  }
}

@media only screen and (max-width: 38rem) {
  body {
    font-size: 18px;
    max-width: 36rem;
  }
}

p {
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
}

a {
  color: var(--link-color);
  text-underline-offset: 0.3rem;
}

a:hover {
  text-decoration: none;
}

ul {
  margin-bottom: 1.5rem;
  padding-left: 1.3rem;
}

ol {
  margin-bottom: 1.5rem;
  padding-left: 1.6rem;
}

li {
  margin-bottom: 1rem;
}

pre {
  font-family: var(--mono-font);
  background-color: var(--code-bg-color);
  color: var(--code-text-color);
  padding: 1rem .5rem 1rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.35rem;
  max-width: 100%;
  overflow: auto;
  margin: 2rem auto 2.5rem auto;
  white-space: pre-wrap;
}

pre > code {
  color: var(--code-text-color);
  padding: 0;
  font-size: 100%;
  font-weight: normal;
}

code {
  font-family: var(--mono-font);
  background-color: var(--code-bg-color);
  color: var(--code-text-color);
  padding: 0.10rem .20rem;
  font-size: 100%;
  font-weight: bold;
}

kbd {
  font-family: var(--mono-font);
  color: var(--code-text-color);
  border: 1px solid var(--border-color);
  border-bottom: 3px solid var(--border-color);
  border-radius: .25rem;
  padding: 0.1rem 0.4rem;
}

img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  width: auto;
}

figure {
  margin: 0;
  display: block;
  overflow-x: auto;
}

figcaption {
  text-align: center;
  font-size: 0.9rem;
  color: var(--meta-color);
  margin-block: 1rem;
}

table {
  margin: 1.5rem 0;
}

figure > table {
  width: max-content;
  margin: 0;
}

tbody tr:nth-child(odd) {
  background-color: var(--tr1-color);
}

tbody tr:nth-child(even) {
  background-color: var(--tr2-color);
}

tbody tr th {
  background-color: var(--th-bg-color) !important;
  color: var(--th-color);
}

th, td {
  text-align: start;
  padding: .5rem;
}

table caption {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

blockquote {
  margin-inline-start: 2rem;
  margin-inline-end: 0;
  margin-block: 2rem;
  padding: 0.4rem 0.8rem;
  border-inline-start: 0.35rem solid var(--quote-border-color);
  color: var(--text-color);
  font-style: italic;
}

cite {
  font-size: 0.9rem;
  color: var(--meta-color);
  font-style: normal;
}

@media only screen and (max-width: 810px) {
  blockquote {
    margin-inline-start: 1.2rem;
    border-inline-start: 0.25rem solid var(--quote-border-color);

  }
}

abbr[title] {
  cursor: help;
  text-decoration-line: underline;
  text-decoration-style: dotted;
}

header > nav {
  margin-bottom: 2rem;
}

header > nav a,
header > nav a:visited {
  margin: 0 .25rem 1rem .25rem;
  color: var(--text-color);
  display: inline-block;
  border-radius: .25rem;
  padding: 0.1rem .5rem;
  text-decoration: none;
}

header > nav a:hover,
header > nav a.current,
header > nav a[aria-current="page"],
header > nav a[aria-current="true"] {
  background: var(--meta-color);
  color: var(--code-text-color);
  cursor: pointer;
}

main li::marker {
  color: var(--li-marker-color);
}

footer {
  text-align: right;
  margin-top: 5rem;
  border-top: 3px solid var(--footer-border-color);
}

footer > nav a,
footer > nav a:visited {
  margin: 1rem .25rem 0 .25rem;
  color: var(--text-color);
  display: inline-block;
  border-radius: .25rem;
  padding: 0.1rem .5rem;
  text-decoration: none;
}

footer > nav a:hover {
  color: var(--code-text-color);
  cursor: pointer;
}

aside, details, progress {
  background-color: var(--aside-bg-color);
  margin-bottom: 1rem;
}

aside {
  font-size: 1rem;
  width: 30%;
  padding: 0 15px;
  margin-inline-start: 15px;
  float: right;
  border: 2px solid var(--meta-color);
  border-radius: .35rem;
}
*[dir="rtl"] aside {
  float: left;
}

/* Make aside full-width on mobile */
@media only screen and (max-width: 720px) {
  aside {
    width: 100%;
    float: none;
    margin-inline-start: 0;
  }
}

details {
  padding: 0.7rem 1rem;
  border-radius: 0 0 .35rem .35rem;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99999;
}

details[open] {
  opacity: 0.97;
}

summary {
  cursor: pointer;
  font-weight: bold;
  padding: 0.7rem 1rem;
  margin: -0.7rem -1rem;
  word-break: break-all;
  color: var(--toc-color);
}

details[open] > summary + * {
  margin-top: 0;
}

details[open] > summary {
  margin-bottom: 0.5rem;
}

details[open] > :last-child {
  margin-bottom: 0;
}

mark {
  padding: 2px 5px;
  border-radius: .25rem;
  background-color: var(--mark-bg-color);
  color: var(--th-color);
}

mark a {
  color: var(--link-color);
}

hr {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 1rem auto;
}

@media only screen and (max-width: 820px) {
  details {
    right: 0;
  }
}

@media only screen and (max-width: 480px) {
  details {
    /*margin-left: -.75rem;
    margin-right: -.75rem;*/
  }
}

/* Classes */

.site-navi {
  display: block;
  text-align: center;
}

.site-name {
  font-family: 'Space Mono';
  font-weight: bold;
  font-size: 1.5rem;
  text-decoration: none;
  color: var(--blue-color);
  
}

.site-name:hover {
  background: transparent;
  color: var(--text-color);
}

.site-name img {
  width: 32px;
  display: inline-block;
}

.author {
  text-align: center;
  margin-bottom: 4rem;
}

.date {
  color: var(--meta-color);
  text-align: right;
}

.index-list hr {
  background: var(--code-color);
  margin: 2.5rem auto;
}

.comic {
  border-radius: 1rem;
  margin-top: 4rem;
}

.image-leader {
    margin-top: 4rem;
}

.page-footer {
  font-family: 'Space Mono';
  margin: 6rem 1rem 4rem 1rem;
}

.emoji {
  height: 25px;
  display: inline;
  margin: 0;
  vertical-align: sub;
  border-radius: 50%;
}

@media only screen and (max-width: 580px) {
  .comic {
    border-radius: .5rem;
  }
}
