/**
 * 3D Foundation Project
 * Copyright 2025 Smithsonian Institution
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

////////////////////////////////////////////////////////////////////////////////
// COLOR

@use "sass:color";

$color-primary: #0089bf; // Smithsonian primary blue
 // Smithsonian secondary yellow
$color-tertiary: #1b2226; // Smithsonian dark blue

$menu-color-text: #f0f0f0;
$menu-color-text-dim: #a0a0a0;
$menu-color-background: color.adjust(#363d40, $alpha: -0.4);
$menu-color-background-dark: color.adjust(#1f2426, $alpha: -0.2);
$menu-color-background-darker: color.adjust(#050708, $alpha: -0.15);
$menu-color-background-hover: color.adjust(#4a5257, $alpha: -0.5);

$color-paragraph-background: color.adjust($color-tertiary, $alpha: -0.5);
$color-paragraph-hover: color.adjust(#333b40, $alpha: -0.5);

$section-border: 1px solid color.adjust($color-primary, $alpha: -0.5);

////////////////////////////////////////////////////////////////////////////////
// Geometry

$canvas-border-width: 6px;
$main-menu-button-size: 38px;

////////////////////////////////////////////////////////////////////////////////

@use "../styles" as common with (
  $color-primary: $color-primary,
  $color-secondary: #ffcd00
);

* {
  scrollbar-color: common.$color-background-lighter common.$color-background-darker;
  scrollbar-width: thin;
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  ::-webkit-scrollbar-track {
    background-color: common.$color-background-darker;
  }
  ::-webkit-scrollbar-thumb {
    background-color: common.$color-background-lighter;
    border-radius: 8px;
  }
}

@mixin circle-btn {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  width: $main-menu-button-size;
  height: $main-menu-button-size;
  background-color: $menu-color-background-dark;
  border-radius: 20px;
  font-size: 17px;
  transition: all common.$tx-short;
  pointer-events: auto;

  .ff-text {
    color: common.$color-icon;
  }

  &:focus {
    outline: none;
    background-color: $menu-color-background-dark;
    box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
  }

  &:focus:not(:focus-visible) {
    outline: 0;
    box-shadow: 0 0;
  }

  &:focus-visible {
    outline: none;
    background-color: $menu-color-background-dark;
    box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
  }

  &:hover {
    background-color: $menu-color-background-hover;
    fill: common.$color-text;

    & > .ff-text {
      color: common.$color-text;
    }
  }

  &[selected] {
    background-color: common.$color-primary;
    color: $menu-color-text;

    & > .ff-icon {
      filter: drop-shadow(1px 1px 6px color.adjust(common.$color-primary, $lightness: -10%));
      fill: common.$color-text;
    }

    &:hover, &:focus {
      background-color: common.$color-primary-light;
    }
  }
}

////////////////////////////////////////////////////////////////////////////////
// MAIN VIEW

voyager-explorer {
  font-size: 16px;
}

////////////////////////////////////////////////////////////////////////////////
// CONTENT LAYER

$pad: $canvas-border-width + $main-menu-button-size + 8px;

.sv-content-only, .sv-content-stack {
  .sv-scene-view {
    @include common.fullsize;

    &:focus {
      border: 2px solid color.adjust(common.$color-primary, $lightness: 50%);
    }

    &:focus:not(:focus-visible) {
      border: none;
      outline: 0;
    }

    &:focus-visible {
      border: 2px solid color.adjust(common.$color-primary, $lightness: 50%);
    }

    cursor: grab;
  }
}

.sv-reader-container {
  overflow-y: auto;
}

.sv-content-stack {
  .sv-reader-container {
    @include common.fullsize;
    margin-top: $pad;
  }

  .sv-reader-view {
    pointer-events: auto;
    display: flex;
    justify-content: center;

    .sv-left {
      flex: 0 0 $pad;
    }
    .sv-article {
      flex: 0 2 720px;
      background-color: $color-paragraph-background;
      padding-bottom: 35px; // room for tour navigator overlay
    }
    .sv-right {
      flex: 0 3 16px;
      background-color: $color-paragraph-background;
    }
  }
}

.sv-content-split {
  display: flex;

  .sv-reader-container {
    @include common.fullsize;
    margin-top: $pad;
  }

  .sv-scene-view {
    flex: 1 1 60%;
  }
  .sv-reader-view {
    pointer-events: auto;
    flex: 1 1 40%;
    padding: 0 20px;

    .sv-left {
      flex: 0 0 $pad;
    }
    .sv-article {
      flex: 0 2 720px;
      background-color: $color-paragraph-background;
      padding-bottom: 35px; // room for tour navigator overlay
      padding-right: 16px;
    }
    .sv-right {
      flex: 0 3 16px;
      background-color: $color-paragraph-background;
    }
  }
}

.sv-article {
  position: relative;
  padding: 5px 8px 0 16px;
  user-select: text;
  -moz-user-select: text;
  -webkit-user-select: text;
}

.sv-content-overlay {
  .error-msg {
    position: absolute;
    text-align: center;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: red;
    background-color: silver;
    padding: 8px;
  }
}

.ff-viewport-overlay {
  font-size: 1.0em;
}

.sv-scene-view {
  @include common.fullsize;
  overflow: hidden;

  &.sv-blur {
    filter: brightness(60%) blur(5px);
    transition: filter 0.5s;
  }
}

////////////////////////////////////////////////////////////////////////////////
// ANNOTATIONS

.sv-annotation {
  box-sizing: border-box;
  position: absolute;
  z-index: 1;

  a:link, a:visited, a:hover, a:active {
    color: common.$color-primary;
  }

  img {
    max-height: 120px;
    max-width: 100%;
  }

  .sv-img-credit {
    font-size: x-small;
  }

  &:has(:focus-visible) {
    opacity: 1 !important;
  }
  
  @include common.noselect;
}

.sv-annotation-img {
  max-width: 100%;
}

.sv-circle-annotation {
  display: flex;

  &.sv-expanded {
    z-index: 2;
    width: 16%;
    min-width: 180px;
    max-width: 280px;
  }

  .sv-marker {
    background-color: rgba(0, 0, 0, 0.65); 
    border-radius: 50%;  
    text-align: center; 
    height: 18px;
    aspect-ratio: 1/1;
    border-style: solid;
    border-width: 1px;
    cursor: pointer;
    font-size: 0.9em;
    color: #fff;
    -webkit-tap-highlight-color: transparent;

    &:focus-visible {
      outline: none;
      background-color: $menu-color-background-dark;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }
  }

  .sv-annotation-body {
    padding: 4px 8px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    margin: 0px 1px;
    width: 100%;

    &:has(:focus-visible) {
      outline: none;
      background-color: $menu-color-background-dark;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }

    .sv-title {
      padding: 0 0 2px 0;
      font-weight: bold;
    }
    p {
      @include common.font-ui-normal;
      font-size: 0.88em;
      line-height: 1.35;
      color: common.$color-text;
      margin: 0.5em 0;
    }
    .ff-button {
      background: rgba(0, 0, 0, 0.01); // hack to get click events

      &:hover {
        text-decoration: underline;
      }
    }

    .sv-content {
      overflow: hidden;
      overflow-wrap: break-word;
    }
  }
}

.sv-pin-annotation {
  padding: 0 4px;
  background-color: color.adjust(black, $alpha: -0.5);
  color: common.$color-text;
  transform: translate(-50%, -100%);
}

.sv-scale-annotation {
  opacity: 0;
  transition: opacity 0.3s ease-in;
  position: absolute;
  color: black;
  background-color: white;
  font-weight: bold;
  border-radius: 20px;
  padding-left: 4px;
  padding-right: 4px;

  &.sv-show {
    opacity: 1;
  }
}

.sv-standard-annotation, .sv-extended-annotation {
  max-width: 20%;
  min-width: min-content;
  padding: 0 4px;
  background-color: color.adjust(black, $alpha: -0.5);
  color: common.$color-text;
  pointer-events: auto;
  overflow-wrap: normal;

  &:has(:focus-visible) {
    outline: none;
    background-color: $menu-color-background-dark;
    box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
  }

  &.sv-expanded {
    width: 20%;
    min-width: 180px;
    background-color: color.adjust(black, $alpha: -0.2);
    z-index: 2;
  }

  &.sv-short {
    width: unset;
    min-width: min-content;
  }

  &.sv-q0 {
    transform: translate(0, -100%);
    border-bottom-style: solid;
    border-bottom-width: 1px;
    text-align: left;
  }
  &.sv-q1 {
    transform: translate(-100%, -100%);
    border-bottom-style: solid;
    border-bottom-width: 1px;
    text-align: right;
  }
  &.sv-q2 {
    transform: translate(-100%, 0);
    border-top-style: solid;
    border-top-width: 1px;
    text-align: right;
  }
  &.sv-q3 {
    transform: translate(0, 0);
    border-top-style: solid;
    border-top-width: 1px;
    text-align: left;
  }
  &.sv-static-width {
    width: fit-content;
  }

  .sv-title {
    padding: 1px 0 2px 0;
    font-weight: bold;
    -webkit-tap-highlight-color: transparent;

    &:focus-visible {
      outline: none;
    }
  }

  .sv-content {
    padding: 2px 0;
    height: 0;
    overflow: hidden;
    overflow-wrap: break-word;
    transition: height 0.2s;
  }

  p {
    @include common.font-ui-normal;
    font-size: 0.88em;
    line-height: 1.35;
    color: common.$color-text;
    margin: 0.5em 0;
  }
  .ff-button {
    background: rgba(0, 0, 0, 0.01); // hack to get click events

    .ff-icon {
      fill: common.$color-icon;
    }

    &:hover {
      text-decoration: underline;
    }
  }
}

.sv-extended-annotation {
  .sv-title {
    cursor: pointer;
  }
}

.sv-standard-annotation {
  pointer-events: none;

  &.sv-enable-events {
    pointer-events: auto;
    cursor: pointer;
  }
}

.sv-annotation-overlay {
  padding: 7px;
  pointer-events: auto;
  background-color: $menu-color-background;
  max-width: #{"min(80%, 800px)"};
  min-width: 50%;
  max-height: 90%;
  overflow-y: auto;
  cursor: auto;

  .sv-annotation-body {
    .ff-button {
      background: rgba(0, 0, 0, 0.01); // hack to get click events

      &:hover {
        text-decoration: underline;
      }
    }
  }
}

////////////////////////////////////////////////////////////////////////////////
// AR MODE

.sv-ar-prompt {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-radius: 20px;
  //height: 200px;
  margin: 30% 0 0 0;
  overflow: hidden;
  background-color: $menu-color-background;

  .sv-content {
    flex: 1;
    width: 100%;
    margin: 10px 10px;
    text-align: center;
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10 and IE 11 */
    user-select: none;

    .sv-ar-icon {
      height: 10em;
    }
  }
}

