/*
 * Copyright 2015 The Chromium Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

:host {
  width: 270px;
  height: 350px;
  user-select: none;
  padding: 16px;
  overflow: hidden;
}

.bezier-preset-selected > svg {
  background-color: var(--sys-color-tonal-container);
}

.bezier-container {
  --override-bezier-control-color: var(--sys-color-purple-bright);

  display: flex;
  margin-top: 38px;
  flex-shrink: 0;
  /* overflown bezier visualization must be on top of the source text */
  z-index: 2;
  background-image: radial-gradient(circle, var(--sys-color-surface-variant) 1px, var(--color-background-inverted-opacity-0) 1px);
  background-size: 17px 17px;
  background-position: -5px -10px;
}

.bezier-preset {
  width: 50px;
  height: 50px;
  padding: 5px;
  margin: auto;
  background-color: var(--sys-color-surface1);
  border-radius: 3px;
}

.bezier-preset line.bezier-control-line {
  stroke: var(--sys-color-token-subtle);
  stroke-width: 1;
  stroke-linecap: round;
  fill: none;
}

.bezier-preset circle.bezier-control-circle {
  fill: var(--sys-color-token-subtle);
}

.bezier-preset path.bezier-path {
  stroke: var(--sys-color-inverse-surface);
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
}

.bezier-preset-selected path.bezier-path,
.bezier-preset-selected line.bezier-control-line {
  stroke: var(--sys-color-on-tonal-container);
}

.bezier-preset-selected circle.bezier-control-circle {
  fill: var(--sys-color-on-tonal-container);
}

.bezier-curve line.linear-line {
  stroke: var(--sys-color-neutral-outline);
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
}

.bezier-curve line.bezier-control-line {
  stroke: var(--override-bezier-control-color);
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
  opacity: 60%;
}

.bezier-curve circle.bezier-control-circle {
  fill: var(--override-bezier-control-color);
  cursor: pointer;
}

.bezier-curve path.bezier-path {
  stroke: var(--sys-color-inverse-surface);
  stroke-width: 3;
  stroke-linecap: round;
  fill: none;
}

.bezier-curve path.bezier-path.linear-path {
  cursor: pointer;
}

.bezier-preview-container {
  position: relative;
  background-color: var(--sys-color-cdt-base-container);
  overflow: hidden;
  border-radius: 20px;
  width: 200%;
  height: 20px;
  z-index: 2;
  flex-shrink: 0;
  opacity: 0%;
}

.bezier-preview-animation {
  background-color: var(--sys-color-purple-bright);
  width: 20px;
  height: 20px;
  border-radius: 20px;
  position: absolute;
}

.bezier-preview-onion {
  margin-top: -20px;
  position: relative;
  z-index: 1;
}

.bezier-preview-onion > .bezier-preview-animation {
  opacity: 10%;
}

svg.bezier-preset-modify {
  background-color: var(--sys-color-cdt-base-container);
  border-radius: 35px;
  display: inline-block;
  visibility: hidden;
  transition: transform 100ms cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: absolute;
}

svg.bezier-preset-modify:hover,
.bezier-preset:hover {
  background-color: var(--sys-color-state-hover-on-subtle);
}

.bezier-preset-selected .bezier-preset:hover {
  background-color: var(--sys-color-tonal-container);
}

.bezier-preset-modify path {
  stroke-width: 2;
  stroke: var(--sys-color-on-surface-subtle);
  fill: none;
}

.bezier-presets {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bezier-preset-selected .bezier-preset-modify {
  opacity: 100%;
}

.bezier-preset-category {
  width: 50px;
  cursor: pointer;
  transition: transform 100ms cubic-bezier(0.4, 0, 0.2, 1);
}

span.bezier-display-value {
  width: 100%;
  user-select: text;
  display: block;
  text-align: center;
  line-height: 20px;
  min-height: 20px;
  cursor: text;
}

svg.bezier-curve {
  margin-left: 32px;
  margin-top: -8px;
}

svg.bezier-curve.linear {
  margin-top: 42px;
  overflow: visible;
}

svg.bezier-preset-modify.bezier-preset-plus {
  right: 0;
}

.bezier-header {
  margin-top: 16px;
  z-index: 1;
}

svg.bezier-preset-modify:active {
  transform: scale(1.1);
  background-color: var(--sys-color-state-ripple-neutral-on-subtle);
}

.bezier-preset-category:active {
  transform: scale(1.05);
}

.bezier-header-active > svg.bezier-preset-modify {
  visibility: visible;
}

.bezier-preset-modify:active path {
  stroke: var(--sys-color-on-surface-subtle);
}
