.popover {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-l);
  background: var(--pop);
  box-shadow: 0 0 0 1px var(--line), 0 30px 90px var(--shadow);
  animation: popover-in 0.24s var(--ease);
}

.popover.is-closing {
  pointer-events: none;
  animation: popover-out 0.16s ease-in forwards;
}

@keyframes popover-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
}

@keyframes popover-out {
  to {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
}

.popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -6px -8px 0 0;
}

.popover-head h2 {
  font-size: var(--text-xl);
  font-weight: 500;
}

/* Color picker */

.picker {
  --hue: 0;
  --current: #000;
  width: 344px;
  gap: 16px;
  padding: 20px;
}

.picker-area {
  position: relative;
  height: 230px;
  border-radius: 16px;
  background:
    linear-gradient(to top, #000, rgba(0, 0, 0, 0)),
    linear-gradient(to right, #fff, hsl(calc(var(--hue) * 1deg) 100% 50%));
  cursor: crosshair;
  touch-action: none;
}

.picker-thumb {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  background: var(--current);
  box-shadow: 0 0 0 3px #fff, 0 2px 10px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.picker-hue {
  position: relative;
  height: 30px;
  margin: 0 15px;
  background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  cursor: ew-resize;
  touch-action: none;
}

.picker-hue::before,
.picker-hue::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 15px;
  background: #f00;
}

.picker-hue::before {
  left: -15px;
  border-radius: 15px 0 0 15px;
}

.picker-hue::after {
  right: -15px;
  border-radius: 0 15px 15px 0;
}

.picker-hue-thumb {
  top: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  background: hsl(calc(var(--hue) * 1deg) 100% 50%);
}

.picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 10px;
}

.picker-row.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.picker-hex {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 20px;
  border-radius: var(--radius-m);
  background: var(--well);
  cursor: text;
}

.picker-hex span {
  color: var(--ink-3);
  font-size: var(--text-l);
}

.picker-hex-input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  font-size: var(--text-xl);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
}

.picker-tool {
  display: grid;
  place-items: center;
  border-radius: var(--radius-m);
  background: var(--well);
  color: var(--ink-2);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.picker-tool:hover {
  background: var(--well-hover);
  color: var(--ink);
}

.picker-remove {
  color: var(--ink-2);
}

.picker-remove:hover {
  color: var(--ink);
}

/* Composition */

.composition {
  width: 440px;
  gap: 20px;
  padding: 24px;
}

.ratios {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.ratio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 0 12px;
  border-radius: 18px;
  color: var(--ink-3);
  font-size: var(--text-l);
  font-variant-numeric: tabular-nums;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.ratio:hover {
  color: var(--ink-2);
}

.ratio[aria-checked="true"] {
  background: var(--well);
  color: var(--ink);
}

.ratio-frame {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
}

.ratio-shape {
  border: 1.6px solid currentColor;
  border-radius: 5px;
}

.size-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.size-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--control-h);
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-m);
  cursor: text;
  transition: border-color 0.2s var(--ease);
}

.size-field:focus-within {
  border-color: var(--ink-3);
}

.size-field span {
  color: var(--ink-3);
  font-size: var(--text-m);
}

.size-field input {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  font-size: var(--text-l);
  font-variant-numeric: tabular-nums;
}

.format-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.format-label {
  color: var(--ink-2);
  font-size: var(--text-l);
}
