main > menu#options {
  position: fixed;
  left: 2rem;
  top: 7rem;
  bottom: 5rem;
  width: 23rem;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--colors--block);
  backdrop-filter: blur(0.5rem);
  border-radius: 0.25rem;
  overflow: clip;
  margin: 0;
  padding: 0;
  user-select: none;

  > li {
    list-style: none;
    padding: 0;
    margin: 0;
    height: 3rem;
    overflow: clip;
    transition: height 0.25s;
    display: grid;
    grid-template-rows: auto 1fr;
    align-items: start;
    align-content: start;
    border-bottom: solid 1px rgba(0, 0, 0, 0.1);

    &:last-child {
      border-bottom: none;
    }

    &.--disabled {
      pointer-events: none;
      opacity: 0.5;
    }

    &.--active {
      height: calc(100% - ((var(--_count, 7) - 1) * 3rem));
      background: color-mix(in srgb, var(--colors--primary), transparent 95%);      

      > header {
        color: white;
        background: var(--colors--primary);

        i {
          transform: rotate(0);
        }
      }
    }

    > header {
      padding: 0 3rem 0 1rem;
      height: 3rem;
      position: relative;
      cursor: pointer;
      display: flex;
      place-items: center;
      gap: 1rem;
      box-shadow: var(--shadow);
      transition: all 0.25s;

      &:hover {
        background: var(--colors--primary);
        color: white;
      }

      span:first-child {
        flex: 1;
      }

      i {
        padding: 1rem;
        display: flex;
        place-items: center;
        place-content: center;
        right: 0;
        position: absolute;
        top: 0;
        bottom: 0;
        transform: rotate(90deg);
        transition: transform 0.5s;
      }
    }

    > section {
      margin: 0;
      overflow: auto;
      padding: 1rem;
      height: 100%;
      display: grid;
      gap: 1rem;
      align-items: start;
      align-content: start;

      button {
        border: none;
        background: var(--_button-background, var(--colors--area));
        border-radius: 0.25rem;
        padding: 1rem;
        max-height: unset;
        height: unset;
      }
    }
  }
}

main > #view-actions {
  position: fixed;
  left: 27rem;
  top: 9rem;
  display: flex;
  margin: 0;
  padding: 0;
  border-radius: 0.25rem;
  box-shadow: var(--shadow);
  background: var(--colors--block);
  backdrop-filter: blur(0.5rem);
  color: var(--colors--primary);
  z-index: 0;

  > label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-left: 1px solid color-mix(in srgb, currentColor, transparent 80%);
    color: light-dark(var(--colors--primary), white);
    font-size: 0.875rem;

    input {
      width: 4rem;
      padding: 0;
      border: none;
      background: transparent;
      color: inherit;
      font-size: inherit;

      &:focus-visible {
        outline: 2px solid currentColor;
        outline-offset: 2px;
      }
    }
  }

  > button {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: none;
    background: transparent;
    line-height: 1.5rem;
    cursor: pointer;
    border-radius: unset;
    

    &:disabled {
      cursor: wait;
      opacity: 0.5;
    }

    &:not([hidden]) + button {
      border-left: 1px solid color-mix(in srgb, currentColor, transparent 80%);
    }

    i {
      font-size: 1.25rem;
    }

    small {
      font-size: 0.875rem;
    }
  }
}

main > aside#info {
  position: fixed;
  left: 2rem;
  top: 7rem;
  width: 23rem;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--colors--primary), transparent 10%);
  backdrop-filter: blur(0.5rem);
  border-top-right-radius: 0.25rem;
  border-bottom-right-radius: 0.25rem;
  overflow: clip;
  user-select: none;
  transform: translate(0, calc(3rem * var(--_i)));
  color: white;
  line-height: 1.5;
  font-size: 0.875rem;
  opacity: 0;
  transition: opacity 0.5s, transform 0.5s;
  transition-delay: 1s;
  padding-left: 1rem;
  
  > section {
    padding: 2rem;
    white-space: pre-wrap;

    &:empty {
      display: none;
    }

    &[data-type="action"], &[data-type="dynamic"] {
      background: var(--colors--area);
    }
    
    & > video {
      width: calc(100% + 4rem);
      height: auto;
      margin: -2rem;
    }
  }

  button.link {
    width: 100%;
    margin-top: 1rem;
  }

  > a {
    text-decoration: none;
  }

  &:hover, &.--active {
    opacity: 1;
    transform: translate(calc(100% - 1rem), calc(3rem * var(--_i)));
    transition-delay: 0s;
  }
}

