@font-face {
  font-family: "a";
  src: url("./fonts/HealTheWebA-Regular.otf");
}

@font-face {
  font-family: "b";
  src: url("./fonts/HealTheWebB-Regular.otf");
}

@font-face {
  font-family: "AuthenticSans";
  src: url("./fonts/AUTHENTICSans-90.woff"),
    url("./fonts/AUTHENTICSans-90.woff2");
}

body {
  margin: 0;
  padding: 0;
  background-color: #7f7f7f;
  height: 100%;
  font-family: "a";
}

/* ======================================= LOGO ========================================== */

.logo-container {
  display: flex;
  justify-content: start;
  gap: 0;
  width: auto;
  position: fixed;
  text-decoration: none;
  top: 0;
  left: 0;
  padding: 1%;
  z-index: 1000;
  align-items: center;
  mix-blend-mode: difference;
}

.logo-container img {
  height: 3.5vw;
  padding-right: 0.7vw;
  width: auto;
  transition: transform 0.35s ease-in-out, margin 0.4s ease-in-out,
    height 0.2s ease;
}

.logo-container.open img {
  transition: transform 0.42s ease-in-out, margin 0.4s ease-in-out,
    height 0.2s ease;
}

#logo-form2 {
  height: 0.9vw;
  width: auto;
  transform-origin: left;
  transform: translateY(25%);
}

.logo-container.open #logo-form2 {
  width: auto;
  transform: translateY(25%) scaleX(164%);
}

.logo-container.open #logo-form3 {
  margin-left: 24%;
  transition: transform 0.4s ease-in-out, margin 0.4s ease-in-out,
    height 0.2s ease;
}

.logo-container:hover #logo-form2 {
  transform: translateY(25%) scaleX(90%);
  transition: transform 0.4s ease-in-out, margin 0.4s ease-in-out,
    height 0.2s ease;
}

.logo-container:hover #logo-form3 {
  margin-left: -3.5%;
}

/* ================================== MAIN CONTENT ===================================== */

.flexbox-container {
  display: flex;
  width: 85vw;
  height: 100vh;
  overflow: hidden;
}

.flexbox-container.open {
  width: calc(100% - 4rem);
}

.stories {
  width: 100%;
  padding: 2%;
  padding-top: 7.5rem;
  padding-right: 3%;
  padding-bottom: 5%;
  background-color: white;
  overflow-y: scroll;
  display: inline;
  gap: 1em;
  height: auto;
  padding-bottom: 20px;
  scroll-behavior: smooth;
  position: relative;
  box-shadow: 1px 1px 40px grey;
  transition: 0.1s ease;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.stories * {
  text-decoration: none !important;
}

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

.stories.locked {
  width: 53.5%;
  background-color: white;
}

#openForm {
  position: fixed;
  bottom: 0;
  right: 0;
  height: 100%;
  width: 10%;
  border-radius: 1rem;
}

form {
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: 10;
  height: 100%;
  width: 45%;
  padding: 1.5%;
  transform: translateX(calc(100% - 4rem));
  box-shadow: 1px 1px 10px black;
  justify-content: end;
  overflow: auto;
  background-color: rgb(0, 0, 0);
}

form:not(.open):hover {
  transform: translateX(calc(100% - 6rem));
  transition: transform 0.2s ease;
  cursor: pointer;
}

#formIntro {
  margin-top: 5rem;
  margin-bottom: 0rem;
  color: white;
  font-size: 2.4rem;
  font-family: "AuthenticSans" !important;
  line-height: 100%;
}

form.open {
  transform: translateX(0%);
  transition: 0.2s transform;
}

form * {
  opacity: 0;
  color: black;
  overflow: hidden;
  cursor: pointer;
}

form.open * {
  opacity: 1;
  transform: translateX(0%);
  transition-delay: 1s;
  transition: opacity 0.2s;
  cursor: auto;
}

form #add {
  position: fixed;
  left: 0;
  width: 4rem;
  height: 100%;
  top: 50%;
  font-size: 4rem;
  transform: translatey(-50%);
  background-color: transparent;
  color: white;
  border: none;
  font-family: "b";
  cursor: pointer;
  opacity: 1;
}

form.open #add {
  display: none;
}

#radio-group {
  display: flex;
  gap: 0;
  margin-bottom: 0.6rem;
}

#radio-group button {
  width: 100%;
  height: 100%;
  background-color: white;
  color: black;
  padding: 1rem;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-family: "AuthenticSans", sans-serif !important;
  border: 0.06rem solid black;
  cursor: pointer;
}

