@charset "UTF-8";

@layer reset, fonts, colors;

@import "reset.css" layer(reset);
@import "fonts.css" layer(fonts);
@import "colors.css" layer(colors);

:root {
  --hue: 225deg;
  --saturation: 0%;
  --lightness: 96%;
  --duration: 0.35s;
  --gap: 0.5rem;
}

html,
body,
#drag-panel,
.player {
  height: 100%;
}

.player.hide-cursor {
  cursor: none;
}

body {
  font: 0.8375rem "JetBrains Mono", monospace;
  overflow-x: hidden;
}

#drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
}

#drag-panel {
  display: grid;
  place-content: center;
  place-items: center;
  gap: var(--gap);
  font-weight: bold;
  font-size: 2.25rem;
  color: var(--text2);
  background-image: radial-gradient(
    circle at 100% 0,
    var(--surface1),
    var(--surface1) 50%,
    var(--surface3) 75%,
    var(--surface1) 75%
  );
  transition: box-shadow var(--duration);

  &[data-file-hover] {
    box-shadow: inset 0 0 0.75em 0.25em;
  }

  & > * {
    margin-inline: 1em;
    text-align: center;
  }

  & #drag-panel-text {
    margin-bottom: 0.85em;
    color: hsl(0deg 2.11% 72.97%);
  }

  & #file-picker {
    max-inline-size: 20em;
    font-size: 0.5em;
    padding: 0.5em;
    border-radius: 0.5em;
    color: hsl(0deg 2.11% 72.97%);
    background: var(--surface2);
    box-shadow: 0 0 0.5em hsl(var(--surface-shadow) / calc(var(--shadow-strength) + 15%));
    --spacing: 0.75em;
    padding-block: calc(var(--spacing) * 0.618);
    padding-inline: var(--spacing);
    margin-inline-end: var(--spacing);
    transition-duration: var(--duration);
    transition-property: background-color, box-shadow;

    &:hover {
      background-color: var(--surface1);
    }

    &:active {
      box-shadow: none;
    }
  }
}

.player {
  display: flex;
  flex-direction: column;
  background-image: radial-gradient(var(--surface4), var(--surface3));

  & video {
    flex: 1;
    min-block-size: 0;
    background-color: black;
    transition-duration: var(--duration);
    transition-property: scale, border-radius, border;

    &[data-file-hover] {
      scale: 0.75;
      border-radius: 1rem;
      border: medium solid var(--surface4);
    }
  }

  .controls {
    --spacing: 0.75rem;
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--gap);
    padding: var(--spacing);
    color: var(--text2);
    background-color: var(--surface2);

    & > * {
      height: 2.75rem;
    }

    button {
      transition: var(--duration);
      transition-property: color, background-color, box-shadow, font-variation-settings;

      &:is(:hover, :focus-visible) {
        color: var(--text1);
        background-color: var(--surface3);
        box-shadow: 0 0 1px;
      }

      &.material-icon {
        &[class$="-btn"] {
          border-radius: 50%;
          aspect-ratio: 1;

          &:is(:hover, :focus-visible) {
            font-variation-settings: "FILL" 1;
          }
        }
      }
    }

    .volume-container {
      display: flex;
      align-items: center;
      position: relative;

      & #volume-controls {
        width: 0;
        padding: 0;
        margin: 0;
        opacity: 0;
        pointer-events: none;
        transition: all var(--duration);
        cursor: pointer;
        -webkit-appearance: none;
        appearance: none;
        background: transparent;
        position: relative;

        --thumb-color: white;
        --fill-color: white;
        --background-color: rgba(255, 255, 255, 0.3);
        --progress: 100%;

        &::before {
          content: "";
          position: absolute;
          top: 50%;
          left: 0;
          right: 0;
          height: 1.5rem;
          transform: translateY(-50%);
          background: transparent;
          pointer-events: all;
          cursor: pointer;
        }

        &.amplified {
          --thumb-color: #f3c669;
          --fill-color: #f3c669;
        }

        &::-webkit-slider-runnable-track {
          height: 3px;
          background: linear-gradient(
            to right,
            var(--fill-color) var(--progress),
            var(--background-color) var(--progress)
          );
          border-radius: 2px;
          border: none;
        }

        &::-webkit-slider-thumb {
          -webkit-appearance: none;
          appearance: none;
          width: 12px;
          height: 12px;
          border-radius: 50%;
          background: var(--thumb-color);
          margin-top: -4.5px;
          cursor: pointer;
          transition: transform 0.2s;

          &:hover {
            transform: scale(1.2);
          }
        }
      }

      &:hover #volume-controls {
        width: 80px;
        opacity: 1;
        margin: 0 8px;
        pointer-events: auto;
      }

      .volume-btn {
        margin-right: 0;
        height: 2.75rem;
      }
    }

    &.hidden {
      display: none;
    }
  }

  #preview-bar,
  #video-bar {
    --track-height: 0.2rem;
    appearance: none;
    color: var(--video-bar);
    background: linear-gradient(
      to right,
      currentColor var(--progress, 0%),
      var(--surface3) var(--progress, 0%)
    );
    transition: 0.15s;
    transition-property: block-size, height, filter;
  }

  #preview-bar {
    display: none;
    z-index: 1;
    block-size: var(--track-height);

    &::-webkit-slider-thumb {
      width: 0;
      height: 0;
      cursor: default;

      &:is(:hover, :focus-visible) {
        box-shadow: none;
      }
    }
  }

  #video-bar {
    position: absolute;
    inset: 0;
    translate: 0 -50%;
    block-size: var(--track-height);

    &:is(:hover, :focus-visible) {
      --track-height: 0.3rem;
    }

    &::-webkit-slider-thumb {
      width: 10px;
      height: 10px;
      transition: 0.15s;

      &:hover {
        width: 15px;
        height: 15px;
      }
    }

    &::before {
      content: "";
      position: absolute;
      top: 50%;
      left: 0;
      right: 0;
      height: 1.5rem;
      transform: translateY(-50%);
      background: transparent;
      pointer-events: all;
      cursor: pointer;
    }
  }
}

