@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');

:root {
  --line-color: #696969;
  --hover-color: #75e688;
  --background-color: #1a1a1a;
  --accent-color: #647b17;
  --text-color: #dcdcdc;
  --panel-color: rgba(0, 0, 0, 0.718);
  --font-family: 'Open Sans', sans-serif;
}
* {
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-family);
  line-height: 1.5rem;
}
body {
  min-height: 100vh;
  width: 100%;
  background-color: var(--background-color);
  color: var(--text-color); 
  display: grid;
  grid-template-columns: auto 1fr;
}

#toggle-btn{
  rotate: 180deg;}

#sidebar{
 height: 100vh;
  width: 50px;
  padding: 0;
  position: sticky;
  top: 0;
  align-self: start;
  transition: 300ms ease-in-out;
  overflow: hidden;
  text-wrap: nowrap;
   background-color: var(--panel-color);
  border-right: 1px solid var(--line-color);

}

#sidebar-trigger {
  display: none;
}

#sidebar.open{
  box-sizing: border-box;
  height: 100vh;
  width: 250px;
  padding: 0;
  background-color: var(--panel-color);

  position: sticky;
  top: 0;
  align-self: start;
  transition: 300ms ease-in-out;
  overflow: hidden;
  text-wrap: nowrap;
}


@media (min-width: 801px) {
  body {
    grid-template-columns: 1fr;
  }

  #sidebar-trigger {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    width: 12px;
    height: 100vh;
  }

  #sidebar,
  #sidebar.open {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1001;
    transition: width 300ms ease-in-out, opacity 300ms ease-in-out, transform 300ms ease-in-out;
    border-right: 0;
 
  }

  #sidebar.auto-hide {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
  }

  #sidebar-trigger:hover + #sidebar.auto-hide,
  #sidebar.auto-hide:hover,
  #sidebar.auto-hide:focus-within {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
}


#sidebar ul {
  list-style: none;
}
#sidebar > .navbar > ul > li:first-child {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}
#sidebar .logo {
  font-weight: 600;
  font-size: 1.25em;
}
#sidebar .sub-menu li.active > a {
  color: var(--accent-color);
}
#sidebar a, #sidebar .dropdown-btn, #sidebar .logo{
  border-radius: .5em;
  padding: .85em;
  text-decoration: none;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 1em;
}
#sidebar a:hover, #sidebar .dropdown-btn:hover {
  background-color: var(--accent-color);
  fill: var(--background-color);
}
.dropdown-btn {
width: 100%;
text-align: left;
background: none;
border: none;
font: inherit;
cursor: pointer;
}

#sidebar svg {
  flex-shrink: 0;
  fill  : var(--text-color);

}
#sidebar a span, #sidebar .dropdown-btn span {
  flex-grow: 1;
}



#sidebar .sub-menu {
  display: grid;
  transition: all .3s ease-in-out;
  grid-template-rows: 0fr;

  > div {
  overflow: hidden;
}
}

 

#sidebar .sub-menu.show {
  grid-template-rows: 1fr;

}

.dropdown-btn.rotate svg{
  transition: 200ms ease;
}
.rotate svg:last-child {
  rotate: 180deg; 
   
} 

/* Aerygrim active state when submenu open */
#sidebar > .navbar > ul > li.aerygrim-menu.active > .dropdown-btn,
#sidebar > .navbar > ul > li.aerygrim-menu.active > .dropdown-btn span {
  color: var(--accent-color);
}
#sidebar > .navbar > ul > li.aerygrim-menu.active > .dropdown-btn svg {
  fill: var(--accent-color);
}
#sidebar > .navbar > ul > li.aerygrim-menu > .dropdown-btn.rotate,
#sidebar > .navbar > ul > li.aerygrim-menu > .dropdown-btn.rotate span.aerygrim {
  color: var(--accent-color);
}
#sidebar > .navbar > ul > li.aerygrim-menu > .dropdown-btn.rotate svg {
  fill: var(--accent-color);
}


#sidebar .sub-menu a{
  padding-left: 2em;
}

