:root {
  /* Colors */
  --color-red: #e53946;
  --color-blue-dark: #1d2557;
  --color-blue-light: #d0e6ff;
  --color-white: #f1faee;
  --color-brown-dark: #4d3229;
  --color-brown-light: #5c3d32;

  /* Space */
  --space-3xs: clamp(0.25rem, 0.2292rem + 0.0926vw, 0.3125rem);
  --space-2xs: clamp(0.5rem, 0.4583rem + 0.1852vw, 0.625rem);
  --space-xs: clamp(0.75rem, 0.6875rem + 0.2778vw, 0.9375rem);
  --space-s: clamp(1rem, 0.9167rem + 0.3704vw, 1.25rem);
  --space-m: clamp(1.5rem, 1.375rem + 0.5556vw, 1.875rem);
  --space-l: clamp(2rem, 1.8333rem + 0.7407vw, 2.5rem);
  --space-xl: clamp(3rem, 2.75rem + 1.1111vw, 3.75rem);
  --space-2xl: clamp(4rem, 3.6667rem + 1.4815vw, 5rem);
  --space-3xl: clamp(6rem, 5.5rem + 2.2222vw, 7.5rem);

  /* Fontsize */
  --fontsize-2xs: clamp(0.6944rem, 0.6593rem + 0.1564vw, 0.8rem);
  --fontsize-xs: clamp(0.8333rem, 0.7778rem + 0.2469vw, 1rem);
  --fontsize-s: clamp(1rem, 0.9167rem + 0.3704vw, 1.25rem);
  --fontsize-m: clamp(1.2rem, 1.0792rem + 0.537vw, 1.5625rem);
  --fontsize-l: clamp(1.44rem, 1.269rem + 0.7602vw, 1.9531rem);
  --fontsize-xl: clamp(1.728rem, 1.4902rem + 1.0569vw, 2.4414rem);
  --fontsize-2xl: clamp(2.0736rem, 1.7475rem + 1.4491vw, 3.0518rem);
  --fontsize-3xl: clamp(2.4883rem, 2.0462rem + 1.965vw, 3.8147rem);
}

/* -----GENERAL----- */
* {
  box-sizing: border-box;
}

html {
  font-family: Arial, Helvetica, sans-serif;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Berkshire Swash";
  color: var(--color-red);
}

a {
  text-decoration: none;
  color: inherit;
}

a:visited {
  color: inherit;
}

.hidden {
  display: none !important;
  position: absolute !important;
}

/* -----HEADER----- */
.body__header {
  background-color: rgb(255, 132, 0);
  height: 3dvh;
}

/* -----MAIN----- */
.body__main section {
  min-height: 100dvh;
}

/* FOLD */
.main__fold {
  background: url("../assets/fold-img-2.svg"), url("../assets/mountains.svg"), linear-gradient(to bottom, rgb(255, 132, 0) 5%, rgb(248, 146, 153) 20%);

  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: var(--space-2xl);
}

.fold__text {
  align-self: flex-end;
  position: relative;
  top: -5rem;
  margin-right: var(--space-l);

  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.fold__title {
  font-weight: bold;
  font-size: 8rem;
  color: var(--color-red);
  text-shadow: 0px 5px 5px var(--color-blue-dark);
}

.fold__tagline {
  font-size: var(--fontsize-m);
  color: var(--color-blue-dark);
  margin-left: var(--space-m);
  font-style: italic;
}

.fold__canvas {
  margin-right: var(--space-l);
  position: relative;
  top: -7.5rem;
  left: -2.5rem;

  display: grid;
  grid-template-rows: 1fr;
  grid-template-columns: 1fr;
  justify-items: center;
  align-items: center;
}

.fold__canvas canvas {
  grid-row: 1;
  grid-column: 1;

  width: 680px;
  height: 420px;
}

.canvas__back {
  display: none;
}

.canvas__background {
  grid-row: 1;
  grid-column: 1;
  width: 110%;
  text-shadow: 0px 0px 5px red;
}

.canvas__front {
  z-index: +1;
  padding: 1rem 0 1.5rem 1.5rem;
}

.canvas__info {
  grid-row: 1;
  grid-column: 1;

  text-align: center;

  font-size: var(--fontsize-s);
  font-weight: bold;
  color: var(--color-blue-light);
}

.canvas__hint {
  color: var(--color-blue-dark);
  position: relative;
  top: -2.5rem;
  opacity: 0;

  transition: all 500ms ease;
}

.canvas__hint--active {
top: -5rem;
opacity: 0.5;
}

/* STORY */
.main__story {
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-s);
  row-gap: var(--space-3xl);

  background-color: white;

  margin-top: 7.5rem;
}

