// Open edX: LMS footer
// ====================
@import '../base/grid-settings';
@import 'neat/neat'; // lib - Neat

.wrapper-footer {
  box-shadow: 0 -1px 5px 0 rgba(0,0,0, 0.1);
  border-top: 1px solid tint($m-gray,50%);
  padding: 25px ($baseline/2) ($baseline*1.5) ($baseline/2);
  background: $footer-bg;
  clear: both;

  footer {
    @include clearfix();
    @include box-sizing(border-box);
    max-width: grid-width(12);
    min-width: 760px;
    width: flex-grid(12);
    margin: 0 auto;

    p, ol, ul {
      font-family: $sans-serif;
    }

    a {
      @include transition(link-color 0.15s ease-in-out 0s, border 0.15s ease-in-out 0s);
      border-bottom: none;
      color: $link-color;
      text-decoration: none !important;
      font-family: $sans-serif;

      &:hover, &:focus, &:active {
        border-bottom: 1px dotted $link-color;
        color: $link-color;
      }
    }

    // colophon
    .colophon {
      @include margin-right(flex-gutter());
      width: flex-grid(8,12);
      @include float(left);

      .nav-colophon {
        @include clearfix();
        margin: $footer_margin;

        li {
          @include float(left);
          margin-right: ($baseline*0.75);

          a {
            color: tint($black, 20%);

            &:hover, &:focus, &:active {
              color: $link-color;
            }
          }

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

      .colophon-about {
        @include clearfix();

        img {
          width: 68px;
          height: 34px;
          margin-right: 0;
          float: left;
        }

        p {
          float: left;
          width: flex-grid(6,8);
          margin-left: $baseline;
          padding-left: $baseline;
          font-size: em(13);
          background: transparent url(/static/images/bg-footer-divider.jpg) 0 0 no-repeat;
        }
      }
    }

    // references
    .references {
      margin: -10px 0 0 0;
      width: flex-grid(4,12);
      display: inline-block;
    }

    .wrapper-logo {
      margin: ($baseline*.75) 0;

      a {
        display: inline-block;

        &:hover {
          border-bottom: 0;
        }
      }
    }

    .copyright {
      margin: -2px 0 8px 0;
      font-size: em(11);
      color: $gray-l2;
      @include text-align(left);
    }

    .nav-legal {
      @include clearfix();
      @include text-align(left);

      li {
        display: inline-block;
        font-size: em(11);

        a {
          display: block;
        }
      }

      .nav-legal-01 a {

        &:after {
          margin-left: 5px;
          content: "-";
        }
      }
    }

    .nav-social {
      margin: 0;
      text-align: right;

      li {
        display: inline-block;

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

        a {
          display: block;

          &:hover, &:focus, &:active {
            border: none;
          }
        }

        img {
          display: block;
        }
      }
    }

    // platform Open edX logo and link
    .powered-by {
      @include float(right);
      width: flex-grid(3,12);
      display: inline-block;
      vertical-align: bottom;
      @include text-align(right);

      a {
        display: inline-block;

        &:hover {
          border-bottom: none;
        }
      }
    }
  }

  // edx theme overrides
  &.edx-footer {

    footer {

      .copyright {
        text-align: right;
      }

      .nav-legal {
        text-align: right;
      }
    }
  }
}

// marketing site design syncing
.view-register, .view-login, .view-passwordreset {

  .wrapper-footer footer {
    width: 960px;

    .colophon-about img {
      margin-top: ($baseline*1.5);
    }
  }
}


// edX theme: LMS Footer
// ====================
$edx-footer-spacing: ($baseline*0.75);
$edx-footer-link-color: rgb(0, 158, 231);
$edx-footer-bg-color: rgb(252,252,252);

%edx-footer-reset {
  @include box-sizing(border-box);
}

%edx-footer-section {
  float: left;
  min-height: ($baseline*17.5);
  margin-right: flex-gutter();
  border-right: 1px solid rgb(230, 230, 230);
  padding-right: ($baseline*1.5);

  // CASE: last child
  &:last-child {
    margin-right: 0;
    border: none;
    padding-right: 0;
  }
}

%edx-footer-title {
  // TODO: refactor _typography.scss to extend this set of styling
  @extend %t-title;
  @extend %t-weight4;
  @include font-size(15);
  @include line-height(15);
  text-transform: none;
  letter-spacing: inherit;
  color: rgb(61, 62, 63);
}

%edx-footer-link {
  @extend %t-copy-sub1;
  @include transition(color $tmg-f2 ease-in-out 0);
  display: block;
  margin-bottom: ($baseline/2);

  // NOTE: resetting poor link styles
  border: none;
  padding: 0;
  color: $edx-footer-link-color;

  .copy {
    @include transition(border-color $tmg-f2 ease-in-out 0);
    display: inline-block;
    border-bottom: 1px solid transparent;
    padding: 0 0 ($baseline/20) 0;
    color: $edx-footer-link-color;
  }

  // STATE: hover + focused
  &:hover, &:focus {
    color: saturate($edx-footer-link-color, 25%);

    // NOTE: resetting poor link styles
    border: none;

    .copy {
      border-bottom-color: saturate($edx-footer-link-color, 25%);
    }
  }

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

  // CASE: has visual emphasis
  &.has-emphasis {
    @extend %t-weight4;

    .copy {
      @extend %t-weight4;
    }
  }
}

.edx-footer-new {
  background: $edx-footer-bg-color;

  // NOTE: resetting older footer styles - can be removed once not needed
  box-shadow: none;
  border-top: none;
  padding: ($baseline*2) $baseline;

  // about
  // --------------------
  .footer-about {
    @extend %edx-footer-reset;
    @extend %edx-footer-section;
    width: flex-grid(6,12);
  }

  .footer-about-title {
    @extend %edx-footer-title;
  }

  .footer-about-logo {
    margin-bottom: $edx-footer-spacing;
  }

  .footer-about-copy {
    @extend %t-copy-sub1;
    margin-bottom: $edx-footer-spacing;
    color: rgb(61, 62, 63);

    p {
      // NOTE: needed for poor LMS span styling
      color: inherit;
    }
  }

  .footer-about-copyright {
    @extend %t-copy-sub1;
    margin-bottom: $edx-footer-spacing;
    color: rgb(138, 140, 143);

    p {
      // NOTE: needed for poor LMS span styling
      color: inherit;
    }
  }

  .footer-about-links {

    a {
      @extend %edx-footer-link;
      margin-bottom: ($edx-footer-spacing/2);
    }

    .note {
      color: rgb(138, 140, 143);
    }
  }

  // nav (learn more links)
  // --------------------
  .footer-nav {
    @extend %edx-footer-reset;
    @extend %edx-footer-section;
    width: flex-grid(3,12);
  }

  .footer-nav-title {
    @extend %edx-footer-title;
    margin-top: $baseline;
  }

  .footer-nav-links {
    margin-bottom: ($edx-footer-spacing*2.25);

    a {
      @extend %edx-footer-link;
    }
  }

  // follow (social media)
  // --------------------
  .footer-follow {
    @extend %edx-footer-reset;
    @extend %edx-footer-section;
    width: flex-grid(3,12);

  }

  .footer-follow-title {
    @extend %edx-footer-title;
    margin-top: $baseline;
  }

  .footer-follow-links {

    a {
      @extend %edx-footer-link;
      margin-top: 20px;

      .icon, .copy {
        display: inline-block;
        vertical-align: middle;
      }

      .icon {
        @extend %t-icon3;
        margin-right: ($baseline/4);
        text-align: center;
        min-width: ($baseline*1.5);
      }

      .copy {
        // NOTE: needed for poor LMS span styling
        color: inherit;
      }
    }
  }

  &.rwd {
    @include box-sizing(border-box);
    @include outer-container;

    &.wrapper-footer footer {
      min-width: 0;
    }

    .footer-about,
    .footer-nav,
    .footer-follow {
      @include span-columns(12);
    }

    @include media( $tablet ) {
    }

    @include media( $desktop ) {
      .footer-about {
        @include span-columns(6);
      }

      .footer-nav,
      .footer-follow {
        @include span-columns(3);
      }
    }
  }
}
