.cartouche-wrapper {
    width: 90%;
    text-align: left;
    margin: 0 auto;
}

.cartouche {
    border: solid 0.15rem white;
    display: inline-block;
    border-radius: 0.4rem;
    overflow: hidden;
    p {
        padding: 0 1em;
        line-height: 32px;
        margin: 0;
    }
}
.cartouche.sketch {
  background: white;
  img {
    display: block;
    max-width: 100%;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Animate newly-shown stamps with a "stamping" animation */
.shadow.active ~ .section-content {
  .cartouche.eki-stamp img {
      animation: stampIn 0.4s ease-out forwards;
  }
  .cartouche.sketch img {
      display: block;
      max-width: 100%;
      animation: fadeIn 0.4s ease-in-out forwards;
  }
}

@keyframes stampIn {
  0% {
    opacity: 0;
    transform: scale(2) rotate(5deg);
  }
  50% {
    opacity: 1;
    transform: scale(0.95) rotate(-5deg);
  }
  80% {
    transform: scale(1.05) rotate(2deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

img.manhole {
    filter: drop-shadow(0.2em 0.2em 0.25em #00000038);
    margin: 0.5em auto;
}

#progress {
    position: fixed;
    bottom: calc(0.25em + 7px);
    left: var(--toc-width);
    width: 0%;
    height: 0.25em;
    background-color: white;
    filter: drop-shadow(0 0.2rem 0.3rem #000000a8);
    z-index: 2;
    overflow-x: clip;
}

#menu-bar {
  position: fixed;
  top: 0.5em;
  right: 0.5em;
  background-color: rgba(var(--background-color), 0.7);
  border-radius: 0.75em;
  img {
    cursor: pointer;
    margin: 0.25em 0.5em;
  }
  img:hover {
    filter: drop-shadow(0 0.1rem 0.3rem var(--highlight));
  }
}

.toc-chapter ul {
  visibility: hidden;
  display: none;
}

.toc-chapter.active-chapter ul {
  visibility: visible;
  display: block;
}

@media only screen and (max-width: 600px) {
    :root {
      --toc-width: 16px;
    }
    html {
      scroll-padding-bottom: 10em;
    }

    #menu-bar {
      display: none;
    }
    .wrapper {
        .content {
          padding-top: 4.5em;
        }
        nav.toc {
            z-index: 2;
            left: 0;
            top: 0;
            position: fixed;
            background-color: var(--background-secondary);
            width: 100%;
            font-size: 0.8em;
            > ul {
              display: flex;
              align-items: center;
              position: relative;
            }
            ul {
                padding: 0;
                display: flex;
                align-items: center;
                margin: 0 auto;
                background-color: var(--background-secondary);
            }
            li.toc-chapter {
              white-space: nowrap;
              flex: 1;
              > ul {
                position: absolute;
                top: 100%;
                left: 0;
              }
              > a {
                padding: 0.8em 0em;
              }
              li a {
                padding: 0.4em 0;
                font-size: 1em;
                width: calc(100vw / 7);
              }
              li.active:hover a {
                  border-top: solid 0px;
                  border-bottom: solid 3px var(--highlight);
              }
              li a:hover {
                  border-top: solid 1px var(--background);
                  border-bottom: solid 1px var(--highlight);
              }
            }
            li {
              list-style: none;
              a {
                  display: block;
                  text-align: center;
              }
            }
            li a:hover {
                background-color: var(--background);
            }
            li.toc-chapter.active-chapter {
                background-color: var(--background);
            }
            li.active a {
                border-bottom: solid 3px var(--highlight);
                background-color: var(--background);
                font-weight: bold;
            }
        }
        .section:has(> .shadow.active) {
            .section-content {
                top: 4.5em !important;
            }
        }
    }
    a.big-text {
      display: none !important;
    }
    
}

@media only screen and (min-width: 601px) {
    :root {
      --toc-width: 8em;
    }
    html {
      scroll-padding-top: 1em;
      scroll-padding-bottom: 10em;
    }
    .wrapper {
        padding-left: calc(2em + var(--toc-width)) !important;
        width: calc(50% - 1em - var(--toc-width)) !important;
        div.map-wrapper {
            width: calc(50% - 2em) !important;
        }

        nav.toc {
            width: var(--toc-width);
            position: fixed;
            left: 0;
            top: 0;
            height: 100%;
            display: flex;
            align-items: center;
            background-color: var(--background-secondary);
            ul {
                padding: 0;
            }
            li.toc-chapter li a {
              padding-left: 1.5em;
            }
            li.toc-chapter > a {
              padding-left: 1em;
              padding-right: 2em;
            }
            li {
              list-style: none;
              a {
                border-left: solid 1px var(--background);
                width: calc(var(--toc-width) - 3em);
                padding: 1em 0em;
                display: block;
                color: var(--primary);
              }
              a:hover {
                border-left: solid 1px var(--highlight);
                background-color: var(--background);
              }
            }
            li.toc-chapter.active-chapter {
                border-top: solid 1px var(--highlight);
                border-bottom: solid 1px var(--highlight);
                background-color: var(--background);
            }
            li.active a {
                border-left: solid 3px var(--highlight);
                background-color: var(--background);
                font-weight: bold;
                color: var(--highlight);
            }
        }
    }
    a.mini-text {
      display: none !important;
    }
}

body:has(dialog) {
  overflow-x: hidden;
  overflow-y: hidden !important;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  max-width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  z-index: 9999;
  padding: 0;
  margin: 0;
  border: 0;
}

.modal-close {
  position: absolute;
  top: 0.5em;
  right: 1.5em;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10000;
  color: white;
}

.food-wrapper {
  margin: auto;
  display: flex;
  width: 100%;
  .food-image {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    filter: drop-shadow(0 0rem 0.5rem var(--primary));
    cursor: pointer;
  }
  .food-meta {
    width: calc(100% - 64px);
    padding: 0 1em;
  }
  .food-name {
    font-weight: bold;
  }
  .food-desc {
    font-style: italic;
  }
  p {
    margin: 0;
    margin-bottom: 0.5em;
  }
}

.food-modal-wrapper {
  z-index: 10000;
  height: 60%;
  min-height: 400px;
  margin: auto;
  background-color: var(--background-secondary);
  padding: 1em;
  width: fit-content;
  border-radius: 0.5em;
}

.food-modal-gallery {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  display: grid;
  grid-template-columns: auto auto auto;
  padding-right: 1.25em;
  img {
    image-rendering: pixelated;
    border: solid 1px transparent;
    width: 64px;
    height: 64px;
  }
}

.parallax {
  position: fixed;
  z-index: -1;
  bottom: 0;
  overflow-x: clip;
  opacity: var(--opacity);

  img, div.loop {
    display: block;
    position: absolute;
    bottom: 0;
    image-rendering: pixelated;
  }

  div.loop {
    width: 400%;
    background-repeat: repeat-x;
    background-size: auto 100%;
  }
}

@media only screen and (max-width: 600px) {
  .parallax {
    left: 0;
    width: 100%;
  }
}

@media only screen and (min-width: 601px) {
  .parallax {
    left: var(--toc-width);
    width: calc(50% + 2em - var(--toc-width));
  }
}