/*
    This file is part of m.css.

    Copyright © 2017, 2018, 2019, 2020 Vladimír Vondruš <mosra@centrum.cz>

    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the "Software"),
    to deal in the Software without restriction, including without limitation
    the rights to use, copy, modify, merge, publish, distribute, sublicense,
    and/or sell copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.
*/

/* Header navigation */
body > header > nav {
  width: 100%;
  background-color: var(--header-background-color);
  min-height: 3rem;
}
body > header > nav.m-navbar-landing,
body > header > nav.m-navbar-cover {
  background-color: transparent;
  position: relative;
}
body > header > nav.m-navbar-landing {
  opacity: 0.8;
}
body > header > nav.m-navbar-cover {
  background-color: var(--header-background-color-jumbo);
  opacity: 1;
}
body > header > nav.m-navbar-landing:hover,
body > header > nav.m-navbar-cover:hover {
  background-color: var(--header-background-color-landing);
  opacity: 1;
}
body> header > nav.m-navbar-landing:target,
body> header > nav.m-navbar-cover:target {
  background-color: var(--header-background-color);
  opacity: 1;
}
body > header > nav.m-navbar-landing #m-navbar-brand.m-navbar-brand-hidden {
  visibility: hidden;
}
body > header > nav.m-navbar-landing:target #m-navbar-brand.m-navbar-brand-hidden {
  visibility: visible;
}
body > header > nav {
  margin-left: auto;
  margin-right: auto;
  color: var(--header-color);
}
body > header > nav a {
  text-decoration: var(--link-decoration-nav);
  text-transform: var(--nav-menu-case);
  display: inline-block;
  line-height: 2.75rem;
  color: var(--header-link-color);
}
body > header > nav #m-navbar-brand, body > header > nav a#m-navbar-show, body > header > nav a#m-navbar-hide {
  font-weight: var(--heading-font-weight);
  font-size: 1.125rem;
  padding-left: 1rem;
  padding-right: 1rem;
}
body > header > nav a#m-navbar-brand, body > header > nav #m-navbar-brand a {
  text-transform: var(--nav-brand-case);
}
body > header > nav a#m-navbar-brand img, body > header > nav #m-navbar-brand a img {
  /* unfortunately, with SVGs, unless the size is hardcoded like this, it will
     cause ugly jumps during loading :( */
  width: 3rem;
  height: 1.75rem;
  vertical-align: -15%;
  margin-right: 0.5rem;
}
body > header > nav #m-navbar-brand a {
  padding-left: 0;
  padding-right: 0;
}
body > header > nav #m-navbar-brand .m-thin {
  font-weight: normal;
}
body > header > nav #m-navbar-brand .m-breadcrumb {
  color: var(--header-breadcrumb-color);
}
body > header > nav a#m-navbar-show:before, body > header > nav a#m-navbar-hide:before {
  content: '\2630';
}
body > header > nav #m-navbar-collapse {
  padding-bottom: 1rem;
}
body > header > nav #m-navbar-collapse li {
  border-style: solid;
  border-color: transparent;
  border-width: 0 0 0 0.25rem;
  margin-left: -1rem;
}
body > header > nav #m-navbar-collapse li a {
  border-style: solid;
  border-color: transparent;
  line-height: 1.5rem;
  margin-left: -0.25rem;
  padding-left: 0.75rem;
  border-width: 0 0 0 0.25rem;
  width: 100%;
}
body > header > nav #m-navbar-collapse li a#m-navbar-current {
  color: var(--header-link-current-color);
  border-color: var(--header-link-current-color);
  background-color: var(--header-link-current-backgroud-color);
}
body > header > nav ol {
  list-style-type: none;
  margin: 0;
}
body > header > nav ol ol {
  padding-left: 1.5rem;
}
body > header > nav .m-row > [class*='m-col-'] {
  padding-top: 0;
  padding-bottom: 0;
}
body > header > nav a:hover, body > header > nav a:focus, body > header > nav a:active {
  color: var(--header-link-active-color);
}
body > header > nav #m-navbar-collapse li:hover {
  border-color: var(--header-link-active-color);
}
body > header > nav #m-navbar-collapse li a:hover,
body > header > nav #m-navbar-collapse li a:focus,
body > header > nav #m-navbar-collapse li a:active {
  border-color: var(--header-link-active-color);
  background-color: var(--header-link-active-background-color);
}
body > header > nav.m-navbar-landing #m-navbar-collapse li a:hover,
body > header > nav.m-navbar-cover #m-navbar-collapse li a:hover,
body > header > nav.m-navbar-landing #m-navbar-collapse li a:focus,
body > header > nav.m-navbar-cover #m-navbar-collapse li a:focus,
body > header > nav.m-navbar-landing #m-navbar-collapse li a:active,
body > header > nav.m-navbar-cover #m-navbar-collapse li a:active {
  background-color: var(--header-link-active-background-color-semi);
}

