:root {
  --clr-neutral-100: hsl(0, 0%, 90%);
  --clr-neutral-200: hsl(35, 15%, 90%);
  --clr-neutral-300: hsl(45, 10%, 50%);
  --clr-neutral-400: hsl(0, 0%, 20%);
  --clr-neutral-500: hsl(0, 0%, 2%);
  --clr-accent-accent: hsl(101, 49%, 28%);
  --clr-accent-focus: hsl(56, 90%, 48%);
}

* {
  box-sizing: border-box;
  margin: 0;
}

/* width */
::-webkit-scrollbar {
  width: 3px;
}

/* Track */
::-webkit-scrollbar-track {
  background: var(--clr-neutral-400);
}

/* Handle */
::-webkit-scrollbar-thumb {
  background: var(--clr-accent-accent);
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
  background: var(--clr-neutral-200);
}

html {
  font-family: system-ui;
  font-size: 1.125rem;
  text-wrap: pretty;
  line-height: 1.4;
}

body {
  display: grid;
  place-content: center;
  gap: 2rem;
  min-height: 100svh;
  background-color: var(--clr-neutral-400);
  background: url("assets/image/forest-with-sunbeams.webp") no-repeat;
  background-size: cover;
}

video {
  object-fit: cover;
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  opacity: 0.7;
  mix-blend-mode: multiply;
  z-index: -1;
}

header {
  display: flex;
  flex-flow: column;
  justify-content: flex-start;
  gap: 0.5rem;
  & div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

figure {
  display: flex;
  flex-flow: column;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  border-radius: 1rem 1rem 0 0;
  overflow: hidden;
}

h1,
h2,
h3 {
  line-height: 1.1;
}

.music-control {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
}

.music-toggle {
  min-width: 24px;
  min-height: 24px;
}

.music-toggle:focus-visible {
  outline: 3px solid var(--clr-accent-focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.3);
}

.book {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: 2rem;
  padding: 2rem;
  border-radius: 1rem;
  width: min(100% - clamp(2rem, -0.087rem + 10.4348vw, 8rem), 1200px);
  margin-inline: auto;
  margin-bottom: 1rem;
  background: var(--clr-neutral-300);
  & img {
    max-width: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: 2s ease-in-out fadeIn;
  }
}

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

ul {
  list-style-type: none;
  padding: 0;
}

#inventory-container {
  position: absolute;
  z-index: 10;
  top: -20px;
  left: 20px;
}

.item-list {
  display: flex;
  font-weight: 700;
  flex-flow: row nowrap;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5em 0.75em;
  border-radius: 1rem;
  color: var(--clr-neutral-200);
  background: var(--clr-accent-accent);
}

figure {
  display: flex;
  flex-flow: column;
  width: 100%;
  height: 100%;
}

.figcaption {
  font-style: italic;
}

#pageHeader {
  text-align: center;
  align-items: center;
  margin-top: 1rem;
}

.pagetitle,
.pageparagraf,
.formlabel {
  text-transform: uppercase;
  color: var(--clr-neutral-200);
  line-height: 1.1;
}

.pageparagraf {
  font-size: clamp(1.125rem, 1.0598rem + 0.3261vw, 1.3125rem);
  font-weight: 300;
}

.pagetitle {
  font-size: clamp(2.0625rem, 1.4103rem + 3.2609vw, 3.9375rem);
  font-weight: 900;
}

.pageparagraf.no-animation {
  animation: none;
  letter-spacing: 0.1em;
}

.pagetitle.no-animation {
  animation: none;
  letter-spacing: 0.3em;
}

@media (prefers-reduced-motion: no-preference) {
  .pageparagraf {
    animation: 3s cubic-bezier(0.215, 0.61, 0.355, 1) both
      header-letter-contract;
  }
  .pagetitle {
    animation: 4s cubic-bezier(0.215, 0.61, 0.355, 1) 1s both
      title-letter-contract;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pageparagraf,
  .pagetitle {
    animation: none;
  }
}

@keyframes header-letter-contract {
  0% {
    letter-spacing: 0.8em;
    opacity: 0;
  }
  40% {
    opacity: 0.4;
  }
  70% {
    opacity: 0.7;
  }
  100% {
    letter-spacing: 0.5em;
    opacity: 1;
  }
}

@keyframes title-letter-contract {
  0% {
    letter-spacing: inherit;
    opacity: 0;
  }
  100% {
    letter-spacing: 0.3em;
    opacity: 1;
  }
}

.storyText {
  display: grid;
  gap: 0.4rem;
  height: 425px;
  margin-bottom: 0.25em;
  padding-right: 2em;
  overflow-y: auto;
}

.storyQuestion {
  font-size: 1.125rem;
  margin-top: auto;
  font-weight: 700;
}

.btn {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--clr-neutral-400);
  border: 1px solid var(--clr-neutral-500);
  padding: 0.7em 2em;
  border-radius: 0.5em;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
  transition: all 100ms ease-in-out;
}

.btn.music-toggle {
  padding: 0.5em 0.7em;
  background: hsl(from var(--clr-neutral-400) h s l / 0.2);
}

.buttoncontainer {
  margin-top: auto;
}

.btn,
.btn:visited {
  color: var(--clr-neutral-100);
}

.btn:visited {
  background: var(--clr-neutral-400);
  border: 1px solid var(--clr-neutral-500);
}

.btn:hover {
  border: 1px solid var(--clr-neutral-500);
}

.btn:hover,
.btn:focus-visible {
  color: var(--clr-neutral-400);
  background: var(--clr-neutral-100);
}

.btn:focus-visible,
input[type="text"]:focus-visible {
  outline: 2px solid var(--clr-accent-focus);
  outline-offset: 2px;
}

input[type="text"] {
  width: 200px;
  padding: 0.8em 1.2em;
  margin: 0.5rem 0 0.8rem 0;
  border: 1px solid var(--clr-neutral-500);
  border-radius: 0.5rem;
  background-color: var(--clr-neutral-100);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (max-width: 768px) {
  #inventory-container {
  left: 10px;
}
  .storyText {
    height: auto;
    max-height: 250px;
    padding-right: 0.5em;
  }

  .book {
    padding: 1.25rem;
  }
}
