// studio - base styling
// ====================

// Table of Contents
// * +Basic Setup
// * +Typography - Basic
// * +Typography - Primary Content
// * +Typography - Secondary Content
// * +Typography - Loose Headings
// * +Layout - Basic
// * +Layout - Basic Page Header
// * +Layout - Basic Page Content
// * +Layout - Primary Content
// * +Layout - Supplemental Content
// * +Layout - Grandfathered
// * +UI - Actions
// * +UI - Misc
// * +Utility - Basic
// * +JS Dependent

// +Basic Setup
// ====================
html {
  font-size: 62.5%;
  height: 102%; // force scrollbar to prevent jump when scroll appears, cannot use overflow because it breaks drag
}

body {
  @extend %t-copy-base;

  min-width: $fg-min-width;
  background: $uxpl-grayscale-x-back;
  color: $gray-d3;
}

body,
input,
button {
  font-family: 'Open Sans', sans-serif;
}

// removing the outline on any element that we make programmatically focusable
[tabindex="-1"] {
  outline: none;
}

a {
  @include transition(color $tmg-f2 ease-in-out 0s);

  text-decoration: none;
  color: theme-color("primary");

  &:hover {
    color: $uxpl-blue-hover-active;
  }
}

h1 {
  @extend %t-title4;
  @extend %t-light;
}

.waiting {
  opacity: 0.1;
}

.page-actions {
  margin-bottom: ($baseline*1.5);
}

.wrapper {
  @include clearfix();
  @include box-sizing(border-box);

  width: 100%;
}

// +Typography - Basic
// ====================
.page-header {
  @extend %t-title3;
  @extend %t-strong;

  display: block;
  color: $gray-d3;

  .navigation,
  .subtitle {
    @extend %t-title7;
    @extend %t-regular;

    position: relative;
    top: ($baseline/4);
    display: block;
    color: $gray-d2;
  }
}

.section-header {
  @extend %t-title4;
  @extend %t-strong;

  .subtitle {
    @extend %t-title7;
  }
}

.area-header {
  @extend %t-title6;
  @extend %t-strong;

  .subtitle {
    @extend %t-title8;
  }
}

.area-subheader {
  @extend %t-title7;
  @extend %t-strong;

  .subtitle {
    @extend %t-title9;
  }
}

// +Typography - Primary Content
// ====================
.content-primary {
  .section-header {
    color: $gray-d3;

    .subtitle {
      color: $gray-l2;
    }
  }

  .content-header {
    color: $gray-d3;

    .subtitle {
      color: $gray-l2;
    }
  }

  .area-header {
    color: $gray-d3;

    .subtitle {
      color: $gray-l2;
    }
  }

  .area-subheader {
    color: $gray-d3;

    .subtitle {
      color: $gray-l2;
    }
  }
}

// +Typography - Secondary Content
// ====================
.content-secondary {
  .section-header {
    color: $gray-d3;

    .subtitle {
      color: $gray-l2;
    }
  }

  .content-header {
    color: $gray-d3;

    .subtitle {
      color: $gray-l2;
    }
  }

  .content-header {
    color: $gray-d3;

    .subtitle {
      color: $gray-l2;
    }
  }
}

// +Typography - Loose Headings  (BT: needs to be removed once html is clean)
// ====================
.title-1,
.title-2,
.title-3,
.title-4,
.title-5,
.title-6 {
  @extend %t-strong;
}

.title-1 {
  @extend %t-title3;

  margin-bottom: ($baseline*1.5);
}

.title-2 {
  @extend %t-title4;

  margin-bottom: $baseline;
}

.title-3 {
  @extend %t-title5;

  margin-bottom: ($baseline/2);
}

.title-4 {
  @extend %t-title7;
  @extend %t-regular;

  margin-bottom: $baseline;
}

.title-5 {
  @extend %t-title7;
  @extend %t-regular;

  color: $gray-l1;
  margin-bottom: $baseline;
}

.title-6 {
  @extend %t-title7;
  @extend %t-regular;

  color: $gray-l2;
  margin-bottom: $baseline;
}

p,
ul,
ol,
dl {
  margin-bottom: ($baseline/2);

  &:last-child {
    margin-bottom: 0;
  }
}

