@media only screen and (max-width: 768px) {
  /* For mobile phones: */
  .modal {
      font-size: 14px;
  }
}

html, body, .pages {
    padding: 0 0 0 0;
    margin: 0;
}

body {
    font-size: 16px;
    font-family: 'Anonymous Pro', 'Courier new', monospace;
    text-align: center;
}

.auto-zoom, .auto-layout {
    visibility: hidden;
}

.modal {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}
.modal.visible {
    display: block;
}

.modal-card {
    border: 1.5px dashed black;
    z-index: 1;
    padding: 20px;

    color: black;
    background-color: white;
    text-decoration: none;

    box-shadow: 20px 20px 0 0px black;
}
.modal.visible .modal-card {
    animation: shake 0.5s;
}
.modal-button {
    border: 1.5px dashed black;
    padding: 15px;
    display: inline-block;
    vertical-align: middle;

    color: black;
    text-decoration: none;
}
.modal-button:hover {
    background: black;
    color: white;
    border-color: white;
    cursor: pointer;
}

.footer {
    border-top: 1px dashed black;
    margin-top: 20px;
    padding-top: 20px;
    padding-bottom: 20px;
    text-align: right;
}
.footer .button {
    border: 1.5px dashed black;
    padding: 20px;
    margin: 20px;
    display: inline-block;
    vertical-align: middle;

    color: black;
    text-decoration: none;

    box-shadow: 20px 20px 0 0px black;
}
.footer .button:hover {
    background: black;
    color: white;
    border-color: white;
    cursor: pointer;
    /* Slight shake anim */
    animation: shake 0.05s; 
}
.button.zoom.fitH:before {
    content: "fit images vertically";
}
.button.zoom.fitV:before {
    content: "fit images horizontally";
}
.button.layout.single:before {
    content: "switch to double page layout ▯▯";
}
.button.layout.double:before {
    content: "switch to single page layout ▯";
}
.button.tutorial.showtutorial:before {
    content: "hide tutorial";
}
.button.tutorial.hidetutorial:before {
    content: "show tutorial";
}

.book {
    max-width: 100vw;
    text-align: center;
    position: relative;
    white-space: nowrap;
    display: inline-block;
}
.book.fitH {
    overflow-x: hidden;
    overflow-y: auto;
}
.book.fitV {   
    overflow-x: auto;
    overflow-y: hidden;
}

.pages {
    width: auto;
    height: auto;
    position: relative;
    float: left;
}
.pages.fitH {
    width: 100vw;
}
.pages.fitV {
    height: 100vh;
}

:root {
    --nav-bg-color: none;
}
:root:has(.modal.tutorial.visible) {
    --nav-bg-color: gold;
}
.nav {
    position: absolute;
    width: 30%;
    top: 0;
    bottom: 0;
    opacity: 0.4;
    animation: glow 4s;
    animation-iteration-count: infinite;
}
.nav.prev {
    background-color: var(--nav-bg-color);
    left: 0;
}
.nav.next {
    background-color: var(--nav-bg-color);
    right: 0;
}

.fadeout {
    animation: fade_out 0.2s linear;
    opacity: 0;
}
img {
    animation: fade_in 0.2s linear;
    opacity: 1;
}
img.cache {
    display: none;
}
img.page {
    width: auto;
    height: auto;
}
img.single.fitH {
    width: 100%;
}
img.double.fitH {
    width: 50%;
}
img.fitV {
    height: 100%;
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}
@keyframes fade_out {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes fade_in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes glow {
    0%   { opacity:0.4; }
    50%  { opacity:0.1; }
    100% { opacity:0.4; }
}