/* Header navigation -- collapsible part */
body > header > nav #m-navbar-hide {
  display: none;
}
body > header > nav:target #m-navbar-collapse {
  display: block;
}
body > header > nav:target #m-navbar-show {
  display: none;
}
body > header > nav:target #m-navbar-hide {
  display: inline-block;
}

/* Header navigation -- 768px and up (tablets, desktops) */
@media screen and (min-width: 768px) {
  body > header > nav #m-navbar-show, body > header > nav #m-navbar-hide,
  body > header > nav:target #m-navbar-show, body > header > nav:target #m-navbar-hide {
    display: none;
  }
  body > header > nav #m-navbar-collapse li a {
    line-height: 2.5rem;
  }
  body > header > nav a, body > header > nav #m-navbar-collapse li a {
    margin-left: 0;
    padding-left: 1rem;
    padding-right: 1rem;
    white-space: nowrap;
  }
  body > header > nav #m-navbar-collapse {
    padding-bottom: 0;
  }
  body > header > nav #m-navbar-collapse li ol {
    background-color: var(--header-background-color);
  }
  body > header > nav #m-navbar-collapse ol ol li {
    margin-left: 0;
    padding-left: 0;
    border-left-width: 0;
  }
  body > header > nav #m-navbar-collapse ol ol li a {
    padding-left: 0.75rem;
  }
  body > header > nav #m-navbar-collapse > .m-row > ol > li {
    margin-left: 0;
    border-left-width: 0;
  }
  body > header > nav #m-navbar-collapse > .m-row > ol > li > a {
    border-width: var(--header-border-width);
  }
  body > header > nav #m-navbar-collapse ol {
    padding-left: 0;
    padding-right: 0;
  }
  body > header > nav #m-navbar-collapse > .m-row > ol, body > header > nav #m-navbar-collapse > .m-row > ol > li {
    float: left;
  }
  body > header > nav #m-navbar-collapse ol ol {
    z-index: 99999;
    position: absolute;
    visibility: hidden;
  }
  body > header > nav #m-navbar-collapse li:hover ol {
    visibility: visible;
  }
}

/* Footer navigation */
body > footer {
  width: 100%;
}
body > footer > nav {
  padding-top: 1rem;
  padding-bottom: 1rem;
  font-size: var(--footer-font-size);
  text-align: center;
  color: var(--footer-color);
  background-color: var(--footer-background-color);
}
body > footer > nav h3, body > footer > nav h3 a {
  text-transform: var(--nav-heading-case);
  font-weight: normal;
}
body > footer > nav ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}
body > footer > nav a {
  text-decoration: underline;
  font-weight: bold;
  color: var(--footer-link-color);
}
body > footer > nav a:hover, body > footer > nav a:focus, body > footer > nav a:active {
  color: var(--footer-link-active-color);
}
/* Move the footer to the bottom of the window if the content is short */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > footer {
  width: 100%;
  margin-top: auto;
}

