* {
    box-sizing: border-box;
}

html {
    height: 100%;
    padding: 0;
    margin: 0;
}

body {
    background-color: $bg;
    font-family: "Open Sans", sans-serif;
    font-size: $base-font-size;
    line-height: $base-line-height;
    margin: 0;
    word-wrap: break-word;
}

a:link {
    text-decoration: none;
    color: #000;
}

a:visited {
    color: #000;
}

a:active,
a:hover {
    color: $bold;
}

h1 {
    font-size: 2 * $base-font-size;
    line-height: 2 * $base-line-height;
}

h2 {
    font-size: 1.5 * $base-font-size;
    line-height: 1.5 * $base-line-height;
}

h3 {
    font-size: 1.25 * $base-font-size;
    line-height: 1.5 * $base-line-height;
}

h4 {
    font-size: 1.125 * $base-font-size;
}

img {
    max-width: 100%;
    height: auto;
}

/* @group ----- Forms ----- */

input,
textarea,
button,
.button,
select {
    font-family: "Open Sans", sans-serif;
    font-size: $base-font-size;
    line-height: $base-line-height;
    margin: 0;
    vertical-align: top;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
textarea {
    appearance: none;
    border-radius: 0;
    height: 1.5 * $spacing-l;
    border: 1px solid $light;
    padding: ($spacing-s - 1px) gutter();
    margin: 0;
}

textarea {
    height: 3 * $spacing-l;
}

input[type="file"] {
    line-height: 1;
    vertical-align: bottom;
    font-size: .75 * $base-font-size;
}

button,
a.button,
[type="submit"] {
    background-color: $light;
    border-radius: 2px;
    padding: $spacing-s;
    display: inline-block;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 0;
    cursor: pointer;
}

select {
    background-color: #fff;
    padding: $spacing-s;
    border-color: $light;
    height: 1.5 * $spacing-l;
}

::-webkit-input-placeholder {
   font-style: italic;
}

:-moz-placeholder { /* Firefox 18- */
   font-style: italic;
}

::-moz-placeholder {  /* Firefox 19+ */
   font-style: italic;
}

:-ms-input-placeholder {
   font-style: italic;
}

.field {
    margin: $spacing-l 0;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

.field .field-meta {
    width: 30%;
    padding: $spacing-s gutter() 0 0;
}

.field .inputs {
    width: 70%;
    padding-left: gutter();

    & > select,
    & > textarea,
    & > input[type="text"],
    & > input[type="password"],
    & > input[type="email"],
    & > input[type="url"] {
        width: 100%;
    }

    input[type="checkbox"] {
        vertical-align: bottom;
    }
}

.field.required .field-meta:after {
    content: "\f069";
    font-family: "FontAwesome";
    font-size: .75 * $base-font-size;
}

.field .value:not(:last-child) {
    margin-bottom: $spacing-m;
}

.field-description {
    font-size: .75 * $base-font-size;
}

/* @end */

/* @group ----- Navigation ----- */

header nav {
    position: relative;
    margin: $spacing-m 0 (-$spacing-m);
    padding: 0;
}

header nav.closed ul {
    height: 0;
    overflow: hidden;
    margin: 0;
}

header nav:before {
    font-family: "FontAwesome";
    content: "\f0c9";
    display: block;
    width: 1.25 * $spacing-l;
    height: 1.25 * $spacing-l;
    border: 1px solid $light;
    text-align: center;
    border-radius: 2px;
    position: absolute;
    right: gutter();
    top: -(1.75 * $spacing-l);
    cursor: pointer;
    line-height: 1.25 * $base-line-height;
}

header nav.open:before {
    content: "\f00d";
}

header nav ul {
    padding-left: 0;
    list-style: none;
    position: relative;
    margin: 0 auto;

    a {
        display: inline-block;
        width: 100%;
        padding: $spacing-s;
    }

    a:hover {
        border-bottom: 0;
        background-color: $light;
    }

    li {
        border-top: 1px solid $light;
        position: relative;
    }

    li li:last-of-type {
        padding-bottom: 0;
    }

    li.active {
        font-weight: bold;
    }

    li > ul:before {
        font-family: "FontAwesome";
        content: "\f105";
        position: absolute;
        right: 0;
        top: -(1.5 * $spacing-l);
        color: $light;
        width: $spacing-l;
        height: 1.5 * $spacing-l;
        line-height: 1.5 * $base-line-height;
        text-align: center;
    }

    li > ul:hover:before {
        content: "\f107";
    }

    a:hover ~ ul:before {
        color: $gray;
    }
}

header nav > ul > li:last-child {
    border-bottom: 1px solid $light;
    padding-bottom: -1px;
}

header nav > ul ul li {
    height: 0;
    overflow: hidden;
    border: 0;
}

header nav > ul ul:hover > li {
    height: auto;
    border-top: 1px solid $light;
    padding-top: -1px;
}

/* Second level items */
header nav > ul > li > ul > li.active > a {
    margin-left: -1.5em;
}

header nav > ul > li > ul > li.active > a:before {
    content: ">";
    display: inline-block;
    width: 1.5em;
}

header nav > ul > li > ul > li a {
    padding-left: $spacing-l;
}

/* Third level items */
header nav > ul > li > ul > li > ul > li a {
    padding-left: 2 * $spacing-l;
}

.sub-menu ul {
    padding-left: 0;
    list-style-type: none;
    margin-top: $spacing-m;
}

.sub-menu li {
    font-size: .75 * $base-font-size;
    font-weight: bold;
    border-bottom: 1px solid $light;
    padding: $spacing-s 0 ($spacing-s - 1px);

    &:first-of-type {
        border-top: 1px solid $light;
        padding-top: ($spacing-s - 1px);
    }
}

nav.pagination {
    margin-bottom: $spacing-l;
    font-size: $base-font-size;
    line-height: 1.5 * $base-line-height;
}

.pagination input {
    text-align: center;
}

.resource-list + .pagination {
    border-color: transparent;
}

.pagination form {
    min-width: 3 * $spacing-l;
}

.pagination form,
.pagination .button,
.pagination button,
.pagination .page-count {
    display: inline-block;
    vertical-align: top;
    height: 1.5 * $base-line-height;
}

.pagination .button {
    border: 1px solid $light;
    background-color: $light;
    width: 1.5 * $spacing-l;
    text-align: center;
    padding: $spacing-s;
    border-radius: 2px;
    color: $gray;
    line-height: $base-line-height;

    &:hover {
        background-color: $bold;
    }
}

.pagination .inactive.button {
    opacity: .5;
    background-color: white;

    &:hover {
        background-color: white;
    }
}

.pagination form,
.pagination .last {
    margin-right: $spacing-s;
}

.pagination input {
    width: 2 * $spacing-l;
}

.breadcrumbs {
    font-size: .75 * $base-font-size;
    margin: $spacing-l 0 (-$spacing-m);
}

/* @end */

/* @group ----- Header ----- */

.site-title h1 {
    font-size: 1.25 * $base-font-size;
    line-height: $base-line-height;
    padding-right: $base-line-height;
}

header {
    background-color: #fff;
    margin: 0 0 (2.5 * $spacing-l);
    padding-top: $spacing-m;
    border-bottom: 1px solid $light;
    padding-bottom: ($spacing-m - 1px);
    position: relative;

    & > * {
        @include container;
        padding: 0 gutter();
        display: block;
    }
}

.site-title:hover,
.site-title:active {
    border-bottom: 0;
}

.site-title h1 {
    margin: 0;
}

button.o-icon-search {
    display: none;
}

#search {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    border-bottom: 1px solid $light;
    border-top: 1px solid $light;
    padding: $spacing-s gutter();
}

#search form {
    display: flex;
    flex-wrap: nowrap;
}

