:root {
  --clip-reveal: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  --clip-left: polygon(0% 0%, 0% 0%, 0% 100%, 0% 100%);
  --clip-top: polygon(0% 0%, 100% 0%, 100% 0%, 0% 0%);
  --clip-right: polygon(100% 0%, 100% 0%, 100% 100%, 100% 100%);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
}

/* -- font -- */

@font-face {
  font-family: "Caudex";
  src: url("../font/Caudex-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "Caudex";
  src: url("../font/Caudex-Italic.ttf") format("truetype");
  font-weight: normal;
  font-style: italic;
}

@font-face {
  font-family: "Caudex";
  src: url("../font/Caudex-Bold.ttf") format("truetype");
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: "Caudex";
  src: url("../font/Caudex-BoldItalic.ttf");
  font-weight: bold;
  font-style: italic;
}

@font-face {
  font-family: "Soul Atlas";
  src: url("../font/soulatlas_norus.otf") format("opentype");
}

html {
  overflow-x: hidden;
  scrollbar-width: none;
  font-size:1vw;
}

::-webkit-scrollbar {
  display: none;
}

body {
  font-family: "Caudex";
  overflow: hidden;
  background-color: white;
  cursor: url("../images/Menu/cursor_i.webp") 0 0, auto;
}

/* -- loading -- */

#loading_screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: black;
    display:flex;
    justify-content:center;
    align-items:center;
    color:white;
    transition:opacity 1s ease, visibility 1s ease;
}

#loading_screen.hide {
    opacity:0;
    visibility:hidden;
}


.loading_content {
    display:flex;
    flex-direction:column;
    align-items:center;
    font-family:"Caudex";
}


.loading_content h2 {
    margin-top:20px;
    font-size:2rem;
}


.loading_wheel {
    width:50px;
    height:50px;
    border:4px solid rgba(255,255,255,.3);
    border-top-color:white;
    border-radius:50%;
    animation:loadingSpin 1s linear infinite;
}


@keyframes loadingSpin {
    from {
        transform:rotate(0deg);
    }

    to {
        transform:rotate(360deg);
    }
}


/* -- overlay -- */

#overlay_container{
  position:fixed;
  inset:0;
  z-index:110;
  display:flex;
  justify-content:center;
  align-items:center;
  background:rgba(0,0,0,.65);
  opacity:1;
  visibility:visible;
  transition: opacity .6s ease, visibility .6s ease;
}

#overlay_container.hide{
  opacity:0;
  visibility:hidden;
}

.overlay{
  display:flex;
  flex-direction:column;
  align-items:center;
  color:white;
  text-align:center;
  animation:hintAppear .6s ease;
}

.overlay h2{
  margin-top:20px;
  margin-bottom:5px;
  font-size:2em;
  font-weight:bold;
  font-family: "Soul Atlas";
}

.overlay p{
  font-size:1.1em;
  line-height:1.6;
  opacity:0.9;
}

.key{
  width:3%;
  height:auto;
  vertical-align:middle;
}

/* -- overlay animation -- */

.wheel{
  width:42px;
  height:72px;
  border:3px solid white;
  border-radius:25px;
  position:relative;
}

.wheeling{
  position:absolute;
  left:50%;
  top:12px;
  width:7px;
  height:13px;
  background:white;
  border-radius:10px;
  transform:translateX(-50%);
  animation:wheelMove 1.4s infinite;
}

@keyframes wheelMove{
  0%{
      opacity:1;
      transform:translate(-50%,0);
  }
  70%{
      opacity:0;
      transform:translate(-50%,22px);
  }
  100%{
      opacity:0;
      transform:translate(-50%,22px);
  }
}

@keyframes hintAppear{
  from{
      opacity:0;
      transform:translateY(15px);
  }
  to{
      opacity:1;
      transform:none;
  }
}

/* -- menu -- */