.sv-ar-menu {
  display: flex;
  position: absolute;
  bottom: 0px;
  flex-direction: row;
  margin: 0 0 $canvas-border-width $canvas-border-width;
  align-items: end;

  & > .ff-button {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    width: $main-menu-button-size;
    height: $main-menu-button-size;
    margin: 0 6px 2px 0;
    background-color: $menu-color-background-hover;
    border-radius: 20px;
    font-size: 17px;
    transition: all common.$tx-short;
    pointer-events: auto;

    &:hover, &:focus {
      outline: none;
      background-color: $menu-color-background-hover;
      fill: common.$color-text;
    }

    &[selected] {
      background-color: common.$color-primary;
      color: $menu-color-text;

      & > .ff-icon {
        filter: drop-shadow(1px 1px 6px color.adjust(common.$color-primary, $lightness: -10%));
        fill: common.$color-text;
      }

      &:hover, &:focus {
        background-color: common.$color-primary-light;
      }
    }
  }

  & .sv-tag-cloud {
    width: 100%;

    & .sv-section-lead {
      display: none;
    }
  }
}

.sv-ar-code {
  position: relative;
  width: 420px;
  max-width: 85%;
  max-height: 90%;
  padding: 8px;
  background: common.$color-background;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.35);
  pointer-events: auto;

  .ff-title {
    margin: 0.5em 0 1em 0;

    .ff-icon {
        height: 2em;
        width: 2em;
        padding: 2px;
        border-radius: 20px;
        background-color: $menu-color-background-hover;
      }
  }

  img {
    height: 250px;
    margin: auto;
  }
}

