:root {
  --vid-ratio: calc(1080 / 1920);

  --base-toc-width: 230px;
  --base-main-width: 640px;
  --toc-width: min(
    var(--base-toc-width),
    calc(
      var(--base-toc-width) -
        min(
          calc(
            (calc(100vw - var(--nav-closed-width)) - var(--base-main-width)) / 2
          ),
          var(--base-toc-width)
        )
    )
  );
  --main-width: calc(var(--base-main-width) - var(--toc-width));
}

html,
body {
  max-width: 100vw;
  width: 100%;
  padding: 0;
  margin: 0;
  background: var(--bg-col);
}

.lesson-bottom-nav-mobile,
.mobile-text-nav {
  display: none;
}
.video-nav {
  position: absolute;
  right: 1rem;
  top: 1rem;
  font-size: 1.8rem;
  opacity: 0.8;
  transition: all 100ms linear;
  z-index: 10;
}

.video-nav:hover {
  transform: scale(1.2);
  opacity: 1;
}

/*Surrounding geometry*/
main {
  display: flex;
  width: 100%;
  height: calc(var(--vh, 1vh) * 100);
  flex-direction: column;
}

/* Hide scrollbar for Chrome, Safari and Opera */
main::-webkit-scrollbar {
  display: none;
}

main {
  min-height: 100%;
  height: fit-content;
  display: flex;
  flex-direction: row;
  overflow: auto;
}

main {
  max-width: var(--base-main-width);
}

.section-pieces {
  position: relative;
  width: 100%;
  max-width: calc(var(--main-width) + var(--toc-width));
  margin: auto;
  position: sticky;
  top: 0px;
  display: flex;
  flex-direction: row-reverse;
}

.section-pieces > ul {
  list-style: none;
  padding: 0;
  width: calc(var(--base-toc-width) - 2rem);
  margin: 1rem;
  position: absolute;
  left: calc(100% - var(--toc-width));
  top: 80px;
}

.section-pieces > ul > li {
  padding: 0.5rem;
  border-left: 2px solid var(--overlay-col);
  font-weight: 300;
}

.section-pieces a {
  display: block;
  text-decoration: none;
  color: var(--text-col);
}

.section-pieces a:hover {
  display: block;
  text-decoration: none;
  color: var(--accent-col);
}

.section-pieces > ul > .active {
  border-left: 2px solid var(--accent-col);
}

.section-pieces > ul::before {
  content: "Table of Content";
  font-family: "Inria Sans", sans-serif;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  display: block;
}

.mobile-top-header {
  display: none;
}

/*Apply styles if the screen width is higher than 1000px*/
@media (max-width: 800px) {
  .section-pieces {
    display: none;
  }

  .markdown {
    padding: 1rem !important;
  }
}

article {
  width: 100%;
  margin: 6rem 0;
}

article a {
  display: inline-block;
  padding: 1rem;
  margin: 0.5rem;
  border-radius: 4rem;
  background: #333c;
  color: white;
  font-family: "Inria Sans", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  width: fit-content;
  cursor: pointer;
  box-shadow: 2px 2px 2px 2px #0003;
  text-decoration: none;
}
.end-article > span {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  margin-top: 4rem;
}
.end-article > span > a {
  padding: 0.6rem 1rem;
  border-radius: 2rem;
  text-decoration: none;
  color: var(--text-col);
  opacity: 0.7;
  position: relative;
  font-weight: 500;
}

.end-article > span > a:hover {
  opacity: 1;
  color: var(--accent-col);
}

article a:hover {
  background: #222;
}

hgroup {
  position: relative;
  min-height: 240px;
  width: 100%;
  background: linear-gradient(
      217deg,
      rgba(100, 255, 255),
      rgba(255, 0, 0, 0) 70.71%
    ),
    linear-gradient(127deg, rgba(0, 255, 0, 0.8), rgba(0, 255, 0, 0) 70.71%),
    linear-gradient(336deg, rgba(255, 100, 100, 0.8), rgba(0, 0, 255, 0) 70.71%);
  box-shadow: 2px 2px 5px 5px #0004;
  border-bottom: solid 1px #0001;
}

hgroup::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(rgba(0, 0, 0, 0.2) 1px, transparent 1px);
  background-position: 16px 16px;
  background-size: 16px 16px;
  pointer-events: none;
}

hgroup > header {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: #000b;
  margin: 0;
}