#turn_off{
  position:fixed;
  left:0;
  top:0;
  width:100vw;
  height:100vh;
  z-index:99;
  display:none;
}

#turn_off.open{
  display:block;
}

#menu_btn {
  position: fixed;
  right: 2%;
  bottom: 2%;
  cursor: pointer;
  z-index: 101;
  transition: right 1s, filter 1s, transform 1s;
}

#menu_btn.open {
  right: calc(35vw - 50px);
  filter: invert();
  transition: right 1s 0.03s, filter 1s, transform 1s;
}

#menu_btn img {
  transform-origin: center;
  transition: transform 1s;
  filter: drop-shadow(2px 2px 5px rgba(192, 192, 192, 0.25));
}

#menu_btn.open img {
  transform: rotate(-360deg);
}

#menu {
  position: fixed;
  bottom: 0;
  right: -35vw;
  width: 35vw;
  height: 100vh;
  z-index: 100;
  transition: right 1.1s;
  color:white;
  overflow:hidden;
}

#menu:hover{
  cursor: url("../images/Menu/cursor_i.webp") 0 0, auto;
}

#menu.open {
  right: 0;
  transition: right 1s;
}

#menu_bg {
  display: block;
  width: 100%;
  height: 100%;
  left: 100%;
}

#menu_content {
  position: absolute;
  inset: 0;
  display:flex;
  flex-direction:column;
  align-items:center;
  padding-left:10%;
  padding-right:10%;
  padding-top:5%;
}

#logo {
  width:17.5%;
  height:auto;
}

/* -- menu // buttons and sliders -- */

#menu_settings{
  width:100%;
  height:15%;
  display:grid;
  grid-template-areas:
    "fullscreen music_label"
    "darkmode music_slider"
    "parallax speed_label"
    "autoscroll speed_slider";
  grid-auto-rows: 1fr;
  grid-template-columns:1fr 2fr;
  gap:5%;
  margin-top:5%;
  font-size:1.2rem;
}

.menu_option:nth-child(1){
    grid-area:fullscreen;
}

.menu_option:nth-child(2){
    grid-area:darkmode;
}

.menu_option:nth-child(3){
    grid-area:parallax;
}

.menu_option:nth-child(4){
    grid-area:autoscroll;
}

#menu_settings > span:nth-of-type(1){
    grid-area:music_label;
}

#menu_settings > span:nth-of-type(2){
    grid-area:speed_label;
}

.slider_inline:nth-of-type(1){
    grid-area:music_slider;
}

.slider_inline:nth-of-type(2){
    grid-area:speed_slider;
}

.menu_option{
  display:flex;
  align-items:center;
  justify-content:flex-start;
}

.menu_option img{
  width:20px;
  height:auto;
  margin-right:15px;
}

#menu_settings > span{
  display:flex;
  align-items:center;
  justify-content:center;
}

.slider_inline{
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:center;
  gap:20px;
}

.slider_inline p{
  width:45px;
  margin:0;
  text-align:right;
}

.slider {
  flex:1;
  min-width:0;
  -webkit-appearance: none;
  appearance: none;
  width: 90%;
  height: auto;
  background: url("../images/Menu/slider.webp") no-repeat center;
  background-size: contain;
  outline: none;
}

.slider::-moz-range-track {   /* this is for Firefox */
  height: 20px;
  background: url("../images/Menu/slider.webp") no-repeat center;
  background-size: contain;
  border: none;
}

.slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: url("../images/Menu/slider_thumb.webp") no-repeat center;
  background-size: contain;
  border: none;
  cursor: pointer;
}

.slider::-webkit-slider-runnable-track { /* this is for Chrome, Edge, and Safari... Need to double check all this */
  -webkit-appearance: none;
  appearance: none;
  height: 20px;
  background: url("../images/Menu/slider.webp") no-repeat center;
  background-size: contain;
  border:none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: 0px;
  background: url("../images/Menu/slider_thumb.webp") no-repeat center;
  background-size: contain;
  border: none;
  cursor: pointer;
}