#search form input[type="text"] {
    width: 100%;
}

#search form button[type="submit"] {
    height: 1.5 * $base-line-height;
    width: 1.5 * $base-line-height;
    text-indent: -9999px;
    position: relative;
    border-radius: 0 3px 3px 0;

    &:before {
        content: "\f002";
        font-family: "FontAwesome";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        text-align: center;
        text-indent: 0;
        line-height: 1.5 * $base-line-height;
    }
}

/* @end */

/* @group ----- Footer ----- */

footer {
    @include container;
    padding: 0 gutter() $spacing-l;
}

/* @end */

/* @group ----- Page and Blocks ----- */

#content {
    @include container;
    padding: 0 gutter() $spacing-l;
}

.item-showcase {
    margin: $spacing-l 0;
    border-top: 1px solid $light;
    border-bottom: 1px solid $light;
    padding: ($spacing-l - 1px) 0 0;
    overflow: hidden;
    text-align: center;
    clear: both;
    display: flex;
    flex-wrap: wrap;
}

.item.resource .caption {
    font-size: .75 * $base-font-size;
    line-height: $base-line-height;

    * {
        margin: 0 0 $spacing-l 0;
    }

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

.item-showcase .resource.item {
    vertical-align: top;
    margin-bottom: $spacing-l;

    img {
        margin-right: $spacing-m;
    }

    &:only-child img {
        margin: 0 auto;
    }

    &:not(:only-child) {
        width: 25%;
        clear: none;
        padding: 0 gutter();
    }

    &:not(:only-child) h3 {
        clear: left;
        font-size: .75 * $base-font-size;
        line-height: $base-line-height;
        margin: $spacing-m 0 0;
    }

    &:not(:only-child) img {
        max-height: 7 * $spacing-l;
        width: auto;
        float: none;
        margin-right: 0;
        vertical-align: top;
    }
}

.right,
.left {
    overflow: hidden;
}

.left .item.resource,
.right .item.resource {
    margin: 0 0 $spacing-l 0;
    width: -webkit-min-content;
    width: -moz-min-content;
    width: min-content;
    max-width: 40vw;

    &:first-of-type {
        border-top: 1px solid $light;
        padding-top: ($spacing-l - 1px);
        margin-top: 0;
    }

    &:last-of-type {
        border-bottom: 1px solid $light;
        padding-bottom: ($spacing-l - 1px);
    }

    .media-render > *, img {
        max-width: 40vw;
    }
}

.left:not(.file) .item.resource,
.right:not(.file) .item.resource {
    max-width: 50%;
}

/* IE/Edge min-content alternative */
.file {
    display: -ms-grid;
    -ms-grid-columns: min-content;
}

.left.file,
.right.file {
    max-width: 50%;
}

.left.file {
    float: left;
    clear: left;
}

.right.file {
    float: right;
    clear: right;
}

.left .item.resource {
    float: left;
    margin-right: $spacing-l;
    clear: left;
}

.right .item.resource {
    float: right;
    margin-left: $spacing-l;
    clear: right;
}

.left .item.resource > a:first-child,
.right .item.resource > a:first-child {
    vertical-align: top;
}

.medium .item.resource > h3,
.square .item.resource > h3 {
    font-size: $base-font-size;
    line-height: $base-line-height;
}

.left .item.resource > h3,
.right .item.resource > h3 {
    margin: 0;
}

.left .item.resource + p,
.right .item.resource + p {
    margin-top: 0;
}

.break {
    width: 100%;
    clear: both;
    border-bottom: 1px solid $light;
    padding-bottom: -1px;
    margin: $spacing-l 0;

    &.transparent {
        border-color: transparent;
    }

    &.opaque {
        border-color: $light;
    }
}

.preview-block {
    margin: $spacing-l 0;
    overflow: hidden;
}

.resource-list.preview + a {
    background-color: $light;
    text-align: center;
    padding: $spacing-s;
    border-radius: 2px;
    line-height: $base-line-height;
    display: inline-block;
    font-weight: bold;

    &:hover {
        background-color: $bold;
        border-bottom-width: 0px;
        color: #fff;
    }
}

.toc-block > ul {
    margin: $spacing-l 0;
    list-style-type: none;
    border-left: 5px solid $gray;
}

.toc-block > ul > li {
    margin-bottom: $spacing-m;
}

.toc-block > ul > li > a {
    font-weight: bold;
}

.toc-block ul ul {
    list-style-type: none;
    padding-left: 0;
}

.toc-block ul ul ul {
    padding-left: 1.25em;
}

.toc-block ul ul li:before {
    content: "\2014";
    color: $light;
}

.item-with-metadata .show.resource {
    margin: (2 * $spacing-l) 0;
}

.site-page-pagination {
    margin-top: 2 * $spacing-l;
    clear: both;
}

/* @end */

/* @group ----- Resource List ----- */

ul.resource-list {
    list-style-type: none;
    padding-left: 0;
}

ul.resource-list .resource {
    border-bottom: 1px solid $light;
    padding-bottom: ($spacing-l - 1px);
    margin: $spacing-l 0;
    overflow: hidden;
    position: relative;

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

    &:first-child {
        border-top: 1px solid $light;
        padding-top: ($spacing-l - 1px);
    }
}

ul.resource-list .resource img {
    height: auto;
    width: 2 * $spacing-l;
    float: right;
    margin-left: $spacing-m;
}

ul.resource-list .resource h4 {
    margin-top: 0;
}

ul.resource-list .resource .description {
    max-height: 3 * $spacing-l;
    overflow: hidden;
    position: relative;

    &:after {
        content: "";
        position: absolute;
        top: 1.75 * $spacing-l;
        left: 0;
        right: 0;
        height: 1.25 * $spacing-l;
        background: linear-gradient(to top, rgba(248,248,248,1), rgba(248,248,248,0));
    }
}

ul.resource-list .resource img ~ * {
    width: calc(100% - #{2.5 * $spacing-l});
}

/* @end */

/* @group ----- Browse ---- */

.search-filters {
    margin-bottom: $spacing-l;
}

.filter-label,
.filter-value {
    display: inline-block;
    border: 1px solid $light;
    padding: ($spacing-s - 1px);
}

.filter-label {
    background-color: $light;
}

.filter-value {
    margin-left: -5px;
}

.advanced-search {
    float: right;
    margin: $spacing-s 0;
}

/* @end */

/* @group ----- Show ----- */

body.resource #content > h2:first-of-type + h3 {
    font-size: .75 * $base-font-size;
    text-transform: uppercase;
    margin: -$spacing-l 0 $spacing-l;
}

.property {
    margin-bottom: $spacing-l;
}

.property h4 {
    margin-bottom: 0;
    font-size: .75 * $base-font-size;
}

.property .value img {
    width: auto;
    height: 1.5 * $spacing-l;
    display: inline-block;
    vertical-align: middle;
    margin-right: $spacing-s;
}

.property .value a {
    display: inline-block;
    vertical-align: middle;
}

.property .value:not(:last-child) img {
    margin-bottom: $spacing-s;
}

.property .value:not(:last-child) img + a {
    margin-bottom: $spacing-s;
}

.property .value .language {
    background-color: lighten($gray, 15%);
    padding: .5 * $spacing-s;
    font-size: .5 * $base-font-size;
}

#content .media.resource {
    display: inline-block;
    text-align: center;
    vertical-align: bottom;
    margin-right: $spacing-s;

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

#content .media.resource img {
    vertical-align: top;
    margin-bottom: $spacing-m;
}

.media-render > * {
    max-width: 100%;
}

/* @end */

/* @group ----- Advanced Search ----- */

#advanced-search .value:not(:last-child) {
    margin-bottom: $spacing-m;
}

/* @end */

/* @group ----- Common Modules ---- */

a.metadata-browse-link {
    font-size: .75 * $base-font-size;
}

/* @end */