hgroup h1 {
  color: whitesmoke;
  margin: auto;
  width: calc(100% - 3rem);
  max-width: 800px;
  padding: 1rem;
  max-width: var(--base-main-width);
  font-size: 1.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

hgroup h1 button {
  color: var(--text-col);
  background: var(--bg-col);
  border-radius: 1rem;
  margin: 0;
  border: 1px solid var(--panel-col);
  padding: 0.5rem;
}
hgroup h1 button p,
hgroup h1 button i {
  margin: 0; 
}
hgroup h1 button:hover {
  border: 1px solid var(--text-col);
}

.article-footer {
  display: flex;
  justify-content: space-around;
}

.article-footer > details > summary {
  display: block;
  padding: 1rem;
  border-radius: 4rem;
  background: #333c;
  color: white;
  font-family: "Inria Sans", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  width: fit-content;
  margin: 4rem auto;
  cursor: pointer;
  box-shadow: 2px 2px 2px 2px #0003;
}

/*Question overlay*/
.full-overlay-wrapper {
  display: none;
  z-index: 10;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #00000060;
  align-items: center;
  justify-content: center;
}

.full-overlay-wrapper.opened {
  display: flex;
}

.questions-overlay {
  position: relative;
  background: var(--panel-col);
  border-radius: 1rem;
  box-shadow: 0 0 0.5rem 0.5rem #0003;
  width: 100%;
  min-width: 300px;
  max-width: 700px;
  display: flex;
  flex-flow: column;
}

.questions-overlay form {
  display: flex;
  margin: 0 1.5rem;
  margin-top: 1.7rem;
  border-radius: 0.8rem;
  transition: all 150ms linear;
}
.questions-overlay h2 {
  font-size: 1.5rem;
  padding: 1rem 1.5rem;
  margin: 0;
  font-weight: 400;
  border-bottom: 1px solid #fff3;
}
.questions-overlay form:focus-within {
  background-color: #00000015;
  margin: -0.8rem 0.7rem;
  margin-top: 0.9rem;
  padding: 0.8rem 0.8rem;
}

.close-questions {
  width: fit-content;
  position: absolute;
  right: 1rem;
  top: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 1.5rem;
  font-size: 1.2rem;
  border: none;
  color: var(--text-col);
  background: none;
}

.close-questions:hover {
  background: #fff4;
}
/*Cross */
.close-questions::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 2px;
  background: var(--text-col);
  transform: translateY(-50%) rotate(45deg);
}

.close-questions::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 2px;
  background: var(--text-col);
  transform: translateY(-50%) rotate(-45deg);
}

.questions-overlay input[type="text"] {
  background: none;
  outline: none;
  border: none;
  border-bottom: gray solid 1px;
  flex-grow: 1;
  font-size: 1rem;
  transition: all 150ms linear;
}

.questions-overlay form:focus-within input[type="text"] {
  border: none;
  border-radius: 0.4rem;
}

.questions-overlay form button {
  transition: all 150ms linear;
  opacity: 0;
  margin-left: 0.4em;
  font-size: 1rem;
  color: white;
  background-color: rgb(50, 100, 255);
  border: none;
  border-radius: 0.4rem;
  padding: 0.2rem 0.4rem;
}

.questions-overlay form button:hover {
  background: rgb(80, 140, 255);
}

.questions-overlay form:focus-within button {
  opacity: 1;
}

.qo-field {
  margin: 0.8rem 0 0 1.5rem;
  overflow: auto;
  height: fit-content;
  padding: 0;
  padding-top: 1.5rem;
}

.qo-field li {
  display: block;
  margin-bottom: 3rem;
  font-size: 1.1rem;
}

.qo-field li p {
  margin: 0.4rem 0;
}

.qo-field .qo-answer {
  padding: 0.2rem 0.4rem;
  border-left: 5px solid blueviolet;
  border-radius: 5px;
  margin-right: 3rem;
  background: #0002;
}

.qo-field .qo-unanswered-q {
  padding: 0.2rem 0.4rem;
  border-left: 5px solid crimson;
  border-radius: 5px;
  margin-right: 3rem;
  background: #f002;
}

.qo-field .qo-unanswered-q summary {
  cursor: pointer;
}

.questions-btn[open] .fa-question {
  display: none;
}
.questions-btn:not([open]) .fa-close {
  display: none;
}

.questions-btn > summary {
  width: fit-content;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.6rem;
  cursor: pointer;
  background: var(--navbar-bg-col);
  width: 3rem;
  height: 3rem;
  border-radius: 2rem;
  box-shadow: 2px 0px 5px #0004;
  margin-bottom: 1rem;
}
.lesson-nav {
  display: flex;
}

.markdown h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}
.markdown h3 {
  display: flex;
  font-size: 1.2rem;
  margin: 2.5rem 0 0 0;
}
.markdown :not(pre) > code {
  color: var(--faded-text-col);
}
.lesson-nav > a,
.lesson-nav > button {
  background: none;
  border-radius: 1rem;
  padding: none;
  color: var(--faded-text-col);
  text-decoration: none;
  width: 3rem;
  height: 3rem;
  display: flex;
  justify-content: center;
  align-items: center;
  border: none;
  font-size: 1.2rem;
}
.lesson-nav > a:hover,
.lesson-nav > button:hover {
  background: var(--overlay-col);
  cursor: pointer;
  color: var(--text-col);
}