/**
 * @file
 * Positioning for responsive layout .
 *
 * Define CSS classes to create a table-free, 3-column, 2-column, or single
 * column layout depending on whether blocks are enabled in the left or right
 * columns.
 *
 * This layout uses the Zen Grids plugin for Compass: http://zengrids.com
 */

/*
 * Hide the overflow
 */

html, body {
  overflow-x: hidden;
}


/*
 * Center the page.
 */

#page,
.region-bottom {
  /* For screen sizes larger than 1200px, prevent excessively long lines of text
     by setting a max-width. */
  margin-left: auto;
  margin-right: auto;
  max-width: 1200px;
}

/*
 * Apply the shared properties of grid items in a single, efficient ruleset.
 */

#header,
#content,
#navigation,
.region-sidebar-first,
.region-sidebar-second,
#footer {
  padding-left: 10px;
  padding-right: 10px;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -ms-box-sizing: border-box;
  box-sizing: border-box;
  word-wrap: break-word;
  _display: inline;
  _overflow: hidden;
  _overflow-y: visible;
}

/*
 * Containers for grid items and flow items.
 */

#header,
#main,
#footer {
  *position: relative;
  *zoom: 1;
}
#header:before, #header:after,
#main:before, #main:after,
#footer:before, #footer:after {
  content: "";
  display: table;
}
#header:after,
#main:after,
#footer:after {
  clear: both;
}

/*
 * Navigation bar
 */

@media all and (min-width: 480px) {

  #main {
    padding-top: 3em; /* Move all the children of #main down to make room. */
  }

  #navigation {
    position: absolute;
    top: 0; /* Move the navbar up inside #main's padding. */
    height: 3em;
    width: 100%;
  }
}

/*
 * Use 1 column for smaller screens
 */