main > aside#moose-advice {
  position: fixed;
  right: 2rem;
  bottom: 18rem;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(16rem, 23rem) 11rem;
  align-items: end;
  width: min(34rem, calc(100vw - 2rem));
  pointer-events: none;
  opacity: 0;
  transform: translate(110%, 2rem) rotate(4deg);
  transform-origin: bottom right;
  transition: opacity 0.25s, transform 0.35s ease-in;

  > section {
    position: relative;
    margin-bottom: 3rem;
    padding: 1.5rem;
    border-radius: 0.25rem;
    box-shadow: var(--shadow);
    background: var(--colors--block);
    backdrop-filter: blur(0.5rem);

    &::after {
      content: '';
      position: absolute;
      left: 100%;
      bottom: 1.5rem;
      width: 1.25rem;
      height: 1.5rem;
      background: var(--colors--block);
      clip-path: polygon(0 0, 100% 50%, 0 100%);
    }
  }

  menu {
    display: flex;
    gap: 0.75rem;
    margin: 1rem 0 0;
    padding: 0;

    button {
      padding: 0.75rem 1rem;
      background: var(--colors--primary);
      color: white;
      cursor: pointer;

      &:last-child {
        background: var(--colors--area);
        color: inherit;
      }
    }
  }

  > figure {
    z-index: 1;
    display: grid;
    width: 13rem;
    margin: 0 0 0 -1rem;
    filter: drop-shadow(0 0.5rem 0.75rem rgba(0, 0, 0, 0.2));

    > img {
      grid-area: 1 / 1;
      width: 100%;
      transition: opacity 0.15s;

      &:not([data-expression="neutral"]) {
        opacity: 0;
      }
    }
  }

  &:has(button[value="apply"]:is(:hover, :focus-visible)) > figure > img,
  &:has(button[value="dismiss"]:is(:hover, :focus-visible)) > figure > img {
    opacity: 0;
  }

  &:has(button[value="apply"]:is(:hover, :focus-visible)) > figure > img[data-expression="happy"],
  &:has(button[value="dismiss"]:is(:hover, :focus-visible)) > figure > img[data-expression="sad"] {
    opacity: 1;
  }

  &[data-response] > figure > img {
    opacity: 0;
  }

  &[data-response="apply"] > figure > img[data-expression="celebrate"],
  &[data-response="dismiss"] > figure > img[data-expression="sad"] {
    opacity: 1;
  }

  &.--active {
    pointer-events: auto;
    opacity: 1;
    transform: none;
    transition: opacity 0.25s, transform 0.65s cubic-bezier(0.2, 1.4, 0.4, 1);

    > section {
      animation: moose-speech-in 0.4s 0.2s backwards;
    }

    > figure {
      animation: moose-peek-in 0.7s 0.05s backwards;
    }
  }

  &[data-response="apply"] > figure {
    animation: moose-celebrate 0.4s 2;
  }

  &[data-response="dismiss"] > figure {
    animation: moose-sad-laugh 0.4s 2;
  }

  @media screen and (max-width: 700px) {
    right: 1rem;
    grid-template-columns: minmax(0, 1fr) 7rem;
    width: calc(100vw - 2rem);

    > figure {
      width: 8.5rem;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    transition: none;

    > figure > img {
      transition: none;
    }

    &.--active {
      transition: none;

      > :is(section, figure) {
        animation: none;
      }
    }
  }
}

@keyframes moose-peek-in {
  0% {
    transform: translate(3rem, 3rem) rotate(8deg);
  }

  65% {
    transform: translate(-0.5rem, -0.25rem) rotate(-2deg);
  }

  100% {
    transform: none;
  }
}