#radio-group button:first-child {
  border-radius: 1rem 0 0 1rem;
}

#radio-group button:last-child {
  border-radius: 0vw 1rem 1rem 0vw;
}

#radio-group button.active,
#radio-group button:hover {
  background-color: #b78ed2;
}

#content-input {
  /* height: 0vh; */
  width: 100%;
}

#content-input.active {
  /* height: 25rem; */
  margin-bottom: 1rem;
}

#content-input button {
  font-family: "b";
  background-color: white;
  border: none;
  cursor: pointer;
  font-size: 2.1rem;
  height: 100%;
  padding: 1rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
}

#content-input button:hover {
  background-color: #66ff8a;
}

.clearPreview {
  margin-top: 0rem;
}

.clearPreview:hover {
  background-color: #ff8366 !important;
}

.image-upload-preview img {
  max-height: 40vh;
  object-fit: contain;
  display: flex;
  margin: 1vh;
  justify-content: center;
  width: 100%;
}

.tree {
  background-color: rgb(223, 223, 223);
  width: 5%;
  font-size: 5rem;
  cursor: pointer;
  overflow: hidden;
  transition: 0.2s ease;
  pointer-events: all;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
}

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

.tree * {
  filter: blur(7px);
}

.tree.open * {
  filter: blur(0);
}

.tree.open {
  width: 100%;
  overflow: auto;
}

.tree.locked * {
  pointer-events: none;
  width: 100%;
}

.tree-entry.notFetched {
  border-left: none;
  color: white !important;
  filter: blur(5px) grayscale(1) brightness(0.1) !important;
  opacity: 0.3;
  position: relative;
}

.notFetched .fullname {
  display: none;
}

#treeZoom {
  display: flex;
  position: fixed;
  justify-content: space-between;
  bottom: 0;
  left: 52vw;
  width: 100%;
  width: auto;
  z-index: 8;
  line-height: 140%;
  font-size: 3rem;
  color: white;
}

#slider {
  width: 11rem;
  height: auto;
  transform: scaleX(50%);
  transition: 0.4s ease;
  cursor: grab;
  margin-top: -0.4rem;
  transform-origin: left;
  align-items: center;
}

#treePlus {
  user-select: none;
}

#treeMinus {
  margin-right: 0.2rem;
  user-select: none;
}

.story-part {
  display: inline;
  max-height: auto;
  max-width: 100%;
  overflow: scroll;
  color: rgb(0, 0, 0);
}

.entry {
  color: rgb(0, 0, 0);
  font-size: 2.7rem;
  line-height: 125%;
  cursor: pointer;
  pointer-events: auto;
  hyphens: auto;
  border-radius: 1rem 1rem 1rem 1rem;
}

.locked .entry {
  opacity: 0.4;
  filter: blur(15px);
  transition: filter 0.3s, opacity 0.3s;
}

.locked a:nth-last-child(1) .entry {
  filter: blur(0);
  opacity: 1;
}

.locked a:nth-last-child(1) .sound-part * {
  pointer-events: all;
}

.locked a:nth-last-child(2) .entry {
  filter: blur(7px);
  opacity: 0.9;
}

.locked a:nth-last-child(3) .entry {
  filter: blur(10px);
  opacity: 0.8;
}

.locked a:nth-last-child(4) .entry {
  filter: blur(14px);
  opacity: 0.7;
}

.entry:hover,
.hovered {
  background-color: rgb(242, 242, 242);
  border-radius: 0;
  box-shadow: 1px 1px 10px rgb(255, 255, 255);
}

.tree-entry:not(.notFetched):hover,
.tree-entry:not(.notFetched).hovered {
  border-radius: 0;
  padding: 0rem !important;
  border: none;
  color: black;
}

.tree-entry {
  display: flex;
  padding-left: 0;
  padding: 0.8rem;
  font-family: "b";
  text-transform: uppercase;
  width: 4.5rem;
  transform: scale(1.15);
  margin-left: 2rem;
  text-decoration: none;
  border-radius: 0rem 1rem 1rem 0rem;
  border-left: 0.2rem dashed rgb(255, 255, 255);
  color: rgb(255, 255, 255);
  justify-content: start;
  scroll-snap-align: end;
}

/* Ensure all tree-entries are positioned for z-index to work */
.tree-entry {
  position: relative;
  z-index: 5;
  transition: .2s ease;
}

.tree-entry.notFetched {
  z-index: 1 !important;
  position: relative;
}

