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

:root {
  --bg-color: #ffffff;
}

input,
textarea,
button,
select {
  font-family: inherit;
}

html {
  overflow-y: scroll;
}

body {
  background-color: #ffffff;
  color: rgb(0, 0, 0);
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Noto Sans KR', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: keep-all;
  letter-spacing: -0.01em;
  transition: background-color 3s ease;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  column-gap: 1.25rem;
  padding: 1.875rem 2.5rem;
  max-width: 100%;
  margin: 0;
  align-items: start;
}

.nav-item {
  text-decoration: none;
  color: inherit;
  font-size: 1.5rem;
  font-weight: 400;
  display: block;
  width: fit-content;
  justify-self: start;
  padding: 0;
  position: relative;
  top: 0.03em;
}

.nav-item:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.nav-logo {
  grid-column: 10;
  justify-self: end;
  width: auto;
  min-width: 1.9rem;
  height: 1.9rem;
  z-index: 10;
}

body.sub-page .nav-logo {
  mix-blend-mode: difference;
}

.nav-logo img {
  height: auto;
  display: block;
}

body.sub-page .nav-logo img {
  filter: invert(1);
}

/* Books */

.books-label {
  grid-column: 1;
  text-align: left;
}

.book-list {
  display: none;
  list-style: none;
  padding: 0;
  margin: 0;
  padding-top: 1.25rem;
  margin-top: -0.625rem;
  position: absolute;
  top: 100%;
  left: 0;
  line-height: 1.4;
  white-space: nowrap;
}

.books-label:hover .book-list,
.books-label.is-open .book-list {
  display: block;
}

.book-list li {
  font-size: 1.5rem;
  cursor: pointer;
  transition: none;
  position: relative;
  top: 0.03em;
  text-decoration: underline transparent solid;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.book-list li:hover {
  transition: none;
}

.book-list li:hover:not(.is-selected) {
  text-decoration-color: currentColor;
  text-decoration-style: dotted;
}

.book-list li.is-selected {
  text-decoration-color: currentColor;
  text-decoration-style: solid;
}

.nav-item a,
.nav-item a:visited {
  color: inherit;
  text-decoration: none;
}

.hover-bg {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: 50vw;
  background-color: #000000;
  z-index: -1;
  display: none;
}

body.bg-active .hover-bg {
  display: block;
}


/* About */
.about-wrapper {
  display: contents;
}

body.sub-page .about-wrapper {
  display: contents;
}

.about-label {
  grid-column: 2;
  grid-row: 1;
  text-align: left;
  display: block;
}

.about-description {
  grid-column: 3 / 6;
  grid-row: 1;
  opacity: 0;
  visibility: hidden;
  transition: none;
  text-align: left;
  padding-right: 2.5rem;
}

.about-label:hover {
  text-decoration-style: dotted;
}

.about-label:hover~.about-description,
.about-label.is-open~.about-description {
  opacity: 1;
  visibility: visible;
}

.about-label.is-open {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-style: solid;
}

body.sub-page .about-label {
  display: none;
}

body.sub-page .about-description {
  position: static;
  grid-column: 3 / 6;
  grid-row: 1;
  width: auto;
  opacity: 1;
  visibility: visible;
  padding-top: 0;
}

.about-description P {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.6;
  color: #000;
  text-align: left;
  font-weight: 500;
}

.about-description .ml-en {
  font-family: 'Inter', sans-serif;
  font-size: 1.025em;
  position: relative;
  top: 0.03em;
  font-weight: 500;
}

.side-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50vw;
  background-color: #000;
  display: none;
  overflow-y: auto;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  align-items: flex-start;
  justify-content: center;
  z-index: 5;
  scrollbar-width: thin;
  /* Firefox */
  scrollbar-color: rgba(255, 255, 255, 0.5) transparent;
}

.side-backdrop::-webkit-scrollbar {
  width: 0.375rem;
  background: transparent;
}

.side-backdrop::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 0.1875rem;
}

body.sub-page .side-backdrop {
  display: flex;
}

.image-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 0;
}

.image-container img {
  width: 100%;
  max-width: 90%;
  height: auto;
  margin-bottom: 1.25rem;
  display: block;
}

.about-label.is-open~.page-description {
  opacity: 0;
  visibility: hidden;
}

/* Tablet (Large) and Mobile Interaction Updates (< 1300px) */
@media (max-width: 1299px) {

  /* Disable hover for Books */
  .books-label:hover .book-list {
    display: none;
  }

  /* Ensure click (is-open) works */
  .books-label.is-open .book-list {
    display: block;
  }

  /* Disable hover for About */
  .about-label:hover~.about-description {
    opacity: 0;
    visibility: hidden;
  }

  /* Ensure click (is-open) works */
  .about-label.is-open~.about-description {
    opacity: 1;
    visibility: visible;
  }

  /* 
     Underline Rules: 
     - Active (is-open, is-selected) = Solid 
     - Inactive / Hover = None 
  */

  .nav-item:hover {
    text-decoration: none;
  }

  .books-label.is-open {
    text-decoration: underline;
    text-decoration-style: solid;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
  }

  .about-label:hover {
    text-decoration: none;
  }

  .about-label.is-open {
    text-decoration: underline;
    text-decoration-style: solid;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
  }

  /* Reset hover for list items */
  .book-list li {
    text-decoration: none;
  }

  .book-list li:hover {
    text-decoration: none;
  }

  /* Ensure selected items stay solid */
  .book-list li.is-selected {
    text-decoration: underline;
    text-decoration-style: solid;
    text-decoration-color: currentColor;
  }
}

@media (min-width: 768px) and (max-width: 1299px) {
  .grid-container {
    grid-template-columns: repeat(6, 1fr);
    padding: 1.875rem 1.25rem;
  }

  .nav-logo {
    grid-column: 6;
  }

  .about-description {
    grid-column: 3 / 6;
  }

  body.sub-page .about-description {
    grid-column: 2 / 4;
    padding-right: 20px;
  }
}


@media (max-width: 767px) {
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
    padding: 1.25rem;
    row-gap: 1.25rem;
    padding-bottom: 3.75rem;
  }

  .nav-item,
  .book-list li {
    font-size: 1.3rem;
  }

  .nav-logo {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin-bottom: 0;
    min-width: 1.5rem;
    height: 1.5rem;
  }

  .books-label {
    grid-column: 1 !important;
    grid-row: 1;
  }

  .book-list {
    background-color: transparent;
    transition: background-color 3s ease;
    z-index: 15;
    padding-top: 0;
    padding-bottom: 0.625rem;
    width: calc(100vw - 1.25rem);
    padding-right: 0.25rem;
    margin-top: 1rem;
  }

  body.sub-page .book-list {
    background-color: #ffffff;
  }

  /* Ensure about-wrapper is transparent to grid */
  .about-wrapper {
    display: contents;
  }

  .about-label {
    grid-column: 2 !important;
    grid-row: 1;
    margin-top: 0;
    margin-left: -2rem;
  }

  .about-description {
    grid-column: 1 / -1 !important;
    grid-row: 3;
    position: relative;
    padding-right: 0;
    padding-top: 0.625rem;
  }

  .about-description p {
    font-size: 0.95rem;
  }

  body.sub-page .about-description {
    grid-column: 1 / -1 !important;
    grid-row: 3;
  }

  .side-backdrop {
    width: 100vw;
    z-index: 20;
    position: relative;
    height: auto;
    top: auto;
    bottom: auto;
    overflow-y: visible;
  }

  .hover-bg {
    width: 100vw;
  }
}