/* Main content */
body > main {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

/* Page heading (not in <header>), breadcrumb navigation on pages */
article h1 {
  color: var(--article-heading-color);
  font-size: 1.75rem;
}
article h1 .m-breadcrumb {
  color: var(--muted-color);
  font-weight: normal;
}
article h1 .m-breadcrumb a {
  color: var(--header-breadcrumb-link-color);
}
article h1 .m-breadcrumb a:hover, article h1 a:focus, article h1 a:active {
  color: var(--link-active-color);
}

/* Article elements */
article > header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
article h1 a, article > header h1, article > header h1 a {
  color: var(--link-color);
}
article h1 a:hover, article > header h1 a:hover, article > header h1 a:focus, article > header h1 a:active {
  color: var(--link-active-color);
}
article > header p {
  color: var(--article-header-color);
  font-size: 1.125rem;
}
article > header h1::after {
  content: " ";
  clear: both;
  display: table;
}
article > footer {
  color: var(--article-footer-color);
}
article > footer p {
  font-style: italic;
  font-size: 0.85rem;
  text-indent: 0;
}

/* Article -- dynamic section headers */
article section:target {
  margin-left: -1.0rem;
  border-left-style: solid;
  border-left-width: 0.25rem;
  padding-left: 0.75rem;
  border-color: var(--article-heading-color);
}
article h1 a, article > header h1 a, article section > h2 a, article section > h3 a,
article section > h4 a, article section > h5 a, article section > h6 a {
  text-decoration: var(--link-decoration-heading);
}

/* Spacing after every block element, but not after the last */
article, article > header, article section { margin-bottom: 1rem; }
article:last-child, article section:last-child { margin-bottom: 0; }

/* Active sections in inflatable content affect left border of some components
   --- restrict to components directly in active section, its subsections and
   floating / inflatable content inside. */
.m-container-inflatable section:target > .m-note,
.m-container-inflatable section:target > .m-frame,
.m-container-inflatable section:target > .m-block,
.m-container-inflatable section:target > pre,
.m-container-inflatable section:target section > .m-note,
.m-container-inflatable section:target section > .m-frame,
.m-container-inflatable section:target section > .m-block,
.m-container-inflatable section:target section > pre,
.m-container-inflatable section:target [class*='m-center-'] > .m-note,
.m-container-inflatable section:target [class*='m-center-'] > .m-frame,
.m-container-inflatable section:target [class*='m-center-'] > .m-block,
.m-container-inflatable section:target [class*='m-center-'] > pre,
.m-container-inflatable section:target [class*='m-left-'] > .m-note,
.m-container-inflatable section:target [class*='m-left-'] > .m-frame,
.m-container-inflatable section:target [class*='m-left-'] > .m-block,
.m-container-inflatable section:target [class*='m-left-'] > pre,
.m-container-inflatable section:target [class*='m-right-'] > .m-note,
.m-container-inflatable section:target [class*='m-right-'] > .m-frame,
.m-container-inflatable section:target [class*='m-right-'] > .m-block,
.m-container-inflatable section:target [class*='m-right-'] > pre,
.m-container-inflatable section:target .m-container-inflate > .m-note,
.m-container-inflatable section:target .m-container-inflate > .m-frame,
.m-container-inflatable section:target .m-container-inflate > .m-block,
.m-container-inflatable section:target .m-container-inflate > pre {
  margin-left: -1.0rem;
  border-left-style: solid;
  border-left-width: 0.25rem;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding-left: 0.75rem;
}
/* Center/left/right are tied to particular breakpoint so we need to
   conditionally revert that. Left-aligned content is touching the left border
   both in full size and aligned, so we revert it only for center and right. */
@media screen and (min-width: 576px) {
  .m-container-inflatable section:target .m-center-s > .m-note,
  .m-container-inflatable section:target .m-center-s > pre {
    /* Centers have -1rem margin on both sides *always* and pre inside figures
       as well, don't revert that */
    border-left-width: 0;
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
    padding-left: 1rem;
  }
  .m-container-inflatable section:target .m-center-s > .m-block,
  .m-container-inflatable section:target .m-right-s > .m-block {
    /* Block keep the same left border width at all times */
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
  }
  .m-container-inflatable section:target .m-center-s > .m-frame,
  .m-container-inflatable section:target .m-right-s > .m-frame {
    /* Frame has a thinner border */
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
    border-left-width: 0.125rem;
    padding-left: 0.875rem;
  }
  .m-container-inflatable section:target .m-right-s > .m-block,
  .m-container-inflatable section:target .m-right-s > .m-frame {
    margin-left: 0;
  }
  .m-container-inflatable section:target .m-right-s > .m-note,
  .m-container-inflatable section:target .m-right-s > pre {
    /* Note and pre has no border */
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
    margin-left: 0;
    border-left-width: 0;
    padding-left: 1rem;
  }
}
@media screen and (min-width: 768px) {
  .m-container-inflatable section:target .m-center-m > .m-note,
  .m-container-inflatable section:target .m-center-m > pre {
    /* Centers have -1rem margin on both sides *always* and pre inside figures
       as well, don't revert that */
    border-left-width: 0;
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
    padding-left: 1rem;
  }
  .m-container-inflatable section:target .m-center-m > .m-block,
  .m-container-inflatable section:target .m-right-m > .m-block {
    /* Block keep the same left border width at all times */
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
  }
  .m-container-inflatable section:target .m-center-m > .m-frame,
  .m-container-inflatable section:target .m-right-m > .m-frame {
    /* Frame has a thinner border */
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
    border-left-width: 0.125rem;
    padding-left: 0.875rem;
  }
  .m-container-inflatable section:target .m-right-m > .m-block,
  .m-container-inflatable section:target .m-right-m > .m-frame {
    margin-left: 0;
  }
  .m-container-inflatable section:target .m-right-m > .m-note,
  .m-container-inflatable section:target .m-right-m > pre {
    /* Note and pre has no border */
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
    margin-left: 0;
    border-left-width: 0;
    padding-left: 1rem;
  }
}
@media screen and (min-width: 992px) {
  .m-container-inflatable section:target .m-center-l > .m-note,
  .m-container-inflatable section:target .m-center-l > pre {
    /* Centers have -1rem margin on both sides *always* and pre inside figures
       as well, don't revert that */
    border-left-width: 0;
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
    padding-left: 1rem;
  }
  .m-container-inflatable section:target .m-center-l > .m-block,
  .m-container-inflatable section:target .m-right-l > .m-block {
    /* Block keep the same left border width at all times */
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
  }
  .m-container-inflatable section:target .m-center-l > .m-frame,
  .m-container-inflatable section:target .m-right-l > .m-frame {
    /* Frame has a thinner border */
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
    border-left-width: 0.125rem;
    padding-left: 0.875rem;
  }
  .m-container-inflatable section:target .m-right-l > .m-block,
  .m-container-inflatable section:target .m-right-l > .m-frame {
    margin-left: 0;
  }
  .m-container-inflatable section:target .m-right-l > .m-note,
  .m-container-inflatable section:target .m-right-l > pre {
    /* Note and pre has no border */
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
    margin-left: 0;
    border-left-width: 0;
    padding-left: 1rem;
  }
}

/* These don't have any border otherwise, so we don't need to restrict the
   selectors or border sides like above. */
.m-container-inflatable section:target pre {
  border-color: var(--line-color);
}
.m-container-inflatable section:target .m-note.m-default {
  border-color: var(--line-color);
}
.m-container-inflatable section:target .m-note.m-primary  {
  border-color: var(--primary-color);
}
.m-container-inflatable section:target .m-note.m-success {
  border-color: var(--success-color);
}
.m-container-inflatable section:target .m-note.m-warning {
  border-color: var(--warning-color);
}
.m-container-inflatable section:target .m-note.m-danger {
  border-color: var(--danger-color);
}
.m-container-inflatable section:target .m-note.m-info {
  border-color: var(--info-color);
}
.m-container-inflatable section:target .m-note.m-dim {
  border-color: var(--dim-color);
}