@media all and (max-width: 480px) {
  /* header, search and main navigation */
  #page {
    position: relative;
  }

  #page #main {
    width: inherit;
    position: relative;
    display: block;
    clear: both;
    padding-top: 60px;
  }

  #page #header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 8px 0;
    background-color: #002d62;
    border-bottom: 5px solid #b87618;
    z-index: 999;
  }

  /* mobile font-sizes */
  #page h1#page-title {
    font-size: 2.4em;
  }

  #page #content article.node-page p.intro {
     font-size: 1.6em;
     margin: 0.5em 0;
     line-height: 1.6;
  }

  #page #block-search-form #edit-submit {
    font-size: 1.6em;
    padding-left: 30px;
  }

  #page .search-form {
    margin: 0;
  }

  #header #block-block-19 {
    display: block;
    position: absolute;
    right: 10px;
    margin-bottom: 0;
  }

  #page #block-search-form {
    position: static;
    top: 0;
    width: 100%;
    clear: both;
    margin-bottom: 0;
  }

  #page #block-search-form form {
    padding: 20px 10px;
  }

  #page #block-search-form input {
    padding: 5px;
  }

  #page #block-search-form .form-text {
    width: 60%;
  }

  #header .main-nice-menu {
    display: inline;
  }

  #header #block-nice-menus-1 {
    float: left;
    margin: 8px 3px -6px 0;
    width: 100%;
    height: auto;
    background: url('../../images/nav-menu.png') 20px 0 no-repeat;
    padding: 25px 30px 0 0;
  }

  #header #block-nice-menus-1 ul#nice-menu-1 {
    display: block;
    width: 100%;
    margin-top: 10px;
    border-bottom: 0;
  }

  #page header #block-nice-menus-1.active {
    padding-right: 5px;
  }

  #header .main-nice-menu li {
    background: transparent;
    clear: both;
    width: 100%;
    padding: 5px 10px 5px 5px;
    color: #FFF;
    border: 0;
    position: relative;
    background: #002d62;
    width: 100%;
  }

  #header .main-nice-menu li:before, #header .main-nice-menu li:after {
     content: "";
     position: absolute;
     background: #002d62;  /* Match the background */
     top: 0;
     bottom: 0;
     width: 9999px;   /* some huge width */
  }

  #header .main-nice-menu li:before,
  #header .main-nice-menu li.odd:before {
     right: 100%;
  }

  #header .main-nice-menu li:after,
  #header .main-nice-menu li.odd:after {
     left: 100%;
  }

  #header .main-nice-menu li.odd,
  #header .main-nice-menu li.odd:before, #header .main-nice-menu li.odd:after {
    background: #ccd5e0;
    color: #002d62;
  }

  #header .main-nice-menu li.menu-parent {
    background: transparent;
  }

  #block-views-homepage-slideshow-block-1 {
    width: inherit;
    overflow: hidden;
  }

  #block-views-homepage-slideshow-block-1 #views_slideshow_cycle_teaser_section_homepage_slideshow-block_1 {
    height: auto;
  }

  #block-views-homepage-slideshow-block-1 .views_slideshow_slide {
    padding: 20px 0;
  }

  #block-views-homepage-slideshow-block-1 .views_slideshow_slide h2 {
    margin: 0;
    width: auto;
  }

  #block-views-homepage-slideshow-block-1 .views_slideshow_slide {
    height: inherit;
  }
  #block-views-homepage-slideshow-block-1 {
    background: -moz-linear-gradient(45deg, rgba(244,237,228,0.9) 0%, rgba(244,237,228,0.9) 1%, rgba(224,207,179,0.9) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,rgba(244,237,228,0.9)), color-stop(1%,rgba(244,237,228,0.9)), color-stop(100%,rgba(224,207,179,0.9))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(45deg, rgba(244,237,228,0.9) 0%,rgba(244,237,228,0.9) 1%,rgba(224,207,179,0.9) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(45deg, rgba(244,237,228,0.9) 0%,rgba(244,237,228,0.9) 1%,rgba(224,207,179,0.9) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(45deg, rgba(244,237,228,0.9) 0%,rgba(244,237,228,0.9) 1%,rgba(224,207,179,0.9) 100%); /* IE10+ */
    background: linear-gradient(45deg, rgba(244,237,228,0.9) 0%,rgba(244,237,228,0.9) 1%,rgba(224,207,179,0.9) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e6f4ede4', endColorstr='#e6e0cfb3',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
  }

  #block-views-homepage-slideshow-block-1 .views-field-field-main-link,
  #block-views-homepage-slideshow-block-1 .views-field-body {
    width: auto;
    padding: 0 10px;
  }

  #block-views-homepage-slideshow-block-1 .views-field-field-main-link {
    top: 290px;
  }

  .view-homepage-widgets.view-display-id-block_2 .views-row {
    display: block;
    clear: both;
    padding: 10px 0;
    border-bottom: 3px solid #f4ece4;
    width: 100%;
  }

  .view-homepage-widgets.view-display-id-block_2 .views-row-last {
    border-bottom: 0;
  }

  /* Remove items not needed for mobile */
  #header #logo,
  #header #block-menu-menu-header-menu,
  #header .main-nice-menu li,
  #block-views-homepage-slideshow-block-1 .views-slideshow-controls-text,
  #block-views-homepage-slideshow-block-1 img,
  #block-views-homepage-slideshow-block-1 .views-field-counter,
  #block-views-homepage-slideshow-block-1 .view-homepage-slideshow .views-field-field-caption,
  span.sidebar-icon {
    display: none;
  }

  #page #header #block-nice-menus-1 ul#nice-menu-1 li.menuparent ul { /* When you're on mobile and don't need to see child menus */
    display: none !important;
  }

  #page .view-homepage-widgets.news-features-events .views-row {
    float: left;
    clear: both;
    width: 100%;
  }

  #block-views-homepage-widgets-block, #block-views-homepage-widgets-block-1 {
    position: static;
  }

  aside,
  #page aside .region-sidebar-second {
    clear: both;
    background: transparent;
  }

  #page .region-bottom #block-block-7 p {
    padding: 10px 20px;
    margin: 0;
  }

  #page #footer .block-menu,
  #page .region-bottom .block-menu {
    clear: both;
    width: 100%;
    border: 0;
  }

 .region-bottom #block-menu-menu-footer-menu {
    margin: 0;
    padding: 0;
  }

  #footer #block-menu-menu-footer-menu ul {
    float: left;
    width: 100%;
  }

  #page .region-bottom #block-menu-menu-footer-menu ul li {
    padding: 0 8px;
    border: 0;
  }

  #page .region-bottom #block-block-7,
  #page #footer #block-block-8 {
    clear: both;
    border-top: 1px solid #334a65;
    padding: 10px 7px;
    float: none;
    text-align: left;
  }

  .region-content-bottom #block-views-faces-of-mathematics-block .views-field {
    float: left;
  }

  .region-content-bottom #block-views-faces-of-mathematics-block .views-field-field-picture {
    margin-top: 0;
    min-height: auto;
  }

  .region-content-bottom #block-views-faces-of-mathematics-block h2,
  .region-content-bottom #block-views-faces-of-mathematics-block .view-header {
    margin-left: 0;
  }

  .region-content-bottom #block-views-faces-of-mathematics-block .views-field-field-fom-image {
    margin-top: 0;
  }

  #header #block-block-23 {
    display: none;
  }
}

