/* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */

:host {
  box-sizing: border-box;
  position: relative;
  display: inline-block;
}

:host(:hover) .polymer-tooltip {
  visibility: visible !important;
}

:host(:focus) .polymer-tooltip {
  visibility: visible !important;
}

.polymer-tooltip:not(.show) {
  visibility: hidden;
}

.polymer-tooltip {
   pointer-events: none; 
  position: absolute;
  display: flex;
  font-size: 10px;
  font-family: sans-serif;
  padding: 8px;
  color: white;
  background-color: rgba(0,0,0,0.8);
  box-sizing: border-box;
  border-radius: 3px; /* TODO: not in spec. */
  white-space: nowrap;
  line-height: 6px;
  z-index: 1002; /* TODO: this is brittle. */
}

:host([large]) .polymer-tooltip {
  line-height: 14px;
  font-size: 14px;
  padding: 16px;
}

.polymer-tooltip.noarrow::after {
  display: none;
}

.polymer-tooltip::after {
  position: absolute;
  border: solid transparent;
  content: '';
  height: 0;
  width: 0;
  border-width: 4px;
}

.top {
  margin-bottom: 10px; /* TODO: not specified in spec */
  bottom: 100%;
}

.right {
  margin-left: 10px; /* TODO: not specified in spec */
  left: 100%;
}

.bottom {
  top: 100%;
  margin-top: 10px; /* TODO: not specified in spec */
}

.left {
  margin-right: 10px; /* TODO: not specified in spec */
  right: 100%;
}

.polymer-tooltip.bottom::after {
  bottom: 100%;
  left: calc(50% - 4px);
  border-bottom-color: rgba(0,0,0,0.8);
}

.polymer-tooltip.left::after {
  left: 100%;
  top: calc(50% - 4px);
  border-left-color: rgba(0,0,0,0.8);
}

.polymer-tooltip.top::after {
  top: 100%;
  left: calc(50% - 4px);
  border-top-color: rgba(0,0,0,0.8);
}

.polymer-tooltip.right::after {
  right: 100%;
  top: calc(50% - 4px);
  border-right-color: rgba(0,0,0,0.8);
}