// +Layout - Basic Page Header
// ====================
.wrapper-mast {
  margin: ($baseline*1.5) 0 0 0;
  padding: 0 $baseline;
  position: relative;

  .mast, .metadata {
    @include clearfix();

    position: relative;
    max-width: $fg-max-width;
    min-width: $fg-min-width;
    width: flex-grid(12);
    margin: 0 auto $baseline auto;
    color: $gray-d2;
  }

  .mast {
    border-bottom: 1px solid $gray-l4;
    padding-bottom: ($baseline/2);

    // layout with actions
    .page-header {
      width: flex-grid(12);
    }

    // layout with actions
    &.has-actions {
      @include clearfix();

      .page-header {
        @include float(left);
        @include margin-right(flex-gutter());

        width: flex-grid(6, 12);
      }

      .nav-actions {
        @include float(left);
        @include text-align(right);

        position: relative;
        bottom: -($baseline*0.75);
        width: flex-grid(6, 12);

        .nav-item {
          display: inline-block;
          vertical-align: top;

          @include margin-right($baseline/2);

          &:last-child {
            @include margin-right(0);
          }
        }

        // buttons
        .button {
          padding: ($baseline/4) ($baseline/2) ($baseline/3) ($baseline/2);
        }
      }
    }

    // layout with actions
    &.has-subtitle {
      .nav-actions {
        bottom: -($baseline*1.5);
      }
    }

    // layout with navigation
    &.has-navigation {
      .nav-actions {
        bottom: -($baseline*1.5);
      }

      .navigation-link {
        @extend %cont-truncated;

        display: inline-block;
        vertical-align: bottom; // correct for extra padding in FF
        max-width: 250px;

        &.navigation-current {
          @extend %ui-disabled;

          color: $gray;
          max-width: 250px;

          &::before {
            color: $gray;
          }
        }
      }

      .navigation-link::before {
        content: " / ";
        margin: ($baseline/4);
        color: $gray;

        &:hover {
          color: $gray;
        }
      }

      .navigation .navigation-link:first-child::before {
        content: "";
        margin: 0;
      }
    }
  }

  // CASE: wizard-based mast
  .mast-wizard {
    .page-header-sub {
      @extend %t-title4;

      color: $gray;
      font-weight: 300;
    }

    .page-header-super {
      @extend %t-title4;

      float: left;
      width: flex-grid(12, 12);
      margin-top: ($baseline/2);
      border-top: 1px solid $gray-l4;
      padding-top: ($baseline/2);
      font-weight: 600;
    }
  }

  // page metadata/action bar
  .metadata {

  }
}

// +Layout - Basic Page Content
// ====================
.wrapper-content {
  margin: 0;
  padding: 0 $baseline;
  position: relative;
}

.content {
  @include clearfix();

  @extend %t-copy-base;

  max-width: $fg-max-width;
  min-width: $fg-min-width;
  width: flex-grid(12);
  margin: 0 auto;
  color: $gray-d2;

  header {
    position: relative;
    margin-bottom: $baseline;
    border-bottom: 1px solid $gray-l4;
    padding-bottom: ($baseline/2);

    .title-sub {
      @extend %t-copy-sub1;

      display: block;
      margin: 0;
      color: $gray-l2;
    }

    .title-1 {
      @extend %t-title3;

      margin: 0;
      padding: 0;
      font-weight: 600;
      color: $gray-d3;
    }
  }
}

.content-primary, .content-supplementary {
  @include box-sizing(border-box);
}

// +Layout - Primary Content
// ====================
.content-primary {
  .title-1 {
    @extend %t-title3;
  }

  .title-2 {
    @extend %t-title4;

    margin: 0 0 ($baseline/2) 0;
  }

  .title-3 {
    @extend %t-title6;

    margin: 0 0 ($baseline/2) 0;
  }

  header {
    @include clearfix();

    .title-2 {
      width: flex-grid(5, 12);
      margin: 0 flex-gutter() 0 0;
      float: left;
    }

    .tip {
      @extend %t-copy-sub2;

      @include text-align(right);
      @include float(right);

      width: flex-grid(7, 12);
      margin-top: ($baseline/2);
      color: $gray-d1;
    }
  }
}

// +Layout - Supplemental Content
// ====================
.content-supplementary {
  > section {
    margin: 0 0 $baseline 0;
  }
}

// +Layout - Grandfathered
// ====================
.main-wrapper {
  position: relative;
  margin: 0 ($baseline*2);
}

