@layer base;

@layer components {
  .timeline-editor {
    background-color: oklch(15.2% 0 0);
    min-height: 2rem;
    font-family: ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
    font-size: .75rem;
    line-height: 1rem;
    transition: all .3s ease-in-out;
    position: relative;
    overflow: hidden;

    & [data-slot="scroll-area"] {
      position: relative;
    }

    & [data-slot="scroll-area-viewport"] {
      border-radius: inherit;
      outline: none;
      width: 100%;
      height: 100%;
      transition-property: color, box-shadow;
      transition-duration: .15s;
      transition-timing-function: cubic-bezier(.4, 0, .2, 1);

      & > div {
        height: 100%;
        position: relative;
      }
    }

    & [data-slot="scroll-area-viewport"]:focus-visible {
      outline: 1px solid oklch(35.3% 0 0);
      box-shadow: 0 0 0 3px oklch(35.3% 0 0 / .5);
    }

    & [data-slot="scroll-area-scrollbar"] {
      touch-action: none;
      user-select: none;
      padding: 1px;
      transition-property: color;
      transition-duration: .15s;
      transition-timing-function: cubic-bezier(.4, 0, .2, 1);
      display: flex;
    }

    & [data-slot="scroll-area-scrollbar"][data-orientation="vertical"] {
      border-left: 1px solid #0000;
      width: .625rem;
      height: 100%;
      transition: width .15s ease-in-out;

      &:hover {
        width: 1rem;
      }
    }

    & [data-slot="scroll-area-scrollbar"][data-orientation="horizontal"] {
      border-top: 1px solid #0000;
      flex-direction: column;
      height: .625rem;
      transition: height .15s ease-in-out;

      &:hover {
        height: 1rem;
      }
    }

    & [data-slot="scroll-area-thumb"] {
      background-color: oklch(35.3% 0 0);
      border-radius: 9999px;
      flex: 1;
      position: relative;
    }
  }

  .timeline-editor-edit-area {
    background-image: linear-gradient(#0000, #0000), linear-gradient(90deg, oklch(100% 0 0 / .08) 1px, #0000 0);
    background-repeat: no-repeat, repeat;
    min-height: calc(100% - 42px);
    margin-top: .625rem;
  }

  .timeline-editor-edit-row {
    transition: height .35s, transform .35s;
    transition-timing-function: linear(0,
      .338 8%,
      .605 16.5%,
      .804 25.6%,
      .878 30.4%,
      .938 35.5%,
      1.006 44.9%,
      1.025 50.1%,
      1.035 55.7%,
      1.035 64.6%,
      1.006 87.3%,
      1);
    flex-direction: row;
    display: flex;
    overflow: clip;
  }

  .timeline-editor-collapsed-row-label {
    z-index: 3;
    pointer-events: none;
    align-self: stretch;
    align-items: center;
    max-width: min(16rem, 50vw);
    display: flex;
    position: sticky;
    left: 0;
  }

  .timeline-editor-empty-row {
    z-index: 1;
    pointer-events: none;
    align-self: stretch;
    align-items: center;
    display: flex;
    position: sticky;
    left: 0;
  }

  .timeline-editor-action {
    z-index: 2;
    background-color: oklch(35.3% 0 0);
    position: absolute;
    top: 0;
    left: 0;
  }

  .timeline-editor-action-preview {
    pointer-events: none;
    z-index: 1;
    position: absolute;
    top: 0;
    left: 0;
  }

  .timeline-editor-action-left-stretch, .timeline-editor-action-right-stretch {
    cursor: ew-resize;
    width: .625rem;
    height: 100%;
    position: absolute;
    top: 0;
  }

  .timeline-editor-action-left-stretch:after, .timeline-editor-action-right-stretch:after {
    background: oklch(55.6% 0 0);
    border-radius: 1rem;
    width: .25rem;
    position: absolute;
    top: 20%;
    bottom: 20%;
  }

  .timeline-editor-action-left-stretch {
    left: 0;

    &:hover:after {
      opacity: 1;
    }
  }

  .timeline-editor-action-left-stretch:after {
    content: "";
    opacity: 1;
    transition: opacity .1s ease-in-out;
    left: .2rem;
  }

  .timeline-editor-action-right-stretch {
    right: 0;

    &:hover:after {
      opacity: 1;
    }
  }

  .timeline-editor-action-right-stretch:after {
    content: "";
    opacity: 1;
    transition: opacity .1s ease-in-out;
    right: .2rem;
  }

  .timeline-editor-time-area {
    cursor: crosshair;
    z-index: 3;
    text-align: center;
    background-color: oklch(15.2% 0 0 / .8);
    height: 2rem;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.75rem;
    position: sticky;
    top: 0;
    overflow: clip;
  }

  .timeline-editor-time-unit {
    box-sizing: content-box;
    pointer-events: none;
    border-right: 1px solid oklch(35.3% 0 0);
    position: absolute;
    top: auto;
    bottom: 0;
    left: 0;
  }

  .timeline-editor-time-unit-big {
    height: .5rem;
  }

  .timeline-editor-time-unit-small {
    height: .25rem;
  }

  .timeline-editor-time-unit-scale {
    pointer-events: none;
    color: oklch(55.6% 0 0);
    font-size: .75rem;
    font-weight: 300;
    line-height: 1rem;
    position: absolute;
    top: 0;
    right: 0;
    transform: translateX(50%) translateY(-100%);
  }

  .timeline-editor-cursor {
    --scale-x: .5;
    cursor: ew-resize;
    box-sizing: border-box;
    z-index: 4;
    min-height: calc(100% - 32px);
    position: absolute;
    top: 2rem;
    left: -4px;
  }

  .timeline-editor-cursor-preview {
    box-sizing: border-box;
    z-index: 5;
    pointer-events: none;
    color: oklch(78% 0 0);
    transform-origin: 0 0;
    min-height: calc(100% - 32px);
    transition: opacity 80ms ease-out;
    position: absolute;
    top: 2rem;
    left: -4px;
  }

  .timeline-editor-cursor-preview-head {
    color: inherit;
    transform-origin: 0 0;
    position: sticky;
    top: 2rem;
    transform: scaleX(2);
  }

  .timeline-editor-cursor-preview .timeline-editor-cursor-top {
    color: oklch(78% 0 0);
  }

  .timeline-editor-cursor-preview .timeline-editor-cursor-area {
    border-left-color: oklch(78% 0 0);
    border-right-color: oklch(78% 0 0);
  }

  .timeline-editor-cursor-top {
    color: oklch(65.1% .197 250.3);
    position: sticky;
    top: 2rem;
    transform: translateX(0) translateY(0) scaleX(2);
  }

  .timeline-editor-cursor-area {
    box-sizing: content-box;
    cursor: ew-resize;
    border-left: 1px solid oklch(65.1% .197 250.3);
    border-right: 1px solid oklch(65.1% .197 250.3);
    width: 0;
    height: calc(100% - 2px);
    position: absolute;
    top: 1px;
    left: -1px;
    transform: translateX(200%);
  }

  .timeline-editor-snap-line-container {
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
  }

  .timeline-editor-snap-line {
    border-left: 1px dashed oklch(55.1% .033 250.1);
    width: 0;
    height: 99%;
    position: absolute;
    top: 0;
  }
}