@media all and (min-width: 320px) and (max-width: 480px) {
  body #page #block-search-form {
    width: 100%;
  }

  body #page #content,
  body #page .region-sidebar-second {
    margin: 0;
    width: 100%;
  }

  body #page #content .block {
    float: left;
    clear: both;
    width: 100%;
  }
}

/*
 * Use 3 grid columns for smaller screens.
 */

@media all and (min-width: 480px) and (max-width: 959px) { /*(max-width: 959px)*/

  /*
  * Hide the overflow
  */

  html, body {
    overflow-x: hidden;
  }

  /*
   * The layout when there is only one sidebar, the left one.
   */

   #main {
      position: static;
   }

   /* Header menu */
  #page #block-menu-menu-header-menu {
    position: absolute;
    top: 0;
    right: 20px;
    width: auto;
  }

  #views_slideshow_cycle_div_homepage_slideshow-block_1_0 {
    width: 100%;
  }

   /* Website search */
  #page #block-search-form {
    position: absolute;
    top: 60px;
    right: 20px;
    width: 50%;
  }

  .sidebar-first #content { /* Span 2 columns, starting in 2nd column from left. */
    float: left;
    width: 66.667%;
    margin-left: 33.333%;
    margin-right: -100%;
  }
  .sidebar-first .region-sidebar-first { /* Span 1 column, starting in 1st column from left. */
    float: left;
    width: 33.333%;
    margin-left: 0%;
    margin-right: -33.333%;
  }

  #page #block-nice-menus-1 ul#nice-menu-1 li {
    padding: 5px 1px;
  }

  #page #block-nice-menus-1 ul#nice-menu-1 li a {
    padding: 5px 3px;
    margin:0;
  }

  #page #views_slideshow_cycle_main_homepage_slideshow-block_1 {
    min-height: 250px;
  }

  #page .view-homepage-slideshow .views-field-body {
    position: relative;
  }

  #page #views_slideshow_cycle_main_homepage_slideshow-block_1 img {
    position: absolute;
    height: 315px;
  }

  #page .view-homepage-widgets.news-features-events .views-row-odd {
    border: 0;
  }


  #footer #block-block-8 {
    position: relative;
  }

  #footer #block-block-8 img {
    float: left;
    display: inline;
    position: absolute;
    top: 80px;
  }

 #footer #block-block-8 #address {
    display: inline;
    width: 60%;
    text-align: right;
  }

  #footer #block-block-8 #address h4 {
    margin-top: 0;
  }

  .region-bottom #block-block-7,
  #footer #block-block-8 {
    border-top: 1px solid #334a65;
  }

  #page #block-views-homepage-widgets-block-1 .views-field-body {
    min-height: 140px;
  }

  #page #block-views-homepage-widgets-block-1 .views-field-view-node {
    margin-top: 0;
  }

  #page #block-views-homepage-widgets-block-1 .views-slideshow-controls-bottom .views-slideshow-controls-text-previous,
  #page #block-views-homepage-widgets-block-1 .views-slideshow-controls-bottom .views-slideshow-controls-text-next {
    display: none;
  }

  #page #block-views-homepage-widgets-block-1 .views-slideshow-controls-bottom .views-slideshow-slide-counter {
    float: right;
  }

  #page #block-views-faces-of-mathematics-block {
    float: left;
    height: auto;
  }

  #block-views-faces-of-mathematics-block .views-field {
    float: right;
    width: 355px;
  }

  #block-views-faces-of-mathematics-block .view-content .views-field-field-picture {
    min-height: auto;
    margin-top: -140px;
  }

  #block-views-faces-of-mathematics-block .view-content .views-field-body,
  #block-views-faces-of-mathematics-block .view-content .views-field-field-read-more {
    float: left;
    width: 100%;
  }

  #page #block-views-faces-of-mathematics-block .views-field-field-fom-image {
    margin-top: -135px;
  }

  #page #block-views-homepage-widgets-block-1 span.sidebar-icon {
    right: -5px;
  }

  /*
   * The layout when there is only one sidebar, the right one.
   */

  .sidebar-second #content { /* Span 2 columns, starting in 1st column from left. */
    float: left;
    width: 66.667%;
    margin-left: 0%;
    margin-right: -66.667%;
  }
  .sidebar-second .region-sidebar-second { /* Span 1 column, starting in 3rd column from left. */
    float: left;
    width: 33.333%;
    margin-left: 66.667%;
    margin-right: -100%;
  }

  /*
   * The layout when there are two sidebars.
   */

  .two-sidebars #content { /* Span 2 columns, starting in 2nd column from left. */
    float: left;
    width: 66.667%;
    margin-left: 33.333%;
    margin-right: -100%;
  }
  .two-sidebars .region-sidebar-first { /* Span 1 column, starting in 1st column from left. */
    float: left;
    width: 33.333%;
    margin-left: 0%;
    margin-right: -33.333%;
  }
  .two-sidebars .region-sidebar-second { /* Start a new row and span all 3 columns. */
    float: left;
    width: 100%;
    margin-left: 0%;
    margin-right: -100%;
    *position: relative;
    *zoom: 1;
    padding-left: 0;
    padding-right: 0;
    clear: left;
  }
  .two-sidebars .region-sidebar-second:before,
  .two-sidebars .region-sidebar-second:after {
    content: "";
    display: table;
  }
  .two-sidebars .region-sidebar-second:after {
    clear: both;
  }
  .two-sidebars .region-sidebar-second .block {
    padding-left: 10px;
    padding-right: 10px;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -ms-box-sizing: border-box;
    box-sizing: border-box;
    word-wrap: break-word;
    _display: inline;
    _overflow: hidden;
    _overflow-y: visible;
  }
  .two-sidebars .region-sidebar-second .block:nth-child(3n+1) { /* Span 1 column, starting in the 1st column from left. */
    float: left;
    width: 33.333%;
    margin-left: 0%;
    margin-right: -33.333%;
    clear: left;
  }
  .two-sidebars .region-sidebar-second .block:nth-child(3n+2) { /* Span 1 column, starting in the 2nd column from left. */
    float: left;
    width: 33.333%;
    margin-left: 33.333%;
    margin-right: -66.667%;
  }
  .two-sidebars .region-sidebar-second .block:nth-child(3n) { /* Span 1 column, starting in the 3rd column from left. */
    float: left;
    width: 33.333%;
    margin-left: 66.667%;
    margin-right: -100%;
  }
}