.tree-entry:not(.notFetched) {
  z-index: 10 !important;
  position: relative;
}

.tree-entry:not(.notFetched) .fullname {
  z-index: 20 !important;
  position: relative;
}

/* Hovered fullname is always on top */
.fullname.hovered {
  z-index: 30 !important;
  position: absolute;
  left: 0;
  top: 0;
}

.tree.small .tree-entry {
  padding: 0.4rem;
  width: 2rem;
}

.tree.small .fullname {
  transform: translateX(-0.5rem);
}

.tree.big .tree-entry {
  padding: 1.6rem;
  width: 8rem;
}

.tree.big .fullname {
  transform: translateX(-1.8rem);
  border-left: 0.2rem dashed rgb(255, 255, 255) !important;
}

.fullname {
  color: rgb(0, 0, 0);
  font-size: 0rem;
  position: relative;
  transform: translateX(-0.9rem);
}

.notFetched .fullname {
  display: none;
}

.tree.big .fullname {
  border: none;
}

.fullname.hovered {
  text-align: left;
  padding: 0.5rem;
  font-size: 2.7rem;
  box-shadow: none;
  border-left: 0.2rem dashed rgb(255, 255, 255);
}

.split-branches {
  display: flex;
  flex-direction: row;
  justify-content: center;
  width: auto;
  scroll-snap-align: end;
  border-top: 0.2rem dashed rgb(255, 255, 255);
}

.branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
}

.story-part sup {
  margin-right: 0.3em;
}

.image-part {
  display: inline;
  max-height: 0.8em;
}

.image-part.big,
.locked a:nth-last-child(1) .image-part {
  max-height: 70dvh;
  max-width: 100%;
}

.audio-play-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: white;
  font-size: 1em;
  padding: 0;
  display: inline;
}

.input-name {
  border-radius: 1vw;
  width: 75%;
  margin-bottom: 2rem;
  font-family: "b";
  text-transform: uppercase;
  font-size: 4rem;
  background-color: #ffffff;
  border: none;
  text-align: center;
  padding: .6rem 0 0 0;
}

.input-name::-webkit-input-placeholder {
  color: grey;
}

.input-name:-ms-input-placeholder {
  color: grey;
}

.input-name::placeholder {
  color: grey;
}

.input-name:focus {
  outline: none;
}

.textfeld,
.skizze-canvas {
  width: 100%;
  height: 100%;
  border: none;
  resize: none;
  padding: 3%;
  border-radius: 10px;
  font-size: 1rem;
  font-size: 2.4rem !important;
  font-family: "a";
  box-sizing: border-box;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
  background-color: white;
}

.textfeld:focus {
  outline: none;
}

.text-sm {
  position: absolute;
  bottom: 0rem;
  right: 1rem;
  font-size: 1.2rem;
}

.word-counter {
  font-size: 0.9rem;
  margin-top: 4px;
  color: #555;
  text-align: right;
}

.word-counter.over-limit {
  color: red;
  font-weight: bold;
}

.image-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 10px;
  margin-top: 0.5em;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

.input-foto,
.skizze-canvas,
.audio-recorder {
  display: none;
}

.publish {
  font-family: "AUTHENTICSans", sans-serif !important;
  font-size: 2.8rem;
  width: auto;
  border-radius: 1rem;
  margin-top: 1.5rem;
  line-height: 200%;
  width: calc((100% - 64px) - 2rem);
  border: 0.2rem solid black;
  background-color: white;
  cursor: pointer !important;
  bottom: 0.7rem;
  position: relative;
}

.publish:hover {
  background-color: #66ff8a;
}

label {
  color: white;
}

.content {
  display: contents;
}

/* help styling @jule */
.help-icon {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 4rem;
  height: 4rem;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 4rem;
  color: rgb(102, 138, 255);
  font-family: "b";
  cursor: pointer;
  z-index: 101;
}

#help {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 90%;
  height: 100%;
  background-color: rgb(255, 131, 102);
  border-radius: 0;
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow: hidden !important;
  box-shadow: -4px 0px 20px rgba(0, 0, 0, 0.3);
}

.help-icon:hover + #help:not(.open) {
  transform: translateX(calc(100% - 4rem));
}

#help.open {
  transform: translateX(0%) !important;
}

#help-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  padding: 3rem;
  padding-top: 5rem;
  padding-bottom: 0rem;
  padding-right: 8rem;
  color: black;
  font-family: "b", sans-serif;
  font-size: 2.7rem;
  opacity: 0;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Content wird nur bei vollständiger Öffnung sichtbar */
