/*
Copyright 2015 Google Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/


@import './progress-bar.css';
@import './site.css';


:root {
  --Header-text-color-light: #eee;
  --Header-text-color-light-faded: #bbb;

  --Header-text-color-dark: var(--text-color);
  --Header-text-color-dark-faded: #999;

  --Header-overlay-color: rgba(0,0,0,.3);
  --Header-overlay-color-light: rgba(0,0,0,.1);
}

.Header {
  position: relative;
}

.Header-block {
  background: var(--bg-color-dark);
  box-shadow: 0 0 .5em rgba(0,0,0,.1);
  padding: 1em var(--gap);
  position: relative;
}

.Header-menu {
  cursor: pointer;
  display: flex;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.Header-menuIcon {
  border-radius: .333em;
  color: #bbb;
  display: flex;
  font-size: 1.3125em;
  margin: -.333em -.5em;
  padding: .333em .5em;
}

.Header-menuIcon:hover {
  background: var(--Header-overlay-color);
  color: #fff;
}

.Header-user {
  display: none;
}

.Header-auth {
  text-align: center;
}


.Header-auth .gapi-analytics-auth-styles-signinbutton {
  background: var(--ga-orange-light);
  border-radius: 0;
  display: block;
  padding: 1em var(--gap);
  transition: background-color .2s var(--quantum-timing);
  width: auto;
}

.Header-auth .gapi-analytics-auth-styles-signinbutton:hover {
  background: var(--ga-orange-dark);
  cursor: pointer;
}

.Header-auth .gapi-analytics-auth-styles-signinbutton-image,
.Header-auth .gapi-analytics-auth-styles-signinbutton-buttonText {
  display: inline-block;
  vertical-align: middle;
}

.Header-auth .gapi-analytics-auth-styles-signinbutton-image {
  background: url('/public/images/ga-mark-white.svg') no-repeat 0 50%;
  background-size: 1.5em;
  border: 0;
  height: 1.5em;
  padding-left: 2.5em;
  width: auto;
}

.Header-auth .gapi-analytics-auth-styles-signinbutton-image::after {
  content: 'Click here to authorize\00a0\00a0→';
}

.Header-auth .gapi-analytics-auth-styles-signinbutton-buttonText {
  display: none;
}

.Header-signOut {
  display: none;
}

.Header-progressIndicator {
  bottom: -3px;
  height: 3px;
  left: 0;
  position: absolute;
  right: 0;
  transform: scaleY(0);
  transform-origin: 0 0;
  transition: all .5s var(--quantum-timing);
  visibility: hidden;
}

.Site.is-loading .Header-progressIndicator {
  animation: Header-showProgressIndicator .5s var(--quantum-timing);
  transform: scaleY(1);
  visibility: visible;
}

.Site.is-needingAuthorization .Header-progressIndicator {
  visibility: hidden;
  transform: scaleY(0);
  transition: none;
}

@keyframes Header-showProgressIndicator {
  0% {
    transform: scaleY(0);
  }
}


/* The user is signed in
   ========================================================================== */

.Site.is-authorized .Header-user {
  cursor: pointer;
  display: flex;
  position: absolute;
  right: var(--gap);
  top: 50%;
  transform: translateY(-50%);
}

.Site.is-authorized .Header-userIcon {
  border-radius: .333em;
  color: var(--Header-text-color-light-faded);
  display: flex;
  font-size: 1.3125em;
  margin: -.333em -.5em;
  padding: .333em .5em;
}

.Site.is-authorized .Header-userIcon:hover {
  background: var(--Header-overlay-color);
  color: #fff;
}

.Site.is-authorized .Header-auth {
  display: none;
}

/* The user has opened the header drawer (showing the user info).
   ========================================================================== */

.Header.is-open .Header-auth {
  background: #fff;
  box-shadow: 0 0 .5em var(--Header-overlay-color-light);
  color: var(--text-color-faded);
  display: block;
  padding: 1em var(--gap);
  text-align: center;
}

.Header.is-open .Header-embedApi,
.Header.is-open .Header-signOut {
  display: inline-block;
  padding: 0 .5em;
}

.Header.is-open .Header-userIcon {
  background: var(--Header-overlay-color);
  color: #fff;
}

.Header.is-open .Header-user::before {
  border-color: transparent transparent currentColor;
  border-width: 0 .333em .333em;
}

@media (--break-lg) {

  .Header-block {
    background: #fff;
    padding: var(--gap-lg) calc(var(--gap-lg)*1.5) calc(var(--gap-lg)*1.5);
  }

  .Header-menu {
    display: none;
  }

  .Site.is-authorized .Header-user {
    right: var(--gap-lg);
    top: var(--gap-lg);
    transform: none;
  }

  .Site.is-authorized .Header-userIcon {
    color: var(--Header-text-color-dark-faded);
    margin: 0;
  }

  .Site.is-authorized .Header-userIcon:hover,
  .Header.is-open .Header-userIcon {
    background: var(--Header-overlay-color-light);
    color: var(--Header-text-color-dark);
  }

  .Header.is-open .Header-auth {
    background: #fff;
    border-radius: .5em;
    box-shadow: 0 0 0 1px var(--Header-overlay-color-light);
    padding: 0 .5em;
    position: absolute;
    line-height: 2.4em;
    right: 6em; /* covers the width of the user icon + spacing */
    text-align: right;
    top: 2em;
  }

  .Header.is-open .Header-auth * {
    vertical-align: baseline;
  }

  .Header-auth .gapi-analytics-auth-styles-signinbutton {
    font-size: 1em;
    padding: 1.5em calc(var(--gap-lg)*1.5);
    text-align: left;
  }

}