.story__intro {
  position: absolute;
  width: 100%;
  margin-top: -7.5rem;
  text-align: center;
  font-size: var(--fontsize-m);
  font-weight: bold;
  font-style: italic;
  color: var(--color-blue-dark);
}

.story__path {
  grid-row: 1/5;
  grid-column: 1/5;
  padding: var(--space-m) 0;
}

#motion-path {
  stroke: transparent;
}

.story__skier {
  width: 10rem;
}

.main__story article {
  min-height: fit-content;
  max-width: 70%;
}

.part__one {
  grid-row: 1;
  grid-column: 1/3;

  position: relative;
  top: 4rem;
  left: 25rem;
}

.part__two {
  grid-row: 2;
  grid-column: 3/5;

  position: relative;
  top: -11rem;
  left: -7.5rem;
}

.part__three {
  grid-row: 3;
  grid-column: 1/3;

  position: relative;
  top: 2.5rem;
  left: 40rem;
}

.part__four {
  grid-row: 4;
  grid-column: 3/5;

  position: relative;
  top: 8rem;
  left: -10rem;
}

.story__title {
  font-size: var(--fontsize-xl);
}

.story__text {
  font-size: var(--fontsize-s);
  line-height: 120%;
  margin-top: var(--space-xs);
  margin-left: var(--space-xs);
}

/* GAME */
.main__game {
  display: grid;
  grid-template-rows: 1fr;
  grid-template-columns: 1fr;

  background-image: url("../assets/game-bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  height: 100dvh;
  border-top: 30px solid var(--color-red);
}

.game__components {
  grid-row: 1;
  grid-column: 1;

  width: 100%;
  height: 100%;

  display: flex;
  flex-direction: column;
  align-items: center;
}

.game__canvas {
  display: none;
}

.game__character {
  position: relative;
  top: 10rem;

  width: 6rem;
  height: 4rem;
}

.game__character img {
  rotate: 90deg;
}

.game__obstacles {
  grid-row: 1;
  grid-column: 1;

  width: 50%;
  height: 100%;
  margin: auto;

  overflow-y: hidden;
  overflow-x: visible;

  position: relative;
}

.obstacle {
  position: absolute;
  top: 0;
  width: 4rem;
  height: 4rem;

  background-image: url("../assets/rock.webp");
  background-size: contain;
  background-repeat: no-repeat;

  z-index: +1;
}

.game__info {
  grid-row: 1;
  grid-column: 1;
  position: relative;

  background-color: rgba(0, 0, 0, 0.5);

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  text-align: center;
  z-index: +2;
}

.game__start {
  background: linear-gradient(to bottom, #90ee90, green);
  color: white;
  font-size: var(--fontsize-l);
  font-weight: bold;

  width: fit-content;
  height: fit-content;
  padding: var(--space-m);
  border: 5px solid darkgreen;
  border-radius: 15px;

  transform: scale();

  cursor: pointer;
  z-index: +2;

  transition: all 200ms ease;
}

.game__start:hover {
  transform: scale(110%);
}

.game__instructions {
  background-color: white;

  width: fit-content;
  height: fit-content;
  padding: var(--space-s);
  border-radius: 15px;
  box-shadow: 0 0 5px black;
  margin-top: var(--space-m);

  justify-self: center;
}

/* -----FOOTER----- */
.body__footer {
  background-color: var(--color-red);
  color: var(--color-white);
  text-align: center;
  padding: var(--space-xs);
  margin-top: -2.9rem;
  position: relative;
  z-index: 10000;
}

/* popup */
.popup {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
  z-index: 9999;
}

.popup.open {
  opacity: 1;
  pointer-events: auto;
}

.popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.popup__box {
  position: relative;
  z-index: 2;
  background: white;
  color: #111;
  padding: 2rem;
  border-radius: 12px;
  width: min(420px, 90vw);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.popup__title {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: bold;
}

.popup__message {
  margin: 0 0 1rem 0;
}

.popup__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.popup__btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 0;
  cursor: pointer;
}

.popup__close {
  background: #ddd;
}

.popup__restart {
  background: #4caf50;
  color: white;
}