#help.open #help-container {
  opacity: 1;
  transition: opacity 0.3s ease 0.2s;
}

#help:not(.open) #help-container {
  opacity: 0;
}

#help-container ul {
  margin: 0.5rem 0;
  font-family: "AUTHENTICSANS", sans-serif;
  padding-left: 1rem;
  font-size: 1.4rem;
}

#help-container a {
  color: rgb(89, 89, 89);
}

#help-container li {
  margin: 0.6rem 0;
  list-style: none;
  position: relative;
  padding-left: 4rem;
  max-width: 70%;
}

#help-container li span {
  color: rgb(89, 89, 89);
}

#help-container li::before {
  content: "—";
  position: absolute;
  left: 0;
  font-family: "b";
  top: 0;
  color: black;
}

#credits {
  font-size: 1rem;
  padding: 0rem;
  line-height: 1.3rem;
  font-family: "AUTHENTICSANS", sans-serif;
}

.sound-part {
  display: inline-flex;
  align-items: center;
  transform: translateY(-0rem);
}

.audio-player {
  font-size: 1.5rem;
  display: inline;
  color: black;
  line-height: 120%;
  padding: 0 0.8rem 0 0.2rem;
}

.audio-player .controls {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
}

.audio-player button {
  background-color: transparent;
  border: none;
  color: inherit;
  font-size: 1em;
  margin: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.audio-player button img {
  height: 1em;
  width: 1em;
}

.audio-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.audio-time {
  font-size: 1em;
  line-height: 1.5;
  margin-top: 0.15em;
}

.audio-progress-bar {
  width: 7rem;
  display: block;
}

input[type="range"] {
  position: relative;
  min-height: 0.7rem;
  background-color: transparent;
  -webkit-appearance: none;
  height: 100%;
  display: inline;
  width: auto;
  margin: 0;
  padding: 0;
}

.audio-preview {
  margin-top: 0.5em;
  border-radius: 20px;
}

.audio-upload-play {
  display: flex;
  justify-content: center;
  margin: auto;
  width: 100%;
  background-color: #b78ed2 !important;
}

.audio-upload-play .audio-progress {
  width: 100% !important;
  height: auto;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  background: url("assets/slider-thumb.svg");
  background-size: 100% 100%;
  width: 1rem;
  height: 1rem;
  pointer-events: auto;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  z-index: 10;
}

/* apparently this cant be styled together but needs to be duplicate */

input[type="range"]::-moz-range-thumb {
  appearance: none;
  background: url("assets/slider-thumb.svg");
  background-size: 100% 100%;
  width: 1rem;
  height: 1rem;
  pointer-events: auto;
  position: relative;
  cursor: pointer;
  z-index: 10;
  border: none;
}

/* progress (before the thumb) */
/* chrome */
input[type="range"]::before {
  position: absolute;
  content: "";
  top: 15%;
  left: 0;
  width: calc(var(--val) - var(--per) * 1rem - 0.1rem);
  height: 50%;
  cursor: pointer;
  background: url("./assets/slider-squiggly.svg");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

/* firefox */
input[type="range"]::-moz-range-progress {
  height: 50%;
  background: url("./assets/slider-squiggly.svg");
  background-repeat: no-repeat;
  background-size: calc(100% - var(--per) * 1rem - 0.1rem) 100%;
}

input[type="range"]::-moz-range-track {
  --point: calc(var(--val) + (1 - var(--per)) * 1rem + 0.1rem);
  width: 100%;
  height: 0.18em;
  cursor: pointer;
  background: linear-gradient(
    to right,
    transparent var(--point),
    black var(--point)
  );
}

input[type="range"]::-webkit-slider-runnable-track {
  --point: calc(var(--val) + (1 - var(--per)) * 1rem + 0.1rem);
  width: 100%;
  height: 0.18em;
  cursor: pointer;
  background: linear-gradient(
    to right,
    transparent var(--point),
    black var(--point)
  );
}

canvas {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 1rem;
  touch-action: none;
}

.drawing-inputs {
  color: black;
  background-color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-radius: 1rem;
  margin-top: 0rem;
}

input[type="color"] {
  -webkit-appearance: none;
  background-color: black;
  border-radius: 0.5rem;
  border: 1px solid black;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
}

input[type="color"]::-moz-color-swatch {
  border: none;
}

.pen-size-range {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  height: 1rem;
  align-items: center;
}

#pen-size-small-label {
  width: 5px;
  height: 5px;
}

#pen-size-big-label {
  width: 40px;
  height: 40px;
}