/* -- menu // dark mode --*/

body.dark_mode {
  background-color: black;
}

body.dark_mode section {
  background-color: black;
}

/* -- menu // page navigation --*/

#page_navigation{
  flex:1;
  display:flex;
  flex-direction:column;
  text-align:center;
  margin-top:10%;
}

#page_navigation h3{
  margin-top:5%;
}

.page_buttons{
  margin-top:5%;
  display:flex;
  flex-wrap:wrap;
  flex-direction:row;
  align-items:center;
  justify-content:center;
  gap:15px;

}

.page_buttons a {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 3vw;
  height: 3vw;
  background: url("../images/Menu/navigation.webp") center center / contain no-repeat;
  color: white;
  font-size: 1.25rem;
  text-decoration: none;
  transition: color 1s;
}

.page_buttons .a2{
  font-size:0.8rem;
}

.page_buttons a:hover, .page_buttons a.active{
  background:url("../images/Menu/navigation_i.webp") center center / contain no-repeat;
  color:black;
}

#next_chapter{
  margin-top:5%;
  font-weight:bold;
  font-size:1.5rem;
}

#bugs{
  font-weight:bold;
  font-size:0.8rem;
  margin-top:auto;
  margin-bottom:5%;
}

#bugs a, #bugs a:active, #bugs a:hover, #bugs a:focus, #bugs a:visited, #bugs a:link{
  color:#2fbf56;
  text-decoration:none;
}

/* -- pre-story pages --*/

#pre_story {
  position: relative;
}

.pre_page {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.pre_page img {
  display: block;
  width: 100%;
  height: auto;
}


/* -- story pages --*/

#comic {
  position: relative;
  width: 100vw;
  height: 100vh;
}

section {
  position: absolute;
  inset: 0;
  width:100vw;
  height:100vh;
  overflow:hidden;
}

section div { 
  position: absolute !important; 
  width: min(100vw, calc(100vh * 16 / 9)); 
  height: min(100vh, calc(100vw * 9 / 16)); 
  inset: 0;
  margin: auto;
} 

section img { 
  width: 100%; 
  height: 100%;
  object-fit: cover; 
  object-position: center top;
  margin:0;
 }

/* -- scalers -- */

.scale_100 {
  transform: scale(100%);
}

.scale_107 {
  transform: scale(107%);
}

.scale_108 {
  transform: scale(108%);
}

.scale_109 {
  transform: scale(109%);
}

.scale_110 {
  transform: scale(110%);
}

.scale_111 {
  transform: scale(111%);
}

.scale_112 {
  transform: scale(112%);
}

.scale_113 {
  transform: scale(113%);
}

.scale_114 {
  transform: scale(114%);
}

.scale_115 {
  transform: scale(115%);
}

.scale_116 {
  transform: scale(116%);
}

.scale_117 {
  transform: scale(117%);
}

.scale_118 {
  transform: scale(118%);
}

.scale_119 {
  transform: scale(119%);
}

.scale_120 {
  transform: scale(120%);
}

/* -- clippers --  */

.clip_left {
  clip-path: var(--clip-left);
}

.clip_top {
  clip-path: var(--clip-top);
}

.clip_right {
  clip-path: var(--clip-right);
}

/* -- opacity --  */

.opacity_zero {
    opacity: 0;
}

/* -- footer --  */

/* -- tablet -- */

@media only screen and (max-width: 1024px) {

  #logo{
    width:20%;
    height:auto;
  }

  #menu_settings{
    font-size:1.3rem;
    gap:7%;
  }

  .slider_inline p{
    width:20px;
    margin:0;
    text-align:right;
  }

  .page_buttons{
    gap:10px;
  }

  .page_buttons a{
    width:4vw;
    height:4vw;
  }

  #page_navigation h2{
    font-size:1.5rem;
  }

  #page_navigation h3{
    font-size:1.3rem;
  }

} 