@keyframes moose-speech-in {
  from {
    opacity: 0;
    transform: translateX(2rem) scale(0.9);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes moose-celebrate {
  50% {
    transform: translateY(-0.5rem) rotate(-2deg);
  }
}

@keyframes moose-sad-laugh {
  25%, 75% {
    transform: translateY(0.15rem) rotate(1deg);
  }

  50% {
    transform: translateY(-0.15rem) rotate(-1deg);
  }
}

main > menu#view {
  display: flex;
  position: fixed;
  left: 27rem;
  bottom: 5rem;
  line-height: 1;
  box-shadow: var(--shadow);
  background: var(--colors--block);
  backdrop-filter: blur(0.5rem);
  border-radius: 0.25rem;
  overflow: clip;
  margin: unset;
  padding: unset;

  li {
    list-style: none;
    cursor: pointer;
    border-right: solid 1px var(--colors--block);
    padding: 1rem;

    &:last-child {
      border-right: none;
    }
  }
}

main > footer {
  display: grid;
  gap: .75rem;
  position: fixed;
  right: 2rem;
  bottom: 5rem;
  width: 23rem;
  padding: 2rem;
  line-height: 1;
  isolation: isolate;

  &::before {
    position: absolute;
    inset: 0;
    content: '';
    border-radius: 0.25rem;
    box-shadow: var(--shadow);
    background: var(--colors--block);
    backdrop-filter: blur(0.5rem);
    z-index: -1;
  }

  data#configuration-price {
    display: grid;
    font-size: 1.5em;
    font-weight: bold;
    overflow: hidden;
    max-width: 10ch;

    &.--error > .configuration-price--value {
      font-size: 1rem;
    }

    > span {
      grid-area: 1 / 1;
      transition: opacity 0.5s ease, transform 0.5s ease;
    }

    > .configuration-price--value {
      opacity: 1;
      transform: translateX(0);
    }

    > .configuration-price--loader {
      display: grid;
      place-items: center start;
      opacity: 0;
      transform: translateX(-100%);
    }

    &.--pending {
      > .configuration-price--value {
        opacity: 0;
        transform: translateX(1.5rem);
      }

      > .configuration-price--loader {
        opacity: 1;
        transform: translateX(0);
      }
    }
  }

  > div.order--action {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    padding: 2rem;
    display: flex;
    gap: 1rem;
    cursor: pointer;

    > div {
      display: grid;
      place-items: center;
      place-content: center;
      padding-top: 1rem;

      > i, > img {
        grid-row: 1;
        grid-column: 1;
      }

      > img {
        border-radius: 50%;
        height: 2rem;
        width: 2rem;
      }

      > i {
        font-size: 1rem;
        text-shadow: 0 0 1px black;
        color: white;
      }
    }
    
    > i {
      font-size: 3rem;
      display: flex;
      align-items: center;
    }
  }

  > div.order--info {
    position: absolute;
    padding: 2rem;
    left: 0;
    right: 0;
    bottom: calc(100% - 0.25rem);
    background: color-mix(in srgb, var(--colors--primary), transparent 10%);
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
    backdrop-filter: blur(0.5rem);
    box-shadow: var(--shadow);
    color: white;
    transition: height 0.5s, transform 0.5s;
    z-index: -2;
    display: grid;
    gap: 0.75rem;
    overflow: clip;
    height: 3rem;
    transform: translateY(1rem);
    align-items: start;
    grid-template-rows: 1fr auto;    

    > section {
      display: grid;
      gap: 0.75rem;

      &:first-child {

        > header {
          position: sticky;
          top: -2rem;
          padding: 1rem 2rem;
          margin: -2rem -2rem 1.25rem -2rem;
          background: color-mix(in srgb, color-mix(in srgb, var(--colors--primary), black 10%), transparent 10%);
          backdrop-filter: blur(0.5rem);
          font-size: 0.875rem;
          border-top-left-radius: 0.25rem;
          border-top-right-radius: 0.25rem;
        }

        a {
          text-decoration: none;
          color: currentColor;
          font-weight: bold;
          font-size: 0.875em;
        }

        p, strong {
          line-height: 1.5;
          margin: 0;
          font-size: 0.875em;
        }

      }

      &:last-child {
        position: sticky;
        bottom: -2rem;
        margin: 1.25rem -2rem -2rem -2rem;
        padding: 2rem 2rem 2.5rem 2rem;
        background: color-mix(in srgb, color-mix(in srgb, var(--colors--primary), black 10%), transparent 10%);
        backdrop-filter: blur(0.5rem);

        > data {
          display: block;
          font-weight: bold;
          margin-bottom: 0.75rem;

          &[data-unit="€"]::before {
            content: '+';
            margin-right: 0.25rem;
          }

          &[data-unit="h"]::after {
            content: 'h';
            margin-left: 0.25rem;
          }

        }
      }
    }
  }

  &:hover {
    > div.order--info { 
      height: calc(100vh + 0.25rem - 5rem - 7.25rem - 7rem);
      overflow: auto;
      transform: translateY(0);
    }
  }
}

#add-to-cart {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  place-content: center;
  position: absolute;
  right: 100%;
  bottom: 0.5rem;
  top: 0.5rem;
  padding: 0;
  font-size: 2rem;
  backdrop-filter: blur(0.5rem);
  border-top-right-radius: unset;
  border-bottom-right-radius: unset;
  background: var(--colors--primary);
  color: white;
  cursor: pointer;
  gap: 0.5rem;
  transition: color 0.25s, background 0.25s;

  &:hover {
    background: var(--colors--primary);
    color: white;
  }

  small {
    white-space: nowrap;
    font-size: 0.75rem;
    filter: drop-shadow(0 0 0.5px black);
  }

  i {
    filter: drop-shadow(0 0 0.5px black);
    font-size: 1.75rem;
  }
}

@media screen and (prefers-color-scheme: dark) {
  skan-option img {
    &[src*="_nicht_"],
    &[src*="_X"],
    &[src*="K1"], &[src*="K2"], &[src*="K3"], &[src*="K4"], &[src*="K5"], &[src*="K6"],
    &[src*="P1"], &[src*="P2"], &[src*="P3"], &[src*="P4"], &[src*="P5"] {
      filter: invert(1);
    }

    &[src*="Freistehend"],
    &[src*="Wandanbau_"],
    &[src*="Wand_"],
    &[src*="Profil"],
    &[src*="Rhombus."],
    &[src*="Blockbohlen"],
    &[src*="Andreas"],
    &[src*="Balkon"],
    &[src*="Fachwerk"],
    &[src*="Schnee"],
    &[src*="Deckelschalung"],
    &[src*="/images/Blende"],
    &[src*="Deckelschalung"],
    &[src*="mit_Abstellraum"] {
      filter: brightness(2) invert(1);
    }

    &[src*="Schneelast"] {
      filter: brightness(1.75);
    }
  }
}

main:has(> #view-actions) > aside#info {
  top: 14rem;
  width: 25rem;
  max-width: calc(100vw - 29rem);
  padding-left: 0;
  border-radius: 0.25rem;

  > section {
    background: none;
  }

  &:hover, &.--active {
    transform: translate(25rem, 0);
  }
}