////////////////////////////////////////////////////////////////////////////////
// CHROME VIEW

.sv-chrome-view {
  @include common.font-ui-normal;
  font-size: 0.85em;
  line-height: 1.35;
  color: common.$color-text;
  @include common.fullsize;
  overflow: clip;
  display: flex;
  flex-direction: column;
  background: linear-gradient(to bottom, color.adjust(black, $alpha: -0.7), color.adjust(black, $alpha: -0.85) 10%, transparent 25%);

  z-index: 3;

  .ff-button {
    flex: 0 1 auto;
    box-sizing: border-box;

    &:focus {
      outline: none;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }

    &:focus:not(:focus-visible) {
      outline: 0;
      box-shadow: 0 0;
    }

    &:focus-visible {
      outline: none;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }

    &:hover {
      outline: none;

      & > .ff-icon {
        fill: common.$color-text;
      }
    }

    &[selected] {
      background-color: common.$color-primary;

      &[disabled] {
        background-color: common.$color-background-light;
      }

      & > .ff-icon {
        filter: drop-shadow(1px 1px 6px color.adjust(common.$color-primary, $lightness: -10%));
        fill: common.$color-text;
      }

      &:hover {
      }
      &:focus {
      }
    }
  }
}

////////////////////////////////////////////////////////////////////////////////
// CHROME HEADER

