/*
Copyright (c) 2016 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
*/

$font-size-small: 13px;
$font-size-medium: 18px;

$small-padding: 20px;
$medium-padding: 40px;
$large-padding: 80px;

$mobile-media-breakpoint: 767px;

$pink-a400: #f50057;
$blue-600: #1e88e5;
$blue-800: #1565c0;
$blue-900: #0d47a1;
$blue-grey-900: #263238;
$blue-grey-50: #eceff1;

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-size: 16px;
  font-family: Helvetica, Arial, sans-serif;
  line-height: 24px;
  font-weight: 300;
}

pw-shell {
  display: block;
  margin-top: 64px;

  /* Set up so the footer is always at the bottom of the screen, regardless
   * of the content size */
  min-height: 100vh;
}

/* For nonversioned pages, the server needs to send both v1 and v2 links for
 * the mobile drawer, since it doesn't know what version was previously
 * selected, but the client should hide the irrelevant links. */
pw-shell[active-docs-version="1.0"] a[data-version="2.0"],
pw-shell[active-docs-version="1.0"] a[data-version="3.0"],
pw-shell[active-docs-version="2.0"] a[data-version="1.0"],
pw-shell[active-docs-version="2.0"] a[data-version="3.0"],
pw-shell[active-docs-version="3.0"] a[data-version="1.0"],
pw-shell[active-docs-version="3.0"] a[data-version="2.0"] {
  display: none;
}

a {
  color: $blue-600;
  text-decoration: none;
  font-weight: 500;

  &:hover {
    text-decoration: underline;
  }
}

/* Don't overflow outside of the content area. */
img {
  max-width: 100%;
}

section {
  padding: $large-padding;
  box-sizing: border-box;

  @media (max-width: $mobile-media-breakpoint) {
    padding: $medium-padding;
  }

  @media (max-width: 500px) {
    padding-left: $small-padding;
    padding-right: $small-padding;
  }

  &.short {
    padding-top: $medium-padding;
    padding-bottom: $medium-padding;

    @media (max-width: $mobile-media-breakpoint) {
      padding-top: $small-padding;
      padding-bottom: $small-padding;
    }
  }

  &.gradient-dark, &.gradient-light {
    background-repeat: repeat-x;
    background-position: bottom;
    /* Use smaller gradient triangles */
    background-size: 20px;

    &.short {
      background-size: 12px;
    }
  }

  &.gradient-dark {
    background-image: url("/images/textures/section-gradient-dark.png");
  }

  &.gradient-light {
    background-image: url("/images/textures/section-gradient-light.png");
  }

  &.gradient-light-flipped {
    background-image: url("/images/textures/section-gradient-light-flipped.png");
    background-repeat: repeat-x;
    background-position: top;
    /* Use smaller gradient triangles */
    background-size: 20px;
  }

  &.light {
    background-color: white;
    color: black;
  }

  &.dark {
    background-color: $blue-grey-900;
    color: white;
  }

  &.grey {
    background-color: $blue-grey-50;
    color: black;
  }

  &.pink {
    background-color: $pink-a400;
  }

  &.blue {
    background-color: $blue-600;
    color: white;

    a {
      color: white;
    }

    .blue-button {
      color: $blue-600;
      background: white;
    }

    h3 {
      margin-bottom: 5px;
    }
  }

  & > * {
    max-width: 900px;
    margin: 0 auto;
  }
}

.section-columns {
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -ms-flex-direction: row;
  -webkit-flex-direction: row;
  flex-direction: row;

  @media (max-width: $mobile-media-breakpoint) {
    display: block;
    /* Switch to a vertical layout */
    -ms-flex-direction: column;
    -webkit-flex-direction: column;
    flex-direction: column;
  }

  & > div:not(:last-child),
  & > p:not(:last-child),
  & > h2:not(:last-child) {
    margin-right: $medium-padding;
    overflow: hidden;

    @media (max-width: $mobile-media-breakpoint) {
      margin-right: 0px;
      margin-bottom: $medium-padding;
    }
  }
}

h2 {
  font-family: 'Roboto Slab', 'Roboto', 'Noto', sans-serif;
  font-size: 24px;
  font-weight: 300;
  line-height: 38px;
  margin: 10px 0;

  @media (max-width: $mobile-media-breakpoint) {
    font-size: 22px;
  }

  &.underline {
    border-bottom: 1px solid $pink-a400;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }
}

h1 {
  font-family: 'Roboto Slab', 'Roboto', 'Noto', sans-serif;
  line-height: 38px;
  margin: 10px 0;
  font-size: 32px;
  font-weight: 400;

  @media (max-width: $mobile-media-breakpoint) {
    font-size: 22px;
  }
}

h3 {
  @media (max-width: $mobile-media-breakpoint) {
    font-size: $font-size-medium;
  }
}

.blue-button {
  color: white;
  background: $blue-600;
  text-transform: uppercase;
  text-decoration: none;
  font-size: $font-size-small;
  font-weight: 400;
  padding: 3px $small-padding;
  margin-bottom: 5px;
  border-radius: 2px;
  text-align: center;
  display: inline-block;

  &:hover, &:focus {
    text-decoration: none;
    outline-color: $pink-a400;
  }

  &.vertical {
    margin-bottom: $small-padding;
    padding: 3px $medium-padding;
    &:first-child {
      margin-top: $small-padding;
    }
  }

  &.full-width {
    width: 100%;
  }

  &.flat {
    color: $blue-600;
    background: transparent;
  }
}

.subsection:not(:last-of-type) {
  border-bottom: 1px solid $pink-a400;
  padding-bottom: $medium-padding;
  margin-bottom: $medium-padding;
}

// TOC and deep links ----
.permalink {
  display: none;
  margin-left: 5px;
  vertical-align: top;
}

.has-permalink:hover .permalink {
  display: initial;
}

.no-permalink .permalink {
  display: none !important;
}

details {
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  cursor: pointer;

  summary {
    outline: none;
  }
}

iron-doc-viewer, iron-doc-element, iron-doc-mixin, iron-doc-module, iron-doc-namespace, iron-doc-class, iron-doc-behavior {
  padding: 20px 40px;
  max-width: 800px;
  margin: 0;

  @media (max-width: $mobile-media-breakpoint) {
    padding: 20px;
  }

  section {
    padding: 0;
  }
}
// -----