/*
 * Use 5 grid columns for larger screens.
 */

@media all and (min-width: 960px) {

  #footer,
  .region-bottom {
    float: left;
    width: 100%;

  }

  #page #footer .block-menu {
    width: 17%;

  }

  #header .main-nice-menu li.first {
    margin-left: 10px;
  }

 /*
   * The layout when there is only one sidebar, the left one.
   */

   .two-sidebars.not-front .region-sidebar-second {
      float: left;
      clear: both;
      background: transparent;
      width: 100%;
      margin: 1em 0;
   }

   .two-sidebars.not-front .region-sidebar-second .block {
      display: inline-block;
      width: 32%;
      margin: 0 5px;
      vertical-align: top;
   }

  .sidebar-first #content { /* Span 4 columns, starting in 2nd column from left. */
    float: left;
    width: 65%;
    margin-left: 35%;
    margin-right: -100%;
  }
  .sidebar-first .region-sidebar-first { /* Span 1 column, starting in 1st column from left. */
    float: left;
    width: 25%;
    margin-left: 0%;
    margin-right: -35%;
  }

  #page .view-homepage-widgets.news-features-events .views-row {
    width: 45%;
  }

  #page #footer #block-block-8 {
    clear: both;
    margin: 0;
    padding: 0;
    position: absolute;
    right: 0;
    height: 100%;
    width: 240px;
  }

  #page #footer #block-block-8 #address {
    text-align: right;
  }

  #page #footer #block-block-8 img {
    position: absolute;
    bottom: 30px;
  }

  /*
   * The layout when there is only one sidebar, the right one.
   */

  .sidebar-second #content { /* Span 4 columns, starting in 1st column from left. */
    float: left;
    width: 70%;
    margin-left: 0%;
    margin-right: -70%;
  }
  .sidebar-second .region-sidebar-second { /* Span 1 column, starting in 5th column from left. */
    float: left;
    width: 30%;
    margin-left: 70%;
    margin-right: -100%;
  }

  /*
   * The layout when there are two sidebars.
   */

  .two-sidebars #content { /* Span 3 columns, starting in 2nd column from left. */
    float: left;
    width: 70%;
    margin-left: 30%;
    margin-right: -100%;
  }
  .two-sidebars .region-sidebar-first { /* Span 1 column, starting in 1st column from left. */
    float: left;
    width: 25%;
    margin-left: 0%;
    margin-right: -25%;
  }
  .two-sidebars .region-sidebar-second { /* Span 1 column, starting in 5th column from left. */
    float: left;
    width: 20%;
    margin-left: 80%;
    margin-right: -100%;
  }
}