.sv-chrome-header {
  display: flex;
  align-items: flex-start;
  height: 100%;
  position: relative;

  .sv-top-bar {
    flex: 1 1 auto;
    display: flex;
    align-items: flex-start;
    height: 40px;
    margin: 9px 9px 0 0;
    overflow: hidden;
  }

  .sv-main-title {
    flex: 1 1 auto;
    margin: $canvas-border-width 8px;
    font-family: "Hind Siliguri", sans-serif;;
    font-weight: normal;
    font-size: 1.412em;
    white-space: pre;
    color: common.$color-text-light;
    @include common.noselect;

    span {
      color: transparent;
    }
  }
}

////////////////////////////////////////////////////////////////////////////////
// CHROME FOOTER

.sv-chrome-footer {
  display: block;
  position: absolute;
  bottom: 0;
  right: 0;
  //z-index: -1;

  .sv-bottom-bar {
    flex: 1 1 auto;
    display: flex;
    align-items: flex-end;
    text-align: right;
    //height: 30px;
    //margin: 9px 9px 0 0;
    overflow: hidden;

    & > .ff-button {
      margin: 6px 6px 6px 5px;
      @include circle-btn;
    }
  }

  .sv-text-icon {
    font-family: "Hind Siliguri", sans-serif;
    font-weight: bold;
    line-height: 25px;
  }
}

////////////////////////////////////////////////////////////////////////////////
// MAIN MENU

.sv-main-menu-wrapper {
  position: relative;
  height: 100%;
  min-width: 50px;
}

.sv-main-menu {
  display: flex;
  flex-direction: column;
  padding: $canvas-border-width $canvas-border-width+3 $canvas-border-width $canvas-border-width;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  pointer-events: auto;
  position: absolute;
  box-sizing: border-box;
  overscroll-behavior-y: contain;

  & > .ff-button {
    margin: 2px 0;
    @include circle-btn;
  }
}

////////////////////////////////////////////////////////////////////////////////
// SHARE MENU