.inner-wrapper {
  @include clearfix();

  position: relative;
  max-width: 1280px;
  margin: auto;

  > article {
    clear: both;
  }
}

.main-column {
  clear: both;

  @include float(left);

  width: 70%;
}

.sidebar {
  @include float(right);

  width: 28%;
}

.left {
  @include float(left);
}

.right {
  @include float(right);
}

// +UI - Actions
// ====================
.new-unit-item,
.new-subsection-item,
.new-policy-item {
  @include grey-button();

  @extend %t-action5;

  margin: ($baseline/2);
  padding: 3px ($baseline/2) 4px ($baseline/2);

  .new-folder-icon,
  .new-policy-icon,
  .new-unit-icon {
    position: relative;
    top: 2px;
  }
}

.item-actions {
  position: absolute;
  top: 5px;

  @include right(5px);

  .edit-button,
  .delete-button,
  .visibility-toggle {
    float: left;
    margin-right: 13px;
    color: #a4aab7;
  }
}

// +UI - Misc
// ====================
hr.divide {
  @extend %cont-text-sr;
}

.item-details {
  float: left;
  padding: ($baseline/2) 0;
}

.details {
  @extend %t-copy-sub1;

  display: none;
  margin-bottom: ($baseline*1.5);
}

.window {
  .window-contents {
    padding: 20px;
  }

  .header {
    @include linear-gradient(top, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));

    @extend %t-title7;

    padding: 6px 14px;
    border-bottom: 1px solid $mediumGrey;
    border-radius: 2px 2px 0 0;
    background-color: $lightBluishGrey;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
  }

  label {
    display: block;
    margin-bottom: 6px;

    @extend %t-strong;

    &.inline-label {
      display: inline;
    }

    .description {
      @extend %t-copy-sub2;
      @extend %t-regular;

      display: block;
      font-style: italic;
      color: #999;
    }
  }

  .row {
    margin-bottom: ($baseline/2);
    padding-bottom: ($baseline/2);
    border-bottom: 1px solid #cbd1db;
  }
}

// +Utility - Basic
// ====================

// UI - semantically hide text
.sr, .sr-only {
  @extend %cont-text-sr;
}

// UI - faking a link's behavior
.fake-link {
  @extend %ui-fake-link;
}

// UI - disabled
.is-disabled {
  @extend %ui-disabled;
}

// ui - semantic + visual divider
hr.divider {
  @extend %cont-text-sr;
}

// ui - skipnav
.nav-skip,
.transcript-skip {
  @extend %t-action3;

  display: inline-block;
  position: absolute;
  left: 0;
  top: -($baseline*30);
  overflow: hidden;
  background: $white;
  border-bottom: 1px solid $gray-l4;
  padding: ($baseline*0.75) ($baseline/2);

  &:focus,
  &:active {
    position: relative;
    top: auto;
    width: auto;
    height: auto;
    margin: 0;
  }
}

// lean/simple modal window
.content-modal {
  @include border-bottom-radius(2px);
  @include box-sizing(border-box);

  position: relative;
  display: none;
  width: 700px;
  padding: ($baseline);
  border: 1px solid $gray-d1;
  background: $white;
  box-shadow: 0 2px 4px $shadow-d1;
  overflow: hidden;

  .action-modal-close {
    @include transition(top $tmg-f3 ease-in-out 0s);
    @include border-bottom-radius(3px);

    position: absolute;
    top: -3px;
    right: $baseline;
    padding: ($baseline/4) ($baseline/2) 0 ($baseline/2);
    background: $gray-l3;
    text-align: center;

    .label {
      @extend %cont-text-sr;
    }

    .icon {
      @extend %t-action1;

      color: $white;
    }

    &:hover,
    &:active {
      top: 0;
      background: theme-color("primary");
    }
  }

  img {
    @include box-sizing(border-box);

    width: 100%;
    overflow-y: scroll;
    padding: ($baseline/10);
    border: 1px solid $gray-l4;
  }

  .title {
    @extend %t-title5;
    @extend %t-strong;

    margin: 0 0 ($baseline/2) 0;
    color: $gray-d3;
  }

  .description {
    @extend %t-copy-sub2;

    margin-top: ($baseline/2);
    color: $gray-l1;
  }
}