#toggle-btn{
  margin-left: auto;
  padding: 1em;
  border: none;
  border-radius: .5em;
  background: none;
  cursor: pointer;

  svg {
    transition: rotate 150ms ease;
  }
}
#toggle-btn:hover svg {
  fill: var(--accent-color);
}

/* this where the content starts */

main {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.hero {
  box-sizing: border-box;
  display: flex;
  height: 100vh;
  width: 100%;
  margin: 0;
  gap: 10em;
  box-sizing: border-box;
  background-image:  linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.763)), url("/images/whimsical\ journey\ of\ the\ spacemage.jpg");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  align-items: center;
  justify-content: center;
  gap: 2em;
 
}
.section1 {
  aspect-ratio: 4/6;
  width: 500px;
  height: 700px;
  position: relative;

}
.section1 img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.section1a {
  position: relative;
  width: 500px;
  height: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-items: center;
  text-align: center;
  z-index: 1;
  opacity: 0;
  gap: 1em;
  box-sizing: border-box;
}

.section1a:hover {
  background-color: rgba(0, 0, 0, 0.629); 
   border-color: var(--accent-color);
  opacity: 1;
  transition: 200ms ease;
}

.title {

  text-align: center;
  padding: 1em;
  margin: 0;
}
.paragraph {
font-size: 20px;
  width: 90%;
  border: 2px solid var(--line-color);
  text-align: center;
  padding: 1em;
  margin: 0;
}

.section2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-items: center;
  text-align: left;
  gap: .5em;
  padding: 0;
  background-color: var(--panel-color);
  width: 500px;
  height: 700px;
}

.chapters {
  box-sizing: border-box;
  padding: 1em;
  font-size: 35px;
}
.chapterlist {
  display: flex;
  flex-direction: column;
  list-style: none;
  font-size: 30px;
  gap: 1rem;
  width: 90%;
  height: 72%;
  padding: 0;
  margin: 0; 
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-color) transparent;
}

.chapterlist a {  
  color: var(--text-color);
  text-decoration: none;
}

.chapterlist a:visited {
  color: var(--accent-color);
}


/*mobile format*/

@media (max-width: 800px) {
  body {
    grid-template-columns: minmax(0, 1fr);
  }

  main {
    min-width: 0;
  }


  .hero, .knight {
    text-wrap: auto;
    border: none;
    padding: 0;
  }

  #sidebar{
    height: 60px;
    width: 100%;
    border-right: none;
    border-top: 1px solid var(--line-color);
    padding: 0;
    position: fixed;
    top: unset;
    bottom: 0;
    transition: transform 300ms ease-in-out;
    z-index: 2;

    .navbar { 
      
    ul li span, ul li:first-child, .dropdown-btn svg:last-child {
    display: none;}
    
   
    > ul{
      padding: 0;
      display: grid;
      grid-auto-columns: 60px;
      grid-auto-flow: column;
      align-items: center;
      overflow-x: scroll;
      justify-content: center;
    }

    ul li {
      height: 100%;}
      
    
    ul a, ul .dropdown-btn {
      width: 60px;
      height: 60px;
      padding: 0;
      border-radius: 0;
      justify-content: center;
    }
    ul li .sub-menu.show {
      position: fixed;
      bottom: 60px;
      left: 0;
      box-sizing: border-box;
      height: 60px;
      width: 100%;
      background-color: var(--panel-color);
      border-top: 1px solid var(--accent-color);
      display: flex;
      justify-content: center;

      >div {overflow-x: auto}

      li{
        display: inline-flex;
      }
      a{box-sizing: border-box;
      padding: 1em;
    width: auto;
  justify-content: center;}

    }
  }
  }

  #sidebar.mobile-hidden {
  transform: translateY(100%);
  }

.hero{
   display: flex;
   height: 100vh;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  flex-flow: row nowrap;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  justify-content: flex-start;
  gap: 8em;
  padding-inline: max(0px, calc((100vw - min(500px, 90vw)) / 2));
  scrollbar-width: none;
}

.hero > .section1,
.hero > .section2 {
  flex: 0 0 min(500px, 90vw);
  min-width: 0;
  height: 100%;
  scroll-snap-align: center;
}

.hero .section1a {
  width: 100%;
  height: 100%;
  justify-content: center;
}
}