.sv-share-menu {
  position: relative;
  width: 450px;
  max-width: 85%;
  padding: 8px;
  background: common.$color-background;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.35);
  pointer-events: auto;

  .ff-title {
    margin: 0.5em 0 1em 0;
  }
  .ff-button {
    flex: 0 0 auto;
  }
  .ff-text-edit {
    height: 6.5em;
  }

  .sv-share-buttons .ff-button {
    width: 48px;
    height: 48px;
    border-radius: 48px;
    margin: 0 1em 1em 0;
    padding: 0;

    .ff-icon {
      height: 30px;
      fill: #f0f0f0;
    }

  }

  .sv-share-button-twitter {
    background-color: #00aced;
    
    &:focus {
      outline: none;
      background-color: #00aced;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }

    &:focus:not(:focus-visible) {
      outline: 0;
      box-shadow: 0 0;
    }

    &:focus-visible {
      outline: none;
      background: #00aced;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }

    &:hover { background-color: color.adjust(#00aced, $lightness: 10%) }
  }
  .sv-share-button-facebook {
    background-color: #3c5a99;

    &:focus {
      outline: none;
      background-color: #3c5a99;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }

    &:focus:not(:focus-visible) {
      outline: 0;
      box-shadow: 0 0;
    }

    &:focus-visible {
      outline: none;
      background: #3c5a99;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }

    &:hover { background-color: color.adjust(#3c5a99, $lightness: 10%) }
  }
  .sv-share-button-linkedin {
    background-color: #0077B5;

    &:focus {
      outline: none;
      background-color: #0077B5;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }

    &:focus:not(:focus-visible) {
      outline: 0;
      box-shadow: 0 0;
    }

    &:focus-visible {
      outline: none;
      background: #0077B5;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }

    &:hover { background-color: color.adjust(#0077B5, $lightness: 10%) }
  }
  .sv-share-button-email {
    background-color: #d28842;

    &:focus {
      outline: none;
      background-color: #d28842;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }

    &:focus:not(:focus-visible) {
      outline: 0;
      box-shadow: 0 0;
    }

    &:focus-visible {
      outline: none;
      background: #d28842;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }

    &:hover { background-color: color.adjust(#d28842, $lightness: 10%) }
  }
}

////////////////////////////////////////////////////////////////////////////////
// DOCUMENT OVERLAY

.sv-document-overlay {
  position: absolute;
  left: $canvas-border-width + $main-menu-button-size + 8px;
  top: $canvas-border-width + $main-menu-button-size + 8px;
  right: $canvas-border-width;
  bottom: 0;
  pointer-events: auto;
}

////////////////////////////////////////////////////////////////////////////////
// TOUR MENU

$tour-entry-indent: 12px;

.sv-tour-menu, .sv-reader-view {
  .sv-article {
    position: relative;

    .sv-nav-button {
      float: right;
      margin: 1em 0.5em;
      padding: 2px;
      .ff-icon {
        height: 1.5em;
      }
    }
  }

  .sv-entry {
    position: relative;
    cursor: pointer;
    padding: 5px 0 5px 15px;
    margin: 2px 2px 16px 2px;
    max-width: 960px;
    background-color: $color-paragraph-background;

    &:hover {
      background-color: $color-paragraph-hover;
    }

    .sv-titlebar {
      display: flex;
    }
  
    .ff-icon {
      margin: auto 10px auto auto;
      height: 1.5em;
      border-radius: 60px;
      border-style: solid;
      box-shadow: 0 0 2px $menu-color-text-dim;
      padding: 0.6em 0.6em;
    }
  }
}

////////////////////////////////////////////////////////////////////////////////
// LANGUAGE MENU

.sv-option-menu {
  position: relative;
  width: 225px;
  max-width: 85%;
  height: 200px;
  max-height: 85%;
  padding: 8px;
  background: common.$color-background;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.35);
  pointer-events: auto;

  .ff-title {
    padding: 0.3em 0 0.3em 0.3em;
  }
  .ff-header {
    padding: 0.3em 0 0.3em 0.3em;
    background: $menu-color-background-dark;
  }
  .ff-button {
    flex: 0 0 auto;
    //margin: 4px;
  }
  .sv-scroll-offset {
    top: 50px;
  }
  .sv-centered {
    justify-content: center;
    padding: 0.3em 0 0.3em 0.3em;
  }

  .sv-entry {
    position: relative;
    cursor: pointer;
    padding: 5px 0 5px 15px;
    margin-bottom: 2px;
    max-width: 960px;
    background-color: $color-paragraph-background;
    @include common.noselect;

    &:focus {
      outline: 2px solid color.adjust(common.$color-primary, $lightness: 50%);
      outline-offset: -2px;
      background-color: $color-paragraph-background;
    }

    &:focus:not(:focus-visible) {
      outline: 0;
    }

    &:focus-visible {
      outline: 2px solid color.adjust(common.$color-primary, $lightness: 50%);
      outline-offset: -2px;
      background-color: $color-paragraph-background;
    }

    &:hover {
      background-color: $color-paragraph-hover;
      fill: common.$color-text;
    }

    &[selected] {
      background-color: common.$color-primary;
      color: $menu-color-text;

      &:hover, &:focus {
        background-color: common.$color-primary-light;
      }
    }
  }
}

////////////////////////////////////////////////////////////////////////////////
// HELP SCREEN

.sv-main-help {
  position: relative;
  width: 90%;
  height: 90%;
  padding: 8px;
  background: common.$color-background;
  pointer-events: auto;

  .sv-help-section {
    display: flex;
    text-align: center;
    width: 33%;
    min-width: 180px;
    max-height: 90%;
    flex-direction: column;
    justify-content: center;
    margin-top: 20px;
    margin-bottom: 20px;
  }

  .sv-help-short {
    min-width: 100px;
  }

  .sv-help-row {
    display: flex;
    flex-wrap: wrap;
    height: 90%;
    justify-content: center;
    overflow: auto;
  }

  .sv-help-text {
    padding: 5px 5px 0px 5px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sv-help-region {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .ff-icon {
    height: 2rem;
  }

  .sv-commands {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    padding: 2px;
  
    .ff-button {
      width: 50%;
      min-width: 100px;
    }
  }
}

////////////////////////////////////////////////////////////////////////////////
// BLUE BAR

.sv-bottom-bar-container {
  position: relative;
  display: flex;
  justify-content: center;
  transition: transform common.$tx-medium ease-out, opacity common.$tx-short ease-out;
  z-index: 1;

  &.sv-transition {
    transform: translateY(40px);
    opacity: 0;
  }

  .ff-button {
    transition: all common.$tx-short;
  }
}

.sv-blue-bar {
  flex: 0 1 960px;
  display: flex;
  flex-direction: column;
  background-color: $menu-color-background-darker;
  border-left: $section-border;
  border-right: $section-border;
  margin: 0 -1px 0 -1px; // side borders disappear on smaller screens
  min-width: 0px;

  pointer-events: auto;
  @include common.noselect;

  .sv-group {
    display: flex;
    flex-direction: column;
  }

  .sv-section {
    position: relative;
    display: flex;
    flex-direction: row;
    border-top: $section-border;
  }

  .sv-section-lead, .sv-section-trail {
    flex: 0 0 auto;
    padding: 6px;
    width: 38px;

    &:hover {
      background-color: $menu-color-background-hover;
    }
  }
  .sv-section-lead {
    border-right: $section-border;
  }
  .sv-section-trail {
    border-left: $section-border;
  }

  .sv-transparent-button {
    flex: 0 1 auto;
    padding: 6px;
    border-radius: 2px;

    .ff-text {
      margin: 1px 2px;
    }
    .ff-icon {
      height: 22px;
      margin: 1px 2px;
    }
  }
  
  .sv-centered {
    justify-content: center;
    padding: 0.3em 0 0.3em 0.3em;
  }

  .sv-blue-button {

  }
}

////////////////////////////////////////////////////////////////////////////////
// TOUR NAVIGATOR

.sv-tour-navigator {
  color: common.$color-text;

  .sv-content {
    flex: 1;
    margin: 2px 8px;
    text-align: center;
  }
  .sv-title {
    font-size: 1.1em;
    @keyframes ticker { 100% { transform:translateX(var(--x-offset)); } }
  }
  .sv-text {
    font-size: 0.9em;
  }
}

.sv-text-scroll {
  animation:ticker 1s linear 1;
  text-overflow: clip;
}

////////////////////////////////////////////////////////////////////////////////
// TARGET NAVIGATOR

.sv-target-navigator {
  .sv-content {
    flex: 1;
    margin: 2px 8px;
    text-align: center;
  }
  .sv-title {
    font-size: 1.1em;
  }
}

////////////////////////////////////////////////////////////////////////////////
// TAG CLOUD

.sv-tag-cloud {
  .sv-tag-buttons {
    flex: 1 1 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 4px;
  }

  .sv-tag-button {
    flex: 0 1 auto;
    margin: 3px 3px;
    padding: 2px 4px;
    background-color: $menu-color-background-dark;
    border-radius: 3px;
    font-size: 0.88em;

    &:hover {
      background-color: $menu-color-background-hover;
    }
    &[selected] {
      background-color: common.$color-primary;
    }

    .ff-text {
      margin: 1px 2px;
    }
    .ff-icon {
      height: 22px;
      margin: 1px 2px;
    }
  }
}

////////////////////////////////////////////////////////////////////////////////
// PROPERTIES
.sv-property{
  &[disabled], &[aria-disabled="true"] {
    filter: brightness(0.6);
  }

  .ff-input{
    min-width: auto;
    width: 0;
    margin: 0;
    padding: 2px;
  }

  .ff-input, select{
    text-align: right;
    background-image: none;
    appearance: auto;
    &:focus{
      text-align: left;
    }
  }

  &.sv-property-datetime {
    .ff-input[type="datetime-local"] {
      width: auto;
      border: 1px solid common.$color-background-lighter;
      color-scheme: dark;
      cursor: pointer;
      transition: all common.$tx-short;

      @supports (-moz-appearance:none) {
          word-spacing: -6px;
          letter-spacing: -1px;
      }

      &:hover {
        background-color: color.adjust(common.$color-background-lighter, $lightness: 5%);
        box-shadow: 0 0 4px color.adjust(common.$color-primary, $alpha: -0.5);
      }

      &:focus {
        box-shadow: 0 0 6px color.adjust(common.$color-primary, $alpha: -0.3);
      }
    }
  }

  &.sv-property-color {
    position: relative;
    display: block;

    & > .sv-property-field {
      display: flex;
      
      .ff-button{
        min-width: 23px;
        border-radius: 2px;
        margin: 2px;
      }
    }

    .ff-color-edit {
      position: absolute;
      width: 200px;
      height: 180px;
      right: 0px;
      top: -188px;
      background: common.$color-background-dark;
      padding: 8px;
      border-radius: 2px;
    }
  }
  
  &.sv-property-number{
    .sv-property-field{
      position: relative;
      touch-action: none;
      display: inline-flex;
      .ff-bar{
        background: common.$color-background-dark;
        position: absolute;
        inset: 0;
        margin: 0;
        width: 0;
        box-sizing: border-box;
        border: 2px solid common.$color-background-darker;
      }
      .ff-input, .ff-unit{
        position: relative;
        touch-action: none;
        width: auto;
      }

      .ff-bar, .ff-unit{
        pointer-events: none;
        user-select: none;
      }
    }
  }



  &.sv-property-slider {
    flex: 0 2 180px;

    .ff-linear-slider {
      height: 6px;
      margin: 12px 2px;
      padding-right: 16px;
      border-radius: 2px;
      background-color: common.$color-background-light;

      .ff-knob {
        width: 16px;
        height: 26px;
        margin: -10px 0 0 0;
        border-radius: 2px;
        background-color: common.$color-primary;
        box-shadow: 0 0 6px black;
      }
    }
  }

  &.sv-property-options{
    .sv-options-buttons{
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      padding: 2px 0;
      gap: 2px;
      .ff-button.ff-control{
        flex: 0 1 auto;
      }
    }
  }
}


////////////////////////////////////////////////////////////////////////////////
// TOOL BAR

.sv-tool-bar {
  color: common.$color-text;
  pointer-events: auto;
  
  .sv-tool-buttons {
    flex: 1 1 auto;
    display: flex;
    margin: 4px;
    overflow-x: auto;

    .sv-tool-button:first-child {
        margin-left: auto;
    }
    
    .sv-tool-button:last-child {
        margin-right: auto;
    }
  }

  .sv-tool-button {
    flex: 0 1 auto;
    margin: 2px;
    padding: 1px 2px;
    border-radius: 3px;
    font-size: 0.882em;

    .ff-text {
      margin: 1px 2px;
    }
    .ff-icon {
      height: 22px;
      margin: 1px 2px;
    }
  }
}

.sv-tool-bar-container {
  position: relative;
  bottom: 0px;
  width: 100%;
}

.sv-tool-controls {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.882em;

  .sv-property {
    flex: 0 1 auto;
    align-self: start;
    display: flex;
    flex-direction: column;
    margin: 4px;

    label {
      height: 1.25em;
    }

    &.sv-nogap {
      margin: 4px 0 !important;
    }

    &.sv-property-slider {
      flex: 0 2 180px;
    }
  }



  .sv-options {
    display: flex;
  }

  .ff-label {
    margin: 2px;
  }

  .ff-string {
    flex: 0 1 auto;
    height: 26px;
    margin: 2px;
    font-size: 1.34em;
  }

  .ff-button {
    height: 26px;
    margin: 2px;
    padding: 0 4px;
    background: common.$color-background;
    border-radius: 2px;

    &:focus {
      outline: none;
      background: common.$color-background;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }

    &:focus:not(:focus-visible) {
      outline: 0;
      box-shadow: 0 0;
    }

    &:focus-visible {
      outline: none;
      background: common.$color-background;
      box-shadow: 0 0 3pt 2pt color.adjust(common.$color-primary, $lightness: 50%);
    }

    &:hover {
      background-color: common.$color-background-lighter;
      fill: common.$color-text;
    }
  }
}

.sv-view-tool-view, .sv-render-tool-view, .sv-light-tool-view {
  .sv-options {
    flex-wrap: wrap;
  }
}

.sv-tape-tool-view, .sv-slice-tool-view, .sv-environment-tool-view {
  .sv-tool-controls {
    flex-wrap: wrap;
  }
}

////////////////////////////////////////////////////////////////////////////////
// OVERLAYS

.sv-action-prompt {
  height: 30px;
  width: 30px;
  fill: #fff;
}

.sv-caption-view {
  position: absolute;
  bottom: 10%;
  z-index: 2;
  font-size: 1.5rem;
  justify-content: center;
  display: flex;
  width: 100%;
  
}

.sv-caption-box {
  position: relative;
  text-align: center;
  background-color: rgba(0,0,0,0.85);
  max-width: 85%;
}

.sv-splash {
  padding: 7px;
  pointer-events: auto;
  background-color: $menu-color-background;
  max-width: #{"min(80%, 800px)"};
  min-width: 50%;
  max-height: 90%;
  overflow-y: auto;

  & > :focus-visible {
    outline: none;
    box-shadow: 0 0;
  }
}

.sv-audio-view {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  max-width: 100%;
  min-width: 110px;
  height: 30px;
  background-color: $menu-color-text;
  border-radius: 15px;
  color: black;
  cursor: auto;

  & > .ff-button {
    width: 30px;
    height: 30px;
    border-radius: 15px;
    flex: 0 1 auto;
    padding: 0px;
    margin-right: 3px;
    background-color: $menu-color-text;
    -webkit-tap-highlight-color: transparent;

    .ff-icon {
      height: 1.5em;
      margin: 5px;
      fill: black;
    }

    &:focus {
      background-color: $menu-color-text;
    }

    &:hover {
      background-color: color.adjust($menu-color-text, $lightness: -30%);

      & > .ff-icon {
        fill: black;
      }
    }
  }

  .sv-timer {
    font-size: small;
    display: flex;
  }

  input {
    width: 100%;
    margin-left: 3px;
    margin-right: 3px;
  }
}

.sv-narrate-player {
  position: absolute;
  pointer-events: auto;
  width: 200px;
  max-width: 75%;
  margin: auto auto;
  left: 0;
  right: 0;
  z-index: 4;
  padding-top: 6px;
}