input[type="range"] {
  &::-webkit-slider-thumb {
    appearance: none;
    --thumb-size: 1rem;
    block-size: var(--thumb-size);
    inline-size: var(--thumb-size);
    border-radius: 50%;
    background-color: currentColor;
    transition: box-shadow var(--duration);

    &:is(:hover, :focus-visible) {
      margin: 0;
      box-shadow: 0 0 0 0.5em hsl(var(--surface-shadow) / calc(var(--shadow-strength) + 15%));
    }
  }
}

#time-indicator {
  white-space: nowrap;
  border-radius: 1.25rem;
  padding-inline: var(--spacing);

  .duration::before {
    content: " / ";
  }
}

#file-name-container {
  display: inline-flex;
  place-items: center;
  min-inline-size: 6ch;

  & #file-name {
    max-inline-size: 66ch;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    &::before {
      content: "•";
      margin-inline-end: calc(var(--spacing) + var(--gap));
    }
  }
}

/* Speed Control Container */
.speed-control-container {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 2.75rem;
  background: var(--surface2);
  border-radius: 1.25rem;
  padding: 4px;
  border: thin solid var(--surface4);
  box-shadow: inset 0 0 0.25em hsl(var(--surface-shadow) / calc(var(--shadow-strength) + 15%));

  .speed-display {
    min-width: 4.5em;
    text-align: center;
    padding: 0.4em 0.75em;
    font-weight: 500;
    cursor: pointer;
    border-radius: 1rem;
    transition: all 0.2s;
    background: transparent;
    user-select: none;
    color: var(--text2);

    &:hover {
      background: var(--surface3);
      color: var(--text1);
    }

    &.preset-active {
      background: var(--surface3);
      color: var(--text1);
    }

    .preset-indicator {
      font-size: 0.7em;
      color: var(--video-bar);
      margin-left: 4px;
    }
  }

  .speed-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: none;
    background: var(--surface3);
    color: var(--text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: bold;
    transition: all 0.2s;
    padding: 0;

    &:hover {
      background: var(--surface4);
      color: var(--text1);
      transform: scale(1.1);
    }

    &:active {
      transform: scale(0.95);
    }
  }
}

.stretchClass {
  transform-origin: top left;
  transform: scaleX(1) scaleY(1) !important;

  &.mode-2 {
    transform-origin: top center;
    transform: scaleX(1.2) scaleY(1) !important;
  }

  &.mode-1 {
    transform-origin: center left;
    transform: scaleX(1) scaleY(1.11) !important;
  }

  &.fullscreen-mode-2 {
    transform-origin: top center;
    transform: scaleX(1.291) scaleY(1) !important;
  }

  &.fullscreen-mode-1 {
    transform-origin: center left;
    transform: scaleX(1) scaleY(1.027) !important;
  }
}

#seeker-preview {
  position: absolute;
  top: -238px;
  height: 200px;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 10px;
  box-sizing: border-box;
  color: white;
  text-align: center;

  & video {
    width: auto;
    height: 100%;
  }

  & div {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
  }
}