#close {
  display: none;
}

@media (max-width: 768px) {
  .logo-container {
    padding: 2%;
    margin-top: 1%;
  }

  .logo-container img {
    height: 9vw;
    padding-right: 1.3vw;
  }

  #logo-form2 {
    height: 2.1vw;
  }

  .logo-container.open #logo-form2 {
    height: 1.9vw;
  }

  .logo-container.open #logo-form3 {
    margin-left: 21.5%;
  }

  .logo-container:hover #logo-form3 {
    margin-left: -3.5%;
  }

  .flexbox-container {
    display: flex;
    flex-direction: row;
    overflow-x: hidden;
    height: calc(100dvh - 6rem);
    width: auto !important;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 0vw;
  }

  .flexbox-container.open {
    overflow-x: auto;
  }

  .stories {
    width: 85vw;
    min-width: 85vw;
    flex-shrink: 0;
    scroll-padding-left: 15vw;
    display: block;
    scroll-snap-align: start;
  }

  .tree {
    max-width: 90vw;
    flex-shrink: 0;
    scroll-padding-right: 15vw;
    display: block;
    scroll-snap-align: end;
  }

  .stories {
    padding-top: 16vw;
  }

  .tree.locked {
    width: 10vw !important;
    min-width: 10vw;
  }

  /* Optional: hide vertical scrollbars */
  .stories::-webkit-scrollbar,
  .tree::-webkit-scrollbar {
    display: none;
  }

  form {
    width: 100vw;
    bottom: 0;
    padding-top: 0rem !important;
    height: auto;
    transform: translateX(0) translateY(calc(100% - 6rem));
    transition: 0s;
  }

  form.mobile-open {
    width: 96vw;
    padding: 2vw;
    transform: translateX(0) translateY(0) !important;
    top: 14vw !important;
  }

  form.open {
    transform: translateX(0) translateY(calc(100% - 6rem));
  }

  form.open *:not(#add) {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  form.mobile-open *:not(#add) {
    opacity: 1;
    pointer-events: all;
    transition: opacity 0.3s;
  }

  form.open #add {
    display: block;
  }

  .mobile-open #add {
    display: none !important;
  }

  form:not(.open):hover {
    transform: translateX(0) translateY(calc(100% - 6rem));
  }

  #add {
    left: 47vw !important;
    width: 100% !important;
    height: auto !important;
    top: 0% !important;
    padding-top: 1rem;
    font-size: 6.5vw !important;
    font-family: "AUTHENTICSANS", sans-serif !important;
    transform: translateX(-50%) !important;
    z-index: 5000000;
  }

  #formIntro {
    display: none;
  }

  #help {
    font-size: 1rem !important;
  }

  #close {
    position: absolute;
    right: 0;
    top: 0;
    padding: 0.7rem;
    text-align: right;
    font-size: 1.4rem;
    z-index: 1000;
    display: block;
    color: white;
    cursor: pointer;
  }

  #add:after {
    content: " Führe die Geschichte fort";
  }

  .help-icon {
    font-size: 8vw;
    padding: 2vw !important;
    width: auto;
    height: auto;
  }

  #radio-group button {
    font-size: 4vw;
    padding: 0.7rem;
    border: 0.06vw solid black;
  }

  #content-input button {
    padding: 0.7rem;
    font-size: 5vw;
  }

  .textfeld {
    font-size: 1.3rem !important;
  }

  .text-sm {
    font-size: 1rem;
  }

  .input-name {
    font-size: 2rem;
    width: 66%;
    border-radius: 0.5rem;
    padding: .5rem 0 .3rem 0;
  }

  .textfeld,
  .canvas {
    border-radius: 0.5rem !important;
  }

  .publish {
    font-size: 6.3vw;
    color: black;
    padding-top: .5rem;
  }

  .entry,
  .tree-entry,
  .hovered .fullname {
    font-size: 1.4rem;
    color: black;
  }

  .audio-player {
    font-size: 1.2rem;
  }

  .tree-entry {
    width: 2.5rem;
    padding: 0.7rem;
  }

  #treeZoom {
    display: none;
  }

  #help {
    width: 100%;
  }

  #help-container {
    left: 0;
    padding: 1rem;
    padding-top: 13vw;
  }

  #help *:not(#credits, * :first-child) {
    font-size: 1.2rem;
    line-height: 130%;
  }

  .help-icon:hover + #help:not(.open) {
    transform: translateX(100%);
  }
  
  .fullname {
    transform: translateX(-0.8rem);
  }
}
