:root {
    --body-color: #333333;
    --main-column-width: 100vw;
    --outer-well-width: 100vw;
    --carousel-arrow-size: 48px;
    --body-top-margin: 80px;
}

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin-top: var(--body-top-margin);
    background-color: rgba(248, 244, 253, 1);
    font-size: 1.25rem;
    min-width: 2500px;
    color: var(--body-color);
    padding-bottom: 2rem;
}

/* Index page
*/

.index {
    margin-top: 2rem;
}

.index__header {
    width: 100%;
    text-align: center;
    padding-top: 4rem;
    padding-bottom: 4rem;
    line-height: 2.8rem;
}

.index__header + section {
    margin-top: 6rem;
}

.index__header__title {
    font-size: 2rem;
}

.index__header__subtitle {
    font-size: 1.5rem;
    display: block;
    margin: auto;
}

.index__list {
    margin: 0 auto;
    width: fit-content;
    list-style: none;
    padding-left: 0;
    line-height: 2rem;
}

.index__list a {
    color: #337ab7;
    text-decoration: none;
}

/* for top-level list items */
.index__list__chapter {
    padding-left: 20px;
    margin: 0.4rem 0;
}

/* for nested lists */
.index__list__subchapter {
    padding-left: 1.6rem; /* more indentation for visual hierarchy */
    list-style: none;
}

.index__list__subchapter li {
    margin: 0.4rem 0;
}

/* Menu
*/

.menu {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
    width: 100vw;
    display: flex;
    justify-content: space-between;
    transform: translateY(0);
    transition: transform 0.5s ease-in-out;
}

.menu--hidden {
    transform: translateY(-100%);
}

.menu-right, .menu-left {
    width: fit-content;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1rem;
    justify-content: end;
    background-color: #F8F4FD;
    border-radius: 6px;
}

.menu a {
    padding: 0 1rem;
}

.menu-right {
    text-align: right;
}

/* Chapters and Subchapters
*/

.chapter, .subchapter {
    margin-top: 2rem;
}

.page-title {
    width: inherit;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    text-align: center;
    gap: 2rem;
    font-size: 2.25rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.page-title::before,
.page-title::after {
    content: "";
    border-top: 6px double;
}

.main-column {
    max-width: var(--main-column-width);
    padding: 0 2rem;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.well {
    width: 100%;
    margin: 2ch auto;
    padding: 1.3rem 1.5rem;
    line-height: 1.8rem;
}

.well > .well:last-child {
    margin-bottom: 0;
}

.out {
    width: var(--outer-well-width);
}

p {
    line-height: 1.8rem;
}

p:has(> mjx-container) {
  overflow-x: scroll;
  overflow-y: hidden;
}

.statement,
.remark {
    background-color: #f5f5f5;
    border: 1px #e3e3e3 solid;
    border-radius: 4px;
    vertical-align: baseline;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.05);
}

.highlight {
    background-color: #f5f5f5;
    color: var(--body-color);
    border: 1px #e3e3e3 solid;
    border-radius: 4px;
}

.highlight .statement {
    background-color: #F0FFFF;
}

.exercise {
    background-color: #e8e4d6;
    border-radius: 4px;
}

.remark {
    background-color: #F0FFFF;
}

.alert-info {
    background-color: #D9EDF7;
    color: #31708f;
}

.alert-warning {
    background-color: #FCF8E3;
    color: #8a6d3b;
}

.qed {
    display: inline-block;
    float: right;
}

p:has(> span.qed:only-child):last-child {
  padding-bottom: 2rem;
}

.nowrap {
  white-space: nowrap;
}

pre {
    font-size: 1rem;
    white-space: pre-wrap;
    margin: 0 2ch;
}

pre code.pythonPrompt {
    color: #000;
}

pre code.pythonPrompt::before {
    color: purple;
    font-family: "courier";
    content: ">>> ";
    width: 8em;
}

pre {
    white-space: pre-wrap;
}

pre.listing:before {
    counter-reset: listing;
}

pre.listing code {
    counter-increment: listing;
    color: var(--body-color);
}

pre.listing code::before {
    color: gray;
    content: counter(listing) ". ";
    min-width: 4ch;
    display: inline-block;
}

.terminalOutput {
    color: blue;
}

figure.main-column,
.well figure {
    width: fit-content;
    margin: 20px auto;
    text-align: center;
    overflow: visible;
}

figure.main-column img,
.well figure img {
    max-width: var(--main-column-width);
}

figure.main-column img.constrained,
.well img.constrained {
    max-width: 100%;
}

.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 500ms;
}

.carousel {
    width: inherit;
    height: auto;
    display: flex;
    align-items: center;
}

.carousel__nav-button {
    flex-shrink: 0; 
    border: none;
    background-color: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #333;
    transition: background-color 0.3s ease;
    z-index: 100;
}

.carousel__nav-button > img {
    width: var(--carousel-arrow-size);
    height: var(--carousel-arrow-size); 
}

.carousel__nav-button:disabled {
    opacity: 0.4;
    cursor: default;
    color: #999;
}

.carousel__items {
    position: relative;
    max-width: 100%;
    min-width: 0;
    width: 100%;
    height: auto;
    flex: 1 0 0%;
    display: flex;
    text-align: center;
}

.carousel__item > * {
    max-width: 100%;
    box-sizing: border-box;
}

.carousel__items > .carousel__item {
    position: relative;
    max-width: 100%;
    display: none;
    flex: 1 0 100%;
    
}

.carousel__items > .carousel__item.active {
    display: block;
}

h1 {
    font-size: 2.25rem;
    font-weight: normal;
}

h3 {
    font-size: 1.5rem;
    font-weight: normal;
}

p + p {
    margin-top: 0.8rem;
}

h1 + p,
h2 + p,
h3 + p {
  margin-top: 0.8rem;
}

p + h1,
p + h2,
p + h3 {
  margin-top: 0.8rem;
}

code {
    padding: 2px 4px;
    font-size: 0.9rem;
    color: #c7254e;
    border-radius: 4px;
}

ol, ul {
    list-style-position: inside;
    padding-left: 1rem;
}

li > p:first-child {
    display: inline;
}

a {
    color: #337ab7;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

hr {
    color: #EEEEEE40;
}

.math-block {
  position: relative;
  display: block;
  width: 100%;
  overflow-x: scroll;
  overflow-y: hidden;
}
