:root {
  --c1-light: #d1e4a0;
  --c1-dark: #aac078;
  --c1-text: #8ead48;
  --c2-light: #edbdbc;
  --c2-dark: #d5999e;
  --c2-text: #ce7f85;
  --c3-light: #bbaad4;
  --c3-dark: #b088d1;
  --c3-text: #966eb7;
  --c4-light: #ffd872;
  --c4-dark: #f9c243;
  --c4-text: #dda118;
}

* {
  box-sizing: border-box;
}

html {
  font-family: "proxima-nova", sans-serif;
  overscroll-behavior-inline: none;
}

.colour-switcher {
  width: 100vw;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  overscroll-behavior-inline: none;
}

.image-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  display: none;

  .center-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: auto;
    z-index: 2;
  }

  .foreground {
    z-index: 4;
    filter: blur(3px);
  }

  .foreground-1 {
    position: absolute;
    top: 50%;
    left: -5%;
    width: 18vw;

    @media (max-width: 768px) {
      width: 30vw;
    }
  }

  .foreground-2 {
    position: absolute;
    top: 20%;
    right: -5%;
    width: 20vw;

    @media (max-width: 768px) {
      width: 30vw;
    }
  }

  .midground {
    z-index: 3;
  }

  .midground-1 {
    position: absolute;
    top: 30%;
    left: 25%;
    width: 10vw;

    @media (max-width: 768px) {
      width: 16vw;
    }
  }

  .midground-2 {
    position: absolute;
    top: 50%;
    right: 25%;
    width: 10vw;

    @media (max-width: 768px) {
      right: 15%;
      width: 22vw;
    }
  }

  .background {
    z-index: 2;
  }

  .background-1 {
    position: absolute;
    top: 50%;
    left: 28%;
    width: 7vw;
  }

  .background-2 {
    position: absolute;
    top: 29%;
    right: 28%;
    width: 12vw;
  }

  .very-background {
    z-index: 1;
  }
}

header {
  position: relative;
  text-align: center;
  padding: 2rem;
  z-index: 2;
  font-weight: 500;
  font-size: clamp(0.75rem, 2vw, 1.2rem);
  line-height: 120%;
  letter-spacing: -0.5%;

  h1 {
    font-weight: inherit;
    margin: 0;
  }
}

.background-font {
  font-family: "proxima-nova", sans-serif;
  font-weight: 700;
  font-style: bold;
  font-size: clamp(3.2rem, 10vw, 7rem);
  line-height: 109.00000000000001%;
  letter-spacing: 0%;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1;
  margin: 0;

  .line:nth-child(even) {
    transform: translateX(100vw);
  }

  .line:nth-child(odd) {
    transform: translateX(-100vw);
  }
}

model-viewer {
  width: 70vw;
  height: 70dvh;
  margin: 0 auto;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  overflow: hidden;

  @media (max-width: 768px) {
    width: 36vh;
    height: 56dvh;
  }

  &.loaded {
    opacity: 1;
  }
}

model-viewer::part(progress-bar) {
  background-color: transparent; /* removes black track */
}

model-viewer::part(default-ar-button) {
  z-index: 100000;
}

.color-switcher-slide {
  width: 100vw;
  height: 100dvh;
  display: grid;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  opacity: 0;

  @media (max-width: 768px) {
    height: 70dvh;
  }

  &.active {
    z-index: 1;
    opacity: 1;
  }

  .centered {
    display: grid;
    place-items: center;
    height: 100%;
    width: 100%;

    .background-font,
    model-viewer {
      grid-row: 1;
      grid-column: 1;
    }
  }

  .details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    z-index: 1;
    padding-block: 2rem;
    opacity: 0;
    transform: translateY(100px);
    padding-inline: 1rem;

    .detail-title {
      font-weight: 700;
    }

    .detail-description {
      max-width: 40ch;
      margin: 0 auto;
    }
  }
}

.content-bottom {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 10;
}

.swatches {
  display: flex;
  justify-content: center;
  gap: 1rem;
  z-index: 1;
}

.fader {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: transparent;
  z-index: 0;
  pointer-events: none;
}

.swatch {
  width: calc(2rem + 4px);
  height: calc(2rem + 4px);
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s ease-in-out;

  .swatch-inner {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 2px solid white;
    transition: box-shadow 0.2s ease-in-out;
    box-shadow: inset 0 -2px 5px rgba(0, 0, 0, 0.5);
  }

  &:hover {
    .swatch-inner {
      box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
    }
  }

  &.swatch-1 {
    .swatch-inner {
      background: var(--c1-dark);
    }
  }

  &.swatch-2 {
    .swatch-inner {
      background: var(--c3-dark);
    }
  }

  &.swatch-3 {
    .swatch-inner {
      background: linear-gradient(to right, var(--c4-dark) 0%, var(--c4-dark) 50%, #a2352d 50.1%, #a2352d 100%);
    }
  }
}

.slide-1 {
  .bg {
    background: linear-gradient(to bottom, var(--c1-light), var(--c1-dark));
  }

  .background-font {
    color: var(--c1-text);
  }

  .swatch-1 {
    border-color: #000;
  }
}

.slide-2 {
  .bg {
    background: linear-gradient(to bottom, var(--c3-light), var(--c3-dark));
  }

  .background-font {
    color: var(--c3-text);
  }

  .swatch-2 {
    border-color: #000;
  }
}

.slide-3 {
  .bg {
    background: linear-gradient(to bottom, var(--c4-light), var(--c4-dark));
  }

  .background-font {
    color: var(--c4-text);
  }

  .swatch-3 {
    border-color: #000;
  }
}

.with-bg {
  .fader {
    &:before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: url("./bg.jpg") no-repeat center center;
      filter: grayscale(100%);
      filter: grayscale(100%) brightness(0.6);
      mix-blend-mode: luminosity;
      mix-blend-mode: hard-light;

      @media (max-width: 768px) {
        background: url("./bg.jpg") no-repeat center -50vh;
      }
    }
  }

  .background-font {
    color: rgba(0, 0, 0, 0.3);
  }
}

.controls {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;

  @media (max-width: 768px) {
    display: none;
  }

  .control-button {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 0;
    cursor: pointer;
    transition: filter 0.2s ease-in-out;

    &:hover {
      filter: invert(1);
    }

    img {
      width: 100%;
      height: 100%;
      pointer-events: none;
    }
  }
}

.with-mouse-orbit {
  .control-button[data-control="with-mouse-orbit"] {
    filter: invert(1) !important;
  }
}

.with-fruit {
  .control-button[data-control="with-fruit"] {
    filter: invert(1) !important;
  }

  .image-container {
    display: block;
  }
}

.with-bg {
  .control-button[data-control="with-bg"] {
    filter: invert(1) !important;
  }
}
